mirror of
https://github.com/antebudimir/tempus.git
synced 2026-04-15 16:27:26 +00:00
feat: enhance navigation (#450)
* feat: enhance navigation * fix: leaving settings always unlocks drawer * feat: set app settings inside a frame layout In order to add a toolbar with a back button in settings I needed to extend from a fragment so I converted SettingsFragment into a fragment and created SettingsContainerFragment, the latter is injected as a child of SettingsFragment inside a FrameLayout. Since SettingsContainerFragment extends from PreferenceFragmentCompat, this allows to swap it for other and, in the bigger picture, allow an arbitrary organization. * fix: onStop declaration on wrong class * fix: equalizer not respecting navigation ui directives * Revert "fix: equalizer not respecting navigation ui directives" This reverts commit eeb125542d41760059e3a7c7653abf4d54a538f0. * fix: navbar + bottom sheet behavior on equalizer fragment * Revert "fix: onStop declaration on wrong class" This reverts commit 34d354d8039ac70798b880bf99c808ef00a1e330. * Revert "feat: set app settings inside a frame layout" This reverts commit 52cfd36b09c461de72bed9b07a8c8852856c3421. * chore: set experimental label to settings title Hide bottom navigation bar on portrait and unlock drawer on portrait
This commit is contained in:
parent
932d1aaa8c
commit
145bb82eb0
18 changed files with 376 additions and 42 deletions
|
|
@ -3,7 +3,6 @@ package com.cappielloantonio.tempo.ui.activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
|
@ -11,12 +10,16 @@ import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.splashscreen.SplashScreen;
|
import androidx.core.splashscreen.SplashScreen;
|
||||||
|
import androidx.core.view.WindowCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
import androidx.core.view.WindowInsetsControllerCompat;
|
||||||
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.media3.common.MediaItem;
|
import androidx.media3.common.MediaItem;
|
||||||
|
|
@ -48,6 +51,7 @@ import com.cappielloantonio.tempo.viewmodel.MainViewModel;
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||||
import com.google.android.material.color.DynamicColors;
|
import com.google.android.material.color.DynamicColors;
|
||||||
|
import com.google.android.material.navigation.NavigationView;
|
||||||
import com.google.common.util.concurrent.MoreExecutors;
|
import com.google.common.util.concurrent.MoreExecutors;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
@ -63,9 +67,12 @@ public class MainActivity extends BaseActivity {
|
||||||
private FragmentManager fragmentManager;
|
private FragmentManager fragmentManager;
|
||||||
private NavHostFragment navHostFragment;
|
private NavHostFragment navHostFragment;
|
||||||
private BottomNavigationView bottomNavigationView;
|
private BottomNavigationView bottomNavigationView;
|
||||||
|
private FrameLayout bottomNavigationViewFrame;
|
||||||
public NavController navController;
|
public NavController navController;
|
||||||
|
private DrawerLayout drawerLayout;
|
||||||
|
private NavigationView navigationView;
|
||||||
private BottomSheetBehavior bottomSheetBehavior;
|
private BottomSheetBehavior bottomSheetBehavior;
|
||||||
private boolean isLandscape = false;
|
public boolean isLandscape = false;
|
||||||
private AssetLinkNavigator assetLinkNavigator;
|
private AssetLinkNavigator assetLinkNavigator;
|
||||||
private AssetLinkUtil.AssetLink pendingAssetLink;
|
private AssetLinkUtil.AssetLink pendingAssetLink;
|
||||||
|
|
||||||
|
|
@ -111,6 +118,7 @@ public class MainActivity extends BaseActivity {
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
pingServer();
|
pingServer();
|
||||||
|
toggleNavigationDrawerLockOnOrientationChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -148,14 +156,8 @@ public class MainActivity extends BaseActivity {
|
||||||
goToLogin();
|
goToLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set bottom navigation height
|
toggleNavigationDrawerLockOnOrientationChange();
|
||||||
if (isLandscape) {
|
|
||||||
ViewGroup.LayoutParams layoutParams = bottomNavigationView.getLayoutParams();
|
|
||||||
Rect windowRect = new Rect();
|
|
||||||
bottomNavigationView.getWindowVisibleDisplayFrame(windowRect);
|
|
||||||
layoutParams.width = windowRect.height();
|
|
||||||
bottomNavigationView.setLayoutParams(layoutParams);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BOTTOM SHEET/NAVIGATION
|
// BOTTOM SHEET/NAVIGATION
|
||||||
|
|
@ -259,8 +261,12 @@ public class MainActivity extends BaseActivity {
|
||||||
|
|
||||||
private void initNavigation() {
|
private void initNavigation() {
|
||||||
bottomNavigationView = findViewById(R.id.bottom_navigation);
|
bottomNavigationView = findViewById(R.id.bottom_navigation);
|
||||||
|
bottomNavigationViewFrame = findViewById(R.id.bottom_navigation_frame);
|
||||||
navHostFragment = (NavHostFragment) fragmentManager.findFragmentById(R.id.nav_host_fragment);
|
navHostFragment = (NavHostFragment) fragmentManager.findFragmentById(R.id.nav_host_fragment);
|
||||||
navController = Objects.requireNonNull(navHostFragment).getNavController();
|
navController = Objects.requireNonNull(navHostFragment).getNavController();
|
||||||
|
// This is the lateral slide-in drawer
|
||||||
|
drawerLayout = findViewById(R.id.drawer_layout);
|
||||||
|
navigationView = findViewById(R.id.nav_view);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In questo modo intercetto il cambio schermata tramite navbar e se il bottom sheet è aperto,
|
* In questo modo intercetto il cambio schermata tramite navbar e se il bottom sheet è aperto,
|
||||||
|
|
@ -277,16 +283,90 @@ public class MainActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
|
|
||||||
NavigationUI.setupWithNavController(bottomNavigationView, navController);
|
NavigationUI.setupWithNavController(bottomNavigationView, navController);
|
||||||
|
NavigationUI.setupWithNavController(navigationView, navController);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBottomNavigationBarVisibility(boolean visibility) {
|
public void setBottomNavigationBarVisibility(boolean visibility) {
|
||||||
if (visibility) {
|
if (visibility) {
|
||||||
bottomNavigationView.setVisibility(View.VISIBLE);
|
bottomNavigationView.setVisibility(View.VISIBLE);
|
||||||
|
bottomNavigationViewFrame.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
bottomNavigationView.setVisibility(View.GONE);
|
bottomNavigationView.setVisibility(View.GONE);
|
||||||
|
bottomNavigationViewFrame.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void toggleBottomNavigationBarVisibilityOnOrientationChange() {
|
||||||
|
// Ignore orientation change, bottom navbar always hidden
|
||||||
|
if (Preferences.getHideBottomNavbarOnPortrait()) {
|
||||||
|
setBottomNavigationBarVisibility(false);
|
||||||
|
setPortraitPlayerBottomSheetPeekHeight(56);
|
||||||
|
setSystemBarsVisibility(!isLandscape);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isLandscape) {
|
||||||
|
// Show app navbar + show system bars
|
||||||
|
setPortraitPlayerBottomSheetPeekHeight(136);
|
||||||
|
setBottomNavigationBarVisibility(true);
|
||||||
|
setSystemBarsVisibility(true);
|
||||||
|
} else {
|
||||||
|
// Hide app navbar + hide system bars
|
||||||
|
setPortraitPlayerBottomSheetPeekHeight(56);
|
||||||
|
setBottomNavigationBarVisibility(false);
|
||||||
|
setSystemBarsVisibility(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNavigationDrawerLock(boolean locked) {
|
||||||
|
int mode = locked
|
||||||
|
? DrawerLayout.LOCK_MODE_LOCKED_CLOSED
|
||||||
|
: DrawerLayout.LOCK_MODE_UNLOCKED;
|
||||||
|
drawerLayout.setDrawerLockMode(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggleNavigationDrawerLockOnOrientationChange() {
|
||||||
|
// Ignore orientation check, drawer always unlocked
|
||||||
|
if (Preferences.getEnableDrawerOnPortrait()) {
|
||||||
|
setNavigationDrawerLock(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isLandscape) {
|
||||||
|
setNavigationDrawerLock(true);
|
||||||
|
} else {
|
||||||
|
setNavigationDrawerLock(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSystemBarsVisibility(boolean visibility) {
|
||||||
|
WindowInsetsControllerCompat insetsController;
|
||||||
|
View decorView = getWindow().getDecorView();
|
||||||
|
insetsController = new WindowInsetsControllerCompat(getWindow(), decorView);
|
||||||
|
|
||||||
|
if (visibility) {
|
||||||
|
WindowCompat.setDecorFitsSystemWindows(getWindow(), true);
|
||||||
|
insetsController.show(WindowInsetsCompat.Type.navigationBars());
|
||||||
|
insetsController.show(WindowInsetsCompat.Type.statusBars());
|
||||||
|
insetsController.setSystemBarsBehavior(
|
||||||
|
WindowInsetsControllerCompat.BEHAVIOR_DEFAULT);
|
||||||
|
} else {
|
||||||
|
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
|
||||||
|
insetsController.hide(WindowInsetsCompat.Type.navigationBars());
|
||||||
|
insetsController.hide(WindowInsetsCompat.Type.statusBars());
|
||||||
|
insetsController.setSystemBarsBehavior(
|
||||||
|
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setPortraitPlayerBottomSheetPeekHeight(int peekHeight) {
|
||||||
|
FrameLayout bottomSheet = findViewById(R.id.player_bottom_sheet);
|
||||||
|
BottomSheetBehavior<FrameLayout> behavior =
|
||||||
|
BottomSheetBehavior.from(bottomSheet);
|
||||||
|
|
||||||
|
int newPeekPx = (int) (peekHeight * getResources().getDisplayMetrics().density);
|
||||||
|
behavior.setPeekHeight(newPeekPx);
|
||||||
|
}
|
||||||
|
|
||||||
private void initService() {
|
private void initService() {
|
||||||
MediaManager.check(getMediaBrowserListenableFuture());
|
MediaManager.check(getMediaBrowserListenableFuture());
|
||||||
|
|
||||||
|
|
@ -570,4 +650,4 @@ public class MainActivity extends BaseActivity {
|
||||||
|
|
||||||
MediaManager.playDownloadedMediaItem(getMediaBrowserListenableFuture(), mediaItem);
|
MediaManager.playDownloadedMediaItem(getMediaBrowserListenableFuture(), mediaItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -83,7 +83,7 @@ public class DownloadFragment extends Fragment implements ClickCallback {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
initializeMediaBrowser();
|
initializeMediaBrowser();
|
||||||
activity.setBottomNavigationBarVisibility(true);
|
activity.toggleBottomNavigationBarVisibilityOnOrientationChange();
|
||||||
activity.setBottomSheetVisibility(true);
|
activity.setBottomSheetVisibility(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,18 +21,26 @@ import com.cappielloantonio.tempo.R
|
||||||
import com.cappielloantonio.tempo.service.EqualizerManager
|
import com.cappielloantonio.tempo.service.EqualizerManager
|
||||||
import com.cappielloantonio.tempo.service.BaseMediaService
|
import com.cappielloantonio.tempo.service.BaseMediaService
|
||||||
import com.cappielloantonio.tempo.service.MediaService
|
import com.cappielloantonio.tempo.service.MediaService
|
||||||
|
import com.cappielloantonio.tempo.ui.activity.MainActivity
|
||||||
import com.cappielloantonio.tempo.util.Preferences
|
import com.cappielloantonio.tempo.util.Preferences
|
||||||
|
|
||||||
class EqualizerFragment : Fragment() {
|
class EqualizerFragment : Fragment() {
|
||||||
|
|
||||||
|
private lateinit var activity: MainActivity
|
||||||
private var equalizerManager: EqualizerManager? = null
|
private var equalizerManager: EqualizerManager? = null
|
||||||
private lateinit var eqBandsContainer: LinearLayout
|
private lateinit var eqBandsContainer: LinearLayout
|
||||||
private lateinit var eqSwitch: Switch
|
private lateinit var eqSwitch: Switch
|
||||||
private lateinit var resetButton: Button
|
private lateinit var resetButton: Button
|
||||||
private lateinit var safeSpace: Space
|
private lateinit var safeSpace: Space
|
||||||
private val bandSeekBars = mutableListOf<SeekBar>()
|
private val bandSeekBars = mutableListOf<SeekBar>()
|
||||||
|
|
||||||
private var receiverRegistered = false
|
private var receiverRegistered = false
|
||||||
|
|
||||||
|
@OptIn(UnstableApi::class)
|
||||||
|
override fun onAttach(context: Context) {
|
||||||
|
super.onAttach(context)
|
||||||
|
activity = requireActivity() as MainActivity
|
||||||
|
}
|
||||||
|
|
||||||
private val equalizerUpdatedReceiver = object : BroadcastReceiver() {
|
private val equalizerUpdatedReceiver = object : BroadcastReceiver() {
|
||||||
@OptIn(UnstableApi::class)
|
@OptIn(UnstableApi::class)
|
||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
|
|
@ -73,6 +81,8 @@ class EqualizerFragment : Fragment() {
|
||||||
)
|
)
|
||||||
receiverRegistered = true
|
receiverRegistered = true
|
||||||
}
|
}
|
||||||
|
val showBottomBar = !Preferences.getHideBottomNavbarOnPortrait()
|
||||||
|
activity.setBottomNavigationBarVisibility(showBottomBar)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class HomeFragment extends Fragment {
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
activity.setBottomNavigationBarVisibility(true);
|
activity.toggleBottomNavigationBarVisibilityOnOrientationChange();
|
||||||
activity.setBottomSheetVisibility(true);
|
activity.setBottomSheetVisibility(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ public class LibraryFragment extends Fragment implements ClickCallback {
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
initializeMediaBrowser();
|
initializeMediaBrowser();
|
||||||
activity.setBottomNavigationBarVisibility(true);
|
activity.toggleBottomNavigationBarVisibilityOnOrientationChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,8 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
activity.setBottomNavigationBarVisibility(false);
|
activity.setBottomNavigationBarVisibility(false);
|
||||||
activity.setBottomSheetVisibility(false);
|
activity.setBottomSheetVisibility(false);
|
||||||
|
activity.setNavigationDrawerLock(true);
|
||||||
|
activity.setSystemBarsVisibility(!activity.isLandscape);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -167,6 +169,8 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
activity.setBottomSheetVisibility(true);
|
activity.setBottomSheetVisibility(true);
|
||||||
|
activity.toggleNavigationDrawerLockOnOrientationChange();
|
||||||
|
activity.setSystemBarsVisibility(!activity.isLandscape);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ object Preferences {
|
||||||
private const val IMAGE_CACHE_SIZE = "image_cache_size"
|
private const val IMAGE_CACHE_SIZE = "image_cache_size"
|
||||||
private const val STREAMING_CACHE_SIZE = "streaming_cache_size"
|
private const val STREAMING_CACHE_SIZE = "streaming_cache_size"
|
||||||
private const val LANDSCAPE_ITEMS_PER_ROW = "landscape_items_per_row"
|
private const val LANDSCAPE_ITEMS_PER_ROW = "landscape_items_per_row"
|
||||||
|
private const val ENABLE_DRAWER_ON_PORTRAIT = "enable_drawer_on_portrait"
|
||||||
|
private const val HIDE_BOTTOM_NAVBAR_ON_PORTRAIT = "hide_bottom_navbar_on_portrait"
|
||||||
private const val IMAGE_SIZE = "image_size"
|
private const val IMAGE_SIZE = "image_size"
|
||||||
private const val MAX_BITRATE_WIFI = "max_bitrate_wifi"
|
private const val MAX_BITRATE_WIFI = "max_bitrate_wifi"
|
||||||
private const val MAX_BITRATE_MOBILE = "max_bitrate_mobile"
|
private const val MAX_BITRATE_MOBILE = "max_bitrate_mobile"
|
||||||
|
|
@ -310,6 +312,16 @@ object Preferences {
|
||||||
return App.getInstance().preferences.getString(LANDSCAPE_ITEMS_PER_ROW, "4")!!.toInt()
|
return App.getInstance().preferences.getString(LANDSCAPE_ITEMS_PER_ROW, "4")!!.toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getEnableDrawerOnPortrait(): Boolean {
|
||||||
|
return App.getInstance().preferences.getBoolean(ENABLE_DRAWER_ON_PORTRAIT, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getHideBottomNavbarOnPortrait(): Boolean {
|
||||||
|
return App.getInstance().preferences.getBoolean(HIDE_BOTTOM_NAVBAR_ON_PORTRAIT, false)
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getImageSize(): Int {
|
fun getImageSize(): Int {
|
||||||
return App.getInstance().preferences.getString(IMAGE_SIZE, "-1")!!.toInt()
|
return App.getInstance().preferences.getString(IMAGE_SIZE, "-1")!!.toInt()
|
||||||
|
|
|
||||||
23
app/src/main/res/drawable/ic_albums.xml
Normal file
23
app/src/main/res/drawable/ic_albums.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M2,17.4V2.6C2,2.269 2.269,2 2.6,2H17.4C17.731,2 18,2.269 18,2.6V17.4C18,17.731 17.731,18 17.4,18H2.6C2.269,18 2,17.731 2,17.4Z"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M8,22H21.4C21.731,22 22,21.731 22,21.4V8"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M11,12.5C11,13.328 10.328,14 9.5,14C8.672,14 8,13.328 8,12.5C8,11.672 8.672,11 9.5,11C10.328,11 11,11.672 11,12.5ZM11,12.5V6.6C11,6.269 11.269,6 11.6,6H13"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
32
app/src/main/res/drawable/ic_artists.xml
Normal file
32
app/src/main/res/drawable/ic_artists.xml
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M1,20V19C1,15.134 4.134,12 8,12V12C11.866,12 15,15.134 15,19V20"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M13,14V14C13,11.239 15.239,9 18,9V9C20.761,9 23,11.239 23,14V14.5"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M8,12C10.209,12 12,10.209 12,8C12,5.791 10.209,4 8,4C5.791,4 4,5.791 4,8C4,10.209 5.791,12 8,12Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M18,9C19.657,9 21,7.657 21,6C21,4.343 19.657,3 18,3C16.343,3 15,4.343 15,6C15,7.657 16.343,9 18,9Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
11
app/src/main/res/drawable/ic_genres.xml
Normal file
11
app/src/main/res/drawable/ic_genres.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="49dp"
|
||||||
|
android:height="49dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M3,17.4V6.6C3,6.269 3.269,6 3.6,6H16.679C16.879,6 17.067,6.1 17.178,6.267L20.778,11.667C20.913,11.869 20.913,12.131 20.778,12.333L17.178,17.733C17.067,17.9 16.879,18 16.679,18H3.6C3.269,18 3,17.731 3,17.4Z"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"/>
|
||||||
|
</vector>
|
||||||
33
app/src/main/res/drawable/ic_playlist.xml
Normal file
33
app/src/main/res/drawable/ic_playlist.xml
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="49dp"
|
||||||
|
android:height="49dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M2,11L16,11"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M2,17L13,17"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M2,5L20,5"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M20,18.5C20,19.328 19.328,20 18.5,20C17.672,20 17,19.328 17,18.5C17,17.672 17.672,17 18.5,17C19.328,17 20,17.672 20,18.5ZM20,18.5V10.6C20,10.269 20.269,10 20.6,10H22"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.drawerlayout.widget.DrawerLayout
|
||||||
|
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"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
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">
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
android:id="@+id/drawer_layout"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent">
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
@ -18,19 +17,17 @@
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
android:id="@+id/bottom_navigation_frame"
|
||||||
android:layout_width="55dp"
|
android:layout_width="55dp"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
android:id="@+id/bottom_navigation"
|
android:id="@+id/bottom_navigation"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="55dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:paddingStart="0dp"
|
|
||||||
android:paddingEnd="68dp"
|
|
||||||
android:rotation="90"
|
android:rotation="90"
|
||||||
app:menu="@menu/bottom_nav_menu" />
|
app:menu="@menu/bottom_nav_menu" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<androidx.fragment.app.FragmentContainerView
|
||||||
|
|
@ -41,7 +38,6 @@
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
app:defaultNavHost="true"
|
app:defaultNavHost="true"
|
||||||
app:navGraph="@navigation/nav_graph" />
|
app:navGraph="@navigation/nav_graph" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
|
@ -51,9 +47,16 @@
|
||||||
app:behavior_hideable="true"
|
app:behavior_hideable="true"
|
||||||
app:behavior_peekHeight="@dimen/bottom_sheet_peek_height"
|
app:behavior_peekHeight="@dimen/bottom_sheet_peek_height"
|
||||||
app:layout_behavior="@string/bottom_sheet_behavior" />
|
app:layout_behavior="@string/bottom_sheet_behavior" />
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.navigation.NavigationView
|
||||||
|
android:id="@+id/nav_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
app:menu="@menu/nav_drawer"
|
||||||
|
app:headerLayout="@layout/nav_drawer_header" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/offline_mode_text_view"
|
android:id="@+id/offline_mode_text_view"
|
||||||
style="@style/NoConnectionTextView"
|
style="@style/NoConnectionTextView"
|
||||||
|
|
@ -63,5 +66,4 @@
|
||||||
android:text="@string/activity_info_offline_mode"
|
android:text="@string/activity_info_offline_mode"
|
||||||
android:textSize="6sp"
|
android:textSize="6sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
</androidx.drawerlayout.widget.DrawerLayout>
|
||||||
</LinearLayout>
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.drawerlayout.widget.DrawerLayout
|
||||||
|
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"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
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">
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
android:id="@+id/drawer_layout"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent">
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:id="@+id/nav_host_fragment"
|
android:id="@+id/nav_host_fragment"
|
||||||
|
|
@ -35,11 +35,31 @@
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:paddingStart="24dp"
|
android:paddingStart="24dp"
|
||||||
android:paddingEnd="24dp"
|
android:paddingEnd="24dp"
|
||||||
android:visibility="gone"
|
|
||||||
app:menu="@menu/bottom_nav_menu" />
|
app:menu="@menu/bottom_nav_menu" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This FrameLayout id is always called,
|
||||||
|
if removed the app crashes
|
||||||
|
-->
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/bottom_navigation_frame"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:clickable="false"
|
||||||
|
android:focusable="false" />
|
||||||
|
|
||||||
|
<com.google.android.material.navigation.NavigationView
|
||||||
|
android:id="@+id/nav_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
app:menu="@menu/nav_drawer"
|
||||||
|
app:headerLayout="@layout/nav_drawer_header" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/offline_mode_text_view"
|
android:id="@+id/offline_mode_text_view"
|
||||||
style="@style/NoConnectionTextView"
|
style="@style/NoConnectionTextView"
|
||||||
|
|
@ -47,8 +67,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/activity_info_offline_mode"
|
android:text="@string/activity_info_offline_mode"
|
||||||
android:textSize="12sp"
|
android:textSize="6sp"
|
||||||
android:textStyle="bold"
|
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
</androidx.drawerlayout.widget.DrawerLayout>
|
||||||
</LinearLayout>
|
|
||||||
|
|
|
||||||
31
app/src/main/res/layout/nav_drawer_header.xml
Normal file
31
app/src/main/res/layout/nav_drawer_header.xml
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="28dp"
|
||||||
|
android:paddingTop="30dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="28dp"
|
||||||
|
android:layout_height="28dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:background="@drawable/ic_toolbar_tempo" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/HeadlineMedium"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
|
android:text="@string/app_name" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
60
app/src/main/res/menu/nav_drawer.xml
Normal file
60
app/src/main/res/menu/nav_drawer.xml
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/searchFragment"
|
||||||
|
android:icon="@drawable/ic_search"
|
||||||
|
android:title="@string/menu_search_button" />
|
||||||
|
|
||||||
|
<item android:title="Index" >
|
||||||
|
<menu>
|
||||||
|
<item
|
||||||
|
android:id="@+id/homeFragment"
|
||||||
|
android:icon="@drawable/ic_home"
|
||||||
|
android:title="@string/menu_home_label" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/libraryFragment"
|
||||||
|
android:icon="@drawable/ic_graphic_eq"
|
||||||
|
android:title="@string/menu_library_label" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/downloadFragment"
|
||||||
|
android:icon="@drawable/ic_play_for_work"
|
||||||
|
android:title="@string/menu_download_label" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/settingsFragment"
|
||||||
|
android:icon="@drawable/ic_settings"
|
||||||
|
android:title="@string/menu_settings_button" />
|
||||||
|
</menu>
|
||||||
|
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item android:title="All" >
|
||||||
|
<menu>
|
||||||
|
<item
|
||||||
|
android:id="@+id/albumCatalogueFragment"
|
||||||
|
android:icon="@drawable/ic_albums"
|
||||||
|
android:title="Albums" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/artistCatalogueFragment"
|
||||||
|
android:icon="@drawable/ic_artists"
|
||||||
|
android:title="Artists" />
|
||||||
|
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/genreCatalogueFragment"
|
||||||
|
android:icon="@drawable/ic_genres"
|
||||||
|
android:title="Genres" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/playlistCatalogueFragment"
|
||||||
|
android:icon="@drawable/ic_playlist"
|
||||||
|
android:title="Playlists"
|
||||||
|
android:defaultValue="ALL"/>
|
||||||
|
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
|
</menu>
|
||||||
|
|
@ -220,6 +220,10 @@
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_playlistCatalogueFragment_to_playlistPageFragment"
|
android:id="@+id/action_playlistCatalogueFragment_to_playlistPageFragment"
|
||||||
app:destination="@id/playlistPageFragment" />
|
app:destination="@id/playlistPageFragment" />
|
||||||
|
<argument
|
||||||
|
android:name="playlist_all"
|
||||||
|
app:argType="string"
|
||||||
|
android:defaultValue="ALL" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
|
|
|
||||||
|
|
@ -386,6 +386,10 @@
|
||||||
<string name="settings_show_mini_shuffle_button_summary">If enabled, show the shuffle button, remove the heart in the mini player</string>
|
<string name="settings_show_mini_shuffle_button_summary">If enabled, show the shuffle button, remove the heart in the mini player</string>
|
||||||
<string name="settings_radio">Show radio</string>
|
<string name="settings_radio">Show radio</string>
|
||||||
<string name="settings_radio_summary">If enabled, show the radio section. Restart the app for it to take full effect.</string>
|
<string name="settings_radio_summary">If enabled, show the radio section. Restart the app for it to take full effect.</string>
|
||||||
|
<string name="settings_enable_drawer_on_landscape">Enable drawer on portrait [Experimental]</string>
|
||||||
|
<string name="settings_enable_drawer_on_landscape_summary">Unlocks the lateral landscape menu drawer on portrait. The changes will take effect on restart.</string>
|
||||||
|
<string name="settings_hide_bottom_navbar_on_portrait">Hide bottom navbar on portrait [Experimental]</string>
|
||||||
|
<string name="settings_hide_bottom_navbar_on_portrait_summary">Experimental.Increases vertical space by removing the bottom navbar. The changes will take effect on restart.</string>
|
||||||
<string name="settings_auto_download_lyrics">Auto download lyrics</string>
|
<string name="settings_auto_download_lyrics">Auto download lyrics</string>
|
||||||
<string name="settings_auto_download_lyrics_summary">Automatically save lyrics when they are available so they can be shown while offline.</string>
|
<string name="settings_auto_download_lyrics_summary">Automatically save lyrics when they are available so they can be shown while offline.</string>
|
||||||
<string name="settings_replay_gain">Set replay gain mode</string>
|
<string name="settings_replay_gain">Set replay gain mode</string>
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,16 @@
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="always_on_display" />
|
android:key="always_on_display" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:title="@string/settings_enable_drawer_on_landscape"
|
||||||
|
android:key="enable_drawer_on_portrait"
|
||||||
|
android:summary="@string/settings_enable_drawer_on_landscape_summary"/>
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:title="@string/settings_hide_bottom_navbar_on_portrait"
|
||||||
|
android:key="hide_bottom_navbar_on_portrait"
|
||||||
|
android:summary="@string/settings_hide_bottom_navbar_on_portrait_summary"/>
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue