Java Code Examples for android.widget.TextView.setLinksClickable()

The following are Jave code examples for showing how to use setLinksClickable() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Android-Development   File: PoiDetailsFragment.java   View Source Code Vote up 6 votes
private View inflateRowItem(String title, String value) {
    View view;
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    view = inflater.inflate(R.layout.detailed_poi_tagitem, null);

    //LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.rowContainer);
    TextView titleTextView = (TextView) view.findViewById(R.id.rowTitle);
    TextView valueTextView = (TextView) view.findViewById(R.id.rowValue);
    titleTextView.setText(title);
    valueTextView.setText(value);
    //Linking content
    if (title.toLowerCase().equals("email") || title.toLowerCase().equals("contact:email")) {
        Linkify.addLinks(valueTextView, Linkify.EMAIL_ADDRESSES);
        valueTextView.setLinksClickable(true);
    }
    if (title.toLowerCase().equals("website") || title.toLowerCase().equals("contact:website")) {
        Linkify.addLinks(valueTextView, Linkify.WEB_URLS);
        valueTextView.setLinksClickable(true);
    }
    if (title.toLowerCase().equals("phone") || title.toLowerCase().equals("phone:mobile") || title.toLowerCase().equals("contact:mobile") || title.toLowerCase().equals("contact:phone")) {
        Linkify.addLinks(valueTextView, Linkify.PHONE_NUMBERS);
        valueTextView.setLinksClickable(true);
    }
    return view;
}
 
Example 2
Project: AndroidIRCLogViewer   File: MainActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mTextMessage = (TextView) findViewById(R.id.message);
    mTextMessage.setLinksClickable(true);
    mTextMessage.setMovementMethod(LinkMovementMethod.getInstance());
    BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);

    final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    baseUrl = preferences.getString("base_url", null);
    nickname = preferences.getString("nickname", null);

    loadLog();
}
 
Example 3
Project: FinalProject   File: MessagesListAdapter.java   View Source Code Vote up 5 votes
protected void configureLinksBehavior(final TextView text) {
    text.setLinksClickable(false);
    text.setMovementMethod(new LinkMovementMethod() {
        @Override
        public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) {
            boolean result = false;
            if (!isSelectionModeEnabled) {
                result = super.onTouchEvent(widget, buffer, event);
            }
            itemView.onTouchEvent(event);
            return result;
        }
    });
}
 
Example 4
Project: FinalProject   File: MessageHolders.java   View Source Code Vote up 5 votes
protected void configureLinksBehavior(final TextView text) {
    text.setLinksClickable(false);
    text.setMovementMethod(new LinkMovementMethod() {
        @Override
        public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) {
            boolean result = false;
            if (!MessagesListAdapter.isSelectionModeEnabled) {
                result = super.onTouchEvent(widget, buffer, event);
            }
            itemView.onTouchEvent(event);
            return result;
        }
    });
}