List of usage examples for android.text.method LinkMovementMethod getInstance
public static MovementMethod getInstance()
From source file:io.github.t3r1jj.pbmap.AboutActivity.java
private void setUpAuthor() { TextView authorText = (TextView) findViewById(R.id.about_author); authorText.setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.hybris.mobile.adapter.CartAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); Object cartItem = items.get(position); View rowView = null;//from w ww .j a va 2 s. c om if (cartItem instanceof CartEntry) { CartEntry cartEntry = (CartEntry) cartItem; rowView = inflater.inflate(R.layout.cart_row, parent, false); TextView lblProductTitle = (TextView) rowView.findViewById(R.id.lbl_product_title); TextView lblProductPrice = (TextView) rowView.findViewById(R.id.lbl_price_quantity); TextView lblManufacturer = (TextView) rowView.findViewById(R.id.lbl_productManufacturer); TextView lblTotal = (TextView) rowView.findViewById(R.id.lbl_total); ImageView productImage = (ImageView) rowView.findViewById(R.id.img_product); if (StringUtils.isEmpty(cartEntry.getProduct().getManufacturer())) { lblManufacturer.setHeight(0); } else { lblManufacturer.setText(cartEntry.getProduct().getManufacturer()); } lblProductTitle.setText(cartEntry.getProduct().getName()); lblProductPrice.setText(cartEntry.getBasePrice().getFormattedValue() + " - " + this.getContext().getString(R.string.cartentry_quantity_placeholder) + cartEntry.getQuantity().toString()); lblManufacturer.setText(cartEntry.getProduct().getManufacturer()); lblTotal.setText(cartEntry.getTotalPrice().getFormattedValue()); UrlImageViewHelper.setUrlDrawable(productImage, cartEntry.getProduct().getThumbnail(), R.drawable.loading_drawable); } // Promotions else if (cartItem instanceof CartPromotion) { CartPromotion cartPromotion = (CartPromotion) cartItem; rowView = inflater.inflate(R.layout.promotion_row, parent, false); // Update promotions section TextView promotionsTextView = (TextView) rowView.findViewById(R.id.textView); promotionsTextView.setMovementMethod(LinkMovementMethod.getInstance()); promotionsTextView.setText(Html.fromHtml(Cart.generatePromotionString(cartPromotion))); StringUtil.removeUnderlines((Spannable) promotionsTextView.getText()); } return rowView; }
From source file:com.borjabravo.readmoretextview.ReadMoreTextView.java
public void setText() { super.setText(getDisplayableText(), bufferType); setMovementMethod(LinkMovementMethod.getInstance()); //setHighlightColor(Color.TRANSPARENT); }
From source file:com.github.michalbednarski.intentslab.browser.RegisteredReceiverInfoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.activity_component_info, container, false); // Find views: header, icon, component name and description TextView titleTextView = (TextView) v.findViewById(R.id.title); TextView componentTextView = (TextView) v.findViewById(R.id.component); ImageView iconView = (ImageView) v.findViewById(R.id.icon); TextView descriptionTextView = (TextView) v.findViewById(R.id.description); descriptionTextView.setMovementMethod(LinkMovementMethod.getInstance()); // Fill header titleTextView.setText(R.string.registered_receiver); componentTextView.setText(mReceiverInfo.processName); /*mIconView.setImageDrawable( mExtendedComponentInfo.systemComponentInfo.loadIcon(getActivity().getPackageManager()) );*//*from w w w.j a v a2s.c o m*/ iconView.setImageDrawable(null); // TODO // Description text FormattedTextBuilder text = new FormattedTextBuilder(); // Description: permission boolean hasOverallPermission = false; String permission = null; try { permission = mReceiverInfo.getOverallPermission(); hasOverallPermission = true; } catch (RegisteredReceiverInfo.MixedPermissionsException ignored) { } if (permission != null) { text.appendValue(getString(R.string.permission_required_title), permission, true, FormattedTextBuilder.ValueSemantic.PERMISSION); } // Description: <intent-filter>'s text.appendHeader(getString(R.string.intent_filters)); IntentFilter[] intentFilters = mReceiverInfo.intentFilters; for (int i = 0, j = intentFilters.length; i < j; i++) { IntentFilter filter = intentFilters[i]; boolean hasSpecificPermission = !hasOverallPermission && mReceiverInfo.filterPermissions[i] != null; if (hasSpecificPermission) { text.appendColoured( // TODO: link "\n\n<!-- " + getString(R.string.permission_required_title) + ": " + mReceiverInfo.filterPermissions[i] + " -->", getResources().getColor(R.color.xml_comment)); } text.appendFormattedText(ComponentInfoFragment.dumpIntentFilter(filter, getResources(), true)); if (hasSpecificPermission) { text.appendRaw("\n"); } } // Put text in TextView descriptionTextView.setText(text.getText()); // Go to intent editor button v.findViewById(R.id.go_to_intent_editor).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getArguments().getBoolean(ComponentInfoFragment.ARG_LAUNCHED_FROM_INTENT_EDITOR, false)) { getActivity().finish(); return; } startActivity(new Intent(getActivity(), IntentEditorActivity.class) .putExtra(IntentEditorActivity.EXTRA_INTENT, new Intent()) .putExtra(IntentEditorActivity.EXTRA_COMPONENT_TYPE, IntentEditorConstants.BROADCAST) .putExtra(IntentEditorActivity.EXTRA_INTENT_FILTERS, mReceiverInfo.intentFilters)); } }); // Receive broadcast button View receiveBroadcastButton = v.findViewById(R.id.receive_broadcast); receiveBroadcastButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ReceiveBroadcastService.startReceiving(getActivity(), mReceiverInfo.intentFilters, false); } }); receiveBroadcastButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { ReceiveBroadcastService.startReceiving(getActivity(), mReceiverInfo.intentFilters, true); return true; } }); receiveBroadcastButton.setVisibility(View.VISIBLE); receiveBroadcastButton.setEnabled(true); return v; }
From source file:com.inter.trade.ui.fragment.smsreceivepayment.SmsSuccessFragment.java
private void initView(View view) { if (requsetData != null) { TextView tv_content = (TextView) view.findViewById(R.id.tv_content); String s1 = "????"; String s2 = requsetData.getValue("fumobile"); String s3 = "??"; String s4 = "" + requsetData.getValue("money"); String s5 = ",??1"; String content = s1 + s2 + s3 + s4 + s5; int len = 0; /**//from www. j a va 2 s . c o m * ?TEXTVIEW?? */ SpannableString ss = new SpannableString(content); ss.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.agent_apply_yellow)), len = s1.length() + s2.length() + s3.length(), len + s4.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); tv_content.setText(ss); tv_content.setMovementMethod(LinkMovementMethod.getInstance()); // String content = "????" // +requsetData.getValue("fumobile") // +"??" // +requsetData.getValue("money") // +",??1"; // tv_content.setText(content); TextView tv_shou_bank = (TextView) view.findViewById(R.id.tv_shou_bank); String shou_bank = "" + requsetData.getValue("shoucardbank"); tv_shou_bank.setText(shou_bank); TextView tv_shou_card = (TextView) view.findViewById(R.id.tv_shou_card); String shou_card = "?" + requsetData.getValue("shoucardno"); tv_shou_card.setText(shou_card); } Button see_history = (Button) view.findViewById(R.id.see_history); see_history.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub getActivity().setResult(Constants.ACTIVITY_FINISH); getActivity().finish(); } }); Button btnAgain = (Button) view.findViewById(R.id.btn_again); btnAgain.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { /** * ?? */ SmsReceivePaymentMainFragment.isComeBackFromPaySuccess = true; Intent intent = new Intent(getActivity(), IndexActivity.class); intent.putExtra(FragmentFactory.INDEX_KEY, FuncMap.SMSRECEIPT_INDEX_FUNC); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }); }
From source file:de.tobiasbielefeld.solitaire.ui.about.InformationFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_about_tab1, container, false); TextView textViewBuildDate = (TextView) view.findViewById(R.id.aboutTextViewBuild); //build date TextView textViewAppVersion = (TextView) view.findViewById(R.id.aboutTextViewVersion); //app version TextView textViewGitHubLink = (TextView) view.findViewById(R.id.aboutTextViewGitHubLink); //link for the gitHub repo TextView textViewLicenseLink = (TextView) view.findViewById(R.id.aboutTextViewLicenseLink); TextView textJapaneseContributors = (TextView) view.findViewById(R.id.about_japanese_contributors); TextView textEsperantoContributors = (TextView) view.findViewById(R.id.about_esperanto_contributors); TextView textPolishContributors = (TextView) view.findViewById(R.id.about_polish_contributors); TextView textFrenchContributors = (TextView) view.findViewById(R.id.about_french_contributors); TextView textFinnishContributors = (TextView) view.findViewById(R.id.about_finnish_contributors); TextView textTurkishContributors = (TextView) view.findViewById(R.id.about_turkish_contributors); TextView textSpanishArgentinaContributors = (TextView) view .findViewById(R.id.about_spanish_argentina_contributers); TextView textFurtherContributors1 = (TextView) view.findViewById(R.id.about_further_contributors_1); TextView textFurtherContributors2 = (TextView) view.findViewById(R.id.about_further_contributors_2); TextView textFurtherContributors3 = (TextView) view.findViewById(R.id.about_further_contributors_3); String buildDate = DateFormat.getDateInstance().format(BuildConfig.TIMESTAMP); //get the build date in locale time format //update the textViews textViewAppVersion.setText(stringFormat(BuildConfig.VERSION_NAME)); textViewBuildDate.setText(stringFormat(buildDate)); //enable the hyperlink clicks TextView[] textViews = new TextView[] { textViewGitHubLink, textViewLicenseLink, textJapaneseContributors, textEsperantoContributors, textPolishContributors, textFinnishContributors, textTurkishContributors, textFrenchContributors, textFurtherContributors1, textFurtherContributors2, textFurtherContributors3, textSpanishArgentinaContributors }; for (TextView textView : textViews) { textView.setMovementMethod(LinkMovementMethod.getInstance()); }/*w ww. j ava 2s . co m*/ return view; }
From source file:com.sdrtouch.tools.DialogManager.java
private Dialog createDialog(final dialogs id) { switch (id) { case DIAG_ABOUT: final AlertDialog addd = new AlertDialog.Builder(getActivity()).setTitle(R.string.help) .setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() { @Override/*w w w .ja v a 2 s .c o m*/ public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).setMessage(Html.fromHtml(getString(R.string.help_info))).create(); try { addd.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface paramDialogInterface) { try { final TextView tv = (TextView) addd.getWindow().findViewById(android.R.id.message); if (tv != null) tv.setMovementMethod(LinkMovementMethod.getInstance()); } catch (Exception ignored) { } } }); } catch (Exception ignored) { } return addd; case DIAG_LICENSE: return new AlertDialog.Builder(getActivity()).setTitle("License") .setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).setMessage(readWholeStream(R.raw.license)).create(); } return null; }
From source file:org.creativecommons.thelist.fragments.TermsFragment.java
@Override public void onResume() { super.onResume(); mCheckBox = (CheckBox) getView().findViewById(R.id.checkBox); mNextButton = (Button) getView().findViewById(R.id.nextButton); mCancelButton = (TextView) getView().findViewById(R.id.cancelButton); mLearnMoreButton = (TextView) getView().findViewById(R.id.learnMoreButton); mCheckBox.setOnClickListener(new View.OnClickListener() { @Override//from w w w . ja v a 2 s .co m public void onClick(View v) { if (mCheckBox.isChecked()) { mNextButton.setVisibility(View.VISIBLE); } else { mNextButton.setVisibility(View.INVISIBLE); } } }); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mCallback.onTermsClicked(); } }); mCancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mCallback.onTermsCancelled(); } }); if (mLearnMoreButton != null) { mLearnMoreButton.setMovementMethod(LinkMovementMethod.getInstance()); } }
From source file:cn.zhangls.android.weibo.ui.weibo.content.RepostPictureViewProvider.java
@Override protected void onBindContentViewHolder(@NonNull final RepostPicHolder holder, @NonNull final Status status) { // ??/*from w ww.ja v a2 s . c o m*/ // ? StringBuffer buffer = new StringBuffer(); if (status.getRetweeted_status().getUser() != null) {// ??? buffer.append("@"); buffer.append(status.getRetweeted_status().getUser().getName() != null ? status.getRetweeted_status().getUser().getName() : status.getRetweeted_status().getUser().getScreen_name() != null ? status.getRetweeted_status().getUser().getScreen_name() : "") .append(" :"); holder.mTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CommentActivity.actionStart(holder.mTextView.getContext(), status.getRetweeted_status()); } }); } buffer.append(status.getRetweeted_status().getText()); final Context context = holder.itemView.getContext(); holder.mTextView.setText(TextUtil.convertText(context, buffer.toString(), ContextCompat.getColor(context, R.color.colorAccent), (int) holder.mTextView.getTextSize())); holder.mTextView.setMovementMethod(LinkMovementMethod.getInstance()); // RecyclerView ArrayList<Status> statuses = new ArrayList<>(); statuses.add(status.getRetweeted_status()); PictureRecyclerAdapter picAdapter = new PictureRecyclerAdapter(context, statuses); holder.mRecyclerView.setLayoutManager(new GridLayoutManager(context, 3, GridLayoutManager.VERTICAL, false)); holder.mRecyclerView.addItemDecoration(new SpaceItemDecoration(context)); holder.mRecyclerView.setAdapter(picAdapter); }
From source file:de.tobiasbielefeld.solitaire.ui.about.LicenseFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_about_tab2, container, false); TextView textMaterialIconsLicense = (TextView) view.findViewById(R.id.about_license_material_icons); TextView textMaterialIconsLicense2 = (TextView) view.findViewById(R.id.about_license_material_icons_2); TextView textMaterialIconsUsage2 = (TextView) view.findViewById(R.id.about_license_material_icons_2_usage); TextView textCardThemesLicense = (TextView) view.findViewById(R.id.about_license_cards_theme); TextView textCardThemesLicenseUsage = (TextView) view.findViewById(R.id.about_license_card_themes_usage); TextView textPokerLicense = (TextView) view.findViewById(R.id.about_license_poker_theme); TextView textPokerLicenseUsage = (TextView) view.findViewById(R.id.about_license_poker_theme_usage); TextView textParisLicenseUsage = (TextView) view.findViewById(R.id.about_license_paris_theme_usage); TextView textCustomColorPickerLicense = (TextView) view .findViewById(R.id.about_license_custom_color_picker); TextView textSoundsLicense = (TextView) view.findViewById(R.id.about_license_sounds); TextView textSoundsLicenseUsage = (TextView) view.findViewById(R.id.about_license_sounds_usage); TextView textSlidingTabsLicense = (TextView) view.findViewById(R.id.about_license_sliding_tabs); TextView textAndroidSupportLicense = (TextView) view .findViewById(R.id.about_license_android_support_libraries); TextView[] textViews = new TextView[] { textMaterialIconsLicense, textMaterialIconsLicense2, textMaterialIconsUsage2, textCardThemesLicense, textCardThemesLicenseUsage, textPokerLicense, textPokerLicenseUsage, textCustomColorPickerLicense, textSoundsLicense, textSoundsLicenseUsage, textSlidingTabsLicense, textAndroidSupportLicense, textParisLicenseUsage }; //explicitly set the strings here, otherwise the links in them wouldn't show properly textCardThemesLicenseUsage.setText(Html.fromHtml(getString(R.string.about_card_themes_usage))); textPokerLicenseUsage.setText(Html.fromHtml(getString(R.string.about_poker_themes_usage))); textParisLicenseUsage.setText(Html.fromHtml(getString(R.string.about_paris_themes_usage))); textSoundsLicenseUsage.setText(Html.fromHtml(getString(R.string.about_sounds_usage))); textMaterialIconsUsage2.setText(Html.fromHtml(getString(R.string.about_material_icons_2_usage))); for (TextView textView : textViews) { textView.setMovementMethod(LinkMovementMethod.getInstance()); }/*from ww w .java 2s. com*/ return view; }