Merge pull request #172 from h4h13/not-played

Fix lot of things haha
This commit is contained in:
Hemanth S 2019-02-17 22:33:32 +05:30 committed by GitHub
commit 01a4119a8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 250 additions and 125 deletions

View file

@ -32,8 +32,8 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
versionCode 283
versionName '3.0.550'
versionCode 286
versionName '3.0.570'
multiDexEnabled true
@ -131,7 +131,7 @@ dependencies {
implementation "com.google.android.material:material:$supportLibVersion"
implementation "com.squareup.retrofit2:retrofit:2.5.0"
implementation "com.squareup.retrofit2:converter-gson:2.4.0"
implementation "com.squareup.retrofit2:converter-gson:2.5.0"
implementation "com.squareup.retrofit2:adapter-rxjava2:2.5.0"
implementation "com.afollestad.material-dialogs:core:$materialDialog"
@ -141,8 +141,8 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.8.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.17'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar') {
transitive = true
@ -167,6 +167,7 @@ dependencies {
kapt 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
repositories {
mavenCentral()

View file

@ -115,7 +115,7 @@
<activity android:name=".ui.activities.PurchaseActivity" />
<activity android:name=".ui.activities.EqualizerActivity" />
<activity
android:name=".ui.activities.ErrorHandlerActivity"
android:name=".ui.activities.bugreport.ErrorHandlerActivity"
android:immersive="true"
android:label="@string/error"
android:launchMode="singleInstance"

View file

@ -1 +1 @@
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: #{link-color}; } a:active { color: #{link-color-active}; } ul { list-style-position: outside; padding-left: 0; padding-right: 0; margin-left: 1em; } li { padding-top: 8px; } </style> </head> <body> <h4>v3.0.550</h4> <h3>Highlights</h3> <ul style="line-height=150%"> <li>Kotlin conversion from Good old Java</li> <li>Outline style system icons</li> <li>New Material Design principles and Guide lines</li> <li>Holiday Theme</li> </ul> <h3>Changelog</h3> <ul style="line-height:150%"> <li>Added favorite songs in home section</li> <li>Combined home sections to single Recycler View to make load faster</li> <li>Fixed app clear data when crash happens</li> 50</h4> <li>Kotlin conversion from Good old Java</li> <li>By default theme will be dark</li> <li>Now you can add search app shortcut in home screen</li> <li>Last selected Lyrics options saved</li> <li>Fonts are removed to make it fast loading</li> <li>Now you can add plain text home screen widget</li> <h3>Highlights</h3> <li>Bug report for better tracking with milestones</li> <li>Snow fall effect can be enable from other settings(Works only one normal theme)</li> <li>Click new music mix to play songs</li> <h3>Highlights</h3> <li>Kotlin conversion from Good old Java</li> <li>Clear button for playing queue</li> <li>Folder list back button</li> <li>New theme Fit</li> <li>On library click on toolbar for accessing main menu </li> <li>On home click on toolbar for accessing search </li> <ul style="line-height=150%"> 50</h4> <ul style="line-height=150%"> <h3>Highlights</h3> </li> <ul style="line-height=150%"> <ul style="line-height=150%"> <ul style="line-height=150%"> <li>Kotlin conversion from Good old Java</li> <ul style="line-height=150%"> <li>Outline style system icons</li> </li> <ul style="line-height=150%"> <li>New Material Design principles and Guide lines</li> <li>Improving lyrics page</li> <li>Updated image loading libraries(might loose your current artist images)</li> </ul> <p>If you see entire app white or dark or black select same theme in settings to fix </p> <p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a> </p> <p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body>
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: #{link-color}; } a:active { color: #{link-color-active}; } ul { list-style-position: outside; padding-left: 0; padding-right: 0; margin-left: 1em; } li { padding-top: 8px; } </style> </head> <body> <h4>v3.0.5<ul style="line-height=150%"> <h3>Changelog</h3> <li>Kotlin conversion from Good old Java</li> <li>Kotlin conversion from Good old Java</li> 50</h4> <li>Kotlin conversion from Good old Java</li> <h3>Highlights</h3> <li>Kotlin conversion from Good old Java</li> <ul style="line-height=150%"> <li>Kotlin conversion from Good old Java</li> <li>Kotlin conversion from Good old Java</li> <li>Kotlin conversion from Good old Java</li> <li>Outline style system icons</li> <li>Kotlin conversion from Good old Java</li> <li>New Material Design principles and Guide lines</li> </li> </ul> <p>If you see entire app white or dark or black select same theme in settings to fix </p> <p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a> </p> <p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body>

View file

@ -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

View file

@ -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

View file

@ -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) {

View file

@ -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 {

View file

@ -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"

View file

@ -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> {

View file

@ -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() {

View file

@ -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)

View file

@ -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!!
}
}
}

View file

@ -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")) } }

View file

@ -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

View file

@ -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

View file

@ -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()) } }

View file

@ -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)
}

View file

@ -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;
}

View file

@ -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()

View file

@ -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() {

View file

@ -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() {

View file

@ -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()

View file

@ -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()
}

View file

@ -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()

View file

@ -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()

View file

@ -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 {

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="16dp"
android:height="16dp" />
<solid android:color="@color/md_white_1000" />
</shape>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="16dp"
android:height="16dp" />
<solid android:color="@color/md_white_1000" />
</shape>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/abc_btn_switch_to_on_mtrl_00012" android:state_checked="true"/>
<item android:drawable="@drawable/abc_btn_switch_to_on_mtrl_00001"/>
<item android:drawable="@drawable/abc_btn_switch_to_on_mtrl_00012" android:state_checked="true" />
<item android:drawable="@drawable/abc_btn_switch_to_on_mtrl_00001" />
</selector>

View file

@ -1,35 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/title"
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:padding="6dp"
android:id="@+id/dialogTitle"
style="@style/SubTitleTextAppearance"
android:text="@string/what_do_you_want_to_share"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
tools:ignore="MissingPrefix" />
android:textStyle="bold" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
<com.google.android.material.button.MaterialButton
android:id="@+id/audioText"
style="@style/Widget.MaterialComponents.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:gravity="start|center_vertical"
android:paddingTop="14dp"
android:paddingBottom="14dp"
android:text="@string/the_audio_file"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
android:textAllCaps="false" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
<com.google.android.material.button.MaterialButton
android:id="@+id/audioFile"
android:layout_width="wrap_content"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:gravity="start|center_vertical"
android:paddingTop="14dp"
android:paddingBottom="14dp"
android:text="@string/the_audio_file"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
android:textAllCaps="false"
app:strokeWidth="2dp" />
</LinearLayout>

View file

@ -30,7 +30,7 @@
android:textAppearance="?android:textAppearanceLarge" />
<SeekBar
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -14,8 +14,10 @@
android:id="@+id/progressSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingEnd="24dp"
android:maxHeight="3dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:progressDrawable="@drawable/color_progress_seek"
tools:progress="20" />
<LinearLayout
@ -23,8 +25,8 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingStart="16dp">
android:paddingStart="16dp"
android:paddingEnd="16dp">
<TextView
@ -32,8 +34,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingEnd="8dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
android:textStyle="bold"
@ -45,8 +47,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:paddingEnd="8dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
android:textStyle="bold"
@ -57,11 +59,11 @@
android:id="@+id/playerMediaControllerContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:layoutDirection="ltr"
android:paddingEnd="4dp"
android:paddingStart="4dp"
android:layout_marginBottom="8dp"
android:paddingEnd="4dp"
tools:ignore="ContentDescription,UnusedAttribute">
<ImageButton
@ -142,8 +144,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingEnd="8dp"
android:paddingStart="8dp">
android:paddingStart="8dp"
android:paddingEnd="8dp">
<fragment
android:id="@+id/volumeFragment"

View file

@ -59,10 +59,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="20dp"
android:maxHeight="3dp"
android:paddingEnd="20dp"
android:progressDrawable="@drawable/color_progress_seek"
android:progressTint="@color/md_white_1000"
android:splitTrack="false"
android:thumb="@null"
android:thumbTint="@color/md_white_1000"
tools:progress="20" />

View file

@ -12,10 +12,8 @@
android:id="@+id/progressSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="3dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false"
android:thumb="@drawable/switch_thumb_material"
android:thumb="@drawable/flat_shadow_thumb"
tools:ignore="RtlHardcoded,UnusedAttribute" />

View file

@ -14,6 +14,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="3dp"
android:progressDrawable="@drawable/color_progress_seek"
android:paddingStart="24dp"
android:paddingEnd="24dp"
tools:progress="20" />

View file

@ -20,7 +20,9 @@
android:id="@+id/volumeSeekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
android:layout_weight="1"
android:maxHeight="3dp"
android:progressDrawable="@drawable/color_progress_seek" />
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/volumeUp"

View file

@ -134,10 +134,6 @@
</style>
<style name="ErrorHandlingTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">@color/md_white_1000</item>
<item name="colorPrimaryDark">@color/md_white_1000</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="android:windowBackground">@color/md_white_1000</item>
</style>
</resources>

View file

@ -3,6 +3,7 @@ package code.name.monkey.appthemehelper.common.prefs
import android.content.Context
import android.util.AttributeSet
import code.name.monkey.appthemehelper.R
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.prefs.MaterialDialogPreference

View file

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.11'
ext.kotlin_version = '1.3.21'
ext {
supportLibVersion = '1.0.0'
firebase = "11.8.0"
@ -13,7 +13,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.android.tools.build:gradle:3.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}