Java 类android.text.method.LinkMovementMethod 实例源码

项目:smart-asset-iot-android-demo    文件:AboutActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.NoActionBar);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    ButterKnife.bind(this);

    toolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.white));
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_return);
    toolbar.setNavigationOnClickListener(v -> onBackPressed());
    title.setMovementMethod(LinkMovementMethod.getInstance());
}
项目:LibVNCAndroid    文件:ActivityTabs.java   
/**
 * @brief Shows the dialog to indicate about info
 * @return The new dialog
 * @details Shows the dialog to indicate about info
 */
private Dialog createAboutDialog()
 {
    //necesario para poder clicar en los links
    final TextView message = new TextView(this);
    final SpannableString s = 
               new SpannableString(this.getText(R.string.about_message));
  Linkify.addLinks(s, Linkify.WEB_URLS);
  message.setText(s);
  message.setMovementMethod(LinkMovementMethod.getInstance());

  return new AlertDialog.Builder(this)
  .setTitle(R.string.about_title)
  .setView(message)
  .setPositiveButton(R.string.about_ok,
   new DialogInterface.OnClickListener() {

    @Override
    public void onClick(DialogInterface dialog, int which) {
     // Auto-generated method stub

    }
   }
    )
  .show();
 }
项目:SERC-ENERYGY-METERING-MOBILE-APP    文件:AboutActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);


    // about_page_textview has links specified by putting <a> tags in the string
    // resource.  By default these links will appear but not
    // respond to user input.  To make them active, you need to
    // call setMovementMethod() on the TextView object.
    TextView aboutPageText = (TextView) findViewById(R.id.about_page_textview);
    aboutPageText.setMovementMethod(LinkMovementMethod.getInstance());

    // This makes the image clickable
    ImageView img = (ImageView)findViewById(R.id.about_page_image);
    img.setOnClickListener(new View.OnClickListener(){
        public void onClick(View v){
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_VIEW);
            intent.addCategory(Intent.CATEGORY_BROWSABLE);
            intent.setData(Uri.parse("http://serc.strathmore.edu/"));
            startActivity(intent);
        }
    });
}
项目:GitHub    文件:BookContentTextView.java   
public void setText(String text) {
    int startIndex = 0;
    while (true) {

        int start = text.indexOf("《");
        int end = text.indexOf("》");
        if (start < 0 || end < 0) {
            append(text.substring(startIndex));
            break;
        }

        append(text.substring(startIndex, start));

        SpannableString spanableInfo = new SpannableString(text.substring(start, end + 1));
        spanableInfo.setSpan(new Clickable(spanableInfo.toString()), 0, end + 1 - start, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        append(spanableInfo);
        //setMovementMethod()该方法必须调用,否则点击事件不响应
        setMovementMethod(LinkMovementMethod.getInstance());
        text = text.substring(end + 1);

        LogUtils.e(spanableInfo.toString());
    }
}
项目:GitHub    文件:MessageDialog.java   
@SuppressLint("InflateParams")
@Override
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
    View dialogView = LayoutInflater.from(getActivity())
            .inflate(R.layout.dialog_message, null);

    TextView messageView = (TextView) dialogView.findViewById(R.id.message);
    messageView.setMovementMethod(LinkMovementMethod.getInstance());
    messageView.setText(Html.fromHtml(getArguments().getString(ARG_MESSAGE)));

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppTheme_AlertDialog);
    builder.setTitle(getArguments().getString(ARG_TITLE))
            .setIcon(getArguments().getInt(ARG_ICON))
            .setView(dialogView)
            .setPositiveButton(R.string.OK, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });

    return builder.create();
}
项目:GitHub    文件:NestAdapter.java   
@Override
protected void convert(BaseViewHolder helper, Status item) {
    helper.addOnClickListener(R.id.tweetText);
    switch (helper.getLayoutPosition()%
            3){
        case 0:
            helper.setImageResource(R.id.img,R.mipmap.animation_img1);
            break;
        case 1:
            helper.setImageResource(R.id.img,R.mipmap.animation_img2);
            break;
        case 2:
            helper.setImageResource(R.id.img,R.mipmap.animation_img3);
            break;
    }
    helper.setText(R.id.tweetName,"Hoteis in Rio de Janeiro");
    String msg="\"He was one of Australia's most of distinguished artistes, renowned for his portraits\"";
    ( (TextView)helper.getView(R.id.tweetText)).setText(SpannableStringUtils.getBuilder(msg).append("landscapes and nedes").setClickSpan(clickableSpan).create());
    ( (TextView)helper.getView(R.id.tweetText)).setMovementMethod(LinkMovementMethod.getInstance());
}
项目:anitrend-app    文件:BottomSheetMessage.java   
@Override
public void onStart() {
    super.onStart();
    mState.setOnClickListener(this);

    if(negative == 0)
        mNegative.setVisibility(View.GONE);
    else {
        mNegative.setOnClickListener(this);
        mNegative.setText(negative);
    }

    if(positive == 0)
        mPositive.setVisibility(View.GONE);
    else {
        mPositive.setOnClickListener(this);
        mPositive.setText(positive);
    }

    mTitle.setText(title);
    mText.setMovementMethod(LinkMovementMethod.getInstance());
    mText.setText(Html.fromHtml(getString(text)));
    if(bottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED)
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
项目:chromium-for-android-56-debug-video    文件:SadTabViewFactory.java   
/**
 * @param context Context of the resulting Sad Tab view.
 * @param suggestionAction Action to be executed when user clicks "try these suggestions".
 * @param reloadButtonAction Action to be executed when Reload button is pressed.
 *                           (e.g., refreshing the page)
 * @return A "Sad Tab" view instance which is used in place of a crashed renderer.
 */
public static View createSadTabView(
        Context context, final OnClickListener suggestionAction,
        OnClickListener reloadButtonAction) {
    // Inflate Sad tab and initialize.
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(
            Context.LAYOUT_INFLATER_SERVICE);
    View sadTabView = inflater.inflate(R.layout.sad_tab, null);

    TextView messageText = (TextView) sadTabView.findViewById(R.id.sad_tab_message);
    messageText.setText(getHelpMessage(context, suggestionAction));
    messageText.setMovementMethod(LinkMovementMethod.getInstance());

    Button reloadButton = (Button) sadTabView.findViewById(R.id.sad_tab_reload_button);
    reloadButton.setOnClickListener(reloadButtonAction);

    return sadTabView;
}
项目:ultrasonic    文件:ShareActivity.java   
private void displayShareInfo(final Share share)
{
    final TextView textView = new TextView(this);
    textView.setPadding(5, 5, 5, 5);

    final Spannable message = new SpannableString("Owner: " + share.getUsername() +
            "\nComments: " + ((share.getDescription() == null) ? "" : share.getDescription()) +
            "\nURL: " + share.getUrl() +
            "\nEntry Count: " + share.getEntries().size() +
            "\nVisit Count: " + share.getVisitCount() +
            ((share.getCreated() == null) ? "" : ("\nCreation Date: " + share.getCreated().replace('T', ' '))) +
            ((share.getLastVisited() == null) ? "" : ("\nLast Visited Date: " + share.getLastVisited().replace('T', ' '))) +
            ((share.getExpires() == null) ? "" : ("\nExpiration Date: " + share.getExpires().replace('T', ' '))));

    Linkify.addLinks(message, Linkify.WEB_URLS);
    textView.setText(message);
    textView.setMovementMethod(LinkMovementMethod.getInstance());

    new AlertDialog.Builder(this).setTitle("Share Details").setCancelable(true).setIcon(android.R.drawable.ic_dialog_info).setView(textView).show();
}
项目:IntroApp    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    findViewById(R.id.btn_play_again).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            PrefManager prefManager = new PrefManager(getApplicationContext());

            prefManager.setFirstTimeLaunch(true);

            startActivity(new Intent(MainActivity.this, WelcomeActivity.class));
            finish();
        }
    });

    TextView textView =(TextView)findViewById(R.id.textView);
    textView.setClickable(true);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    String text = "<a href='https://github.com/Kvaibhav01/IntroApp'> Star or Fork this project on GitHub </a>";
    textView.setText(Html.fromHtml(text));
}
项目:Password-Storage    文件:AboutUsActivity.java   
private void onClickURL(){
    MovementMethod contributors_descMovementMethod = contributors_desc.getMovementMethod();
    if ((contributors_descMovementMethod == null) || !(contributors_descMovementMethod instanceof LinkMovementMethod)) {
        if (contributors_desc.getLinksClickable()) {
            contributors_desc.setMovementMethod(LinkMovementMethod.getInstance());
        }
    }
    MovementMethod app_report_issues_descMovementMethod = app_report_issues_desc.getMovementMethod();
    if ((app_report_issues_descMovementMethod == null) || !(app_report_issues_descMovementMethod instanceof LinkMovementMethod)) {
        if (app_report_issues_desc.getLinksClickable()) {
            app_report_issues_desc.setMovementMethod(LinkMovementMethod.getInstance());
        }
    }
    MovementMethod app_license_info_descMovementMethod = app_license_info_desc.getMovementMethod();
    if ((app_license_info_descMovementMethod == null) || !(app_license_info_descMovementMethod instanceof LinkMovementMethod)) {
        if (app_license_info_desc.getLinksClickable()) {
            app_license_info_desc.setMovementMethod(LinkMovementMethod.getInstance());
        }
    }
}
项目:Phoenix-for-VK    文件:VideoPreviewFragment.java   
@Override
public void displayVideoInfo(Video video) {
    if(nonNull(mRootView)){
        mRootView.findViewById(R.id.content).setVisibility(View.VISIBLE);
        mRootView.findViewById(R.id.loading_root).setVisibility(View.GONE);
    }

    safelySetText(mTitleText, video.getTitle());

    if(nonNull(mSubtitleText)){
        Spannable subtitle = OwnerLinkSpanFactory.withSpans(video.getDescription(), true, false, ownerLinkAdapter);

        mSubtitleText.setText(subtitle, TextView.BufferType.SPANNABLE);
        mSubtitleText.setMovementMethod(LinkMovementMethod.getInstance());
    }

    String imageUrl = video.getMaxResolutionPhoto();

    if (nonEmpty(imageUrl) && nonNull(mPreviewImage)) {
        PicassoInstance.with()
                .load(imageUrl)
                .into(mPreviewImage);
    }
}
项目:dynamic-toasts    文件:AboutDialogFragment.java   
@Override
protected @NonNull DynamicDialog onCustomiseDialog(@NonNull DynamicDialog alertDialog,
                                                   @Nullable Bundle savedInstanceState) {
    View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_about,
            new LinearLayout(getContext()), false);
    TextView message = view.findViewById(R.id.dialog_about_text);

    message.setText(Html.fromHtml(getString(R.string.about_content)
            .replace("\n", "<br/>")));
    message.setTextSize(TypedValue.COMPLEX_UNIT_SP, TEXT_SIZE);
    message.setLineSpacing(0f, 1.2f);
    message.setMovementMethod(LinkMovementMethod.getInstance());
    message.setLinkTextColor(ContextCompat.getColor(getContext(), R.color.colorPrimary));

    alertDialog.setView(view);
    return alertDialog;
}
项目:Sprog-App    文件:PoemActivity.java   
public void displayPost(CharSequence title, CharSequence author, CharSequence content,
                        String link) {
    View v = LayoutInflater.from(this).inflate(R.layout.post_row, mainlist, false);
    ((TextView) v.findViewById(R.id.title))
            .setText(title);
    ((TextView) v.findViewById(R.id.author)).setText(author);
    if (content != null || link != null) {
        ((TextView) v.findViewById(R.id.content))
                .setMovementMethod(LinkMovementMethod.getInstance());
        v.findViewById(R.id.content).setVisibility(View.VISIBLE);
        if (content != null) {
            ((TextView) v.findViewById(R.id.content)).setText(content);
        } else if (link != null) {
            ((TextView) v.findViewById(R.id.content))
                    .setText(Util.linkToSpan(link));
        }
    }
    mainlist.addView(v);
}
项目:FlickLauncher    文件:Utilities.java   
public static void upgradeToPROAlertDialog(Context context)
{
    AlertDialog builder =
            new AlertDialog.Builder(context, R.style.AlertDialogCustom).setTitle(context.getResources().getString(R.string.app_name))
                    .setCancelable(false)
                    .setIcon(R.mipmap.ic_launcher_home)
                    .setMessage(R.string.license_dialog_message_pro)
                    .setPositiveButton(context.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            dialog.dismiss();
                        }
                    }).create();
    builder.show();
    ((TextView)builder.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
    ((TextView)builder.findViewById(android.R.id.message)).setGravity(Gravity.CENTER_VERTICAL);
    builder.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
}
项目:PeSanKita-android    文件:VerifyIdentityActivity.java   
private void setFingerprintViews(Fingerprint fingerprint) {
  String digits   = fingerprint.getDisplayableFingerprint().getDisplayText();
  int    partSize = digits.length() / codes.length;

  for (int i=0;i<codes.length;i++) {
    codes[i].setText(digits.substring(i * partSize, (i * partSize) + partSize));
  }

  byte[] qrCodeData   = fingerprint.getScannableFingerprint().getSerialized();
  String qrCodeString = new String(qrCodeData, Charset.forName("ISO-8859-1"));
  Bitmap qrCodeBitmap = QrCode.create(qrCodeString);

  qrCode.setImageBitmap(qrCodeBitmap);
  description.setText(Html.fromHtml(String.format(getActivity().getString(R.string.verify_display_fragment__if_you_wish_to_verify_the_security_of_your_end_to_end_encryption_with_s), recipient.toShortString())));
  description.setMovementMethod(LinkMovementMethod.getInstance());
}
项目:JavaIsFun    文件:AboutTheApp.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about_the_app);
    setTitle("Sobre o aplicativo");
    TextView link = (TextView) findViewById(R.id.linkGithub);
    String linkText = "<a href='https://github.com/jvbeltra/JavaIsFun'>Repositório Github</a>";
    link.setText(Html.fromHtml(linkText));
    link.setMovementMethod(LinkMovementMethod.getInstance());
    TextView link2 = (TextView) findViewById(R.id.linkSiteIF);
    String linkText2 = "<a href='http://ibirama.ifc.edu.br/'>IFC - Ibirama</a>";
    link2.setText(Html.fromHtml(linkText2));
    link2.setMovementMethod(LinkMovementMethod.getInstance());


}
项目:anitrend-app    文件:CommentAdapter.java   
ViewHolder(View view) {
    super(view);
    mLikesViewer = view.findViewById(R.id.likes_viewer);
    mPostContainer = view.findViewById(R.id.post_extra_holder);
    mFlipper = (ViewFlipper) view.findViewById(R.id.mFlipper);
    mAvatar = (ImageView) view.findViewById(R.id.post_avatar);
    mPostExtra = (ImageView) view.findViewById(R.id.post_extra_img);
    mTime = (TextView) view.findViewById(R.id.post_time);
    mUsername = (TextView) view.findViewById(R.id.post_user_name);
    mContent = (TextView) view.findViewById(R.id.post_text);
    mLike = (TextView) view.findViewById(R.id.post_like);
    mReply = (TextView) view.findViewById(R.id.post_reply);
    mEdit = (TextView) view.findViewById(R.id.post_edit);
    mDelete = (TextView) view.findViewById(R.id.post_delete);
    mGallery = (TextView) view.findViewById(R.id.post_extra_img_gallery) ;
    mContent.setMovementMethod(LinkMovementMethod.getInstance());
    mContent.setFocusable(false);
    mLikesViewer.setOnClickListener(this);
    mFlipper.setOnClickListener(this);
    mReply.setOnClickListener(this);
    mEdit.setOnClickListener(this);
    mDelete.setOnClickListener(this);
    mAvatar.setOnClickListener(this);
    mPostExtra.setOnClickListener(this);
    mGallery.setOnClickListener(this);
}
项目:Ghost-Android    文件:AppUtils.java   
public static void setHtmlWithLinkClickHandler(TextView tv, String html,
                                        Action1<String> linkClickHandler) {
    CharSequence sequence = Html.fromHtml(html);
    SpannableStringBuilder strBuilder = new SpannableStringBuilder(sequence);
    URLSpan[] urls = strBuilder.getSpans(0, sequence.length(), URLSpan.class);
    for (URLSpan span : urls) {
        int start = strBuilder.getSpanStart(span);
        int end = strBuilder.getSpanEnd(span);
        int flags = strBuilder.getSpanFlags(span);
        ClickableSpan clickable = new ClickableSpan() {
            public void onClick(View view) {
                linkClickHandler.call(span.getURL());
            }
        };
        strBuilder.setSpan(clickable, start, end, flags);
        strBuilder.removeSpan(span);
    }
    tv.setText(strBuilder);
    tv.setMovementMethod(LinkMovementMethod.getInstance());
}
项目:homebank_android    文件:AboutActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);


    TextView t2 = (TextView) findViewById(R.id.hb);
    t2.setMovementMethod(LinkMovementMethod.getInstance());

    TextView t1 = (TextView) findViewById(R.id.help);
    t1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("market://details?id=" + getApplicationContext().getPackageName()));
            startActivity(intent);
        }
    });
    t1.setMovementMethod(LinkMovementMethod.getInstance());
}
项目:MiPushFramework    文件:CheckDozeActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (PushServiceAccessibility.isInDozeWhiteList(this)) {
        nextPage();
        finish();
        return;
    }
    SetupWizardLayout layout = new SetupWizardLayout(this);
    layout.getNavigationBar()
            .setNavigationBarListener(this);
    TextView textView = new TextView(this);
    textView.setText(Html.fromHtml(getString(R.string.wizard_descr_doze_whitelist)));
    int padding = (int) getResources().getDimension(R.dimen.suw_glif_margin_sides);
    textView.setPadding(padding, padding, padding, padding);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    layout.addView(textView);
    layout.setHeaderText(R.string.wizard_title_doze_whitelist);
    setContentView(layout);
}
项目:MiPushFramework    文件:FinishWizardActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    WizardSPUtils.setShouldShowWizard(false, this);
    SetupWizardLayout layout = new SetupWizardLayout(this);
    layout.getNavigationBar()
            .setNavigationBarListener(this);
    layout.getNavigationBar().getBackButton().setVisibility(View.GONE);
    TextView textView = new TextView(this);
    textView.setText(Html.fromHtml(getString(R.string.wizard_descr_finish)));
    int padding = (int) getResources().getDimension(R.dimen.suw_glif_margin_sides);
    textView.setPadding(padding, padding, padding, padding);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    layout.addView(textView);
    layout.setHeaderText(R.string.app_name);
    setContentView(layout);
}
项目:MiPushFramework    文件:WelcomeActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (!WizardSPUtils.shouldShowWizard(this)) {
        startActivity (new Intent(this,
                MainActivity.class));
        finish();
        return;
    }
    SetupWizardLayout layout = new SetupWizardLayout(this);
    layout.getNavigationBar()
            .setNavigationBarListener(this);
    TextView textView = new TextView(this);
    textView.setText(Html.fromHtml(getString(R.string.wizard_descr)));
    int padding = (int) getResources().getDimension(R.dimen.suw_glif_margin_sides);
    textView.setPadding(padding, padding, padding, padding);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    layout.addView(textView);
    layout.setHeaderText(R.string.app_name);
    setContentView(layout);
}
项目:decoy    文件:ChatRoomMsgViewHolderBaseText.java   
@Override
protected void bindContentView() {
    layoutDirection();

    TextView bodyTextView = findViewById(R.id.nim_message_item_text_body);
    bodyTextView.setTextColor(isReceivedMessage() ? Color.BLACK : Color.WHITE);
    bodyTextView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onItemClick();
        }
    });
    MoonUtil.identifyFaceExpression(NimUIKit.getContext(), bodyTextView, getDisplayText(), ImageSpan.ALIGN_BOTTOM);
    bodyTextView.setMovementMethod(LinkMovementMethod.getInstance());
    bodyTextView.setOnLongClickListener(longClickListener);
}
项目:OSchina_resources_android    文件:TweetQueueAdapter.java   
@SuppressWarnings("unused")
public void bind(int position, TweetPublishModel model, RequestManager loader) {
    itemView.setTag(model);

    Context context = itemView.getContext();

    Spannable spannable = TweetParser.getInstance().parse(context, model.getContent());
    mTitle.setText(spannable);
    mTitle.setMovementMethod(LinkMovementMethod.getInstance());
    mTitle.setFocusable(false);
    mTitle.setDispatchToParent(true);
    mTitle.setLongClickable(false);

    mLog.setText(String.format("Error:%s.",
            model.getErrorString() == null ? "null" : model.getErrorString()));
    mDate.setText(FORMAT.format(new Date(model.getDate())));
}
项目:puremadrid    文件:InfoFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    // Set the text view as the activity layout
    View view = inflater.inflate(R.layout.fragment_info, container, false);
    this.view = view;

    //Set actions for buttons
    Button button_calaire = view.findViewById(R.id.link_calaire);
    Button button_rateus = view.findViewById(R.id.link_google_play);
    Button button_facebook = view.findViewById(R.id.link_facebook);

    button_calaire.setOnClickListener(this);
    button_rateus.setOnClickListener(this);
    button_facebook.setOnClickListener(this);

    TextView textAppDdisenada = view.findViewById(R.id.text_app_disenada);
    textAppDdisenada.setMovementMethod(LinkMovementMethod.getInstance());

    return view;
}
项目:iosched-reader    文件:AboutUtils.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    int padding = getResources().getDimensionPixelSize(R.dimen.content_padding_dialog);

    TextView eulaTextView = new TextView(getActivity());
    eulaTextView.setText(Html.fromHtml(getString(R.string.eula_legal_text)));
    eulaTextView.setMovementMethod(LinkMovementMethod.getInstance());
    eulaTextView.setPadding(padding, padding, padding, padding);

    return new AlertDialog.Builder(getActivity())
            .setTitle(R.string.about_eula)
            .setView(eulaTextView)
            .setPositiveButton(R.string.ok,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            dialog.dismiss();
                        }
                    }
            )
            .create();
}
项目:Cable-Android    文件:WebRtcCallScreen.java   
public void setUntrustedIdentity(Recipient personInfo, IdentityKey untrustedIdentity) {
  String          name            = recipient.toShortString();
  String          introduction    = String.format(getContext().getString(R.string.WebRtcCallScreen_new_safety_numbers), name, name);
  SpannableString spannableString = new SpannableString(introduction + " " + getContext().getString(R.string.WebRtcCallScreen_you_may_wish_to_verify_this_contact));

  spannableString.setSpan(new VerifySpan(getContext(), personInfo.getRecipientId(), untrustedIdentity),
                          introduction.length()+1, spannableString.length(),
                          Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

  setPersonInfo(personInfo);

  this.incomingCallOverlay.setActiveCall();
  this.status.setText(R.string.WebRtcCallScreen_new_safety_number_title);
  this.untrustedIdentityContainer.setVisibility(View.VISIBLE);
  this.untrustedIdentityExplanation.setText(spannableString);
  this.untrustedIdentityExplanation.setMovementMethod(LinkMovementMethod.getInstance());

  this.endCallButton.setVisibility(View.INVISIBLE);
}
项目:AndroidIRCLogViewer    文件:MainActivity.java   
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mTextMessage = (TextView) findViewById(R.id.message);
    mTextMessage.setLinksClickable(true);
    mTextMessage.setMovementMethod(LinkMovementMethod.getInstance());
    BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);

    final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    baseUrl = preferences.getString("base_url", null);
    nickname = preferences.getString("nickname", null);

    loadLog();
}
项目:Show_Chat    文件:AboutActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    ButterKnife.bind(this);
    setupToolbar();

    MovementMethod movementMethod = LinkMovementMethod.getInstance();

    versionTextView.setText(getVersionName());
    appInfoTextView.setText(StringUtils.fromHtml(getString(R.string.about_app_info)));
    appInfoTextView.setMovementMethod(movementMethod);
    librariesTextView.setText(StringUtils.fromHtml(getString(R.string.about_libraries_text)));
    librariesTextView.setMovementMethod(movementMethod);
    licenseTextView.setText(StringUtils.fromHtml(getString(R.string.about_license_text)));
    licenseTextView.setMovementMethod(movementMethod);
}
项目:javaide    文件:FormatTextView.java   
@Override
public void setText(CharSequence text, BufferType type) {
    Spanned html = Html.fromHtml(text.toString());
    ClickableSpan[] spans = html.getSpans(0, html.length(), ClickableSpan.class);
    if (spans != null && spans.length > 0) {
        setMovementMethod(LinkMovementMethod.getInstance());
    }
    super.setText(html, type);
}
项目:smart-asset-iot-android-demo    文件:IntroActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.NoActionBar);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_intro);
    ButterKnife.bind(this);

    toolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.white));
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    title.setMovementMethod(LinkMovementMethod.getInstance());
}
项目:cnBetaGeek    文件:NewsDetailActivity.java   
private void bindData(NewsDetailBean newsDetailBean) {
    if (newsDetailBean == null) {
        finish();
        return;
    }
    String status = newsDetailBean.getStatus();
    if (!Keys.RESULT_OK.equalsIgnoreCase(status)) {
        finish();
        return;
    }
    NewsDetailBean.ResultBean bean = newsDetailBean.getResult();
    try {
        comments = Integer.valueOf(bean.getComments());
    } catch (NumberFormatException e) {
        // empty
    }
    tvTitle.setText(bean.getTitle());
    tvInfo.setText(
            getString(R.string.news_info, bean.getTime(),
                    Html.fromHtml(bean.getSource()),
                    bean.getCounter(),
                    bean.getGood(),
                    bean.getComments()));
    tvShortDesc.setText(Html.fromHtml(HtmlUtil.htmlFilter(bean.getHometext())));
    boolean isSaveNetWork = true;
    if (isSaveNetWork) {
        int imageWidth = this.getResources().getDisplayMetrics().widthPixels - DisplayUtil.dp2px(this,
                10);
        tvContent.setMovementMethod(new LinkMovementMethod());
        tvContent.setText(Html.fromHtml(bean.getBodytext(),
                new PicassoImageGetter(tvContent), null));
    } else {
        // 省流量模式
        tvContent.setText(Html.fromHtml(bean.getBodytext()));
    }

}
项目:AOSP-Kayboard-7.1.2    文件:AccountsSettingsFragment.java   
@Override
public void onShow(DialogInterface dialog) {
    TextView messageView = (TextView) ((AlertDialog) dialog).findViewById(
            android.R.id.message);
    if (messageView != null) {
        messageView.setMovementMethod(LinkMovementMethod.getInstance());
    }
}
项目:OSchina_resources_android    文件:UserSendMessageAdapter.java   
SenderViewHolder(View itemView) {
    super(itemView);
    tv_sender = (TweetTextView) itemView.findViewById(R.id.tv_sender);
    tv_send_time = (TextView) itemView.findViewById(R.id.tv_send_time);
    tv_sender.setMovementMethod(LinkMovementMethod.getInstance());
    tv_sender.setFocusable(false);
    tv_sender.setDispatchToParent(true);
    tv_sender.setLongClickable(false);
}
项目:RepWifiApp    文件:CreditsActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_credits);

    String content = getResources().getString(R.string.credit_text);
    TextView tv = (TextView) findViewById(R.id.txt_credits);
    tv.setMovementMethod(new ScrollingMovementMethod());
    tv.setText(Html.fromHtml(content));
    tv.setMovementMethod(LinkMovementMethod.getInstance());

}
项目:AppFirCloud    文件:ScanResultActivity.java   
@Override
protected void onViewCreated(@Nullable Bundle savedInstanceState) {
    String content = getIntent().getStringExtra(KEY_CONTENT);
    mTvContent.setText(content);
    //超链接相关字符识别
    mTvContent.setAutoLinkMask(Linkify.ALL);
    mTvContent.setMovementMethod(LinkMovementMethod.getInstance());
}
项目:BloomReader    文件:MainActivity.java   
private void DisplaySimpleResource(String title, int fileResourceId) {
    // Linkify the message
    final SpannableString msg = new SpannableString(IOUtilities.InputStreamToString(getResources().openRawResource(fileResourceId)));
    Linkify.addLinks(msg, Linkify.ALL);

    final AlertDialog d = new AlertDialog.Builder(this, R.style.SimpleDialogTheme)
            .setPositiveButton(android.R.string.ok, null)
            .setTitle(title)
            .setMessage(msg)
            .create();
    d.show();

    // Make the textview clickable. Must be called after show()
    ((TextView)d.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
}
项目:Movie-Notifier-Android    文件:SettingsActivity.java   
private void showAboutDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    View dialogView = View.inflate(this, R.layout.view_about, null);
    builder.setView(dialogView);
    builder.setCancelable(true);

    ((TextView) dialogView.findViewById(R.id.version)).setText(getString(R.string.settings_about_version, BuildConfig.VERSION_NAME, String.valueOf(BuildConfig.VERSION_CODE)));
    ((TextView) dialogView.findViewById(R.id.source)).setMovementMethod(new LinkMovementMethod());

    builder.show();
}
项目:GitHub    文件:AboutActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrefStore.setLocale(this);
    setContentView(R.layout.activity_about);
    TextView atv = (TextView) findViewById(R.id.aboutTextView);
    atv.setMovementMethod(LinkMovementMethod.getInstance());
    TextView vtv = (TextView) findViewById(R.id.versionView);
    vtv.setText(getString(R.string.app_version, PrefStore.getVersion(this)));
}