From aa3fed2b0ad98a0dd2301171dbd32ff64a02b218 Mon Sep 17 00:00:00 2001 From: izzy2lost Date: Mon, 22 Sep 2025 02:29:07 -0400 Subject: [PATCH] Add PiP button to right drawer and make it scrollable - Add Picture-in-Picture button with picture_in_picture_alt_24px icon and 'PIP' text - Make right navigation drawer scrollable by wrapping in ScrollView - Wire up PiP button functionality to enter Picture-in-Picture mode - Position PiP button between Saves and Exit Game for logical flow - Maintains consistent styling with other drawer buttons Features: - Users can now easily access PiP mode from the right drawer - Right drawer is now scrollable to accommodate more buttons - PiP button automatically closes drawer and enters PiP mode - Consistent Material Design theming with brand primary colors --- .../java/com/izzy2lost/psx2/MainActivity.java | 14 +++++++ .../drawable/picture_in_picture_alt_24px.xml | 11 ++++++ .../res/layout/drawer_right_quick_actions.xml | 37 +++++++++++++++++-- 3 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 app/src/main/res/drawable/picture_in_picture_alt_24px.xml diff --git a/app/src/main/java/com/izzy2lost/psx2/MainActivity.java b/app/src/main/java/com/izzy2lost/psx2/MainActivity.java index 58d9a30..d9fd14a 100644 --- a/app/src/main/java/com/izzy2lost/psx2/MainActivity.java +++ b/app/src/main/java/com/izzy2lost/psx2/MainActivity.java @@ -2231,6 +2231,20 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF }); } + // Picture-in-Picture button + View btnPip = rightDrawer.findViewById(R.id.right_drawer_btn_pip); + if (btnPip != null) { + btnPip.setOnClickListener(v -> { + try { + // Close right drawer first + DrawerLayout drawer = findViewById(R.id.drawer_layout); + if (drawer != null) drawer.closeDrawer(androidx.core.view.GravityCompat.END); + // Enter Picture-in-Picture mode + enterPictureInPictureMode(); + } catch (Throwable ignored) {} + }); + } + // Exit Game button (pause + open games) View btnExitGame = rightDrawer.findViewById(R.id.right_drawer_btn_exit_game); if (btnExitGame != null) { diff --git a/app/src/main/res/drawable/picture_in_picture_alt_24px.xml b/app/src/main/res/drawable/picture_in_picture_alt_24px.xml new file mode 100644 index 0000000..558d24e --- /dev/null +++ b/app/src/main/res/drawable/picture_in_picture_alt_24px.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/layout/drawer_right_quick_actions.xml b/app/src/main/res/layout/drawer_right_quick_actions.xml index 6f31275..bd7ecdd 100644 --- a/app/src/main/res/layout/drawer_right_quick_actions.xml +++ b/app/src/main/res/layout/drawer_right_quick_actions.xml @@ -1,10 +1,15 @@ - + + @@ -70,6 +75,31 @@ app:iconSize="24dp" app:rippleColor="@color/brand_primary" /> + + + - \ No newline at end of file + +