diff --git a/app/build.gradle b/app/build.gradle
index b35ed219..ca2261c0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -22,7 +22,7 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
- versionCode 409
+ versionCode 410
versionName '3.4.950'
multiDexEnabled true
diff --git a/app/src/main/assets/retro-changelog.html b/app/src/main/assets/retro-changelog.html
index 6a3b7c12..2e173e32 100644
--- a/app/src/main/assets/retro-changelog.html
+++ b/app/src/main/assets/retro-changelog.html
@@ -1 +1 @@
-
v3.4.950
- Added bluetooth connection to play on device as soon as it connected
- Fix tablet version of app
- Fix Album and Artist details toolbar full width for better accessibility
v3.4.900
- Added playlist search
- Added Drive mode
- Added Album and Artist layout change option in library
- Added Show more album and artist information in details
- Added Pixel style scroller bar
- Added current now playing share
- Fix font issues and colors in some places
- Improved Full now playing theme
v3.4.850
- Added new theme called circle
- Added tiny color card style for home artists
- Added extra track info details to now playing themes
- Added scroll animation
- Added smooth transition animations 🤔
- Added current playing tab options for Bottom Navigation View
- Added search in genre
- Improved selecting feedback effect(ripple with corners)
- Fix bugs & crashes
- Fix crashing on lyrics
- Fix genre details last song is under mini player
- Fix colors mistakes and font sizes
- Fix slider jumping while scrolling in now playing themes
v3.4.800
- Improved dark theme colors and Follow system theme
- Rounded rectangle ripple for BottomNavigationView
- Follow sleep timer dialog checkbox color as accent
- Added song list selection for Album and Artist details
- Fixed Toolbar popup text color when selecting songs
v3.4.700
- Added splash screen(for app loading time)
- Updated dark theme colors
- Added circular progress view
- Hiding year if not showing
v3.4.600
- Fix notification layout height
- Fix folder list last item not showing
- Added auto hide/ show controls according to first and last item
v3.4.500
- Added peak theme
- Added app rating dialog
- Fix song name scrolling in now playing themes if it's long
- Fix playing queue last item hiding FAB
- Added desaturated color option for dark mode
- Fix slow search loading
- Fix last added slow loading
- Fix home banner toolbar corner
- Fix home crashing when switching between two tabs
- Fix remaining time in playing queue
- Fix font not applied for some components
- Fix crashing on album details sorting
- Fixed lot of internal bugs
- Fix dialog expand
- Fix list card color
- Removed SlidingUpPanel to replace with BottomSheet
- Removed color theme as per material design guidelines
- Removed classic theme(We're bringing back)
- Replace line switch to Material Switch in settings
- Performance improved
- Updated internal libraries
- Updated translation
- Limiting the use of Theme engine for making use of system colors
- Change home icon from the user icon
- Corrected all toolbar with elevation when scrolling
If you see entire app white or dark or black select same theme in settings to fix
FAQ's
*If you face any UI related issues you clear app data and cache, if its
not working try to
uninstall and install again.
\ No newline at end of file
+
v3.4.950
- Major code refactor for library tabs
- Folder option now in available in tabs
- Improved drive mode page
- Added date modified option to sort songs
- Added toggle bluetooth connection to play on device as soon as it connected
- Fix tablet version of app
- Fix Album and Artist details toolbar full width for better accessibility
v3.4.900
- Added playlist search
- Added Drive mode
- Added Album and Artist layout change option in library
- Added Show more album and artist information in details
- Added Pixel style scroller bar
- Added current now playing share
- Fix font issues and colors in some places
- Improved Full now playing theme
v3.4.850
- Added new theme called circle
- Added tiny color card style for home artists
- Added extra track info details to now playing themes
- Added scroll animation
- Added smooth transition animations 🤔
- Added current playing tab options for Bottom Navigation View
- Added search in genre
- Improved selecting feedback effect(ripple with corners)
- Fix bugs & crashes
- Fix crashing on lyrics
- Fix genre details last song is under mini player
- Fix colors mistakes and font sizes
- Fix slider jumping while scrolling in now playing themes
v3.4.800
- Improved dark theme colors and Follow system theme
- Rounded rectangle ripple for BottomNavigationView
- Follow sleep timer dialog checkbox color as accent
- Added song list selection for Album and Artist details
- Fixed Toolbar popup text color when selecting songs
v3.4.700
- Added splash screen(for app loading time)
- Updated dark theme colors
- Added circular progress view
- Hiding year if not showing
v3.4.600
- Fix notification layout height
- Fix folder list last item not showing
- Added auto hide/ show controls according to first and last item
v3.4.500
- Added peak theme
- Added app rating dialog
- Fix song name scrolling in now playing themes if it's long
- Fix playing queue last item hiding FAB
- Added desaturated color option for dark mode
- Fix slow search loading
- Fix last added slow loading
- Fix home banner toolbar corner
- Fix home crashing when switching between two tabs
- Fix remaining time in playing queue
- Fix font not applied for some components
- Fix crashing on album details sorting
- Fixed lot of internal bugs
- Fix dialog expand
- Fix list card color
- Removed SlidingUpPanel to replace with BottomSheet
- Removed color theme as per material design guidelines
- Removed classic theme(We're bringing back)
- Replace line switch to Material Switch in settings
- Performance improved
- Updated internal libraries
- Updated translation
- Limiting the use of Theme engine for making use of system colors
- Change home icon from the user icon
- Corrected all toolbar with elevation when scrolling
If you see entire app white or dark or black select same theme in settings to fix
FAQ's
*If you face any UI related issues you clear app data and cache, if its
not working try to
uninstall and install again.
\ No newline at end of file
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt
index b9238f83..bfd8e61a 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt
@@ -12,7 +12,6 @@ import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
import code.name.monkey.retromusic.adapter.song.ShuffleButtonSongAdapter
-import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.helper.menu.GenreMenuHelper
import code.name.monkey.retromusic.interfaces.CabHolder
import code.name.monkey.retromusic.model.Genre
@@ -80,7 +79,8 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
}
private fun setUpToolBar() {
- applyToolbar(toolbar)
+ toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
+ setSupportActionBar(toolbar)
title = genre.name
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt
index 80ef2287..9dc03ef9 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt
@@ -1,5 +1,6 @@
package code.name.monkey.retromusic.activities
+import android.R.attr
import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.os.AsyncTask
@@ -20,6 +21,7 @@ import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
+import code.name.monkey.appthemehelper.util.ATHUtil.resolveColor
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
@@ -390,8 +392,8 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPage
val context = activity!!
setCurrentPlayLineColor(ThemeStore.accentColor(context))
setIndicatorTextColor(ThemeStore.accentColor(context))
- setCurrentIndicateLineTextColor(ThemeStore.textColorPrimary(context))
- setNoLrcTextColor(ThemeStore.textColorPrimary(context))
+ setCurrentIndicateLineTextColor(resolveColor(activity, attr.textColorPrimary))
+ setNoLrcTextColor(resolveColor(activity, attr.textColorPrimary))
setOnPlayIndicatorLineListener(object : LrcView.OnPlayIndicatorLineListener {
override fun onPlay(time: Long, content: String) {
MusicPlayerRemote.seekTo(time.toInt())
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java
index 69b6ebd9..f6e2c86a 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java
@@ -26,6 +26,7 @@ import android.content.res.ColorStateList;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
+import android.os.Handler;
import android.provider.MediaStore;
import android.util.Log;
import android.view.Menu;
@@ -36,6 +37,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
+import androidx.transition.TransitionManager;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
@@ -72,6 +74,7 @@ import com.afollestad.materialcab.MaterialCab;
import com.afollestad.materialcab.MaterialCab.Callback;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.card.MaterialCardView;
+import com.google.android.material.textview.MaterialTextView;
import java.util.ArrayList;
import java.util.List;
import org.jetbrains.annotations.NotNull;
@@ -98,6 +101,8 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
private AppBarLayout mAppBarLayout;
+ private MaterialTextView mAppTitle;
+
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
@@ -144,6 +149,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
}
mToolbarContainer = findViewById(R.id.toolbarContainer);
+ mAppTitle = findViewById(R.id.appTitle);
mToolbar = findViewById(R.id.toolbar);
mAppBarLayout = findViewById(R.id.appBarLayout);
@@ -752,6 +758,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
}
private void setupToolbar() {
+ setTitle(null);
mToolbar.setBackgroundColor(Color.TRANSPARENT);
mToolbarContainer.setCardBackgroundColor(
ColorStateList.valueOf(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface)));
@@ -773,5 +780,15 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
.show(getSupportFragmentManager(), "Main_Menu");
}
});
+
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ TransitionManager.beginDelayedTransition(mToolbar);
+ Log.i(TAG, "run: " + Thread.currentThread().getName());
+ mAppTitle.setVisibility(View.GONE);
+ setTitle(R.string.action_search);
+ }
+ }, 1500);
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt
index 712e20e3..4af72c3a 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt
@@ -6,12 +6,12 @@ import android.view.MenuItem
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
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.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
-import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.util.MusicUtil
import com.h6ah4i.android.widget.advrecyclerview.animator.DraggableItemAnimator
@@ -20,7 +20,6 @@ import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeMana
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
import kotlinx.android.synthetic.main.activity_playing_queue.clearQueue
-import kotlinx.android.synthetic.main.activity_playing_queue.playerQueueSubHeader
import kotlinx.android.synthetic.main.activity_playing_queue.recyclerView
import kotlinx.android.synthetic.main.activity_playing_queue.toolbar
@@ -128,7 +127,7 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
}
private fun updateCurrentSong() {
- playerQueueSubHeader.text = getUpNextAndQueueTime()
+ toolbar.subtitle = getUpNextAndQueueTime()
}
override fun onPlayingMetaChanged() {
@@ -138,7 +137,7 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
private fun updateQueuePosition() {
playingQueueAdapter?.setCurrent(MusicPlayerRemote.position)
resetToCurrentPosition()
- playerQueueSubHeader.text = getUpNextAndQueueTime()
+ toolbar.subtitle = getUpNextAndQueueTime()
}
private fun updateQueue() {
@@ -176,20 +175,14 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
}
private fun setupToolbar() {
- playerQueueSubHeader.text = getUpNextAndQueueTime()
- playerQueueSubHeader.setTextColor(ThemeStore.accentColor(this))
+ toolbar.subtitle = getUpNextAndQueueTime()
- applyToolbar(toolbar)
- clearQueue.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
+ toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
+ setSupportActionBar(toolbar)
+ val accentColor = ThemeStore.accentColor(this)
+ clearQueue.backgroundTintList = ColorStateList.valueOf(accentColor)
ColorStateList.valueOf(
- MaterialValueHelper.getPrimaryTextColor(
- this,
- ColorUtil.isColorLight(
- ThemeStore.accentColor(
- this
- )
- )
- )
+ MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(accentColor))
).apply {
clearQueue.setTextColor(this)
clearQueue.iconTint = this
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt
index 24e6d1f0..07c1ee04 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt
@@ -6,12 +6,12 @@ import android.os.Bundle
import android.util.Log
import android.view.MenuItem
import android.widget.Toast
+import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.BuildConfig
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
-import code.name.monkey.retromusic.extensions.applyToolbar
import com.anjlab.android.iab.v3.BillingProcessor
import com.anjlab.android.iab.v3.TransactionDetails
import kotlinx.android.synthetic.main.activity_pro_version.purchaseButton
@@ -31,7 +31,8 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
setStatusbarColorAuto()
setNavigationbarColorAuto()
setLightNavigationBar(true)
- applyToolbar(toolbar)
+ toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
+ setSupportActionBar(toolbar)
restoreButton.isEnabled = false
purchaseButton.isEnabled = false
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/SupportDevelopmentActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/SupportDevelopmentActivity.kt
index 88e3684a..16c62557 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/SupportDevelopmentActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/SupportDevelopmentActivity.kt
@@ -23,6 +23,8 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.BuildConfig
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
+import code.name.monkey.retromusic.extensions.textColorPrimary
+import code.name.monkey.retromusic.extensions.textColorSecondary
import com.anjlab.android.iab.v3.BillingProcessor
import com.anjlab.android.iab.v3.SkuDetails
import com.anjlab.android.iab.v3.TransactionDetails
@@ -216,11 +218,8 @@ class SkuDetailsAdapter(
val titleTextColor = if (purchased) ATHUtil.resolveColor(
donationsDialog,
android.R.attr.textColorHint
- ) else ThemeStore.textColorPrimary(donationsDialog)
- val contentTextColor = if (purchased) titleTextColor else ThemeStore.textColorSecondary(
- donationsDialog
- )
-
+ ) else textColorPrimary(donationsDialog)
+ val contentTextColor = if (purchased) titleTextColor else textColorSecondary(donationsDialog)
viewHolder.title.setTextColor(titleTextColor)
viewHolder.text.setTextColor(contentTextColor)
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/UserInfoActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/UserInfoActivity.kt
index 732e603c..7b7d3331 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/UserInfoActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/UserInfoActivity.kt
@@ -14,6 +14,7 @@ import android.text.TextUtils
import android.view.MenuItem
import android.widget.Toast
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.MaterialUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
@@ -22,7 +23,6 @@ import code.name.monkey.retromusic.Constants.USER_BANNER
import code.name.monkey.retromusic.Constants.USER_PROFILE
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
-import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.util.Compressor
import code.name.monkey.retromusic.util.ImageUtil.getResizedBitmap
import code.name.monkey.retromusic.util.PreferenceUtil
@@ -30,7 +30,13 @@ import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.list.listItems
-import kotlinx.android.synthetic.main.activity_user_info.*
+import kotlinx.android.synthetic.main.activity_user_info.bannerImage
+import kotlinx.android.synthetic.main.activity_user_info.bannerSelect
+import kotlinx.android.synthetic.main.activity_user_info.name
+import kotlinx.android.synthetic.main.activity_user_info.nameContainer
+import kotlinx.android.synthetic.main.activity_user_info.next
+import kotlinx.android.synthetic.main.activity_user_info.toolbar
+import kotlinx.android.synthetic.main.activity_user_info.userImage
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -49,7 +55,8 @@ class UserInfoActivity : AbsBaseActivity() {
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
- applyToolbar(toolbar)
+ toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
+ setSupportActionBar(toolbar)
MaterialUtil.setTint(nameContainer, false)
name.setText(PreferenceUtil.getInstance(this).userName)
@@ -64,7 +71,12 @@ class UserInfoActivity : AbsBaseActivity() {
MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
cornerRadius(PreferenceUtil.getInstance(this@UserInfoActivity).dialogCorner)
title(text = getString(R.string.set_photo))
- listItems(items = listOf(getString(R.string.new_profile_photo), getString(R.string.remove_profile_photo))) { _, position, _ ->
+ listItems(
+ items = listOf(
+ getString(R.string.new_profile_photo),
+ getString(R.string.remove_profile_photo)
+ )
+ ) { _, position, _ ->
when (position) {
0 -> pickNewPhoto()
1 -> PreferenceUtil.getInstance(this@UserInfoActivity).saveProfileImage("")
@@ -76,7 +88,12 @@ class UserInfoActivity : AbsBaseActivity() {
MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
cornerRadius(PreferenceUtil.getInstance(this@UserInfoActivity).dialogCorner)
title(R.string.select_banner_photo)
- listItems(items = listOf(getString(R.string.new_banner_photo), getString(R.string.remove_banner_photo)))
+ listItems(
+ items = listOf(
+ getString(R.string.new_banner_photo),
+ getString(R.string.remove_banner_photo)
+ )
+ )
{ _, position, _ ->
when (position) {
0 -> selectBannerImage()
@@ -96,11 +113,16 @@ class UserInfoActivity : AbsBaseActivity() {
finish()
}
next.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
- ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this))))
- .apply {
- next.setTextColor(this)
- next.iconTint = this
- }
+ ColorStateList.valueOf(
+ MaterialValueHelper.getPrimaryTextColor(
+ this,
+ ColorUtil.isColorLight(ThemeStore.accentColor(this))
+ )
+ )
+ .apply {
+ next.setTextColor(this)
+ next.iconTint = this
+ }
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
@@ -143,14 +165,13 @@ class UserInfoActivity : AbsBaseActivity() {
try {
data.data?.let {
val bitmap = getResizedBitmap(
- getBitmap(contentResolver, it),
- PROFILE_ICON_SIZE
+ getBitmap(contentResolver, it),
+ PROFILE_ICON_SIZE
)
val profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE)
PreferenceUtil.getInstance(this).saveProfileImage(profileImagePath)
loadImageFromStorage(profileImagePath)
}
-
} catch (e: IOException) {
e.printStackTrace()
}
@@ -187,8 +208,8 @@ class UserInfoActivity : AbsBaseActivity() {
CoroutineScope(Dispatchers.IO).launch {
withContext(Dispatchers.IO) {
val bitmap = Compressor(this@UserInfoActivity).setQuality(100)
- .setCompressFormat(Bitmap.CompressFormat.WEBP)
- .compressToBitmap(File(profileImagePath, USER_BANNER))
+ .setCompressFormat(Bitmap.CompressFormat.WEBP)
+ .compressToBitmap(File(profileImagePath, USER_BANNER))
withContext(Dispatchers.Main) { bannerImage.setImageBitmap(bitmap) }
}
}
@@ -198,11 +219,11 @@ class UserInfoActivity : AbsBaseActivity() {
CoroutineScope(Dispatchers.IO).launch {
withContext(Dispatchers.IO) {
val bitmap = Compressor(this@UserInfoActivity)
- .setMaxHeight(300)
- .setMaxWidth(300)
- .setQuality(75)
- .setCompressFormat(Bitmap.CompressFormat.WEBP)
- .compressToBitmap(File(path, USER_PROFILE))
+ .setMaxHeight(300)
+ .setMaxWidth(300)
+ .setQuality(75)
+ .setCompressFormat(Bitmap.CompressFormat.WEBP)
+ .compressToBitmap(File(path, USER_PROFILE))
withContext(Dispatchers.Main) { userImage.setImageBitmap(bitmap) }
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/AlbumTagEditorActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/AlbumTagEditorActivity.kt
index 244141e6..e90f205d 100755
--- a/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/AlbumTagEditorActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/AlbumTagEditorActivity.kt
@@ -16,7 +16,6 @@ import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.appHandleColor
-import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
import code.name.monkey.retromusic.loaders.AlbumLoader
@@ -93,8 +92,8 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
private var lastFMRestClient: LastFMRestClient? = null
private fun setupToolbar() {
- applyToolbar(toolbar)
- supportActionBar?.setDisplayShowHomeEnabled(true)
+ toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
+ setSupportActionBar(toolbar)
}
override fun onCreate(savedInstanceState: Bundle?) {
@@ -141,10 +140,6 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
deleteAlbumArt = false
}
- override fun onPause() {
- super.onPause()
- }
-
private fun toastLoadingFailed() {
Toast.makeText(
this@AlbumTagEditorActivity,
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/SongTagEditorActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/SongTagEditorActivity.kt
index a76f74e9..887b7770 100755
--- a/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/SongTagEditorActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/SongTagEditorActivity.kt
@@ -4,10 +4,10 @@ import android.net.Uri
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
+import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.appHandleColor
-import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.loaders.SongLoader
import kotlinx.android.synthetic.main.activity_song_tag_editor.albumArtistContainer
import kotlinx.android.synthetic.main.activity_song_tag_editor.albumArtistText
@@ -42,8 +42,8 @@ class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
setNoImageMode()
setUpViews()
- applyToolbar(toolbar)
-
+ toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
+ setSupportActionBar(toolbar)
}
private fun setUpViews() {
diff --git a/app/src/main/java/code/name/monkey/retromusic/extensions/ActivityEx.kt b/app/src/main/java/code/name/monkey/retromusic/extensions/ActivityEx.kt
index bc1827c7..81265b42 100644
--- a/app/src/main/java/code/name/monkey/retromusic/extensions/ActivityEx.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/extensions/ActivityEx.kt
@@ -14,19 +14,3 @@
package code.name.monkey.retromusic.extensions
-import android.content.res.ColorStateList
-import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.widget.Toolbar
-import code.name.monkey.appthemehelper.util.ATHUtil
-import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
-import code.name.monkey.retromusic.R
-
-fun AppCompatActivity.applyToolbar(toolbar: Toolbar) {
- toolbar.apply {
- setNavigationOnClickListener { onBackPressed() }
- setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp)
- ToolbarContentTintHelper.colorBackButton(toolbar)
- backgroundTintList = ColorStateList.valueOf(ATHUtil.resolveColor(this@applyToolbar, R.attr.colorSurface))
- }
- setSupportActionBar(toolbar)
-}
diff --git a/app/src/main/java/code/name/monkey/retromusic/extensions/ColorExt.kt b/app/src/main/java/code/name/monkey/retromusic/extensions/ColorExt.kt
index 87a21374..29fb16cc 100644
--- a/app/src/main/java/code/name/monkey/retromusic/extensions/ColorExt.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/extensions/ColorExt.kt
@@ -34,4 +34,16 @@ fun Toolbar.backgroundTintList() {
val surfaceColor = ATHUtil.resolveColor(context, R.attr.colorSurface, Color.BLACK)
val colorStateList = ColorStateList.valueOf(surfaceColor)
backgroundTintList = colorStateList
+}
+
+fun textColorSecondary(context: Context): Int {
+ return ATHUtil.resolveColor(context, android.R.attr.textColorSecondary)
+}
+
+fun colorControlNormal(context: Context): Int {
+ return ATHUtil.resolveColor(context, android.R.attr.colorControlNormal)
+}
+
+fun textColorPrimary(context: Context): Int {
+ return ATHUtil.resolveColor(context, android.R.attr.textColorPrimary)
}
\ No newline at end of file
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt
index cf477ebb..f19b2bd6 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt
@@ -15,6 +15,8 @@ import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
+import code.name.monkey.retromusic.extensions.textColorPrimary
+import code.name.monkey.retromusic.extensions.textColorSecondary
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
@@ -86,10 +88,10 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda
val song = MusicPlayerRemote.currentSong
val title = SpannableString(song.title)
- title.setSpan(ForegroundColorSpan(ThemeStore.textColorPrimary(requireContext())), 0, title.length, 0)
+ title.setSpan(ForegroundColorSpan(textColorPrimary(requireContext())), 0, title.length, 0)
val text = SpannableString(song.artistName)
- text.setSpan(ForegroundColorSpan(ThemeStore.textColorSecondary(requireContext())), 0, text.length, 0)
+ text.setSpan(ForegroundColorSpan(textColorSecondary(requireContext())), 0, text.length, 0)
builder.append(title).append(" • ").append(text)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt
index 37a0046a..ffa7e448 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt
@@ -7,10 +7,11 @@ import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import androidx.appcompat.widget.Toolbar
-import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
+import code.name.monkey.retromusic.extensions.textColorPrimary
+import code.name.monkey.retromusic.extensions.textColorSecondary
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
@@ -149,8 +150,8 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call
inflateMenu(R.menu.menu_player)
setNavigationOnClickListener { requireActivity().onBackPressed() }
ToolbarContentTintHelper.colorizeToolbar(this, primaryColor, requireActivity())
- setTitleTextColor(primaryColor)
- setSubtitleTextColor(ThemeStore.textColorSecondary(requireContext()))
+ setTitleTextColor(textColorPrimary(requireContext()))
+ setSubtitleTextColor(textColorSecondary(requireContext()))
setOnMenuItemClickListener(this@AdaptiveFragment)
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt
index b3c30285..2eb8797b 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt
@@ -23,13 +23,13 @@ import android.view.ViewGroup
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
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.ripAlpha
+import code.name.monkey.retromusic.extensions.textColorSecondary
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
@@ -134,7 +134,7 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
- ThemeStore.textColorSecondary(requireContext())
+ textColorSecondary(requireContext())
}.ripAlpha()
volumeFragment?.setTintable(colorFinal)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt
index 2a7008de..4a6a9e7a 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt
@@ -8,7 +8,6 @@ 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
@@ -16,6 +15,7 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.ripAlpha
import code.name.monkey.retromusic.extensions.show
+import code.name.monkey.retromusic.extensions.textColorSecondary
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
@@ -130,7 +130,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
- ThemeStore.textColorSecondary(requireContext())
+ textColorSecondary(requireContext())
}.ripAlpha()
text.setTextColor(colorFinal)
@@ -167,7 +167,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
}
private fun setUpPrevNext() {
- updatePrevNextColor(ThemeStore.textColorSecondary(requireContext()))
+ updatePrevNextColor(textColorSecondary(requireContext()))
nextButton.setOnClickListener { MusicPlayerRemote.playNextSong() }
previousButton.setOnClickListener { MusicPlayerRemote.back() }
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerControlFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerControlFragment.kt
index e3ceacf3..6af74e40 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerControlFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerControlFragment.kt
@@ -23,13 +23,13 @@ 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.extensions.ripAlpha
+import code.name.monkey.retromusic.extensions.textColorSecondary
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
@@ -111,7 +111,7 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
lastPlaybackControlsColor = color
color
} else {
- ThemeStore.textColorSecondary(requireContext())
+ textColorSecondary(requireContext())
}.ripAlpha()
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt
index 16e614b5..900404b0 100644
--- a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt
@@ -17,7 +17,6 @@ package code.name.monkey.retromusic.preferences
import android.annotation.SuppressLint
import android.app.Dialog
import android.content.Context
-import android.graphics.PorterDuff
import android.os.Bundle
import android.util.AttributeSet
import android.view.LayoutInflater
@@ -26,13 +25,15 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
+import androidx.core.graphics.BlendModeColorFilterCompat
+import androidx.core.graphics.BlendModeCompat.SRC_IN
import androidx.preference.PreferenceDialogFragmentCompat
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
-import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
+import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
import code.name.monkey.retromusic.fragments.AlbumCoverStyle.CARD
import code.name.monkey.retromusic.fragments.AlbumCoverStyle.CIRCLE
@@ -45,19 +46,12 @@ import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView
import com.bumptech.glide.Glide
-class AlbumCoverStylePreference : ATEDialogPreference {
- constructor(context: Context) : super(context)
-
- constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(
- context,
- attrs,
- defStyleAttr,
- defStyleRes
- )
+class AlbumCoverStylePreference @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = -1,
+ defStyleRes: Int = -1
+) : ATEDialogPreference(context, attrs, defStyleAttr, defStyleRes) {
private val mLayoutRes = R.layout.preference_dialog_now_playing_screen
@@ -66,7 +60,8 @@ class AlbumCoverStylePreference : ATEDialogPreference {
}
init {
- icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
+ icon?.colorFilter =
+ BlendModeColorFilterCompat.createBlendModeColorFilterCompat(colorControlNormal(context), SRC_IN)
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt
index 8271e715..1d4fab50 100644
--- a/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt
@@ -16,15 +16,16 @@ package code.name.monkey.retromusic.preferences
import android.app.Dialog
import android.content.Context
-import android.graphics.PorterDuff
import android.os.Bundle
import android.text.Html
import android.util.AttributeSet
+import androidx.core.graphics.BlendModeColorFilterCompat
+import androidx.core.graphics.BlendModeCompat.SRC_IN
import androidx.fragment.app.DialogFragment
-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.dialogs.BlacklistFolderChooserDialog
+import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.providers.BlacklistStore
import code.name.monkey.retromusic.util.PreferenceUtil
import com.afollestad.materialdialogs.LayoutMode
@@ -34,17 +35,16 @@ import com.afollestad.materialdialogs.list.listItems
import java.io.File
import java.util.ArrayList
-class BlacklistPreference : ATEDialogPreference {
- constructor(context: Context) : super(context)
-
- constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
+class BlacklistPreference @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = -1,
+ defStyleRes: Int = -1
+) : ATEDialogPreference(context, attrs, defStyleAttr, defStyleRes) {
init {
- icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
+ icon?.colorFilter =
+ BlendModeColorFilterCompat.createBlendModeColorFilterCompat(colorControlNormal(context), SRC_IN)
}
}
@@ -55,9 +55,9 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog
}
}
-
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
- val blacklistFolderChooserDialog = childFragmentManager.findFragmentByTag("FOLDER_CHOOSER") as BlacklistFolderChooserDialog?
+ val blacklistFolderChooserDialog =
+ childFragmentManager.findFragmentByTag("FOLDER_CHOOSER") as BlacklistFolderChooserDialog?
blacklistFolderChooserDialog?.setCallback(this)
refreshBlacklistData()
return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
@@ -81,13 +81,20 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog
negativeButton(R.string.add_action) {
val dialog = BlacklistFolderChooserDialog.create()
dialog.setCallback(this@BlacklistPreferenceDialog)
- dialog.show(childFragmentManager, "FOLDER_CHOOSER");
+ dialog.show(childFragmentManager, "FOLDER_CHOOSER")
}
listItems(items = paths, waitForPositiveButton = false) { _, _, text ->
MaterialDialog(context, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
title(code.name.monkey.retromusic.R.string.remove_from_blacklist)
- message(text = Html.fromHtml(getString(code.name.monkey.retromusic.R.string.do_you_want_to_remove_from_the_blacklist, text)))
+ message(
+ text = Html.fromHtml(
+ getString(
+ code.name.monkey.retromusic.R.string.do_you_want_to_remove_from_the_blacklist,
+ text
+ )
+ )
+ )
positiveButton(code.name.monkey.retromusic.R.string.remove_action) {
BlacklistStore.getInstance(context).removePath(File(text.toString()))
refreshBlacklistData()
@@ -108,7 +115,7 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog
}
override fun onFolderSelection(dialog: BlacklistFolderChooserDialog, folder: File) {
- BlacklistStore.getInstance(context!!).addPath(folder);
- refreshBlacklistData();
+ BlacklistStore.getInstance(context!!).addPath(folder)
+ refreshBlacklistData()
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt
index bce32754..b07aa0a5 100644
--- a/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt
@@ -16,44 +16,43 @@ package code.name.monkey.retromusic.preferences
import android.app.Dialog
import android.content.Context
-import android.graphics.PorterDuff
import android.os.Bundle
import android.util.AttributeSet
import android.widget.Toast
+import androidx.core.graphics.BlendModeColorFilterCompat
+import androidx.core.graphics.BlendModeCompat.SRC_IN
import androidx.preference.PreferenceDialogFragmentCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
-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.adapter.CategoryInfoAdapter
+import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.model.CategoryInfo
import code.name.monkey.retromusic.util.PreferenceUtil
import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.customview.customView
-import java.util.*
+import java.util.ArrayList
-
-class LibraryPreference : ATEDialogPreference {
- constructor(context: Context) : super(context)
-
- constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
+class LibraryPreference @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = -1,
+ defStyleRes: Int = -1
+) :
+ ATEDialogPreference(context, attrs, defStyleAttr, defStyleRes) {
init {
- icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
+ icon?.colorFilter =
+ BlendModeColorFilterCompat.createBlendModeColorFilterCompat(colorControlNormal(context), SRC_IN)
}
}
class LibraryPreferenceDialog : PreferenceDialogFragmentCompat() {
override fun onDialogClosed(positiveResult: Boolean) {
-
}
lateinit var adapter: CategoryInfoAdapter
@@ -75,20 +74,20 @@ class LibraryPreferenceDialog : PreferenceDialogFragmentCompat() {
adapter.attachToRecyclerView(recyclerView)
return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
- .title(R.string.library_categories)
- .cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
- .customView(view = view)
- .positiveButton(android.R.string.ok) {
- updateCategories(adapter.categoryInfos)
- dismiss()
- }
- .negativeButton(android.R.string.cancel) {
- dismiss()
- }
- .neutralButton(R.string.reset_action) {
- adapter.categoryInfos = PreferenceUtil.getInstance(requireContext()).defaultLibraryCategoryInfos
- }
- .noAutoDismiss()
+ .title(R.string.library_categories)
+ .cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
+ .customView(view = view)
+ .positiveButton(android.R.string.ok) {
+ updateCategories(adapter.categoryInfos)
+ dismiss()
+ }
+ .negativeButton(android.R.string.cancel) {
+ dismiss()
+ }
+ .neutralButton(R.string.reset_action) {
+ adapter.categoryInfos = PreferenceUtil.getInstance(requireContext()).defaultLibraryCategoryInfos
+ }
+ .noAutoDismiss()
}
override fun onSaveInstanceState(outState: Bundle) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt
index 76b937a9..2bb91842 100644
--- a/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt
@@ -17,41 +17,34 @@ package code.name.monkey.retromusic.preferences
import android.app.Dialog
import android.content.Context
import android.content.res.TypedArray
-import android.graphics.PorterDuff
import android.os.Bundle
import android.util.AttributeSet
+import androidx.core.graphics.BlendModeColorFilterCompat
+import androidx.core.graphics.BlendModeCompat.SRC_IN
import androidx.preference.ListPreference
import androidx.preference.PreferenceDialogFragmentCompat
-import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
+import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.util.PreferenceUtil
import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.list.listItemsSingleChoice
+class MaterialListPreference @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = -1,
+ defStyleRes: Int = -1
+) : ListPreference(context, attrs, defStyleAttr, defStyleRes) {
-class MaterialListPreference : ListPreference {
private val mLayoutRes = R.layout.ate_preference_list
- constructor(context: Context) : super(context) {
- init(context)
- }
-
- private fun init(context: Context) {
- icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
- }
-
- constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
- init(context)
- }
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
- init(context)
- }
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
- init(context)
+ init {
+ icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
+ colorControlNormal(context),
+ SRC_IN
+ )
}
override fun getDialogLayoutResource(): Int {
@@ -80,23 +73,27 @@ class MaterialListPreferenceDialog : PreferenceDialogFragmentCompat() {
val entriesValues = arguments?.getStringArrayList(EXTRA_ENTRIES_VALUES)
val position: Int = arguments?.getInt(EXTRA_POSITION) ?: 0
materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
- .title(text = materialListPreference.title.toString())
- .positiveButton(R.string.set)
- .cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
- .listItemsSingleChoice(items = entries, initialSelection = position, waitForPositiveButton = true) { _, index, _ ->
- entriesValues?.let {
- materialListPreference.callChangeListener(it[index])
- materialListPreference.setCustomValue(it[index])
- }
- entries?.let {
- materialListPreference.summary = it[index]
- val value = materialListPreference.entryValues[index].toString()
- if (materialListPreference.callChangeListener(value)) {
- materialListPreference.value = value
- }
- }
- dismiss()
+ .title(text = materialListPreference.title.toString())
+ .positiveButton(R.string.set)
+ .cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
+ .listItemsSingleChoice(
+ items = entries,
+ initialSelection = position,
+ waitForPositiveButton = true
+ ) { _, index, _ ->
+ entriesValues?.let {
+ materialListPreference.callChangeListener(it[index])
+ materialListPreference.setCustomValue(it[index])
}
+ entries?.let {
+ materialListPreference.summary = it[index]
+ val value = materialListPreference.entryValues[index].toString()
+ if (materialListPreference.callChangeListener(value)) {
+ materialListPreference.value = value
+ }
+ }
+ dismiss()
+ }
return materialDialog
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt
index 35a1915c..1eb98ce5 100644
--- a/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt
@@ -16,7 +16,6 @@ package code.name.monkey.retromusic.preferences
import android.app.Dialog
import android.content.Context
-import android.graphics.PorterDuff
import android.os.Bundle
import android.util.AttributeSet
import android.view.LayoutInflater
@@ -25,13 +24,15 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
+import androidx.core.graphics.BlendModeColorFilterCompat
+import androidx.core.graphics.BlendModeCompat.SRC_IN
import androidx.preference.PreferenceDialogFragmentCompat
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
-import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
+import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.fragments.NowPlayingScreen
import code.name.monkey.retromusic.fragments.NowPlayingScreen.ADAPTIVE
import code.name.monkey.retromusic.fragments.NowPlayingScreen.BLUR
@@ -50,20 +51,12 @@ import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView
import com.bumptech.glide.Glide
-class NowPlayingScreenPreference : ATEDialogPreference {
-
- constructor(context: Context) : super(context)
-
- constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(
- context,
- attrs,
- defStyleAttr,
- defStyleRes
- )
+class NowPlayingScreenPreference @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = -1,
+ defStyleRes: Int = -1
+) : ATEDialogPreference(context, attrs, defStyleAttr, defStyleRes) {
private val mLayoutRes = R.layout.preference_dialog_now_playing_screen
@@ -72,7 +65,10 @@ class NowPlayingScreenPreference : ATEDialogPreference {
}
init {
- icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
+ icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
+ colorControlNormal(context),
+ SRC_IN
+ )
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/views/BreadCrumbLayout.java b/app/src/main/java/code/name/monkey/retromusic/views/BreadCrumbLayout.java
index 366dabb2..d8c3d131 100644
--- a/app/src/main/java/code/name/monkey/retromusic/views/BreadCrumbLayout.java
+++ b/app/src/main/java/code/name/monkey/retromusic/views/BreadCrumbLayout.java
@@ -28,7 +28,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
-import code.name.monkey.appthemehelper.ThemeStore;
+import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.retromusic.R;
import java.io.File;
import java.util.ArrayList;
@@ -41,19 +41,47 @@ import java.util.List;
*/
public class BreadCrumbLayout extends HorizontalScrollView implements View.OnClickListener {
- @ColorInt
- private int contentColorActivated;
- @ColorInt
- private int contentColorDeactivated;
-
public static class Crumb implements Parcelable {
+ public static final Creator CREATOR = new Creator() {
+ @Override
+ public Crumb createFromParcel(Parcel source) {
+ return new Crumb(source);
+ }
+
+ @Override
+ public Crumb[] newArray(int size) {
+ return new Crumb[size];
+ }
+ };
+
+ private final File file;
+
+ private int scrollPos;
+
public Crumb(File file) {
this.file = file;
}
- private final File file;
- private int scrollPos;
+ protected Crumb(Parcel in) {
+ this.file = (File) in.readSerializable();
+ this.scrollPos = in.readInt();
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return (o instanceof Crumb) && ((Crumb) o).getFile() != null &&
+ ((Crumb) o).getFile().equals(getFile());
+ }
+
+ public File getFile() {
+ return file;
+ }
public int getScrollPosition() {
return scrollPos;
@@ -67,16 +95,6 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
return file.getPath().equals("/") ? "root" : file.getName();
}
- public File getFile() {
- return file;
- }
-
- @Override
- public boolean equals(Object o) {
- return (o instanceof Crumb) && ((Crumb) o).getFile() != null &&
- ((Crumb) o).getFile().equals(getFile());
- }
-
@Override
public String toString() {
return "Crumb{" +
@@ -85,6 +103,43 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
'}';
}
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeSerializable(this.file);
+ dest.writeInt(this.scrollPos);
+ }
+ }
+
+ public static class SavedStateWrapper implements Parcelable {
+
+ public static final Creator CREATOR = new Creator() {
+ public SavedStateWrapper createFromParcel(Parcel source) {
+ return new SavedStateWrapper(source);
+ }
+
+ public SavedStateWrapper[] newArray(int size) {
+ return new SavedStateWrapper[size];
+ }
+ };
+
+ public final int mActive;
+
+ public final List mCrumbs;
+
+ public final int mVisibility;
+
+ public SavedStateWrapper(BreadCrumbLayout view) {
+ mActive = view.mActive;
+ mCrumbs = view.mCrumbs;
+ mVisibility = view.getVisibility();
+ }
+
+ protected SavedStateWrapper(Parcel in) {
+ this.mActive = in.readInt();
+ this.mCrumbs = in.createTypedArrayList(Crumb.CREATOR);
+ this.mVisibility = in.readInt();
+ }
+
@Override
public int describeContents() {
return 0;
@@ -92,32 +147,38 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeSerializable(this.file);
- dest.writeInt(this.scrollPos);
+ dest.writeInt(this.mActive);
+ dest.writeTypedList(mCrumbs);
+ dest.writeInt(this.mVisibility);
}
-
- protected Crumb(Parcel in) {
- this.file = (File) in.readSerializable();
- this.scrollPos = in.readInt();
- }
-
- public static final Creator CREATOR = new Creator() {
- @Override
- public Crumb createFromParcel(Parcel source) {
- return new Crumb(source);
- }
-
- @Override
- public Crumb[] newArray(int size) {
- return new Crumb[size];
- }
- };
}
public interface SelectionCallback {
+
void onCrumbSelection(Crumb crumb, int index);
}
+ @ColorInt
+ private int contentColorActivated;
+
+ @ColorInt
+ private int contentColorDeactivated;
+
+ private int mActive;
+
+ private SelectionCallback mCallback;
+
+ private LinearLayout mChildFrame;
+
+ // Stores currently visible crumbs
+ private List mCrumbs;
+
+ // Stores user's navigation history, like a fragment back stack
+ private List mHistory;
+
+ // Used in setActiveOrAdd() between clearing crumbs and adding the new set, nullified afterwards
+ private List mOldCrumbs;
+
public BreadCrumbLayout(Context context) {
super(context);
init();
@@ -133,59 +194,9 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
init();
}
- // Stores currently visible crumbs
- private List mCrumbs;
- // Used in setActiveOrAdd() between clearing crumbs and adding the new set, nullified afterwards
- private List mOldCrumbs;
- // Stores user's navigation history, like a fragment back stack
- private List mHistory;
-
- private LinearLayout mChildFrame;
- private int mActive;
- private SelectionCallback mCallback;
-
- private void init() {
- contentColorActivated = ThemeStore.Companion.textColorPrimary(getContext());
- contentColorDeactivated = ThemeStore.Companion.textColorSecondary(getContext());
- setMinimumHeight((int) getResources().getDimension(R.dimen.tab_height));
- setClipToPadding(false);
- setHorizontalScrollBarEnabled(false);
- mCrumbs = new ArrayList<>();
- mHistory = new ArrayList<>();
- mChildFrame = new LinearLayout(getContext());
- addView(mChildFrame, new ViewGroup.LayoutParams(
- ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT));
- }
-
- public void addHistory(Crumb crumb) {
- mHistory.add(crumb);
- }
-
- public Crumb lastHistory() {
- if (mHistory.size() == 0) return null;
- return mHistory.get(mHistory.size() - 1);
- }
-
- public boolean popHistory() {
- if (mHistory.size() == 0) return false;
- mHistory.remove(mHistory.size() - 1);
- return mHistory.size() != 0;
- }
-
- public int historySize() {
- return mHistory.size();
- }
-
- public void clearHistory() {
- mHistory.clear();
- }
-
- public void reverseHistory() {
- Collections.reverse(mHistory);
- }
-
public void addCrumb(@NonNull Crumb crumb, boolean refreshLayout) {
- LinearLayout view = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.bread_crumb, this, false);
+ LinearLayout view = (LinearLayout) LayoutInflater.from(getContext())
+ .inflate(R.layout.bread_crumb, this, false);
view.setTag(mCrumbs.size());
view.setOnClickListener(this);
@@ -205,21 +216,8 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
invalidateActivatedAll();
}
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- super.onLayout(changed, l, t, r, b);
- //RTL works fine like this
- View child = mChildFrame.getChildAt(mActive);
- if (child != null)
- smoothScrollTo(child.getLeft(), 0);
- }
-
- public Crumb findCrumb(@NonNull File forDir) {
- for (int i = 0; i < mCrumbs.size(); i++) {
- if (mCrumbs.get(i).getFile().equals(forDir))
- return mCrumbs.get(i);
- }
- return null;
+ public void addHistory(Crumb crumb) {
+ mHistory.add(crumb);
}
public void clearCrumbs() {
@@ -232,65 +230,75 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
}
}
+ public void clearHistory() {
+ mHistory.clear();
+ }
+
+ public Crumb findCrumb(@NonNull File forDir) {
+ for (int i = 0; i < mCrumbs.size(); i++) {
+ if (mCrumbs.get(i).getFile().equals(forDir)) {
+ return mCrumbs.get(i);
+ }
+ }
+ return null;
+ }
+
+ public int getActiveIndex() {
+ return mActive;
+ }
+
public Crumb getCrumb(int index) {
return mCrumbs.get(index);
}
- public void setCallback(SelectionCallback callback) {
- mCallback = callback;
+ public SavedStateWrapper getStateWrapper() {
+ return new SavedStateWrapper(this);
}
- private boolean setActive(Crumb newActive) {
- mActive = mCrumbs.indexOf(newActive);
- invalidateActivatedAll();
- boolean success = mActive > -1;
- if (success)
+ public int historySize() {
+ return mHistory.size();
+ }
+
+ public Crumb lastHistory() {
+ if (mHistory.size() == 0) {
+ return null;
+ }
+ return mHistory.get(mHistory.size() - 1);
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (mCallback != null) {
+ int index = (Integer) v.getTag();
+ mCallback.onCrumbSelection(mCrumbs.get(index), index);
+ }
+ }
+
+ public boolean popHistory() {
+ if (mHistory.size() == 0) {
+ return false;
+ }
+ mHistory.remove(mHistory.size() - 1);
+ return mHistory.size() != 0;
+ }
+
+ public void restoreFromStateWrapper(SavedStateWrapper mSavedState) {
+ if (mSavedState != null) {
+ mActive = mSavedState.mActive;
+ for (Crumb c : mSavedState.mCrumbs) {
+ addCrumb(c, false);
+ }
requestLayout();
- return success;
- }
-
- void invalidateActivatedAll() {
- for (int i = 0; i < mCrumbs.size(); i++) {
- Crumb crumb = mCrumbs.get(i);
- invalidateActivated(mChildFrame.getChildAt(i), mActive == mCrumbs.indexOf(crumb), false, i < mCrumbs.size() - 1).setText(crumb.getTitle());
+ setVisibility(mSavedState.mVisibility);
}
}
- void removeCrumbAt(int index) {
- mCrumbs.remove(index);
- mChildFrame.removeViewAt(index);
+ public void reverseHistory() {
+ Collections.reverse(mHistory);
}
- public boolean trim(String path, boolean dir) {
- if (!dir) return false;
- int index = -1;
- for (int i = mCrumbs.size() - 1; i >= 0; i--) {
- File fi = mCrumbs.get(i).getFile();
- if (fi.getPath().equals(path)) {
- index = i;
- break;
- }
- }
-
- boolean removedActive = index >= mActive;
- if (index > -1) {
- while (index <= mCrumbs.size() - 1)
- removeCrumbAt(index);
- if (mChildFrame.getChildCount() > 0) {
- int lastIndex = mCrumbs.size() - 1;
- invalidateActivated(mChildFrame.getChildAt(lastIndex), mActive == lastIndex, false, false);
- }
- }
- return removedActive || mCrumbs.size() == 0;
- }
-
- public boolean trim(File file) {
- return trim(file.getPath(), file.isDirectory());
- }
-
- void updateIndices() {
- for (int i = 0; i < mChildFrame.getChildCount(); i++)
- mChildFrame.getChildAt(i).setTag(i);
+ public void setActivatedContentColor(@ColorInt int contentColorActivated) {
+ this.contentColorActivated = contentColorActivated;
}
public void setActiveOrAdd(@NonNull Crumb crumb, boolean forceRecreate) {
@@ -329,99 +337,115 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
}
}
- public int size() {
- return mCrumbs.size();
- }
-
- private TextView invalidateActivated(View view, final boolean isActive, final boolean noArrowIfAlone, final boolean allowArrowVisible) {
- int contentColor = isActive ? contentColorActivated : contentColorDeactivated;
- LinearLayout child = (LinearLayout) view;
- TextView tv = (TextView) child.getChildAt(0);
- tv.setTextColor(contentColor);
- ImageView iv = (ImageView) child.getChildAt(1);
- iv.setColorFilter(contentColor, PorterDuff.Mode.SRC_IN);
- if (noArrowIfAlone && getChildCount() == 1)
- iv.setVisibility(View.GONE);
- else if (allowArrowVisible)
- iv.setVisibility(View.VISIBLE);
- else
- iv.setVisibility(View.GONE);
- return tv;
- }
-
- public int getActiveIndex() {
- return mActive;
- }
-
- public void setActivatedContentColor(@ColorInt int contentColorActivated) {
- this.contentColorActivated = contentColorActivated;
+ public void setCallback(SelectionCallback callback) {
+ mCallback = callback;
}
public void setDeactivatedContentColor(@ColorInt int contentColorDeactivated) {
this.contentColorDeactivated = contentColorDeactivated;
}
+ public int size() {
+ return mCrumbs.size();
+ }
+
+ public boolean trim(String path, boolean dir) {
+ if (!dir) {
+ return false;
+ }
+ int index = -1;
+ for (int i = mCrumbs.size() - 1; i >= 0; i--) {
+ File fi = mCrumbs.get(i).getFile();
+ if (fi.getPath().equals(path)) {
+ index = i;
+ break;
+ }
+ }
+
+ boolean removedActive = index >= mActive;
+ if (index > -1) {
+ while (index <= mCrumbs.size() - 1) {
+ removeCrumbAt(index);
+ }
+ if (mChildFrame.getChildCount() > 0) {
+ int lastIndex = mCrumbs.size() - 1;
+ invalidateActivated(mChildFrame.getChildAt(lastIndex), mActive == lastIndex, false, false);
+ }
+ }
+ return removedActive || mCrumbs.size() == 0;
+ }
+
+ public boolean trim(File file) {
+ return trim(file.getPath(), file.isDirectory());
+ }
+
@Override
- public void onClick(View v) {
- if (mCallback != null) {
- int index = (Integer) v.getTag();
- mCallback.onCrumbSelection(mCrumbs.get(index), index);
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ super.onLayout(changed, l, t, r, b);
+ //RTL works fine like this
+ View child = mChildFrame.getChildAt(mActive);
+ if (child != null) {
+ smoothScrollTo(child.getLeft(), 0);
}
}
- public static class SavedStateWrapper implements Parcelable {
-
- public final int mActive;
- public final List mCrumbs;
- public final int mVisibility;
-
- public SavedStateWrapper(BreadCrumbLayout view) {
- mActive = view.mActive;
- mCrumbs = view.mCrumbs;
- mVisibility = view.getVisibility();
+ void invalidateActivatedAll() {
+ for (int i = 0; i < mCrumbs.size(); i++) {
+ Crumb crumb = mCrumbs.get(i);
+ invalidateActivated(mChildFrame.getChildAt(i), mActive == mCrumbs.indexOf(crumb), false,
+ i < mCrumbs.size() - 1).setText(crumb.getTitle());
}
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(this.mActive);
- dest.writeTypedList(mCrumbs);
- dest.writeInt(this.mVisibility);
- }
-
- protected SavedStateWrapper(Parcel in) {
- this.mActive = in.readInt();
- this.mCrumbs = in.createTypedArrayList(Crumb.CREATOR);
- this.mVisibility = in.readInt();
- }
-
- public static final Creator CREATOR = new Creator() {
- public SavedStateWrapper createFromParcel(Parcel source) {
- return new SavedStateWrapper(source);
- }
-
- public SavedStateWrapper[] newArray(int size) {
- return new SavedStateWrapper[size];
- }
- };
}
- public SavedStateWrapper getStateWrapper() {
- return new SavedStateWrapper(this);
+ void removeCrumbAt(int index) {
+ mCrumbs.remove(index);
+ mChildFrame.removeViewAt(index);
}
- public void restoreFromStateWrapper(SavedStateWrapper mSavedState) {
- if (mSavedState != null) {
- mActive = mSavedState.mActive;
- for (Crumb c : mSavedState.mCrumbs) {
- addCrumb(c, false);
- }
+ void updateIndices() {
+ for (int i = 0; i < mChildFrame.getChildCount(); i++) {
+ mChildFrame.getChildAt(i).setTag(i);
+ }
+ }
+
+ private void init() {
+ contentColorActivated = ATHUtil.INSTANCE.resolveColor(getContext(), android.R.attr.textColorPrimary);
+ contentColorDeactivated = ATHUtil.INSTANCE.resolveColor(getContext(), android.R.attr.textColorSecondary);
+ setMinimumHeight((int) getResources().getDimension(R.dimen.tab_height));
+ setClipToPadding(false);
+ setHorizontalScrollBarEnabled(false);
+ mCrumbs = new ArrayList<>();
+ mHistory = new ArrayList<>();
+ mChildFrame = new LinearLayout(getContext());
+ addView(mChildFrame, new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT));
+ }
+
+ private TextView invalidateActivated(View view, final boolean isActive, final boolean noArrowIfAlone,
+ final boolean allowArrowVisible) {
+ int contentColor = isActive ? contentColorActivated : contentColorDeactivated;
+ LinearLayout child = (LinearLayout) view;
+ TextView tv = (TextView) child.getChildAt(0);
+ tv.setTextColor(contentColor);
+ ImageView iv = (ImageView) child.getChildAt(1);
+ iv.setColorFilter(contentColor, PorterDuff.Mode.SRC_IN);
+ if (noArrowIfAlone && getChildCount() == 1) {
+ iv.setVisibility(View.GONE);
+ } else if (allowArrowVisible) {
+ iv.setVisibility(View.VISIBLE);
+ } else {
+ iv.setVisibility(View.GONE);
+ }
+ return tv;
+ }
+
+ private boolean setActive(Crumb newActive) {
+ mActive = mCrumbs.indexOf(newActive);
+ invalidateActivatedAll();
+ boolean success = mActive > -1;
+ if (success) {
requestLayout();
- setVisibility(mSavedState.mVisibility);
}
+ return success;
}
}
\ No newline at end of file
diff --git a/app/src/main/res/layout-land/fragment_home.xml b/app/src/main/res/layout-land/fragment_home.xml
index 074b2f31..3aec89ce 100644
--- a/app/src/main/res/layout-land/fragment_home.xml
+++ b/app/src/main/res/layout-land/fragment_home.xml
@@ -71,5 +71,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/titleWelcome" />
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_album_content.xml b/app/src/main/res/layout/activity_album_content.xml
index 71f9bcde..5d4129f1 100644
--- a/app/src/main/res/layout/activity_album_content.xml
+++ b/app/src/main/res/layout/activity_album_content.xml
@@ -10,10 +10,8 @@
android:id="@+id/playAction"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/button_margin_horizontal"
- android:layout_marginTop="8dp"
- android:layout_marginEnd="@dimen/button_margin_horizontal"
- android:layout_marginBottom="8dp"
+ android:layout_marginStart="8dp"
+ android:layout_marginEnd="4dp"
android:text="@string/action_play_all"
android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface"
@@ -27,10 +25,8 @@
android:id="@+id/shuffleAction"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/button_margin_horizontal"
- android:layout_marginTop="8dp"
- android:layout_marginEnd="@dimen/button_margin_horizontal"
- android:layout_marginBottom="8dp"
+ android:layout_marginStart="4dp"
+ android:layout_marginEnd="8dp"
android:text="@string/shuffle"
android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface"
@@ -59,6 +55,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
+ android:overScrollMode="never"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/songTitle"
@@ -85,6 +82,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
+ android:overScrollMode="never"
android:visibility="gone"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/app/src/main/res/layout/activity_album_tag_editor.xml b/app/src/main/res/layout/activity_album_tag_editor.xml
index 2789d7aa..0776c35e 100755
--- a/app/src/main/res/layout/activity_album_tag_editor.xml
+++ b/app/src/main/res/layout/activity_album_tag_editor.xml
@@ -19,9 +19,6 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@android:color/transparent"
- android:elevation="0dp"
- app:elevation="0dp"
app:liftOnScroll="true">
-
-
diff --git a/app/src/main/res/layout/activity_donation.xml b/app/src/main/res/layout/activity_donation.xml
index a4c6a1b8..47910c12 100644
--- a/app/src/main/res/layout/activity_donation.xml
+++ b/app/src/main/res/layout/activity_donation.xml
@@ -16,8 +16,8 @@
android:id="@+id/toolbar"
style="@style/Toolbar"
app:layout_collapseMode="pin"
- app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/support_development"
+ app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:ignore="UnusedAttribute" />
diff --git a/app/src/main/res/layout/activity_error_handler.xml b/app/src/main/res/layout/activity_error_handler.xml
deleted file mode 100644
index bc7843b1..00000000
--- a/app/src/main/res/layout/activity_error_handler.xml
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_license.xml b/app/src/main/res/layout/activity_license.xml
index d56a3837..f0afb12d 100644
--- a/app/src/main/res/layout/activity_license.xml
+++ b/app/src/main/res/layout/activity_license.xml
@@ -29,8 +29,8 @@
android:id="@+id/toolbar"
style="@style/Toolbar"
app:layout_collapseMode="pin"
- app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/licenses"
+ app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:ignore="UnusedAttribute" />
diff --git a/app/src/main/res/layout/activity_lyrics.xml b/app/src/main/res/layout/activity_lyrics.xml
index 7dd50c99..f4669d9d 100644
--- a/app/src/main/res/layout/activity_lyrics.xml
+++ b/app/src/main/res/layout/activity_lyrics.xml
@@ -23,10 +23,10 @@
app:contentInsetStartWithNavigation="0dp"
app:layout_scrollFlags="scroll|enterAlways"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
- app:subtitleTextAppearance="@style/TextAppearance.AppCompat.Caption"
+ app:subtitleTextAppearance="@style/TextViewSubtitle1"
app:titleMargin="0dp"
app:titleMarginStart="0dp"
- app:titleTextAppearance="@style/TextAppearance.AppCompat.Subhead"
+ app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:subtitle="@tools:sample/full_names"
tools:title="@tools:sample/full_names" />
diff --git a/app/src/main/res/layout/activity_main_content.xml b/app/src/main/res/layout/activity_main_content.xml
index 6b20d393..c52961c4 100644
--- a/app/src/main/res/layout/activity_main_content.xml
+++ b/app/src/main/res/layout/activity_main_content.xml
@@ -49,10 +49,17 @@
android:background="?attr/colorSurface"
app:navigationIcon="@drawable/ic_menu_white_24dp"
app:popupTheme="?attr/toolbarPopupTheme"
- app:title="@string/action_search"
app:titleTextAppearance="@style/TextViewHeadline6"
- app:titleTextColor="?android:attr/textColorSecondary"
- tools:ignore="UnusedAttribute" />
+ tools:ignore="UnusedAttribute">
+
+
+
-
-
-
-
-
-
+ app:layout_collapseMode="pin"
+ app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
+ app:title="@string/queue"
+ app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
+ tools:ignore="UnusedAttribute" />
-
diff --git a/app/src/main/res/layout/activity_playlist_detail.xml b/app/src/main/res/layout/activity_playlist_detail.xml
index dec7055b..67e46f53 100644
--- a/app/src/main/res/layout/activity_playlist_detail.xml
+++ b/app/src/main/res/layout/activity_playlist_detail.xml
@@ -24,9 +24,6 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@android:color/transparent"
- android:elevation="0dp"
- app:elevation="0dp"
app:liftOnScroll="true">
@@ -53,6 +51,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
+ android:overScrollMode="never"
android:scrollbars="none"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
diff --git a/app/src/main/res/layout/activity_pro_version.xml b/app/src/main/res/layout/activity_pro_version.xml
index 05092b5d..6fccf43d 100644
--- a/app/src/main/res/layout/activity_pro_version.xml
+++ b/app/src/main/res/layout/activity_pro_version.xml
@@ -38,6 +38,7 @@
android:id="@+id/toolbar"
style="@style/Toolbar"
app:layout_collapseMode="pin"
+ app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/retro_music_pro"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:ignore="UnusedAttribute" />
diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml
index cb0b2e63..481e015e 100755
--- a/app/src/main/res/layout/activity_search.xml
+++ b/app/src/main/res/layout/activity_search.xml
@@ -110,6 +110,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
+ android:overScrollMode="never"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
diff --git a/app/src/main/res/layout/activity_song_tag_editor.xml b/app/src/main/res/layout/activity_song_tag_editor.xml
index 0e737fd7..baed30b1 100755
--- a/app/src/main/res/layout/activity_song_tag_editor.xml
+++ b/app/src/main/res/layout/activity_song_tag_editor.xml
@@ -11,9 +11,6 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@android:color/transparent"
- android:elevation="0dp"
- app:elevation="0dp"
app:liftOnScroll="true">
diff --git a/app/src/main/res/layout/activity_whats_new.xml b/app/src/main/res/layout/activity_whats_new.xml
index 735378cb..9686dbd7 100644
--- a/app/src/main/res/layout/activity_whats_new.xml
+++ b/app/src/main/res/layout/activity_whats_new.xml
@@ -39,10 +39,10 @@
-
diff --git a/app/src/main/res/layout/home_content.xml b/app/src/main/res/layout/home_content.xml
index f3af50ea..f97294c1 100644
--- a/app/src/main/res/layout/home_content.xml
+++ b/app/src/main/res/layout/home_content.xml
@@ -38,7 +38,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
- tools:visibility="gone" />
+ android:overScrollMode="never"
+ app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
+ app:spanCount="3"
+ tools:itemCount="3"
+ tools:listitem="@layout/item_album_card" />
+ >
since
- }
-
- fun setStatusbarColorAuto(activity: Activity) {
- setStatusbarColor(activity, ThemeStore.statusBarColor(activity))
- }
-
- fun setStatusbarColor(activity: Activity, color: Int) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- activity.window.statusBarColor = color
- setLightStatusbarAuto(activity, color)
- }
- }
-
- fun setLightStatusbarAuto(activity: Activity, bgColor: Int) {
- setLightStatusbar(activity, ColorUtil.isColorLight(bgColor))
+ return ThemeStore.isConfigured(context) && ThemeStore.prefs(context).getLong(
+ ThemeStorePrefKeys.VALUES_CHANGED,
+ -1
+ ) > since
}
fun setLightStatusbar(activity: Activity, enabled: Boolean) {
@@ -84,8 +72,10 @@ object ATH {
setActivityToolbarColor(activity, toolbar, ThemeStore.primaryColor(activity))
}
- fun setActivityToolbarColor(activity: Activity, toolbar: Toolbar?,
- color: Int) {
+ fun setActivityToolbarColor(
+ activity: Activity, toolbar: Toolbar?,
+ color: Int
+ ) {
if (toolbar == null) {
return
}
diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ThemeStore.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ThemeStore.kt
index 98546ba1..83018a92 100755
--- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ThemeStore.kt
+++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/ThemeStore.kt
@@ -4,8 +4,12 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences
import android.graphics.Color
-import androidx.annotation.*
+import androidx.annotation.AttrRes
+import androidx.annotation.CheckResult
+import androidx.annotation.ColorInt
+import androidx.annotation.ColorRes
import androidx.annotation.IntRange
+import androidx.annotation.StyleRes
import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
@@ -15,6 +19,7 @@ import code.name.monkey.appthemehelper.util.ColorUtil
*/
class ThemeStore @SuppressLint("CommitPrefEdits")
private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeStoreInterface {
+
private val mEditor: SharedPreferences.Editor
init {
@@ -166,8 +171,8 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
override fun commit() {
mEditor.putLong(ThemeStorePrefKeys.VALUES_CHANGED, System.currentTimeMillis())
- .putBoolean(ThemeStorePrefKeys.IS_CONFIGURED_KEY, true)
- .commit()
+ .putBoolean(ThemeStorePrefKeys.IS_CONFIGURED_KEY, true)
+ .commit()
}
companion object {
@@ -194,29 +199,24 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
@CheckResult
@ColorInt
fun primaryColor(context: Context): Int {
- return prefs(context).getInt(ThemeStorePrefKeys.KEY_PRIMARY_COLOR, ATHUtil.resolveColor(context, R.attr.colorPrimary, Color.parseColor("#455A64")))
- }
-
- @CheckResult
- @ColorInt
- fun primaryColorDark(context: Context): Int {
- return prefs(context).getInt(ThemeStorePrefKeys.KEY_PRIMARY_COLOR_DARK, ATHUtil.resolveColor(context, R.attr.colorPrimaryDark, Color.parseColor("#37474F")))
+ return prefs(context).getInt(
+ ThemeStorePrefKeys.KEY_PRIMARY_COLOR,
+ ATHUtil.resolveColor(context, R.attr.colorPrimary, Color.parseColor("#455A64"))
+ )
}
@CheckResult
@ColorInt
fun accentColor(context: Context): Int {
val desaturatedColor = prefs(context).getBoolean("desaturated_color", false)
- val color = prefs(context).getInt(ThemeStorePrefKeys.KEY_ACCENT_COLOR, ATHUtil.resolveColor(context, R.attr.colorAccent, Color.parseColor("#263238")))
- return if (ATHUtil.isWindowBackgroundDark(context) && desaturatedColor) ColorUtil.desaturateColor(color, 0.4f) else color
- }
-
- @CheckResult
- @ColorInt
- fun statusBarColor(context: Context): Int {
- return if (!coloredStatusBar(context)) {
- Color.BLACK
- } else prefs(context).getInt(ThemeStorePrefKeys.KEY_STATUS_BAR_COLOR, primaryColorDark(context))
+ val color = prefs(context).getInt(
+ ThemeStorePrefKeys.KEY_ACCENT_COLOR,
+ ATHUtil.resolveColor(context, R.attr.colorAccent, Color.parseColor("#263238"))
+ )
+ return if (ATHUtil.isWindowBackgroundDark(context) && desaturatedColor) ColorUtil.desaturateColor(
+ color,
+ 0.4f
+ ) else color
}
@CheckResult
@@ -227,30 +227,6 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
} else prefs(context).getInt(ThemeStorePrefKeys.KEY_NAVIGATION_BAR_COLOR, primaryColor(context))
}
- @CheckResult
- @ColorInt
- fun textColorPrimary(context: Context): Int {
- return prefs(context).getInt(ThemeStorePrefKeys.KEY_TEXT_COLOR_PRIMARY, ATHUtil.resolveColor(context, android.R.attr.textColorPrimary))
- }
-
- @CheckResult
- @ColorInt
- fun textColorPrimaryInverse(context: Context): Int {
- return prefs(context).getInt(ThemeStorePrefKeys.KEY_TEXT_COLOR_PRIMARY_INVERSE, ATHUtil.resolveColor(context, android.R.attr.textColorPrimaryInverse))
- }
-
- @CheckResult
- @ColorInt
- fun textColorSecondary(context: Context): Int {
- return prefs(context).getInt(ThemeStorePrefKeys.KEY_TEXT_COLOR_SECONDARY, ATHUtil.resolveColor(context, android.R.attr.textColorSecondary))
- }
-
- @CheckResult
- @ColorInt
- fun textColorSecondaryInverse(context: Context): Int {
- return prefs(context).getInt(ThemeStorePrefKeys.KEY_TEXT_COLOR_SECONDARY_INVERSE, ATHUtil.resolveColor(context, android.R.attr.textColorSecondaryInverse))
- }
-
@CheckResult
fun coloredStatusBar(context: Context): Boolean {
return prefs(context).getBoolean(ThemeStorePrefKeys.KEY_APPLY_PRIMARYDARK_STATUSBAR, true)
@@ -272,7 +248,12 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
}
@SuppressLint("CommitPrefEdits")
- fun isConfigured(context: Context, @IntRange(from = 0, to = Integer.MAX_VALUE.toLong()) version: Int): Boolean {
+ fun isConfigured(
+ context: Context, @IntRange(
+ from = 0,
+ to = Integer.MAX_VALUE.toLong()
+ ) version: Int
+ ): Boolean {
val prefs = prefs(context)
val lastVersion = prefs.getInt(ThemeStorePrefKeys.IS_CONFIGURED_VERSION_KEY, -1)
if (version > lastVersion) {
diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEColorPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEColorPreference.kt
index 1d532285..e52ca24a 100755
--- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEColorPreference.kt
+++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEColorPreference.kt
@@ -15,14 +15,15 @@
package code.name.monkey.appthemehelper.common.prefs.supportv7
import android.content.Context
-import android.graphics.PorterDuff
import android.util.AttributeSet
import android.view.View
+import androidx.core.graphics.BlendModeColorFilterCompat
+import androidx.core.graphics.BlendModeCompat
import androidx.preference.Preference
import androidx.preference.PreferenceViewHolder
import code.name.monkey.appthemehelper.R
-import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.prefs.BorderCircleView
+import code.name.monkey.appthemehelper.util.ATHUtil
class ATEColorPreference @JvmOverloads constructor(
context: Context,
@@ -39,7 +40,12 @@ class ATEColorPreference @JvmOverloads constructor(
widgetLayoutResource = R.layout.ate_preference_color
isPersistent = false
- icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
+ icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
+ ATHUtil.resolveColor(
+ context,
+ android.R.attr.colorControlNormal
+ ), BlendModeCompat.SRC_IN
+ )
}
override fun onBindViewHolder(holder: PreferenceViewHolder) {
diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEListPreference.java b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEListPreference.java
deleted file mode 100644
index f506bada..00000000
--- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEListPreference.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2019 Hemanth Savarala.
- *
- * Licensed under the GNU General Public License v3
- *
- * This is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by
- * the Free Software Foundation either version 3 of the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- */
-
-package code.name.monkey.appthemehelper.common.prefs.supportv7;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import androidx.preference.ListPreference;
-import code.name.monkey.appthemehelper.R;
-
-public class ATEListPreference extends ListPreference {
-
- public ATEListPreference(Context context) {
- super(context);
- init(context, null);
- }
-
- public ATEListPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(context, attrs);
- }
-
- public ATEListPreference(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- init(context, attrs);
- }
-
- public ATEListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- init(context, attrs);
- }
-
- private void init(Context context, AttributeSet attrs) {
- setLayoutResource(R.layout.ate_preference_custom_support);
- if (getSummary() == null || getSummary().toString().trim().isEmpty()) {
- setSummary("%s");
- }
- }
-}
\ No newline at end of file
diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEListPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEListPreference.kt
new file mode 100644
index 00000000..96180b22
--- /dev/null
+++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEListPreference.kt
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2019 Hemanth Savarala.
+ *
+ * Licensed under the GNU General Public License v3
+ *
+ * This is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by
+ * the Free Software Foundation either version 3 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ */
+package code.name.monkey.appthemehelper.common.prefs.supportv7
+
+import android.content.Context
+import android.util.AttributeSet
+import androidx.preference.ListPreference
+import code.name.monkey.appthemehelper.R.layout
+
+class ATEListPreference @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = -1,
+ defStyleRes: Int = -1
+) : ListPreference(context, attrs, defStyleAttr, defStyleRes) {
+
+ init {
+ layoutResource = layout.ate_preference_custom_support
+ if (summary == null || summary.toString().trim { it <= ' ' }.isEmpty()) {
+ summary = "%s"
+ }
+ }
+}
\ No newline at end of file
diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEPreference.kt
index 712bc433..53e3919b 100755
--- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEPreference.kt
+++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEPreference.kt
@@ -15,10 +15,11 @@
package code.name.monkey.appthemehelper.common.prefs.supportv7
import android.content.Context
-import android.graphics.PorterDuff
import android.util.AttributeSet
+import androidx.core.graphics.BlendModeColorFilterCompat
+import androidx.core.graphics.BlendModeCompat
import androidx.preference.Preference
-import code.name.monkey.appthemehelper.ThemeStore
+import code.name.monkey.appthemehelper.util.ATHUtil
class ATEPreference @JvmOverloads constructor(
context: Context,
@@ -28,6 +29,11 @@ class ATEPreference @JvmOverloads constructor(
) : Preference(context, attrs, defStyleAttr, defStyleRes) {
init {
- icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
+ icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
+ ATHUtil.resolveColor(
+ context,
+ android.R.attr.colorControlNormal
+ ), BlendModeCompat.SRC_IN
+ )
}
}
\ No newline at end of file
diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESeekBarPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESeekBarPreference.kt
index 72dad5b9..213971b2 100644
--- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESeekBarPreference.kt
+++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESeekBarPreference.kt
@@ -1,39 +1,31 @@
package code.name.monkey.appthemehelper.common.prefs.supportv7
import android.content.Context
-import android.graphics.PorterDuff
import android.util.AttributeSet
import android.widget.SeekBar
+import androidx.core.graphics.BlendModeColorFilterCompat
+import androidx.core.graphics.BlendModeCompat
import androidx.preference.PreferenceViewHolder
import androidx.preference.SeekBarPreference
import code.name.monkey.appthemehelper.R
import code.name.monkey.appthemehelper.ThemeStore
+import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.TintHelper
-class ATESeekBarPreference : SeekBarPreference {
- constructor(context: Context) : super(context) {
- init()
- }
+class ATESeekBarPreference @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = -1,
+ defStyleRes: Int = -1
+) : SeekBarPreference(context, attrs, defStyleAttr, defStyleRes) {
- constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
- init()
- }
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
- init()
- }
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(
- context,
- attrs,
- defStyleAttr,
- defStyleRes
- ) {
- init()
- }
-
- private fun init() {
- icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
+ init {
+ icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
+ ATHUtil.resolveColor(
+ context,
+ android.R.attr.colorControlNormal
+ ), BlendModeCompat.SRC_IN
+ )
}
override fun onBindViewHolder(view: PreferenceViewHolder) {
diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt
index eda097f1..3f2869d3 100755
--- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt
+++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt
@@ -1,38 +1,31 @@
package code.name.monkey.appthemehelper.common.prefs.supportv7
-import android.annotation.TargetApi
import android.content.Context
-import android.graphics.PorterDuff
-import android.os.Build
import android.util.AttributeSet
+import androidx.core.graphics.BlendModeColorFilterCompat
+import androidx.core.graphics.BlendModeCompat
import androidx.preference.CheckBoxPreference
import code.name.monkey.appthemehelper.R
-import code.name.monkey.appthemehelper.ThemeStore
+import code.name.monkey.appthemehelper.util.ATHUtil
/**
* @author Aidan Follestad (afollestad)
*/
-class ATESwitchPreference : CheckBoxPreference {
+class ATESwitchPreference @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = -1,
+ defStyleRes: Int = -1
+) :
+ CheckBoxPreference(context, attrs, defStyleAttr, defStyleRes) {
- constructor(context: Context) : super(context) {
- init()
- }
-
- constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
- init()
- }
-
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
- init()
- }
-
- @TargetApi(Build.VERSION_CODES.LOLLIPOP)
- constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
- init()
- }
-
- private fun init() {
+ init {
widgetLayoutResource = R.layout.ate_preference_switch_support
- icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
+ icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
+ ATHUtil.resolveColor(
+ context,
+ android.R.attr.colorControlNormal
+ ), BlendModeCompat.SRC_IN
+ )
}
}
\ No newline at end of file
diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEListPreferenceDialogFragmentCompat.java b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEListPreferenceDialogFragmentCompat.java
index 6e32c6fa..3cce11d3 100644
--- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEListPreferenceDialogFragmentCompat.java
+++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEListPreferenceDialogFragmentCompat.java
@@ -75,12 +75,4 @@ public class ATEListPreferenceDialogFragmentCompat extends ATEPreferenceDialogFr
}
}
}
-
- /* @Override
- public boolean onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
- mClickedDialogEntryIndex = which;
- onClick(dialog, DialogAction.POSITIVE);
- dismiss();
- return true;
- }*/
}
\ No newline at end of file
diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEPreferenceDialogFragment.java b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEPreferenceDialogFragment.java
index cb8492fb..887741b8 100644
--- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEPreferenceDialogFragment.java
+++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEPreferenceDialogFragment.java
@@ -18,21 +18,20 @@ package code.name.monkey.appthemehelper.common.prefs.supportv7.dialogs;
import android.app.Dialog;
import android.os.Bundle;
import android.view.Window;
-
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.preference.DialogPreference;
-
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
/**
* @author Karim Abou Zeid (kabouzeid)
*/
public class ATEPreferenceDialogFragment extends DialogFragment {
- protected static final String ARG_KEY = "key";
+
+ static final String ARG_KEY = "key";
private DialogPreference mPreference;
@@ -56,6 +55,10 @@ public class ATEPreferenceDialogFragment extends DialogFragment {
}
}
+ public DialogPreference getPreference() {
+ return this.mPreference;
+ }
+
@NonNull
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
MaterialAlertDialogBuilder materialDialog = new MaterialAlertDialogBuilder(requireActivity())
@@ -77,23 +80,19 @@ public class ATEPreferenceDialogFragment extends DialogFragment {
return dialog;
}
- public DialogPreference getPreference() {
- return this.mPreference;
- }
+ public void onDialogClosed(boolean positiveResult) {
- protected void onPrepareDialogBuilder(MaterialAlertDialogBuilder builder) {
}
protected boolean needInputMethod() {
return false;
}
+ protected void onPrepareDialogBuilder(MaterialAlertDialogBuilder builder) {
+ }
+
private void requestInputMethod(Dialog dialog) {
Window window = dialog.getWindow();
window.setSoftInputMode(5);
}
-
- public void onDialogClosed(boolean positiveResult) {
-
- }
}
\ No newline at end of file
diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ToolbarContentTintHelper.java b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ToolbarContentTintHelper.java
index 27a2f1b8..36144228 100755
--- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ToolbarContentTintHelper.java
+++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ToolbarContentTintHelper.java
@@ -159,7 +159,8 @@ public final class ToolbarContentTintHelper {
radioButtonField.setAccessible(true);
final boolean isDark = !ColorUtil.INSTANCE.isColorLight(
- ATHUtil.INSTANCE.resolveColor(context, android.R.attr.windowBackground));
+ ATHUtil.INSTANCE
+ .resolveColor(context, android.R.attr.windowBackground));
for (int i = 0; i < listView.getChildCount(); i++) {
View v = listView.getChildAt(i);
@@ -351,8 +352,9 @@ public final class ToolbarContentTintHelper {
}
//Step 3: Changing the color of title and subtitle.
- toolbarView.setTitleTextColor(ThemeStore.Companion.textColorPrimary(activity));
- toolbarView.setSubtitleTextColor(ThemeStore.Companion.textColorSecondary(activity));
+ toolbarView.setTitleTextColor(ATHUtil.INSTANCE.resolveColor(activity, android.R.attr.textColorPrimary));
+ toolbarView
+ .setSubtitleTextColor(ATHUtil.INSTANCE.resolveColor(activity, android.R.attr.textColorSecondary));
//Step 4: Changing the color of the Overflow Menu icon.
setOverflowButtonColor(activity, toolbarView, toolbarIconsColor);
diff --git a/change-log.html b/change-log.html
new file mode 100644
index 00000000..5f7df3da
--- /dev/null
+++ b/change-log.html
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+ Change log
+
+
+
+3.4.950
+Stable
+What's new?
+
+ - Major refactor has been done for library tabs
+ - Folder option now in available in tabs
+ - Improved drive mode page
+ - Added date modified option to sort songs
+ - Added toggle bluetooth connection to play on device as soon as it connected
+ - Fix tablet version of app
+ - Fix Album and Artist details toolbar full width for better accessibility
+
+Improvements and fixes
+
+ - Major refactor has been done for library tabs
+ - Folder option now in available in tabs
+ - Improved drive mode page
+ - Added date modified option to sort songs
+ - Added toggle bluetooth connection to play on device as soon as it connected
+ - Fix tablet version of app
+ - Fix Album and Artist details toolbar full width for better accessibility
+
+
+
\ No newline at end of file
diff --git a/fonts/build.gradle b/fonts/build.gradle
index 7c135b78..c0ef8167 100644
--- a/fonts/build.gradle
+++ b/fonts/build.gradle
@@ -42,7 +42,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
- implementation 'androidx.core:core-ktx:1.1.0'
+ implementation 'androidx.core:core-ktx:1.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
diff --git a/fonts/src/main/java/dev/hemanths/fonts/CommonAttrs.kt b/fonts/src/main/java/dev/hemanths/fonts/CommonAttrs.kt
new file mode 100644
index 00000000..eb368fcc
--- /dev/null
+++ b/fonts/src/main/java/dev/hemanths/fonts/CommonAttrs.kt
@@ -0,0 +1,5 @@
+package dev.hemanths.fonts
+
+/**
+ * Created by hemanths on 2020-02-22.
+ */
\ No newline at end of file