mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-23 00:17:34 +00:00
Merge branch 'dev' into huawei-3
This commit is contained in:
commit
c8dcfbf32c
@ -111,16 +111,16 @@ class SessionDialogBuilder(val context: Context) {
|
|||||||
text,
|
text,
|
||||||
contentDescription,
|
contentDescription,
|
||||||
R.style.Widget_Session_Button_Dialog_DestructiveText,
|
R.style.Widget_Session_Button_Dialog_DestructiveText,
|
||||||
listener
|
) { listener() }
|
||||||
)
|
|
||||||
|
|
||||||
fun okButton(listener: (() -> Unit) = {}) = button(android.R.string.ok, listener = listener)
|
fun okButton(listener: (() -> Unit) = {}) = button(android.R.string.ok) { listener() }
|
||||||
fun cancelButton(listener: (() -> Unit) = {}) = button(android.R.string.cancel, R.string.AccessibilityId_cancel_button, listener = listener)
|
fun cancelButton(listener: (() -> Unit) = {}) = button(android.R.string.cancel, R.string.AccessibilityId_cancel_button) { listener() }
|
||||||
|
|
||||||
fun button(
|
fun button(
|
||||||
@StringRes text: Int,
|
@StringRes text: Int,
|
||||||
@StringRes contentDescriptionRes: Int = text,
|
@StringRes contentDescriptionRes: Int = text,
|
||||||
@StyleRes style: Int = R.style.Widget_Session_Button_Dialog_UnimportantText,
|
@StyleRes style: Int = R.style.Widget_Session_Button_Dialog_UnimportantText,
|
||||||
|
dismiss: Boolean = false,
|
||||||
listener: (() -> Unit) = {}
|
listener: (() -> Unit) = {}
|
||||||
) = Button(context, null, 0, style).apply {
|
) = Button(context, null, 0, style).apply {
|
||||||
setText(text)
|
setText(text)
|
||||||
@ -129,7 +129,7 @@ class SessionDialogBuilder(val context: Context) {
|
|||||||
.apply { setMargins(toPx(20, resources)) }
|
.apply { setMargins(toPx(20, resources)) }
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
listener.invoke()
|
listener.invoke()
|
||||||
dismiss()
|
if (dismiss) dismiss()
|
||||||
}
|
}
|
||||||
}.let(buttonLayout::addView)
|
}.let(buttonLayout::addView)
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class ShareLogsDialog : DialogFragment() {
|
|||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog = createSessionDialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog = createSessionDialog {
|
||||||
title(R.string.dialog_share_logs_title)
|
title(R.string.dialog_share_logs_title)
|
||||||
text(R.string.dialog_share_logs_explanation)
|
text(R.string.dialog_share_logs_explanation)
|
||||||
button(R.string.share) { shareLogs() }
|
button(R.string.share, dismiss = false) { shareLogs() }
|
||||||
cancelButton { dismiss() }
|
cancelButton { dismiss() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user