make text selectable
This commit is contained in:
@@ -12,16 +12,19 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import org.joinmastodon.android.R;
|
import org.joinmastodon.android.R;
|
||||||
import org.joinmastodon.android.model.Attachment;
|
import org.joinmastodon.android.model.Attachment;
|
||||||
import org.joinmastodon.android.ui.utils.UiUtils;
|
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||||
|
|
||||||
|
import me.grishka.appkit.utils.SingleViewRecyclerAdapter;
|
||||||
import me.grishka.appkit.utils.V;
|
import me.grishka.appkit.utils.V;
|
||||||
import me.grishka.appkit.views.BottomSheet;
|
import me.grishka.appkit.views.BottomSheet;
|
||||||
|
import me.grishka.appkit.views.UsableRecyclerView;
|
||||||
|
|
||||||
public class ImageDescriptionSheet extends BottomSheet{
|
public class ImageDescriptionSheet extends BottomSheet{
|
||||||
private LinearLayout layout;
|
private UsableRecyclerView list;
|
||||||
|
|
||||||
public ImageDescriptionSheet(@NonNull Activity activity, Attachment attachment){
|
public ImageDescriptionSheet(@NonNull Activity activity, Attachment attachment){
|
||||||
super(activity);
|
super(activity);
|
||||||
@@ -38,26 +41,32 @@ public class ImageDescriptionSheet extends BottomSheet{
|
|||||||
textView.setTypeface(null, Typeface.ITALIC);
|
textView.setTypeface(null, Typeface.ITALIC);
|
||||||
} else {
|
} else {
|
||||||
textView.setText(attachment.description);
|
textView.setText(attachment.description);
|
||||||
|
textView.setTextIsSelectable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView header = new TextView(activity);
|
TextView heading=new TextView(activity);
|
||||||
header.setText(R.string.image_description);
|
heading.setText(R.string.image_description);
|
||||||
header.setAllCaps(true);
|
heading.setAllCaps(true);
|
||||||
header.setTypeface(null, Typeface.BOLD);
|
heading.setTypeface(null, Typeface.BOLD);
|
||||||
header.setPadding(0, V.dp(24), 0, V.dp(8));
|
heading.setPadding(0, V.dp(24), 0, V.dp(8));
|
||||||
|
|
||||||
layout = new LinearLayout(activity);
|
LinearLayout linearLayout = new LinearLayout(activity);
|
||||||
layout.setOrientation(LinearLayout.VERTICAL);
|
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||||
layout.addView(header);
|
linearLayout.setPadding(V.dp(24), 0, V.dp(24), 0);
|
||||||
layout.addView(textView);
|
linearLayout.addView(heading);
|
||||||
|
linearLayout.addView(textView);
|
||||||
|
|
||||||
FrameLayout content=new FrameLayout(activity);
|
FrameLayout layout=new FrameLayout(activity);
|
||||||
content.setBackgroundResource(R.drawable.bg_bottom_sheet);
|
layout.addView(handle);
|
||||||
content.addView(handle);
|
layout.addView(linearLayout);
|
||||||
content.addView(layout);
|
|
||||||
content.setPadding(V.dp(24), V.dp(0), V.dp(24), V.dp(0));
|
|
||||||
|
|
||||||
setContentView(content);
|
list=new UsableRecyclerView(activity);
|
||||||
|
list.setLayoutManager(new LinearLayoutManager(activity));
|
||||||
|
list.setBackgroundResource(R.drawable.bg_bottom_sheet);
|
||||||
|
list.setAdapter(new SingleViewRecyclerAdapter(layout));
|
||||||
|
list.setClipToPadding(false);
|
||||||
|
|
||||||
|
setContentView(list);
|
||||||
setNavigationBarBackground(new ColorDrawable(UiUtils.getThemeColor(activity, R.attr.colorWindowBackground)), !UiUtils.isDarkTheme());
|
setNavigationBarBackground(new ColorDrawable(UiUtils.getThemeColor(activity, R.attr.colorWindowBackground)), !UiUtils.isDarkTheme());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,12 +76,12 @@ public class ImageDescriptionSheet extends BottomSheet{
|
|||||||
int tappableBottom=insets.getTappableElementInsets().bottom;
|
int tappableBottom=insets.getTappableElementInsets().bottom;
|
||||||
int insetBottom=insets.getSystemWindowInsetBottom();
|
int insetBottom=insets.getSystemWindowInsetBottom();
|
||||||
if(tappableBottom==0 && insetBottom>0){
|
if(tappableBottom==0 && insetBottom>0){
|
||||||
layout.setPadding(0, 0, 0, V.dp(48)-insetBottom);
|
list.setPadding(0, 0, 0, V.dp(48)-insetBottom);
|
||||||
}else{
|
}else{
|
||||||
layout.setPadding(0, 0, 0, V.dp(24));
|
list.setPadding(0, 0, 0, V.dp(24));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
layout.setPadding(0, 0, 0, V.dp(24));
|
list.setPadding(0, 0, 0, V.dp(24));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user