Java Code Examples for android.widget.TextView#setLongClickable()

The following examples show how to use android.widget.TextView#setLongClickable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageHolder.java    From zulip-android with Apache License 2.0 6 votes vote down vote up
public MessageHolder(final View itemView) {
    super(itemView);
    gravatar = (ImageView) itemView.findViewById(R.id.gravatar);
    senderName = (TextView) itemView.findViewById(R.id.senderName);
    timestamp = (TextView) itemView.findViewById(R.id.timestamp);
    leftTimestamp = (TextView) itemView.findViewById(R.id.left_timestamp);
    edited = (TextView) itemView.findViewById(R.id.message_edit_tag);
    leftEdited = (TextView) itemView.findViewById(R.id.left_message_edit_tag);
    contentView = (TextView) itemView.findViewById(R.id.contentView);
    contentView.setMovementMethod(LinkMovementMethod.getInstance());
    leftBar = itemView.findViewById(R.id.leftBar);
    messageTile = (RelativeLayout) itemView.findViewById(R.id.messageTile);
    contentImage = (ImageView) itemView.findViewById(R.id.load_image);
    starImage = (ImageView) itemView.findViewById(R.id.star_image);
    leftStarImage = (ImageView) itemView.findViewById(R.id.left_star_image);
    contentImageContainer = itemView.findViewById(R.id.load_image_container);
    reactionsTable = (TableLayout) itemView.findViewById(R.id.reactions_table);
    contentView.setOnClickListener(this);
    contentView.setLongClickable(true);
    itemView.setOnCreateContextMenuListener(this);

    // Add click listener to sender view
    View senderView = itemView.findViewById(R.id.senderTile);
    if (senderView != null) senderView.setOnClickListener(this);
}
 
Example 2
Source File: InfoPreference.java    From MiPushFramework with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    TextView text = holder.itemView.findViewById(android.R.id.summary);
    text.setMovementMethod(new LinkMovementMethod());
    text.setClickable(true);
    text.setLongClickable(false);
    holder.itemView.setClickable(false);
}
 
Example 3
Source File: UI.java    From Android-Commons with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the given `TextView` to be read-only or read-and-write
 *
 * @param view a `TextView` or one of its subclasses
 * @param readOnly whether the view should be read-only or not
 */
public static void setReadOnly(final TextView view, final boolean readOnly) {
	view.setFocusable(!readOnly);
	view.setFocusableInTouchMode(!readOnly);
	view.setClickable(!readOnly);
	view.setLongClickable(!readOnly);
	view.setCursorVisible(!readOnly);
}
 
Example 4
Source File: HtmlUtils.java    From materialup with Apache License 2.0 3 votes vote down vote up
/**
 * Work around some 'features' of TextView and URLSpans. i.e. vanilla URLSpans do not react to
 * touch so we replace them with our own {@link io.plaidapp.ui.span
 * .TouchableUrlSpan}
 * & {@link io.plaidapp.util.LinkTouchMovementMethod} to fix this.
 * <p>
 * Setting a custom MovementMethod on a TextView also alters touch handling (see
 * TextView#fixFocusableAndClickableSettings) so we need to correct this.
 *
 * @param textView
 * @param input
 */
public static void setTextWithNiceLinks(TextView textView, CharSequence input) {
    textView.setText(input);
    textView.setMovementMethod(LinkTouchMovementMethod.getInstance());
    textView.setFocusable(false);
    textView.setClickable(false);
    textView.setLongClickable(false);
}
 
Example 5
Source File: HtmlUtils.java    From android-proguards with Apache License 2.0 3 votes vote down vote up
/**
 * Work around some 'features' of TextView and URLSpans. i.e. vanilla URLSpans do not react to
 * touch so we replace them with our own {@link TouchableUrlSpan}
 * & {@link LinkTouchMovementMethod} to fix this.
 * <p/>
 * Setting a custom MovementMethod on a TextView also alters touch handling (see
 * TextView#fixFocusableAndClickableSettings) so we need to correct this.
 */
public static void setTextWithNiceLinks(TextView textView, CharSequence input) {
    textView.setText(input);
    textView.setMovementMethod(LinkTouchMovementMethod.getInstance());
    textView.setFocusable(false);
    textView.setClickable(false);
    textView.setLongClickable(false);
}