fix problems with selectable text in detailed status
This commit is contained in:
parent
787cfbc82a
commit
d17ff3eb0f
|
@ -41,7 +41,6 @@ abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
private View container;
|
||||
private TextView displayName;
|
||||
private TextView username;
|
||||
private TextView content;
|
||||
private ImageButton replyButton;
|
||||
private SparkButton reblogButton;
|
||||
private SparkButton favouriteButton;
|
||||
|
@ -59,11 +58,12 @@ abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
private TextView sensitiveMediaWarning;
|
||||
private View sensitiveMediaShow;
|
||||
private TextView mediaLabel;
|
||||
private TextView contentWarningDescription;
|
||||
private ToggleButton contentWarningButton;
|
||||
|
||||
ImageView avatar;
|
||||
TextView timestampInfo;
|
||||
TextView content;
|
||||
TextView contentWarningDescription;
|
||||
|
||||
StatusBaseViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.keylesspalace.tusky.adapter;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -13,6 +15,7 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.keylesspalace.tusky.R;
|
||||
import com.keylesspalace.tusky.entity.Card;
|
||||
|
@ -93,6 +96,20 @@ class StatusDetailedViewHolder extends StatusBaseViewHolder {
|
|||
favourites.setText(numberFormat.format(status.getFavouritesCount()));
|
||||
setApplication(status.getApplication());
|
||||
|
||||
View.OnLongClickListener longClickListener = view -> {
|
||||
TextView textView = (TextView)view;
|
||||
ClipboardManager clipboard = (ClipboardManager) view.getContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("toot", textView.getText());
|
||||
clipboard.setPrimaryClip(clip);
|
||||
|
||||
Toast.makeText(view.getContext(), R.string.copy_to_clipboard_success, Toast.LENGTH_SHORT).show();
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
content.setOnLongClickListener(longClickListener);
|
||||
contentWarningDescription.setOnLongClickListener(longClickListener);
|
||||
|
||||
if(status.getAttachments().length == 0 && status.getCard() != null && !TextUtils.isEmpty(status.getCard().getUrl())) {
|
||||
final Card card = status.getCard();
|
||||
cardView.setVisibility(View.VISIBLE);
|
||||
|
@ -134,15 +151,7 @@ class StatusDetailedViewHolder extends StatusBaseViewHolder {
|
|||
cardImage.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
cardView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
LinkHelper.openLink(card.getUrl(), v.getContext());
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
cardView.setOnClickListener(v -> LinkHelper.openLink(card.getUrl(), v.getContext()));
|
||||
|
||||
} else {
|
||||
cardView.setVisibility(View.GONE);
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
android:layout_below="@id/status_name_bar"
|
||||
android:lineSpacingMultiplier="1.1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="?attr/status_text_large"
|
||||
tools:text="CW this is a long long long long long long long long content warning" />
|
||||
|
||||
|
@ -91,7 +90,6 @@
|
|||
android:focusable="true"
|
||||
android:lineSpacingMultiplier="1.1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="?attr/status_text_large" />
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -265,6 +265,6 @@
|
|||
<string name="send_toot_notification_channel_name">Beiträge senden</string>
|
||||
|
||||
<string name="error_no_custom_emojis">Deine Instanz %s hat keine Emojis definiert</string>
|
||||
|
||||
<string name="copy_to_clipboard_success">In die Zwischenablage kopiert</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -302,5 +302,6 @@
|
|||
<string name="send_toot_notification_saved_content">A copy of the toot has been saved to your drafts</string>
|
||||
|
||||
<string name="error_no_custom_emojis">Your instance %s does not have any custom emojis</string>
|
||||
<string name="copy_to_clipboard_success">Copied to clipboard</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue