mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-25 15:07:20 +00:00
Fix dialog button style
This commit is contained in:
parent
29275cef51
commit
1f6542eff3
@ -14,14 +14,12 @@ import androidx.annotation.LayoutRes
|
|||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.annotation.StyleRes
|
import androidx.annotation.StyleRes
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.core.view.setMargins
|
|
||||||
import androidx.core.view.setPadding
|
import androidx.core.view.setPadding
|
||||||
import androidx.core.view.updateMargins
|
import androidx.core.view.updateMargins
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.thoughtcrime.securesms.util.toPx
|
import org.thoughtcrime.securesms.util.toPx
|
||||||
|
|
||||||
|
|
||||||
@DslMarker
|
@DslMarker
|
||||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE)
|
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE)
|
||||||
annotation class DialogDsl
|
annotation class DialogDsl
|
||||||
@ -31,6 +29,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)
|
||||||
|
|
||||||
@ -64,7 +63,6 @@ class SessionDialogBuilder(val context: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun text(text: CharSequence?, @StyleRes style: Int, modify: TextView.() -> Unit) {
|
private fun text(text: CharSequence?, @StyleRes style: Int, modify: TextView.() -> Unit) {
|
||||||
text ?: return
|
text ?: return
|
||||||
TextView(context, null, 0, style)
|
TextView(context, null, 0, style)
|
||||||
@ -125,8 +123,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(MATCH_PARENT, dp60, 1f)
|
||||||
.apply { setMargins(toPx(20, resources)) }
|
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
listener.invoke()
|
listener.invoke()
|
||||||
if (dismiss) dismiss()
|
if (dismiss) dismiss()
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
|
@ -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"
|
||||||
@ -46,16 +45,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" />
|
||||||
|
|
||||||
|
@ -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" />
|
||||||
|
@ -10,6 +10,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>
|
||||||
|
@ -115,6 +115,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">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user