implemented dynamic tabs
This commit is contained in:
parent
0c23f313b6
commit
67ea2a40a9
39 changed files with 871 additions and 162 deletions
|
@ -175,7 +175,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailContrac
|
|||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (requestCode) {
|
||||
REQUEST_CODE_SELECT_IMAGE -> if (resultCode == Activity.RESULT_OK) {
|
||||
CustomArtistImageUtil.getInstance(this).setCustomArtistImage(artist!!, data!!.data!!)
|
||||
data?.data?.let { CustomArtistImageUtil.getInstance(this).setCustomArtistImage(artist, it) }
|
||||
}
|
||||
else -> if (resultCode == Activity.RESULT_OK) {
|
||||
reload()
|
||||
|
|
|
@ -24,7 +24,6 @@ import code.name.monkey.retromusic.loaders.AlbumLoader
|
|||
import code.name.monkey.retromusic.loaders.ArtistLoader
|
||||
import code.name.monkey.retromusic.loaders.PlaylistSongsLoader
|
||||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import java.util.*
|
||||
|
@ -62,12 +61,17 @@ class MainActivity : AbsSlidingMusicPanelActivity(), SharedPreferences.OnSharedP
|
|||
setDrawUnderStatusBar()
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
getBottomNavigationView().selectedItemId = PreferenceUtil.getInstance().lastPage
|
||||
|
||||
getBottomNavigationView().setOnNavigationItemSelectedListener {
|
||||
PreferenceUtil.getInstance().lastPage = it.itemId
|
||||
selectedFragment(it.itemId)
|
||||
|
||||
true
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
selectedFragment(PreferenceUtil.getInstance().lastPage)
|
||||
} else {
|
||||
|
@ -254,8 +258,10 @@ class MainActivity : AbsSlidingMusicPanelActivity(), SharedPreferences.OnSharedP
|
|||
key == PreferenceUtil.ALBUM_COVER_STYLE ||
|
||||
key == PreferenceUtil.HOME_ARTIST_GRID_STYLE ||
|
||||
key == PreferenceUtil.ALBUM_COVER_TRANSFORM ||
|
||||
key == PreferenceUtil.TAB_TEXT_MODE)
|
||||
key == PreferenceUtil.TAB_TEXT_MODE ||
|
||||
key == PreferenceUtil.LIBRARY_CATEGORIES)
|
||||
postRecreate()
|
||||
|
||||
}
|
||||
|
||||
private fun showPromotionalOffer() {
|
||||
|
@ -277,6 +283,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(), SharedPreferences.OnSharedP
|
|||
R.id.action_album,
|
||||
R.id.action_artist,
|
||||
R.id.action_playlist,
|
||||
R.id.action_genre,
|
||||
R.id.action_song -> setCurrentFragment(LibraryFragment.newInstance(itemId), false)
|
||||
R.id.action_home -> setCurrentFragment(BannerHomeFragment.newInstance(), false)
|
||||
R.id.action_folder -> setCurrentFragment(FoldersFragment.newInstance(this), false)
|
||||
|
@ -296,8 +303,6 @@ class MainActivity : AbsSlidingMusicPanelActivity(), SharedPreferences.OnSharedP
|
|||
|
||||
companion object {
|
||||
const val APP_INTRO_REQUEST = 2323
|
||||
const val LIBRARY = 1
|
||||
const val FOLDERS = 3
|
||||
const val HOME = 0
|
||||
private const val TAG = "MainActivity"
|
||||
private const val APP_USER_INFO_REQUEST = 9003
|
||||
|
|
|
@ -61,6 +61,8 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
|
|||
|
||||
chooseFragmentForTheme()
|
||||
setupSlidingUpPanel()
|
||||
|
||||
updateTabs()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
@ -307,4 +309,16 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
fun updateTabs() {
|
||||
bottomNavigationView.menu.clear()
|
||||
val currentTabs = PreferenceUtil.getInstance().libraryCategoryInfos
|
||||
for (tab in currentTabs) {
|
||||
if (tab.visible) {
|
||||
val menu = tab.category;
|
||||
bottomNavigationView.menu.add(0, menu.id, 0, menu.stringRes)
|
||||
.setIcon(menu.icon)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* 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.retromusic.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.model.CategoryInfo;
|
||||
import code.name.monkey.retromusic.util.SwipeAndDragHelper;
|
||||
|
||||
public class CategoryInfoAdapter extends RecyclerView.Adapter<CategoryInfoAdapter.ViewHolder> implements SwipeAndDragHelper.ActionCompletionContract {
|
||||
private List<CategoryInfo> categoryInfos;
|
||||
private ItemTouchHelper touchHelper;
|
||||
|
||||
public CategoryInfoAdapter(@NonNull List<CategoryInfo> categoryInfos) {
|
||||
this.categoryInfos = categoryInfos;
|
||||
SwipeAndDragHelper swipeAndDragHelper = new SwipeAndDragHelper(this);
|
||||
touchHelper = new ItemTouchHelper(swipeAndDragHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public CategoryInfoAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.preference_dialog_library_categories_listitem, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CategoryInfoAdapter.ViewHolder holder, int position) {
|
||||
CategoryInfo categoryInfo = categoryInfos.get(position);
|
||||
|
||||
holder.checkBox.setChecked(categoryInfo.visible);
|
||||
holder.title.setText(holder.title.getResources().getString(categoryInfo.category.stringRes));
|
||||
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
if (!(categoryInfo.visible && isLastCheckedCategory(categoryInfo))) {
|
||||
categoryInfo.visible = !categoryInfo.visible;
|
||||
holder.checkBox.setChecked(categoryInfo.visible);
|
||||
} else {
|
||||
Toast.makeText(holder.itemView.getContext(), R.string.you_have_to_select_at_least_one_category, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
holder.dragView.setOnTouchListener((view, event) -> {
|
||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||
touchHelper.startDrag(holder);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return categoryInfos.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewMoved(int oldPosition, int newPosition) {
|
||||
CategoryInfo categoryInfo = categoryInfos.get(oldPosition);
|
||||
categoryInfos.remove(oldPosition);
|
||||
categoryInfos.add(newPosition, categoryInfo);
|
||||
notifyItemMoved(oldPosition, newPosition);
|
||||
}
|
||||
|
||||
public void attachToRecyclerView(RecyclerView recyclerView) {
|
||||
touchHelper.attachToRecyclerView(recyclerView);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public List<CategoryInfo> getCategoryInfos() {
|
||||
return categoryInfos;
|
||||
}
|
||||
|
||||
public void setCategoryInfos(@NonNull List<CategoryInfo> categoryInfos) {
|
||||
this.categoryInfos = categoryInfos;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private boolean isLastCheckedCategory(CategoryInfo categoryInfo) {
|
||||
if (categoryInfo.visible) {
|
||||
for (CategoryInfo c : categoryInfos) {
|
||||
if (c != categoryInfo && c.visible) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
CheckBox checkBox;
|
||||
TextView title;
|
||||
View dragView;
|
||||
|
||||
ViewHolder(View view) {
|
||||
super(view);
|
||||
checkBox = view.findViewById(R.id.checkbox);
|
||||
title = view.findViewById(R.id.title);
|
||||
dragView = view.findViewById(R.id.drag_view);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,14 +4,12 @@ import android.app.Activity
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.Locale
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.model.Genre
|
||||
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
||||
import code.name.monkey.retromusic.model.Genre
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
|
@ -40,10 +38,6 @@ class GenreAdapter(private val mActivity: Activity, dataSet: ArrayList<Genre>, p
|
|||
else
|
||||
mActivity.getString(R.string.song))
|
||||
}
|
||||
|
||||
if (holder.separator != null) {
|
||||
holder.separator!!.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
|
@ -56,14 +50,6 @@ class GenreAdapter(private val mActivity: Activity, dataSet: ArrayList<Genre>, p
|
|||
}
|
||||
|
||||
inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) {
|
||||
init {
|
||||
if (menu != null) {
|
||||
menu!!.visibility = View.GONE
|
||||
}
|
||||
assert(imageContainer != null)
|
||||
imageContainer!!.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
super.onClick(v)
|
||||
val genre = dataSet[adapterPosition]
|
||||
|
|
|
@ -32,7 +32,6 @@ class HomeAdapter(private val activity: AppCompatActivity, private var homes: Li
|
|||
val layout = LayoutInflater.from(activity).inflate(R.layout.section_recycler_view, parent, false)
|
||||
return when (viewType) {
|
||||
RECENT_ARTISTS, TOP_ARTISTS -> ArtistViewHolder(layout)
|
||||
GENRES -> GenreViewHolder(layout)
|
||||
PLAYLISTS -> PlaylistViewHolder(layout)
|
||||
else -> {
|
||||
AlbumViewHolder(LayoutInflater.from(activity).inflate(R.layout.metal_section_recycler_view, parent, false))
|
||||
|
@ -52,10 +51,6 @@ class HomeAdapter(private val activity: AppCompatActivity, private var homes: Li
|
|||
val viewHolder = holder as ArtistViewHolder
|
||||
viewHolder.bindView(home)
|
||||
}
|
||||
GENRES -> {
|
||||
val viewHolder = holder as GenreViewHolder
|
||||
viewHolder.bindView(home)
|
||||
}
|
||||
PLAYLISTS -> {
|
||||
val viewHolder = holder as PlaylistViewHolder
|
||||
viewHolder.bindView(home)
|
||||
|
@ -108,20 +103,6 @@ class HomeAdapter(private val activity: AppCompatActivity, private var homes: Li
|
|||
chip.setChipIconResource(home.icon)
|
||||
}
|
||||
}
|
||||
|
||||
private inner class GenreViewHolder(view: View) : AbsHomeViewItem(view) {
|
||||
fun bindView(home: Home) {
|
||||
recyclerView.apply {
|
||||
val genreAdapter = GenreAdapter(activity, home.arrayList as ArrayList<Genre>, R.layout.item_list)
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
adapter = genreAdapter
|
||||
|
||||
}
|
||||
chip.text = activity.getString(home.title)
|
||||
chip.setChipIconResource(home.icon)
|
||||
}
|
||||
}
|
||||
|
||||
private inner class PlaylistViewHolder(view: View) : AbsHomeViewItem(view) {
|
||||
fun bindView(home: Home) {
|
||||
val songs = PlaylistSongsLoader.getPlaylistSongList(activity, home.arrayList[0] as Playlist).blockingFirst()
|
||||
|
|
|
@ -3,11 +3,11 @@ package code.name.monkey.retromusic.fragments.mainactivity
|
|||
import android.os.Bundle
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.adapter.album.AlbumAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
|
||||
import code.name.monkey.retromusic.model.Album
|
||||
import code.name.monkey.retromusic.mvp.contract.AlbumContract
|
||||
import code.name.monkey.retromusic.mvp.presenter.AlbumPresenter
|
||||
import code.name.monkey.retromusic.adapter.album.AlbumAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
|
||||
open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager>(), AlbumContract.AlbumView {
|
||||
|
@ -95,23 +95,9 @@ open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Al
|
|||
presenter = AlbumPresenter(this)
|
||||
}
|
||||
|
||||
override fun setMenuVisibility(menuVisible: Boolean) {
|
||||
super.setMenuVisibility(menuVisible)
|
||||
if (menuVisible) {
|
||||
|
||||
libraryFragment.setTitle(
|
||||
if (PreferenceUtil.getInstance().tabTitles())
|
||||
R.string.library
|
||||
else
|
||||
R.string.albums)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
libraryFragment.setTitle(
|
||||
if (PreferenceUtil.getInstance().tabTitles()) R.string.library else R.string.albums)
|
||||
if (adapter!!.dataSet.isEmpty()) {
|
||||
presenter.subscribe()
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@ package code.name.monkey.retromusic.fragments.mainactivity
|
|||
import android.os.Bundle
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.adapter.artist.ArtistAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
|
||||
import code.name.monkey.retromusic.model.Artist
|
||||
import code.name.monkey.retromusic.mvp.contract.ArtistContract
|
||||
import code.name.monkey.retromusic.mvp.presenter.ArtistPresenter
|
||||
import code.name.monkey.retromusic.adapter.artist.ArtistAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import java.util.*
|
||||
|
||||
|
@ -86,22 +86,8 @@ class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Artist
|
|||
presenter.loadArtists()
|
||||
}
|
||||
|
||||
|
||||
override fun setMenuVisibility(menuVisible: Boolean) {
|
||||
super.setMenuVisibility(menuVisible)
|
||||
if (menuVisible) {
|
||||
libraryFragment.setTitle(
|
||||
if (PreferenceUtil.getInstance().tabTitles())
|
||||
R.string.library
|
||||
else
|
||||
R.string.artists)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
libraryFragment.setTitle(
|
||||
if (PreferenceUtil.getInstance().tabTitles()) R.string.library else R.string.artists)
|
||||
if (adapter!!.dataSet.isEmpty()) {
|
||||
presenter.subscribe()
|
||||
}
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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.retromusic.fragments.mainactivity
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.adapter.GenreAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewFragment
|
||||
import code.name.monkey.retromusic.model.Genre
|
||||
import code.name.monkey.retromusic.mvp.contract.GenreContract
|
||||
import code.name.monkey.retromusic.mvp.presenter.GenrePresenter
|
||||
|
||||
|
||||
class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearLayoutManager>(), GenreContract.GenreView {
|
||||
override fun loading() {
|
||||
|
||||
}
|
||||
|
||||
override fun showData(list: ArrayList<Genre>) {
|
||||
adapter?.swapDataSet(list)
|
||||
}
|
||||
|
||||
override fun showEmptyView() {
|
||||
|
||||
}
|
||||
|
||||
override fun completed() {
|
||||
|
||||
}
|
||||
|
||||
override fun createLayoutManager(): LinearLayoutManager {
|
||||
return LinearLayoutManager(activity)
|
||||
}
|
||||
|
||||
override fun createAdapter(): GenreAdapter {
|
||||
val dataSet = if (adapter == null) ArrayList() else adapter!!.dataSet
|
||||
return GenreAdapter(libraryFragment.mainActivity, dataSet, R.layout.item_list_no_image)
|
||||
}
|
||||
|
||||
override val emptyMessage: Int
|
||||
get() = R.string.no_genres
|
||||
|
||||
private lateinit var presenter: GenrePresenter
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
presenter = GenrePresenter(this)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (adapter!!.dataSet.isEmpty()) {
|
||||
presenter.subscribe()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
presenter.unsubscribe()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun onMediaStoreChanged() {
|
||||
presenter.loadGenre()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun newInstance(): GenresFragment {
|
||||
return GenresFragment()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package code.name.monkey.retromusic.fragments.mainactivity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -26,10 +25,11 @@ import com.google.android.material.card.MaterialCardView;
|
|||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.common.ATHToolbarActivity;
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.TintHelper;
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
@ -137,6 +137,9 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
case R.id.action_playlist:
|
||||
selectedFragment(PlaylistsFragment.Companion.newInstance());
|
||||
break;
|
||||
case R.id.action_genre:
|
||||
selectedFragment(GenresFragment.Companion.newInstance());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,13 +147,13 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
private void setupToolbar() {
|
||||
int primaryColor = ThemeStore.Companion.primaryColor(getContext());
|
||||
TintHelper.setTintAuto(contentContainer, primaryColor, true);
|
||||
appBarLayout.setBackgroundColor(primaryColor);
|
||||
toolbar.setBackgroundColor(RetroColorUtil.toolbarColor(getMainActivity()));
|
||||
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
|
||||
toolbar.setOnClickListener(v -> {
|
||||
Pair<View, String> pair = new Pair<>(toolbarContainer, getString(R.string.transition_toolbar));
|
||||
NavigationUtil.goToSearch(getMainActivity(), pair);
|
||||
});
|
||||
appBarLayout.setBackgroundColor(primaryColor);
|
||||
appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) ->
|
||||
getMainActivity().setLightStatusbar(!ATHUtil.INSTANCE.isWindowBackgroundDark(getContext())));
|
||||
getMainActivity().setSupportActionBar(toolbar);
|
||||
|
@ -187,12 +190,12 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
if (cab != null && cab.isActive()) {
|
||||
cab.finish();
|
||||
}
|
||||
//noinspection ConstantConditions
|
||||
|
||||
cab = new MaterialCab(getMainActivity(), R.id.cab_stub)
|
||||
.setMenu(menuRes)
|
||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||
.setBackgroundColor(
|
||||
RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.Companion.primaryColor(getActivity())))
|
||||
RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.Companion.primaryColor(Objects.requireNonNull(getActivity()))))
|
||||
.start(callback);
|
||||
return cab;
|
||||
}
|
||||
|
|
|
@ -5,12 +5,11 @@ import android.view.Menu
|
|||
import android.view.MenuInflater
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.adapter.playlist.PlaylistAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewFragment
|
||||
import code.name.monkey.retromusic.model.Playlist
|
||||
import code.name.monkey.retromusic.mvp.contract.PlaylistContract
|
||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistPresenter
|
||||
import code.name.monkey.retromusic.adapter.playlist.PlaylistAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewFragment
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import java.util.*
|
||||
|
||||
|
||||
|
@ -36,16 +35,8 @@ class PlaylistsFragment : AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, L
|
|||
R.layout.item_list, libraryFragment)
|
||||
}
|
||||
|
||||
override fun setMenuVisibility(menuVisible: Boolean) {
|
||||
super.setMenuVisibility(menuVisible)
|
||||
if (menuVisible) {
|
||||
libraryFragment.setTitle(if (PreferenceUtil.getInstance().tabTitles()) R.string.library else R.string.playlists)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
libraryFragment.setTitle(if (PreferenceUtil.getInstance().tabTitles()) R.string.library else R.string.playlists)
|
||||
if (adapter!!.dataSet.isEmpty()) {
|
||||
presenter.subscribe()
|
||||
}
|
||||
|
|
|
@ -2,14 +2,13 @@ package code.name.monkey.retromusic.fragments.mainactivity
|
|||
|
||||
import android.os.Bundle
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.mvp.contract.SongContract
|
||||
import code.name.monkey.retromusic.mvp.presenter.SongPresenter
|
||||
import code.name.monkey.retromusic.adapter.song.ShuffleButtonSongAdapter
|
||||
import code.name.monkey.retromusic.adapter.song.SongAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.mvp.contract.SongContract
|
||||
import code.name.monkey.retromusic.mvp.presenter.SongPresenter
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import java.util.*
|
||||
|
||||
|
@ -81,23 +80,11 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdap
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
libraryFragment.setTitle(if (PreferenceUtil.getInstance().tabTitles()) R.string.library else R.string.songs)
|
||||
if (adapter!!.dataSet.isEmpty()) {
|
||||
presenter.subscribe()
|
||||
}
|
||||
}
|
||||
|
||||
override fun setMenuVisibility(menuVisible: Boolean) {
|
||||
super.setMenuVisibility(menuVisible)
|
||||
if (menuVisible) {
|
||||
libraryFragment.setTitle(
|
||||
if (PreferenceUtil.getInstance().tabTitles())
|
||||
R.string.library
|
||||
else
|
||||
R.string.songs)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
presenter.unsubscribe()
|
||||
super.onDestroy()
|
||||
|
|
|
@ -71,8 +71,9 @@ abstract class AbsSettingsFragment : PreferenceFragmentCompat() {
|
|||
var dialogFragment: DialogFragment? = null// Dialog creation could not be handled here. Try with the super method.
|
||||
// The dialog was created (it was one of our custom Preferences), show the dialog for it
|
||||
when (preference) {
|
||||
is NowPlayingScreenPreference -> dialogFragment = NowPlayingScreenPreferenceDialog.newInstance(preference.key)
|
||||
is AlbumCoverStylePreference -> dialogFragment = AlbumCoverStylePreferenceDialog.newInstance(preference.key)
|
||||
is LibraryPreference -> dialogFragment = LibraryPreferenceDialog.newInstance()
|
||||
is NowPlayingScreenPreference -> dialogFragment = NowPlayingScreenPreferenceDialog.newInstance( )
|
||||
is AlbumCoverStylePreference -> dialogFragment = AlbumCoverStylePreferenceDialog.newInstance()
|
||||
is MaterialListPreference -> {
|
||||
preference.entries
|
||||
dialogFragment = MaterialListPreferenceDialog.newInstance(preference)
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* 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.retromusic.model;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
|
||||
public class CategoryInfo implements Parcelable {
|
||||
public static final Creator<CategoryInfo> CREATOR = new Creator<CategoryInfo>() {
|
||||
public CategoryInfo createFromParcel(Parcel source) {
|
||||
return new CategoryInfo(source);
|
||||
}
|
||||
|
||||
public CategoryInfo[] newArray(int size) {
|
||||
return new CategoryInfo[size];
|
||||
}
|
||||
};
|
||||
public Category category;
|
||||
public boolean visible;
|
||||
|
||||
public CategoryInfo(Category category, boolean visible) {
|
||||
this.category = category;
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
|
||||
private CategoryInfo(Parcel source) {
|
||||
category = (Category) source.readSerializable();
|
||||
visible = source.readInt() == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeSerializable(category);
|
||||
dest.writeInt(visible ? 1 : 0);
|
||||
}
|
||||
|
||||
public enum Category {
|
||||
HOME(R.id.action_home, R.string.home, R.drawable.toggle_home),
|
||||
SONGS(R.id.action_song, R.string.songs, R.drawable.toggle_audiotrack),
|
||||
ALBUMS(R.id.action_album, R.string.albums, R.drawable.toggle_album),
|
||||
ARTISTS(R.id.action_artist, R.string.artists, R.drawable.toggle_artist),
|
||||
PLAYLISTS(R.id.action_playlist, R.string.playlists, R.drawable.toggle_queue_music),
|
||||
GENRES(R.id.action_genre, R.string.genres, R.drawable.toggle_guitar);
|
||||
|
||||
public final int stringRes;
|
||||
public final int id;
|
||||
public final int icon;
|
||||
|
||||
Category(int id, int stringRes, int icon) {
|
||||
this.stringRes = stringRes;
|
||||
this.id = id;
|
||||
this.icon = icon;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,7 +42,6 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
|||
loadTopArtists()
|
||||
loadATopAlbums()
|
||||
loadFavorite()
|
||||
if (PreferenceUtil.getInstance().isGenreShown) loadGenre()
|
||||
}
|
||||
|
||||
override fun subscribe() {
|
||||
|
@ -102,14 +101,4 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
|||
view.showEmptyView()
|
||||
})
|
||||
}
|
||||
|
||||
private fun loadGenre() {
|
||||
disposable += repository.allGenres
|
||||
.subscribe({
|
||||
if (it.isNotEmpty()) hashSet.add(Home(6, R.string.genres, 0, it, GENRES, R.drawable.ic_guitar_acoustic_white_24dp))
|
||||
view.showData(ArrayList(hashSet))
|
||||
}, {
|
||||
view.showEmptyView()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ import code.name.monkey.retromusic.fragments.AlbumCoverStyle
|
|||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||
import com.afollestad.materialdialogs.customview.customView
|
||||
import com.bumptech.glide.Glide
|
||||
|
||||
|
@ -131,14 +130,8 @@ class AlbumCoverStylePreferenceDialog : PreferenceDialogFragmentCompat(), ViewPa
|
|||
companion object {
|
||||
val TAG: String = AlbumCoverStylePreferenceDialog::class.java.simpleName
|
||||
|
||||
private const val EXTRA_KEY = "key"
|
||||
|
||||
fun newInstance(key: String): AlbumCoverStylePreferenceDialog {
|
||||
val args = Bundle()
|
||||
args.putString(EXTRA_KEY, key)
|
||||
val fragment = AlbumCoverStylePreferenceDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
fun newInstance(): AlbumCoverStylePreferenceDialog {
|
||||
return AlbumCoverStylePreferenceDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.util.AttributeSet
|
|||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.preference.DialogPreference
|
||||
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.providers.BlacklistStore
|
||||
|
@ -32,7 +33,7 @@ import com.afollestad.materialdialogs.list.listItems
|
|||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
class BlacklistPreference : DialogPreference {
|
||||
class BlacklistPreference : ATEDialogPreference {
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* 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.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.fragment.app.DialogFragment
|
||||
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.adapter.CategoryInfoAdapter
|
||||
import code.name.monkey.retromusic.model.CategoryInfo
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||
import com.afollestad.materialdialogs.customview.customView
|
||||
import java.util.*
|
||||
|
||||
|
||||
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) {}
|
||||
|
||||
init {
|
||||
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
}
|
||||
|
||||
class LibraryPreferenceDialog : DialogFragment() {
|
||||
lateinit var adapter: CategoryInfoAdapter
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val view = activity!!.layoutInflater.inflate(code.name.monkey.retromusic.R.layout.preference_dialog_library_categories, null)
|
||||
|
||||
val categoryInfos: List<CategoryInfo>
|
||||
if (savedInstanceState != null) {
|
||||
categoryInfos = savedInstanceState.getParcelableArrayList(PreferenceUtil.LIBRARY_CATEGORIES)
|
||||
} else {
|
||||
categoryInfos = PreferenceUtil.getInstance().getLibraryCategoryInfos()
|
||||
}
|
||||
adapter = CategoryInfoAdapter(categoryInfos)
|
||||
|
||||
val recyclerView = view.findViewById<RecyclerView>(code.name.monkey.retromusic.R.id.recycler_view)
|
||||
recyclerView.layoutManager = LinearLayoutManager(activity)
|
||||
recyclerView.adapter = adapter
|
||||
|
||||
adapter.attachToRecyclerView(recyclerView)
|
||||
|
||||
|
||||
return MaterialDialog(context!!, BottomSheet())
|
||||
.title(code.name.monkey.retromusic.R.string.library_categories)
|
||||
.customView(view = view)
|
||||
.positiveButton(android.R.string.ok) {
|
||||
updateCategories(adapter.categoryInfos)
|
||||
dismiss()
|
||||
}
|
||||
.negativeButton(android.R.string.cancel) {
|
||||
dismiss()
|
||||
}
|
||||
.neutralButton(code.name.monkey.retromusic.R.string.reset_action) {
|
||||
adapter.categoryInfos = PreferenceUtil.getInstance().defaultLibraryCategoryInfos
|
||||
}
|
||||
.noAutoDismiss()
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
outState.putParcelableArrayList(PreferenceUtil.LIBRARY_CATEGORIES, ArrayList(adapter.categoryInfos))
|
||||
}
|
||||
|
||||
private fun updateCategories(categories: List<CategoryInfo>) {
|
||||
if (getSelected(categories) == 0) return
|
||||
if (getSelected(categories) > 5) {
|
||||
Toast.makeText(context, "Not more than 5 items", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
PreferenceUtil.getInstance().libraryCategoryInfos = categories
|
||||
}
|
||||
|
||||
private fun getSelected(categories: List<CategoryInfo>): Int {
|
||||
var selected = 0
|
||||
for (categoryInfo in categories) {
|
||||
if (categoryInfo.visible)
|
||||
selected++
|
||||
}
|
||||
return selected
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun newInstance(): LibraryPreferenceDialog {
|
||||
return LibraryPreferenceDialog()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -124,14 +124,10 @@ class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewP
|
|||
}
|
||||
|
||||
companion object {
|
||||
private const val EXTRA_KEY = "key"
|
||||
|
||||
fun newInstance(key: String): NowPlayingScreenPreferenceDialog {
|
||||
val args = Bundle()
|
||||
args.putString(EXTRA_KEY, key)
|
||||
val fragment = NowPlayingScreenPreferenceDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
|
||||
fun newInstance(): NowPlayingScreenPreferenceDialog {
|
||||
return NowPlayingScreenPreferenceDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ class CustomArtistImageUtil private constructor(context: Context) {
|
|||
@SuppressLint("ApplySharedPref")
|
||||
override fun doInBackground(vararg params: Void): Void? {
|
||||
val dir = File(App.context.filesDir, FOLDER_NAME)
|
||||
println(dir.absolutePath)
|
||||
if (!dir.exists()) {
|
||||
if (!dir.mkdirs()) { // create the folder
|
||||
return null
|
||||
|
|
|
@ -27,8 +27,14 @@ import androidx.annotation.StyleRes;
|
|||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import code.name.monkey.retromusic.App;
|
||||
|
@ -38,6 +44,7 @@ import code.name.monkey.retromusic.fragments.AlbumCoverStyle;
|
|||
import code.name.monkey.retromusic.fragments.NowPlayingScreen;
|
||||
import code.name.monkey.retromusic.fragments.mainactivity.folders.FoldersFragment;
|
||||
import code.name.monkey.retromusic.helper.SortOrder;
|
||||
import code.name.monkey.retromusic.model.CategoryInfo;
|
||||
import code.name.monkey.retromusic.transform.CascadingPageTransformer;
|
||||
import code.name.monkey.retromusic.transform.DepthTransformation;
|
||||
import code.name.monkey.retromusic.transform.HingeTransformation;
|
||||
|
@ -47,7 +54,7 @@ import code.name.monkey.retromusic.transform.VerticalFlipTransformation;
|
|||
import code.name.monkey.retromusic.transform.VerticalStackTransformer;
|
||||
|
||||
public final class PreferenceUtil {
|
||||
|
||||
public static final String LIBRARY_CATEGORIES = "library_categories";
|
||||
public static final String KEEP_SCREEN_ON = "keep_screen_on";
|
||||
public static final String TOGGLE_HOME_BANNER = "toggle_home_banner";
|
||||
public static final String NOW_PLAYING_SCREEN_ID = "now_playing_screen_id";
|
||||
|
@ -812,4 +819,44 @@ public final class PreferenceUtil {
|
|||
public boolean isClickOrSave() {
|
||||
return mPreferences.getBoolean(NOW_PLAYING_SCREEN, false);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public List<CategoryInfo> getLibraryCategoryInfos() {
|
||||
String data = mPreferences.getString(LIBRARY_CATEGORIES, null);
|
||||
if (data != null) {
|
||||
Gson gson = new Gson();
|
||||
Type collectionType = new TypeToken<List<CategoryInfo>>() {
|
||||
}.getType();
|
||||
|
||||
try {
|
||||
return gson.fromJson(data, collectionType);
|
||||
} catch (JsonSyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return getDefaultLibraryCategoryInfos();
|
||||
}
|
||||
|
||||
public void setLibraryCategoryInfos(List<CategoryInfo> categories) {
|
||||
Gson gson = new Gson();
|
||||
Type collectionType = new TypeToken<List<CategoryInfo>>() {
|
||||
}.getType();
|
||||
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putString(LIBRARY_CATEGORIES, gson.toJson(categories, collectionType));
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public List<CategoryInfo> getDefaultLibraryCategoryInfos() {
|
||||
List<CategoryInfo> defaultCategoryInfos = new ArrayList<>(6);
|
||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.HOME, true));
|
||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.SONGS, true));
|
||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.ALBUMS, true));
|
||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.ARTISTS, true));
|
||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.PLAYLISTS, true));
|
||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.GENRES, false));
|
||||
return defaultCategoryInfos;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,6 +195,13 @@ public class RetroColorUtil {
|
|||
return backgroundColor;
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
public static int shiftBackgroundColorForDarkText(@ColorInt int backgroundColor) {
|
||||
while (!ColorUtil.INSTANCE.isColorLight(backgroundColor)) {
|
||||
backgroundColor = ColorUtil.INSTANCE.lightenColor(backgroundColor);
|
||||
}
|
||||
return backgroundColor;
|
||||
}
|
||||
|
||||
private static class SwatchComparator implements Comparator<Palette.Swatch> {
|
||||
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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.retromusic.util;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
|
||||
public class SwipeAndDragHelper extends ItemTouchHelper.Callback {
|
||||
|
||||
private ActionCompletionContract contract;
|
||||
|
||||
public SwipeAndDragHelper(ActionCompletionContract contract) {
|
||||
this.contract = contract;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN;
|
||||
return makeMovementFlags(dragFlags, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
|
||||
contract.onViewMoved(viewHolder.getAdapterPosition(), target.getAdapterPosition());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLongPressDragEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChildDraw(Canvas c,
|
||||
RecyclerView recyclerView,
|
||||
RecyclerView.ViewHolder viewHolder,
|
||||
float dX,
|
||||
float dY,
|
||||
int actionState,
|
||||
boolean isCurrentlyActive) {
|
||||
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
|
||||
float alpha = 1 - (Math.abs(dX) / recyclerView.getWidth());
|
||||
viewHolder.itemView.setAlpha(alpha);
|
||||
}
|
||||
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
|
||||
}
|
||||
|
||||
public interface ActionCompletionContract {
|
||||
void onViewMoved(int oldPosition, int newPosition);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,17 @@
|
|||
<!-- drawable/guitar_acoustic.xml -->
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
android:viewportWidth="511.999"
|
||||
android:viewportHeight="511.999">
|
||||
|
||||
<path
|
||||
android:fillColor="@color/md_white_1000"
|
||||
android:pathData="M19.59,3H22V5H20.41L16.17,9.24C15.8,8.68 15.32,8.2 14.76,7.83L19.59,3M12,8A4,4 0 0,1 16,12C16,13.82 14.77,15.42 13,15.87V16A5,5 0 0,1 8,21A5,5 0 0,1 3,16A5,5 0 0,1 8,11H8.13C8.58,9.24 10.17,8 12,8M12,10.5A1.5,1.5 0 0,0 10.5,12A1.5,1.5 0 0,0 12,13.5A1.5,1.5 0 0,0 13.5,12A1.5,1.5 0 0,0 12,10.5M6.94,14.24L6.23,14.94L9.06,17.77L9.77,17.06L6.94,14.24Z" />
|
||||
android:pathData="M276.503 421.573c5.687-26.889 21.401-49.915 44.245-64.834 19.137-12.495 30.74-29.04 33.555-47.846 3.149-21.04-4.592-44.418-23.022-69.629l64.952-64.949-58.682-58.682-65.311 65.315c-24.124-16.967-46.712-24.068-67.286-21.117-18.947 2.72-35.843 14.104-48.864 32.926-15.481 22.39-38.441 37.471-64.657 42.467-25.764 4.921-43.684 12.515-54.784 23.212-23.097 22.258-36.062 54.037-36.506 89.484-0.53 42.25 16.932 85.486 46.71 115.656 29.794 30.185 72.705 48.286 114.787 48.421 0.162 0.001 0.318 0 0.48 0 35.187-0.001 67.001-12.443 89.616-35.062 11.137-11.137 19.239-29.245 24.767-55.362zm-127.857 1.924c-3.839 0-7.678-1.464-10.607-4.393l-45.276-45.276c-5.858-5.858-5.858-15.355 0-21.213 5.857-5.858 15.355-5.858 21.213 0l45.276 45.276c5.858 5.858 5.858 15.355 0 21.213-2.929 2.929-6.768 4.393-10.606 4.393zm64.261-74.466c-12.827 0-25.653-4.88-35.422-14.641-19.529-19.544-19.527-51.322-0.004-70.847 8.539-8.539 19.875-13.705 31.921-14.547 14.474-1.02 28.658 4.281 38.923 14.547 10.266 10.265 15.567 24.455 14.546 38.932-0.834 12.032-5.999 23.364-14.547 31.911-9.762 9.763-22.59 14.645-35.417 14.645z" />
|
||||
<path
|
||||
android:fillColor="@color/md_white_1000"
|
||||
android:pathData="M359.067 40.306c-5.858 5.858-5.858 15.355 0 21.213l15.16 15.16-15.485 17.719 58.728 58.728 17.719-15.485 15.159 15.159c2.929 2.929 6.768 4.394 10.607 4.393 3.839 0 7.678-1.464 10.606-4.393 5.858-5.858 5.858-15.355 0-21.213l-13.732-13.732 11.057-9.663 13.036 13.036c2.929 2.929 6.768 4.394 10.607 4.393 3.839 0 7.678-1.464 10.606-4.393 5.858-5.858 5.858-15.355 0-21.213l-11.609-11.609 15.213-13.295c3.127-2.733 4.981-6.64 5.121-10.79 0.139 -4.151-1.448-8.174-4.385-11.11l-48.818-48.818c-2.936-2.937-6.943-4.52-11.11-4.385-4.15 0.14 -8.057 1.994-10.79 5.121l-13.295 15.213-11.609-11.609c-5.858-5.858-15.356-5.858-21.213 0-5.858 5.858-5.858 15.355 0 21.213l13.036 13.036-9.663 11.057-13.733-13.733c-5.858-5.859-15.356-5.859-21.213 0z" />
|
||||
<path
|
||||
android:fillColor="@color/md_white_1000"
|
||||
android:pathData="M232.945 300.364c0.332-4.714-1.009-9.354-3.732-13.136-0.628-0.873-1.33-1.7-2.102-2.472-3.781-3.782-8.89-5.884-14.193-5.884-0.47 0-0.941 0.017 -1.414 0.05 -4.84 0.338 -9.386 2.41-12.81 5.833-7.831 7.832-7.829 20.582 0.004 28.421 7.832 7.826 20.581 7.828 28.413-0.004 3.431-3.43 5.502-7.969 5.832-12.782 0.001 -0.008 0.002 -0.017 0.002 -0.026z" />
|
||||
</vector>
|
14
app/src/main/res/drawable/ic_guitar_white_24dp.xml
Normal file
14
app/src/main/res/drawable/ic_guitar_white_24dp.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="512"
|
||||
android:viewportHeight="512">
|
||||
|
||||
<path
|
||||
android:fillColor="@color/md_white_1000"
|
||||
android:pathData="M511.861 64.321c0.139-4.151-1.448-8.174-4.385-11.11l-48.817-48.818c-2.936-2.937-6.943-4.521-11.11-4.385-4.15 0.14 -8.058 1.994-10.791 5.121l-13.295 15.213-11.608-11.609c-5.857-5.858-15.355-5.858-21.213 0s-5.858 15.355 0 21.213l13.036 13.036-9.663 11.057-13.733-13.733c-5.857-5.858-15.355-5.858-21.213 0s-5.858 15.355 0 21.213l15.16 15.16-102.024 104.305c-22.898-16.082-44.302-23.315-63.925-21.541-20.337 1.838-38.384 13.358-52.188 33.316-15.486 22.389-38.447 37.472-64.653 42.47-25.751 4.912-43.671 12.503-54.782 23.208-23.1 22.254-36.067 54.03-36.514 89.476-0.533 42.25 16.928 85.488 46.708 115.66 29.792 30.185 72.7 48.289 114.779 48.426 0.165 0 0.327 0.001 0.49 0.001 35.188 0 66.999-12.441 89.618-35.06 11.143-11.143 19.245-29.252 24.77-55.363 5.69-26.892 21.404-49.917 44.248-64.835 20.106-13.129 31.83-30.629 33.904-50.607 2.139-20.603-5.537-42.685-23.346-66.899l103.876-101.595 15.16 15.159c2.929 2.929 6.768 4.394 10.606 4.394s7.678-1.464 10.606-4.394c5.858-5.858 5.858-15.355 0-21.213l-13.732-13.732 11.057-9.663 13.036 13.036c2.929 2.929 6.768 4.394 10.606 4.394s7.678-1.464 10.606-4.394c5.858-5.858 5.858-15.355 0-21.213l-11.609-11.609 15.213-13.295c3.128-2.733 4.982-6.64 5.122-10.79zm-187.042 238.716c-1.125 10.834-8.011 20.452-20.468 28.587-29.538 19.289-49.85 49.029-57.195 83.743-5.54 26.185-12.798 36.526-16.632 40.359-17.032 17.032-41.486 26.318-68.797 26.273-34.262-0.113-69.225-14.879-93.526-39.5-24.267-24.587-38.495-59.805-38.062-94.209 0.345 -27.364 10.051-51.602 27.331-68.249 3.767-3.629 13.918-10.448 39.588-15.344 33.986-6.481 63.713-25.969 83.705-54.872 8.701-12.58 18.868-19.479 30.216-20.504 1.046-0.094 2.111-0.142 3.193-0.142 10.609 0 22.904 4.54 36.463 13.373l-47.245 47.245c-9.497 1.824-18.565 6.404-25.904 13.742-19.531 19.531-19.531 51.311 0 70.841 9.766 9.766 22.593 14.648 35.421 14.648s25.655-4.883 35.421-14.648c7.338-7.339 11.918-16.406 13.742-25.904l47.701-47.701c11.128 16.162 16.272 30.472 15.048 42.262zm-97.704-18.283c7.834 7.834 7.834 20.582 0 28.416-7.835 7.834-20.581 7.834-28.416 0-7.834-7.834-7.834-20.581 0-28.416 3.918-3.917 9.062-5.875 14.208-5.875 5.145-0.001 10.291 1.958 14.208 5.875zm28.388-12.135c-1.996-3.227-4.378-6.282-7.175-9.078-2.797-2.797-5.851-5.179-9.079-7.175l130.124-130.124 16.254 16.254zm152.027-150.647-17.633-17.633 58.893-67.389 26.129 26.129z" />
|
||||
<path
|
||||
android:fillColor="@color/md_white_1000"
|
||||
android:pathData="M113.978 352.615c-5.857-5.858-15.355-5.858-21.213 0s-5.858 15.355 0 21.213l45.276 45.276c2.929 2.929 6.768 4.394 10.606 4.394s7.678-1.464 10.606-4.394c5.858-5.858 5.858-15.355 0-21.213z" />
|
||||
</vector>
|
|
@ -1,4 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_album_selected_white_24dp" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/ic_album_white_24dp" />
|
||||
|
|
|
@ -1,4 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_artist_selected_white_24dp" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/ic_artist_white_24dp" />
|
||||
|
|
|
@ -1,4 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_audiotrack_selected_black_24dp" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/ic_audiotrack_black_24dp" />
|
||||
|
|
17
app/src/main/res/drawable/toggle_guitar.xml
Normal file
17
app/src/main/res/drawable/toggle_guitar.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ 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.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_guitar_acoustic_white_24dp" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/ic_guitar_white_24dp" />
|
||||
</selector>
|
|
@ -1,4 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_home_selected_white_24dp" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/ic_home_white_24dp" />
|
||||
|
|
|
@ -1,4 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_queue_music_selected_white_24dp" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/ic_queue_music_white_24dp" />
|
||||
|
|
|
@ -50,12 +50,13 @@
|
|||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:titleMarginStart="0dp"
|
||||
app:title="@string/library"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/cab_stub"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="48dp" />
|
||||
</FrameLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
|
51
app/src/main/res/layout/item_list_no_image.xml
Normal file
51
app/src/main/res/layout/item_list_no_image.xml
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
android:foreground="?attr/rectSelector"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:textColor="?android:textColorSecondary" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:focusable="true"
|
||||
android:foreground="?attr/rectSelector"
|
||||
android:minHeight="@dimen/md_listitem_height"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingRight="16dp"
|
||||
tools:gravity="start|center_vertical">
|
||||
|
||||
<code.name.monkey.appthemehelper.common.views.ATECheckBox
|
||||
android:id="@+id/checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/md_listitem_height"
|
||||
android:paddingStart="@dimen/md_listitem_control_margin"
|
||||
android:paddingLeft="@dimen/md_listitem_control_margin"
|
||||
android:paddingTop="@dimen/md_listitem_vertical_margin_choice"
|
||||
android:paddingBottom="@dimen/md_listitem_vertical_margin_choice"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/md_listitem_textsize"
|
||||
tools:text="Item" />
|
||||
|
||||
<code.name.monkey.retromusic.views.IconImageView
|
||||
android:id="@+id/drag_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:minHeight="@dimen/md_listitem_height"
|
||||
android:tint="?attr/iconColor"
|
||||
android:tintMode="src_in"
|
||||
app:srcCompat="@drawable/ic_drag_vertical_white_24dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</LinearLayout>
|
|
@ -2,8 +2,7 @@
|
|||
<resources>
|
||||
<item name="action_new_playlist" type="id" />
|
||||
<item name="action_show_lyrics" type="id" />
|
||||
|
||||
|
||||
<item name="action_genre" type="id" />
|
||||
<item name="action_album_sort_order_asc" type="id" />
|
||||
<item name="action_album_sort_order_desc" type="id" />
|
||||
<item name="action_album_sort_order_artist" type="id" />
|
||||
|
@ -17,7 +16,6 @@
|
|||
<item name="action_song_sort_order_year" type="id" />
|
||||
<item name="action_song_sort_order_date" type="id" />
|
||||
<item name="action_song_sort_order_composer" type="id" />
|
||||
|
||||
<item name="action_multi_select_adapter_check_all" type="id" />
|
||||
<item name="action_folder" type="id" />
|
||||
</resources>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<resources>
|
||||
<string name="you_have_to_select_at_least_one_category">You have to select at least one category.</string>
|
||||
<string name="small">Small album</string>
|
||||
<string name="accent_color">Accent color</string>
|
||||
<string name="accent_color_desc">The theme accent color, defaults to teal</string>
|
||||
|
@ -601,6 +602,7 @@
|
|||
<string name="pick_image_intent_text">Pick image</string>
|
||||
<string name="set_photo">Set a profile photo</string>
|
||||
<string name="edit">Edit</string>
|
||||
<string name="pref_header_library">Library</string>
|
||||
<string name="swipe_to_unlock">Swipe to unlock</string>
|
||||
<string name="add_lyrics">Add lyrics</string>
|
||||
<string name="paste_lyrics_here">Paste lyrics here</string>
|
||||
|
@ -625,4 +627,7 @@
|
|||
<string name="action_play_all">Play all</string>
|
||||
<string name="start_play_music">Start playing music.</string>
|
||||
<string name="keyboard">Keyboard</string>
|
||||
<string name="reset_action">Reset</string>
|
||||
<string name="library_categories">Library categories</string>
|
||||
<string name="pref_summary_library_categories">Configure visibility and order of library categories.</string>
|
||||
</resources>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
<style name="Toolbar">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">50dp</item>
|
||||
<item name="android:layout_height">48dp</item>
|
||||
<item name="popupTheme">?toolbarPopupTheme</item>
|
||||
<item name="android:transitionName" tools:ignore="NewApi">toolbar</item>
|
||||
<item name="android:titleTextAppearance">@style/ToolbarTextAppearance</item>
|
||||
|
|
|
@ -37,28 +37,32 @@
|
|||
app:enableCopying="true"
|
||||
app:icon="@drawable/ic_home_white_24dp" />
|
||||
|
||||
<code.name.monkey.retromusic.preferences.MaterialListPreference
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/pref_tab_text_mode_titles"
|
||||
android:entryValues="@array/pref_tab_text_mode_values"
|
||||
android:key="tab_text_mode"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="@string/pref_title_tab_text_mode"
|
||||
app:enableCopying="true" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="toggle_home_banner"
|
||||
android:summary="@string/pref_summary_home_banner"
|
||||
android:title="@string/pref_title_home_banner" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="toggle_genre"
|
||||
android:summary="@string/pref_summary_genre_toggle"
|
||||
android:title="@string/pref_title_genre_toggle"
|
||||
app:enableCopying="true"
|
||||
app:icon="@drawable/ic_guitar_acoustic_white_24dp" />
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory android:title="@string/pref_header_library">
|
||||
|
||||
<code.name.monkey.retromusic.preferences.LibraryPreference
|
||||
android:key="library_categories"
|
||||
android:summary="@string/pref_summary_library_categories"
|
||||
android:title="@string/library_categories"
|
||||
app:enableCopying="true"
|
||||
app:icon="@drawable/ic_library_music_white_24dp" />
|
||||
|
||||
<code.name.monkey.retromusic.preferences.MaterialListPreference
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/pref_tab_text_mode_titles"
|
||||
android:entryValues="@array/pref_tab_text_mode_values"
|
||||
android:key="tab_text_mode"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="@string/pref_title_tab_text_mode"
|
||||
app:enableCopying="true" />
|
||||
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
||||
|
||||
|
||||
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
||||
</androidx.preference.PreferenceScreen>
|
Loading…
Reference in a new issue