From 885f5736c9d7523a08b41f683fc42f4d8776726e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 23 Jun 2021 16:44:41 +0200 Subject: [PATCH] Stop using ProgressDialog, there is a theme issue with it. It's not maintain by Google since it's deprecated. Force usage of MaterialAlertDialogBuilder to have the same UI effect. We sometimes need to block the UI :/ --- .../debug/DebugMaterialThemeActivity.kt | 6 +++ .../layout/activity_debug_material_theme.xml | 7 ++++ .../src/main/java/MaterialProgressDialog.kt | 37 +++++++++++++++++++ .../res/layout/dialog_progress_material.xml | 37 +++++++++++++++++++ .../app/core/platform/VectorBaseFragment.kt | 22 ++++------- 5 files changed, 95 insertions(+), 14 deletions(-) create mode 100644 library/ui-styles/src/main/java/MaterialProgressDialog.kt create mode 100644 library/ui-styles/src/main/res/layout/dialog_progress_material.xml diff --git a/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeActivity.kt b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeActivity.kt index e91ade9c46..553d495e22 100644 --- a/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeActivity.kt +++ b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeActivity.kt @@ -24,6 +24,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.snackbar.Snackbar import im.vector.lib.ui.styles.R import im.vector.lib.ui.styles.databinding.ActivityDebugMaterialThemeBinding +import im.vector.lib.ui.styles.dialogs.MaterialProgressDialog // Rendering is not the same with VectorBaseActivity abstract class DebugMaterialThemeActivity : AppCompatActivity() { @@ -61,6 +62,11 @@ abstract class DebugMaterialThemeActivity : AppCompatActivity() { showTestDialog(R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive) } + views.debugShowProgressDialog.setOnClickListener { + MaterialProgressDialog(this) + .show(message = "Progress Dialog\nLine 2", cancellable = true) + } + views.debugShowBottomSheet.setOnClickListener { DebugBottomSheet().show(supportFragmentManager, "TAG") } diff --git a/library/ui-styles/src/debug/res/layout/activity_debug_material_theme.xml b/library/ui-styles/src/debug/res/layout/activity_debug_material_theme.xml index e6d4404f2d..4828810e34 100644 --- a/library/ui-styles/src/debug/res/layout/activity_debug_material_theme.xml +++ b/library/ui-styles/src/debug/res/layout/activity_debug_material_theme.xml @@ -466,6 +466,13 @@ android:layout_gravity="center_horizontal" android:text="Show Dialog Neg Destructive" /> +