Added fragment to bottom options
This commit is contained in:
parent
1dc0a8fcc0
commit
bad40d4ccd
12 changed files with 80 additions and 112 deletions
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
package code.name.monkey.retromusic.activities;
|
package code.name.monkey.retromusic.activities;
|
||||||
|
|
||||||
import static code.name.monkey.appthemehelper.util.ATHUtil.INSTANCE;
|
|
||||||
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -23,6 +21,7 @@ import android.webkit.WebView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import code.name.monkey.appthemehelper.ThemeStore;
|
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.ColorUtil;
|
||||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
|
@ -49,7 +48,7 @@ public class LicenseActivity extends AbsBaseActivity {
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
ToolbarContentTintHelper.colorBackButton(toolbar);
|
ToolbarContentTintHelper.colorBackButton(toolbar);
|
||||||
toolbar.setBackgroundColor(INSTANCE.resolveColor(this, R.attr.colorSurface));
|
toolbar.setBackgroundColor(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface));
|
||||||
WebView webView = findViewById(R.id.license);
|
WebView webView = findViewById(R.id.license);
|
||||||
try {
|
try {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
|
@ -62,8 +61,8 @@ public class LicenseActivity extends AbsBaseActivity {
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
// Inject color values for WebView body background and links
|
// Inject color values for WebView body background and links
|
||||||
final boolean isDark = INSTANCE.isWindowBackgroundDark(this);
|
final boolean isDark = ATHUtil.INSTANCE.isWindowBackgroundDark(this);
|
||||||
final String backgroundColor = colorToCSS(INSTANCE.resolveColor(this, R.attr.colorSurface,
|
final String backgroundColor = colorToCSS(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface,
|
||||||
Color.parseColor(isDark ? "#424242" : "#ffffff")));
|
Color.parseColor(isDark ? "#424242" : "#ffffff")));
|
||||||
final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000"));
|
final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000"));
|
||||||
final String changeLog = buf.toString()
|
final String changeLog = buf.toString()
|
||||||
|
|
|
@ -207,11 +207,21 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||||
if (isPlaylistPage()) {
|
if (isPlaylistPage()) {
|
||||||
menu.add(0, R.id.action_new_playlist, 0, R.string.new_playlist_title)
|
menu.add(0, R.id.action_new_playlist, 0, R.string.new_playlist_title)
|
||||||
.setIcon(R.drawable.ic_playlist_add_white_24dp).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
.setIcon(R.drawable.ic_playlist_add_white_24dp)
|
||||||
|
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
}
|
}
|
||||||
if (isHomePage()) {
|
if (isHomePage()) {
|
||||||
menu.add(0, R.id.action_search, 0, getString(R.string.action_search))
|
menu.add(0, R.id.action_search, 0, getString(R.string.action_search))
|
||||||
.setIcon(R.drawable.ic_mic_white_24dp).setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
.setIcon(R.drawable.ic_mic_white_24dp)
|
||||||
|
.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
|
}
|
||||||
|
if (isFolderPage()) {
|
||||||
|
menu.add(0, R.id.action_scan, 0, R.string.scan_media)
|
||||||
|
.setIcon(R.drawable.ic_scanner_white_24dp)
|
||||||
|
.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
|
menu.add(0, R.id.action_go_to_start_directory, 0, R.string.action_go_to_start_directory)
|
||||||
|
.setIcon(R.drawable.ic_bookmark_music_white_24dp)
|
||||||
|
.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
}
|
}
|
||||||
Fragment fragment = getCurrentFragment();
|
Fragment fragment = getCurrentFragment();
|
||||||
if (fragment instanceof AbsLibraryPagerRecyclerViewCustomGridSizeFragment) {
|
if (fragment instanceof AbsLibraryPagerRecyclerViewCustomGridSizeFragment) {
|
||||||
|
@ -562,6 +572,10 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isFolderPage() {
|
||||||
|
return getSupportFragmentManager().findFragmentByTag(FoldersFragment.TAG) instanceof FoldersFragment;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isHomePage() {
|
private boolean isHomePage() {
|
||||||
return getSupportFragmentManager().findFragmentByTag(BannerHomeFragment.TAG) instanceof BannerHomeFragment;
|
return getSupportFragmentManager().findFragmentByTag(BannerHomeFragment.TAG) instanceof BannerHomeFragment;
|
||||||
}
|
}
|
||||||
|
@ -611,6 +625,9 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||||
case R.id.action_song:
|
case R.id.action_song:
|
||||||
setCurrentFragment(SongsFragment.newInstance(), SongsFragment.TAG);
|
setCurrentFragment(SongsFragment.newInstance(), SongsFragment.TAG);
|
||||||
break;
|
break;
|
||||||
|
case R.id.action_folder:
|
||||||
|
setCurrentFragment(FoldersFragment.newInstance(this), FoldersFragment.TAG);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
case R.id.action_home:
|
case R.id.action_home:
|
||||||
setCurrentFragment(BannerHomeFragment.newInstance(), BannerHomeFragment.TAG);
|
setCurrentFragment(BannerHomeFragment.newInstance(), BannerHomeFragment.TAG);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package code.name.monkey.retromusic.activities;
|
package code.name.monkey.retromusic.activities;
|
||||||
|
|
||||||
import static code.name.monkey.appthemehelper.util.ATHUtil.INSTANCE;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
|
@ -13,6 +12,7 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.widget.NestedScrollView;
|
import androidx.core.widget.NestedScrollView;
|
||||||
import code.name.monkey.appthemehelper.ThemeStore;
|
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.ColorUtil;
|
||||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
|
@ -45,13 +45,13 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
||||||
toolbar = findViewById(R.id.toolbar);
|
toolbar = findViewById(R.id.toolbar);
|
||||||
appBarLayout = findViewById(R.id.appBarLayout);
|
appBarLayout = findViewById(R.id.appBarLayout);
|
||||||
|
|
||||||
toolbar.setBackgroundColor(INSTANCE.resolveColor(this, R.attr.colorSurface));
|
toolbar.setBackgroundColor(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface));
|
||||||
//setSupportActionBar(toolbar);
|
//setSupportActionBar(toolbar);
|
||||||
|
|
||||||
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
||||||
ToolbarContentTintHelper.colorBackButton(toolbar);
|
ToolbarContentTintHelper.colorBackButton(toolbar);
|
||||||
NestedScrollView nestedScrollView = findViewById(R.id.container);
|
NestedScrollView nestedScrollView = findViewById(R.id.container);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
InputStream json = getAssets().open("retro-changelog.html");
|
InputStream json = getAssets().open("retro-changelog.html");
|
||||||
|
@ -63,8 +63,8 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
// Inject color values for WebView body background and links
|
// Inject color values for WebView body background and links
|
||||||
final boolean isDark = INSTANCE.isWindowBackgroundDark(this);
|
final boolean isDark = ATHUtil.INSTANCE.isWindowBackgroundDark(this);
|
||||||
final String backgroundColor = colorToCSS(INSTANCE.resolveColor(this, R.attr.colorSurface,
|
final String backgroundColor = colorToCSS(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface,
|
||||||
Color.parseColor(isDark ? "#424242" : "#ffffff")));
|
Color.parseColor(isDark ? "#424242" : "#ffffff")));
|
||||||
final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000"));
|
final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000"));
|
||||||
final String changeLog = buf.toString()
|
final String changeLog = buf.toString()
|
||||||
|
|
|
@ -37,8 +37,6 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
|
||||||
override fun onClick(view: View) {
|
override fun onClick(view: View) {
|
||||||
val mainActivity = activity as MainActivity? ?: return
|
val mainActivity = activity as MainActivity? ?: return
|
||||||
when (view.id) {
|
when (view.id) {
|
||||||
R.id.actionFolders -> mainActivity.setMusicChooser(FOLDER)
|
|
||||||
R.id.actionLibrary -> mainActivity.setMusicChooser(LIBRARY)
|
|
||||||
R.id.actionSettings -> NavigationUtil.goToSettings(mainActivity)
|
R.id.actionSettings -> NavigationUtil.goToSettings(mainActivity)
|
||||||
R.id.actionDriveMode -> NavigationUtil.gotoDriveMode(mainActivity)
|
R.id.actionDriveMode -> NavigationUtil.gotoDriveMode(mainActivity)
|
||||||
R.id.actionRate -> NavigationUtil.goToPlayStore(mainActivity)
|
R.id.actionRate -> NavigationUtil.goToPlayStore(mainActivity)
|
||||||
|
@ -47,8 +45,6 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var actionSettings: OptionMenuItemView
|
private lateinit var actionSettings: OptionMenuItemView
|
||||||
private lateinit var actionLibrary: OptionMenuItemView
|
|
||||||
private lateinit var actionFolders: OptionMenuItemView
|
|
||||||
private lateinit var actionRate: OptionMenuItemView
|
private lateinit var actionRate: OptionMenuItemView
|
||||||
private lateinit var actionDriveMode: OptionMenuItemView
|
private lateinit var actionDriveMode: OptionMenuItemView
|
||||||
private lateinit var materialDialog: MaterialDialog
|
private lateinit var materialDialog: MaterialDialog
|
||||||
|
@ -58,20 +54,10 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
|
||||||
val layout = LayoutInflater.from(context).inflate(R.layout.fragment_main_options, null)
|
val layout = LayoutInflater.from(context).inflate(R.layout.fragment_main_options, null)
|
||||||
actionSettings = layout.findViewById(R.id.actionSettings)
|
actionSettings = layout.findViewById(R.id.actionSettings)
|
||||||
actionRate = layout.findViewById(R.id.actionRate)
|
actionRate = layout.findViewById(R.id.actionRate)
|
||||||
actionLibrary = layout.findViewById(R.id.actionLibrary)
|
|
||||||
actionFolders = layout.findViewById(R.id.actionFolders)
|
|
||||||
actionDriveMode = layout.findViewById(R.id.actionDriveMode)
|
actionDriveMode = layout.findViewById(R.id.actionDriveMode)
|
||||||
|
|
||||||
|
|
||||||
when (arguments?.getInt(WHICH_ONE)) {
|
|
||||||
LIBRARY -> actionLibrary.isSelected = true
|
|
||||||
FOLDER -> actionFolders.isSelected = true
|
|
||||||
}
|
|
||||||
|
|
||||||
actionSettings.setOnClickListener(this)
|
actionSettings.setOnClickListener(this)
|
||||||
actionRate.setOnClickListener(this)
|
actionRate.setOnClickListener(this)
|
||||||
actionLibrary.setOnClickListener(this)
|
|
||||||
actionFolders.setOnClickListener(this)
|
|
||||||
actionDriveMode.setOnClickListener(this)
|
actionDriveMode.setOnClickListener(this)
|
||||||
|
|
||||||
if (MusicPlayerRemote.playingQueue.isEmpty()) {
|
if (MusicPlayerRemote.playingQueue.isEmpty()) {
|
||||||
|
|
|
@ -7,11 +7,10 @@ import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuInflater;
|
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewGroup.MarginLayoutParams;
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
import android.widget.PopupMenu;
|
import android.widget.PopupMenu;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -37,6 +36,7 @@ import code.name.monkey.retromusic.misc.DialogAsyncTask;
|
||||||
import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener;
|
import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener;
|
||||||
import code.name.monkey.retromusic.misc.WrappedAsyncTaskLoader;
|
import code.name.monkey.retromusic.misc.WrappedAsyncTaskLoader;
|
||||||
import code.name.monkey.retromusic.model.Song;
|
import code.name.monkey.retromusic.model.Song;
|
||||||
|
import code.name.monkey.retromusic.util.DensityUtil;
|
||||||
import code.name.monkey.retromusic.util.FileUtil;
|
import code.name.monkey.retromusic.util.FileUtil;
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil;
|
import code.name.monkey.retromusic.util.RetroColorUtil;
|
||||||
|
@ -392,7 +392,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
getMainActivity().setBottomBarVisibility(View.GONE);
|
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
|
@ -438,12 +437,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
return new AsyncFileLoader(this);
|
return new AsyncFileLoader(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
|
||||||
inflater.inflate(R.menu.menu_folders, menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCrumbSelection(BreadCrumbLayout.Crumb crumb, int index) {
|
public void onCrumbSelection(BreadCrumbLayout.Crumb crumb, int index) {
|
||||||
setCrumb(crumb, true);
|
setCrumb(crumb, true);
|
||||||
|
@ -587,6 +580,17 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onQueueChanged() {
|
||||||
|
super.onQueueChanged();
|
||||||
|
checkForPadding();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onServiceConnected() {
|
||||||
|
super.onServiceConnected();
|
||||||
|
checkForPadding();
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
|
@ -603,6 +607,13 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
return cab;
|
return cab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkForPadding() {
|
||||||
|
final int count = adapter.getItemCount();
|
||||||
|
final MarginLayoutParams params = (MarginLayoutParams) coordinatorLayout.getLayoutParams();
|
||||||
|
params.bottomMargin = count > 0 && !MusicPlayerRemote.getPlayingQueue().isEmpty() ? DensityUtil
|
||||||
|
.dip2px(requireContext(), 104f) : DensityUtil.dip2px(requireContext(), 54f);
|
||||||
|
}
|
||||||
|
|
||||||
private void checkIsEmpty() {
|
private void checkIsEmpty() {
|
||||||
emojiText.setText(getEmojiByUnicode(0x1F631));
|
emojiText.setText(getEmojiByUnicode(0x1F631));
|
||||||
if (empty != null) {
|
if (empty != null) {
|
||||||
|
@ -672,6 +683,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
public void onChanged() {
|
public void onChanged() {
|
||||||
super.onChanged();
|
super.onChanged();
|
||||||
checkIsEmpty();
|
checkIsEmpty();
|
||||||
|
checkForPadding();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
|
@ -71,7 +71,7 @@ object MusicPlayerRemote {
|
||||||
musicService!!.position = position
|
musicService!!.position = position
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@JvmStatic
|
||||||
val playingQueue: ArrayList<Song>
|
val playingQueue: ArrayList<Song>
|
||||||
get() = if (musicService != null) {
|
get() = if (musicService != null) {
|
||||||
musicService?.playingQueue as ArrayList<Song>
|
musicService?.playingQueue as ArrayList<Song>
|
||||||
|
@ -390,6 +390,7 @@ object MusicPlayerRemote {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun playFromUri(uri: Uri) {
|
fun playFromUri(uri: Uri) {
|
||||||
if (musicService != null) {
|
if (musicService != null) {
|
||||||
|
|
|
@ -28,7 +28,8 @@ public class CategoryInfo implements Parcelable {
|
||||||
ARTISTS(R.id.action_artist, R.string.artists, R.drawable.ic_artist_white_24dp),
|
ARTISTS(R.id.action_artist, R.string.artists, R.drawable.ic_artist_white_24dp),
|
||||||
PLAYLISTS(R.id.action_playlist, R.string.playlists, R.drawable.ic_playlist_play_white_24dp),
|
PLAYLISTS(R.id.action_playlist, R.string.playlists, R.drawable.ic_playlist_play_white_24dp),
|
||||||
GENRES(R.id.action_genre, R.string.genres, R.drawable.ic_guitar_white_24dp),
|
GENRES(R.id.action_genre, R.string.genres, R.drawable.ic_guitar_white_24dp),
|
||||||
QUEUE(R.id.action_playing_queue, R.string.queue, R.drawable.ic_queue_music_white_24dp);
|
QUEUE(R.id.action_playing_queue, R.string.queue, R.drawable.ic_queue_music_white_24dp),
|
||||||
|
FOLDER(R.id.action_folder, R.string.folders, R.drawable.ic_folder_white_24dp);
|
||||||
|
|
||||||
public final int icon;
|
public final int icon;
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ import code.name.monkey.retromusic.fragments.mainactivity.folders.FoldersFragmen
|
||||||
import code.name.monkey.retromusic.helper.SortOrder;
|
import code.name.monkey.retromusic.helper.SortOrder;
|
||||||
import code.name.monkey.retromusic.helper.SortOrder.AlbumSongSortOrder;
|
import code.name.monkey.retromusic.helper.SortOrder.AlbumSongSortOrder;
|
||||||
import code.name.monkey.retromusic.model.CategoryInfo;
|
import code.name.monkey.retromusic.model.CategoryInfo;
|
||||||
|
import code.name.monkey.retromusic.model.CategoryInfo.Category;
|
||||||
import code.name.monkey.retromusic.transform.CascadingPageTransformer;
|
import code.name.monkey.retromusic.transform.CascadingPageTransformer;
|
||||||
import code.name.monkey.retromusic.transform.DepthTransformation;
|
import code.name.monkey.retromusic.transform.DepthTransformation;
|
||||||
import code.name.monkey.retromusic.transform.HingeTransformation;
|
import code.name.monkey.retromusic.transform.HingeTransformation;
|
||||||
|
@ -491,14 +492,15 @@ public final class PreferenceUtil {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<CategoryInfo> getDefaultLibraryCategoryInfos() {
|
public List<CategoryInfo> getDefaultLibraryCategoryInfos() {
|
||||||
List<CategoryInfo> defaultCategoryInfos = new ArrayList<>(7);
|
List<CategoryInfo> defaultCategoryInfos = new ArrayList<>(8);
|
||||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.HOME, true));
|
defaultCategoryInfos.add(new CategoryInfo(Category.HOME, true));
|
||||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.SONGS, true));
|
defaultCategoryInfos.add(new CategoryInfo(Category.SONGS, true));
|
||||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.ALBUMS, true));
|
defaultCategoryInfos.add(new CategoryInfo(Category.ALBUMS, true));
|
||||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.ARTISTS, true));
|
defaultCategoryInfos.add(new CategoryInfo(Category.ARTISTS, true));
|
||||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.PLAYLISTS, true));
|
defaultCategoryInfos.add(new CategoryInfo(Category.PLAYLISTS, true));
|
||||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.GENRES, false));
|
defaultCategoryInfos.add(new CategoryInfo(Category.GENRES, false));
|
||||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.QUEUE, false));
|
defaultCategoryInfos.add(new CategoryInfo(Category.QUEUE, false));
|
||||||
|
defaultCategoryInfos.add(new CategoryInfo(Category.FOLDER, false));
|
||||||
return defaultCategoryInfos;
|
return defaultCategoryInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,28 +14,20 @@
|
||||||
|
|
||||||
package code.name.monkey.retromusic.util
|
package code.name.monkey.retromusic.util
|
||||||
|
|
||||||
import android.animation.Animator
|
|
||||||
import android.animation.ArgbEvaluator
|
|
||||||
import android.animation.ObjectAnimator
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.graphics.Color
|
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.graphics.drawable.LayerDrawable
|
import android.graphics.drawable.LayerDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.animation.PathInterpolator
|
|
||||||
import android.widget.ProgressBar
|
import android.widget.ProgressBar
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
import androidx.annotation.ColorInt
|
import androidx.core.graphics.BlendModeColorFilterCompat
|
||||||
|
import androidx.core.graphics.BlendModeCompat.SRC_IN
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.retromusic.R
|
|
||||||
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
|
|
||||||
|
|
||||||
object ViewUtil {
|
object ViewUtil {
|
||||||
|
|
||||||
|
@ -57,37 +49,24 @@ object ViewUtil {
|
||||||
|
|
||||||
fun setProgressDrawable(progressSlider: ProgressBar, newColor: Int) {
|
fun setProgressDrawable(progressSlider: ProgressBar, newColor: Int) {
|
||||||
|
|
||||||
val ld = progressSlider.progressDrawable as LayerDrawable
|
val layerDrawable = progressSlider.progressDrawable as LayerDrawable
|
||||||
|
|
||||||
val progress = ld.findDrawableByLayerId(android.R.id.progress)
|
val progress = layerDrawable.findDrawableByLayerId(android.R.id.progress)
|
||||||
progress.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
|
progress.colorFilter =
|
||||||
|
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(newColor, SRC_IN)
|
||||||
|
|
||||||
val background = ld.findDrawableByLayerId(android.R.id.background)
|
val background = layerDrawable.findDrawableByLayerId(android.R.id.background)
|
||||||
val primaryColor = ATHUtil.resolveColor(progressSlider.context, android.R.attr.windowBackground)
|
val primaryColor = ATHUtil.resolveColor(progressSlider.context, android.R.attr.windowBackground)
|
||||||
background.setColorFilter(MaterialValueHelper.getPrimaryDisabledTextColor(progressSlider.context, ColorUtil.isColorLight(primaryColor)), PorterDuff.Mode.SRC_IN)
|
background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
|
||||||
|
MaterialValueHelper.getPrimaryDisabledTextColor(
|
||||||
val secondaryProgress = ld.findDrawableByLayerId(android.R.id.secondaryProgress)
|
progressSlider.context,
|
||||||
secondaryProgress?.setColorFilter(
|
ColorUtil.isColorLight(primaryColor)
|
||||||
ColorUtil.withAlpha(newColor, 0.65f), PorterDuff.Mode.SRC_IN
|
), SRC_IN
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
private fun createColorAnimator(
|
val secondaryProgress = layerDrawable.findDrawableByLayerId(android.R.id.secondaryProgress)
|
||||||
target: Any, propertyName: String, @ColorInt startColor: Int, @ColorInt endColor: Int
|
secondaryProgress?.colorFilter =
|
||||||
): Animator {
|
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(ColorUtil.withAlpha(newColor, 0.65f), SRC_IN)
|
||||||
val animator: ObjectAnimator
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
animator = ObjectAnimator.ofArgb(target, propertyName, startColor, endColor)
|
|
||||||
} else {
|
|
||||||
animator = ObjectAnimator.ofInt(target, propertyName, startColor, endColor)
|
|
||||||
animator.setEvaluator(ArgbEvaluator())
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
animator.interpolator = PathInterpolator(0.4f, 0f, 1f, 1f)
|
|
||||||
}
|
|
||||||
animator.duration = RETRO_MUSIC_ANIM_TIME.toLong()
|
|
||||||
return animator
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hitTest(v: View, x: Int, y: Int): Boolean {
|
fun hitTest(v: View, x: Int, y: Int): Boolean {
|
||||||
|
@ -101,18 +80,6 @@ object ViewUtil {
|
||||||
return x in left..right && y >= top && y <= bottom
|
return x in left..right && y >= top && y <= bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setUpFastScrollRecyclerViewColor(
|
|
||||||
context: Context,
|
|
||||||
recyclerView: FastScrollRecyclerView,
|
|
||||||
accentColor: Int = ThemeStore.accentColor(context)
|
|
||||||
) {
|
|
||||||
recyclerView.setPopupBgColor(accentColor)
|
|
||||||
recyclerView.setPopupTextColor(MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(accentColor)))
|
|
||||||
recyclerView.setThumbColor(accentColor)
|
|
||||||
recyclerView.setTrackColor(Color.TRANSPARENT)
|
|
||||||
recyclerView.setTrackColor(ColorUtil.withAlpha(ATHUtil.resolveColor(context, R.attr.colorControlNormal), 0.12f))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun convertDpToPixel(dp: Float, resources: Resources): Float {
|
fun convertDpToPixel(dp: Float, resources: Resources): Float {
|
||||||
val metrics = resources.displayMetrics
|
val metrics = resources.displayMetrics
|
||||||
return dp * metrics.density
|
return dp * metrics.density
|
||||||
|
|
|
@ -9,21 +9,6 @@
|
||||||
android:paddingEnd="8dp"
|
android:paddingEnd="8dp"
|
||||||
tools:ignore="MissingPrefix">
|
tools:ignore="MissingPrefix">
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.OptionMenuItemView
|
|
||||||
android:id="@+id/actionLibrary"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="2dp"
|
|
||||||
app:optionIcon="@drawable/ic_library_music_white_24dp"
|
|
||||||
app:optionTitle="@string/library" />
|
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.OptionMenuItemView
|
|
||||||
android:id="@+id/actionFolders"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="2dp"
|
|
||||||
app:optionIcon="@drawable/ic_folder_white_24dp"
|
|
||||||
app:optionTitle="@string/folders" />
|
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.OptionMenuItemView
|
<code.name.monkey.retromusic.views.OptionMenuItemView
|
||||||
android:id="@+id/actionDriveMode"
|
android:id="@+id/actionDriveMode"
|
||||||
|
|
|
@ -2,10 +2,8 @@ package code.name.monkey.appthemehelper.common;
|
||||||
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
import code.name.monkey.appthemehelper.ATHActivity;
|
import code.name.monkey.appthemehelper.ATHActivity;
|
||||||
import code.name.monkey.appthemehelper.R;
|
import code.name.monkey.appthemehelper.R;
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||||
|
@ -13,6 +11,7 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||||
|
|
||||||
|
|
||||||
public class ATHToolbarActivity extends ATHActivity {
|
public class ATHToolbarActivity extends ATHActivity {
|
||||||
|
|
||||||
private Toolbar toolbar;
|
private Toolbar toolbar;
|
||||||
|
|
||||||
public static int getToolbarBackgroundColor(@Nullable Toolbar toolbar) {
|
public static int getToolbarBackgroundColor(@Nullable Toolbar toolbar) {
|
||||||
|
|
|
@ -159,8 +159,7 @@ public final class ToolbarContentTintHelper {
|
||||||
radioButtonField.setAccessible(true);
|
radioButtonField.setAccessible(true);
|
||||||
|
|
||||||
final boolean isDark = !ColorUtil.INSTANCE.isColorLight(
|
final boolean isDark = !ColorUtil.INSTANCE.isColorLight(
|
||||||
ATHUtil.INSTANCE
|
ATHUtil.INSTANCE.resolveColor(context, android.R.attr.windowBackground));
|
||||||
.resolveColor(context, android.R.attr.windowBackground));
|
|
||||||
|
|
||||||
for (int i = 0; i < listView.getChildCount(); i++) {
|
for (int i = 0; i < listView.getChildCount(); i++) {
|
||||||
View v = listView.getChildAt(i);
|
View v = listView.getChildAt(i);
|
||||||
|
|
Loading…
Reference in a new issue