aboutsummaryrefslogtreecommitdiff
path: root/RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java
diff options
context:
space:
mode:
Diffstat (limited to 'RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java')
-rw-r--r--RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java30
1 files changed, 22 insertions, 8 deletions
diff --git a/RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java b/RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java
index 0e417b4..4b8844d 100644
--- a/RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java
+++ b/RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java
@@ -31,14 +31,15 @@ import androidx.fragment.app.Fragment;
*/
public class RotaryMenu extends Fragment {
- private Fragment mRotaryCards = null;
- private Fragment mRotaryGrid = null;
- private Fragment mDirectManipulation = null;
- private Fragment mSysUiDirectManipulation = null;
- private Fragment mNotificationFragment = null;
- private Fragment mScrollFragment = null;
- private Fragment mWebViewFragment = null;
- private Fragment mCustomFocusAreasFragment = null;
+ private Fragment mRotaryCards;
+ private Fragment mRotaryGrid;
+ private Fragment mDirectManipulation;
+ private Fragment mSysUiDirectManipulation;
+ private Fragment mNotificationFragment;
+ private Fragment mScrollFragment;
+ private Fragment mWebViewFragment;
+ private Fragment mCustomFocusAreasFragment;
+ private Fragment mSurfaceViewFragment;
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@@ -93,6 +94,12 @@ public class RotaryMenu extends Fragment {
showCustomFocusAreasFragment();
});
+ Button surfaceViewButton = view.findViewById(R.id.surface_view);
+ surfaceViewButton.setOnClickListener(v -> {
+ selectTab(v);
+ showSurfaceViewFragment();
+ });
+
return view;
}
@@ -162,6 +169,13 @@ public class RotaryMenu extends Fragment {
showFragment(mCustomFocusAreasFragment);
}
+ private void showSurfaceViewFragment() {
+ if (mSurfaceViewFragment == null) {
+ mSurfaceViewFragment = new SurfaceViewFragment();
+ }
+ showFragment(mSurfaceViewFragment);
+ }
+
private void showFragment(Fragment fragment) {
getFragmentManager().beginTransaction()
.replace(R.id.rotary_content, fragment)