From 1f6542eff367b96e733c4f488700330715937ce8 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 22 Sep 2023 00:16:10 +0930 Subject: [PATCH 1/2] Fix dialog button style --- .../org/thoughtcrime/securesms/SessionDialogBuilder.kt | 7 ++----- .../destructive_dialog_text_button_background.xml | 1 - .../unimportant_dialog_text_button_background.xml | 1 - app/src/main/res/layout/dialog_clear_all_data.xml | 8 +++----- app/src/main/res/layout/dialog_send_seed.xml | 4 ++-- app/src/main/res/values/dimens.xml | 1 + app/src/main/res/values/styles.xml | 1 + 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt b/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt index 44c30741ef..18113ea474 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt @@ -14,14 +14,12 @@ import androidx.annotation.LayoutRes import androidx.annotation.StringRes import androidx.annotation.StyleRes import androidx.appcompat.app.AlertDialog -import androidx.core.view.setMargins import androidx.core.view.setPadding import androidx.core.view.updateMargins import androidx.fragment.app.Fragment import network.loki.messenger.R import org.thoughtcrime.securesms.util.toPx - @DslMarker @Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE) annotation class DialogDsl @@ -31,6 +29,7 @@ class SessionDialogBuilder(val context: Context) { private val dp20 = toPx(20, context.resources) private val dp40 = toPx(40, context.resources) + private val dp60 = toPx(60, context.resources) private val dialogBuilder: AlertDialog.Builder = AlertDialog.Builder(context) @@ -64,7 +63,6 @@ class SessionDialogBuilder(val context: Context) { } } - private fun text(text: CharSequence?, @StyleRes style: Int, modify: TextView.() -> Unit) { text ?: return TextView(context, null, 0, style) @@ -125,8 +123,7 @@ class SessionDialogBuilder(val context: Context) { ) = Button(context, null, 0, style).apply { setText(text) contentDescription = resources.getString(contentDescriptionRes) - layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1f) - .apply { setMargins(toPx(20, resources)) } + layoutParams = LinearLayout.LayoutParams(MATCH_PARENT, dp60, 1f) setOnClickListener { listener.invoke() if (dismiss) dismiss() diff --git a/app/src/main/res/drawable/destructive_dialog_text_button_background.xml b/app/src/main/res/drawable/destructive_dialog_text_button_background.xml index f3e13c8000..3ba98c4992 100644 --- a/app/src/main/res/drawable/destructive_dialog_text_button_background.xml +++ b/app/src/main/res/drawable/destructive_dialog_text_button_background.xml @@ -4,7 +4,6 @@ - diff --git a/app/src/main/res/drawable/unimportant_dialog_text_button_background.xml b/app/src/main/res/drawable/unimportant_dialog_text_button_background.xml index f3e13c8000..3ba98c4992 100644 --- a/app/src/main/res/drawable/unimportant_dialog_text_button_background.xml +++ b/app/src/main/res/drawable/unimportant_dialog_text_button_background.xml @@ -4,7 +4,6 @@ - diff --git a/app/src/main/res/layout/dialog_clear_all_data.xml b/app/src/main/res/layout/dialog_clear_all_data.xml index db95647dad..94d4828e21 100644 --- a/app/src/main/res/layout/dialog_clear_all_data.xml +++ b/app/src/main/res/layout/dialog_clear_all_data.xml @@ -6,8 +6,7 @@ android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" - android:elevation="4dp" - android:padding="@dimen/medium_spacing"> + android:elevation="4dp">