List of usage examples for android.text.method LinkMovementMethod getInstance
public static MovementMethod getInstance()
From source file:eu.iescities.pilot.rovereto.roveretoexplorer.fragments.event.info.EventDetailInfoAdapter.java
@SuppressWarnings("deprecation") @Override/* w ww . ja v a2 s . c o m*/ public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parentView) { final EventInfoParent parent = this.fragment.parents.get(groupPosition); final EventInfoChild child = parent.getChildren().get(childPosition); int itemType = getChildType(groupPosition, childPosition); Log.i("GROUPVIEW", "************ init child view!! ************ "); Log.i("GROUPVIEW", "COUNT: " + countChildViewCall); Log.i("GROUPVIEW", "CHILD TEXT: " + child.getText()); Log.i("GROUPVIEW", "CHILD TYPE: " + child.getType()); row = convertView; if (row == null) { // Inflate event_info_child_item.xml file for child rows LayoutInflater inflater = (LayoutInflater) this.fragment.context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(R.layout.event_info_child_item, parentView, false); eventChildViewHolder = new EventInfoChildViewHolder(); eventChildViewHolder.text = (TextView) row.findViewById(R.id.event_info_attribute_values); // eventChildViewHolder.imgSx = (ImageView) row // .findViewById(R.id.event_info_attribute_value_icon); eventChildViewHolder.imgsDx1 = (ImageView) row.findViewById(R.id.event_info_action1); eventChildViewHolder.divider = (View) row.findViewById(R.id.event_info_item_divider); //this will be added again when it will be possible to cancel/edit the single items // eventChildViewHolder.imgsDx2 = (ImageView) row // .findViewById(R.id.event_info_action2); // eventChildViewHolder.imgsDx3 = (ImageView) row // .findViewById(R.id.event_info_action3); row.setTag(eventChildViewHolder); } else { eventChildViewHolder = (EventInfoChildViewHolder) row.getTag(); } // Get event_info_child_item.xml file elements and set values if (child.getTextInBold()) eventChildViewHolder.text.setTypeface(null, Typeface.BOLD); else eventChildViewHolder.text.setTypeface(null, Typeface.NORMAL); if (!child.getText().contains("http")) { eventChildViewHolder.text.setText(child.getText()); } else { if (!child.getText().matches(fragment.getString(R.string.start_url))) { Log.i("GROUPVIEW", "make the text part clickable!!!"); //make the text part clickable int i1 = 0; int i2 = child.getName().length() - 1; eventChildViewHolder.text.setMovementMethod(LinkMovementMethod.getInstance()); eventChildViewHolder.text.setText(child.getName(), BufferType.SPANNABLE); //eventChildViewHolder.text.setAutoLinkMask(Linkify.WEB_URLS); //Linkify.addLinks(eventChildViewHolder.text, Linkify.WEB_URLS); //String s = "<a href=\" + child.getText() + \">Website</a>"; //eventChildViewHolder.text.setText(Html.fromHtml(s)); Spannable mySpannable = (Spannable) eventChildViewHolder.text.getText(); ClickableSpan myClickableSpan = new ClickableSpan() { @Override public void onClick(View widget) { // Toast.makeText(fragment.context, // "Open browser ofr url: " + child.getText(), // Toast.LENGTH_LONG).show(); String url = child.getText(); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); fragment.context.startActivity(i); } }; // row.setFocusable(true); // row.setFocusableInTouchMode(true); mySpannable.setSpan(myClickableSpan, i1, i2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // eventChildViewHolder.text.setText(Html.fromHtml(child.getText())); // eventChildViewHolder.text.setMovementMethod(LinkMovementMethod.getInstance()); } else eventChildViewHolder.text.setText(child.getName()); } if (child.getName().equals("Description")) { //Log.i("EVENT", "EventDetailInfoAdapter --> set description to html!!"); eventChildViewHolder.text.setText(Html.fromHtml(child.getText())); eventChildViewHolder.text.setPadding(10, 10, 0, 0); } // set icon on the left side // if (child.getLeftIconId() != -1) { // Log.i("GROUPVIEW", "CHILD SX ICON ID: " + child.getLeftIconId()); // eventChildViewHolder.imgSx.setVisibility(View.VISIBLE); // eventChildViewHolder.imgSx.setImageResource(child.getLeftIconId()); // // Log.i("IMAGE", "IMG CHILD NAME: " // + child.getText()); // // Log.i("IMAGE", "IMG ICON WIDTH: " // + eventChildViewHolder.imgSx.getWidth()); // // } else { // Log.i("GROUPVIEW", "CHILD SX ICON -1"); // if ( (child.getName().equals("email")) || (child.getName().equals("tel")) ){ // Log.i("GROUPVIEW", "CHILD NAME: " + child.getName()); // eventChildViewHolder.imgSx.setVisibility(View.INVISIBLE); // eventChildViewHolder.text.setPadding(10, 0, 0, 0); // } // else{ // eventChildViewHolder.imgSx.setVisibility(View.GONE); // eventChildViewHolder.text.setPadding(10, 10, 0, 0); // } // // } // set icon on the left side if (child.getLeftIconId() != -1) { Log.i("GROUPVIEW", "CHILD SX ICON ID: " + child.getLeftIconId()); eventChildViewHolder.text.setCompoundDrawablesWithIntrinsicBounds(child.getLeftIconId(), 0, 0, 0); } else eventChildViewHolder.text.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); // set icons on the right side for the items of type 1 (telefono, email) if ((child.getRightIconIds() != null) && (child.getType() == 1)) { Log.i("GROUPVIEW", "CHILD DX1 ICON ID: " + child.getRightIconIds()[0]); eventChildViewHolder.text.setTypeface(null, Typeface.BOLD); eventChildViewHolder.imgsDx1.setVisibility(View.VISIBLE); eventChildViewHolder.imgsDx1.setImageResource(child.getRightIconIds()[0]); eventChildViewHolder.imgsDx1 .setOnClickListener(new ChildAddIconClickListener(this.fragment.context, child)); } else { Log.i("GROUPVIEW", "CHILD DX1 ICON NULL"); eventChildViewHolder.imgsDx1.setVisibility(View.INVISIBLE); } //set divider line height and color eventChildViewHolder.divider.setBackgroundColor(fragment.getResources().getColor(child.getDividerColor())); eventChildViewHolder.divider.setLayoutParams( new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, child.getDividerHeight())); // set icons on the right side for the items of type 0 (single values) if ((child.getRightIconIds() != null) && (child.getType() == 0)) { Log.i("GROUPVIEW", "CHILD DX1 ICON ID: " + child.getRightIconIds()[0]); int iconsNumb = child.getRightIconIds().length; Log.i("GROUPVIEW", "ICON NUMMBER: " + iconsNumb); eventChildViewHolder.imgsDx1.setVisibility(View.VISIBLE); eventChildViewHolder.imgsDx1.setImageResource(child.getRightIconIds()[0]); eventChildViewHolder.imgsDx1 .setOnClickListener(new ChildActionIconClickListener(this.fragment.context, child)); //this will be added when cancel/edit for single item will be possible // eventChildViewHolder.imgsDx2.setVisibility(View.VISIBLE); // eventChildViewHolder.imgsDx2.setImageResource(child // .getRightIconIds()[1]); // if (iconsNumb == 3) // eventChildViewHolder.imgsDx3.setVisibility(View.VISIBLE); // eventChildViewHolder.imgsDx3.setImageResource(child // .getRightIconIds()[2]); } else { Log.i("GROUPVIEW", "CHILD DX1 ICON NULL"); eventChildViewHolder.imgsDx1.setVisibility(View.INVISIBLE); //this will be added when cancel/edit for single item will be possible // eventChildViewHolder.imgsDx2.setVisibility(View.INVISIBLE); // eventChildViewHolder.imgsDx3.setVisibility(View.INVISIBLE); } // Log.i("GROUPVIEW", "child view: group POS: " + groupPosition + "!!"); // Log.i("GROUPVIEW", "child view: child POS: " + childPosition + "!!"); countChildViewCall++; return row; }
From source file:com.adkdevelopment.e_contact.PagerActivity.java
/** * Initialises Navigation Drawer and adds links movement to the footer * sets listener on an item click in the Drawer *//*from w w w. j a v a 2 s . co m*/ private void initNavigationDrawer() { // Make links work in the Drawer mFooterLinks.setMovementMethod(LinkMovementMethod.getInstance()); // add listener to the buttons in the navigation drawer mNavigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem item) { if (item.getItemId() == R.id.drawer_map) { item.setChecked(false); mDrawerLayout.closeDrawers(); if (Utilities.checkPlayServices(PagerActivity.this)) { Intent intent = new Intent(PagerActivity.this, MapsActivity.class); startActivity(intent); return true; } else { item.setChecked(false); return true; } } else { item.setChecked(true); mDrawerLayout.closeDrawers(); return true; } } }); }
From source file:com.syncedsynapse.kore2.ui.hosts.AddHostFragmentZeroconf.java
/** * Found hosts, present them//from w ww . jav a 2 s. c o m * @param serviceInfos Service infos found */ public void foundHosts(final ServiceInfo[] serviceInfos) { LogUtils.LOGD(TAG, "Found hosts: " + serviceInfos.length); titleTextView.setText(R.string.xbmc_found); messageTextView.setText(Html.fromHtml(getString(R.string.wizard_search_host_found))); messageTextView.setMovementMethod(LinkMovementMethod.getInstance()); nextButton.setVisibility(View.VISIBLE); nextButton.setText(R.string.next); nextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.onAddHostZeroconfNoHost(); } }); previousButton.setVisibility(View.VISIBLE); previousButton.setText(R.string.search_again); previousButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startSearching(); } }); progressBar.setVisibility(View.GONE); hostListGridView.setVisibility(View.VISIBLE); HostListAdapter adapter = new HostListAdapter(getActivity(), R.layout.grid_item_host, serviceInfos); hostListGridView.setAdapter(adapter); hostListGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long itemId) { ServiceInfo selectedServiceInfo = serviceInfos[position]; String hostName = selectedServiceInfo.getName(); String hostAddress = selectedServiceInfo.getHostAddresses()[0]; int hostHttpPort = selectedServiceInfo.getPort(); HostInfo selectedHostInfo = new HostInfo(hostName, hostAddress, hostHttpPort, HostInfo.DEFAULT_TCP_PORT, null, null); listener.onAddHostZeroconfFoundHost(selectedHostInfo); } }); }
From source file:busradar.madison.StopDialog.java
StopDialog(final Context ctx, final int stopid, final int lat, final int lon) { super(ctx);/* ww w .j av a 2 s . co m*/ this.stopid = stopid; // getWindow().requestFeature(Window.FEATURE_LEFT_ICON); getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); final String name = DB.getStopName(stopid); setTitle(name); routes = get_time_urls(StopDialog.this.stopid); // getWindow().setLayout(LayoutParams.FILL_PARENT, // LayoutParams.FILL_PARENT); setContentView(new RelativeLayout(ctx) { { addView(new TextView(ctx) { { setId(stop_num_id); setText(Html.fromHtml(String.format( "[<a href='http://www.cityofmadison.com/metro/BusStopDepartures/StopID/%04d.pdf'>%04d</a>]", stopid, stopid))); setPadding(0, 0, 5, 0); this.setMovementMethod(LinkMovementMethod.getInstance()); } }, new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT) { { addRule(ALIGN_PARENT_RIGHT); } }); addView(new ImageView(ctx) { boolean enabled; @Override public void setEnabled(boolean e) { enabled = e; setImageResource(e ? R.drawable.love_enabled : R.drawable.love_disabled); if (e) { G.favorites.add_favorite_stop(stopid, name, lat, lon); Toast.makeText(ctx, "Added stop to Favorites", Toast.LENGTH_SHORT).show(); } else { G.favorites.remove_favorite_stop(stopid); Toast.makeText(ctx, "Removed stop from Favorites", Toast.LENGTH_SHORT).show(); } } { enabled = G.favorites.is_stop_favorite(stopid); setImageResource(enabled ? R.drawable.love_enabled : R.drawable.love_disabled); setPadding(0, 0, 10, 0); setOnClickListener(new OnClickListener() { public void onClick(View v) { setEnabled(!enabled); } }); } }, new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT) { { addRule(LEFT_OF, stop_num_id); setMargins(0, -3, 0, 0); } }); addView(cur_loading_text = new TextView(ctx) { { setText("Loading..."); setPadding(5, 0, 0, 0); } }); addView(new HorizontalScrollView(ctx) { { setId(route_list_id); setHorizontalScrollBarEnabled(false); addView(new LinearLayout(ctx) { float text_size; Button cur_button; { int last_route = -1; for (int i = 0; i < routes.length; i++) { final RouteURL route = routes[i]; if (route.route == last_route) continue; last_route = route.route; addView(new Button(ctx) { public void setEnabled(boolean e) { if (e) { setBackgroundColor(0xff000000 | G.route_points[route.route].color); setTextSize(TypedValue.COMPLEX_UNIT_PX, text_size * 1.5f); } else { setBackgroundColor(0x90000000 | G.route_points[route.route].color); setTextSize(TypedValue.COMPLEX_UNIT_PX, text_size); } } { setText(G.route_points[route.route].name); setTextColor(0xffffffff); setTypeface(Typeface.DEFAULT_BOLD); text_size = getTextSize(); if (G.active_route == route.route) { setEnabled(true); cur_button = this; } else setEnabled(false); final Button b = this; setOnClickListener(new OnClickListener() { public void onClick(View v) { if (cur_button != null) { cur_button.setEnabled(false); } if (cur_button == b) { cur_button.setEnabled(false); cur_button = null; selected_route = null; update_time_display(); } else { cur_button = b; cur_button.setEnabled(true); selected_route = route; update_time_display(); } } }); } }); } } }); } }, new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) { { addRule(RelativeLayout.BELOW, stop_num_id); addRule(RelativeLayout.CENTER_HORIZONTAL); } }); addView(status_text = new TextView(ctx) { { setText(""); } }, new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) { { addRule(RelativeLayout.BELOW, route_list_id); addRule(RelativeLayout.CENTER_HORIZONTAL); } }); addView(list_view = new ListView(ctx) { { setId(time_list_id); setVerticalScrollBarEnabled(false); setAdapter(times_adapter = new BaseAdapter() { public View getView(final int position, View convertView, ViewGroup parent) { CellView v; if (convertView == null) v = new CellView(ctx); else v = (CellView) convertView; RouteTime rt = curr_times.get(position); v.setBackgroundColor(G.route_points[rt.route].color | 0xff000000); v.route_textview.setText(G.route_points[rt.route].name); if (rt.dir != null) v.dir_textview.setText("to " + rt.dir); v.time_textview.setText(rt.time); return v; } public int getCount() { return curr_times.size(); } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } }); } }, new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT) { { addRule(RelativeLayout.BELOW, route_list_id); } }); } }); TextView title = (TextView) findViewById(android.R.id.title); title.setEllipsize(TextUtils.TruncateAt.MARQUEE); title.setSelected(true); title.setTextColor(0xffffffff); title.setMarqueeRepeatLimit(-1); // getWindow().set, value) // getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, // android.R.drawable.ic_dialog_info); // title.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.CENTER_VERTICAL); if (G.active_route >= 0) for (int i = 0; i < routes.length; i++) if (routes[i].route == G.active_route) { selected_route = routes[i]; RouteURL[] rnew = new RouteURL[routes.length]; rnew[0] = selected_route; for (int j = 0, k = 1; j < routes.length; j++) if (j != i) rnew[k++] = routes[j]; routes = rnew; break; } update_time_display(); }
From source file:com.tweetlanes.android.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 = (View) 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); }/* w w w . jav a 2s . co m*/ } fullNameTextView.setText(mUser.getName()); if (mFollowsLoggedInUser != null && mFollowsLoggedInUser.booleanValue() == true) { followingTextView.setText(R.string.follows_you); } else { followingTextView.setText(null); } String description = mUser.getDescription(); if (description != null) { String descriptionMarkup = TwitterUtil.getTextMarkup(description); descriptionTextView.setText(Html.fromHtml(descriptionMarkup + " ")); descriptionTextView.setMovementMethod(LinkMovementMethod.getInstance()); URLSpanNoUnderline.stripUnderlines(descriptionTextView); } 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.getUrl() != null) { linkLayout.setVisibility(View.VISIBLE); //link.setText(mUser.getUrl()); //URLSpanNoUnderline.stripUnderlines(link); link.setText(Html.fromHtml("<a href=\"" + mUser.getUrl() + "\">" + mUser.getUrl() + "</a>")); link.setMovementMethod(LinkMovementMethod.getInstance()); URLSpanNoUnderline.stripUnderlines(link); } else { linkLayout.setVisibility(View.GONE); } if (mUser.getLocation() != null) { locationLayout.setVisibility(View.VISIBLE); location.setText(mUser.getLocation()); } else { locationLayout.setVisibility(View.GONE); } configureFriendshipButtonVisibility(mLoggedInUserFollows); getBaseLaneActivity().setComposeTweetDefault(); } 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.shafiq.mytwittle.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 = (View) 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); }//w ww. j a va 2 s .c o m } fullNameTextView.setText(mUser.getName()); if (mFollowsLoggedInUser != null && mFollowsLoggedInUser.booleanValue() == true) { followingTextView.setText(R.string.follows_you); } else { followingTextView.setText(null); } String description = mUser.getDescription(); if (description != null) { String descriptionMarkup = TwitterUtil.getTextMarkup(description); descriptionTextView.setText(Html.fromHtml(descriptionMarkup + " ")); descriptionTextView.setMovementMethod(LinkMovementMethod.getInstance()); URLSpanNoUnderline.stripUnderlines(descriptionTextView); } 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.getUrl() != null) { linkLayout.setVisibility(View.VISIBLE); // link.setText(mUser.getUrl()); // URLSpanNoUnderline.stripUnderlines(link); link.setText(Html.fromHtml("<a href=\"" + mUser.getUrl() + "\">" + mUser.getUrl() + "</a>")); link.setMovementMethod(LinkMovementMethod.getInstance()); URLSpanNoUnderline.stripUnderlines(link); } else { linkLayout.setVisibility(View.GONE); } if (mUser.getLocation() != null) { locationLayout.setVisibility(View.VISIBLE); location.setText(mUser.getLocation()); } else { locationLayout.setVisibility(View.GONE); } configureFriendshipButtonVisibility(mLoggedInUserFollows); getBaseLaneActivity().setComposeTweetDefault(); } 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:org.liberty.android.fantastischmemopro.downloader.DownloaderFE.java
@Override 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(//from w ww .j a v a 2 s . co m 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(DownloaderFE.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 = Environment.getExternalStorageDirectory() .getAbsolutePath() + getString(R.string.default_dir); new AlertDialog.Builder(DownloaderFE.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(DownloaderFE.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:gr.scify.newsum.ui.ViewActivity.java
protected void initGestures() { GestureOverlayView gestureOverlayView = new GestureOverlayView(this); View inflate = getLayoutInflater().inflate(R.layout.view, null); gestureOverlayView.addView(inflate); gestureOverlayView.addOnGesturePerformedListener(this); gestureOverlayView.setGestureColor(Color.TRANSPARENT); gestureOverlayView.setUncertainGestureColor(Color.TRANSPARENT); gestureLib = GestureLibraries.fromRawResource(this, R.raw.gestures); if (!gestureLib.load()) { finish();// w ww .j a v a 2 s. c o m } setContentView(gestureOverlayView); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title); ImageView title_image = (ImageView) findViewById(R.id.title_image); title_image.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.scify))); startActivity(browse); } }); // Allow links to be followed into browser final TextView tx = (TextView) findViewById(R.id.textView1); tx.setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.todoroo.astrid.taskrabbit.TaskRabbitActivity.java
public void showIntroDialog() { if (!Preferences.getBoolean(TASK_RABBIT_DIALOG_INTRO_PREF, false)) { if (TaskRabbitLocationManager.supportsCurrentLocation(currentLocation)) { AlertDialog.Builder adb = new AlertDialog.Builder(TaskRabbitActivity.this); adb.setTitle(R.string.tr_alert_intro_title); adb.setMessage(getString(R.string.tr_alert_intro_location)); adb.setPositiveButton(getString(R.string.tr_alert_button_close), new DialogInterface.OnClickListener() { public void onClick(final DialogInterface dialog, final int id) { showAddListPopover(); }/*from w ww . jav a 2 s . com*/ }); adb.show(); } else { final AlertDialog adb = new AlertDialog.Builder(TaskRabbitActivity.this) .setTitle(R.string.tr_alert_intro_title).setMessage(R.string.tr_alert_intro_no_location) .setPositiveButton(getString(R.string.tr_alert_button_close), null).show(); ((TextView) adb.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } Preferences.setBoolean(TASK_RABBIT_DIALOG_INTRO_PREF, true); } }