From 9f1809abf4b71bbab1662f01b9edbeb1ffe602e2 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Fri, 17 Apr 2020 12:21:01 +1000 Subject: [PATCH] Clean --- .../loki/redesign/activities/PNModeActivity.kt | 2 +- .../loki/redesign/dialogs/PNModeBottomSheet.kt | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/loki/redesign/activities/PNModeActivity.kt b/src/org/thoughtcrime/securesms/loki/redesign/activities/PNModeActivity.kt index c79af2a295..b81a622bac 100644 --- a/src/org/thoughtcrime/securesms/loki/redesign/activities/PNModeActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/redesign/activities/PNModeActivity.kt @@ -83,7 +83,7 @@ class PNModeActivity : BaseActionBarActivity() { private fun register() { if (selectedOptionView == null) { val dialog = AlertDialog.Builder(this) - dialog.setMessage(R.string.activity_pn_mode_no_option_picked_dialog_title) + dialog.setTitle(R.string.activity_pn_mode_no_option_picked_dialog_title) dialog.setPositiveButton(R.string.ok) { _, _ -> } dialog.create().show() return diff --git a/src/org/thoughtcrime/securesms/loki/redesign/dialogs/PNModeBottomSheet.kt b/src/org/thoughtcrime/securesms/loki/redesign/dialogs/PNModeBottomSheet.kt index 583307e2ac..749d9d5263 100644 --- a/src/org/thoughtcrime/securesms/loki/redesign/dialogs/PNModeBottomSheet.kt +++ b/src/org/thoughtcrime/securesms/loki/redesign/dialogs/PNModeBottomSheet.kt @@ -1,5 +1,6 @@ package org.thoughtcrime.securesms.loki.redesign.dialogs +import android.app.AlertDialog import android.content.DialogInterface import android.graphics.drawable.TransitionDrawable import android.os.Bundle @@ -31,7 +32,7 @@ class PNModeBottomSheet : BottomSheetDialogFragment() { super.onViewCreated(view, savedInstanceState) fcmOptionView.setOnClickListener { toggleFCM() } backgroundPollingOptionView.setOnClickListener { toggleBackgroundPolling() } - confirmButton.setOnClickListener { onConfirmTapped?.invoke(selectedOptionView == fcmOptionView) } + confirmButton.setOnClickListener { confirm() } skipButton.setOnClickListener { onSkipTapped?.invoke() } } @@ -84,4 +85,16 @@ class PNModeBottomSheet : BottomSheetDialogFragment() { } } } + + private fun confirm() { + if (selectedOptionView == null) { + val dialog = AlertDialog.Builder(context) + dialog.setTitle(R.string.sheet_pn_mode_no_option_picked_dialog_title) + dialog.setPositiveButton(R.string.ok) { _, _ -> } + dialog.create().show() + return + } + onConfirmTapped?.invoke(selectedOptionView == fcmOptionView) + } + // endregion } \ No newline at end of file