List of usage examples for android.widget TextView setMovementMethod
public final void setMovementMethod(MovementMethod movement)
From source file:com.money.manager.ex.about.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String text, version;// ww w . ja va2 s .c o m View view = inflater.inflate(R.layout.about_fragment, container, false); MmxBaseFragmentActivity activity = (MmxBaseFragmentActivity) getActivity(); if (activity != null && activity.getSupportActionBar() != null) { activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); } // Version application TextView txtVersion = (TextView) view.findViewById(R.id.textViewVersion); Core core = new Core(getActivity()); version = core.getAppVersionName(); // build = core.getAppVersionBuild(); txtVersion.setText(getString(R.string.version) + " " + version); // + " (" + getString(R.string.build) + " " + build + ")" // Send Feedback TextView txtFeedback = (TextView) view.findViewById(R.id.textViewLinkFeedback); text = "<u>" + txtFeedback.getText() + "</u>"; txtFeedback.setText(Html.fromHtml(text)); txtFeedback.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { Constants.EMAIL }); intent.putExtra(Intent.EXTRA_SUBJECT, "MoneyManagerEx for Android: Feedback"); try { startActivity(Intent.createChooser(intent, "Send mail...")); } catch (Exception e) { Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show(); } } }); // rate application TextView txtRate = (TextView) view.findViewById(R.id.textViewLinkRate); text = "<u>" + txtRate.getText() + "</u>"; txtRate.setText(Html.fromHtml(text)); txtRate.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerRate = new OnClickListenerUrl(); clickListenerRate.setUrl("http://play.google.com/store/apps/details?id=com.money.manager.ex"); txtRate.setOnClickListener(clickListenerRate); // application issue tracker TextView txtIssues = (TextView) view.findViewById(R.id.textViewIssuesTracker); text = "<u>" + txtIssues.getText() + "</u>"; txtIssues.setText(Html.fromHtml(text)); txtIssues.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerIssuesTracker = new OnClickListenerUrl(); clickListenerIssuesTracker.setUrl("https://github.com/moneymanagerex/android-money-manager-ex/issues/"); txtIssues.setOnClickListener(clickListenerIssuesTracker); // MMEX for Android web page TextView txtWebsite = (TextView) view.findViewById(R.id.textViewWebSite); text = "<u>" + txtWebsite.getText() + "</u>"; txtWebsite.setText(Html.fromHtml(text)); txtWebsite.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerWebsite = new OnClickListenerUrl(); clickListenerWebsite.setUrl("http://android.moneymanagerex.org/"); txtWebsite.setOnClickListener(clickListenerWebsite); // report set link TextView txtReport = (TextView) view.findViewById(R.id.textViewLinkWebSite); text = "<u>" + txtReport.getText() + "</u>"; txtReport.setText(Html.fromHtml(text)); txtReport.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerFeedback = new OnClickListenerUrl(); clickListenerFeedback .setUrl("http://www.moneymanagerex.org/?utm_campaign=Application_Android&utm_medium=MMEX_" + version + "&utm_source=Website"); txtReport.setOnClickListener(clickListenerFeedback); // image view google plus OnClickListenerUrl clickListenerGooglePlus = new OnClickListenerUrl(); clickListenerGooglePlus.setUrl("http://goo.gl/R693Ih"); ImageView imageViewGooglePlus = (ImageView) view.findViewById(R.id.imageViewGooglePlus); imageViewGooglePlus.setOnClickListener(clickListenerGooglePlus); // image view github OnClickListenerUrl clickListenerGithub = new OnClickListenerUrl(); clickListenerGithub.setUrl("https://github.com/moneymanagerex/android-money-manager-ex"); ImageView imageViewGithub = (ImageView) view.findViewById(R.id.imageViewGithub); imageViewGithub.setOnClickListener(clickListenerGithub); // image view twitter OnClickListenerUrl clickListenerTwitter = new OnClickListenerUrl(); clickListenerTwitter.setUrl("https://twitter.com/MMEX4Android"); ImageView imageViewTwitter = (ImageView) view.findViewById(R.id.imageViewTwitter); imageViewTwitter.setOnClickListener(clickListenerTwitter); // GPLv2 license TextView txtLicense = (TextView) view.findViewById(R.id.textViewLicense); text = "<u>" + txtLicense.getText() + "</u>"; txtLicense.setText(Html.fromHtml(text)); OnClickListenerUrl clickListenerLicense = new OnClickListenerUrl(); clickListenerLicense.setUrl("http://www.gnu.org/licenses/old-licenses/gpl-2.0.html"); txtLicense.setOnClickListener(clickListenerLicense); // logcat TextView txtLogcat = (TextView) view.findViewById(R.id.textViewLogcat); text = "<u>" + txtLogcat.getText() + "</u>"; txtLogcat.setText(Html.fromHtml(text)); txtLogcat.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { LynxConfig lynxConfig = new LynxConfig(); lynxConfig.setMaxNumberOfTracesToShow(4000); Intent lynxActivityIntent = LynxActivity.getIntent(getActivity(), lynxConfig); startActivity(lynxActivityIntent); } }); // Donate, button Button buttonDonate = (Button) view.findViewById(R.id.buttonDonateInApp); buttonDonate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(getActivity(), DonateActivity.class)); } }); // Send logcat button Button sendLogcatButton = (Button) view.findViewById(R.id.sendLogcatButton); sendLogcatButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { sendLogcat(); } }); return view; }
From source file:org.liberty.android.fantastischmemo.downloader.DownloaderAnyMemo.java
@Override protected void fetchDatabase(final DownloadItem di) { final Thread downloadThread = new Thread() { @Override/* ww w . ja v a 2 s . co m*/ public void run() { String filename = di.getExtras("filename"); try { downloadDatabase(di); filename = filename.replace(".zip", ".db"); String sdpath = AMEnv.DEFAULT_ROOT_PATH; final File dbFile = new File(sdpath + filename); mHandler.post(new Runnable() { public void run() { new AlertDialog.Builder(DownloaderAnyMemo.this) .setTitle(R.string.downloader_download_success) .setMessage(getString(R.string.downloader_download_success_message) + dbFile.toString()) .setPositiveButton(R.string.ok_text, null).create().show(); } }); } catch (final Exception e) { mHandler.post(new Runnable() { public void run() { new AlertDialog.Builder(DownloaderAnyMemo.this) .setTitle(R.string.downloader_download_fail) .setMessage(getString(R.string.downloader_download_fail_message) + " " + e.toString()) .setPositiveButton(R.string.ok_text, null).create().show(); } }); } } }; View alertView = View.inflate(DownloaderAnyMemo.this, R.layout.link_alert, null); TextView textView = (TextView) alertView.findViewById(R.id.link_alert_message); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setText( Html.fromHtml(getString(R.string.downloader_download_alert_message) + di.getDescription())); new AlertDialog.Builder(this).setView(alertView) .setTitle(getString(R.string.downloader_download_alert) + di.getExtras("filename")) .setPositiveButton(getString(R.string.yes_text), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { downloadThread.start(); } }).setNegativeButton(getString(R.string.no_text), null).show(); }
From source file:com.flowzr.activity.FlowzrSyncActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.flowzr_sync); //@see: http://stackoverflow.com/questions/16539251/get-rid-of-blue-line, //only way found to remove on various devices 2.3x, 3.0, ... getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#121212"))); renderLastTime();/*www. j ava2 s .c o m*/ CheckBox chkForce = (CheckBox) findViewById(R.id.chk_sync_from_zero); chkForce.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { resetLastTime(); renderLastTime(); } }); Button syncButton = (Button) findViewById(R.id.sync); syncButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startSync(); } }); Button textViewAbout = (Button) findViewById(R.id.buySubscription); textViewAbout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String accountName = MyPreferences.getFlowzrAccount(getApplicationContext()); if (accountName == null) { Toast.makeText(FlowzrSyncActivity.this, R.string.flowzr_choose_account, Toast.LENGTH_SHORT) .show(); return; } if (isOnline(FlowzrSyncActivity.this)) { //checkPlayServices(); } else { showErrorPopup(FlowzrSyncActivity.this, R.string.flowzr_sync_error_no_network); return; } // Toast.makeText(FlowzrSyncActivity.this, R.string.flowzr_sync_auth_inprogress, Toast.LENGTH_SHORT) .show(); FlowzrBillTask ft = new FlowzrBillTask(FlowzrSyncActivity.this); ft.execute(); //visitFlowzr(accountName); } }); Button textViewAboutAnon = (Button) findViewById(R.id.visitFlowzr); textViewAboutAnon.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (isOnline(FlowzrSyncActivity.this)) { visitFlowzr(null); } else { showErrorPopup(FlowzrSyncActivity.this, R.string.flowzr_sync_error_no_network); } } }); TextView textViewNotes = (TextView) findViewById(R.id.flowzrPleaseNote); textViewNotes.setMovementMethod(LinkMovementMethod.getInstance()); textViewNotes.setText(Html.fromHtml(getString(R.string.flowzr_terms_of_use))); if (MyPreferences.isAutoSync(this)) { if (checkPlayServices()) { gcm = GoogleCloudMessaging.getInstance(this); regid = getRegistrationId(getApplicationContext()); if (regid.equals("")) { registerInBackground(); } Log.i(TAG, "Google Cloud Messaging registered as :" + regid); } else { Log.i(TAG, "No valid Google Play Services APK found."); } } }
From source file:com.flowzr.budget.holo.activity.FlowzrSyncActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.flowzr_sync); //@see: http://stackoverflow.com/questions/16539251/get-rid-of-blue-line, //only way found to remove on various devices 2.3x, 3.0, ... getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#121212"))); renderLastTime();//from ww w . j a v a 2 s. co m CheckBox chkForce = (CheckBox) findViewById(R.id.chk_sync_from_zero); chkForce.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { resetLastTime(); renderLastTime(); } }); Button syncButton = (Button) findViewById(R.id.sync); syncButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startSync(); } }); Button textViewAbout = (Button) findViewById(R.id.buySubscription); textViewAbout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String accountName = MyPreferences.getFlowzrAccount(getApplicationContext()); if (accountName == null) { Toast.makeText(FlowzrSyncActivity.this, R.string.flowzr_choose_account, Toast.LENGTH_SHORT) .show(); return; } if (isOnline(FlowzrSyncActivity.this)) { //checkPlayServices(); } else { showErrorPopup(FlowzrSyncActivity.this, R.string.flowzr_sync_error_no_network); return; } // Toast.makeText(FlowzrSyncActivity.this, R.string.flowzr_sync_auth_inprogress, Toast.LENGTH_SHORT) .show(); FlowzrBillTask ft = new FlowzrBillTask(FlowzrSyncActivity.this); ft.execute(); //visitFlowzr(accountName); } }); Button textViewAboutAnon = (Button) findViewById(R.id.visitFlowzr); textViewAboutAnon.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (isOnline(FlowzrSyncActivity.this)) { visitFlowzr(null); } else { showErrorPopup(FlowzrSyncActivity.this, R.string.flowzr_sync_error_no_network); } } }); TextView textViewNotes = (TextView) findViewById(R.id.flowzrPleaseNote); textViewNotes.setMovementMethod(LinkMovementMethod.getInstance()); textViewNotes.setText(Html.fromHtml(getString(R.string.flowzr_terms_of_use))); if (MyPreferences.isAutoSync(this)) { if (checkPlayServices()) { gcm = GoogleCloudMessaging.getInstance(this); regid = getRegistrationId(getApplicationContext()); if (regid.equals("")) { registerInBackground(); } Log.i(TAG, "Google Cloud Messaging registered as :" + regid); } else { Log.i(TAG, "No valid Google Play Services APK found."); } } }
From source file:org.inftel.ssa.mobile.ui.fragments.ProjectDetailFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (data.moveToFirst()) { mProjectId = data.getString(data.getColumnIndex(Projects._ID)); name = data.getString(data.getColumnIndex(Projects.PROJECT_NAME)); summary = data.getString(data.getColumnIndex(Projects.PROJECT_SUMMARY)); description = data.getString(data.getColumnIndex(Projects.PROJECT_DESCRIPTION)); opened = data.getString(data.getColumnIndex(Projects.PROJECT_OPENED)); started = data.getString(data.getColumnIndex(Projects.PROJECT_STARTED)); closed = data.getString(data.getColumnIndex(Projects.PROJECT_CLOSE)); company = data.getString(data.getColumnIndex(Projects.PROJECT_COMPANY)); license = data.getString(data.getColumnIndex(Projects.PROJECT_LICENSE)); labels = data.getString(data.getColumnIndex(Projects.PROJECT_LABELS)); links = data.getString(data.getColumnIndex(Projects.PROJECT_LINKS)); // taskChart(mProjectId); // Update UI mHandler.post(new Runnable() { public void run() { // Header ((TextView) getView().findViewById(R.id.detail_title)).setText(name); ((TextView) getView().findViewById(R.id.detail_subtitle)).setText(summary); // Tab description if (description != null) { ((TextView) getView().findViewById(R.id.project_detail_description)) .setText(Html.fromHtml(description)); }/*from w w w . jav a2s . co m*/ // Tab links // TODO Ver como llegan los links y aplicarle formato String link = "<a href='http://www.masterinftel.uma.es/'>Master Inftel</a>"; TextView l = (TextView) getView().findViewById(R.id.empty_links); l.setText(Html.fromHtml(link)); l.setMovementMethod(LinkMovementMethod.getInstance()); l.setLinksClickable(true); // Tab Information ((TextView) getView().findViewById(R.id.lblOpened)).setText(formatDate(opened)); ((TextView) getView().findViewById(R.id.lblStarted)).setText(formatDate(started)); ((TextView) getView().findViewById(R.id.lblClosed)).setText(formatDate(closed)); ((TextView) getView().findViewById(R.id.lblCompany)).setText(company); ((TextView) getView().findViewById(R.id.lblLicense)).setText(license); ((TextView) getView().findViewById(R.id.lblLabels)).setText(labels); } }); } }
From source file:com.hybris.mobile.activity.AbstractProductDetailActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.product_detail); // Allow links in promotions label TextView promotionsTextView = (TextView) findViewById(R.id.textViewPromotion); promotionsTextView.setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.keepassdroid.EntryActivity.java
private void showSamsungDialog() { String text = getString(R.string.clipboard_error).concat(System.getProperty("line.separator")) .concat(getString(R.string.clipboard_error_url)); SpannableString s = new SpannableString(text); TextView tv = new TextView(this); tv.setText(s);//from ww w . j ava 2 s . co m tv.setAutoLinkMask(RESULT_OK); tv.setMovementMethod(LinkMovementMethod.getInstance()); Linkify.addLinks(s, Linkify.WEB_URLS); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.clipboard_error_title) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).setView(tv).show(); }
From source file:ooo.oxo.moments.feed.FeedAdapter.java
@Override public void onBindViewHolder(ViewHolder holder, int position) { Media item = feed.get(position); Glide.with(context).load(item.user.profilePicture).bitmapTransform(new CropCircleTransformation(context)) .diskCacheStrategy(DiskCacheStrategy.ALL).into(holder.avatar); ViewCompat.setTransitionName(holder.avatar, item.user.id + "_" + item.id + "_avatar"); holder.user.setText(item.user.username); holder.time.setText(DATE_FORMAT.format(item.createdTime)); Media.Resources.Resource image = item.images.standardResolution; holder.image.setOriginalSize(image.width, image.height); Glide.with(context).load(image.url).into(holder.image); if (item.likes.count > 0) { holder.likes.setText(context.getString(R.string.n_likes, item.likes.count)); holder.likes.setVisibility(View.VISIBLE); } else {/*from ww w . j av a 2s . c o m*/ holder.likes.setVisibility(View.GONE); } holder.comments.removeAllViews(); holder.comments.setVisibility(item.caption != null || item.comments.count > 0 ? View.VISIBLE : View.GONE); if (item.caption != null) { TextView caption = (TextView) inflater.inflate(R.layout.feed_comment_item, holder.comments, false); CharSequence text = CommentTextUtils.format(item.user.username, item.caption.text, item.tags, () -> listener.onUserClick(item.user.id), null); caption.setText(text, TextView.BufferType.SPANNABLE); caption.setMovementMethod(LinkMovementMethod.getInstance()); holder.comments.addView(caption); } for (Comment comment : item.comments.data) { TextView child = (TextView) inflater.inflate(R.layout.feed_comment_item, holder.comments, false); CharSequence text = CommentTextUtils.format(comment.from.username, comment.text, () -> listener.onUserClick(comment.from.id)); child.setText(text, TextView.BufferType.SPANNABLE); child.setMovementMethod(LinkMovementMethod.getInstance()); holder.comments.addView(child); } }
From source file:org.irmacard.cardemu.selfenrol.EnrollSelectActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, "onCreate() called"); // Disable screenshots in release builds if (!BuildConfig.DEBUG) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); }/* ww w.j av a 2 s . c o m*/ setContentView(R.layout.enroll_activity_start); setTitle(R.string.app_name_enroll); enableContinueButton(); screen = SCREEN_START; updateProgressCounter(); String helpHtml = getString(R.string.se_connect_mno); TextView helpTextView = (TextView) findViewById(R.id.se_feedback_text); if (helpTextView != null) { // Can be null if we are on error screen helpTextView.setText(Html.fromHtml(helpHtml)); helpTextView.setMovementMethod(LinkMovementMethod.getInstance()); helpTextView.setLinksClickable(true); } }
From source file:info.schnatterer.nusic.android.activities.MainActivity.java
/** * Shows an alert dialog displaying some text. Useful for welcome messages. * Calls {@link #registerListenersAndStartLoading()} when the dialog is * dismissed./*w ww.ja v a2s . c om*/ * * @param text * text to display. If loading from an asset, consider using * {@link TextUtil#loadTextFromAsset(android.content.Context, String)} */ @SuppressLint("InflateParams") // See http://www.doubleencore.com/2013/05/layout-inflation-as-intended/ private void showWelcomeDialog(CharSequence text) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); View layout = getLayoutInflater().inflate(R.layout.simple_textview_layout, null, false); TextView textView = (TextView) layout.findViewById(R.id.renderRawHtmlTextView); textView.setText(text); textView.setMovementMethod(LinkMovementMethod.getInstance()); alertDialogBuilder .setTitle(getString(R.string.WelcomeScreenTitle, NusicApplication.getCurrentVersionName())) .setIcon(R.drawable.ic_launcher).setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { registerListenersAndStartLoading(true); } }).setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { registerListenersAndStartLoading(true); } }).setView(layout).show(); }