Removed bottom sheet dialog for Activity leaks
This commit is contained in:
parent
162535e3dd
commit
58dc709a7e
19 changed files with 27 additions and 29 deletions
|
@ -128,7 +128,7 @@ class AboutActivity : AbsBaseActivity(), View.OnClickListener {
|
|||
}
|
||||
|
||||
private fun showChangeLogOptions() {
|
||||
MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
||||
MaterialDialog(this).show {
|
||||
cornerRadius(PreferenceUtil.getInstance(this@AboutActivity).dialogCorner)
|
||||
listItems(items = listOf("Telegram Channel", "App")) { _, position, _ ->
|
||||
if (position == 0) {
|
||||
|
|
|
@ -170,7 +170,7 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener,
|
|||
e.printStackTrace()
|
||||
}
|
||||
|
||||
val materialDialog = MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT))
|
||||
val materialDialog = MaterialDialog(this)
|
||||
.show {
|
||||
cornerRadius(PreferenceUtil.getInstance(this@LyricsActivity).dialogCorner)
|
||||
title(R.string.add_time_framed_lryics)
|
||||
|
@ -208,7 +208,7 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener,
|
|||
}
|
||||
|
||||
val materialDialog = MaterialDialog(
|
||||
this, BottomSheet(LayoutMode.WRAP_CONTENT)
|
||||
this
|
||||
).show {
|
||||
cornerRadius(PreferenceUtil.getInstance(this@LyricsActivity).dialogCorner)
|
||||
title(R.string.add_lyrics)
|
||||
|
|
|
@ -62,7 +62,7 @@ class UserInfoActivity : AbsBaseActivity() {
|
|||
loadBannerFromStorage(PreferenceUtil.getInstance(this).bannerImage)
|
||||
}
|
||||
userImage.setOnClickListener {
|
||||
MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
||||
MaterialDialog(this).show {
|
||||
cornerRadius(PreferenceUtil.getInstance(this@UserInfoActivity).dialogCorner)
|
||||
title(text = getString(R.string.set_photo))
|
||||
listItems(
|
||||
|
@ -79,7 +79,7 @@ class UserInfoActivity : AbsBaseActivity() {
|
|||
}
|
||||
}
|
||||
bannerSelect.setOnClickListener {
|
||||
MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
||||
MaterialDialog(this).show {
|
||||
cornerRadius(PreferenceUtil.getInstance(this@UserInfoActivity).dialogCorner)
|
||||
title(R.string.select_banner_photo)
|
||||
listItems(
|
||||
|
|
|
@ -52,7 +52,7 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
|
|||
private var savedArtworkInfo: ArtworkInfo? = null
|
||||
|
||||
protected val show: MaterialDialog
|
||||
get() = MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
||||
get() = MaterialDialog(this).show {
|
||||
cornerRadius(PreferenceUtil.getInstance(this@AbsTagEditorActivity).dialogCorner)
|
||||
title(R.string.update_image)
|
||||
listItems(items = items) { _, position, _ ->
|
||||
|
|
|
@ -39,7 +39,7 @@ class AddToPlaylistDialog : DialogFragment() {
|
|||
playlistNames.add(p.name)
|
||||
}
|
||||
|
||||
return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
||||
return MaterialDialog(requireContext()).show {
|
||||
title(R.string.add_playlist_title)
|
||||
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||
listItems(items = playlistNames) { dialog, index, _ ->
|
||||
|
|
|
@ -38,7 +38,7 @@ class ClearSmartPlaylistDialog : DialogFragment() {
|
|||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
|
||||
return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
||||
return MaterialDialog(requireContext()).show {
|
||||
title(title)
|
||||
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||
message(text = content)
|
||||
|
|
|
@ -43,7 +43,7 @@ class CreatePlaylistDialog : DialogFragment() {
|
|||
override fun onCreateDialog(
|
||||
savedInstanceState: Bundle?
|
||||
): Dialog {
|
||||
val materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
|
||||
val materialDialog = MaterialDialog(requireContext())
|
||||
.show {
|
||||
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||
title(string.new_playlist_title)
|
||||
|
|
|
@ -49,7 +49,7 @@ class DeletePlaylistDialog : DialogFragment() {
|
|||
)
|
||||
}
|
||||
|
||||
return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
|
||||
return MaterialDialog(requireContext())
|
||||
.show {
|
||||
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||
title(title)
|
||||
|
|
|
@ -59,7 +59,7 @@ class DeleteSongsDialog : DialogFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
||||
return MaterialDialog(requireContext()).show {
|
||||
title(title)
|
||||
message(text = content)
|
||||
negativeButton(android.R.string.cancel) {
|
||||
|
|
|
@ -54,7 +54,7 @@ class RemoveFromPlaylistDialog : DialogFragment() {
|
|||
}
|
||||
|
||||
|
||||
return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
|
||||
return MaterialDialog(requireContext())
|
||||
.show {
|
||||
title(title)
|
||||
message(text = content)
|
||||
|
|
|
@ -39,7 +39,7 @@ class RenamePlaylistDialog : DialogFragment() {
|
|||
private lateinit var actionNewPlaylistContainer: TextInputLayout
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
|
||||
val materialDialog = MaterialDialog(requireContext())
|
||||
.show {
|
||||
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||
title(string.rename_playlist_title)
|
||||
|
|
|
@ -58,7 +58,7 @@ class SleepTimerDialog : DialogFragment() {
|
|||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
timerUpdater = TimerUpdater()
|
||||
|
||||
materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
|
||||
materialDialog = MaterialDialog(requireContext())
|
||||
.title(R.string.action_sleep_timer)
|
||||
.cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||
.positiveButton(R.string.action_set) {
|
||||
|
|
|
@ -55,7 +55,7 @@ class SongDetailDialog : DialogFragment() {
|
|||
val context: Context = requireContext()
|
||||
val song = requireArguments().getParcelable<Song>("song")
|
||||
|
||||
val materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
|
||||
val materialDialog = MaterialDialog(requireContext())
|
||||
.show {
|
||||
customView(
|
||||
R.layout.dialog_file_details,
|
||||
|
|
|
@ -34,7 +34,7 @@ class SongShareDialog : DialogFragment() {
|
|||
val currentlyListening: String =
|
||||
getString(R.string.currently_listening_to_x_by_x, song?.title, song?.artistName)
|
||||
|
||||
return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
|
||||
return MaterialDialog(requireContext())
|
||||
.title(R.string.what_do_you_want_to_share)
|
||||
.show {
|
||||
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||
|
|
|
@ -16,7 +16,6 @@ package code.name.monkey.retromusic.fragments.settings
|
|||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.TwoStatePreference
|
||||
import code.name.monkey.appthemehelper.ACCENT_COLORS
|
||||
|
@ -30,9 +29,7 @@ import code.name.monkey.retromusic.App
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import com.afollestad.materialdialogs.LayoutMode
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||
import com.afollestad.materialdialogs.color.colorChooser
|
||||
|
||||
|
||||
|
@ -64,7 +61,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
accentColorPref.setColor(accentColor, ColorUtil.darkenColor(accentColor))
|
||||
|
||||
accentColorPref.setOnPreferenceClickListener {
|
||||
MaterialDialog(requireActivity(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
||||
MaterialDialog(requireActivity()).show {
|
||||
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||
title(R.string.accent_color)
|
||||
positiveButton(R.string.set)
|
||||
|
@ -76,9 +73,9 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
ThemeStore.editTheme(requireContext()).accentColor(color).commit()
|
||||
if (VersionUtils.hasNougatMR())
|
||||
DynamicShortcutManager(requireContext()).updateDynamicShortcuts()
|
||||
Handler().postDelayed({
|
||||
requireActivity().recreate()
|
||||
}, 400)
|
||||
|
||||
requireActivity().recreate()
|
||||
|
||||
}
|
||||
}
|
||||
return@setOnPreferenceClickListener true
|
||||
|
@ -102,7 +99,9 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
findPreference(PreferenceUtil.DESATURATED_COLOR)
|
||||
desaturatedColor?.setOnPreferenceChangeListener { _, value ->
|
||||
val desaturated = value as Boolean
|
||||
ThemeStore.prefs(requireContext()).edit().putBoolean("desaturated_color", desaturated)
|
||||
ThemeStore.prefs(requireContext())
|
||||
.edit()
|
||||
.putBoolean("desaturated_color", desaturated)
|
||||
.apply()
|
||||
PreferenceUtil.getInstance(requireContext()).setDesaturatedColor(desaturated)
|
||||
requireActivity().recreate()
|
||||
|
|
|
@ -30,9 +30,7 @@ import code.name.monkey.retromusic.adapter.CategoryInfoAdapter
|
|||
import code.name.monkey.retromusic.extensions.colorControlNormal
|
||||
import code.name.monkey.retromusic.model.CategoryInfo
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import com.afollestad.materialdialogs.LayoutMode
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||
import com.afollestad.materialdialogs.customview.customView
|
||||
import java.util.*
|
||||
|
||||
|
@ -79,7 +77,7 @@ class LibraryPreferenceDialog : PreferenceDialogFragmentCompat() {
|
|||
|
||||
adapter.attachToRecyclerView(recyclerView)
|
||||
|
||||
return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
|
||||
return MaterialDialog(requireContext())
|
||||
.title(R.string.library_categories)
|
||||
.cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||
.customView(view = view)
|
||||
|
|
|
@ -65,7 +65,7 @@ object AppRater {
|
|||
}
|
||||
|
||||
private fun showRateDialog(context: Context, editor: SharedPreferences.Editor) {
|
||||
MaterialDialog(context, BottomSheet(LayoutMode.WRAP_CONTENT))
|
||||
MaterialDialog(context)
|
||||
.show {
|
||||
|
||||
cornerRadius(PreferenceUtil.getInstance(context).dialogCorner)
|
||||
|
|
|
@ -75,7 +75,7 @@ class RingtoneManager(val context: Context) {
|
|||
}
|
||||
|
||||
fun getDialog(context: Context): MaterialDialog {
|
||||
return MaterialDialog(context, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
||||
return MaterialDialog(context).show {
|
||||
cornerRadius(PreferenceUtil.getInstance(context).dialogCorner)
|
||||
title(R.string.dialog_title_set_ringtone)
|
||||
message(R.string.dialog_message_set_ringtone)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
<style name="Theme.RetroMusic.FollowSystem" parent="Theme.RetroMusic.Base.Adaptive" >
|
||||
<item name="android:windowBackground">@color/window_color</item>
|
||||
<item name="android:scrollbars">none</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.RetroMusic.Notification" parent="@android:style/TextAppearance.StatusBar.EventContent" />
|
||||
|
|
Loading…
Reference in a new issue