Fix alignment

This commit is contained in:
h4h13 2020-04-15 18:38:42 +05:30
commit 1ab5db1389
21 changed files with 194 additions and 123 deletions

View file

@ -25,7 +25,7 @@ android {
applicationId "code.name.monkey.retromusic" applicationId "code.name.monkey.retromusic"
versionCode 416 versionCode 416
versionName '3.5.970' versionName '3.5.010'
multiDexEnabled true multiDexEnabled true

View file

@ -1 +1 @@
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: {link-color}; } a:active { color: {link-color-active}; } ol { list-style-position: inside; padding-left: 0; padding-right: 0; } li { padding-top: 8px; } </style> </head> <body> <h4>v3.4.970</h4> <ul> <li>Added default cover with accent color</li> <li>Added date modified option to sort songs</li> <li>Added toggle bluetooth connection to play on device as soon as it connected</li> <li>Major code refactor for library tabs</li> <li>Folder option now in available in tabs</li> <li>Improved drive mode page</li> <li>Improved fit, full, card themes for status visibility</li> <li>Fix tablet version of app</li> <li>Fix Album and Artist details toolbar full width for better accessibility</li> <li>Updated internal libraries</li> </ul> <h4>v3.4.900</h4> <ul> <li>Added playlist search</li> <li>Added Drive mode</li> <li>Added Album and Artist layout change option in library</li> <li>Added Show more album and artist information in details</li> <li>Added Pixel style scroller bar</li> <li>Added current now playing share</li> <li>Fix font issues and colors in some places</li> <li>Improved Full now playing theme</li> </ul> <h4>v3.4.850</h4> <ul> <li>Added new theme called circle</li> <li>Added tiny color card style for home artists</li> <li>Added extra track info details to now playing themes</li> <li>Added scroll animation</li> <li>Added smooth transition animations 🤔</li> <li>Added current playing tab options for Bottom Navigation View</li> <li>Added search in genre</li> <li>Improved selecting feedback effect(ripple with corners)</li> <li>Fix bugs & crashes</li> <li>Fix crashing on lyrics</li> <li>Fix genre details last song is under mini player</li> <li>Fix colors mistakes and font sizes</li> <li>Fix slider jumping while scrolling in now playing themes</li> </ul> <h4>v3.4.800</h4> <ul> <li>Improved dark theme colors and Follow system theme</li> <li>Rounded rectangle ripple for BottomNavigationView</li> <li>Follow sleep timer dialog checkbox color as accent</li> <li>Added song list selection for Album and Artist details</li> <li>Fixed Toolbar popup text color when selecting songs</li> </ul> <h4>v3.4.700</h4> <ul> <li>Added splash screen(for app loading time)</li> <li>Updated dark theme colors</li> <li>Added circular progress view</li> <li>Hiding year if not showing</li> </ul> <h4>v3.4.600</h4> <ul> <li>Fix notification layout height</li> <li>Fix folder list last item not showing</li> <li>Added auto hide/ show controls according to first and last item</li> </ul> <h4>v3.4.500</h4> <ul> <li>Added peak theme</li> <li>Added app rating dialog</li> <li>Fix song name scrolling in now playing themes if it's long</li> <li>Fix playing queue last item hiding FAB</li> <li>Added desaturated color option for dark mode</li> <li>Fix slow search loading</li> <li>Fix last added slow loading</li> <li>Fix home banner toolbar corner</li> <li>Fix home crashing when switching between two tabs</li> <li>Fix remaining time in playing queue</li> <li>Fix font not applied for some components</li> <li>Fix crashing on album details sorting</li> <li>Fixed lot of internal bugs</li> <li>Fix dialog expand</li> <li>Fix list card color</li> <li>Removed SlidingUpPanel to replace with BottomSheet</li> <li>Removed color theme as per material design guidelines</li> <li>Removed classic theme(We're bringing back)</li> <li>Replace line switch to Material Switch in settings</li> <li>Performance improved</li> <li>Updated internal libraries</li> <li>Updated translation</li> <li>Limiting the use of Theme engine for making use of system colors</li> <li>Change home icon from the user icon</li> <li>Corrected all toolbar with elevation when scrolling</li> </ul> <p>If you see entire app white or dark or black select same theme in settings to fix </p> <p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a> </p> <p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body> <html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: {link-color}; } a:active { color: {link-color-active}; } ol { list-style-position: inside; padding-left: 0; padding-right: 0; } li { padding-top: 8px; } </style> </head> <body> <h4>v3.5.010</h4> <ul> <li>Added grid size and layout change for songs list</li> <li>Removed menu options (No use of having only settings)</li> <li>Added settings option to toolbar</li> <li>Updated internal library</li> </ul> <h4>v3.4.970</h4> <ul> <li>Added default cover with accent color</li> <li>Added date modified option to sort songs</li> <li>Added toggle bluetooth connection to play on device as soon as it connected</li> <li>Major code refactor for library tabs</li> <li>Folder option now in available in tabs</li> <li>Improved drive mode page</li> <li>Improved fit, full, card themes for status visibility</li> <li>Fix tablet version of app</li> <li>Fix Album and Artist details toolbar full width for better accessibility</li> <li>Updated internal libraries</li> </ul> <h4>v3.4.900</h4> <ul> <li>Added playlist search</li> <li>Added Drive mode</li> <li>Added Album and Artist layout change option in library</li> <li>Added Show more album and artist information in details</li> <li>Added Pixel style scroller bar</li> <li>Added current now playing share</li> <li>Fix font issues and colors in some places</li> <li>Improved Full now playing theme</li> </ul> <h4>v3.4.850</h4> <ul> <li>Added new theme called circle</li> <li>Added tiny color card style for home artists</li> <li>Added extra track info details to now playing themes</li> <li>Added scroll animation</li> <li>Added smooth transition animations 🤔</li> <li>Added current playing tab options for Bottom Navigation View</li> <li>Added search in genre</li> <li>Improved selecting feedback effect(ripple with corners)</li> <li>Fix bugs & crashes</li> <li>Fix crashing on lyrics</li> <li>Fix genre details last song is under mini player</li> <li>Fix colors mistakes and font sizes</li> <li>Fix slider jumping while scrolling in now playing themes</li> </ul> <h4>v3.4.800</h4> <ul> <li>Improved dark theme colors and Follow system theme</li> <li>Rounded rectangle ripple for BottomNavigationView</li> <li>Follow sleep timer dialog checkbox color as accent</li> <li>Added song list selection for Album and Artist details</li> <li>Fixed Toolbar popup text color when selecting songs</li> </ul> <h4>v3.4.700</h4> <ul> <li>Added splash screen(for app loading time)</li> <li>Updated dark theme colors</li> <li>Added circular progress view</li> <li>Hiding year if not showing</li> </ul> <h4>v3.4.600</h4> <ul> <li>Fix notification layout height</li> <li>Fix folder list last item not showing</li> <li>Added auto hide/ show controls according to first and last item</li> </ul> <h4>v3.4.500</h4> <ul> <li>Added peak theme</li> <li>Added app rating dialog</li> <li>Fix song name scrolling in now playing themes if it's long</li> <li>Fix playing queue last item hiding FAB</li> <li>Added desaturated color option for dark mode</li> <li>Fix slow search loading</li> <li>Fix last added slow loading</li> <li>Fix home banner toolbar corner</li> <li>Fix home crashing when switching between two tabs</li> <li>Fix remaining time in playing queue</li> <li>Fix font not applied for some components</li> <li>Fix crashing on album details sorting</li> <li>Fixed lot of internal bugs</li> <li>Fix dialog expand</li> <li>Fix list card color</li> <li>Removed SlidingUpPanel to replace with BottomSheet</li> <li>Removed color theme as per material design guidelines</li> <li>Removed classic theme(We're bringing back)</li> <li>Replace line switch to Material Switch in settings</li> <li>Performance improved</li> <li>Updated internal libraries</li> <li>Updated translation</li> <li>Limiting the use of Theme engine for making use of system colors</li> <li>Change home icon from the user icon</li> <li>Corrected all toolbar with elevation when scrolling</li> </ul> <p>If you see entire app white or dark or black select same theme in settings to fix </p> <p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a> </p> <p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body>

View file

@ -8,6 +8,7 @@ import android.view.KeyEvent
import android.view.View import android.view.View
import android.view.WindowManager import android.view.WindowManager
import androidx.annotation.ColorInt import androidx.annotation.ColorInt
import androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.ATH import code.name.monkey.appthemehelper.ATH
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
@ -19,14 +20,14 @@ import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.ThemeManager import code.name.monkey.retromusic.util.theme.ThemeManager
abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable { abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
private val handler = Handler() private val handler = Handler()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
setTheme(ThemeManager.getThemeResValue(this)) updateTheme()
hideStatusBar() hideStatusBar()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setImmersiveFullscreen() setImmersiveFullscreen()
@ -34,6 +35,11 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
toggleScreenOn() toggleScreenOn()
} }
private fun updateTheme() {
setTheme(ThemeManager.getThemeResValue(this))
setDefaultNightMode(ThemeManager.getNightMode(this))
}
private fun toggleScreenOn() { private fun toggleScreenOn() {
if (PreferenceUtil.getInstance(this).isScreenOnEnabled) { if (PreferenceUtil.getInstance(this).isScreenOnEnabled) {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

View file

@ -47,6 +47,7 @@ public class WriteTagsAsyncTask extends
@NonNull @NonNull
@Override @Override
protected Dialog createDialog(@NonNull Context context) { protected Dialog createDialog(@NonNull Context context) {
return new MaterialAlertDialogBuilder(context) return new MaterialAlertDialogBuilder(context)
.setTitle(R.string.saving_changes) .setTitle(R.string.saving_changes)
.setCancelable(false) .setCancelable(false)

View file

@ -180,23 +180,23 @@ open class AlbumAdapter(
override fun onClick(v: View?) { override fun onClick(v: View?) {
super.onClick(v) super.onClick(v)
if (isInQuickSelectMode) { if (isInQuickSelectMode) {
toggleChecked(adapterPosition) toggleChecked(layoutPosition)
} else { } else {
val activityOptions = ActivityOptions.makeSceneTransitionAnimation( val activityOptions = ActivityOptions.makeSceneTransitionAnimation(
activity, activity,
imageContainerCard ?: image, imageContainerCard ?: image,
"${activity.getString(R.string.transition_album_art)}_${dataSet[adapterPosition].id}" "${activity.getString(R.string.transition_album_art)}_${dataSet[layoutPosition].id}"
) )
NavigationUtil.goToAlbumOptions( NavigationUtil.goToAlbumOptions(
activity, activity,
dataSet[adapterPosition].id, dataSet[layoutPosition].id,
activityOptions activityOptions
) )
} }
} }
override fun onLongClick(v: View?): Boolean { override fun onLongClick(v: View?): Boolean {
toggleChecked(adapterPosition) toggleChecked(layoutPosition)
return super.onLongClick(v) return super.onLongClick(v)
} }
} }

View file

@ -16,6 +16,7 @@ package code.name.monkey.retromusic.fragments.settings
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.TwoStatePreference import androidx.preference.TwoStatePreference
import code.name.monkey.appthemehelper.ACCENT_COLORS import code.name.monkey.appthemehelper.ACCENT_COLORS
@ -53,7 +54,9 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
requireActivity().setTheme(PreferenceUtil.getThemeResFromPrefValue(theme)) requireActivity().setTheme(PreferenceUtil.getThemeResFromPrefValue(theme))
DynamicShortcutManager(requireContext()).updateDynamicShortcuts() DynamicShortcutManager(requireContext()).updateDynamicShortcuts()
} }
requireActivity().recreate() Handler().postDelayed({
requireActivity().recreate()
}, 400)
true true
} }
} }
@ -75,7 +78,9 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
ThemeStore.editTheme(requireContext()).accentColor(color).commit() ThemeStore.editTheme(requireContext()).accentColor(color).commit()
if (VersionUtils.hasNougatMR()) if (VersionUtils.hasNougatMR())
DynamicShortcutManager(requireContext()).updateDynamicShortcuts() DynamicShortcutManager(requireContext()).updateDynamicShortcuts()
requireActivity().recreate() Handler().postDelayed({
requireActivity().recreate()
}, 400)
} }
} }
return@setOnPreferenceClickListener true return@setOnPreferenceClickListener true
@ -91,7 +96,9 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
requireActivity().setTheme(PreferenceUtil.getThemeResFromPrefValue("black")) requireActivity().setTheme(PreferenceUtil.getThemeResFromPrefValue("black"))
DynamicShortcutManager(requireContext()).updateDynamicShortcuts() DynamicShortcutManager(requireContext()).updateDynamicShortcuts()
} }
requireActivity().recreate() Handler().postDelayed({
requireActivity().recreate()
}, 400)
true true
} }
@ -102,7 +109,9 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
ThemeStore.prefs(requireContext()).edit().putBoolean("desaturated_color", desaturated) ThemeStore.prefs(requireContext()).edit().putBoolean("desaturated_color", desaturated)
.apply() .apply()
PreferenceUtil.getInstance(requireContext()).setDesaturatedColor(desaturated) PreferenceUtil.getInstance(requireContext()).setDesaturatedColor(desaturated)
requireActivity().recreate() Handler().postDelayed({
requireActivity().recreate()
}, 400)
true true
} }

View file

@ -2,8 +2,6 @@ package code.name.monkey.retromusic.glide;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -86,7 +84,8 @@ public class AlbumGlideRequest {
//noinspection unchecked //noinspection unchecked
return createBaseRequest(requestManager, song, ignoreMediaStore) return createBaseRequest(requestManager, song, ignoreMediaStore)
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY) .diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
.error(new ColorDrawable(Color.RED)) .placeholder(DEFAULT_ERROR_IMAGE)
.error(DEFAULT_ERROR_IMAGE)
.animate(DEFAULT_ANIMATION) .animate(DEFAULT_ANIMATION)
.signature(createSignature(song)); .signature(createSignature(song));
} }
@ -95,7 +94,7 @@ public class AlbumGlideRequest {
public static class BitmapBuilder { public static class BitmapBuilder {
private final Builder builder; private final Builder builder;
public BitmapBuilder(Builder builder) { BitmapBuilder(Builder builder) {
this.builder = builder; this.builder = builder;
} }
@ -104,18 +103,18 @@ public class AlbumGlideRequest {
return createBaseRequest(builder.requestManager, builder.song, builder.ignoreMediaStore) return createBaseRequest(builder.requestManager, builder.song, builder.ignoreMediaStore)
.asBitmap() .asBitmap()
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY) .diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
.error(new ColorDrawable(Color.GREEN)) .placeholder(DEFAULT_ERROR_IMAGE)
.error(DEFAULT_ERROR_IMAGE)
.animate(DEFAULT_ANIMATION) .animate(DEFAULT_ANIMATION)
.signature(createSignature(builder.song)); .signature(createSignature(builder.song));
} }
} }
public static class PaletteBuilder { public static class PaletteBuilder {
private static final String TAG = "PaletteBuilder"; private final Context context;
final Context context;
private final Builder builder; private final Builder builder;
public PaletteBuilder(Builder builder, Context context) { PaletteBuilder(Builder builder, Context context) {
this.builder = builder; this.builder = builder;
this.context = context; this.context = context;
} }
@ -127,6 +126,7 @@ public class AlbumGlideRequest {
.asBitmap() .asBitmap()
.transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class) .transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class)
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY) .diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
.placeholder(DEFAULT_ERROR_IMAGE)
.error(DEFAULT_ERROR_IMAGE) .error(DEFAULT_ERROR_IMAGE)
.animate(DEFAULT_ANIMATION) .animate(DEFAULT_ANIMATION)
.signature(createSignature(builder.song)); .signature(createSignature(builder.song));

View file

@ -47,7 +47,7 @@ public class ArtistGlideRequest {
private static final int DEFAULT_ERROR_IMAGE = R.drawable.default_artist_art; private static final int DEFAULT_ERROR_IMAGE = R.drawable.default_artist_art;
@NonNull @NonNull
public static Key createSignature(@NonNull Artist artist) { private static Key createSignature(@NonNull Artist artist) {
return ArtistSignatureUtil.getInstance(App.Companion.getContext()).getArtistSignature(artist.getName()); return ArtistSignatureUtil.getInstance(App.Companion.getContext()).getArtistSignature(artist.getName());
} }
@ -88,7 +88,7 @@ public class ArtistGlideRequest {
//noinspection unchecked //noinspection unchecked
return createBaseRequest(requestManager, artist, noCustomImage, forceDownload) return createBaseRequest(requestManager, artist, noCustomImage, forceDownload)
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY) .diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
.error(DEFAULT_ERROR_IMAGE) .placeholder(DEFAULT_ERROR_IMAGE)
.animate(DEFAULT_ANIMATION) .animate(DEFAULT_ANIMATION)
.priority(Priority.LOW) .priority(Priority.LOW)
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
@ -114,7 +114,7 @@ public class ArtistGlideRequest {
private final Builder builder; private final Builder builder;
public BitmapBuilder(Builder builder) { BitmapBuilder(Builder builder) {
this.builder = builder; this.builder = builder;
} }
@ -124,7 +124,6 @@ public class ArtistGlideRequest {
builder.forceDownload) builder.forceDownload)
.asBitmap() .asBitmap()
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY) .diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
.error(DEFAULT_ERROR_IMAGE)
.animate(DEFAULT_ANIMATION) .animate(DEFAULT_ANIMATION)
.priority(Priority.LOW) .priority(Priority.LOW)
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
@ -138,7 +137,7 @@ public class ArtistGlideRequest {
private final Builder builder; private final Builder builder;
public PaletteBuilder(Builder builder, Context context) { PaletteBuilder(Builder builder, Context context) {
this.builder = builder; this.builder = builder;
this.context = context; this.context = context;
} }
@ -151,7 +150,6 @@ public class ArtistGlideRequest {
.transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class) .transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class)
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY) .diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
.placeholder(DEFAULT_ERROR_IMAGE) .placeholder(DEFAULT_ERROR_IMAGE)
.error(DEFAULT_ERROR_IMAGE)
.animate(DEFAULT_ANIMATION) .animate(DEFAULT_ANIMATION)
.priority(Priority.LOW) .priority(Priority.LOW)
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)

View file

@ -102,7 +102,7 @@ public class SongGlideRequest {
//noinspection unchecked //noinspection unchecked
return createBaseRequest(requestManager, song, ignoreMediaStore) return createBaseRequest(requestManager, song, ignoreMediaStore)
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY) .diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
.error(DEFAULT_ERROR_IMAGE) .placeholder(DEFAULT_ERROR_IMAGE)
.animate(DEFAULT_ANIMATION) .animate(DEFAULT_ANIMATION)
.signature(createSignature(song)); .signature(createSignature(song));
} }
@ -111,7 +111,7 @@ public class SongGlideRequest {
public static class BitmapBuilder { public static class BitmapBuilder {
private final Builder builder; private final Builder builder;
public BitmapBuilder(Builder builder) { BitmapBuilder(Builder builder) {
this.builder = builder; this.builder = builder;
} }
@ -120,7 +120,7 @@ public class SongGlideRequest {
return createBaseRequest(builder.requestManager, builder.song, builder.ignoreMediaStore) return createBaseRequest(builder.requestManager, builder.song, builder.ignoreMediaStore)
.asBitmap() .asBitmap()
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY) .diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
.error(DEFAULT_ERROR_IMAGE) .placeholder(DEFAULT_ERROR_IMAGE)
.animate(DEFAULT_ANIMATION) .animate(DEFAULT_ANIMATION)
.signature(createSignature(builder.song)); .signature(createSignature(builder.song));
} }
@ -130,7 +130,7 @@ public class SongGlideRequest {
final Context context; final Context context;
private final Builder builder; private final Builder builder;
public PaletteBuilder(Builder builder, Context context) { PaletteBuilder(Builder builder, Context context) {
this.builder = builder; this.builder = builder;
this.context = context; this.context = context;
} }
@ -141,7 +141,7 @@ public class SongGlideRequest {
.asBitmap() .asBitmap()
.transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class) .transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class)
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY) .diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
.error(DEFAULT_ERROR_IMAGE) .placeholder(DEFAULT_ERROR_IMAGE)
.animate(DEFAULT_ANIMATION) .animate(DEFAULT_ANIMATION)
.signature(createSignature(builder.song)); .signature(createSignature(builder.song));
} }

View file

@ -57,6 +57,7 @@ import code.name.monkey.retromusic.transform.HorizontalFlipTransformation;
import code.name.monkey.retromusic.transform.NormalPageTransformer; import code.name.monkey.retromusic.transform.NormalPageTransformer;
import code.name.monkey.retromusic.transform.VerticalFlipTransformation; import code.name.monkey.retromusic.transform.VerticalFlipTransformation;
import code.name.monkey.retromusic.transform.VerticalStackTransformer; import code.name.monkey.retromusic.transform.VerticalStackTransformer;
import code.name.monkey.retromusic.util.theme.ThemeMode;
public final class PreferenceUtil { public final class PreferenceUtil {
@ -527,11 +528,20 @@ public final class PreferenceUtil {
} }
@NonNull @NonNull
public String getGeneralThemeValue() { public ThemeMode getGeneralThemeValue() {
if (isBlackMode()) { if (isBlackMode()) {
return "black"; return ThemeMode.BLACK;
} else { } else {
return mPreferences.getString(GENERAL_THEME, "dark"); String themeMode = mPreferences.getString(GENERAL_THEME, "dark");
switch (themeMode) {
case "light":
return ThemeMode.LIGHT;
case "dark":
return ThemeMode.DARK;
case "auto":
default:
return ThemeMode.AUTO;
}
} }
} }

View file

@ -1,35 +0,0 @@
package code.name.monkey.retromusic.util
import android.content.Context
import android.content.res.Configuration.UI_MODE_NIGHT_MASK
import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.os.PowerManager
import androidx.annotation.StyleRes
import code.name.monkey.retromusic.R
/**
* @author Paolo Valerdi
*/
object ThemeManager {
@StyleRes
fun getThemeResValue(context: Context): Int =
when (PreferenceUtil.getInstance(context).generalThemeValue) {
"light" -> R.style.Theme_RetroMusic_Light
"dark" -> R.style.Theme_RetroMusic_Base
"auto" -> R.style.Theme_RetroMusic_FollowSystem
"black" -> R.style.Theme_RetroMusic_Black
else -> R.style.Theme_RetroMusic_FollowSystem
}
private fun isSystemDarkModeEnabled(context: Context): Boolean {
val isBatterySaverEnabled =
(context.getSystemService(Context.POWER_SERVICE) as PowerManager?)?.isPowerSaveMode
?: false
val isDarkModeEnabled =
(context.resources.configuration.uiMode and UI_MODE_NIGHT_MASK) == UI_MODE_NIGHT_YES
return isBatterySaverEnabled or isDarkModeEnabled
}
}

View file

@ -0,0 +1,50 @@
package code.name.monkey.retromusic.util.theme
import android.content.Context
import android.content.res.Configuration.UI_MODE_NIGHT_MASK
import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.os.PowerManager
import androidx.annotation.StyleRes
import androidx.appcompat.app.AppCompatDelegate
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.theme.ThemeMode.*
/**
* @author Paolo Valerdi
*/
object ThemeManager {
@StyleRes
fun getThemeResValue(
context: Context
): Int = when (context.generalThemeValue) {
LIGHT -> R.style.Theme_RetroMusic_Light
DARK -> R.style.Theme_RetroMusic_Base
BLACK -> R.style.Theme_RetroMusic_Black
AUTO -> R.style.Theme_RetroMusic_FollowSystem
}
fun getNightMode(
context: Context
): Int = when (context.generalThemeValue) {
LIGHT -> AppCompatDelegate.MODE_NIGHT_NO
DARK,
BLACK -> AppCompatDelegate.MODE_NIGHT_YES
AUTO -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
}
private fun isSystemDarkModeEnabled(context: Context): Boolean {
val isBatterySaverEnabled =
(context.getSystemService(Context.POWER_SERVICE) as PowerManager?)?.isPowerSaveMode
?: false
val isDarkModeEnabled =
(context.resources.configuration.uiMode and UI_MODE_NIGHT_MASK) == UI_MODE_NIGHT_YES
return isBatterySaverEnabled or isDarkModeEnabled
}
}
val Context.generalThemeValue: ThemeMode
get() = PreferenceUtil.getInstance(this).generalThemeValue

View file

@ -0,0 +1,8 @@
package code.name.monkey.retromusic.util.theme
enum class ThemeMode {
LIGHT,
DARK,
BLACK,
AUTO
}

View file

@ -13,57 +13,63 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/roundSelector" android:background="?attr/roundSelector"
android:padding="12dp" android:padding="14dp"
app:layout_constraintBottom_toBottomOf="@+id/text" app:layout_constraintBottom_toBottomOf="@+id/titleContainer"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="@id/titleContainer"
app:srcCompat="@drawable/ic_more_vert_white_24dp" /> app:srcCompat="@drawable/ic_more_vert_white_24dp" />
<com.google.android.material.textview.MaterialTextView <LinearLayout
android:id="@+id/title" android:id="@+id/titleContainer"
android:layout_width="315dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="marquee" android:orientation="vertical"
android:gravity="center"
android:marqueeRepeatLimit="marquee_forever"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:singleLine="true"
android:textAppearance="@style/TextViewHeadline6"
android:textColor="@color/md_white_1000"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/text"
app:layout_constraintEnd_toStartOf="@+id/playerMenu"
app:layout_constraintStart_toEndOf="@+id/songFavourite"
app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="315dp"
android:layout_height="wrap_content"
android:alpha="0.75"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:padding="8dp"
android:textColor="@color/md_white_1000"
app:layout_constraintBottom_toTopOf="@+id/progressSlider" app:layout_constraintBottom_toTopOf="@+id/progressSlider"
app:layout_constraintEnd_toStartOf="@+id/playerMenu" app:layout_constraintEnd_toStartOf="@+id/playerMenu"
app:layout_constraintStart_toEndOf="@+id/songFavourite" app:layout_constraintStart_toEndOf="@+id/songFavourite"
app:layout_constraintTop_toBottomOf="@+id/title" app:layout_constraintTop_toTopOf="parent">
tools:layout_editor_absoluteX="48dp"
tools:text="@tools:sample/lorem/random" /> <com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:gravity="center"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:textAppearance="@style/TextViewHeadline6"
android:textColor="@color/md_white_1000"
android:textStyle="bold"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.75"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:paddingTop="6dp"
android:textColor="@color/md_white_1000"
app:layout_constraintBottom_toTopOf="@+id/progressSlider"
app:layout_constraintEnd_toStartOf="@+id/playerMenu"
app:layout_constraintStart_toEndOf="@+id/songFavourite"
app:layout_constraintTop_toBottomOf="@+id/title"
tools:layout_editor_absoluteX="48dp"
tools:text="@tools:sample/lorem/random" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/songFavourite" android:id="@+id/songFavourite"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/roundSelector" android:background="?attr/roundSelector"
android:padding="12dp" android:padding="14dp"
app:layout_constraintBottom_toBottomOf="@+id/text" app:layout_constraintBottom_toBottomOf="@+id/titleContainer"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/title" app:layout_constraintTop_toTopOf="@+id/titleContainer"
app:srcCompat="@drawable/ic_favorite_border_white_24dp" /> app:srcCompat="@drawable/ic_favorite_border_white_24dp" />
@ -92,7 +98,7 @@
app:labelBehavior="gone" app:labelBehavior="gone"
app:layout_constraintEnd_toStartOf="@id/songTotalTime" app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress" app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toBottomOf="@id/text" app:layout_constraintTop_toBottomOf="@id/titleContainer"
app:thumbColor="@color/md_white_1000" app:thumbColor="@color/md_white_1000"
app:thumbRadius="@dimen/slider_thumb_radius" app:thumbRadius="@dimen/slider_thumb_radius"
app:trackColorActive="@color/md_white_1000" app:trackColorActive="@color/md_white_1000"

View file

@ -67,7 +67,6 @@
android:id="@+id/playPauseButton" android:id="@+id/playPauseButton"
android:layout_width="72dp" android:layout_width="72dp"
android:layout_height="72dp" android:layout_height="72dp"
android:layout_centerVertical="true"
android:background="?attr/roundSelector" android:background="?attr/roundSelector"
android:padding="8dp" android:padding="8dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
@ -86,11 +85,10 @@
android:background="?attr/roundSelector" android:background="?attr/roundSelector"
android:padding="16dp" android:padding="16dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer" app:layout_constraintBottom_toBottomOf="@+id/playPauseButton"
app:layout_constraintEnd_toStartOf="@+id/playPauseButton" app:layout_constraintEnd_toStartOf="@+id/playPauseButton"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/repeatButton" app:layout_constraintStart_toEndOf="@+id/repeatButton"
app:layout_constraintTop_toBottomOf="@+id/progressContainer" app:layout_constraintTop_toTopOf="@+id/playPauseButton"
app:srcCompat="@drawable/ic_skip_previous_white_24dp" app:srcCompat="@drawable/ic_skip_previous_white_24dp"
tools:ignore="MissingPrefix" tools:ignore="MissingPrefix"
tools:tint="@color/md_black_1000" /> tools:tint="@color/md_black_1000" />
@ -105,9 +103,8 @@
android:scaleType="fitCenter" android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="@+id/playPauseButton" app:layout_constraintBottom_toBottomOf="@+id/playPauseButton"
app:layout_constraintEnd_toStartOf="@+id/shuffleButton" app:layout_constraintEnd_toStartOf="@+id/shuffleButton"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/playPauseButton" app:layout_constraintStart_toEndOf="@+id/playPauseButton"
app:layout_constraintTop_toBottomOf="@+id/progressContainer" app:layout_constraintTop_toTopOf="@+id/playPauseButton"
app:srcCompat="@drawable/ic_skip_next_white_24dp" app:srcCompat="@drawable/ic_skip_next_white_24dp"
tools:ignore="MissingPrefix" tools:ignore="MissingPrefix"
tools:tint="@color/md_black_1000" /> tools:tint="@color/md_black_1000" />
@ -121,9 +118,11 @@
android:background="?attr/roundSelector" android:background="?attr/roundSelector"
android:padding="16dp" android:padding="16dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer" app:layout_constraintBottom_toBottomOf="@+id/previousButton"
app:layout_constraintEnd_toStartOf="@+id/previousButton"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progressContainer" app:layout_constraintTop_toTopOf="@+id/previousButton"
app:srcCompat="@drawable/ic_repeat_white_24dp" app:srcCompat="@drawable/ic_repeat_white_24dp"
tools:ignore="MissingPrefix" tools:ignore="MissingPrefix"
tools:tint="@color/md_black_1000" /> tools:tint="@color/md_black_1000" />
@ -137,9 +136,10 @@
android:background="?attr/roundSelector" android:background="?attr/roundSelector"
android:padding="16dp" android:padding="16dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer" app:layout_constraintBottom_toBottomOf="@+id/nextButton"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progressContainer" app:layout_constraintStart_toEndOf="@+id/nextButton"
app:layout_constraintTop_toTopOf="@+id/nextButton"
app:srcCompat="@drawable/ic_shuffle_white_24dp" app:srcCompat="@drawable/ic_shuffle_white_24dp"
tools:ignore="MissingPrefix" tools:ignore="MissingPrefix"
tools:tint="@color/md_black_1000" /> tools:tint="@color/md_black_1000" />

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="window_color">@android:color/black</color>
</resources>

View file

@ -16,12 +16,14 @@
<item name="android:statusBarColor">@android:color/transparent</item> <item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowSharedElementsUseOverlay">false</item> <item name="android:windowSharedElementsUseOverlay">false</item>
<item name="android:textViewStyle">@style/TextViewStyleIm</item> <item name="android:textViewStyle">@style/TextViewStyleIm</item>
<item name="android:windowBackground">@color/window_color_dark</item>
</style> </style>
<style name="Theme.RetroMusic.FollowSystem" parent="Theme.RetroMusic.Base.Adaptive"> <style name="Theme.RetroMusic.FollowSystem" parent="Theme.RetroMusic.Base.Adaptive">
<item name="android:statusBarColor">@android:color/transparent</item> <item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowSharedElementsUseOverlay">false</item> <item name="android:windowSharedElementsUseOverlay">false</item>
<item name="android:textViewStyle">@style/TextViewStyleIm</item> <item name="android:textViewStyle">@style/TextViewStyleIm</item>
<item name="android:windowBackground">@color/window_color</item>
</style> </style>
<style name="Theme.RetroMusic.Notification" parent="@android:style/TextAppearance.Material.Notification" /> <style name="Theme.RetroMusic.Notification" parent="@android:style/TextAppearance.Material.Notification" />

View file

@ -31,7 +31,6 @@
<item name="rectSelector">@drawable/rect_selector</item> <item name="rectSelector">@drawable/rect_selector</item>
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item> <item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
<item name="android:windowLightNavigationBar">true</item> <item name="android:windowLightNavigationBar">true</item>
</style> </style>
<style name="Theme.RetroMusic.Base" parent="Theme.MaterialComponents.NoActionBar"> <style name="Theme.RetroMusic.Base" parent="Theme.MaterialComponents.NoActionBar">
@ -56,7 +55,7 @@
<item name="android:windowLightNavigationBar">false</item> <item name="android:windowLightNavigationBar">false</item>
<!--Manual setting colors--> <!--Manual setting colors-->
<item name="colorSurface">@color/darkColorSurface</item> <item name="colorSurface">@color/darkColorSurface</item>
<item name="android:windowBackground">@color/window_color_dark</item>
</style> </style>
<style name="Theme.RetroMusic.Base.Light" parent="Theme.MaterialComponents.Light.NoActionBar"> <style name="Theme.RetroMusic.Base.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
@ -78,6 +77,5 @@
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item> <item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
<item name="materialButtonStyle">@style/MaterialButtonTheme</item> <item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="android:windowLightNavigationBar">false</item> <item name="android:windowLightNavigationBar">false</item>
</style> </style>
</resources> </resources>

View file

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="window_color">@color/md_white_1000</color>
<color name="window_color_light">@color/md_white_1000</color>
<color name="window_color_dark">@android:color/black</color>
<color name="twenty_percent_black_overlay">#34000000</color> <color name="twenty_percent_black_overlay">#34000000</color>
<color name="eighty_percent_black_overlay">#80000000</color> <color name="eighty_percent_black_overlay">#80000000</color>
<color name="app_shortcut_default_foreground">#607d8b</color> <color name="app_shortcut_default_foreground">#607d8b</color>

View file

@ -2,11 +2,17 @@
<style name="Theme.RetroMusic" parent="Theme.RetroMusic.Base" /> <style name="Theme.RetroMusic" parent="Theme.RetroMusic.Base" />
<style name="Theme.RetroMusic.Light" parent="Theme.RetroMusic.Base.Light" /> <style name="Theme.RetroMusic.Light" parent="Theme.RetroMusic.Base.Light" >
<item name="android:windowBackground">@color/window_color_light</item>
</style>
<style name="Theme.RetroMusic.Black" parent="Theme.RetroMusic.Base.Black" /> <style name="Theme.RetroMusic.Black" parent="Theme.RetroMusic.Base.Black" >
<item name="android:windowBackground">@color/window_color_dark</item>
</style>
<style name="Theme.RetroMusic.FollowSystem" parent="Theme.RetroMusic.Base.Adaptive" /> <style name="Theme.RetroMusic.FollowSystem" parent="Theme.RetroMusic.Base.Adaptive" >
<item name="android:windowBackground">@color/window_color</item>
</style>
<style name="Theme.RetroMusic.Notification" parent="@android:style/TextAppearance.StatusBar.EventContent" /> <style name="Theme.RetroMusic.Notification" parent="@android:style/TextAppearance.StatusBar.EventContent" />

View file

@ -41,6 +41,7 @@
<!--Manual setting colors--> <!--Manual setting colors-->
<item name="colorSurface">@color/darkColorSurface</item> <item name="colorSurface">@color/darkColorSurface</item>
<item name="android:windowBackground">@color/window_color_dark</item>
</style> </style>