Fix lot of things haha
This commit is contained in:
parent
a81536ab9a
commit
4197fde140
54 changed files with 250 additions and 125 deletions
|
@ -24,7 +24,7 @@ import code.name.monkey.retromusic.R;
|
|||
/**
|
||||
* @author Aidan Follestad (afollestad), modified by Karim Abou Zeid
|
||||
*/
|
||||
public class BlacklistFolderChooserDialog extends DialogFragment implements MaterialDialog.ListCallback {
|
||||
public class BlacklistFolderChooserDialog extends DialogFragment /*implements MaterialDialog.ListCallback */{
|
||||
|
||||
private String initialPath = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
private File parentFolder;
|
||||
|
@ -68,7 +68,7 @@ public class BlacklistFolderChooserDialog extends DialogFragment implements Mate
|
|||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
/*@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
|
@ -102,9 +102,9 @@ public class BlacklistFolderChooserDialog extends DialogFragment implements Mate
|
|||
.positiveText(R.string.add_action)
|
||||
.negativeText(android.R.string.cancel);
|
||||
return builder.build();
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public void onSelection(MaterialDialog materialDialog, View view, int i, CharSequence s) {
|
||||
if (canGoUp && i == 0) {
|
||||
parentFolder = parentFolder.getParentFile();
|
||||
|
@ -120,7 +120,7 @@ public class BlacklistFolderChooserDialog extends DialogFragment implements Mate
|
|||
}
|
||||
}
|
||||
reload();
|
||||
}
|
||||
}*/
|
||||
|
||||
private void checkIfCanGoUp() {
|
||||
canGoUp = parentFolder.getParent() != null;
|
||||
|
@ -130,7 +130,7 @@ public class BlacklistFolderChooserDialog extends DialogFragment implements Mate
|
|||
parentContents = listFiles();
|
||||
MaterialDialog dialog = (MaterialDialog) getDialog();
|
||||
dialog.setTitle(parentFolder.getAbsolutePath());
|
||||
dialog.setItems((CharSequence[]) getContentsArray());
|
||||
//dialog.setItems((CharSequence[]) getContentsArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,7 +30,7 @@ class DeleteSongsDialog : RoundedBottomSheetDialogFragment() {
|
|||
} else {
|
||||
getString(R.string.delete_song_x, songs[0].title)
|
||||
}
|
||||
dialogTitle.text = content
|
||||
dialogTitle.text = Html.fromHtml(content)
|
||||
}
|
||||
actionDelete.apply {
|
||||
setOnClickListener {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,9 +5,6 @@ import android.app.PendingIntent
|
|||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.drawable.ClipDrawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.os.Bundle
|
||||
import android.os.CountDownTimer
|
||||
import android.os.SystemClock
|
||||
|
@ -24,6 +21,7 @@ import code.name.monkey.retromusic.R
|
|||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment
|
||||
import kotlinx.android.synthetic.main.dialog_sleep_timer.*
|
||||
import java.util.*
|
||||
|
@ -50,9 +48,7 @@ class SleepTimerDialog : RoundedBottomSheetDialogFragment() {
|
|||
}
|
||||
|
||||
private fun setProgressBarColor(dark: Int) {
|
||||
val ld = seekBar.progressDrawable as LayerDrawable
|
||||
val clipDrawable = ld.findDrawableByLayerId(android.R.id.progress) as ClipDrawable
|
||||
clipDrawable.setColorFilter(dark, PorterDuff.Mode.SRC_IN)
|
||||
ViewUtil.setProgressDrawable(progressSlider = seekBar, newColor = dark)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
@ -68,7 +64,9 @@ class SleepTimerDialog : RoundedBottomSheetDialogFragment() {
|
|||
seekArcProgress = PreferenceUtil.getInstance().lastSleepTimerValue
|
||||
updateTimeDisplayTime()
|
||||
seekBar.progress = seekArcProgress
|
||||
|
||||
setProgressBarColor(ThemeStore.accentColor(context!!))
|
||||
|
||||
seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar, i: Int, b: Boolean) {
|
||||
if (i < 1) {
|
||||
|
|
|
@ -13,12 +13,12 @@ import code.name.monkey.retromusic.R
|
|||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment
|
||||
import kotlinx.android.synthetic.main.dialog_delete.*
|
||||
import kotlinx.android.synthetic.main.dialog_file_share.*
|
||||
|
||||
|
||||
class SongShareDialog : RoundedBottomSheetDialogFragment() {
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.dialog_delete, container, false)
|
||||
return inflater.inflate(R.layout.dialog_file_share, container, false)
|
||||
}
|
||||
|
||||
@SuppressLint("StringFormatInvalid")
|
||||
|
@ -27,7 +27,7 @@ class SongShareDialog : RoundedBottomSheetDialogFragment() {
|
|||
val song = arguments!!.getParcelable<Song>("song")!!
|
||||
dialogTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
|
||||
actionDelete.apply {
|
||||
audioText.apply {
|
||||
text = getString(R.string.currently_listening_to_x_by_x, song.title, song.artistName)
|
||||
setTextColor(ThemeStore.textColorSecondary(context!!))
|
||||
setOnClickListener {
|
||||
|
@ -41,15 +41,16 @@ class SongShareDialog : RoundedBottomSheetDialogFragment() {
|
|||
MaterialUtil.setTint(this)
|
||||
}
|
||||
|
||||
actionCancel.apply {
|
||||
audioFile.apply {
|
||||
setTextColor(ThemeStore.textColorSecondary(context!!))
|
||||
setOnClickListener {
|
||||
MusicUtil.createShareSongFileIntent(song, context)
|
||||
activity!!.startActivity(Intent.createChooser(MusicUtil.createShareSongFileIntent(song, activity), null))
|
||||
dismiss()
|
||||
}
|
||||
icon = ContextCompat.getDrawable(context, R.drawable.ic_share_white_24dp)
|
||||
MaterialUtil.setTint(this, false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -3,7 +3,7 @@ package code.name.monkey.retromusic.helper
|
|||
import android.content.Intent
|
||||
import androidx.core.app.ActivityCompat
|
||||
import code.name.monkey.retromusic.App
|
||||
import code.name.monkey.retromusic.ui.activities.ErrorHandlerActivity
|
||||
import code.name.monkey.retromusic.ui.activities.bugreport.ErrorHandlerActivity
|
||||
|
||||
class TopExceptionHandler() : Thread.UncaughtExceptionHandler {
|
||||
private val defaultUEH: Thread.UncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler()
|
||||
|
@ -11,6 +11,7 @@ class TopExceptionHandler() : Thread.UncaughtExceptionHandler {
|
|||
override fun uncaughtException(t: Thread, e: Throwable) {
|
||||
var arr = e.stackTrace
|
||||
var report = e.toString() + "\n\n"
|
||||
|
||||
report += "--------- Stack trace ---------\n\n"
|
||||
for (i in arr.indices) {
|
||||
report += " " + arr[i].toString() + "\n"
|
||||
|
|
|
@ -6,7 +6,9 @@ import code.name.monkey.retromusic.mvp.BaseView
|
|||
|
||||
interface HomeContract {
|
||||
|
||||
interface HomeView : BaseView<ArrayList<Home>>
|
||||
interface HomeView : BaseView<ArrayList<Home>> {
|
||||
fun showEmpty()
|
||||
}
|
||||
|
||||
interface HomePresenter : BasePresenter<HomeView> {
|
||||
|
||||
|
|
|
@ -41,11 +41,13 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
|||
if (favoritePlaylist.isNotEmpty()) homes.add(Home(R.string.favorites, 0, favoritePlaylist, PLAYLISTS))
|
||||
if (genres.isNotEmpty() && PreferenceUtil.getInstance().isGenreShown) homes.add(Home(R.string.genres, 0, genres, GENRES))
|
||||
homes
|
||||
}).subscribe { homes ->
|
||||
}).subscribe({ homes ->
|
||||
if (homes.isNotEmpty()) {
|
||||
view.showData(homes as ArrayList<Home>)
|
||||
}
|
||||
}
|
||||
}, {
|
||||
view.showEmpty()
|
||||
}, { })
|
||||
}
|
||||
|
||||
override fun subscribe() {
|
||||
|
|
|
@ -2,11 +2,10 @@ package code.name.monkey.retromusic.preferences
|
|||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
|
||||
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
|
||||
import androidx.preference.DialogPreference
|
||||
|
||||
|
||||
class AlbumCoverStylePreference : ATEDialogPreference {
|
||||
class AlbumCoverStylePreference : DialogPreference {
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
package code.name.monkey.retromusic.providers
|
||||
|
||||
import android.content.ContentValues
|
||||
import android.content.Context
|
||||
import android.database.sqlite.SQLiteDatabase
|
||||
import android.database.sqlite.SQLiteOpenHelper
|
||||
import code.name.monkey.retromusic.loaders.SongLoader
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
class NotPlayedStore(val context: Context) : SQLiteOpenHelper(context, DATABASE_NAME, null, VERSION) {
|
||||
|
||||
private val dataBaseCreate = "CREATE TABLE IF NOT EXISTS $NAME ( $ID LONG PRIMARY KEY )"
|
||||
|
||||
override fun onCreate(db: SQLiteDatabase) {
|
||||
db.execSQL(dataBaseCreate)
|
||||
}
|
||||
|
||||
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
db.execSQL("DROP TABLE IF EXISTS $NAME")
|
||||
}
|
||||
|
||||
fun removeSong(id: Long) {
|
||||
val db = writableDatabase
|
||||
db.apply {
|
||||
beginTransaction()
|
||||
delete(NAME, "$ID = $id", null)
|
||||
setTransactionSuccessful()
|
||||
endTransaction()
|
||||
close()
|
||||
}
|
||||
}
|
||||
|
||||
fun addAllSongs(songs: ArrayList<Song>) {
|
||||
SongLoader.getAllSongs(context)
|
||||
.map {
|
||||
val database = writableDatabase;
|
||||
database.apply {
|
||||
val contentValues = ContentValues()
|
||||
for (song in songs) {
|
||||
contentValues.put(ID, song.id)
|
||||
insert(NAME, null, contentValues)
|
||||
}
|
||||
setTransactionSuccessful()
|
||||
endTransaction()
|
||||
}
|
||||
return@map true
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val NAME = "not_played_songs"
|
||||
const val ID = "song_id"
|
||||
const val DATABASE_NAME = "not_played.db"
|
||||
private const val VERSION = 1
|
||||
private var sInstance: NotPlayedStore? = null
|
||||
|
||||
@Synchronized
|
||||
fun getInstance(context: Context): NotPlayedStore {
|
||||
if (sInstance == null) {
|
||||
sInstance = NotPlayedStore(context.applicationContext)
|
||||
}
|
||||
return sInstance!!
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
package code.name.monkey.retromusic.ui.activities
import android.content.ActivityNotFoundException
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_error_handler.*
class ErrorHandlerActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(code.name.monkey.retromusic.R.layout.activity_error_handler)
clearAppData.setOnClickListener {
try {
val intent = Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:$packageName")
startActivity(intent)
} catch (e: ActivityNotFoundException) {
val intent = Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS)
startActivity(intent)
}
}
sendCrashLog.setOnClickListener {
val sendIntent = Intent(Intent.ACTION_SEND)
val subject = "Error report"
val body = intent.getStringExtra("error")
sendIntent.putExtra(Intent.EXTRA_EMAIL, arrayOf("monkeycodeapp@gmail.com"))
sendIntent.putExtra(Intent.EXTRA_TEXT, body)
sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject)
sendIntent.type = "message/rfc822"
startActivity(Intent.createChooser(sendIntent, "Send crash log"))
deleteFile("stack.trace")
}
showCrashError.text = String.format("%s", intent.getStringExtra("error"))
}
}
|
|
@ -40,7 +40,7 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
|
|||
appBarLayout.setBackgroundColor(primaryColor)
|
||||
|
||||
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp)
|
||||
toolbar.setNavigationOnClickListener { v -> onBackPressed() }
|
||||
toolbar.setNavigationOnClickListener { onBackPressed() }
|
||||
bannerTitle.setTextColor(ThemeStore.textColorPrimary(this))
|
||||
setSupportActionBar(toolbar)
|
||||
title = null
|
||||
|
|
|
@ -65,7 +65,7 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
|||
setTitle(null);
|
||||
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
||||
title.setTextColor(ThemeStore.Companion.textColorPrimary(this));
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.Companion.accentColor(this));
|
||||
|
||||
|
||||
try {
|
||||
// Load from phonograph-changelog.html in the assets folder
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
package code.name.monkey.retromusic.ui.activities.bugreport
import android.content.ActivityNotFoundException
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.ui.activities.bugreport.model.DeviceInfo
import kotlinx.android.synthetic.main.activity_error_handler.*
class ErrorHandlerActivity : AppCompatActivity() {
private var deviceInfo: DeviceInfo? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_error_handler)
deviceInfo = DeviceInfo(this)
clearAppData.setOnClickListener {
try {
val intent = Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:$packageName")
startActivity(intent)
} catch (e: ActivityNotFoundException) {
val intent = Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS)
startActivity(intent)
}
}
sendCrashLog.setOnClickListener {
val sendIntent = Intent(Intent.ACTION_SEND)
val subject = "Error report"
val body = intent.getStringExtra("error") + "\n" + deviceInfo!!.toString()
sendIntent.putExtra(Intent.EXTRA_EMAIL, arrayOf("monkeycodeapp@gmail.com"))
sendIntent.putExtra(Intent.EXTRA_TEXT, body)
sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject)
sendIntent.type = "message/rfc822"
startActivity(Intent.createChooser(sendIntent, "Send crash log"))
deleteFile("stack.trace")
}
showCrashError.text = String.format("%s", intent.getStringExtra("error"))
showCrashError.append(deviceInfo!!.toString())
}
}
|
|
@ -1,7 +1,6 @@
|
|||
package code.name.monkey.retromusic.ui.fragments
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.graphics.PorterDuff
|
||||
import android.media.AudioManager
|
||||
|
@ -11,8 +10,8 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.widget.SeekBar
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.transition.TransitionManager
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
|
@ -34,7 +33,7 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setTintable(ThemeStore.textColorSecondary(context!!))
|
||||
TintHelper.setTintAuto(volumeSeekBar, ThemeStore.textColorPrimary(context!!), false)
|
||||
volumeDown.setOnClickListener(this)
|
||||
volumeUp.setOnClickListener(this)
|
||||
}
|
||||
|
@ -101,9 +100,10 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum
|
|||
|
||||
private fun setProgressBarColor(newColor: Int) {
|
||||
|
||||
volumeSeekBar.thumbTintList = ColorStateList.valueOf(newColor)
|
||||
volumeSeekBar.progressTintList = ColorStateList.valueOf(newColor)
|
||||
volumeSeekBar.progressBackgroundTintList = ColorStateList.valueOf(newColor)
|
||||
//volumeSeekBar.thumbTintList = ColorStateList.valueOf(newColor)
|
||||
//volumeSeekBar.progressTintList = ColorStateList.valueOf(newColor)
|
||||
//volumeSeekBar.progressBackgroundTintList = ColorStateList.valueOf(newColor)
|
||||
TintHelper.setTintAuto(volumeSeekBar, newColor, false)
|
||||
volumeDown.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
|
||||
volumeUp.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
private MaterialCab cab;
|
||||
private FragmentManager fragmentManager;
|
||||
private ImageView userImage;
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
private CompositeDisposable disposable ;
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
|
@ -94,12 +94,14 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_library, container, false);
|
||||
disposable = new CompositeDisposable();
|
||||
contentContainer = view.findViewById(R.id.fragmentContainer);
|
||||
bannerTitle = view.findViewById(R.id.bannerTitle);
|
||||
appBarLayout = view.findViewById(R.id.appBarLayout);
|
||||
toolbar = view.findViewById(R.id.toolbar);
|
||||
userImage = view.findViewById(R.id.userImage);
|
||||
userImage.setOnClickListener(v -> showMainMenu());
|
||||
|
||||
loadImageFromStorage();
|
||||
return view;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,11 @@ import java.io.File
|
|||
import java.util.*
|
||||
|
||||
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeContract.HomeView {
|
||||
override fun showEmpty() {
|
||||
|
||||
val disposable: CompositeDisposable = CompositeDisposable()
|
||||
}
|
||||
|
||||
private lateinit var disposable: CompositeDisposable
|
||||
private lateinit var homePresenter: HomePresenter
|
||||
private lateinit var contentContainerView: View
|
||||
private lateinit var lastAdded: View
|
||||
|
@ -111,7 +114,11 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
imageView.setImageBitmap(it)
|
||||
if (it != null) {
|
||||
imageView.setImageBitmap(it)
|
||||
} else {
|
||||
imageView.setImageDrawable(ContextCompat.getDrawable(context!!, R.drawable.ic_person_flat))
|
||||
}
|
||||
}) {
|
||||
imageView.setImageDrawable(ContextCompat.getDrawable(context!!, R.drawable.ic_person_flat))
|
||||
})
|
||||
|
@ -132,22 +139,22 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
|
||||
lastAdded = view.findViewById(R.id.lastAdded)
|
||||
lastAdded.setOnClickListener {
|
||||
NavigationUtil.goToPlaylistNew(activity!!, LastAddedPlaylist(activity!!))
|
||||
NavigationUtil.goToPlaylistNew(mainActivity, LastAddedPlaylist(mainActivity))
|
||||
}
|
||||
|
||||
topPlayed = view.findViewById(R.id.topPlayed)
|
||||
topPlayed.setOnClickListener {
|
||||
NavigationUtil.goToPlaylistNew(activity!!, MyTopTracksPlaylist(activity!!))
|
||||
NavigationUtil.goToPlaylistNew(mainActivity, MyTopTracksPlaylist(mainActivity))
|
||||
}
|
||||
|
||||
actionShuffle = view.findViewById(R.id.actionShuffle)
|
||||
actionShuffle.setOnClickListener {
|
||||
MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(activity!!).blockingFirst(), true)
|
||||
MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(mainActivity).blockingFirst(), true)
|
||||
}
|
||||
|
||||
history = view.findViewById(R.id.history)
|
||||
history.setOnClickListener {
|
||||
NavigationUtil.goToPlaylistNew(activity!!, HistoryPlaylist(activity!!))
|
||||
NavigationUtil.goToPlaylistNew(mainActivity, HistoryPlaylist(mainActivity))
|
||||
}
|
||||
|
||||
userImage = view.findViewById(R.id.userImage)
|
||||
|
@ -163,9 +170,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
setupToolbar()
|
||||
homePresenter.subscribe()
|
||||
|
||||
loadImageFromStorage(userImage)
|
||||
getTimeOfTheDay()
|
||||
|
||||
}
|
||||
|
||||
private fun setupToolbar() {
|
||||
|
@ -179,6 +183,13 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
return false
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
disposable = CompositeDisposable()
|
||||
loadImageFromStorage(userImage)
|
||||
getTimeOfTheDay()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
disposable.dispose()
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.SeekBar
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
|
@ -20,6 +21,7 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
|||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.*
|
||||
|
||||
class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
@ -94,9 +96,14 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
updatePrevNextColor()
|
||||
updatePlayPauseColor()
|
||||
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, color, true)
|
||||
TintHelper.setTintAuto(progressSlider, color, false)
|
||||
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
color
|
||||
} else {
|
||||
ThemeStore.accentColor(context!!)
|
||||
}
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(colorFinal)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
TintHelper.setTintAuto(progressSlider, colorFinal, false)
|
||||
}
|
||||
|
||||
private fun updatePlayPauseColor() {
|
||||
|
|
|
@ -2,8 +2,6 @@ package code.name.monkey.retromusic.ui.fragments.player.fit
|
|||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.drawable.ClipDrawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -29,7 +27,6 @@ import code.name.monkey.retromusic.util.PreferenceUtil
|
|||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
|
||||
import kotlinx.android.synthetic.main.media_button.*
|
||||
import kotlinx.android.synthetic.main.player_time.*
|
||||
import kotlinx.android.synthetic.main.volume_controls.*
|
||||
|
||||
class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
||||
|
@ -112,12 +109,12 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
||||
}
|
||||
|
||||
if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
setFabColor(color)
|
||||
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
color
|
||||
} else {
|
||||
setFabColor(ThemeStore.accentColor(context!!))
|
||||
ThemeStore.accentColor(context!!)
|
||||
}
|
||||
|
||||
setFabColor(colorFinal)
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
|
@ -126,7 +123,6 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
private fun setFabColor(i: Int) {
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(i)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, i, true)
|
||||
|
||||
}
|
||||
|
||||
private fun setUpPlayPauseFab() {
|
||||
|
|
|
@ -104,11 +104,15 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
|
|||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
||||
}
|
||||
val accentColor = ThemeStore.accentColor(context!!)
|
||||
val b = PreferenceUtil.getInstance().adaptiveColor
|
||||
updateTextColors(if (b) color else accentColor)
|
||||
setProgressBarColor(if (b) color else accentColor)
|
||||
|
||||
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
color
|
||||
} else {
|
||||
ThemeStore.accentColor(context!!)
|
||||
}
|
||||
|
||||
updateTextColors(colorFinal)
|
||||
setProgressBarColor(colorFinal)
|
||||
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package code.name.monkey.retromusic.ui.fragments.player.material
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.PorterDuff
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -9,9 +8,11 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.SeekBar
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
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.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||
|
@ -22,7 +23,6 @@ import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
|||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.fragment_material_playback_controls.*
|
||||
import kotlinx.android.synthetic.main.fragment_volume.*
|
||||
import kotlinx.android.synthetic.main.player_time.*
|
||||
|
||||
/**
|
||||
|
@ -104,15 +104,17 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
|||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
|
||||
if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
lastPlaybackControlsColor = color
|
||||
text.setTextColor(color)
|
||||
|
||||
progressSlider.thumbTintList = ColorStateList.valueOf(color)
|
||||
progressSlider.progressTintList = ColorStateList.valueOf(color)
|
||||
progressSlider.progressBackgroundTintList = ColorStateList.valueOf(color)
|
||||
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
color
|
||||
} else {
|
||||
ThemeStore.accentColor(context!!)
|
||||
}
|
||||
|
||||
lastPlaybackControlsColor = colorFinal
|
||||
text.setTextColor(colorFinal)
|
||||
TintHelper.setTintAuto(progressSlider, colorFinal, false)
|
||||
|
||||
updatePlayPauseColor()
|
||||
updatePrevNextColor()
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.view.animation.AccelerateInterpolator
|
|||
import android.view.animation.DecelerateInterpolator
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.SeekBar
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
|
@ -126,11 +127,16 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
|
||||
}
|
||||
|
||||
if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(color)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, color, true)
|
||||
setProgressBarColor(color)
|
||||
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
color
|
||||
} else {
|
||||
ThemeStore.accentColor(context!!)
|
||||
}
|
||||
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
setProgressBarColor(colorFinal)
|
||||
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
|
|
|
@ -188,14 +188,16 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
|
||||
}
|
||||
|
||||
if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(color)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, color, true)
|
||||
text.setTextColor(color)
|
||||
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
color
|
||||
} else {
|
||||
text.setTextColor(ThemeStore.accentColor(context!!))
|
||||
ThemeStore.accentColor(context!!)
|
||||
}
|
||||
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
text.setTextColor(colorFinal)
|
||||
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
|
|
|
@ -37,7 +37,6 @@ object ViewUtil {
|
|||
val clipDrawableBackground = ld.findDrawableByLayerId(android.R.id.background)
|
||||
clipDrawableBackground.setColorFilter(MaterialValueHelper.getPrimaryDisabledTextColor(progressSlider.context, ColorUtil.isColorLight(ThemeStore.primaryColor(progressSlider.context))), PorterDuff.Mode.SRC_IN)
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun createColorAnimator(target: Any, propertyName: String, @ColorInt startColor: Int, @ColorInt endColor: Int): Animator {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue