From 88efb2c08c07e2994367b42f9b3f265186eaf0f2 Mon Sep 17 00:00:00 2001 From: Anton Chekulaev Date: Wed, 26 Aug 2020 22:30:17 +1000 Subject: [PATCH] Bottom sheet styles were actually fixed. --- res/values-notnight-v28/themes.xml | 2 +- res/values/styles.xml | 6 +----- res/values/themes.xml | 2 +- .../loki/dialogs/ConversationOptionsBottomSheet.kt | 6 +----- .../loki/dialogs/MultiDeviceRemovalBottomSheet.kt | 13 ++++--------- .../loki/dialogs/OpenGroupSuggestionBottomSheet.kt | 5 ----- 6 files changed, 8 insertions(+), 26 deletions(-) diff --git a/res/values-notnight-v28/themes.xml b/res/values-notnight-v28/themes.xml index 570246a1b5..3de02c6f6a 100644 --- a/res/values-notnight-v28/themes.xml +++ b/res/values-notnight-v28/themes.xml @@ -30,7 +30,7 @@ @style/AppCompatAlertDialogStyleLight @style/AppCompatDialogStyleLight - @style/Theme.MaterialComponents.Light.BottomSheetDialog + @color/white diff --git a/res/values/styles.xml b/res/values/styles.xml index f9c0558654..04fa232c5d 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -29,11 +29,7 @@ @style/Session.AlertDialog.PositiveButtonStyle - - - diff --git a/res/values/themes.xml b/res/values/themes.xml index 2d2ae64f9d..3f3078098c 100644 --- a/res/values/themes.xml +++ b/res/values/themes.xml @@ -27,7 +27,7 @@ @style/Widget.Session.ActionBar @style/Session.AlertDialog - @style/SessionBottomSheetDialogTheme + @style/Widget.Session.BottomSheetDialog @style/Session.SettingsTheme @color/accent true diff --git a/src/org/thoughtcrime/securesms/loki/dialogs/ConversationOptionsBottomSheet.kt b/src/org/thoughtcrime/securesms/loki/dialogs/ConversationOptionsBottomSheet.kt index 61ddb9d73d..828a67fa87 100644 --- a/src/org/thoughtcrime/securesms/loki/dialogs/ConversationOptionsBottomSheet.kt +++ b/src/org/thoughtcrime/securesms/loki/dialogs/ConversationOptionsBottomSheet.kt @@ -25,11 +25,7 @@ public class ConversationOptionsBottomSheet : BottomSheetDialogFragment() { var onDeleteTapped: (() -> Unit)? = null override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - //FIXME AC: For some reason this fragment (created from HomeActivity) - // is not using the activity's theme. So we have to enforce it. - return LayoutInflater.from(ContextThemeWrapper(requireContext(), R.style.Theme_Session_DayNight)) - .inflate(R.layout.fragment_conversation_bottom_sheet, container, false) -// return inflater.inflate(R.layout.fragment_conversation_bottom_sheet, container, false) + return inflater.inflate(R.layout.fragment_conversation_bottom_sheet, container, false) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/src/org/thoughtcrime/securesms/loki/dialogs/MultiDeviceRemovalBottomSheet.kt b/src/org/thoughtcrime/securesms/loki/dialogs/MultiDeviceRemovalBottomSheet.kt index 70e33d8476..72a798082b 100644 --- a/src/org/thoughtcrime/securesms/loki/dialogs/MultiDeviceRemovalBottomSheet.kt +++ b/src/org/thoughtcrime/securesms/loki/dialogs/MultiDeviceRemovalBottomSheet.kt @@ -37,7 +37,7 @@ class MultiDeviceRemovalBottomSheet : BottomSheetDialogFragment() { } private val explanation by lazy { - if (TextSecurePreferences.getMasterHexEncodedPublicKey(context!!) != null) { + if (TextSecurePreferences.getMasterHexEncodedPublicKey(requireContext()) != null) { "You’re seeing this because this is a secondary device in a multi-device setup. To improve reliability and stability, we’ve decided to temporarily disable Session’s multi-device functionality. Device linking has been disabled, and existing secondary clients will be erased on $removalDateDescription.\n\nTo read more about this change, visit the Session FAQ at getsession.org/faq." } else { "You’re seeing this because you have a secondary device linked to your Session ID. To improve reliability and stability, we’ve decided to temporarily disable Session’s multi-device functionality. Device linking has been disabled, and existing secondary clients will be erased on $removalDateDescription.\n\nTo read more about this change, visit the Session FAQ at getsession.org/faq" @@ -49,7 +49,7 @@ class MultiDeviceRemovalBottomSheet : BottomSheetDialogFragment() { val removalDateStartIndex = explanation.indexOf(removalDateDescription) val removalDateEndIndex = removalDateStartIndex + removalDateDescription.count() result.setSpan(StyleSpan(Typeface.BOLD), removalDateStartIndex, removalDateEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) - result.setSpan(ForegroundColorSpan(resources.getColorWithID(R.color.accent, context!!.theme)), removalDateStartIndex, removalDateEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) + result.setSpan(ForegroundColorSpan(resources.getColorWithID(R.color.accent, requireContext().theme)), removalDateStartIndex, removalDateEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) val link = "getsession.org/faq" val linkStartIndex = explanation.indexOf(link) val linkEndIndex = linkStartIndex + link.count() @@ -59,20 +59,15 @@ class MultiDeviceRemovalBottomSheet : BottomSheetDialogFragment() { try { onLinkTapped?.invoke() } catch (e: Exception) { - Toast.makeText(context!!, R.string.invalid_url, Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), R.string.invalid_url, Toast.LENGTH_SHORT).show() } } }, linkStartIndex, linkEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) result.setSpan(StyleSpan(Typeface.BOLD), linkStartIndex, linkEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) - result.setSpan(ForegroundColorSpan(resources.getColorWithID(R.color.accent, context!!.theme)), linkStartIndex, linkEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) + result.setSpan(ForegroundColorSpan(resources.getColorWithID(R.color.accent, requireContext().theme)), linkStartIndex, linkEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) result } - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setStyle(STYLE_NORMAL, R.style.SessionBottomSheetDialogTheme) - } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_multi_device_removal_bottom_sheet, container, false) } diff --git a/src/org/thoughtcrime/securesms/loki/dialogs/OpenGroupSuggestionBottomSheet.kt b/src/org/thoughtcrime/securesms/loki/dialogs/OpenGroupSuggestionBottomSheet.kt index d8a84b13c7..067c100e77 100644 --- a/src/org/thoughtcrime/securesms/loki/dialogs/OpenGroupSuggestionBottomSheet.kt +++ b/src/org/thoughtcrime/securesms/loki/dialogs/OpenGroupSuggestionBottomSheet.kt @@ -12,11 +12,6 @@ class OpenGroupSuggestionBottomSheet : BottomSheetDialogFragment() { var onJoinTapped: (() -> Unit)? = null var onDismissTapped: (() -> Unit)? = null - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setStyle(STYLE_NORMAL, R.style.SessionBottomSheetDialogTheme) - } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_open_group_suggestion_bottom_sheet, container, false) }