fix(sheet-photo-viewer-info): increase button width

This commit is contained in:
FineFindus 2024-03-17 15:30:03 +01:00
parent ad1de60968
commit 7773c08387
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B
2 changed files with 4 additions and 91 deletions

View File

@ -1,87 +0,0 @@
package org.joinmastodon.android.ui;
import android.app.Activity;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import org.joinmastodon.android.R;
import org.joinmastodon.android.model.Attachment;
import org.joinmastodon.android.ui.utils.UiUtils;
import me.grishka.appkit.utils.SingleViewRecyclerAdapter;
import me.grishka.appkit.utils.V;
import me.grishka.appkit.views.BottomSheet;
import me.grishka.appkit.views.UsableRecyclerView;
public class ImageDescriptionSheet extends BottomSheet{
private UsableRecyclerView list;
public ImageDescriptionSheet(@NonNull Activity activity, Attachment attachment){
super(activity);
View handleView=new View(activity);
handleView.setBackgroundResource(R.drawable.bg_bottom_sheet_handle);
ViewGroup handle=new FrameLayout(activity);
handle.addView(handleView);
handle.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, V.dp(24)));
TextView textView = new TextView(activity);
if (attachment.description == null || attachment.description.isEmpty()) {
textView.setText(R.string.media_no_description);
textView.setTypeface(null, Typeface.ITALIC);
} else {
textView.setText(attachment.description);
textView.setTextIsSelectable(true);
}
TextView heading=new TextView(activity);
heading.setText(R.string.sk_image_description);
heading.setAllCaps(true);
heading.setTypeface(null, Typeface.BOLD);
heading.setPadding(0, V.dp(24), 0, V.dp(8));
LinearLayout linearLayout = new LinearLayout(activity);
linearLayout.setOrientation(LinearLayout.VERTICAL);
linearLayout.setPadding(V.dp(24), 0, V.dp(24), 0);
linearLayout.addView(heading);
linearLayout.addView(textView);
FrameLayout layout=new FrameLayout(activity);
layout.addView(handle);
layout.addView(linearLayout);
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.colorM3Surface)), !UiUtils.isDarkTheme());
}
@Override
protected void onWindowInsetsUpdated(WindowInsets insets){
if(Build.VERSION.SDK_INT>=29){
int tappableBottom=insets.getTappableElementInsets().bottom;
int insetBottom=insets.getSystemWindowInsetBottom();
if(tappableBottom==0 && insetBottom>0){
list.setPadding(0, 0, 0, V.dp(48)-insetBottom);
}else{
list.setPadding(0, 0, 0, V.dp(24));
}
}else{
list.setPadding(0, 0, 0, V.dp(24));
}
}
}

View File

@ -47,7 +47,7 @@
<Button
android:id="@+id/btn_favorite"
android:layout_width="64dp"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:text="@string/button_favorite"
android:drawableTop="@drawable/ic_fluent_star_24_selector"
@ -60,7 +60,7 @@
<Button
android:id="@+id/btn_share"
android:layout_width="64dp"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:text="@string/button_share"
android:drawableTop="@drawable/ic_fluent_share_24_regular"
@ -73,7 +73,7 @@
<Button
android:id="@+id/btn_bookmark"
android:layout_width="64dp"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:text="@string/add_bookmark"
android:drawableTop="@drawable/ic_fluent_bookmark_24_selector"
@ -86,7 +86,7 @@
<Button
android:id="@+id/btn_download"
android:layout_width="64dp"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:text="@string/download"
android:drawableTop="@drawable/ic_fluent_arrow_download_24_regular"