Removed library fragment

main
h4h13 2020-02-19 13:23:53 +05:30
parent d03d4e4505
commit f11c392b8d
5 changed files with 118 additions and 173 deletions

View File

@ -49,6 +49,7 @@ import code.name.monkey.retromusic.fragments.mainactivity.GenresFragment;
import code.name.monkey.retromusic.fragments.mainactivity.PlayingQueueFragment; import code.name.monkey.retromusic.fragments.mainactivity.PlayingQueueFragment;
import code.name.monkey.retromusic.fragments.mainactivity.PlaylistsFragment; import code.name.monkey.retromusic.fragments.mainactivity.PlaylistsFragment;
import code.name.monkey.retromusic.fragments.mainactivity.SongsFragment; import code.name.monkey.retromusic.fragments.mainactivity.SongsFragment;
import code.name.monkey.retromusic.fragments.mainactivity.folders.FoldersFragment;
import code.name.monkey.retromusic.fragments.mainactivity.home.BannerHomeFragment; import code.name.monkey.retromusic.fragments.mainactivity.home.BannerHomeFragment;
import code.name.monkey.retromusic.helper.MusicPlayerRemote; import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.SearchQueryHelper; import code.name.monkey.retromusic.helper.SearchQueryHelper;
@ -65,6 +66,7 @@ import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.util.AppRater; import code.name.monkey.retromusic.util.AppRater;
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 code.name.monkey.retromusic.util.RetroColorUtil;
import code.name.monkey.retromusic.util.RetroUtil; import code.name.monkey.retromusic.util.RetroUtil;
import com.afollestad.materialcab.MaterialCab; import com.afollestad.materialcab.MaterialCab;
import com.afollestad.materialcab.MaterialCab.Callback; import com.afollestad.materialcab.MaterialCab.Callback;
@ -92,6 +94,8 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
private boolean blockRequestPermissions = false; private boolean blockRequestPermissions = false;
private MaterialCab cab;
private AppBarLayout mAppBarLayout; private AppBarLayout mAppBarLayout;
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@ -134,7 +138,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
}); });
if (savedInstanceState == null) { if (savedInstanceState == null) {
selectedFragment(PreferenceUtil.getInstance(this).getLastPage()); setMusicChooser(PreferenceUtil.getInstance(this).getLastMusicChooser());
} else { } else {
restoreCurrentFragment(); restoreCurrentFragment();
} }
@ -189,6 +193,15 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
return mAppBarLayout.getTotalScrollRange(); return mAppBarLayout.getTotalScrollRange();
} }
@Override
public boolean handleBackPress() {
if (cab != null && cab.isActive()) {
cab.finish();
return true;
}
return super.handleBackPress() || (currentFragment != null && currentFragment.handleBackPress());
}
@Override @Override
public boolean onCreateOptionsMenu(final Menu menu) { public boolean onCreateOptionsMenu(final Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu); getMenuInflater().inflate(R.menu.menu_main, menu);
@ -275,7 +288,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
key.equals(PreferenceUtil.USER_NAME) || key.equals(PreferenceUtil.TOGGLE_FULL_SCREEN) || key.equals(PreferenceUtil.USER_NAME) || key.equals(PreferenceUtil.TOGGLE_FULL_SCREEN) ||
key.equals(PreferenceUtil.TOGGLE_VOLUME) || key.equals(PreferenceUtil.ROUND_CORNERS) || key.equals(PreferenceUtil.TOGGLE_VOLUME) || key.equals(PreferenceUtil.ROUND_CORNERS) ||
key.equals(PreferenceUtil.CAROUSEL_EFFECT) || key == PreferenceUtil.NOW_PLAYING_SCREEN_ID || key.equals(PreferenceUtil.CAROUSEL_EFFECT) || key == PreferenceUtil.NOW_PLAYING_SCREEN_ID ||
key == PreferenceUtil.TOGGLE_GENRE || key == PreferenceUtil.BANNER_IMAGE_PATH || key == PreferenceUtil.TOGGLE_GENRE || key.equals(PreferenceUtil.BANNER_IMAGE_PATH) ||
key == PreferenceUtil.PROFILE_IMAGE_PATH || key == PreferenceUtil.CIRCULAR_ALBUM_ART || key == PreferenceUtil.PROFILE_IMAGE_PATH || key == PreferenceUtil.CIRCULAR_ALBUM_ART ||
key == PreferenceUtil.KEEP_SCREEN_ON || key == PreferenceUtil.TOGGLE_SEPARATE_LINE || key == PreferenceUtil.KEEP_SCREEN_ON || key == PreferenceUtil.TOGGLE_SEPARATE_LINE ||
key == PreferenceUtil.TOGGLE_HOME_BANNER || key == PreferenceUtil.TOGGLE_ADD_CONTROLS || key == PreferenceUtil.TOGGLE_HOME_BANNER || key == PreferenceUtil.TOGGLE_ADD_CONTROLS ||
@ -290,7 +303,17 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
@NotNull @NotNull
@Override @Override
public MaterialCab openCab(final int menuRes, @NotNull final Callback callback) { public MaterialCab openCab(final int menuRes, @NotNull final Callback callback) {
return null; if (cab != null && cab.isActive()) {
cab.finish();
}
cab = new MaterialCab(this, R.id.cab_stub)
.setMenu(menuRes)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
.setBackgroundColor(
RetroColorUtil.shiftBackgroundColorForLightText(
ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface)))
.start(callback);
return cab;
} }
public void removeOnAppBarOffsetChangedListener( public void removeOnAppBarOffsetChangedListener(
@ -298,12 +321,42 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
mAppBarLayout.removeOnOffsetChangedListener(onOffsetChangedListener); mAppBarLayout.removeOnOffsetChangedListener(onOffsetChangedListener);
} }
public void setCurrentFragment(Fragment fragment, String tag) {
String currentTag = null;
if (getSupportFragmentManager().findFragmentByTag(tag) != null) {
currentTag = getSupportFragmentManager().findFragmentByTag(tag).getTag();
}
if (!tag.equals(currentTag)) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_container, fragment, tag)
.commit();
currentFragment = (MainActivityFragmentCallbacks) fragment;
}
}
public void setMusicChooser(final int option) {
PreferenceUtil.getInstance(this).setLastMusicChooser(option);
if (option == OptionsSheetDialogFragment.FOLDER) {
setCurrentFragment(FoldersFragment.newInstance(this), FoldersFragment.TAG);
} else {
selectedFragment(PreferenceUtil.getInstance(this).getLastPage());
}
}
@NotNull @NotNull
@Override @Override
protected View createContentView() { protected View createContentView() {
return wrapSlidingMusicPanel(R.layout.activity_main_content); return wrapSlidingMusicPanel(R.layout.activity_main_content);
} }
@Override
protected void requestPermissions() {
if (!blockRequestPermissions) {
super.requestPermissions();
}
}
private void checkShowChangelog() { private void checkShowChangelog() {
try { try {
final PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); final PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
@ -563,20 +616,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
} }
} }
private void setCurrentFragment(Fragment fragment, String tag) {
String currentTag = null;
if (getSupportFragmentManager().findFragmentByTag(tag) != null) {
currentTag = getSupportFragmentManager().findFragmentByTag(tag).getTag();
}
if (!tag.equals(currentTag)) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_container, fragment, tag)
.commit();
currentFragment = (MainActivityFragmentCallbacks) fragment;
}
}
private void setUpGridSizeMenu(@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment, private void setUpGridSizeMenu(@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment,
@NonNull SubMenu gridSizeMenu) { @NonNull SubMenu gridSizeMenu) {
@ -702,7 +741,17 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
.makeSceneTransitionAnimation(this, mToolbarContainer, getString(R.string.transition_toolbar)); .makeSceneTransitionAnimation(this, mToolbarContainer, getString(R.string.transition_toolbar));
NavigationUtil.goToSearch(this, options); NavigationUtil.goToSearch(this, options);
}); });
mToolbar.setNavigationOnClickListener( mToolbar.setNavigationOnClickListener(
v -> OptionsSheetDialogFragment.newInstance().show(getSupportFragmentManager(), "Main_Menu")); v -> {
Fragment fragment = getCurrentFragment();
if (fragment instanceof FoldersFragment) {
OptionsSheetDialogFragment.newInstance(OptionsSheetDialogFragment.FOLDER)
.show(getSupportFragmentManager(), "Main_Menu");
} else {
OptionsSheetDialogFragment.newInstance(OptionsSheetDialogFragment.LIBRARY)
.show(getSupportFragmentManager(), "Main_Menu");
}
});
} }
} }

View File

@ -37,10 +37,8 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
override fun onClick(view: View) { override fun onClick(view: View) {
val mainActivity = activity as MainActivity? ?: return val mainActivity = activity as MainActivity? ?: return
when (view.id) { when (view.id) {
R.id.actionFolders -> { R.id.actionFolders -> mainActivity.setMusicChooser(FOLDER)
}//mainActivity.setMusicChooser(MainActivity.FOLDER) R.id.actionLibrary -> mainActivity.setMusicChooser(LIBRARY)
R.id.actionLibrary -> {
}//mainActivity.setMusicChooser(MainActivity.LIBRARY)
R.id.actionSettings -> NavigationUtil.goToSettings(mainActivity) R.id.actionSettings -> NavigationUtil.goToSettings(mainActivity)
R.id.actionDriveMode -> NavigationUtil.gotoDriveMode(mainActivity) R.id.actionDriveMode -> NavigationUtil.gotoDriveMode(mainActivity)
R.id.actionRate -> NavigationUtil.goToPlayStore(mainActivity) R.id.actionRate -> NavigationUtil.goToPlayStore(mainActivity)

View File

@ -1,9 +1,7 @@
package code.name.monkey.retromusic.fragments.mainactivity.folders; package code.name.monkey.retromusic.fragments.mainactivity.folders;
import android.app.ActivityOptions;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.res.ColorStateList;
import android.media.MediaScannerConnection; import android.media.MediaScannerConnection;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
@ -20,18 +18,14 @@ import android.widget.TextView;
import android.widget.Toast; 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.loader.app.LoaderManager; import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader; import androidx.loader.content.Loader;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import code.name.monkey.appthemehelper.ThemeStore; 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.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.dialogs.OptionsSheetDialogFragment;
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment; import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment;
import code.name.monkey.retromusic.helper.MusicPlayerRemote; import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.menu.SongMenuHelper; import code.name.monkey.retromusic.helper.menu.SongMenuHelper;
@ -43,17 +37,13 @@ import code.name.monkey.retromusic.misc.DialogAsyncTask;
import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener; import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener;
import code.name.monkey.retromusic.misc.WrappedAsyncTaskLoader; import code.name.monkey.retromusic.misc.WrappedAsyncTaskLoader;
import code.name.monkey.retromusic.model.Song; import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.util.DensityUtil;
import code.name.monkey.retromusic.util.FileUtil; import code.name.monkey.retromusic.util.FileUtil;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.PreferenceUtil; import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroColorUtil; import code.name.monkey.retromusic.util.RetroColorUtil;
import code.name.monkey.retromusic.util.ThemedFastScroller; import code.name.monkey.retromusic.util.ThemedFastScroller;
import code.name.monkey.retromusic.views.BreadCrumbLayout; import code.name.monkey.retromusic.views.BreadCrumbLayout;
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener; import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener;
import com.afollestad.materialcab.MaterialCab; import com.afollestad.materialcab.MaterialCab;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.card.MaterialCardView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import java.io.File; import java.io.File;
@ -71,7 +61,7 @@ import me.zhanghai.android.fastscroll.FastScroller;
public class FoldersFragment extends AbsMainActivityFragment implements public class FoldersFragment extends AbsMainActivityFragment implements
MainActivityFragmentCallbacks, MainActivityFragmentCallbacks,
CabHolder, BreadCrumbLayout.SelectionCallback, SongFileAdapter.Callbacks, CabHolder, BreadCrumbLayout.SelectionCallback, SongFileAdapter.Callbacks,
AppBarLayout.OnOffsetChangedListener, LoaderManager.LoaderCallbacks<List<File>> { LoaderManager.LoaderCallbacks<List<File>> {
public static class ListPathsAsyncTask extends public static class ListPathsAsyncTask extends
ListingFilesDialogAsyncTask<ListPathsAsyncTask.LoadingInfo, String, String[]> { ListingFilesDialogAsyncTask<ListPathsAsyncTask.LoadingInfo, String, String[]> {
@ -327,8 +317,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
private SongFileAdapter adapter; private SongFileAdapter adapter;
private AppBarLayout appBarLayout;
private BreadCrumbLayout breadCrumbs; private BreadCrumbLayout breadCrumbs;
private MaterialCab cab; private MaterialCab cab;
@ -350,9 +338,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
private RecyclerView recyclerView; private RecyclerView recyclerView;
private Toolbar toolbar;
private MaterialCardView toolbarContainer;
public static File getDefaultStartDirectory() { public static File getDefaultStartDirectory() {
File musicDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC); File musicDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
@ -434,12 +419,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
} }
@Override
public void onDestroyView() {
appBarLayout.removeOnOffsetChangedListener(this);
super.onDestroyView();
}
@Override @Override
public boolean handleBackPress() { public boolean handleBackPress() {
if (cab != null && cab.isActive()) { if (cab != null && cab.isActive()) {
@ -463,8 +442,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_folders, menu); inflater.inflate(R.menu.menu_folders, menu);
ToolbarContentTintHelper.handleOnCreateOptionsMenu(getActivity(), toolbar, menu,
ATHToolbarActivity.getToolbarBackgroundColor(toolbar));
} }
@Override @Override
@ -590,13 +567,6 @@ 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 onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
recyclerView.setPadding(recyclerView.getPaddingLeft(), recyclerView.getPaddingTop(),
recyclerView.getPaddingRight(), DensityUtil.dip2px(requireContext(), 52f) +
this.appBarLayout.getTotalScrollRange() + verticalOffset);
}
@Override @Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) { public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
@ -617,11 +587,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
ToolbarContentTintHelper.handleOnPrepareOptionsMenu(getActivity(), toolbar);
}
@NonNull @NonNull
@Override @Override
@ -661,11 +626,8 @@ public class FoldersFragment extends AbsMainActivityFragment implements
private void initViews(View view) { private void initViews(View view) {
coordinatorLayout = view.findViewById(R.id.coordinatorLayout); coordinatorLayout = view.findViewById(R.id.coordinatorLayout);
toolbarContainer = view.findViewById(R.id.toolbarContainer);
recyclerView = view.findViewById(R.id.recyclerView); recyclerView = view.findViewById(R.id.recyclerView);
appBarLayout = view.findViewById(R.id.appBarLayout);
breadCrumbs = view.findViewById(R.id.breadCrumbs); breadCrumbs = view.findViewById(R.id.breadCrumbs);
toolbar = view.findViewById(R.id.toolbar);
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);
} }
@ -703,7 +665,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
} }
private void setUpAdapter() { private void setUpAdapter() {
adapter = new SongFileAdapter(getMainActivity(), new LinkedList<File>(), R.layout.item_list, adapter = new SongFileAdapter(getMainActivity(), new LinkedList<>(), R.layout.item_list,
this, this); this, this);
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override @Override
@ -717,26 +679,10 @@ public class FoldersFragment extends AbsMainActivityFragment implements
} }
private void setUpAppbarColor() { private void setUpAppbarColor() {
int primaryColor = ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorSurface);
getMainActivity().setSupportActionBar(toolbar);
toolbar.setBackgroundTintList(ColorStateList.valueOf(primaryColor));
toolbarContainer.setCardBackgroundColor(ColorStateList.valueOf(primaryColor));
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
toolbar.setNavigationOnClickListener(v -> {
showMainMenu(OptionsSheetDialogFragment.FOLDER);
});
breadCrumbs.setActivatedContentColor( breadCrumbs.setActivatedContentColor(
ATHUtil.INSTANCE.resolveColor(requireContext(), android.R.attr.textColorPrimary)); ATHUtil.INSTANCE.resolveColor(requireContext(), android.R.attr.textColorPrimary));
breadCrumbs.setDeactivatedContentColor( breadCrumbs.setDeactivatedContentColor(
ATHUtil.INSTANCE.resolveColor(requireContext(), android.R.attr.textColorSecondary)); ATHUtil.INSTANCE.resolveColor(requireContext(), android.R.attr.textColorSecondary));
appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> getMainActivity()
.setLightStatusbar(!ATHUtil.INSTANCE.isWindowBackgroundDark(requireContext())));
toolbar.setOnClickListener(v -> {
ActivityOptions options = ActivityOptions
.makeSceneTransitionAnimation(getMainActivity(), toolbarContainer,
getString(R.string.transition_toolbar));
NavigationUtil.goToSearch(getMainActivity(), options);
});
} }
private void setUpBreadCrumbs() { private void setUpBreadCrumbs() {
@ -745,7 +691,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
private void setUpRecyclerView() { private void setUpRecyclerView() {
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
appBarLayout.addOnOffsetChangedListener(this);
FastScroller fastScroller = ThemedFastScroller.INSTANCE.create(recyclerView); FastScroller fastScroller = ThemedFastScroller.INSTANCE.create(recyclerView);
recyclerView.setOnApplyWindowInsetsListener( recyclerView.setOnApplyWindowInsetsListener(
new ScrollingViewOnApplyWindowInsetsListener(recyclerView, fastScroller)); new ScrollingViewOnApplyWindowInsetsListener(recyclerView, fastScroller));

View File

@ -29,6 +29,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.StyleRes; import androidx.annotation.StyleRes;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.dialogs.OptionsSheetDialogFragment;
import code.name.monkey.retromusic.fragments.AlbumCoverStyle; import code.name.monkey.retromusic.fragments.AlbumCoverStyle;
import code.name.monkey.retromusic.fragments.NowPlayingScreen; import code.name.monkey.retromusic.fragments.NowPlayingScreen;
import code.name.monkey.retromusic.fragments.mainactivity.folders.FoldersFragment; import code.name.monkey.retromusic.fragments.mainactivity.folders.FoldersFragment;
@ -584,6 +585,14 @@ public final class PreferenceUtil {
return mPreferences.getInt(LAST_CHANGELOG_VERSION, -1); return mPreferences.getInt(LAST_CHANGELOG_VERSION, -1);
} }
public final int getLastMusicChooser() {
return mPreferences.getInt(LAST_MUSIC_CHOOSER, OptionsSheetDialogFragment.LIBRARY);
}
public void setLastMusicChooser(int value) {
mPreferences.edit().putInt(LAST_MUSIC_CHOOSER, value).apply();
}
public final int getLastPage() { public final int getLastPage() {
return mPreferences.getInt(LAST_PAGE, R.id.action_song); return mPreferences.getInt(LAST_PAGE, R.id.action_song);
} }

View File

@ -1,80 +1,53 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout 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/coordinatorLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:background="?attr/colorSurface">
<FrameLayout <LinearLayout
android:layout_width="match_parent" android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:elevation="0dp" android:layout_gravity="center"
tools:ignore="UnusedAttribute"> android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<include layout="@layout/status_bar" /> <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" />
</FrameLayout> <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/nothing_to_see"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="?android:attr/textColorSecondary"
tools:visibility="visible" />
</LinearLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout <LinearLayout
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:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout <code.name.monkey.retromusic.views.BreadCrumbLayout
android:id="@+id/appBarLayout" android:id="@+id/breadCrumbs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/tab_height"
android:background="@android:color/transparent" android:paddingStart="60dp"
android:elevation="0dp" android:paddingEnd="8dp"
app:elevation="0dp"> app:layout_collapseMode="pin" />
<com.google.android.material.card.MaterialCardView
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true"
app:layout_scrollFlags="scroll|enterAlways">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:popupTheme="?toolbarPopupTheme"
app:title="@string/action_search"
app:titleMarginStart="0dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceSearch"
tools:ignore="UnusedAttribute" />
<ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="48dp" />
</FrameLayout>
<code.name.monkey.retromusic.views.BreadCrumbLayout
android:id="@+id/breadCrumbs"
android:layout_width="match_parent"
android:layout_height="@dimen/tab_height"
android:paddingStart="60dp"
android:paddingEnd="8dp"
app:layout_collapseMode="pin" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
@ -85,34 +58,5 @@
android:scrollbars="none" android:scrollbars="none"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" /> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
<LinearLayout </LinearLayout>
android:id="@android:id/empty" </FrameLayout>
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/nothing_to_see"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="?android:attr/textColorSecondary"
tools:visibility="visible" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>