List of usage examples for android.text.method LinkMovementMethod getInstance
public static MovementMethod getInstance()
From source file:com.keylesspalace.tusky.AccountActivity.java
private void onObtainAccountSuccess(Account account) { loadedAccount = account;// ww w. j a v a 2 s . c o m TextView username = (TextView) findViewById(R.id.account_username); TextView displayName = (TextView) findViewById(R.id.account_display_name); TextView note = (TextView) findViewById(R.id.account_note); CircularImageView avatar = (CircularImageView) findViewById(R.id.account_avatar); ImageView header = (ImageView) findViewById(R.id.account_header); String usernameFormatted = String.format(getString(R.string.status_username_format), account.username); username.setText(usernameFormatted); displayName.setText(account.getDisplayName()); note.setText(account.note); note.setLinksClickable(true); note.setMovementMethod(LinkMovementMethod.getInstance()); if (account.locked) { accountLockedView.setVisibility(View.VISIBLE); } else { accountLockedView.setVisibility(View.GONE); } Picasso.with(this).load(account.avatar).placeholder(R.drawable.avatar_default) .error(R.drawable.avatar_error).into(avatar); Picasso.with(this).load(account.header).placeholder(R.drawable.account_header_missing).into(header); NumberFormat nf = NumberFormat.getInstance(); // Add counts to the tabs in the TabLayout. String[] counts = { nf.format(Integer.parseInt(account.statusesCount)), nf.format(Integer.parseInt(account.followingCount)), nf.format(Integer.parseInt(account.followersCount)), }; for (int i = 0; i < tabLayout.getTabCount(); i++) { TabLayout.Tab tab = tabLayout.getTabAt(i); if (tab != null) { View view = tab.getCustomView(); if (view != null) { TextView total = (TextView) view.findViewById(R.id.total); total.setText(counts[i]); } } } }
From source file:org.adblockplus.android.Preferences.java
private void showNotificationDialog(final String title, String message, String url) { url = TextUtils.htmlEncode(url);//from w w w .j a va2 s. co m message = TextUtils.htmlEncode(message).replaceAll("<a>(.*?)</a>", "<a href=\"" + url + "\">$1</a>"); final TextView messageView = new TextView(this); messageView.setText(Html.fromHtml(message)); messageView.setMovementMethod(LinkMovementMethod.getInstance()); final int padding = 10; messageView.setPadding(padding, padding, padding, padding); new AlertDialog.Builder(this).setTitle(title).setView(messageView) .setIcon(android.R.drawable.ic_dialog_info).setPositiveButton(R.string.ok, null).create().show(); }
From source file:org.liberty.android.fantastischmemo.downloader.DownloaderSS.java
protected void fetchDatabase(final DownloadItem di) { View alertView = View.inflate(this, R.layout.link_alert, null); TextView textView = (TextView) alertView.findViewById(R.id.link_alert_message); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setText(// ww w . j a va 2s. com 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.getTitle()) .setPositiveButton(getString(R.string.yes_text), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { mProgressDialog = ProgressDialog.show(DownloaderSS.this, getString(R.string.loading_please_wait), getString(R.string.loading_downloading)); new Thread() { public void run() { try { downloadDatabase(di); mHandler.post(new Runnable() { public void run() { mProgressDialog.dismiss(); String dbpath = AMEnv.DEFAULT_ROOT_PATH; new AlertDialog.Builder(DownloaderSS.this) .setTitle(R.string.downloader_download_success) .setMessage( getString(R.string.downloader_download_success_message) + dbpath + di.getTitle() + ".db") .setPositiveButton(R.string.ok_text, null).create().show(); } }); } catch (final Exception e) { Log.e(TAG, "Error downloading", e); mHandler.post(new Runnable() { public void run() { mProgressDialog.dismiss(); new AlertDialog.Builder(DownloaderSS.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(); } }); } } }.start(); } }).setNegativeButton(getString(R.string.no_text), null).show(); }
From source file:de.vanita5.twittnuker.fragment.support.UserListFragment.java
public void displayUserList(final ParcelableUserList userList) { if (userList == null || getActivity() == null) return;//from w ww . jav a2 s . c om getLoaderManager().destroyLoader(0); mErrorRetryContainer.setVisibility(View.GONE); mProgressContainer.setVisibility(View.GONE); mUserList = userList; mUserListDetails.drawEnd(getAccountColor(getActivity(), userList.account_id)); mListNameView.setText(userList.name); final String displayName = UserColorNameUtils.getDisplayName(getActivity(), userList.user_name, userList.user_screen_name); mCreatedByView.setText(getString(R.string.created_by, displayName)); final String description = userList.description; mDescriptionView.setVisibility(isEmpty(description) ? View.GONE : View.VISIBLE); mDescriptionView.setText(description); final TwidereLinkify linkify = new TwidereLinkify( new OnLinkClickHandler(getActivity(), getMultiSelectManager())); linkify.applyAllLinks(mDescriptionView, userList.account_id, false); mDescriptionView.setMovementMethod(LinkMovementMethod.getInstance()); mProfileImageLoader.displayProfileImage(mProfileImageView, userList.user_profile_image_url); invalidateOptionsMenu(); }
From source file:com.tweetlanes.android.core.view.ProfileFragment.java
void configureView() { TextView fullNameTextView = (TextView) mProfileView.findViewById(R.id.fullNameTextView); TextView followingTextView = (TextView) mProfileView.findViewById(R.id.followState); TextView descriptionTextView = (TextView) mProfileView.findViewById(R.id.bioTextView); TextView tweetCount = (TextView) mProfileView.findViewById(R.id.tweetCountLabel); TextView followingCount = (TextView) mProfileView.findViewById(R.id.followingCountLabel); TextView followersCount = (TextView) mProfileView.findViewById(R.id.followersCountLabel); TextView favoritesCount = (TextView) mProfileView.findViewById(R.id.favorites_count); LinearLayout linkLayout = (LinearLayout) mProfileView.findViewById(R.id.linkLayout); TextView link = (TextView) mProfileView.findViewById(R.id.link); LinearLayout locationLayout = (LinearLayout) mProfileView.findViewById(R.id.locationLayout); TextView location = (TextView) mProfileView.findViewById(R.id.location); LinearLayout detailsLayout = (LinearLayout) mProfileView.findViewById(R.id.detailsLayout); ImageView privateAccountImage = (ImageView) mProfileView.findViewById(R.id.private_account_image); mFriendshipButton = (Button) mProfileView.findViewById(R.id.friendship_button); mFriendshipDivider = mProfileView.findViewById(R.id.friendship_divider); if (mUser != null) { ImageView avatar = (ImageView) mProfileView.findViewById(R.id.profileImage); // String imageUrl = // TwitterManager.getProfileImageUrl(mUser.getScreenName(), // TwitterManager.ProfileImageSize.ORIGINAL); String imageUrl = mUser.getProfileImageUrl(TwitterManager.ProfileImageSize.ORIGINAL); UrlImageViewHelper.setUrlDrawable(avatar, imageUrl, R.drawable.ic_contact_picture); // avatar.setImageURL(imageUrl); ImageView coverImage = (ImageView) mProfileView.findViewById(R.id.coverImage); if (coverImage != null) { String url = mUser.getCoverImageUrl(); if (url != null) { UrlImageViewHelper.setUrlDrawable(coverImage, url, R.drawable.ic_contact_picture); }//from www . j a v a2 s .c o m } fullNameTextView.setText(mUser.getName()); if (mFollowsLoggedInUser != null && mFollowsLoggedInUser.booleanValue()) { followingTextView.setText(R.string.follows_you); } else { followingTextView.setText(null); } String description = mUser.getDescription(); URLEntity[] urlEntities = mUser.getUrlEntities(); if (description != null) { String descriptionMarkup = TwitterUtil.getTextMarkup(description, urlEntities); descriptionTextView.setText(Html.fromHtml(descriptionMarkup + " ")); descriptionTextView.setMovementMethod(LinkMovementMethod.getInstance()); URLSpanNoUnderline.stripUnderlines(descriptionTextView); } if (mUser.getUrl() != null) { linkLayout.setVisibility(View.VISIBLE); String urlMarkup = TwitterUtil.getTextMarkup(mUser.getUrl(), urlEntities); link.setText(Html.fromHtml(urlMarkup + "")); link.setMovementMethod(LinkMovementMethod.getInstance()); URLSpanNoUnderline.stripUnderlines(link); } else { linkLayout.setVisibility(View.GONE); } detailsLayout.setVisibility(View.VISIBLE); privateAccountImage.setVisibility(mUser.getProtected() ? View.VISIBLE : View.GONE); tweetCount.setText(Util.getPrettyCount(mUser.getStatusesCount())); followingCount.setText(Util.getPrettyCount(mUser.getFriendsCount())); followersCount.setText(Util.getPrettyCount(mUser.getFollowersCount())); if (favoritesCount != null) { favoritesCount.setText(Util.getPrettyCount(mUser.getFavoritesCount())); } if (mUser.getLocation() != null) { locationLayout.setVisibility(View.VISIBLE); location.setText(mUser.getLocation()); } else { locationLayout.setVisibility(View.GONE); } configureFriendshipButtonVisibility(mLoggedInUserFollows); } else { fullNameTextView.setText(null); followingTextView.setText(null); descriptionTextView.setText(null); detailsLayout.setVisibility(View.GONE); linkLayout.setVisibility(View.GONE); locationLayout.setVisibility(View.GONE); mFriendshipButton.setVisibility(View.GONE); mFriendshipDivider.setVisibility(View.GONE); privateAccountImage.setVisibility(View.GONE); } }
From source file:com.androzic.vnspeech.MapFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.e(TAG, "onCreateView()"); View view = inflater.inflate(R.layout.fragment_map, container, false); coordinates = (TextView) view.findViewById(R.id.coordinates); satellites = (TextView) view.findViewById(R.id.sats); currentFile = (TextView) view.findViewById(R.id.currentfile); mapLicense = (TextView) view.findViewById(R.id.maplicense); mapLicense.setClickable(true);//from ww w.j av a 2 s .c o m mapLicense.setMovementMethod(LinkMovementMethod.getInstance()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mapLicense.setRotation(-90); mapLicense.setPivotX(0); mapLicense.setPivotY(0); } mapZoom = (TextView) view.findViewById(R.id.currentzoom); waypointName = (TextView) view.findViewById(R.id.waypointname); waypointExtra = (TextView) view.findViewById(R.id.waypointextra); routeName = (TextView) view.findViewById(R.id.routename); routeExtra = (TextView) view.findViewById(R.id.routeextra); speedValue = (TextView) view.findViewById(R.id.speed); speedUnit = (TextView) view.findViewById(R.id.speedunit); trackValue = (TextView) view.findViewById(R.id.track); trackUnit = (TextView) view.findViewById(R.id.trackunit); elevationValue = (TextView) view.findViewById(R.id.elevation); elevationUnit = (TextView) view.findViewById(R.id.elevationunit); distanceValue = (TextView) view.findViewById(R.id.distance); distanceUnit = (TextView) view.findViewById(R.id.distanceunit); xtkValue = (TextView) view.findViewById(R.id.xtk); xtkUnit = (TextView) view.findViewById(R.id.xtkunit); bearingValue = (TextView) view.findViewById(R.id.bearing); bearingUnit = (TextView) view.findViewById(R.id.bearingunit); turnValue = (TextView) view.findViewById(R.id.turn); turnUnit = (TextView) view.findViewById(R.id.turnunit); // trackBar = (SeekBar) findViewById(R.id.trackbar); mapInfo = view.findViewById(R.id.mapinfo); satInfo = view.findViewById(R.id.satinfo); navInfo = view.findViewById(R.id.navinfo); mapButtons = view.findViewById(R.id.mapbuttons); waitBar = (TextView) view.findViewById(R.id.waitbar); anchor = view.findViewById(R.id.anchor); map = (MapView) view.findViewById(R.id.mapview); map.initialize(application, this); view.findViewById(R.id.zoomin).setOnClickListener(this); view.findViewById(R.id.zoomin).setOnTouchListener(this); view.findViewById(R.id.zoomout).setOnClickListener(this); view.findViewById(R.id.nextmap).setOnClickListener(this); view.findViewById(R.id.prevmap).setOnClickListener(this); coordinates.setOnClickListener(this); satellites.setOnClickListener(this); currentFile.setOnClickListener(this); mapZoom.setOnClickListener(this); waypointName.setOnClickListener(this); // set route edit button actions view.findViewById(R.id.finishrouteedit).setOnClickListener(this); view.findViewById(R.id.addpoint).setOnClickListener(this); view.findViewById(R.id.insertpoint).setOnClickListener(this); view.findViewById(R.id.removepoint).setOnClickListener(this); view.findViewById(R.id.orderpoints).setOnClickListener(this); application.setMapHolder(this); return view; }
From source file:cn.count.easydrive366.user.SettingsFragment.java
private void init_view() { containerView.findViewById(R.id.row_profile).setOnClickListener(new OnClickListener() { @Override/*from ww w .j a v a 2 s . co m*/ public void onClick(View v) { open_my_profile(); } }); containerView.findViewById(R.id.row_order).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_my_order(); } }); containerView.findViewById(R.id.row_favorite).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_my_favor(); } }); containerView.findViewById(R.id.row_histroy).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_my_histroy(); } }); containerView.findViewById(R.id.row_resetpassword).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { changePassword(); } }); containerView.findViewById(R.id.row_maintain).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // setup_maintain(); get(AppSettings.url_for_get_maintain_record(), 2); } }); containerView.findViewById(R.id.row_setup).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { register_step(); } }); containerView.findViewById(R.id.row_driver).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // setup_driver(); get(AppSettings.url_get_driver_license(), 3); } }); containerView.findViewById(R.id.row_car).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // setup_car_registration(); get(AppSettings.url_get_car_registration(), 4); } }); containerView.findViewById(R.id.row_choose_cellphone).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // start activity bindcellphone Intent intent = new Intent(SettingsFragment.this.getActivity(), BindCellphoneActivity.class); intent.putExtra("phone", _cellphone); intent.putExtra("isbind", _isbind); startActivityForResult(intent, BINDCELLPHONE); } }); containerView.findViewById(R.id.row_choose_check_version).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new CheckUpdate(SettingsFragment.this.getActivity(), true); } }); containerView.findViewById(R.id.row_choose_findpassword).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { reset_password(); } }); containerView.findViewById(R.id.row_choose_user_feedback).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { user_feedback(); } }); containerView.findViewById(R.id.row_card).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { check_activate_code(); } }); containerView.findViewById(R.id.txt_bound).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_bound(); } }); containerView.findViewById(R.id.btn_pay).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_pay(); } }); containerView.findViewById(R.id.btn_insurance).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_insurance(); } }); containerView.findViewById(R.id.btn_task).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_task(); } }); containerView.findViewById(R.id.btn_friend).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_friend(); } }); /* * findViewById(R.id.row_cardview).setOnClickListener(new * OnClickListener(){ * * @Override public void onClick(View v) { cardView(); }}); * findViewById(R.id.row_cardadd).setOnClickListener(new * OnClickListener(){ * * @Override public void onClick(View v) { cardAdd(); * * }}); */ txtNickname = (TextView) containerView.findViewById(R.id.txt_nickname); txtSignature = (TextView) containerView.findViewById(R.id.txt_signature); txtBound = (TextView) containerView.findViewById(R.id.txt_bound); txtBound.setMovementMethod(LinkMovementMethod.getInstance()); txtExp = (TextView) containerView.findViewById(R.id.txt_exp); imgAvater = (ImageView) containerView.findViewById(R.id.img_picture); pbExp = (ProgressBar) containerView.findViewById(R.id.pb_exp); txtBind = (TextView) containerView.findViewById(R.id.txt_bindCellphone); txtVersion = (TextView) containerView.findViewById(R.id.txt_version); txtCellphone = (TextView) containerView.findViewById(R.id.img_choose_cellphone); // txtActivate_code = (TextView)findViewById(R.id.txt_activate_code); txtVersion.setText(String.format("V%s >", AppSettings.version)); this.logoutButton = (Button) containerView.findViewById(R.id.btn_logout); logoutButton.setText(String.format("-%s", AppSettings.username)); containerView.findViewById(R.id.btn_logout).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { logout(); } }); imgAvater.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { openSetupUser(); } }); // this.get(AppSettings.url_get_user_phone(), 1); // this.get(AppSettings.url_get_activate_code(), 11,""); load_user_profile(); }
From source file:com.limewoodmedia.nsdroid.activities.Nation.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.nation);//from w ww. ja v a2 s.c om imageLoader = Utils.getImageLoader(this); this.options = Utils.getImageLoaderDisplayOptions(); // Fetch flag LoadingHelper.loadHomeFlag(this); ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); Utils.setupNavigationDrawer(this); viewPager = (ViewPager) findViewById(R.id.pager); // Overview overview = (RelativeLayout) getLayoutInflater().inflate(R.layout.nation_overview, viewPager, false); layout = (ViewGroup) overview.findViewById(R.id.nation_layout); banner = (BannerView) overview.findViewById(R.id.nation_banner); flag = (BannerView) overview.findViewById(R.id.nation_flag); pretitle = (TextView) overview.findViewById(R.id.nation_pretitle); name = (TextView) overview.findViewById(R.id.nation_name); motto = (TextView) overview.findViewById(R.id.nation_motto); region = (TextView) overview.findViewById(R.id.nation_region); region.setMovementMethod(LinkMovementMethod.getInstance()); waStatus = (TextView) overview.findViewById(R.id.nation_wa_status); influence = (TextView) overview.findViewById(R.id.nation_influence); endorsed = (TextView) overview.findViewById(R.id.nation_endorsed); category = (TextView) overview.findViewById(R.id.nation_category); civilRights = (FreedomView) overview.findViewById(R.id.nation_civil_rights); economicStrength = (FreedomView) overview.findViewById(R.id.nation_economy); politicalFreedoms = (FreedomView) overview.findViewById(R.id.nation_political_freedoms); description = (TextView) overview.findViewById(R.id.nation_description); endorsements = (TextView) overview.findViewById(R.id.nation_endorsements); censusTitle = (TextView) overview.findViewById(R.id.census_title); worldRank = (CensusView) overview.findViewById(R.id.world_rank); regionRank = (CensusView) overview.findViewById(R.id.region_rank); setUpChartRenderer(peopleRenderer); setUpChartRenderer(governmentRenderer); setUpChartRenderer(economyRenderer); // People people = (RelativeLayout) getLayoutInflater().inflate(R.layout.nation_people, viewPager, false); peopleLegend = (TextView) people.findViewById(R.id.people_legend); // Government government = (RelativeLayout) getLayoutInflater().inflate(R.layout.nation_government, viewPager, false); governmentTitle = (TextView) government.findViewById(R.id.government_title); governmentSize = (TextView) government.findViewById(R.id.government_size); governmentPercent = (TextView) government.findViewById(R.id.government_percent); governmentLegend = (TextView) government.findViewById(R.id.government_legend); // Economy economy = (RelativeLayout) getLayoutInflater().inflate(R.layout.nation_economy, viewPager, false); economyTitle = (TextView) economy.findViewById(R.id.economy_title); economyGDP = (TextView) economy.findViewById(R.id.economy_gdp); economyGDPPC = (TextView) economy.findViewById(R.id.economy_gdppc); economyPoorest = (TextView) economy.findViewById(R.id.economy_poorest); economyRichest = (TextView) economy.findViewById(R.id.economy_richest); economyLegend = (TextView) economy.findViewById(R.id.economy_legend); // Set up view pager viewPager.setAdapter(new NationPagerAdapter()); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { // Update context menu supportInvalidateOptionsMenu(); } @Override public void onPageScrollStateChanged(int state) { } }); Log.d(TAG, "DATA " + getIntent().getDataString()); if (getIntent().getData() == null && !getIntent().hasExtra("nation")) { nation = NationInfo.getInstance(this).getId(); myNation = true; } else if (getIntent().hasExtra("nation")) { nation = getIntent().getStringExtra("nation"); myNation = nation.equals(NationInfo.getInstance(this).getId()); } else { nation = getIntent().getDataString().replace("com.limewoodMedia.nsdroid.nation://", ""); myNation = nation.equals(NationInfo.getInstance(this).getId()); } // if(savedInstanceState == null) { loadNation(); // } else { // // Restore // data = savedInstanceState.getParcelable("nation_data"); // doSetup(); // } }
From source file:cn.wjh1119.bestnews.ui.fragment.DetailFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (data != null && data.moveToFirst()) { //?????view FetchDetailDataFromSqlTask fetchDetailDataFromSqlTask = new FetchDetailDataFromSqlTask(); fetchDetailDataFromSqlTask//ww w. ja v a 2s.c om .setOnDataFinishedListener(new FetchDetailDataFromSqlTask.OnDataFinishedListener() { @Override public void onDataSuccessfully(HashMap data) { String title = data.get("title").toString(); String source = data.get("source").toString(); String pubDate = data.get("pubDate").toString(); String content = data.get("content").toString(); String link = data.get("link").toString(); // BitmapDrawable drawable = (BitmapDrawable) data.get("drawable"); Object imageTextFromSql = data.get("imageUrl"); String imageUrl = null; if (imageTextFromSql != null) { imageUrl = data.get("imageUrl").toString(); } mTitleView.setText(title); mTitleView.setFocusable(true); mTitleView.setFocusableInTouchMode(true); mTitleView.requestFocus(); TextPaint paint = mTitleView.getPaint(); paint.setFakeBoldText(true); mSourceView.setText(source); mPubDateView.setText(pubDate); mContentView.setText(content); if (imageUrl != null) { Bitmap bitmap = imageManager.showCacheBitmap(imageUrl); if (bitmap != null) { mImageView.setImageBitmap(bitmap); } else { imageManager.downloadImage(imageUrl, new ImageManager.onImageLoaderListener() { @Override public void onImageLoader(Bitmap bitmap, String url) { if (bitmap != null) { mImageView.setImageBitmap(bitmap); } else { mImageView.setImageResource(R.mipmap.picture_fail_loading); } } }); } } SpannableStringBuilder ssb = new SpannableStringBuilder("??"); ssb.setSpan(new URLSpan(link), 0, ssb.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); ForegroundColorSpan span = new ForegroundColorSpan(Color.BLUE); ssb.setSpan(span, 0, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mLinkView.setText(ssb); // ??MovementMethod mLinkView.setMovementMethod(LinkMovementMethod.getInstance()); // ??ClickableSpan mLinkView.setHighlightColor(0xff8FABCC); } @Override public void onDataFailed() { } }); fetchDetailDataFromSqlTask.execute(data); } AppCompatActivity activity = (AppCompatActivity) getActivity(); Toolbar toolbarView = (Toolbar) getView().findViewById(R.id.toolbar_detail); // We need to start the enter transition after the data has loaded if (mTransitionAnimation) { activity.supportStartPostponedEnterTransition(); if (null != toolbarView) { activity.setSupportActionBar(toolbarView); activity.getSupportActionBar().setDisplayShowTitleEnabled(false); activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); } } else { if (null != toolbarView) { Menu menu = toolbarView.getMenu(); if (null != menu) menu.clear(); } } }
From source file:dev.drsoran.moloko.util.UIUtils.java
public final static void makeLink(TextView textView, Spannable text, ClickableSpan onClickHandler) { if (onClickHandler != null) { text.setSpan(onClickHandler, 0, text.length(), 0); }/*w w w. ja v a2 s . c o m*/ textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setText(text, BufferType.SPANNABLE); }