Merge pull request #1329 from bemusementpark/fix-dialog-button

Fix dialog button style
This commit is contained in:
Andrew 2024-04-24 11:58:09 +09:30 committed by GitHub
commit 797d6eb658
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 12 additions and 13 deletions

View File

@ -7,7 +7,6 @@ import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.Button import android.widget.Button
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.LinearLayout.LayoutParams
import android.widget.LinearLayout.VERTICAL import android.widget.LinearLayout.VERTICAL
import android.widget.Space import android.widget.Space
import android.widget.TextView import android.widget.TextView
@ -31,6 +30,7 @@ class SessionDialogBuilder(val context: Context) {
private val dp20 = toPx(20, context.resources) private val dp20 = toPx(20, context.resources)
private val dp40 = toPx(40, context.resources) private val dp40 = toPx(40, context.resources)
private val dp60 = toPx(60, context.resources)
private val dialogBuilder: AlertDialog.Builder = AlertDialog.Builder(context) private val dialogBuilder: AlertDialog.Builder = AlertDialog.Builder(context)
@ -76,7 +76,7 @@ class SessionDialogBuilder(val context: Context) {
}.let(topView::addView) }.let(topView::addView)
Space(context).apply { Space(context).apply {
layoutParams = LayoutParams(0, dp20) layoutParams = LinearLayout.LayoutParams(0, dp20)
}.let(topView::addView) }.let(topView::addView)
} }
@ -130,8 +130,7 @@ class SessionDialogBuilder(val context: Context) {
) = Button(context, null, 0, style).apply { ) = Button(context, null, 0, style).apply {
setText(text) setText(text)
contentDescription = resources.getString(contentDescriptionRes) contentDescription = resources.getString(contentDescriptionRes)
layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1f) layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, dp60, 1f)
.apply { setMargins(dp20) }
setOnClickListener { setOnClickListener {
listener.invoke() listener.invoke()
if (dismiss) dismiss() if (dismiss) dismiss()

View File

@ -4,7 +4,6 @@
<item android:id="@android:id/mask"> <item android:id="@android:id/mask">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<solid android:color="?android:textColorPrimary"/> <solid android:color="?android:textColorPrimary"/>
<corners android:radius="@dimen/medium_button_corner_radius" />
</shape> </shape>
</item> </item>
</ripple> </ripple>

View File

@ -4,7 +4,6 @@
<item android:id="@android:id/mask"> <item android:id="@android:id/mask">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<solid android:color="?android:textColorPrimary"/> <solid android:color="?android:textColorPrimary"/>
<corners android:radius="@dimen/medium_button_corner_radius" />
</shape> </shape>
</item> </item>
</ripple> </ripple>

View File

@ -6,8 +6,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical" android:orientation="vertical"
android:elevation="4dp" android:elevation="4dp">
android:padding="@dimen/medium_spacing">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -21,6 +20,8 @@
android:id="@+id/dialogDescriptionText" android:id="@+id/dialogDescriptionText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="@dimen/large_spacing" android:layout_marginTop="@dimen/large_spacing"
android:text="@string/dialog_clear_all_data_message" android:text="@string/dialog_clear_all_data_message"
android:textAlignment="center" android:textAlignment="center"
@ -46,16 +47,15 @@
style="@style/Widget.Session.Button.Dialog.DestructiveText" style="@style/Widget.Session.Button.Dialog.DestructiveText"
android:id="@+id/clearAllDataButton" android:id="@+id/clearAllDataButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/small_button_height" android:layout_height="@dimen/dialog_button_height"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginStart="@dimen/medium_spacing"
android:text="@string/dialog_clear_all_data_clear" /> android:text="@string/dialog_clear_all_data_clear" />
<Button <Button
style="@style/Widget.Session.Button.Dialog.UnimportantText" style="@style/Widget.Session.Button.Dialog.UnimportantText"
android:id="@+id/cancelButton" android:id="@+id/cancelButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/small_button_height" android:layout_height="@dimen/dialog_button_height"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/cancel" /> android:text="@string/cancel" />

View File

@ -38,7 +38,7 @@
style="@style/Widget.Session.Button.Dialog.UnimportantText" style="@style/Widget.Session.Button.Dialog.UnimportantText"
android:id="@+id/cancelButton" android:id="@+id/cancelButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/small_button_height" android:layout_height="@dimen/dialog_button_height"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/cancel" /> android:text="@string/cancel" />
@ -46,7 +46,7 @@
style="@style/Widget.Session.Button.Dialog.DestructiveText" style="@style/Widget.Session.Button.Dialog.DestructiveText"
android:id="@+id/sendSeedButton" android:id="@+id/sendSeedButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/small_button_height" android:layout_height="@dimen/dialog_button_height"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginStart="@dimen/medium_spacing" android:layout_marginStart="@dimen/medium_spacing"
android:text="@string/dialog_send_seed_send_button_title" /> android:text="@string/dialog_send_seed_send_button_title" />

View File

@ -11,6 +11,7 @@
<dimen name="massive_font_size">50sp</dimen> <dimen name="massive_font_size">50sp</dimen>
<!-- Element Sizes --> <!-- Element Sizes -->
<dimen name="dialog_button_height">60dp</dimen>
<dimen name="small_button_height">34dp</dimen> <dimen name="small_button_height">34dp</dimen>
<dimen name="medium_button_height">38dp</dimen> <dimen name="medium_button_height">38dp</dimen>
<dimen name="large_button_height">54dp</dimen> <dimen name="large_button_height">54dp</dimen>

View File

@ -119,6 +119,7 @@
<item name="android:textAllCaps">false</item> <item name="android:textAllCaps">false</item>
<item name="android:textSize">@dimen/small_font_size</item> <item name="android:textSize">@dimen/small_font_size</item>
<item name="android:textColor">?android:textColorPrimary</item> <item name="android:textColor">?android:textColorPrimary</item>
<item name="android:textStyle">bold</item>
</style> </style>
<style name="Widget.Session.Button.Dialog.UnimportantText"> <style name="Widget.Session.Button.Dialog.UnimportantText">