Fix crashing on seekbar and file sharing

This commit is contained in:
h4h13 2019-07-24 00:02:41 +05:30
parent 67ea2a40a9
commit d593e7cf78
30 changed files with 172 additions and 136 deletions

View file

@ -31,8 +31,8 @@ android {
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic" applicationId "code.name.monkey.retromusic"
versionCode 340 versionCode 341
versionName '3.2.125' versionName '3.2.135'
multiDexEnabled true multiDexEnabled true

View file

@ -152,6 +152,17 @@
android:resource="@xml/provider_paths" /> android:resource="@xml/provider_paths" />
</provider> </provider>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<receiver android:name=".service.MediaButtonIntentReceiver"> <receiver android:name=".service.MediaButtonIntentReceiver">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" /> <action android:name="android.intent.action.MEDIA_BUTTON" />

View file

@ -127,7 +127,8 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum
fun setTintableColor(color: Int) { fun setTintableColor(color: Int) {
volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN) volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN)
volumeUp.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 { companion object {

View file

@ -108,6 +108,7 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
text.setTextColor(lastDisabledPlaybackControlsColor) text.setTextColor(lastDisabledPlaybackControlsColor)
setFabColor(lastPlaybackControlsColor) setFabColor(lastPlaybackControlsColor)
ViewUtil.setProgressDrawable(progressSlider, lastPlaybackControlsColor)
songCurrentProgress.setTextColor(lastPlaybackControlsColor) songCurrentProgress.setTextColor(lastPlaybackControlsColor)
songTotalTime.setTextColor(lastPlaybackControlsColor) songTotalTime.setTextColor(lastPlaybackControlsColor)
@ -120,11 +121,6 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
private fun setFabColor(i: Int) { private fun setFabColor(i: Int) {
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(i)), false) TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(i)), false)
TintHelper.setTintAuto(playPauseButton, i, true) TintHelper.setTintAuto(playPauseButton, i, true)
setProgressBarColor(i)
}
private fun setProgressBarColor(newColor: Int) {
ViewUtil.setProgressDrawable(progressSlider, newColor)
} }
private fun setUpPlayPauseFab() { private fun setUpPlayPauseFab() {

View file

@ -265,9 +265,9 @@ class ColorFragment : AbsPlayerFragment() {
override fun onPostExecute(l: Lyrics?) { override fun onPostExecute(l: Lyrics?) {
lyricsColor = l lyricsColor = l
if (lyricsColor == null) { if (lyricsColor == null) {
lyricsView.setText(R.string.no_lyrics_found) lyricsView?.setText(R.string.no_lyrics_found)
} else { } else {
lyricsView.text = lyricsColor!!.text lyricsView?.text = lyricsColor!!.text
} }
} }

View file

@ -22,7 +22,14 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.service.MusicService
import code.name.monkey.retromusic.util.MusicUtil 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.*
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.* import kotlinx.android.synthetic.main.media_button.*
class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() { class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
@ -99,7 +106,7 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
title!!.setTextColor(lastPlaybackControlsColor) title!!.setTextColor(lastPlaybackControlsColor)
text!!.setTextColor(lastDisabledPlaybackControlsColor) text!!.setTextColor(lastDisabledPlaybackControlsColor)
TintHelper.setTintAuto(progressSlider, lastPlaybackControlsColor, false) ViewUtil.setProgressDrawable(progressSlider, lastPlaybackControlsColor)
volumeFragment?.setTintableColor(lastPlaybackControlsColor) volumeFragment?.setTintableColor(lastPlaybackControlsColor)

View file

@ -30,12 +30,12 @@ import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.ripAlpha 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.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.service.MusicService 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.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.ViewUtil import code.name.monkey.retromusic.util.ViewUtil
@ -124,10 +124,10 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) { val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
color color
} else { } else {
ThemeStore.textColorSecondary(context!!).ripAlpha() ThemeStore.textColorSecondary(context!!)
} }
volumeFragment?.setTintable(colorFinal) volumeFragment?.setTintable(colorFinal)
ViewUtil.setProgressDrawable(progressSlider, ColorUtil.stripAlpha(colorFinal), true) ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), true)
updatePrevNextColor() updatePrevNextColor()

View file

@ -14,12 +14,12 @@ import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.ripAlpha 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.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.service.MusicService 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.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.ViewUtil import code.name.monkey.retromusic.util.ViewUtil
@ -107,10 +107,10 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
lastPlaybackControlsColor = color lastPlaybackControlsColor = color
color color
} else { } else {
ThemeStore.textColorSecondary(context!!).ripAlpha() ThemeStore.textColorSecondary(context!!)
} }
text.setTextColor(colorFinal) text.setTextColor(colorFinal)
ViewUtil.setProgressDrawable(progressSlider, ColorUtil.stripAlpha(colorFinal), true) ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), true)
volumeFragment?.setTintable(colorFinal) volumeFragment?.setTintable(colorFinal)

View file

@ -16,12 +16,12 @@ import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.ripAlpha 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.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.service.MusicService 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.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.ViewUtil import code.name.monkey.retromusic.util.ViewUtil
@ -72,12 +72,13 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) { val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
color color
} else { } else {
ThemeStore.accentColor(context!!).ripAlpha() ThemeStore.accentColor(context!!)
} }
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false) TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false)
TintHelper.setTintAuto(playPauseButton, colorFinal, true) TintHelper.setTintAuto(playPauseButton, colorFinal, true)
ViewUtil.setProgressDrawable(progressSlider, colorFinal)
ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), false)
volumeFragment?.setTintable(colorFinal) volumeFragment?.setTintable(colorFinal)

View file

@ -17,6 +17,7 @@ import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R 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.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler 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.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.ViewUtil 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.*
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.*
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). * @author Hemanth S (h4h13).
@ -136,18 +144,14 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false) TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false)
TintHelper.setTintAuto(playPauseButton, colorFinal, true) TintHelper.setTintAuto(playPauseButton, colorFinal, true)
setProgressBarColor(colorFinal)
ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), true)
updateRepeatState() updateRepeatState()
updateShuffleState() updateShuffleState()
updatePrevNextColor() updatePrevNextColor()
} }
private fun setProgressBarColor(newColor: Int) {
progressSlider.thumbTintList = ColorStateList.valueOf(newColor)
ViewUtil.setProgressDrawable(progressSlider, newColor)
}
private fun setUpShuffleButton() { private fun setUpShuffleButton() {
shuffleButton.setOnClickListener { MusicPlayerRemote.toggleShuffleMode() } shuffleButton.setOnClickListener { MusicPlayerRemote.toggleShuffleMode() }
} }

View file

@ -71,14 +71,14 @@ abstract class AbsSettingsFragment : PreferenceFragmentCompat() {
var dialogFragment: DialogFragment? = null// Dialog creation could not be handled here. Try with the super method. 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 // The dialog was created (it was one of our custom Preferences), show the dialog for it
when (preference) { when (preference) {
is LibraryPreference -> dialogFragment = LibraryPreferenceDialog.newInstance() is LibraryPreference -> dialogFragment = LibraryPreferenceDialog.newInstance(preference.key)
is NowPlayingScreenPreference -> dialogFragment = NowPlayingScreenPreferenceDialog.newInstance( ) is NowPlayingScreenPreference -> dialogFragment = NowPlayingScreenPreferenceDialog.newInstance(preference.key)
is AlbumCoverStylePreference -> dialogFragment = AlbumCoverStylePreferenceDialog.newInstance() is AlbumCoverStylePreference -> dialogFragment = AlbumCoverStylePreferenceDialog.newInstance(preference.key)
is MaterialListPreference -> { is MaterialListPreference -> {
preference.entries preference.entries
dialogFragment = MaterialListPreferenceDialog.newInstance(preference) dialogFragment = MaterialListPreferenceDialog.newInstance(preference)
} }
is BlacklistPreference -> dialogFragment = BlacklistPreferenceDialog.newInstance(preference.key) is BlacklistPreference -> dialogFragment = BlacklistPreferenceDialog.newInstance()
} }
if (dialogFragment != null) { if (dialogFragment != null) {

View file

@ -17,6 +17,7 @@ package code.name.monkey.retromusic.preferences
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Dialog import android.app.Dialog
import android.content.Context import android.content.Context
import android.graphics.PorterDuff
import android.os.Bundle import android.os.Bundle
import android.util.AttributeSet import android.util.AttributeSet
import android.view.LayoutInflater import android.view.LayoutInflater
@ -24,10 +25,11 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.preference.DialogPreference
import androidx.preference.PreferenceDialogFragmentCompat import androidx.preference.PreferenceDialogFragmentCompat
import androidx.viewpager.widget.PagerAdapter import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager 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.R
import code.name.monkey.retromusic.fragments.AlbumCoverStyle import code.name.monkey.retromusic.fragments.AlbumCoverStyle
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
@ -37,7 +39,7 @@ import com.afollestad.materialdialogs.customview.customView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
class AlbumCoverStylePreference : DialogPreference { class AlbumCoverStylePreference : ATEDialogPreference {
constructor(context: Context) : super(context) constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
@ -51,6 +53,10 @@ class AlbumCoverStylePreference : DialogPreference {
override fun getDialogLayoutResource(): Int { override fun getDialogLayoutResource(): Int {
return mLayoutRes; return mLayoutRes;
} }
init {
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
}
} }
class AlbumCoverStylePreferenceDialog : PreferenceDialogFragmentCompat(), ViewPager.OnPageChangeListener { class AlbumCoverStylePreferenceDialog : PreferenceDialogFragmentCompat(), ViewPager.OnPageChangeListener {
@ -130,8 +136,12 @@ class AlbumCoverStylePreferenceDialog : PreferenceDialogFragmentCompat(), ViewPa
companion object { companion object {
val TAG: String = AlbumCoverStylePreferenceDialog::class.java.simpleName val TAG: String = AlbumCoverStylePreferenceDialog::class.java.simpleName
fun newInstance(): AlbumCoverStylePreferenceDialog { fun newInstance(key: String): AlbumCoverStylePreferenceDialog {
return AlbumCoverStylePreferenceDialog() val bundle = Bundle()
bundle.putString(ARG_KEY, key)
val fragment = AlbumCoverStylePreferenceDialog()
fragment.arguments = bundle
return fragment
} }
} }
} }

View file

@ -21,7 +21,6 @@ import android.os.Bundle
import android.text.Html import android.text.Html
import android.util.AttributeSet import android.util.AttributeSet
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import androidx.preference.DialogPreference
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
@ -49,14 +48,8 @@ class BlacklistPreference : ATEDialogPreference {
class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog.FolderCallback { class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog.FolderCallback {
companion object { companion object {
private const val EXTRA_KEY = "key" fun newInstance(): BlacklistPreferenceDialog {
return BlacklistPreferenceDialog()
fun newInstance(key: String): BlacklistPreferenceDialog {
val args = Bundle()
args.putString(EXTRA_KEY, key)
val fragment = BlacklistPreferenceDialog()
fragment.arguments = args
return fragment
} }
} }

View file

@ -20,7 +20,7 @@ import android.graphics.PorterDuff
import android.os.Bundle import android.os.Bundle
import android.util.AttributeSet import android.util.AttributeSet
import android.widget.Toast import android.widget.Toast
import androidx.fragment.app.DialogFragment import androidx.preference.PreferenceDialogFragmentCompat
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore 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 lateinit var adapter: CategoryInfoAdapter
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
@ -110,8 +115,12 @@ class LibraryPreferenceDialog : DialogFragment() {
companion object { companion object {
fun newInstance(): LibraryPreferenceDialog { fun newInstance(key: String): LibraryPreferenceDialog {
return LibraryPreferenceDialog() val bundle = Bundle()
bundle.putString(ARG_KEY, key)
val fragment = LibraryPreferenceDialog()
fragment.arguments = bundle
return fragment
} }
} }
} }

View file

@ -25,11 +25,11 @@ import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import androidx.preference.DialogPreference
import androidx.preference.PreferenceDialogFragmentCompat import androidx.preference.PreferenceDialogFragmentCompat
import androidx.viewpager.widget.PagerAdapter import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.ThemeStore 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.App
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.fragments.NowPlayingScreen import code.name.monkey.retromusic.fragments.NowPlayingScreen
@ -40,7 +40,7 @@ import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView import com.afollestad.materialdialogs.customview.customView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
class NowPlayingScreenPreference : DialogPreference { class NowPlayingScreenPreference : ATEDialogPreference {
constructor(context: Context) : super(context) {} constructor(context: Context) : super(context) {}
@ -62,7 +62,9 @@ class NowPlayingScreenPreference : DialogPreference {
} }
class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewPager.OnPageChangeListener { class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewPager.OnPageChangeListener {
private var viewPagerPosition: Int = 0 private var viewPagerPosition: Int = 0
override fun onPageScrollStateChanged(state: Int) { override fun onPageScrollStateChanged(state: Int) {
} }
@ -124,10 +126,12 @@ class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewP
} }
companion object { companion object {
fun newInstance(key: String): NowPlayingScreenPreferenceDialog {
val bundle = Bundle()
fun newInstance(): NowPlayingScreenPreferenceDialog { bundle.putString(ARG_KEY, key)
return NowPlayingScreenPreferenceDialog() val fragment = NowPlayingScreenPreferenceDialog()
fragment.arguments = bundle
return fragment
} }
} }
} }

View file

@ -73,7 +73,7 @@ public class MusicUtil {
@NonNull @NonNull
public static Intent createShareSongFileIntent(@NonNull final Song song, @NonNull Context context) { 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 { try {
return new Intent().setAction(Intent.ACTION_SEND).putExtra(Intent.EXTRA_STREAM, file) return new Intent().setAction(Intent.ACTION_SEND).putExtra(Intent.EXTRA_STREAM, file)
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
@ -82,6 +82,19 @@ public class MusicUtil {
e.printStackTrace(); e.printStackTrace();
Toast.makeText(context, "Could not share this file, I'm aware of the issue.", Toast.LENGTH_SHORT).show(); Toast.makeText(context, "Could not share this file, I'm aware of the issue.", Toast.LENGTH_SHORT).show();
return new Intent(); 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();
} }
} }

View file

@ -53,21 +53,8 @@ object ViewUtil {
if (thumbTint) { if (thumbTint) {
progressSlider.thumbTintList = ColorStateList.valueOf(newColor) 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) { fun setProgressDrawable(progressSlider: ProgressBar, newColor: Int) {

View file

@ -5,7 +5,6 @@
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:fillColor="@color/md_white_1000" android:fillColor="@color/md_white_1000"
android:pathData="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-2-3.5l6-4.5-6-4.5z" /> android:pathData="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-2-3.5l6-4.5-6-4.5z" />

View file

@ -85,7 +85,6 @@
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal" style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="3dp" android:layout_height="3dp"
android:progress="20" android:progress="20" />
android:progressDrawable="@drawable/color_progress_seek" />
</code.name.monkey.retromusic.views.FitSystemWindowsLayout> </code.name.monkey.retromusic.views.FitSystemWindowsLayout>

View file

@ -49,13 +49,13 @@
<SeekBar <SeekBar
android:id="@+id/progressSlider" android:id="@+id/progressSlider"
android:layout_centerVertical="true" style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/songTotalTime" android:layout_toLeftOf="@id/songTotalTime"
android:layout_toRightOf="@id/songCurrentProgress" android:layout_toRightOf="@id/songCurrentProgress"
android:maxHeight="3dp" android:maxHeight="2dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false" android:splitTrack="false"
tools:ignore="RtlHardcoded,UnusedAttribute" tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" /> tools:progress="20" />

View file

@ -56,12 +56,12 @@
<androidx.appcompat.widget.AppCompatSeekBar <androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider" android:id="@+id/progressSlider"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxHeight="3dp" android:maxHeight="2dp"
android:paddingStart="20dp" android:paddingStart="20dp"
android:paddingEnd="20dp" android:paddingEnd="20dp"
android:progressDrawable="@drawable/color_progress_seek"
android:progressTint="@color/md_white_1000" android:progressTint="@color/md_white_1000"
android:splitTrack="false" android:splitTrack="false"
android:thumbTint="@color/md_white_1000" android:thumbTint="@color/md_white_1000"

View file

@ -51,8 +51,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@id/songTotalTime" android:layout_toLeftOf="@id/songTotalTime"
android:layout_toRightOf="@id/songCurrentProgress" android:layout_toRightOf="@id/songCurrentProgress"
android:maxHeight="3dp" android:maxHeight="2dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false" android:splitTrack="false"
android:thumb="@drawable/switch_square" android:thumb="@drawable/switch_square"
tools:ignore="RtlHardcoded,UnusedAttribute" tools:ignore="RtlHardcoded,UnusedAttribute"

View file

@ -110,13 +110,13 @@
<SeekBar <SeekBar
android:id="@+id/progressSlider" android:id="@+id/progressSlider"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@id/songTotalTime" android:layout_toLeftOf="@id/songTotalTime"
android:layout_toRightOf="@id/songCurrentProgress" android:layout_toRightOf="@id/songCurrentProgress"
android:maxHeight="3dp" android:maxHeight="3dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false" android:splitTrack="false"
tools:ignore="RtlHardcoded,UnusedAttribute" tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" /> tools:progress="20" />

View file

@ -87,13 +87,13 @@
<SeekBar <SeekBar
android:id="@+id/progressSlider" android:id="@+id/progressSlider"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@id/songTotalTime" android:layout_toLeftOf="@id/songTotalTime"
android:layout_toRightOf="@id/songCurrentProgress" android:layout_toRightOf="@id/songCurrentProgress"
android:maxHeight="3dp" android:maxHeight="2dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false" android:splitTrack="false"
tools:ignore="RtlHardcoded,UnusedAttribute" tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" /> tools:progress="20" />

View file

@ -45,13 +45,13 @@
<SeekBar <SeekBar
android:id="@+id/progressSlider" android:id="@+id/progressSlider"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@id/songTotalTime" android:layout_toLeftOf="@id/songTotalTime"
android:layout_toRightOf="@id/songCurrentProgress" android:layout_toRightOf="@id/songCurrentProgress"
android:maxHeight="3dp" android:maxHeight="3dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false" android:splitTrack="false"
tools:ignore="RtlHardcoded,UnusedAttribute" tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" /> tools:progress="20" />

View file

@ -88,6 +88,5 @@
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal" style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="3dp" android:layout_height="3dp"
android:progress="20" android:progress="20" />
android:progressDrawable="@drawable/color_progress_seek" />
</code.name.monkey.retromusic.views.FitSystemWindowsLayout> </code.name.monkey.retromusic.views.FitSystemWindowsLayout>

View file

@ -42,13 +42,13 @@
<SeekBar <SeekBar
android:id="@+id/progressSlider" android:id="@+id/progressSlider"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@id/songTotalTime" android:layout_toLeftOf="@id/songTotalTime"
android:layout_toRightOf="@id/songCurrentProgress" android:layout_toRightOf="@id/songCurrentProgress"
android:maxHeight="3dp" android:maxHeight="2dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false" android:splitTrack="false"
tools:ignore="RtlHardcoded,UnusedAttribute" tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" /> tools:progress="20" />

View file

@ -8,10 +8,59 @@
android:orientation="vertical" android:orientation="vertical"
tools:ignore="MissingPrefix"> tools:ignore="MissingPrefix">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:paddingStart="12dp"
android:paddingEnd="12dp">
<SeekBar
android:id="@+id/progressSlider"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/songTotalTime"
android:layout_toRightOf="@id/songCurrentProgress"
android:maxHeight="3dp"
android:splitTrack="false"
android:thumb="@drawable/switch_thumb_material"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />
<TextView
android:id="@+id/songTotalTime"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:fontFamily="sans-serif-medium"
android:gravity="center_vertical|right|end"
android:paddingRight="8dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?android:textColorSecondary"
android:textSize="12sp"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/songCurrentProgress"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:fontFamily="sans-serif-medium"
android:gravity="center_vertical|left|end"
android:paddingLeft="8dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?android:textColorSecondary"
android:textSize="12sp"
tools:ignore="RtlHardcoded,RtlSymmetry" />
</RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0" android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
@ -48,54 +97,6 @@
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
</LinearLayout> </LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:paddingStart="12dp"
android:paddingEnd="12dp">
<SeekBar
android:id="@+id/progressSlider"
style="@style/MusicProgressSlider"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/songTotalTime"
android:layout_toRightOf="@id/songCurrentProgress"
android:maxHeight="3dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false"
android:thumb="@drawable/switch_thumb_material"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />
<TextView
android:id="@+id/songTotalTime"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:fontFamily="sans-serif-medium"
android:gravity="center_vertical|right|end"
android:paddingRight="8dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?android:textColorSecondary"
android:textSize="12sp"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/songCurrentProgress"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:fontFamily="sans-serif-medium"
android:gravity="center_vertical|left|end"
android:paddingLeft="8dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?android:textColorSecondary"
android:textSize="12sp"
tools:ignore="RtlHardcoded,RtlSymmetry" />
</RelativeLayout>
<include layout="@layout/media_button" /> <include layout="@layout/media_button" />
<FrameLayout <FrameLayout

View file

@ -19,9 +19,11 @@
<androidx.appcompat.widget.AppCompatSeekBar <androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/volumeSeekBar" android:id="@+id/volumeSeekBar"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:maxHeight="2dp"
tools:progress="20" /> tools:progress="20" />
<code.name.monkey.retromusic.views.IconImageView <code.name.monkey.retromusic.views.IconImageView

View file

@ -11,7 +11,8 @@
<code.name.monkey.retromusic.preferences.AlbumCoverStylePreference <code.name.monkey.retromusic.preferences.AlbumCoverStylePreference
android:key="album_cover_style_id" android:key="album_cover_style_id"
android:title="@string/pref_title_album_cover_style" android:title="@string/pref_title_album_cover_style"
app:enableCopying="true" /> app:enableCopying="true"
app:icon="@drawable/ic_image_white_24dp" />
<code.name.monkey.retromusic.preferences.MaterialListPreference <code.name.monkey.retromusic.preferences.MaterialListPreference
android:defaultValue="0" android:defaultValue="0"