Merge pull request #3549 from vector-im/feature/bma/cleanup_styles

Fix styles issue
This commit is contained in:
Benoit Marty 2021-06-25 19:11:54 +02:00 committed by GitHub
commit cd0c9b4e08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 204 additions and 139 deletions

View File

@ -63,7 +63,7 @@ Supported filename extensions are:
- ``.bugfix``: Signifying a bug fix. - ``.bugfix``: Signifying a bug fix.
- ``.doc``: Signifying a documentation improvement. - ``.doc``: Signifying a documentation improvement.
- ``.removal``: Signifying a deprecation or removal of public API. Can be used to notifying about API change in the Matrix SDK - ``.removal``: Signifying a deprecation or removal of public API. Can be used to notifying about API change in the Matrix SDK
- ``.misc``: A ticket has been closed, but it is not of interest to users. Note that in this case, the content of the file will not be output, but just the issue/PR number. - ``.misc``: Any other changes.
See https://github.com/twisted/towncrier#news-fragments if you need more details. See https://github.com/twisted/towncrier#news-fragments if you need more details.

View File

@ -24,6 +24,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import im.vector.lib.ui.styles.R import im.vector.lib.ui.styles.R
import im.vector.lib.ui.styles.databinding.ActivityDebugMaterialThemeBinding import im.vector.lib.ui.styles.databinding.ActivityDebugMaterialThemeBinding
import im.vector.lib.ui.styles.dialogs.MaterialProgressDialog
// Rendering is not the same with VectorBaseActivity // Rendering is not the same with VectorBaseActivity
abstract class DebugMaterialThemeActivity : AppCompatActivity() { abstract class DebugMaterialThemeActivity : AppCompatActivity() {
@ -50,14 +51,20 @@ abstract class DebugMaterialThemeActivity : AppCompatActivity() {
} }
views.debugShowDialog.setOnClickListener { views.debugShowDialog.setOnClickListener {
MaterialAlertDialogBuilder(this) showTestDialog(0)
.setTitle("Dialog title") }
.setMessage("Dialog content")
.setIcon(R.drawable.ic_debug_icon) views.debugShowDialogDestructive.setOnClickListener {
.setPositiveButton("Positive", null) showTestDialog(R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive)
.setNegativeButton("Negative", null) }
.setNeutralButton("Neutral", null)
.show() views.debugShowDialogNegativeDestructive.setOnClickListener {
showTestDialog(R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
}
views.debugShowProgressDialog.setOnClickListener {
MaterialProgressDialog(this)
.show(message = "Progress Dialog\nLine 2", cancellable = true)
} }
views.debugShowBottomSheet.setOnClickListener { views.debugShowBottomSheet.setOnClickListener {
@ -65,6 +72,17 @@ abstract class DebugMaterialThemeActivity : AppCompatActivity() {
} }
} }
private fun showTestDialog(theme: Int) {
MaterialAlertDialogBuilder(this, theme)
.setTitle("Dialog title")
.setMessage("Dialog content\nLine 2")
.setIcon(R.drawable.ic_debug_icon)
.setPositiveButton("Positive", null)
.setNegativeButton("Negative", null)
.setNeutralButton("Neutral", null)
.show()
}
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_debug, menu) menuInflater.inflate(R.menu.menu_debug, menu)
return true return true

View File

@ -452,6 +452,27 @@
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:text="Show Dialog" /> android:text="Show Dialog" />
<Button
android:id="@+id/debugShowDialogDestructive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Show Dialog Destructive" />
<Button
android:id="@+id/debugShowDialogNegativeDestructive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Show Dialog Neg Destructive" />
<Button
android:id="@+id/debugShowProgressDialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Show Progress Dialog" />
<Button <Button
android:id="@+id/debugShowBottomSheet" android:id="@+id/debugShowBottomSheet"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2021 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.lib.ui.styles.dialogs
import android.content.Context
import android.view.LayoutInflater
import androidx.appcompat.app.AlertDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import im.vector.lib.ui.styles.R
import im.vector.lib.ui.styles.databinding.DialogProgressMaterialBinding
class MaterialProgressDialog(val context: Context) {
fun show(message: CharSequence, cancellable: Boolean = false): AlertDialog {
val view = LayoutInflater.from(context).inflate(R.layout.dialog_progress_material, null)
val views = DialogProgressMaterialBinding.bind(view)
views.message.text = message
return MaterialAlertDialogBuilder(context)
.setCancelable(cancellable)
.setView(view)
.show()
}
}

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Inspired from https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/layout/progress_dialog.xml -->
<LinearLayout
android:id="@+id/body"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal"
android:paddingStart="8dp"
android:paddingTop="10dp"
android:paddingEnd="8dp"
android:paddingBottom="10dp">
<ProgressBar
android:id="@android:id/progress"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:max="10000" />
<TextView
android:id="@+id/message"
style="@style/Widget.Vector.TextView.Body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
tools:text="Content\nLine 2" />
</LinearLayout>
</FrameLayout>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="text_size_title">24sp</dimen>
<dimen name="text_size_headline">18sp</dimen>
<dimen name="text_size_subtitle">16sp</dimen>
<dimen name="text_size_body">14sp</dimen>
<dimen name="text_size_caption">12sp</dimen>
<dimen name="text_size_micro">10sp</dimen>
<dimen name="text_size_button">16sp</dimen>
</resources>

View File

@ -1,28 +1,40 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="AlertDialog.Vector.Light" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog"> <style name="ThemeOverlay.Vector.MaterialAlertDialog" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="colorPrimary">@color/palette_element_green</item> <item name="materialAlertDialogTitleTextStyle">@style/MaterialAlertDialog.Vector.Title.Text</item>
<item name="colorSecondary">@color/palette_element_green</item> <item name="materialAlertDialogBodyTextStyle">@style/MaterialAlertDialog.Vector.Body.Text</item>
<item name="colorSurface">@color/element_system_light</item> <item name="buttonBarPositiveButtonStyle">@style/Widget.Vector.Button.TextButton.Dialog</item>
<item name="colorOnSurface">@color/element_content_primary_light</item> <item name="buttonBarNegativeButtonStyle">@style/Widget.Vector.Button.TextButton.Dialog</item>
<item name="colorError">@color/element_alert_light</item> <item name="buttonBarNeutralButtonStyle">@style/Widget.Vector.Button.TextButton.Dialog</item>
<!--item name="alertDialogStyle">@style/MaterialAlertDialog.App</item>
<item name="materialAlertDialogTitleTextStyle">@style/MaterialAlertDialog.App.Title.Text</item>
<item name="buttonBarPositiveButtonStyle">@style/Widget.App.Button</item>
<item name="buttonBarNeutralButtonStyle">@style/Widget.App.Button</item-->
</style> </style>
<style name="AlertDialog.Vector.Dark" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog"> <style name="ThemeOverlay.Vector.MaterialAlertDialog.Destructive">
<item name="colorPrimary">@color/palette_element_green</item> <item name="buttonBarPositiveButtonStyle">@style/Widget.Vector.Button.TextButton.Dialog.Destructive</item>
<item name="colorSecondary">@color/palette_element_green</item> </style>
<item name="colorSurface">@color/element_system_dark</item>
<item name="colorOnSurface">@color/element_content_primary_dark</item> <style name="ThemeOverlay.Vector.MaterialAlertDialog.NegativeDestructive">
<item name="colorError">@color/element_alert_dark</item> <item name="buttonBarNegativeButtonStyle">@style/Widget.Vector.Button.TextButton.Dialog.Destructive</item>
<!--item name="alertDialogStyle">@style/MaterialAlertDialog.App</item> </style>
<item name="materialAlertDialogTitleTextStyle">@style/MaterialAlertDialog.App.Title.Text</item>
<item name="buttonBarPositiveButtonStyle">@style/Widget.App.Button</item> <!-- Title -->
<item name="buttonBarNeutralButtonStyle">@style/Widget.App.Button</item--> <style name="MaterialAlertDialog.Vector.Title.Text" parent="MaterialAlertDialog.MaterialComponents.Title.Text">
<item name="android:textAppearance">@style/TextAppearance.Vector.Subtitle</item>
</style>
<!-- Body -->
<style name="MaterialAlertDialog.Vector.Body.Text" parent="MaterialAlertDialog.MaterialComponents.Body.Text">
<item name="android:textAppearance">@style/TextAppearance.Vector.Body</item>
<item name="lineHeight">20sp</item>
</style>
<!-- Buttons -->
<style name="Widget.Vector.Button.TextButton.Dialog" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
<item name="android:textAppearance">@style/TextAppearance.Vector.Button</item>
</style>
<style name="Widget.Vector.Button.TextButton.Dialog.Destructive">
<item name="materialThemeOverlay">@style/VectorMaterialThemeOverlayDestructive</item>
</style> </style>
</resources> </resources>

View File

@ -14,7 +14,7 @@
<style name="TextAppearance.Vector.Title" parent="TextAppearance.MaterialComponents.Headline3"> <style name="TextAppearance.Vector.Title" parent="TextAppearance.MaterialComponents.Headline3">
<item name="fontFamily">sans-serif</item> <item name="fontFamily">sans-serif</item>
<item name="android:fontFamily">sans-serif</item> <item name="android:fontFamily">sans-serif</item>
<item name="android:textSize">24sp</item> <item name="android:textSize">@dimen/text_size_title</item>
<item name="android:letterSpacing">0</item> <item name="android:letterSpacing">0</item>
<item name="android:textColor">?vctr_content_primary</item> <item name="android:textColor">?vctr_content_primary</item>
</style> </style>
@ -27,7 +27,7 @@
<style name="TextAppearance.Vector.Headline.Medium" parent="TextAppearance.MaterialComponents.Headline1"> <style name="TextAppearance.Vector.Headline.Medium" parent="TextAppearance.MaterialComponents.Headline1">
<item name="fontFamily">sans-serif-medium</item> <item name="fontFamily">sans-serif-medium</item>
<item name="android:fontFamily">sans-serif-medium</item> <item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textSize">18sp</item> <item name="android:textSize">@dimen/text_size_headline</item>
<item name="android:letterSpacing">0</item> <item name="android:letterSpacing">0</item>
<item name="android:textColor">?vctr_content_primary</item> <item name="android:textColor">?vctr_content_primary</item>
</style> </style>
@ -35,7 +35,7 @@
<style name="TextAppearance.Vector.Subtitle" parent="TextAppearance.MaterialComponents.Subtitle1"> <style name="TextAppearance.Vector.Subtitle" parent="TextAppearance.MaterialComponents.Subtitle1">
<item name="fontFamily">sans-serif</item> <item name="fontFamily">sans-serif</item>
<item name="android:fontFamily">sans-serif</item> <item name="android:fontFamily">sans-serif</item>
<item name="android:textSize">16sp</item> <item name="android:textSize">@dimen/text_size_subtitle</item>
<item name="android:letterSpacing">0</item> <item name="android:letterSpacing">0</item>
<item name="android:textColor">?vctr_content_secondary</item> <item name="android:textColor">?vctr_content_secondary</item>
</style> </style>
@ -49,7 +49,7 @@
<style name="TextAppearance.Vector.Body" parent="TextAppearance.MaterialComponents.Body1"> <style name="TextAppearance.Vector.Body" parent="TextAppearance.MaterialComponents.Body1">
<item name="fontFamily">sans-serif</item> <item name="fontFamily">sans-serif</item>
<item name="android:fontFamily">sans-serif</item> <item name="android:fontFamily">sans-serif</item>
<item name="android:textSize">14sp</item> <item name="android:textSize">@dimen/text_size_body</item>
<item name="android:letterSpacing">0</item> <item name="android:letterSpacing">0</item>
<item name="android:textColor">?vctr_content_primary</item> <item name="android:textColor">?vctr_content_primary</item>
</style> </style>
@ -62,7 +62,7 @@
<style name="TextAppearance.Vector.Caption" parent="TextAppearance.MaterialComponents.Caption"> <style name="TextAppearance.Vector.Caption" parent="TextAppearance.MaterialComponents.Caption">
<item name="fontFamily">sans-serif</item> <item name="fontFamily">sans-serif</item>
<item name="android:fontFamily">sans-serif</item> <item name="android:fontFamily">sans-serif</item>
<item name="android:textSize">12sp</item> <item name="android:textSize">@dimen/text_size_caption</item>
<item name="android:letterSpacing">0</item> <item name="android:letterSpacing">0</item>
<item name="android:textColor">?vctr_content_secondary</item> <item name="android:textColor">?vctr_content_secondary</item>
</style> </style>
@ -70,14 +70,14 @@
<style name="TextAppearance.Vector.Micro" parent="TextAppearance.MaterialComponents.Caption"> <style name="TextAppearance.Vector.Micro" parent="TextAppearance.MaterialComponents.Caption">
<item name="fontFamily">sans-serif</item> <item name="fontFamily">sans-serif</item>
<item name="android:fontFamily">sans-serif</item> <item name="android:fontFamily">sans-serif</item>
<item name="android:textSize">10sp</item> <item name="android:textSize">@dimen/text_size_micro</item>
<item name="android:letterSpacing">0</item> <item name="android:letterSpacing">0</item>
</style> </style>
<style name="TextAppearance.Vector.Button" parent="TextAppearance.MaterialComponents.Button"> <style name="TextAppearance.Vector.Button" parent="TextAppearance.MaterialComponents.Button">
<item name="fontFamily">sans-serif-medium</item> <item name="fontFamily">sans-serif-medium</item>
<item name="android:fontFamily">sans-serif-medium</item> <item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textSize">16sp</item> <item name="android:textSize">@dimen/text_size_button</item>
<item name="android:letterSpacing">0.02</item> <item name="android:letterSpacing">0.02</item>
</style> </style>

View File

@ -76,7 +76,6 @@
<item name="android:textViewStyle">@style/Widget.Vector.TextView.Body</item> <item name="android:textViewStyle">@style/Widget.Vector.TextView.Body</item>
<item name="materialButtonStyle">@style/Widget.Vector.Button</item> <item name="materialButtonStyle">@style/Widget.Vector.Button</item>
<item name="toolbarStyle">@style/Widget.Vector.Toolbar</item> <item name="toolbarStyle">@style/Widget.Vector.Toolbar</item>
<item name="materialAlertDialogTheme">@style/AlertDialog.Vector.Dark</item>
<item name="bottomNavigationStyle">@style/BottomNavigation.Vector</item> <item name="bottomNavigationStyle">@style/BottomNavigation.Vector</item>
<item name="searchViewStyle">@style/Widget.Vector.SearchView</item> <item name="searchViewStyle">@style/Widget.Vector.SearchView</item>
<item name="textInputStyle">@style/Widget.Vector.TextInputLayout</item> <item name="textInputStyle">@style/Widget.Vector.TextInputLayout</item>
@ -89,6 +88,7 @@
<!-- Default theme --> <!-- Default theme -->
<item name="bottomSheetDialogTheme">@style/Theme.Vector.BottomSheetDialog.Dark</item> <item name="bottomSheetDialogTheme">@style/Theme.Vector.BottomSheetDialog.Dark</item>
<item name="materialAlertDialogTheme">@style/ThemeOverlay.Vector.MaterialAlertDialog</item>
<item name="android:textColorLink">@color/element_link_dark</item> <item name="android:textColorLink">@color/element_link_dark</item>

View File

@ -76,7 +76,6 @@
<item name="android:textViewStyle">@style/Widget.Vector.TextView.Body</item> <item name="android:textViewStyle">@style/Widget.Vector.TextView.Body</item>
<item name="materialButtonStyle">@style/Widget.Vector.Button</item> <item name="materialButtonStyle">@style/Widget.Vector.Button</item>
<item name="toolbarStyle">@style/Widget.Vector.Toolbar</item> <item name="toolbarStyle">@style/Widget.Vector.Toolbar</item>
<item name="materialAlertDialogTheme">@style/AlertDialog.Vector.Light</item>
<item name="bottomNavigationStyle">@style/BottomNavigation.Vector</item> <item name="bottomNavigationStyle">@style/BottomNavigation.Vector</item>
<item name="searchViewStyle">@style/Widget.Vector.SearchView</item> <item name="searchViewStyle">@style/Widget.Vector.SearchView</item>
<item name="textInputStyle">@style/Widget.Vector.TextInputLayout</item> <item name="textInputStyle">@style/Widget.Vector.TextInputLayout</item>
@ -89,6 +88,7 @@
<!-- Default theme --> <!-- Default theme -->
<item name="bottomSheetDialogTheme">@style/Theme.Vector.BottomSheetDialog.Light</item> <item name="bottomSheetDialogTheme">@style/Theme.Vector.BottomSheetDialog.Light</item>
<item name="materialAlertDialogTheme">@style/ThemeOverlay.Vector.MaterialAlertDialog</item>
<item name="android:textColorLink">@color/element_link_light</item> <item name="android:textColorLink">@color/element_link_light</item>

View File

@ -114,6 +114,12 @@
android:text="Vector" /> android:text="Vector" />
</LinearLayout> </LinearLayout>
<Button
android:id="@+id/debug_open_button_styles_dark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="See button dark" />
<Button <Button
android:id="@+id/debug_test_text_view_dark" android:id="@+id/debug_test_text_view_dark"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -122,12 +128,6 @@
android:layout_weight="1" android:layout_weight="1"
android:text="Text Views Dark" /> android:text="Text Views Dark" />
<Button
android:id="@+id/debug_open_button_styles_dark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="See button dark" />
<Button <Button
android:id="@+id/debug_show_sas_emoji" android:id="@+id/debug_show_sas_emoji"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -1,27 +0,0 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.core.dialogs
import androidx.annotation.AttrRes
import androidx.appcompat.app.AlertDialog
import im.vector.app.R
import im.vector.app.features.themes.ThemeUtils
fun AlertDialog.withColoredButton(whichButton: Int, @AttrRes color: Int = R.attr.colorError): AlertDialog {
getButton(whichButton)?.setTextColor(ThemeUtils.getColor(context, color))
return this
}

View File

@ -14,11 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
@file:Suppress("DEPRECATION")
package im.vector.app.core.platform package im.vector.app.core.platform
import android.app.ProgressDialog
import android.content.Context import android.content.Context
import android.os.Bundle import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
@ -29,11 +26,12 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.annotation.CallSuper import androidx.annotation.CallSuper
import androidx.annotation.MainThread import androidx.annotation.MainThread
import com.google.android.material.appbar.MaterialToolbar import androidx.appcompat.app.AlertDialog
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.viewbinding.ViewBinding import androidx.viewbinding.ViewBinding
import com.airbnb.mvrx.BaseMvRxFragment import com.airbnb.mvrx.BaseMvRxFragment
import com.bumptech.glide.util.Util.assertMainThread import com.bumptech.glide.util.Util.assertMainThread
import com.google.android.material.appbar.MaterialToolbar
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.jakewharton.rxbinding3.view.clicks import com.jakewharton.rxbinding3.view.clicks
import im.vector.app.R import im.vector.app.R
@ -44,14 +42,14 @@ import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
import im.vector.app.core.error.ErrorFormatter import im.vector.app.core.error.ErrorFormatter
import im.vector.app.core.extensions.toMvRxBundle import im.vector.app.core.extensions.toMvRxBundle
import im.vector.app.features.navigation.Navigator import im.vector.app.features.navigation.Navigator
import im.vector.lib.ui.styles.dialogs.MaterialProgressDialog
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable
import timber.log.Timber import timber.log.Timber
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
abstract class VectorBaseFragment<VB: ViewBinding> : BaseMvRxFragment(), HasScreenInjector { abstract class VectorBaseFragment<VB : ViewBinding> : BaseMvRxFragment(), HasScreenInjector {
protected val vectorBaseActivity: VectorBaseActivity<*> by lazy { protected val vectorBaseActivity: VectorBaseActivity<*> by lazy {
activity as VectorBaseActivity<*> activity as VectorBaseActivity<*>
@ -67,7 +65,7 @@ abstract class VectorBaseFragment<VB: ViewBinding> : BaseMvRxFragment(), HasScre
protected lateinit var errorFormatter: ErrorFormatter protected lateinit var errorFormatter: ErrorFormatter
protected lateinit var unrecognizedCertificateDialog: UnrecognizedCertificateDialog protected lateinit var unrecognizedCertificateDialog: UnrecognizedCertificateDialog
private var progress: ProgressDialog? = null private var progress: AlertDialog? = null
/* ========================================================================================== /* ==========================================================================================
* View model * View model
@ -203,14 +201,10 @@ abstract class VectorBaseFragment<VB: ViewBinding> : BaseMvRxFragment(), HasScre
vectorBaseActivity.getCoordinatorLayout()?.showOptimizedSnackbar(errorFormatter.toHumanReadable(throwable)) vectorBaseActivity.getCoordinatorLayout()?.showOptimizedSnackbar(errorFormatter.toHumanReadable(throwable))
} }
protected fun showLoadingDialog(message: CharSequence? = null, cancelable: Boolean = false) { protected fun showLoadingDialog(message: CharSequence? = null) {
progress?.dismiss() progress?.dismiss()
progress = ProgressDialog(requireContext()).apply { progress = MaterialProgressDialog(requireContext())
setCancelable(cancelable) .show(message ?: getString(R.string.please_wait))
setMessage(message ?: getString(R.string.please_wait))
setProgressStyle(ProgressDialog.STYLE_SPINNER)
show()
}
} }
protected fun dismissLoadingDialog() { protected fun dismissLoadingDialog() {

View File

@ -18,7 +18,6 @@ package im.vector.app.features.home.room.detail
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.content.DialogInterface
import android.content.Intent import android.content.Intent
import android.content.res.Configuration import android.content.res.Configuration
import android.graphics.Color import android.graphics.Color
@ -75,7 +74,6 @@ import com.vanniktech.emoji.EmojiPopup
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.dialogs.ConfirmationDialogBuilder import im.vector.app.core.dialogs.ConfirmationDialogBuilder
import im.vector.app.core.dialogs.GalleryOrCameraDialogHelper import im.vector.app.core.dialogs.GalleryOrCameraDialogHelper
import im.vector.app.core.dialogs.withColoredButton
import im.vector.app.core.epoxy.LayoutManagerStateRestorer import im.vector.app.core.epoxy.LayoutManagerStateRestorer
import im.vector.app.core.extensions.cleanup import im.vector.app.core.extensions.cleanup
import im.vector.app.core.extensions.exhaustive import im.vector.app.core.extensions.exhaustive
@ -1410,7 +1408,7 @@ class RoomDetailFragment @Inject constructor(
is RoomDetailAction.ReportContent -> { is RoomDetailAction.ReportContent -> {
when { when {
data.spam -> { data.spam -> {
MaterialAlertDialogBuilder(requireActivity()) MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
.setTitle(R.string.content_reported_as_spam_title) .setTitle(R.string.content_reported_as_spam_title)
.setMessage(R.string.content_reported_as_spam_content) .setMessage(R.string.content_reported_as_spam_content)
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
@ -1418,10 +1416,9 @@ class RoomDetailFragment @Inject constructor(
roomDetailViewModel.handle(RoomDetailAction.IgnoreUser(data.senderId)) roomDetailViewModel.handle(RoomDetailAction.IgnoreUser(data.senderId))
} }
.show() .show()
.withColoredButton(DialogInterface.BUTTON_NEGATIVE)
} }
data.inappropriate -> { data.inappropriate -> {
MaterialAlertDialogBuilder(requireActivity()) MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
.setTitle(R.string.content_reported_as_inappropriate_title) .setTitle(R.string.content_reported_as_inappropriate_title)
.setMessage(R.string.content_reported_as_inappropriate_content) .setMessage(R.string.content_reported_as_inappropriate_content)
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
@ -1429,10 +1426,9 @@ class RoomDetailFragment @Inject constructor(
roomDetailViewModel.handle(RoomDetailAction.IgnoreUser(data.senderId)) roomDetailViewModel.handle(RoomDetailAction.IgnoreUser(data.senderId))
} }
.show() .show()
.withColoredButton(DialogInterface.BUTTON_NEGATIVE)
} }
else -> { else -> {
MaterialAlertDialogBuilder(requireActivity()) MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
.setTitle(R.string.content_reported_title) .setTitle(R.string.content_reported_title)
.setMessage(R.string.content_reported_content) .setMessage(R.string.content_reported_content)
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
@ -1440,7 +1436,6 @@ class RoomDetailFragment @Inject constructor(
roomDetailViewModel.handle(RoomDetailAction.IgnoreUser(data.senderId)) roomDetailViewModel.handle(RoomDetailAction.IgnoreUser(data.senderId))
} }
.show() .show()
.withColoredButton(DialogInterface.BUTTON_NEGATIVE)
} }
} }
} }
@ -1502,7 +1497,7 @@ class RoomDetailFragment @Inject constructor(
.subscribe { managed -> .subscribe { managed ->
if (!managed) { if (!managed) {
if (title.isValidUrl() && url.isValidUrl() && URL(title).host != URL(url).host) { if (title.isValidUrl() && url.isValidUrl() && URL(title).host != URL(url).host) {
MaterialAlertDialogBuilder(requireActivity()) MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
.setTitle(R.string.external_link_confirmation_title) .setTitle(R.string.external_link_confirmation_title)
.setMessage( .setMessage(
getString(R.string.external_link_confirmation_message, title, url) getString(R.string.external_link_confirmation_message, title, url)
@ -1515,7 +1510,6 @@ class RoomDetailFragment @Inject constructor(
} }
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show() .show()
.withColoredButton(DialogInterface.BUTTON_NEGATIVE)
} else { } else {
// Open in external browser, in a new Tab // Open in external browser, in a new Tab
openUrlInExternalBrowser(requireContext(), url) openUrlInExternalBrowser(requireContext(), url)
@ -1867,7 +1861,7 @@ class RoomDetailFragment @Inject constructor(
} }
private fun askConfirmationToIgnoreUser(senderId: String) { private fun askConfirmationToIgnoreUser(senderId: String) {
MaterialAlertDialogBuilder(requireContext()) MaterialAlertDialogBuilder(requireContext(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive)
.setTitle(R.string.room_participants_action_ignore_title) .setTitle(R.string.room_participants_action_ignore_title)
.setMessage(R.string.room_participants_action_ignore_prompt_msg) .setMessage(R.string.room_participants_action_ignore_prompt_msg)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
@ -1875,7 +1869,6 @@ class RoomDetailFragment @Inject constructor(
roomDetailViewModel.handle(RoomDetailAction.IgnoreUser(senderId)) roomDetailViewModel.handle(RoomDetailAction.IgnoreUser(senderId))
} }
.show() .show()
.withColoredButton(DialogInterface.BUTTON_POSITIVE)
} }
/** /**

View File

@ -16,7 +16,6 @@
package im.vector.app.features.home.room.list package im.vector.app.features.home.room.list
import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
import android.view.LayoutInflater import android.view.LayoutInflater
@ -34,7 +33,6 @@ import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.dialogs.withColoredButton
import im.vector.app.core.epoxy.LayoutManagerStateRestorer import im.vector.app.core.epoxy.LayoutManagerStateRestorer
import im.vector.app.core.extensions.cleanup import im.vector.app.core.extensions.cleanup
import im.vector.app.core.extensions.exhaustive import im.vector.app.core.extensions.exhaustive
@ -386,7 +384,7 @@ class RoomListFragment @Inject constructor(
append(getString(R.string.room_participants_leave_private_warning)) append(getString(R.string.room_participants_leave_private_warning))
} }
} }
MaterialAlertDialogBuilder(requireContext()) MaterialAlertDialogBuilder(requireContext(), if (isPublicRoom) 0 else R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive)
.setTitle(R.string.room_participants_leave_prompt_title) .setTitle(R.string.room_participants_leave_prompt_title)
.setMessage(message) .setMessage(message)
.setPositiveButton(R.string.leave) { _, _ -> .setPositiveButton(R.string.leave) { _, _ ->
@ -394,11 +392,6 @@ class RoomListFragment @Inject constructor(
} }
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show() .show()
.apply {
if (!isPublicRoom) {
withColoredButton(DialogInterface.BUTTON_POSITIVE)
}
}
} }
override fun invalidate() = withState(roomListViewModel) { state -> override fun invalidate() = withState(roomListViewModel) { state ->

View File

@ -17,7 +17,6 @@
package im.vector.app.features.roomprofile package im.vector.app.features.roomprofile
import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
import android.view.LayoutInflater import android.view.LayoutInflater
@ -33,7 +32,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.animations.AppBarStateChangeListener import im.vector.app.core.animations.AppBarStateChangeListener
import im.vector.app.core.animations.MatrixItemAppBarStateChangeListener import im.vector.app.core.animations.MatrixItemAppBarStateChangeListener
import im.vector.app.core.dialogs.withColoredButton
import im.vector.app.core.extensions.cleanup import im.vector.app.core.extensions.cleanup
import im.vector.app.core.extensions.configureWith import im.vector.app.core.extensions.configureWith
import im.vector.app.core.extensions.copyOnLongClick import im.vector.app.core.extensions.copyOnLongClick
@ -268,7 +266,7 @@ class RoomProfileFragment @Inject constructor(
append(getString(R.string.room_participants_leave_private_warning)) append(getString(R.string.room_participants_leave_private_warning))
} }
} }
MaterialAlertDialogBuilder(requireContext()) MaterialAlertDialogBuilder(requireContext(), if (isPublicRoom) 0 else R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive)
.setTitle(R.string.room_participants_leave_prompt_title) .setTitle(R.string.room_participants_leave_prompt_title)
.setMessage(message) .setMessage(message)
.setPositiveButton(R.string.leave) { _, _ -> .setPositiveButton(R.string.leave) { _, _ ->
@ -276,11 +274,6 @@ class RoomProfileFragment @Inject constructor(
} }
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show() .show()
.apply {
if (!isPublicRoom) {
withColoredButton(DialogInterface.BUTTON_POSITIVE)
}
}
} }
override fun onRoomAliasesClicked() { override fun onRoomAliasesClicked() {

View File

@ -16,7 +16,6 @@
package im.vector.app.features.roomprofile.alias package im.vector.app.features.roomprofile.alias
import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -27,7 +26,6 @@ import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.dialogs.withColoredButton
import im.vector.app.core.extensions.cleanup import im.vector.app.core.extensions.cleanup
import im.vector.app.core.extensions.configureWith import im.vector.app.core.extensions.configureWith
import im.vector.app.core.extensions.exhaustive import im.vector.app.core.extensions.exhaustive
@ -133,7 +131,7 @@ class RoomAliasFragment @Inject constructor(
} }
private fun unpublishAlias(alias: String) { private fun unpublishAlias(alias: String) {
MaterialAlertDialogBuilder(requireContext()) MaterialAlertDialogBuilder(requireContext(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive)
.setTitle(R.string.dialog_title_confirmation) .setTitle(R.string.dialog_title_confirmation)
.setMessage(getString(R.string.room_alias_unpublish_confirmation, alias)) .setMessage(getString(R.string.room_alias_unpublish_confirmation, alias))
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
@ -141,7 +139,6 @@ class RoomAliasFragment @Inject constructor(
viewModel.handle(RoomAliasAction.UnpublishAlias(alias)) viewModel.handle(RoomAliasAction.UnpublishAlias(alias))
} }
.show() .show()
.withColoredButton(DialogInterface.BUTTON_POSITIVE)
} }
override fun toggleManualPublishForm() { override fun toggleManualPublishForm() {
@ -185,7 +182,7 @@ class RoomAliasFragment @Inject constructor(
} }
private fun removeLocalAlias(alias: String) { private fun removeLocalAlias(alias: String) {
MaterialAlertDialogBuilder(requireContext()) MaterialAlertDialogBuilder(requireContext(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive)
.setTitle(R.string.dialog_title_confirmation) .setTitle(R.string.dialog_title_confirmation)
.setMessage(getString(R.string.room_alias_delete_confirmation, alias)) .setMessage(getString(R.string.room_alias_delete_confirmation, alias))
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
@ -193,6 +190,5 @@ class RoomAliasFragment @Inject constructor(
viewModel.handle(RoomAliasAction.RemoveLocalAlias(alias)) viewModel.handle(RoomAliasAction.RemoveLocalAlias(alias))
} }
.show() .show()
.withColoredButton(DialogInterface.BUTTON_POSITIVE)
} }
} }

View File

@ -16,7 +16,6 @@
package im.vector.app.features.settings.devtools package im.vector.app.features.settings.devtools
import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -26,7 +25,6 @@ import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.dialogs.withColoredButton
import im.vector.app.core.extensions.cleanup import im.vector.app.core.extensions.cleanup
import im.vector.app.core.extensions.configureWith import im.vector.app.core.extensions.configureWith
import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.core.platform.VectorBaseFragment
@ -85,7 +83,7 @@ class AccountDataFragment @Inject constructor(
} }
override fun didLongTap(data: UserAccountDataEvent) { override fun didLongTap(data: UserAccountDataEvent) {
MaterialAlertDialogBuilder(requireActivity()) MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive)
.setTitle(R.string.delete) .setTitle(R.string.delete)
.setMessage(getString(R.string.delete_account_data_warning, data.type)) .setMessage(getString(R.string.delete_account_data_warning, data.type))
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
@ -93,6 +91,5 @@ class AccountDataFragment @Inject constructor(
viewModel.handle(AccountDataAction.DeleteAccountData(data.type)) viewModel.handle(AccountDataAction.DeleteAccountData(data.type))
} }
.show() .show()
.withColoredButton(DialogInterface.BUTTON_POSITIVE)
} }
} }

View File

@ -17,7 +17,6 @@
package im.vector.app.features.settings.threepids package im.vector.app.features.settings.threepids
import android.app.Activity import android.app.Activity
import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -27,7 +26,6 @@ import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.dialogs.withColoredButton
import im.vector.app.core.extensions.cleanup import im.vector.app.core.extensions.cleanup
import im.vector.app.core.extensions.configureWith import im.vector.app.core.extensions.configureWith
import im.vector.app.core.extensions.exhaustive import im.vector.app.core.extensions.exhaustive
@ -186,14 +184,13 @@ class ThreePidsSettingsFragment @Inject constructor(
} }
override fun deleteThreePid(threePid: ThreePid) { override fun deleteThreePid(threePid: ThreePid) {
MaterialAlertDialogBuilder(requireActivity()) MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive)
.setMessage(getString(R.string.settings_remove_three_pid_confirmation_content, threePid.getFormattedValue())) .setMessage(getString(R.string.settings_remove_three_pid_confirmation_content, threePid.getFormattedValue()))
.setPositiveButton(R.string.remove) { _, _ -> .setPositiveButton(R.string.remove) { _, _ ->
viewModel.handle(ThreePidsSettingsAction.DeleteThreePid(threePid)) viewModel.handle(ThreePidsSettingsAction.DeleteThreePid(threePid))
} }
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show() .show()
.withColoredButton(DialogInterface.BUTTON_POSITIVE)
} }
override fun onBackPressed(toolbarButton: Boolean): Boolean { override fun onBackPressed(toolbarButton: Boolean): Boolean {

View File

@ -16,7 +16,6 @@
package im.vector.app.features.signout.soft package im.vector.app.features.signout.soft
import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -25,7 +24,6 @@ import com.airbnb.mvrx.activityViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.dialogs.withColoredButton
import im.vector.app.core.extensions.cleanup import im.vector.app.core.extensions.cleanup
import im.vector.app.core.extensions.configureWith import im.vector.app.core.extensions.configureWith
import im.vector.app.core.extensions.hideKeyboard import im.vector.app.core.extensions.hideKeyboard
@ -127,7 +125,7 @@ class SoftLogoutFragment @Inject constructor(
R.string.soft_logout_clear_data_dialog_content R.string.soft_logout_clear_data_dialog_content
} }
MaterialAlertDialogBuilder(requireActivity()) MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive)
.setTitle(R.string.soft_logout_clear_data_dialog_title) .setTitle(R.string.soft_logout_clear_data_dialog_title)
.setMessage(messageResId) .setMessage(messageResId)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
@ -135,7 +133,6 @@ class SoftLogoutFragment @Inject constructor(
softLogoutViewModel.handle(SoftLogoutAction.ClearData) softLogoutViewModel.handle(SoftLogoutAction.ClearData)
} }
.show() .show()
.withColoredButton(DialogInterface.BUTTON_POSITIVE)
} }
} }

View File

@ -16,7 +16,6 @@
package im.vector.app.features.spaces package im.vector.app.features.spaces
import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
import android.view.LayoutInflater import android.view.LayoutInflater
@ -28,7 +27,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.di.ActiveSessionHolder import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.di.ScreenComponent import im.vector.app.core.di.ScreenComponent
import im.vector.app.core.dialogs.withColoredButton
import im.vector.app.core.extensions.setTextOrHide import im.vector.app.core.extensions.setTextOrHide
import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment
import im.vector.app.core.resources.ColorProvider import im.vector.app.core.resources.ColorProvider
@ -174,7 +172,7 @@ class SpaceSettingsMenuBottomSheet : VectorBaseBottomSheetDialogFragment<BottomS
null null
} }
MaterialAlertDialogBuilder(requireContext()) MaterialAlertDialogBuilder(requireContext(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive)
.setMessage(warningMessage) .setMessage(warningMessage)
.setTitle(getString(R.string.space_leave_prompt_msg)) .setTitle(getString(R.string.space_leave_prompt_msg))
.setPositiveButton(R.string.leave) { _, _ -> .setPositiveButton(R.string.leave) { _, _ ->
@ -189,7 +187,6 @@ class SpaceSettingsMenuBottomSheet : VectorBaseBottomSheetDialogFragment<BottomS
} }
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show() .show()
.withColoredButton(DialogInterface.BUTTON_POSITIVE)
} }
} }

View File

@ -16,7 +16,6 @@
package im.vector.app.features.spaces.explore package im.vector.app.features.spaces.explore
import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
import android.view.LayoutInflater import android.view.LayoutInflater
@ -30,7 +29,6 @@ import com.airbnb.mvrx.activityViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.dialogs.withColoredButton
import im.vector.app.core.extensions.cleanup import im.vector.app.core.extensions.cleanup
import im.vector.app.core.extensions.configureWith import im.vector.app.core.extensions.configureWith
import im.vector.app.core.extensions.registerStartForActivityResult import im.vector.app.core.extensions.registerStartForActivityResult
@ -180,7 +178,7 @@ class SpaceDirectoryFragment @Inject constructor(
.subscribe { managed -> .subscribe { managed ->
if (!managed) { if (!managed) {
if (title.isValidUrl() && url.isValidUrl() && URL(title).host != URL(url).host) { if (title.isValidUrl() && url.isValidUrl() && URL(title).host != URL(url).host) {
MaterialAlertDialogBuilder(requireActivity()) MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive)
.setTitle(R.string.external_link_confirmation_title) .setTitle(R.string.external_link_confirmation_title)
.setMessage( .setMessage(
getString(R.string.external_link_confirmation_message, title, url) getString(R.string.external_link_confirmation_message, title, url)
@ -193,7 +191,6 @@ class SpaceDirectoryFragment @Inject constructor(
} }
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show() .show()
.withColoredButton(DialogInterface.BUTTON_NEGATIVE)
} else { } else {
// Open in external browser, in a new Tab // Open in external browser, in a new Tab
openUrlInExternalBrowser(requireContext(), url) openUrlInExternalBrowser(requireContext(), url)