mirror of
https://github.com/izzy2lost/PSX2.git
synced 2026-07-05 15:18:36 -07:00
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
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:autoMirrored="true">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M160,800Q127,800 103.5,776.5Q80,753 80,720L80,240Q80,207 103.5,183.5Q127,160 160,160L800,160Q833,160 856.5,183.5Q880,207 880,240L880,720Q880,753 856.5,776.5Q833,800 800,800L160,800ZM160,720L800,720Q800,720 800,720Q800,720 800,720L800,240Q800,240 800,240Q800,240 800,240L160,240Q160,240 160,240Q160,240 160,240L160,720Q160,720 160,720Q160,720 160,720ZM160,720Q160,720 160,720Q160,720 160,720L160,240Q160,240 160,240Q160,240 160,240L160,240Q160,240 160,240Q160,240 160,240L160,720Q160,720 160,720Q160,720 160,720ZM440,680L760,680L760,440L440,440L440,680ZM520,600L520,520L680,520L680,600L520,600Z"/>
|
||||
</vector>
|
||||
@@ -1,10 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/colorSurface"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="32dp">
|
||||
|
||||
<!-- Header -->
|
||||
@@ -70,6 +75,31 @@
|
||||
app:iconSize="24dp"
|
||||
app:rippleColor="@color/brand_primary" />
|
||||
|
||||
<!-- Picture-in-Picture -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/right_drawer_btn_pip"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="PIP"
|
||||
android:textColor="@android:color/white"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="16sp"
|
||||
android:gravity="start|center_vertical"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="24dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
app:icon="@drawable/picture_in_picture_alt_24px"
|
||||
app:iconTint="@color/brand_primary"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="16dp"
|
||||
app:iconSize="24dp"
|
||||
app:rippleColor="@color/brand_primary" />
|
||||
|
||||
<!-- Exit Game -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/right_drawer_btn_exit_game"
|
||||
@@ -151,4 +181,5 @@
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
Reference in New Issue
Block a user