diff options
Diffstat (limited to 'RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java')
-rw-r--r-- | RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java b/RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java index fd3baa8..048686e 100644 --- a/RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java +++ b/RotaryPlayground/src/com/android/car/rotaryplayground/RotaryMenu.java @@ -37,6 +37,7 @@ public class RotaryMenu extends Fragment { private Fragment mSysUiDirectManipulation = null; private Fragment mNotificationFragment = null; private Fragment mScrollFragment = null; + private Fragment mWebViewFragment = null; @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @@ -56,18 +57,16 @@ public class RotaryMenu extends Fragment { }); Button directManipulationButton = view.findViewById(R.id.direct_manipulation); - directManipulationButton.setOnClickListener( - (v -> { - selectTab(v); - showDirectManipulationExamples(); - })); + directManipulationButton.setOnClickListener(v -> { + selectTab(v); + showDirectManipulationExamples(); + }); Button sysUiDirectManipulationButton = view.findViewById(R.id.sys_ui_direct_manipulation); - sysUiDirectManipulationButton.setOnClickListener( - (v -> { - selectTab(v); - showSysUiDirectManipulationExamples(); - })); + sysUiDirectManipulationButton.setOnClickListener(v -> { + selectTab(v); + showSysUiDirectManipulationExamples(); + }); Button notificationButton = view.findViewById(R.id.notification); notificationButton.setOnClickListener(v -> { @@ -81,6 +80,12 @@ public class RotaryMenu extends Fragment { showScrollFragment(); }); + Button webViewButton = view.findViewById(R.id.web_view); + webViewButton.setOnClickListener(v -> { + selectTab(v); + showWebViewFragment(); + }); + return view; } @@ -136,6 +141,13 @@ public class RotaryMenu extends Fragment { showFragment(mScrollFragment); } + private void showWebViewFragment() { + if (mWebViewFragment == null) { + mWebViewFragment = new WebViewFragment(); + } + showFragment(mWebViewFragment); + } + private void showFragment(Fragment fragment) { getFragmentManager().beginTransaction() .replace(R.id.rotary_content, fragment) |