From d593e7cf780dc2f0cb65d20001e0690984daafee Mon Sep 17 00:00:00 2001 From: h4h13 Date: Wed, 24 Jul 2019 00:02:41 +0530 Subject: [PATCH] Fix crashing on seekbar and file sharing --- app/build.gradle | 4 +- app/src/main/AndroidManifest.xml | 11 +++ .../retromusic/fragments/VolumeFragment.kt | 3 +- .../blur/BlurPlaybackControlsFragment.kt | 6 +- .../fragments/player/color/ColorFragment.kt | 4 +- .../color/ColorPlaybackControlsFragment.kt | 9 +- .../LockScreenPlayerControlsFragment.kt | 6 +- .../material/MaterialControlsFragment.kt | 6 +- .../normal/PlayerPlaybackControlsFragment.kt | 7 +- .../plain/PlainPlaybackControlsFragment.kt | 16 +-- .../fragments/settings/AbsSettingsFragment.kt | 8 +- .../AlbumCoverStylePreferenceDialog.kt | 18 +++- .../preferences/BlacklistPreferenceDialog.kt | 11 +-- .../preferences/LibraryPreference.kt | 17 +++- .../NowPlayingScreenPreferenceDialog.kt | 16 +-- .../monkey/retromusic/util/MusicUtil.java | 15 ++- .../name/monkey/retromusic/util/ViewUtil.kt | 15 +-- .../ic_play_circle_filled_white_24dp.xml | 1 - .../layout-xlarge/fragment_mini_player.xml | 3 +- ...ment_adaptive_player_playback_controls.xml | 6 +- ...ent_card_blur_player_playback_controls.xml | 4 +- ...fragment_flat_player_playback_controls.xml | 3 +- .../layout/fragment_full_player_controls.xml | 2 +- ...fragment_lock_screen_playback_controls.xml | 4 +- .../fragment_material_playback_controls.xml | 2 +- .../main/res/layout/fragment_mini_player.xml | 3 +- .../fragment_plain_controls_fragment.xml | 4 +- .../fragment_player_playback_controls.xml | 99 ++++++++++--------- app/src/main/res/layout/fragment_volume.xml | 2 + .../main/res/xml/pref_now_playing_screen.xml | 3 +- 30 files changed, 172 insertions(+), 136 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c0e2de1b..5a75ae55 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,8 +31,8 @@ android { vectorDrawables.useSupportLibrary = true applicationId "code.name.monkey.retromusic" - versionCode 340 - versionName '3.2.125' + versionCode 341 + versionName '3.2.135' multiDexEnabled true diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c6fb09da..d76e64d6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -152,6 +152,17 @@ android:resource="@xml/provider_paths" /> + + + + + diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/VolumeFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/VolumeFragment.kt index eaa1ad18..0ccfb6fd 100755 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/VolumeFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/VolumeFragment.kt @@ -127,7 +127,8 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum fun setTintableColor(color: Int) { volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN) volumeUp.setColorFilter(color, PorterDuff.Mode.SRC_IN) - ViewUtil.setProgressDrawable(volumeSeekBar, color, true) + TintHelper.setTint(volumeSeekBar, color, false) + //ViewUtil.setProgressDrawable(volumeSeekBar, color, true) } companion object { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlaybackControlsFragment.kt index d465b5df..6d880836 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlaybackControlsFragment.kt @@ -108,6 +108,7 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() { text.setTextColor(lastDisabledPlaybackControlsColor) setFabColor(lastPlaybackControlsColor) + ViewUtil.setProgressDrawable(progressSlider, lastPlaybackControlsColor) songCurrentProgress.setTextColor(lastPlaybackControlsColor) songTotalTime.setTextColor(lastPlaybackControlsColor) @@ -120,11 +121,6 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() { private fun setFabColor(i: Int) { TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(i)), false) TintHelper.setTintAuto(playPauseButton, i, true) - setProgressBarColor(i) - } - - private fun setProgressBarColor(newColor: Int) { - ViewUtil.setProgressDrawable(progressSlider, newColor) } private fun setUpPlayPauseFab() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt index b2f617e4..c727ad6d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt @@ -265,9 +265,9 @@ class ColorFragment : AbsPlayerFragment() { override fun onPostExecute(l: Lyrics?) { lyricsColor = l if (lyricsColor == null) { - lyricsView.setText(R.string.no_lyrics_found) + lyricsView?.setText(R.string.no_lyrics_found) } else { - lyricsView.text = lyricsColor!!.text + lyricsView?.text = lyricsColor!!.text } } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorPlaybackControlsFragment.kt index 2a916454..904140c7 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorPlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorPlaybackControlsFragment.kt @@ -22,7 +22,14 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.util.MusicUtil +import code.name.monkey.retromusic.util.ViewUtil import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.* +import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.progressSlider +import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.songCurrentProgress +import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.songTotalTime +import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.text +import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.title +import kotlinx.android.synthetic.main.fragment_player_playback_controls.* import kotlinx.android.synthetic.main.media_button.* class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() { @@ -99,7 +106,7 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() { title!!.setTextColor(lastPlaybackControlsColor) text!!.setTextColor(lastDisabledPlaybackControlsColor) - TintHelper.setTintAuto(progressSlider, lastPlaybackControlsColor, false) + ViewUtil.setProgressDrawable(progressSlider, lastPlaybackControlsColor) volumeFragment?.setTintableColor(lastPlaybackControlsColor) diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt index 71621910..cf04ea3e 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt @@ -30,12 +30,12 @@ import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.extensions.ripAlpha +import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener import code.name.monkey.retromusic.service.MusicService -import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.ViewUtil @@ -124,10 +124,10 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() { val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) { color } else { - ThemeStore.textColorSecondary(context!!).ripAlpha() + ThemeStore.textColorSecondary(context!!) } volumeFragment?.setTintable(colorFinal) - ViewUtil.setProgressDrawable(progressSlider, ColorUtil.stripAlpha(colorFinal), true) + ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), true) updatePrevNextColor() diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt index 091d7ec1..14229973 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt @@ -14,12 +14,12 @@ import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.extensions.ripAlpha +import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener import code.name.monkey.retromusic.service.MusicService -import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.ViewUtil @@ -107,10 +107,10 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() { lastPlaybackControlsColor = color color } else { - ThemeStore.textColorSecondary(context!!).ripAlpha() + ThemeStore.textColorSecondary(context!!) } text.setTextColor(colorFinal) - ViewUtil.setProgressDrawable(progressSlider, ColorUtil.stripAlpha(colorFinal), true) + ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), true) volumeFragment?.setTintable(colorFinal) diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt index 77583ede..a671380c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt @@ -16,12 +16,12 @@ import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.extensions.ripAlpha +import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener import code.name.monkey.retromusic.service.MusicService -import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.ViewUtil @@ -72,12 +72,13 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() { val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) { color } else { - ThemeStore.accentColor(context!!).ripAlpha() + ThemeStore.accentColor(context!!) } TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false) TintHelper.setTintAuto(playPauseButton, colorFinal, true) - ViewUtil.setProgressDrawable(progressSlider, colorFinal) + + ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), false) volumeFragment?.setTintable(colorFinal) diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt index ef5e6206..bbc1743f 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt @@ -17,6 +17,7 @@ import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.retromusic.R +import code.name.monkey.retromusic.extensions.ripAlpha import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler @@ -26,8 +27,15 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.ViewUtil +import kotlinx.android.synthetic.main.fragment_flat_player_playback_controls.* import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.* +import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.progressSlider +import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.songCurrentProgress +import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.songTotalTime import kotlinx.android.synthetic.main.media_button.* +import kotlinx.android.synthetic.main.media_button.playPauseButton +import kotlinx.android.synthetic.main.media_button.repeatButton +import kotlinx.android.synthetic.main.media_button.shuffleButton /** * @author Hemanth S (h4h13). @@ -136,18 +144,14 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() { TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false) TintHelper.setTintAuto(playPauseButton, colorFinal, true) - setProgressBarColor(colorFinal) + + ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), true) updateRepeatState() updateShuffleState() updatePrevNextColor() } - private fun setProgressBarColor(newColor: Int) { - progressSlider.thumbTintList = ColorStateList.valueOf(newColor) - ViewUtil.setProgressDrawable(progressSlider, newColor) - } - private fun setUpShuffleButton() { shuffleButton.setOnClickListener { MusicPlayerRemote.toggleShuffleMode() } } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AbsSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AbsSettingsFragment.kt index 494ce0fb..bd74ae9c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AbsSettingsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AbsSettingsFragment.kt @@ -71,14 +71,14 @@ abstract class AbsSettingsFragment : PreferenceFragmentCompat() { var dialogFragment: DialogFragment? = null// Dialog creation could not be handled here. Try with the super method. // The dialog was created (it was one of our custom Preferences), show the dialog for it when (preference) { - is LibraryPreference -> dialogFragment = LibraryPreferenceDialog.newInstance() - is NowPlayingScreenPreference -> dialogFragment = NowPlayingScreenPreferenceDialog.newInstance( ) - is AlbumCoverStylePreference -> dialogFragment = AlbumCoverStylePreferenceDialog.newInstance() + is LibraryPreference -> dialogFragment = LibraryPreferenceDialog.newInstance(preference.key) + is NowPlayingScreenPreference -> dialogFragment = NowPlayingScreenPreferenceDialog.newInstance(preference.key) + is AlbumCoverStylePreference -> dialogFragment = AlbumCoverStylePreferenceDialog.newInstance(preference.key) is MaterialListPreference -> { preference.entries dialogFragment = MaterialListPreferenceDialog.newInstance(preference) } - is BlacklistPreference -> dialogFragment = BlacklistPreferenceDialog.newInstance(preference.key) + is BlacklistPreference -> dialogFragment = BlacklistPreferenceDialog.newInstance() } if (dialogFragment != null) { diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt index 33b4a57a..c6f92d92 100644 --- a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt @@ -17,6 +17,7 @@ package code.name.monkey.retromusic.preferences import android.annotation.SuppressLint import android.app.Dialog import android.content.Context +import android.graphics.PorterDuff import android.os.Bundle import android.util.AttributeSet import android.view.LayoutInflater @@ -24,10 +25,11 @@ import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView -import androidx.preference.DialogPreference import androidx.preference.PreferenceDialogFragmentCompat import androidx.viewpager.widget.PagerAdapter import androidx.viewpager.widget.ViewPager +import code.name.monkey.appthemehelper.ThemeStore +import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference import code.name.monkey.retromusic.R import code.name.monkey.retromusic.fragments.AlbumCoverStyle import code.name.monkey.retromusic.util.PreferenceUtil @@ -37,7 +39,7 @@ import com.afollestad.materialdialogs.customview.customView import com.bumptech.glide.Glide -class AlbumCoverStylePreference : DialogPreference { +class AlbumCoverStylePreference : ATEDialogPreference { constructor(context: Context) : super(context) constructor(context: Context, attrs: AttributeSet) : super(context, attrs) @@ -51,6 +53,10 @@ class AlbumCoverStylePreference : DialogPreference { override fun getDialogLayoutResource(): Int { return mLayoutRes; } + + init { + icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN) + } } class AlbumCoverStylePreferenceDialog : PreferenceDialogFragmentCompat(), ViewPager.OnPageChangeListener { @@ -130,8 +136,12 @@ class AlbumCoverStylePreferenceDialog : PreferenceDialogFragmentCompat(), ViewPa companion object { val TAG: String = AlbumCoverStylePreferenceDialog::class.java.simpleName - fun newInstance(): AlbumCoverStylePreferenceDialog { - return AlbumCoverStylePreferenceDialog() + fun newInstance(key: String): AlbumCoverStylePreferenceDialog { + val bundle = Bundle() + bundle.putString(ARG_KEY, key) + val fragment = AlbumCoverStylePreferenceDialog() + fragment.arguments = bundle + return fragment } } } diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt index 788b2606..780bf798 100644 --- a/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt @@ -21,7 +21,6 @@ import android.os.Bundle import android.text.Html import android.util.AttributeSet import androidx.fragment.app.DialogFragment -import androidx.preference.DialogPreference import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference import code.name.monkey.retromusic.R @@ -49,14 +48,8 @@ class BlacklistPreference : ATEDialogPreference { class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog.FolderCallback { companion object { - private const val EXTRA_KEY = "key" - - fun newInstance(key: String): BlacklistPreferenceDialog { - val args = Bundle() - args.putString(EXTRA_KEY, key) - val fragment = BlacklistPreferenceDialog() - fragment.arguments = args - return fragment + fun newInstance(): BlacklistPreferenceDialog { + return BlacklistPreferenceDialog() } } diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt index 8dd8d7e8..c5428ebe 100644 --- a/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt +++ b/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt @@ -20,7 +20,7 @@ import android.graphics.PorterDuff import android.os.Bundle import android.util.AttributeSet import android.widget.Toast -import androidx.fragment.app.DialogFragment +import androidx.preference.PreferenceDialogFragmentCompat import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import code.name.monkey.appthemehelper.ThemeStore @@ -48,7 +48,12 @@ class LibraryPreference : ATEDialogPreference { } } -class LibraryPreferenceDialog : DialogFragment() { +class LibraryPreferenceDialog : PreferenceDialogFragmentCompat() { + + override fun onDialogClosed(positiveResult: Boolean) { + + } + lateinit var adapter: CategoryInfoAdapter override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { @@ -110,8 +115,12 @@ class LibraryPreferenceDialog : DialogFragment() { companion object { - fun newInstance(): LibraryPreferenceDialog { - return LibraryPreferenceDialog() + fun newInstance(key: String): LibraryPreferenceDialog { + val bundle = Bundle() + bundle.putString(ARG_KEY, key) + val fragment = LibraryPreferenceDialog() + fragment.arguments = bundle + return fragment } } } \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt index d234d335..4feceb65 100644 --- a/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt @@ -25,11 +25,11 @@ import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import android.widget.Toast -import androidx.preference.DialogPreference import androidx.preference.PreferenceDialogFragmentCompat import androidx.viewpager.widget.PagerAdapter import androidx.viewpager.widget.ViewPager import code.name.monkey.appthemehelper.ThemeStore +import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference import code.name.monkey.retromusic.App import code.name.monkey.retromusic.R import code.name.monkey.retromusic.fragments.NowPlayingScreen @@ -40,7 +40,7 @@ import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.customview.customView import com.bumptech.glide.Glide -class NowPlayingScreenPreference : DialogPreference { +class NowPlayingScreenPreference : ATEDialogPreference { constructor(context: Context) : super(context) {} @@ -62,7 +62,9 @@ class NowPlayingScreenPreference : DialogPreference { } class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewPager.OnPageChangeListener { + private var viewPagerPosition: Int = 0 + override fun onPageScrollStateChanged(state: Int) { } @@ -124,10 +126,12 @@ class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewP } companion object { - - - fun newInstance(): NowPlayingScreenPreferenceDialog { - return NowPlayingScreenPreferenceDialog() + fun newInstance(key: String): NowPlayingScreenPreferenceDialog { + val bundle = Bundle() + bundle.putString(ARG_KEY, key) + val fragment = NowPlayingScreenPreferenceDialog() + fragment.arguments = bundle + return fragment } } } diff --git a/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java index 0dae40bb..4f75cd61 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java @@ -73,7 +73,7 @@ public class MusicUtil { @NonNull public static Intent createShareSongFileIntent(@NonNull final Song song, @NonNull Context context) { - Uri file = FileProvider.getUriForFile(context, context.getPackageName() + ".provider", new File(song.getData())); + /*Uri file = FileProvider.getUriForFile(context, context.getPackageName() + ".provider", new File(song.getData())); try { return new Intent().setAction(Intent.ACTION_SEND).putExtra(Intent.EXTRA_STREAM, file) .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) @@ -82,6 +82,19 @@ public class MusicUtil { e.printStackTrace(); Toast.makeText(context, "Could not share this file, I'm aware of the issue.", Toast.LENGTH_SHORT).show(); return new Intent(); + }*/ + + try { + return new Intent() + .setAction(Intent.ACTION_SEND) + .putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName(), new File(song.getData()))) + .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + .setType("audio/*"); + } catch (IllegalArgumentException e) { + // TODO the path is most likely not like /storage/emulated/0/... but something like /storage/28C7-75B0/... + e.printStackTrace(); + Toast.makeText(context, "Could not share this file, I'm aware of the issue.", Toast.LENGTH_SHORT).show(); + return new Intent(); } } diff --git a/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt b/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt index f07a9b54..06b6012d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt +++ b/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt @@ -53,20 +53,7 @@ object ViewUtil { if (thumbTint) { progressSlider.thumbTintList = ColorStateList.valueOf(newColor) } - - if (progressSlider.progressDrawable is LayerDrawable) { - val ld = progressSlider.progressDrawable as LayerDrawable? - - if (ld != null) { - val clipDrawableProgress = ld.findDrawableByLayerId(android.R.id.progress) - clipDrawableProgress.setColorFilter(newColor, PorterDuff.Mode.SRC_IN) - - val clipDrawableBackground = ld.findDrawableByLayerId(android.R.id.background) - clipDrawableBackground.setColorFilter(MaterialValueHelper.getPrimaryDisabledTextColor(progressSlider.context, ColorUtil.isColorLight(ThemeStore.primaryColor(progressSlider.context))), PorterDuff.Mode.SRC_IN) - } - } else { - progressSlider.progressTintList = ColorStateList.valueOf(newColor) - } + progressSlider.progressTintList = ColorStateList.valueOf(newColor) } fun setProgressDrawable(progressSlider: ProgressBar, newColor: Int) { diff --git a/app/src/main/res/drawable/ic_play_circle_filled_white_24dp.xml b/app/src/main/res/drawable/ic_play_circle_filled_white_24dp.xml index b03fe193..87619b25 100644 --- a/app/src/main/res/drawable/ic_play_circle_filled_white_24dp.xml +++ b/app/src/main/res/drawable/ic_play_circle_filled_white_24dp.xml @@ -5,7 +5,6 @@ android:viewportWidth="24" android:viewportHeight="24"> - diff --git a/app/src/main/res/layout-xlarge/fragment_mini_player.xml b/app/src/main/res/layout-xlarge/fragment_mini_player.xml index 2330dc62..8849595b 100644 --- a/app/src/main/res/layout-xlarge/fragment_mini_player.xml +++ b/app/src/main/res/layout-xlarge/fragment_mini_player.xml @@ -85,7 +85,6 @@ style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal" android:layout_width="match_parent" android:layout_height="3dp" - android:progress="20" - android:progressDrawable="@drawable/color_progress_seek" /> + android:progress="20" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_adaptive_player_playback_controls.xml b/app/src/main/res/layout/fragment_adaptive_player_playback_controls.xml index aa36fe55..cbff386c 100644 --- a/app/src/main/res/layout/fragment_adaptive_player_playback_controls.xml +++ b/app/src/main/res/layout/fragment_adaptive_player_playback_controls.xml @@ -49,13 +49,13 @@ diff --git a/app/src/main/res/layout/fragment_card_blur_player_playback_controls.xml b/app/src/main/res/layout/fragment_card_blur_player_playback_controls.xml index e68bc8ab..273bd432 100644 --- a/app/src/main/res/layout/fragment_card_blur_player_playback_controls.xml +++ b/app/src/main/res/layout/fragment_card_blur_player_playback_controls.xml @@ -56,12 +56,12 @@ diff --git a/app/src/main/res/layout/fragment_lock_screen_playback_controls.xml b/app/src/main/res/layout/fragment_lock_screen_playback_controls.xml index afdd0dfc..e3d13032 100644 --- a/app/src/main/res/layout/fragment_lock_screen_playback_controls.xml +++ b/app/src/main/res/layout/fragment_lock_screen_playback_controls.xml @@ -87,13 +87,13 @@ diff --git a/app/src/main/res/layout/fragment_material_playback_controls.xml b/app/src/main/res/layout/fragment_material_playback_controls.xml index 28327c22..5d92051b 100644 --- a/app/src/main/res/layout/fragment_material_playback_controls.xml +++ b/app/src/main/res/layout/fragment_material_playback_controls.xml @@ -45,13 +45,13 @@ diff --git a/app/src/main/res/layout/fragment_mini_player.xml b/app/src/main/res/layout/fragment_mini_player.xml index 2d9aab6f..692e072d 100644 --- a/app/src/main/res/layout/fragment_mini_player.xml +++ b/app/src/main/res/layout/fragment_mini_player.xml @@ -88,6 +88,5 @@ style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal" android:layout_width="match_parent" android:layout_height="3dp" - android:progress="20" - android:progressDrawable="@drawable/color_progress_seek" /> + android:progress="20" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_plain_controls_fragment.xml b/app/src/main/res/layout/fragment_plain_controls_fragment.xml index 20f2af22..f1d581d1 100644 --- a/app/src/main/res/layout/fragment_plain_controls_fragment.xml +++ b/app/src/main/res/layout/fragment_plain_controls_fragment.xml @@ -42,13 +42,13 @@ diff --git a/app/src/main/res/layout/fragment_player_playback_controls.xml b/app/src/main/res/layout/fragment_player_playback_controls.xml index 7464b302..1fc61597 100755 --- a/app/src/main/res/layout/fragment_player_playback_controls.xml +++ b/app/src/main/res/layout/fragment_player_playback_controls.xml @@ -8,10 +8,59 @@ android:orientation="vertical" tools:ignore="MissingPrefix"> + + + + + + + + + + @@ -48,54 +97,6 @@ android:textColor="?android:attr/textColorSecondary" /> - - - - - - - - - + app:enableCopying="true" + app:icon="@drawable/ic_image_white_24dp" />