From f9206dcfdb7f1fc4d57a99dafce88ae0a1b73d3e Mon Sep 17 00:00:00 2001 From: Hemanth S Date: Sun, 18 Oct 2020 01:30:00 +0530 Subject: [PATCH] Ringtone permission dialog showing #937 Fix crashing on album edit or artist edit and --- .../fragments/albums/AlbumDetailsFragment.kt | 10 +++------- .../fragments/artists/ArtistDetailsFragment.kt | 4 ++-- .../retromusic/fragments/base/AbsPlayerFragment.kt | 2 +- .../name/monkey/retromusic/glide/SingleColorTarget.kt | 2 +- .../name/monkey/retromusic/util/RingtoneManager.kt | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/albums/AlbumDetailsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/albums/AlbumDetailsFragment.kt index f4008bbe..3f351fe8 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/albums/AlbumDetailsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/albums/AlbumDetailsFragment.kt @@ -17,11 +17,7 @@ package code.name.monkey.retromusic.fragments.albums import android.app.ActivityOptions import android.content.Intent import android.os.Bundle -import android.view.Menu -import android.view.MenuInflater -import android.view.MenuItem -import android.view.SubMenu -import android.view.View +import android.view.* import androidx.appcompat.app.AppCompatActivity import androidx.core.os.bundleOf import androidx.core.text.HtmlCompat @@ -287,8 +283,8 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det } private fun setColors(color: Int) { - shuffleAction.applyColor(color) - playAction.applyOutlineColor(color) + shuffleAction?.applyColor(color) + playAction?.applyOutlineColor(color) } override fun onAlbumClick(albumId: Long, view: View) { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/artists/ArtistDetailsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/artists/ArtistDetailsFragment.kt index e9f00117..503916f3 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/artists/ArtistDetailsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/artists/ArtistDetailsFragment.kt @@ -223,8 +223,8 @@ class ArtistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_artist_d } private fun setColors(color: Int) { - shuffleAction.applyColor(color) - playAction.applyOutlineColor(color) + shuffleAction?.applyColor(color) + playAction?.applyOutlineColor(color) } override fun onAlbumClick(albumId: Long, view: View) { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerFragment.kt index 7899823f..43c02dfd 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerFragment.kt @@ -50,13 +50,13 @@ import code.name.monkey.retromusic.model.lyrics.Lyrics import code.name.monkey.retromusic.repository.RealRepository import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.util.* -import java.io.FileNotFoundException import kotlinx.android.synthetic.main.shadow_statusbar_toolbar.* import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.koin.android.ext.android.get +import java.io.FileNotFoundException abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragment(layout), Toolbar.OnMenuItemClickListener, IPaletteColorHolder, PlayerAlbumCoverFragment.Callbacks { diff --git a/app/src/main/java/code/name/monkey/retromusic/glide/SingleColorTarget.kt b/app/src/main/java/code/name/monkey/retromusic/glide/SingleColorTarget.kt index dbe27624..989419fb 100644 --- a/app/src/main/java/code/name/monkey/retromusic/glide/SingleColorTarget.kt +++ b/app/src/main/java/code/name/monkey/retromusic/glide/SingleColorTarget.kt @@ -25,7 +25,7 @@ import com.bumptech.glide.request.animation.GlideAnimation abstract class SingleColorTarget(view: ImageView) : BitmapPaletteTarget(view) { - protected val defaultFooterColor: Int + private val defaultFooterColor: Int get() = ATHUtil.resolveColor(view.context, R.attr.colorControlNormal) abstract fun onColorReady(color: Int) diff --git a/app/src/main/java/code/name/monkey/retromusic/util/RingtoneManager.kt b/app/src/main/java/code/name/monkey/retromusic/util/RingtoneManager.kt index 5a969105..cf8226d9 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/RingtoneManager.kt +++ b/app/src/main/java/code/name/monkey/retromusic/util/RingtoneManager.kt @@ -73,7 +73,7 @@ class RingtoneManager(val context: Context) { return false } - fun getDialog(context: Context): AlertDialog { + fun getDialog(context: Context) { return MaterialAlertDialogBuilder(context, R.style.MaterialAlertDialogTheme) .setTitle(R.string.dialog_title_set_ringtone) .setMessage(R.string.dialog_message_set_ringtone) @@ -83,7 +83,7 @@ class RingtoneManager(val context: Context) { context.startActivity(intent) } .setNegativeButton(android.R.string.cancel, null) - .create() + .create().show() } } } \ No newline at end of file