List of usage examples for android.text.util Linkify ALL
int ALL
To view the source code for android.text.util Linkify ALL.
Click Source Link
Note:
#MAP_ADDRESSES is deprecated.From source file:it.scoppelletti.mobilepower.app.MarketTagHandler.java
/** * Attiva la rilevazione dei collegamenti. * /*from w ww .jav a2s .c o m*/ * @param view Controllo. * @param pkgName Nome del pacchetto. */ public void addLinks(TextView view, String pkgName) { String text; if (myEndPos <= myStartPos || StringUtils.isBlank(pkgName)) { return; } myPkgName = pkgName; // http://www.indelible.org/ink/android-linkify, 09/04/2010 // La rilevazione dei collegamenti personalizzati e' attiva solo // disabilitando la rilevazione dei collegamenti di default e // riabilitandola attraverso la classe Linkify. view.setAutoLinkMask(0); Linkify.addLinks(view, Linkify.ALL); text = String.valueOf(view.getText().subSequence(myStartPos, myEndPos)); Linkify.addLinks(view, Pattern.compile(text), MarketTagHandler.SCHEME, this, this); }
From source file:com.tortel.deploytrack.dialog.AboutDialog.java
@NonNull @Override/*from ww w .jav a2s . c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { final Context wrappedContext = new ContextThemeWrapper(getActivity(), R.style.Theme_DeployThemeLight); MaterialDialog.Builder builder = new MaterialDialog.Builder(wrappedContext); LayoutInflater inflater = getActivity().getLayoutInflater().cloneInContext(wrappedContext); @SuppressLint("InflateParams") View view = inflater.inflate(R.layout.dialog_about, null); TextView text = (TextView) view.findViewById(R.id.about_view); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { text.setText(Html.fromHtml(readRawTextFile(getContent()), Html.FROM_HTML_MODE_LEGACY)); } else { //noinspection deprecation text.setText(Html.fromHtml(readRawTextFile(getContent()))); } Linkify.addLinks(text, Linkify.ALL); text.setMovementMethod(LinkMovementMethod.getInstance()); builder.customView(view, false); builder.title(getTitleString()); builder.positiveText(R.string.close); return builder.build(); }
From source file:com.chrulri.droidoflife.AboutDialogFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.about, container, false); TextView info = (TextView) v.findViewById(R.id.about_info); info.setText(infoText);/* w ww.ja va 2 s .c om*/ Linkify.addLinks(info, Linkify.ALL); TextView legal = (TextView) v.findViewById(R.id.about_legal); legal.setText(legalText); Linkify.addLinks(legal, Linkify.ALL); return v; }
From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.StatusObj.java
public void render(Context context, ViewGroup frame, Obj obj, boolean allowInteractions) { JSONObject content = obj.getJson();/* w w w . jav a 2 s. com*/ TextView valueTV = new TextView(context); valueTV.setText(content.optString(TEXT)); valueTV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); valueTV.setGravity(Gravity.TOP | Gravity.LEFT); if (Linkify.addLinks(valueTV, Linkify.ALL)) { if (!allowInteractions) valueTV.setMovementMethod(null); } frame.addView(valueTV); }
From source file:com.acrylicgoat.scrumnotes.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.activity_main); sharedPref = getSharedPreferences("com.acrylicgoat.scrumnotes", MODE_PRIVATE); if (savedInstanceState != null) { currentOwner = savedInstanceState.getString("currentOwner"); }//from w w w . j a va 2 s.c om if (currentOwner == null || currentOwner.equals("")) { currentOwner = sharedPref.getString("currentOwner", ""); } aBar = this.getActionBar(); today = (EditText) findViewById(R.id.editToday); today.setAutoLinkMask(Linkify.ALL); today.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { Linkify.addLinks(today, Linkify.ALL); } }); devName = (TextView) findViewById(R.id.devName); yesterday = (ImageButton) findViewById(R.id.calendarButton); yesterday.setOnClickListener(new OnClickListener() { public void onClick(View v) { displayPopup(); } }); String[] items = getResources().getStringArray(R.array.nav_list); setDrawer(items); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerList = (ListView) findViewById(R.id.left_drawer); SimpleAdapter sAdapter = new SimpleAdapter(this, navTitles, R.layout.nav_drawer, from, to); // Set the adapter for the list view //drawerList.setAdapter(new ArrayAdapter<String>(this,R.layout.drawer_list_item, navTitles)); // Set the list's click listener drawerList.setOnItemClickListener(new DrawerItemClickListener()); drawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ drawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle(getString(R.string.app_name)); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBar().setTitle(getString(R.string.app_name)); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; drawerToggle.setDrawerIndicatorEnabled(true); drawerToggle.syncState(); drawerLayout.setDrawerListener(drawerToggle); aBar.setTitle(getString(R.string.app_name)); //aBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); aBar.setDisplayHomeAsUpEnabled(true); aBar.setHomeButtonEnabled(true); drawerList.setAdapter(sAdapter); }
From source file:com.acrylicgoat.devchat.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.activity_main); sharedPref = getSharedPreferences("com.acrylicgoat.devchat", MODE_PRIVATE); if (savedInstanceState != null) { currentOwner = savedInstanceState.getString("currentOwner"); }/*from ww w .j a v a 2s . c o m*/ if (currentOwner == null || currentOwner.equals("")) { currentOwner = sharedPref.getString("currentOwner", ""); } aBar = this.getActionBar(); today = (EditText) findViewById(R.id.editToday); today.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { Linkify.addLinks(today, Linkify.ALL); } }); devName = (TextView) findViewById(R.id.devName); yesterday = (ImageButton) findViewById(R.id.calendarButton); yesterday.setOnClickListener(new OnClickListener() { public void onClick(View v) { displayPopup(); } }); String[] items = getResources().getStringArray(R.array.nav_list); setDrawer(items); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerList = (ListView) findViewById(R.id.left_drawer); SimpleAdapter sAdapter = new SimpleAdapter(this, navTitles, R.layout.nav_drawer, from, to); // Set the adapter for the list view //drawerList.setAdapter(new ArrayAdapter<String>(this,R.layout.drawer_list_item, navTitles)); // Set the list's click listener drawerList.setOnItemClickListener(new DrawerItemClickListener()); drawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ drawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle(getString(R.string.app_name)); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBar().setTitle(getString(R.string.app_name)); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; drawerToggle.setDrawerIndicatorEnabled(true); drawerToggle.syncState(); drawerLayout.setDrawerListener(drawerToggle); aBar.setTitle(getString(R.string.app_name)); //aBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); aBar.setDisplayHomeAsUpEnabled(true); aBar.setHomeButtonEnabled(true); drawerList.setAdapter(sAdapter); }
From source file:com.jbirdvegas.mgerrit.cards.PatchSetCommentsCard.java
public View setViewValue(Cursor cursor, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(R.layout.commit_comment, parent, false); }//from w w w . j av a 2 s . c o m ViewHolder viewHolder = (ViewHolder) convertView.getTag(); if (viewHolder == null) { viewHolder = new ViewHolder(convertView); convertView.setTag(viewHolder); } setIndicies(cursor); TextView author = viewHolder.authorTextView; Integer authorNumber = cursor.getInt(authorId_index); author.setTag(authorNumber); author.setText(cursor.getString(authorName_index)); author.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setTrackingUser((Integer) v.getTag()); } }); String timestamp = cursor.getString(timestamp_index); if (timestamp != null) { viewHolder.timestamp.setText(Tools.prettyPrintDate(mContext, timestamp, Prefs.getServerTimeZone(mContext), Prefs.getLocalTimeZone(mContext))); } // setup styled comments // use Linkify to automatically linking http/email/addresses Linkify.addLinks(viewHolder.commentMessage, Linkify.ALL); // replace replace emoticons with drawables viewHolder.commentMessage .setText(EmoticonSupportHelper.getSmiledText(mContext, cursor.getString(message_index))); // set gravatar icon for commenter viewHolder.gravatar.setImageUrl(GravatarHelper.getGravatarUrl(cursor.getString(authorEmail_index)), new ImageLoader(mRequestQuery, new BitmapLruCache(mContext))); return convertView; }
From source file:com.todoroo.astrid.notes.CommentsController.java
/** Helper method to set the contents and visibility of each field */ private void bindView(View view, NoteOrUpdate item) { // name//www . ja v a2 s. c om final TextView nameView = (TextView) view.findViewById(R.id.title); { nameView.setText(item.title); Linkify.addLinks(nameView, Linkify.ALL); } // date final TextView date = (TextView) view.findViewById(R.id.date); { CharSequence dateString = DateUtils.getRelativeTimeSpanString(item.createdAt, DateUtilities.now(), DateUtils.MINUTE_IN_MILLIS, DateUtils.FORMAT_ABBREV_RELATIVE); date.setText(dateString); } // picture final ImageView commentPictureView = (ImageView) view.findViewById(R.id.comment_picture); setupImagePopupForCommentView(view, commentPictureView, item.commentBitmap, activity); }
From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.LinkObj.java
public void render(Context context, ViewGroup frame, Obj obj, boolean allowInteractions) { JSONObject content = obj.getJson();/*from www . ja v a 2s . com*/ TextView valueTV = new TextView(context); String title; if (content.has(TITLE)) { title = "Link: " + content.optString(TITLE); } else { title = content.optString(URI); } valueTV.setText(title); valueTV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); valueTV.setGravity(Gravity.TOP | Gravity.LEFT); if (Linkify.addLinks(valueTV, Linkify.ALL)) { if (!allowInteractions) valueTV.setMovementMethod(null); } frame.addView(valueTV); }
From source file:org.kontalk.ui.view.TextContentView.java
@Override public void bind(long databaseId, TextComponent component, Pattern highlight) { mComponent = component;// w ww . j av a 2s. c om SpannableStringBuilder formattedMessage = formatMessage(highlight); setTextStyle(this); // linkify! if (formattedMessage.length() < MAX_AFFORDABLE_SIZE) Linkify.addLinks(formattedMessage, Linkify.ALL); /* * workaround for bugs: * http://code.google.com/p/android/issues/detail?id=17343 * http://code.google.com/p/android/issues/detail?id=22493 * applies from Honeycomb to JB 4.2.2 afaik */ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB && android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) // from http://stackoverflow.com/a/12303155/1045199 formattedMessage.append("\u200b"); // was: \u2060 setText(formattedMessage); }