From 989ca351d2978b8f455261fb6e1711a454894636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Villegas?= Date: Tue, 3 Feb 2026 15:03:34 -0300 Subject: [PATCH] feat: add landscape layout to song listing views This includes the playlist page and the album page. --- .../tempo/ui/activity/MainActivity.java | 19 +- .../ui/adapter/SongHorizontalAdapter.java | 4 +- .../main/res/drawable/ic_graphic_eq_land.xml | 14 + app/src/main/res/drawable/ic_home_land.xml | 14 + .../res/drawable/ic_play_for_work_land.xml | 14 + .../main/res/layout-land/activity_main.xml | 68 ++++ .../res/layout-land/fragment_album_page.xml | 301 ++++++++++++++++++ .../layout-land/fragment_playlist_page.xml | 214 +++++++++++++ .../main/res/menu-land/bottom_nav_menu.xml | 15 + 9 files changed, 661 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable/ic_graphic_eq_land.xml create mode 100644 app/src/main/res/drawable/ic_home_land.xml create mode 100644 app/src/main/res/drawable/ic_play_for_work_land.xml create mode 100644 app/src/main/res/layout-land/activity_main.xml create mode 100644 app/src/main/res/layout-land/fragment_album_page.xml create mode 100644 app/src/main/res/layout-land/fragment_playlist_page.xml create mode 100644 app/src/main/res/menu-land/bottom_nav_menu.xml diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/activity/MainActivity.java b/app/src/main/java/com/cappielloantonio/tempo/ui/activity/MainActivity.java index 1a75b242..3509175f 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/activity/MainActivity.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/activity/MainActivity.java @@ -2,6 +2,8 @@ package com.cappielloantonio.tempo.ui.activity; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; +import android.graphics.Rect; import android.content.IntentFilter; import android.net.ConnectivityManager; import android.net.NetworkInfo; @@ -11,6 +13,7 @@ import android.os.Handler; import android.text.TextUtils; import android.util.Log; import android.view.View; +import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.core.splashscreen.SplashScreen; @@ -62,6 +65,7 @@ public class MainActivity extends BaseActivity { private BottomNavigationView bottomNavigationView; public NavController navController; private BottomSheetBehavior bottomSheetBehavior; + private boolean isLandscape = false; private AssetLinkNavigator assetLinkNavigator; private AssetLinkUtil.AssetLink pendingAssetLink; @@ -85,6 +89,8 @@ public class MainActivity extends BaseActivity { connectivityStatusBroadcastReceiver = new ConnectivityStatusBroadcastReceiver(this); connectivityStatusReceiverManager(true); + isLandscape = (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE); + init(); checkConnectionType(); getOpenSubsonicExtensions(); @@ -141,6 +147,15 @@ public class MainActivity extends BaseActivity { } else { goToLogin(); } + + // Set bottom navigation height + if (isLandscape) { + ViewGroup.LayoutParams layoutParams = bottomNavigationView.getLayoutParams(); + Rect windowRect = new Rect(); + bottomNavigationView.getWindowVisibleDisplayFrame(windowRect); + layoutParams.width = windowRect.height(); + bottomNavigationView.setLayoutParams(layoutParams); + } } // BOTTOM SHEET/NAVIGATION @@ -215,7 +230,9 @@ public class MainActivity extends BaseActivity { @Override public void onSlide(@NonNull View view, float slideOffset) { animateBottomSheet(slideOffset); - animateBottomNavigation(slideOffset, navigationHeight); + if (!isLandscape) { + animateBottomNavigation(slideOffset, navigationHeight); + } } }; diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/SongHorizontalAdapter.java b/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/SongHorizontalAdapter.java index 1d78f2ea..6e5eefe4 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/SongHorizontalAdapter.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/SongHorizontalAdapter.java @@ -173,10 +173,12 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_home_land.xml b/app/src/main/res/drawable/ic_home_land.xml new file mode 100644 index 00000000..9aad448a --- /dev/null +++ b/app/src/main/res/drawable/ic_home_land.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_play_for_work_land.xml b/app/src/main/res/drawable/ic_play_for_work_land.xml new file mode 100644 index 00000000..29ab2950 --- /dev/null +++ b/app/src/main/res/drawable/ic_play_for_work_land.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml new file mode 100644 index 00000000..25ee0493 --- /dev/null +++ b/app/src/main/res/layout-land/activity_main.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-land/fragment_album_page.xml b/app/src/main/res/layout-land/fragment_album_page.xml new file mode 100644 index 00000000..f957caa5 --- /dev/null +++ b/app/src/main/res/layout-land/fragment_album_page.xml @@ -0,0 +1,301 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +