Fix dialog button style

This commit is contained in:
andrew 2023-09-22 00:16:10 +09:30
parent 29275cef51
commit 1f6542eff3
7 changed files with 9 additions and 14 deletions

View File

@ -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()

View File

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

View File

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

View File

@ -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">
<TextView
android:layout_width="wrap_content"
@ -46,16 +45,15 @@
style="@style/Widget.Session.Button.Dialog.DestructiveText"
android:id="@+id/clearAllDataButton"
android:layout_width="0dp"
android:layout_height="@dimen/small_button_height"
android:layout_height="@dimen/dialog_button_height"
android:layout_weight="1"
android:layout_marginStart="@dimen/medium_spacing"
android:text="@string/dialog_clear_all_data_clear" />
<Button
style="@style/Widget.Session.Button.Dialog.UnimportantText"
android:id="@+id/cancelButton"
android:layout_width="0dp"
android:layout_height="@dimen/small_button_height"
android:layout_height="@dimen/dialog_button_height"
android:layout_weight="1"
android:text="@string/cancel" />

View File

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

View File

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

View File

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