List of usage examples for android.widget TextView setMovementMethod
public final void setMovementMethod(MovementMethod movement)
From source file:org.openhab.habdroid.ui.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.openhababout, container, false); TextView about = (TextView) view.findViewById(R.id.license_link); about.setText(Html.fromHtml(getString(R.string.about_license))); about.setMovementMethod(LinkMovementMethod.getInstance()); TextView appVersion = (TextView) view.findViewById(R.id.app_version); appVersion.setText(getString(R.string.about_version_string, BuildConfig.VERSION_NAME, DateFormat.getDateTimeInstance().format(BuildConfig.buildTime))); String year = new SimpleDateFormat("yyyy", Locale.US).format(Calendar.getInstance().getTime()); TextView copyright = (TextView) view.findViewById(R.id.copyright); copyright.setText(String.format(getString(R.string.about_copyright), year)); copyright.setMovementMethod(LinkMovementMethod.getInstance()); TextView links = (TextView) view.findViewById(R.id.links_list); links.setText(Html.fromHtml(getString(R.string.about_links_list))); links.setMovementMethod(LinkMovementMethod.getInstance()); return view;/*from w ww. j a v a 2 s.co m*/ }
From source file:com.jaspersoft.android.jaspermobile.dialog.AboutDialogFragment.java
@Override public void onShow(DialogInterface dialog) { View decorView = getDialog().getWindow().getDecorView(); if (decorView != null) { TextView messageText = (TextView) decorView.findViewById(android.R.id.message); if (messageText != null) { messageText.setMovementMethod(LinkMovementMethod.getInstance()); }/*w ww. java 2s .c om*/ } }
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 w w . j a va 2 s. c o m*/ 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:hku.fyp14017.blencode.ui.dialogs.AboutDialogFragment.java
@Override public Dialog onCreateDialog(Bundle bundle) { View view = LayoutInflater.from(getActivity()).inflate(hku.fyp14017.blencode.R.layout.dialog_about, null); TextView license = (TextView) view.findViewById(R.id.dialog_about_text_view_license_info); license.setMovementMethod(LinkMovementMethod.getInstance()); String licenseHTML = getString(hku.fyp14017.blencode.R.string.about_link_template, "https://github.com/fyp14017/BLEnCode/blob/master/Acknowledgements.txt", "Pocket Code Acknowledgements"); license.setText(Html.fromHtml(licenseHTML)); TextView aboutUrlTextView = (TextView) view .findViewById(hku.fyp14017.blencode.R.id.dialog_about_text_view_url); aboutUrlTextView.setMovementMethod(LinkMovementMethod.getInstance()); String aboutUrl = getString(hku.fyp14017.blencode.R.string.about_link_template, Constants.ABOUT_POCKETCODE_LICENSE_URL, getString(hku.fyp14017.blencode.R.string.dialog_about_pocketcode_license_link_text)); aboutUrlTextView.setText(Html.fromHtml(aboutUrl)); TextView aboutUrlCatrobatView = (TextView) view .findViewById(hku.fyp14017.blencode.R.id.dialog_about_text_catrobat_url); aboutUrlCatrobatView.setMovementMethod(LinkMovementMethod.getInstance()); String aboutCatrobatUrl = getString(hku.fyp14017.blencode.R.string.about_link_template, Constants.CATROBAT_ABOUT_URL, getString(hku.fyp14017.blencode.R.string.dialog_about_catrobat_link_text)); aboutUrlCatrobatView.setText(Html.fromHtml(aboutCatrobatUrl)); TextView aboutVersionNameTextView = (TextView) view .findViewById(hku.fyp14017.blencode.R.id.dialog_about_text_view_version_name); String versionName = this.getString(hku.fyp14017.blencode.R.string.android_version_prefix) + Utils.getVersionName(getActivity()); aboutVersionNameTextView.setText(versionName); Dialog aboutDialog = new AlertDialog.Builder(getActivity()).setView(view).setTitle("About BLEnCode") .setNeutralButton(hku.fyp14017.blencode.R.string.ok, new DialogInterface.OnClickListener() { @Override//from ww w. j av a 2 s .c o m public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).create(); aboutDialog.setCanceledOnTouchOutside(true); return aboutDialog; }
From source file:com.swisscom.safeconnect.fragment.PipeDialogFragment.java
@Override public void onStart() { super.onStart(); // clickable hyperlinks TextView tvMessage = (TextView) getDialog().findViewById(android.R.id.message); if (tvMessage != null) { tvMessage.setMovementMethod(LinkMovementMethod.getInstance()); }/* w ww . j av a 2 s. c o m*/ }
From source file:info.schnatterer.logbackandroiddemo.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);// ww w . j a v a2 s .c om TextView textView = (TextView) findViewById(R.id.textView); textView.setMovementMethod(new ScrollingMovementMethod()); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new ReadLogOnClickListener(textView, this)); }
From source file:hku.fyp14017.blencode.ui.dialogs.AcceptTermsOfUseDialogFragment.java
@Override public Dialog onCreateDialog(Bundle bundle) { View view = LayoutInflater.from(getActivity()).inflate(hku.fyp14017.blencode.R.layout.dialog_terms_of_use, null);/* w w w . j av a 2 s . c o m*/ TextView termsOfUseUrlTextView = (TextView) view .findViewById(hku.fyp14017.blencode.R.id.dialog_terms_of_use_text_view_url); termsOfUseUrlTextView.setMovementMethod(LinkMovementMethod.getInstance()); String termsOfUseUrl = getString(hku.fyp14017.blencode.R.string.terms_of_use_link_template, Constants.CATROBAT_TERMS_OF_USE_URL, getString(hku.fyp14017.blencode.R.string.dialog_terms_of_use_link_text)); termsOfUseUrlTextView.setText(Html.fromHtml(termsOfUseUrl)); Dialog termsOfUseDialog = new AlertDialog.Builder(getActivity()).setView(view) .setTitle(hku.fyp14017.blencode.R.string.dialog_terms_of_use_title) .setNeutralButton(hku.fyp14017.blencode.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).create(); termsOfUseDialog.setCanceledOnTouchOutside(true); return termsOfUseDialog; }
From source file:com.ketanolab.simidic.adapters.AdaptadorViewPager.java
@Override public Object instantiateItem(View collection, int position) { LinearLayout linearLayout = (LinearLayout) View.inflate(contexto, R.layout.diccionario2, null); // titulo/*from w w w . jav a 2 s. c om*/ TextView textoTitulo = (TextView) linearLayout.findViewById(R.id.textview_titulo); textoTitulo.setText(listaTitulos.get(position)); // Subtitulo TextView textoSubtitulo = (TextView) linearLayout.findViewById(R.id.textview_subtitulo); textoSubtitulo.setText(listaSubtitulos.get(position)); // Extra TextView textoExtra = (TextView) linearLayout.findViewById(R.id.textview_extra); textoExtra.setText(listaExtras.get(position)); textoExtra.setMovementMethod(LinkMovementMethod.getInstance()); // Imagen ImageView imagen = (ImageView) linearLayout.findViewById(R.id.imageview_logo); imagen.setImageResource(listaBitmaps.get(position)); ((ViewPager) collection).addView(linearLayout, 0); return linearLayout; }
From source file:com.google.android.gcm.demo.ui.AbstractFragment.java
protected void setHtmlMode(View parent, int viewId) { TextView description = (TextView) parent.findViewById(viewId); description.setMovementMethod(LinkMovementMethod.getInstance()); description.setText(Html.fromHtml(getValue(parent.findViewById(viewId)))); }
From source file:de.fau.cs.mad.kwikshop.android.view.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup fragmentContainer, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.activity_about, fragmentContainer, false); ButterKnife.inject(this, rootView); // link to the app's GitHub page String linkText = String.format("<a href=\"%s\">%s</a> ", getResources().getString(R.string.githubLink), getResources().getString(R.string.viewOnGitHub)); textView_GitHubLink.setText(Html.fromHtml(linkText)); textView_GitHubLink.setMovementMethod(LinkMovementMethod.getInstance()); //git commit//from ww w.ja v a2s. c o m String text = String.format(getResources().getString(R.string.about_Commit_Format), getResources().getString(R.string.BuildInfo_Git_Commit), getResources().getString(R.string.BuildInfo_CommonRepository_Git_Commit)); textView_GitCommit.setText(text); //display acknowledgements LayoutInflater layoutInflater = getActivity().getLayoutInflater(); String[] acknowledgements = getResources().getStringArray(R.array.acknowledgements_Items); for (String item : acknowledgements) { View view = layoutInflater.inflate(R.layout.activity_about_acknowledgements_item, null); TextView textView = (TextView) view.findViewById(R.id.textView); textView.setText(Html.fromHtml(item)); textView.setMovementMethod(LinkMovementMethod.getInstance()); acknowledgements_Container.addView(view); } // long Google Play Services attribution text // if we use Google Play Service it has to be included View view = layoutInflater.inflate(R.layout.activity_about_acknowledgements_item, null); TextView textView = (TextView) view.findViewById(R.id.textView); textView.setText(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getActivity())); container.addView(view); return rootView; }