I belived fixed android Navigation
This commit is contained in:
parent
a8933cf079
commit
608330f0da
14 changed files with 639 additions and 203 deletions
|
@ -8,11 +8,13 @@ import android.os.Bundle
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.navigation.ui.NavigationUI
|
||||||
import code.name.monkey.retromusic.*
|
import code.name.monkey.retromusic.*
|
||||||
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
||||||
import code.name.monkey.retromusic.extensions.findNavController
|
import code.name.monkey.retromusic.extensions.findNavController
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.SearchQueryHelper.getSongs
|
import code.name.monkey.retromusic.helper.SearchQueryHelper.getSongs
|
||||||
|
import code.name.monkey.retromusic.model.CategoryInfo
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.repository.PlaylistSongsLoader
|
import code.name.monkey.retromusic.repository.PlaylistSongsLoader
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
|
@ -45,6 +47,25 @@ class MainActivity : AbsSlidingMusicPanelActivity(), OnSharedPreferenceChangeLis
|
||||||
hideStatusBar()
|
hideStatusBar()
|
||||||
AppRater.appLaunched(this)
|
AppRater.appLaunched(this)
|
||||||
updateTabs()
|
updateTabs()
|
||||||
|
|
||||||
|
//NavigationUI.setupWithNavController(getBottomNavigationView(), findNavController(R.id.fragment_container))
|
||||||
|
setupNavigationController()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupNavigationController() {
|
||||||
|
val navController = findNavController(R.id.fragment_container)
|
||||||
|
val navInflater = navController.navInflater
|
||||||
|
val navGraph = navInflater.inflate(R.navigation.main_graph)
|
||||||
|
|
||||||
|
val categoryInfo: CategoryInfo = PreferenceUtil.libraryCategory.first { it.visible }
|
||||||
|
if (categoryInfo.visible) {
|
||||||
|
navGraph.startDestination = categoryInfo.category.id
|
||||||
|
}
|
||||||
|
navController.graph = navGraph
|
||||||
|
NavigationUI.setupWithNavController(getBottomNavigationView(), navController)
|
||||||
|
navController.addOnDestinationChangedListener { _, _, _ ->
|
||||||
|
//appBarLayout.setExpanded(true, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSupportNavigateUp(): Boolean =
|
override fun onSupportNavigateUp(): Boolean =
|
||||||
|
|
|
@ -16,7 +16,6 @@ import code.name.monkey.retromusic.helper.SortOrder
|
||||||
import code.name.monkey.retromusic.helper.SortOrder.AlbumSortOrder
|
import code.name.monkey.retromusic.helper.SortOrder.AlbumSortOrder
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
import code.name.monkey.retromusic.util.RetroUtil
|
||||||
import com.google.android.material.transition.platform.MaterialFadeThrough
|
|
||||||
|
|
||||||
|
|
||||||
class AlbumsFragment : AbsRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager>(),
|
class AlbumsFragment : AbsRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager>(),
|
||||||
|
@ -110,6 +109,7 @@ class AlbumsFragment : AbsRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridL
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||||
|
super.onCreateOptionsMenu(menu, inflater)
|
||||||
val gridSizeItem: MenuItem = menu.findItem(R.id.action_grid_size)
|
val gridSizeItem: MenuItem = menu.findItem(R.id.action_grid_size)
|
||||||
if (RetroUtil.isLandscape()) {
|
if (RetroUtil.isLandscape()) {
|
||||||
gridSizeItem.setTitle(R.string.action_grid_size_land)
|
gridSizeItem.setTitle(R.string.action_grid_size_land)
|
||||||
|
@ -118,7 +118,6 @@ class AlbumsFragment : AbsRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridL
|
||||||
val layoutItem = menu.findItem(R.id.action_layout_type)
|
val layoutItem = menu.findItem(R.id.action_layout_type)
|
||||||
setupLayoutMenu(layoutItem.subMenu)
|
setupLayoutMenu(layoutItem.subMenu)
|
||||||
setUpSortOrderMenu(menu.findItem(R.id.action_sort_order).subMenu)
|
setUpSortOrderMenu(menu.findItem(R.id.action_sort_order).subMenu)
|
||||||
super.onCreateOptionsMenu(menu, inflater)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpSortOrderMenu(
|
private fun setUpSortOrderMenu(
|
||||||
|
|
|
@ -15,7 +15,6 @@ import code.name.monkey.retromusic.fragments.base.AbsRecyclerViewCustomGridSizeF
|
||||||
import code.name.monkey.retromusic.helper.SortOrder.ArtistSortOrder
|
import code.name.monkey.retromusic.helper.SortOrder.ArtistSortOrder
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
import code.name.monkey.retromusic.util.RetroUtil
|
||||||
import com.google.android.material.transition.platform.MaterialFadeThrough
|
|
||||||
|
|
||||||
|
|
||||||
class ArtistsFragment : AbsRecyclerViewCustomGridSizeFragment<ArtistAdapter, GridLayoutManager>(),
|
class ArtistsFragment : AbsRecyclerViewCustomGridSizeFragment<ArtistAdapter, GridLayoutManager>(),
|
||||||
|
@ -102,6 +101,7 @@ class ArtistsFragment : AbsRecyclerViewCustomGridSizeFragment<ArtistAdapter, Gri
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||||
|
super.onCreateOptionsMenu(menu, inflater)
|
||||||
val gridSizeItem: MenuItem = menu.findItem(R.id.action_grid_size)
|
val gridSizeItem: MenuItem = menu.findItem(R.id.action_grid_size)
|
||||||
if (RetroUtil.isLandscape()) {
|
if (RetroUtil.isLandscape()) {
|
||||||
gridSizeItem.setTitle(R.string.action_grid_size_land)
|
gridSizeItem.setTitle(R.string.action_grid_size_land)
|
||||||
|
@ -110,7 +110,7 @@ class ArtistsFragment : AbsRecyclerViewCustomGridSizeFragment<ArtistAdapter, Gri
|
||||||
val layoutItem = menu.findItem(R.id.action_layout_type)
|
val layoutItem = menu.findItem(R.id.action_layout_type)
|
||||||
setupLayoutMenu(layoutItem.subMenu)
|
setupLayoutMenu(layoutItem.subMenu)
|
||||||
setUpSortOrderMenu(menu.findItem(R.id.action_sort_order).subMenu)
|
setUpSortOrderMenu(menu.findItem(R.id.action_sort_order).subMenu)
|
||||||
super.onCreateOptionsMenu(menu, inflater)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpSortOrderMenu(
|
private fun setUpSortOrderMenu(
|
||||||
|
|
|
@ -1,26 +1,33 @@
|
||||||
package code.name.monkey.retromusic.fragments.base
|
package code.name.monkey.retromusic.fragments.base
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.*
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.annotation.NonNull
|
import androidx.annotation.NonNull
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
|
import androidx.core.text.HtmlCompat
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
|
import code.name.monkey.appthemehelper.common.ATHToolbarActivity
|
||||||
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
|
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog
|
||||||
|
import code.name.monkey.retromusic.dialogs.ImportPlaylistDialog
|
||||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
|
import code.name.monkey.retromusic.state.NowPlayingPanelState
|
||||||
import code.name.monkey.retromusic.util.DensityUtil
|
import code.name.monkey.retromusic.util.DensityUtil
|
||||||
import code.name.monkey.retromusic.util.ThemedFastScroller.create
|
import code.name.monkey.retromusic.util.ThemedFastScroller.create
|
||||||
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener
|
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener
|
||||||
import com.google.android.material.appbar.AppBarLayout
|
import com.google.android.material.appbar.AppBarLayout
|
||||||
import kotlinx.android.synthetic.main.fragment_main_activity_recycler_view.*
|
import kotlinx.android.synthetic.main.fragment_main_recycler.*
|
||||||
import me.zhanghai.android.fastscroll.FastScroller
|
import me.zhanghai.android.fastscroll.FastScroller
|
||||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||||
|
|
||||||
|
|
||||||
abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> :
|
abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> :
|
||||||
AbsMusicServiceFragment(R.layout.fragment_main_activity_recycler_view),
|
AbsMainActivityFragment(R.layout.fragment_main_recycler),
|
||||||
AppBarLayout.OnOffsetChangedListener {
|
AppBarLayout.OnOffsetChangedListener {
|
||||||
|
|
||||||
val libraryViewModel: LibraryViewModel by sharedViewModel()
|
val libraryViewModel: LibraryViewModel by sharedViewModel()
|
||||||
|
@ -36,9 +43,30 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
libraryViewModel.setPanelState(NowPlayingPanelState.COLLAPSED_WITH)
|
||||||
|
mainActivity.setSupportActionBar(toolbar)
|
||||||
|
mainActivity.supportActionBar?.title = null
|
||||||
initLayoutManager()
|
initLayoutManager()
|
||||||
initAdapter()
|
initAdapter()
|
||||||
setUpRecyclerView()
|
setUpRecyclerView()
|
||||||
|
setupTitle()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupTitle() {
|
||||||
|
toolbar.setNavigationOnClickListener {
|
||||||
|
findNavController().navigate(
|
||||||
|
R.id.searchFragment,
|
||||||
|
null,
|
||||||
|
navOptions
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val color = ThemeStore.accentColor(requireContext())
|
||||||
|
val hexColor = String.format("#%06X", 0xFFFFFF and color)
|
||||||
|
val appName = HtmlCompat.fromHtml(
|
||||||
|
"Retro <span style='color:$hexColor';>Music</span>",
|
||||||
|
HtmlCompat.FROM_HTML_MODE_COMPACT
|
||||||
|
)
|
||||||
|
appNameText.text = appName
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpRecyclerView() {
|
private fun setUpRecyclerView() {
|
||||||
|
@ -138,4 +166,39 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
|
||||||
fun recyclerView(): RecyclerView {
|
fun recyclerView(): RecyclerView {
|
||||||
return recyclerView
|
return recyclerView
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||||
|
super.onPrepareOptionsMenu(menu)
|
||||||
|
ToolbarContentTintHelper.handleOnPrepareOptionsMenu(requireActivity(), toolbar)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||||
|
super.onCreateOptionsMenu(menu, inflater)
|
||||||
|
inflater.inflate(R.menu.menu_main, menu)
|
||||||
|
ToolbarContentTintHelper.handleOnCreateOptionsMenu(
|
||||||
|
requireContext(),
|
||||||
|
toolbar,
|
||||||
|
menu,
|
||||||
|
ATHToolbarActivity.getToolbarBackgroundColor(toolbar)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
|
when (item.itemId) {
|
||||||
|
R.id.action_settings -> findNavController().navigate(
|
||||||
|
R.id.settingsActivity,
|
||||||
|
null,
|
||||||
|
navOptions
|
||||||
|
)
|
||||||
|
R.id.action_import_playlist -> ImportPlaylistDialog().show(
|
||||||
|
childFragmentManager,
|
||||||
|
"ImportPlaylist"
|
||||||
|
)
|
||||||
|
R.id.action_add_to_playlist -> CreatePlaylistDialog.create(emptyList()).show(
|
||||||
|
childFragmentManager,
|
||||||
|
"ShowCreatePlaylistDialog"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -20,6 +20,7 @@ import android.media.MediaScannerConnection;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
|
import android.text.Spanned;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
|
@ -34,8 +35,11 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.core.text.HtmlCompat;
|
||||||
import androidx.loader.app.LoaderManager;
|
import androidx.loader.app.LoaderManager;
|
||||||
import androidx.loader.content.Loader;
|
import androidx.loader.content.Loader;
|
||||||
|
import androidx.navigation.Navigation;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
@ -57,6 +61,7 @@ import java.util.List;
|
||||||
|
|
||||||
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.ATHUtil;
|
||||||
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
import code.name.monkey.retromusic.adapter.SongFileAdapter;
|
import code.name.monkey.retromusic.adapter.SongFileAdapter;
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment;
|
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment;
|
||||||
|
@ -79,6 +84,8 @@ import code.name.monkey.retromusic.views.BreadCrumbLayout;
|
||||||
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener;
|
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener;
|
||||||
import me.zhanghai.android.fastscroll.FastScroller;
|
import me.zhanghai.android.fastscroll.FastScroller;
|
||||||
|
|
||||||
|
import static code.name.monkey.appthemehelper.common.ATHToolbarActivity.getToolbarBackgroundColor;
|
||||||
|
|
||||||
public class FoldersFragment extends AbsMainActivityFragment implements
|
public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
IMainActivityFragmentCallbacks,
|
IMainActivityFragmentCallbacks,
|
||||||
ICabHolder,
|
ICabHolder,
|
||||||
|
@ -95,6 +102,8 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
private static final String CRUMBS = "crumbs";
|
private static final String CRUMBS = "crumbs";
|
||||||
private static final int LOADER_ID = 5;
|
private static final int LOADER_ID = 5;
|
||||||
private SongFileAdapter adapter;
|
private SongFileAdapter adapter;
|
||||||
|
private Toolbar toolbar;
|
||||||
|
private TextView appNameText;
|
||||||
private BreadCrumbLayout breadCrumbs;
|
private BreadCrumbLayout breadCrumbs;
|
||||||
private MaterialCab cab;
|
private MaterialCab cab;
|
||||||
private View coordinatorLayout;
|
private View coordinatorLayout;
|
||||||
|
@ -154,11 +163,27 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
getMainActivity().setSupportActionBar(toolbar);
|
||||||
|
getMainActivity().getSupportActionBar().setTitle(null);
|
||||||
setStatusBarColorAuto(view);
|
setStatusBarColorAuto(view);
|
||||||
setUpAppbarColor();
|
setUpAppbarColor();
|
||||||
setUpBreadCrumbs();
|
setUpBreadCrumbs();
|
||||||
setUpRecyclerView();
|
setUpRecyclerView();
|
||||||
setUpAdapter();
|
setUpAdapter();
|
||||||
|
setUpTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUpTitle() {
|
||||||
|
toolbar.setNavigationOnClickListener(v ->
|
||||||
|
Navigation.findNavController(v).navigate(R.id.searchFragment, null, getNavOptions())
|
||||||
|
);
|
||||||
|
int color = ThemeStore.Companion.accentColor(requireContext());
|
||||||
|
String hexColor = String.format("#%06X", 0xFFFFFF & color);
|
||||||
|
Spanned appName = HtmlCompat.fromHtml(
|
||||||
|
"Retro <span style='color:" + hexColor + ";'>Music</span>",
|
||||||
|
HtmlCompat.FROM_HTML_MODE_COMPACT
|
||||||
|
);
|
||||||
|
appNameText.setText(appName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -329,6 +354,12 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
.execute(new ListSongsAsyncTask.LoadingInfo(files, AUDIO_FILE_FILTER, getFileComparator()));
|
.execute(new ListSongsAsyncTask.LoadingInfo(files, AUDIO_FILE_FILTER, getFileComparator()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPrepareOptionsMenu(@NonNull Menu menu) {
|
||||||
|
super.onPrepareOptionsMenu(menu);
|
||||||
|
ToolbarContentTintHelper.handleOnPrepareOptionsMenu(requireActivity(), toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
|
@ -337,6 +368,12 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
menu.removeItem(R.id.action_grid_size);
|
menu.removeItem(R.id.action_grid_size);
|
||||||
menu.removeItem(R.id.action_layout_type);
|
menu.removeItem(R.id.action_layout_type);
|
||||||
menu.removeItem(R.id.action_sort_order);
|
menu.removeItem(R.id.action_sort_order);
|
||||||
|
ToolbarContentTintHelper.handleOnCreateOptionsMenu(
|
||||||
|
requireContext(),
|
||||||
|
toolbar,
|
||||||
|
menu,
|
||||||
|
getToolbarBackgroundColor(toolbar)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -420,6 +457,8 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
breadCrumbs = view.findViewById(R.id.breadCrumbs);
|
breadCrumbs = view.findViewById(R.id.breadCrumbs);
|
||||||
empty = view.findViewById(android.R.id.empty);
|
empty = view.findViewById(android.R.id.empty);
|
||||||
emojiText = view.findViewById(R.id.emptyEmoji);
|
emojiText = view.findViewById(R.id.emptyEmoji);
|
||||||
|
toolbar = view.findViewById(R.id.toolbar);
|
||||||
|
appNameText = view.findViewById(R.id.appNameText);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveScrollPosition() {
|
private void saveScrollPosition() {
|
||||||
|
|
|
@ -18,16 +18,24 @@ import android.app.ActivityOptions
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
|
import android.view.MenuItem
|
||||||
import android.view.MenuItem.SHOW_AS_ACTION_IF_ROOM
|
import android.view.MenuItem.SHOW_AS_ACTION_IF_ROOM
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
|
import androidx.core.text.HtmlCompat
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
|
import code.name.monkey.appthemehelper.common.ATHToolbarActivity
|
||||||
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||||
import code.name.monkey.retromusic.HISTORY_PLAYLIST
|
import code.name.monkey.retromusic.HISTORY_PLAYLIST
|
||||||
import code.name.monkey.retromusic.LAST_ADDED_PLAYLIST
|
import code.name.monkey.retromusic.LAST_ADDED_PLAYLIST
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.TOP_PLAYED_PLAYLIST
|
import code.name.monkey.retromusic.TOP_PLAYED_PLAYLIST
|
||||||
import code.name.monkey.retromusic.adapter.HomeAdapter
|
import code.name.monkey.retromusic.adapter.HomeAdapter
|
||||||
|
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog
|
||||||
|
import code.name.monkey.retromusic.dialogs.ImportPlaylistDialog
|
||||||
import code.name.monkey.retromusic.extensions.findActivityNavController
|
import code.name.monkey.retromusic.extensions.findActivityNavController
|
||||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
||||||
|
@ -36,7 +44,6 @@ import code.name.monkey.retromusic.glide.UserProfileGlideRequest
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.google.android.material.transition.platform.MaterialFadeThrough
|
|
||||||
import kotlinx.android.synthetic.main.abs_playlists.*
|
import kotlinx.android.synthetic.main.abs_playlists.*
|
||||||
import kotlinx.android.synthetic.main.fragment_banner_home.*
|
import kotlinx.android.synthetic.main.fragment_banner_home.*
|
||||||
import kotlinx.android.synthetic.main.home_content.*
|
import kotlinx.android.synthetic.main.home_content.*
|
||||||
|
@ -48,6 +55,8 @@ class HomeFragment :
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
mainActivity.setSupportActionBar(toolbar)
|
||||||
|
mainActivity.supportActionBar?.title = null
|
||||||
setStatusBarColorAuto(view)
|
setStatusBarColorAuto(view)
|
||||||
bannerImage?.setOnClickListener {
|
bannerImage?.setOnClickListener {
|
||||||
val options = ActivityOptions.makeSceneTransitionAnimation(
|
val options = ActivityOptions.makeSceneTransitionAnimation(
|
||||||
|
@ -104,6 +113,24 @@ class HomeFragment :
|
||||||
})
|
})
|
||||||
|
|
||||||
loadProfile()
|
loadProfile()
|
||||||
|
setupTitle()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupTitle() {
|
||||||
|
toolbar.setNavigationOnClickListener {
|
||||||
|
findNavController().navigate(
|
||||||
|
R.id.searchFragment,
|
||||||
|
null,
|
||||||
|
navOptions
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val color = ThemeStore.accentColor(requireContext())
|
||||||
|
val hexColor = String.format("#%06X", 0xFFFFFF and color)
|
||||||
|
val appName = HtmlCompat.fromHtml(
|
||||||
|
"Retro <span style='color:$hexColor';>Music</span>",
|
||||||
|
HtmlCompat.FROM_HTML_MODE_COMPACT
|
||||||
|
)
|
||||||
|
appNameText.text = appName
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadProfile() {
|
private fun loadProfile() {
|
||||||
|
@ -121,10 +148,17 @@ class HomeFragment :
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||||
super.onCreateOptionsMenu(menu, inflater)
|
super.onCreateOptionsMenu(menu, inflater)
|
||||||
|
inflater.inflate(R.menu.menu_main, menu)
|
||||||
menu.removeItem(R.id.action_grid_size)
|
menu.removeItem(R.id.action_grid_size)
|
||||||
menu.removeItem(R.id.action_layout_type)
|
menu.removeItem(R.id.action_layout_type)
|
||||||
menu.removeItem(R.id.action_sort_order)
|
menu.removeItem(R.id.action_sort_order)
|
||||||
menu.findItem(R.id.action_settings).setShowAsAction(SHOW_AS_ACTION_IF_ROOM)
|
menu.findItem(R.id.action_settings).setShowAsAction(SHOW_AS_ACTION_IF_ROOM)
|
||||||
|
ToolbarContentTintHelper.handleOnCreateOptionsMenu(
|
||||||
|
requireContext(),
|
||||||
|
toolbar,
|
||||||
|
menu,
|
||||||
|
ATHToolbarActivity.getToolbarBackgroundColor(toolbar)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -136,4 +170,28 @@ class HomeFragment :
|
||||||
return HomeFragment()
|
return HomeFragment()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
|
when (item.itemId) {
|
||||||
|
R.id.action_settings -> findNavController().navigate(
|
||||||
|
R.id.settingsActivity,
|
||||||
|
null,
|
||||||
|
navOptions
|
||||||
|
)
|
||||||
|
R.id.action_import_playlist -> ImportPlaylistDialog().show(
|
||||||
|
childFragmentManager,
|
||||||
|
"ImportPlaylist"
|
||||||
|
)
|
||||||
|
R.id.action_add_to_playlist -> CreatePlaylistDialog.create(emptyList()).show(
|
||||||
|
childFragmentManager,
|
||||||
|
"ShowCreatePlaylistDialog"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||||
|
super.onPrepareOptionsMenu(menu)
|
||||||
|
ToolbarContentTintHelper.handleOnPrepareOptionsMenu(requireActivity(), toolbar)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -11,7 +11,6 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.playlist.PlaylistAdapter
|
import code.name.monkey.retromusic.adapter.playlist.PlaylistAdapter
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsRecyclerViewFragment
|
import code.name.monkey.retromusic.fragments.base.AbsRecyclerViewFragment
|
||||||
import com.google.android.material.transition.platform.MaterialFadeThrough
|
|
||||||
import kotlinx.android.synthetic.main.fragment_library.*
|
import kotlinx.android.synthetic.main.fragment_library.*
|
||||||
|
|
||||||
class PlaylistsFragment : AbsRecyclerViewFragment<PlaylistAdapter, LinearLayoutManager>() {
|
class PlaylistsFragment : AbsRecyclerViewFragment<PlaylistAdapter, LinearLayoutManager>() {
|
||||||
|
@ -47,12 +46,12 @@ class PlaylistsFragment : AbsRecyclerViewFragment<PlaylistAdapter, LinearLayoutM
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||||
|
super.onCreateOptionsMenu(menu, inflater)
|
||||||
menu.removeItem(R.id.action_grid_size)
|
menu.removeItem(R.id.action_grid_size)
|
||||||
menu.removeItem(R.id.action_layout_type)
|
menu.removeItem(R.id.action_layout_type)
|
||||||
menu.removeItem(R.id.action_sort_order)
|
menu.removeItem(R.id.action_sort_order)
|
||||||
menu.add(0, R.id.action_add_to_playlist, 0, R.string.new_playlist_title)
|
menu.add(0, R.id.action_add_to_playlist, 0, R.string.new_playlist_title)
|
||||||
menu.add(0, R.id.action_import_playlist, 0, R.string.import_playlist)
|
menu.add(0, R.id.action_import_playlist, 0, R.string.import_playlist)
|
||||||
menu.findItem(R.id.action_settings).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
|
menu.findItem(R.id.action_settings).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
|
||||||
super.onCreateOptionsMenu(menu, inflater)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ class SongsFragment : AbsRecyclerViewCustomGridSizeFragment<SongAdapter, GridLay
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||||
|
super.onCreateOptionsMenu(menu, inflater)
|
||||||
val gridSizeItem: MenuItem = menu.findItem(R.id.action_grid_size)
|
val gridSizeItem: MenuItem = menu.findItem(R.id.action_grid_size)
|
||||||
if (RetroUtil.isLandscape()) {
|
if (RetroUtil.isLandscape()) {
|
||||||
gridSizeItem.setTitle(R.string.action_grid_size_land)
|
gridSizeItem.setTitle(R.string.action_grid_size_land)
|
||||||
|
@ -92,7 +93,6 @@ class SongsFragment : AbsRecyclerViewCustomGridSizeFragment<SongAdapter, GridLay
|
||||||
val layoutItem = menu.findItem(R.id.action_layout_type)
|
val layoutItem = menu.findItem(R.id.action_layout_type)
|
||||||
setupLayoutMenu(layoutItem.subMenu)
|
setupLayoutMenu(layoutItem.subMenu)
|
||||||
setUpSortOrderMenu(menu.findItem(R.id.action_sort_order).subMenu)
|
setUpSortOrderMenu(menu.findItem(R.id.action_sort_order).subMenu)
|
||||||
super.onCreateOptionsMenu(menu, inflater)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpSortOrderMenu(
|
private fun setUpSortOrderMenu(
|
||||||
|
|
|
@ -23,6 +23,5 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:defaultNavHost="true"
|
app:defaultNavHost="true"
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
|
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||||
app:navGraph="@navigation/main_graph" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -11,15 +11,56 @@
|
||||||
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
~ See the GNU General Public License for more details.
|
~ See the GNU General Public License for more details.
|
||||||
-->
|
-->
|
||||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/container"
|
android:layout_width="match_parent"
|
||||||
android:overScrollMode="never"
|
android:layout_height="match_parent">
|
||||||
android:descendantFocusability="beforeDescendants"
|
|
||||||
android:focusableInTouchMode="true"
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appBarLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
app:liftOnScroll="true">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorSurface"
|
||||||
|
app:navigationIcon="@drawable/ic_search"
|
||||||
|
app:popupTheme="?attr/toolbarPopupTheme"
|
||||||
|
app:title="@null"
|
||||||
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/appNameText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textAppearance="@style/TextViewHeadline6"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
|
<ViewStub
|
||||||
|
android:id="@+id/cab_stub"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/toolbar_height" />
|
||||||
|
</FrameLayout>
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:id="@+id/container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:descendantFocusability="beforeDescendants"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
android:overScrollMode="never"
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
@ -108,3 +149,4 @@
|
||||||
app:layout_constraintTop_toBottomOf="@+id/imageContainer" />
|
app:layout_constraintTop_toBottomOf="@+id/imageContainer" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -1,11 +1,53 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appBarLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:liftOnScroll="true">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorSurface"
|
||||||
|
app:navigationIcon="@drawable/ic_search"
|
||||||
|
app:popupTheme="?attr/toolbarPopupTheme"
|
||||||
|
app:title="@null"
|
||||||
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/appNameText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textAppearance="@style/TextViewHeadline6"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
|
<ViewStub
|
||||||
|
android:id="@+id/cab_stub"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/toolbar_height" />
|
||||||
|
</FrameLayout>
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
android:id="@+id/coordinatorLayout"
|
android:id="@+id/coordinatorLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/colorSurface">
|
android:background="?attr/colorSurface"
|
||||||
|
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@android:id/empty"
|
android:id="@android:id/empty"
|
||||||
|
@ -61,3 +103,4 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -11,9 +11,50 @@
|
||||||
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
~ See the GNU General Public License for more details.
|
~ See the GNU General Public License for more details.
|
||||||
-->
|
-->
|
||||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appBarLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:liftOnScroll="true">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorSurface"
|
||||||
|
app:navigationIcon="@drawable/ic_search"
|
||||||
|
app:popupTheme="?attr/toolbarPopupTheme"
|
||||||
|
app:title="@null"
|
||||||
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/appNameText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textAppearance="@style/TextViewHeadline6"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
|
<ViewStub
|
||||||
|
android:id="@+id/cab_stub"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/toolbar_height" />
|
||||||
|
</FrameLayout>
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
android:id="@+id/container"
|
android:id="@+id/container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -74,3 +115,4 @@
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
92
app/src/main/res/layout/fragment_main_recycler.xml
Normal file
92
app/src/main/res/layout/fragment_main_recycler.xml
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout 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="match_parent">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appBarLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:liftOnScroll="true">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorSurface"
|
||||||
|
app:navigationIcon="@drawable/ic_search"
|
||||||
|
app:popupTheme="?attr/toolbarPopupTheme"
|
||||||
|
app:title="@null"
|
||||||
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/appNameText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textAppearance="@style/TextViewHeadline6"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
|
<ViewStub
|
||||||
|
android:id="@+id/cab_stub"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/toolbar_height" />
|
||||||
|
</FrameLayout>
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
android:scrollbars="none"
|
||||||
|
android:transitionGroup="true"
|
||||||
|
app:layout_dodgeInsetEdges="bottom"
|
||||||
|
tools:listitem="@layout/item_list" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@android:id/empty"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/emptyEmoji"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:text="@string/empty_text_emoji"
|
||||||
|
android:textAppearance="@style/TextViewHeadline3" />
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/emptyText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:text="@string/empty"
|
||||||
|
android:textAppearance="@style/TextViewHeadline5"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -3,7 +3,7 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/retro_graph"
|
android:id="@+id/retro_graph"
|
||||||
app:startDestination="@id/libraryFragment">
|
app:startDestination="@id/action_home">
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/genreDetailsFragment"
|
android:id="@+id/genreDetailsFragment"
|
||||||
|
@ -76,4 +76,43 @@
|
||||||
android:name="code.name.monkey.retromusic.activities.PermissionActivity"
|
android:name="code.name.monkey.retromusic.activities.PermissionActivity"
|
||||||
android:label="PermissionFragment"
|
android:label="PermissionFragment"
|
||||||
tools:layout="@layout/activity_permission" />
|
tools:layout="@layout/activity_permission" />
|
||||||
|
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/action_album"
|
||||||
|
android:name="code.name.monkey.retromusic.fragments.albums.AlbumsFragment"
|
||||||
|
tools:layout="@layout/fragment_main_activity_recycler_view" />
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/action_artist"
|
||||||
|
android:name="code.name.monkey.retromusic.fragments.artists.ArtistsFragment"
|
||||||
|
tools:layout="@layout/fragment_main_activity_recycler_view" />
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/action_song"
|
||||||
|
android:name="code.name.monkey.retromusic.fragments.songs.SongsFragment"
|
||||||
|
tools:layout="@layout/fragment_main_activity_recycler_view" />
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/action_genre"
|
||||||
|
android:name="code.name.monkey.retromusic.fragments.genres.GenresFragment"
|
||||||
|
tools:layout="@layout/fragment_main_activity_recycler_view" />
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/action_playlist"
|
||||||
|
android:name="code.name.monkey.retromusic.fragments.playlists.PlaylistsFragment"
|
||||||
|
tools:layout="@layout/fragment_main_activity_recycler_view" />
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/action_folder"
|
||||||
|
android:name="code.name.monkey.retromusic.fragments.folder.FoldersFragment"
|
||||||
|
tools:layout="@layout/fragment_folder" />
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/action_home"
|
||||||
|
android:name="code.name.monkey.retromusic.fragments.home.HomeFragment"
|
||||||
|
android:label=""
|
||||||
|
tools:layout="@layout/fragment_banner_home" />
|
||||||
|
|
||||||
|
|
||||||
</navigation>
|
</navigation>
|
Loading…
Reference in a new issue