Skip to content
Permalink
Browse files

Upgrade to MDC 1.1.0-alpha05

Use MaterialAlertDialogBuilder to get the material styling.
  • Loading branch information...
ianhanniballake committed Apr 4, 2019
1 parent 455d91e commit c1f3b90f5519765606e035358ed095b3dfba9ae1
@@ -32,7 +32,7 @@ buildscript {
glideVersion = "4.9.0"
kotlinVersion = "1.3.21"
lifecycleVersion = "2.1.0-alpha04"
materialVersion = "1.1.0-alpha04"
materialVersion = "1.1.0-alpha05"
multidexVersion = "2.0.1"
navigationVersion = "2.1.0-alpha02"
okhttpVersion = "3.12.1"
@@ -24,11 +24,11 @@ import android.content.res.Resources
import android.net.Uri
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import com.google.android.apps.muzei.util.toast
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import net.nurik.roman.muzei.R

class MissingResourcesDialogFragment : DialogFragment() {
@@ -50,7 +50,7 @@ class MissingResourcesDialogFragment : DialogFragment() {
}

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(requireContext())
return MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.missing_resources_title)
.setMessage(R.string.missing_resources_message)
.setPositiveButton(R.string.missing_resources_open) { _: DialogInterface, _: Int ->
@@ -24,11 +24,11 @@ import android.os.Bundle
import android.preference.PreferenceManager
import android.provider.Settings
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.core.content.edit
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentManager
import com.google.android.apps.muzei.util.toast
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import net.nurik.roman.muzei.R

class NotificationSettingsDialogFragment : DialogFragment() {
@@ -65,7 +65,7 @@ class NotificationSettingsDialogFragment : DialogFragment() {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
val checkedItems = booleanArrayOf(sharedPreferences
.getBoolean(NewWallpaperNotificationReceiver.PREF_ENABLED, true))
return AlertDialog.Builder(context)
return MaterialAlertDialogBuilder(context)
.setTitle(R.string.notification_settings)
.setMultiChoiceItems(items, checkedItems) { _, _, isChecked ->
sharedPreferences.edit {
@@ -41,7 +41,6 @@ import android.view.ViewGroup
import android.view.ViewPropertyAnimator
import android.widget.ArrayAdapter
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.res.ResourcesCompat
import androidx.core.os.bundleOf
@@ -53,6 +52,7 @@ import androidx.lifecycle.observe
import com.google.android.apps.muzei.api.MuzeiArtSource
import com.google.android.apps.muzei.room.MuzeiDatabase
import com.google.android.apps.muzei.room.Source
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.firebase.analytics.FirebaseAnalytics
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
@@ -105,7 +105,7 @@ class SourceSettingsActivity : AppCompatActivity() {
if (savedInstanceState != null) {
currentInitialSetupSource = savedInstanceState.getParcelable(CURRENT_INITIAL_SETUP_SOURCE)
}
val dialog = AlertDialog.Builder(this, R.style.Theme_Muzei_Dialog)
val dialog = MaterialAlertDialogBuilder(this, R.style.Theme_Muzei_Dialog)
.setTitle(R.string.source_provider_name)
.setSingleChoiceItems(adapter, -1) { dialog: DialogInterface, which: Int ->
adapter.getItem(which)?.source?.let { source ->
@@ -184,7 +184,7 @@ class SourceSettingsActivity : AppCompatActivity() {
if (source.selected) {
dialog.dismiss()
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && source.targetSdkVersion >= Build.VERSION_CODES.O) {
val builder = AlertDialog.Builder(this)
val builder = MaterialAlertDialogBuilder(this)
.setTitle(R.string.action_source_target_too_high_title)
.setMessage(getString(R.string.action_source_target_too_high_message, source.label))
.setNegativeButton(R.string.action_source_target_too_high_learn_more) { _, _ ->
@@ -21,13 +21,13 @@ import android.app.Dialog
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.lifecycle.observe
import com.google.android.apps.muzei.api.MuzeiArtSource
import com.google.android.apps.muzei.room.MuzeiDatabase
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import net.nurik.roman.muzei.R

class SourceSetupActivity : AppCompatActivity() {
@@ -91,7 +91,7 @@ class SourceWarningDialogFragment : DialogFragment() {
var negativeListener : () -> Unit = {}

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(requireContext(), R.style.Theme_Muzei_Dialog)
return MaterialAlertDialogBuilder(requireContext(), R.style.Theme_Muzei_Dialog)
.setTitle(R.string.source_warning_title)
.setMessage(R.string.source_warning_message)
.setPositiveButton(R.string.source_warning_positive) { _, _ ->
@@ -28,6 +28,7 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.observe
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.twofortyfouram.locale.api.Intent.EXTRA_BUNDLE
import com.twofortyfouram.locale.api.Intent.EXTRA_STRING_BLURB
import net.nurik.roman.muzei.R
@@ -45,7 +46,7 @@ class TaskerSettingActivity : AppCompatActivity() {
}

private val dialog: AlertDialog by lazy {
AlertDialog.Builder(this, R.style.Theme_Muzei_Dialog)
MaterialAlertDialogBuilder(this, R.style.Theme_Muzei_Dialog)
.setTitle(R.string.tasker_setting_dialog_title)
.setSingleChoiceItems(adapter, -1) { _: DialogInterface, which: Int ->
val action = adapter.getItem(which) ?: return@setSingleChoiceItems
@@ -6,13 +6,13 @@ import android.content.pm.ActivityInfo
import android.os.Bundle
import android.widget.ArrayAdapter
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AlertDialog
import androidx.core.content.withStyledAttributes
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.viewModels
import androidx.lifecycle.LiveData
import androidx.lifecycle.observe
import com.google.android.material.dialog.MaterialAlertDialogBuilder

class GalleryImportPhotosDialogFragment : DialogFragment() {

@@ -40,7 +40,8 @@ class GalleryImportPhotosDialogFragment : DialogFragment() {
}

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(requireContext())
return MaterialAlertDialogBuilder(requireContext(),
R.style.Theme_MaterialComponents_DayNight_Dialog_Alert)
.setTitle(R.string.gallery_import_dialog_title)
.setAdapter(adapter) { _, which ->
getContentActivitiesLiveData.value?.run {

0 comments on commit c1f3b90

Please sign in to comment.
You can’t perform that action at this time.