diff options
Diffstat (limited to 'Source/Android/app/src')
5 files changed, 54 insertions, 123 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index 090e22a1bb..3ec233a117 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -6,7 +6,6 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.os.Bundle; -import android.os.Handler; import android.preference.PreferenceManager; import android.text.TextUtils; import android.util.SparseIntArray; @@ -62,7 +61,6 @@ public final class EmulationActivity extends AppCompatActivity private static final String BACKSTACK_NAME_SUBMENU = "submenu"; public static final int REQUEST_CHANGE_DISC = 1; - private View mDecorView; private EmulationFragment mEmulationFragment; private SharedPreferences mPreferences; @@ -85,7 +83,6 @@ public final class EmulationActivity extends AppCompatActivity private int mPlatform; private String[] mPaths; private static boolean sUserPausedEmulation; - private boolean backPressedOnce = false; public static final String EXTRA_SELECTED_GAMES = "SelectedGames"; public static final String EXTRA_SELECTED_TITLE = "SelectedTitle"; @@ -317,33 +314,10 @@ public final class EmulationActivity extends AppCompatActivity mDeviceHasTouchScreen = getPackageManager().hasSystemFeature("android.hardware.touchscreen"); mMotionListener = new MotionListener(this); - int themeId; - if (mDeviceHasTouchScreen) - { - themeId = R.style.DolphinEmulationBase; - - // Get a handle to the Window containing the UI. - mDecorView = getWindow().getDecorView(); - mDecorView.setOnSystemUiVisibilityChangeListener(visibility -> - { - if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) - { - // Go back to immersive fullscreen mode in 3s - Handler handler = new Handler(getMainLooper()); - handler.postDelayed(this::enableFullscreenImmersive, 3000 /* 3s */); - } - }); - // Set these options now so that the SurfaceView the game renders into is the right size. - enableFullscreenImmersive(); - Toast.makeText(this, getString(R.string.emulation_touch_button_help), Toast.LENGTH_LONG) - .show(); - } - else - { - themeId = R.style.DolphinEmulationTvBase; - } + // Set these options now so that the SurfaceView the game renders into is the right size. + enableFullscreenImmersive(); - setTheme(themeId); + Toast.makeText(this, getString(R.string.emulation_menu_help), Toast.LENGTH_LONG).show(); Rumble.initRumble(this); @@ -360,10 +334,7 @@ public final class EmulationActivity extends AppCompatActivity .commit(); } - if (mDeviceHasTouchScreen) - { - setTitle(mSelectedTitle); - } + setTitle(mSelectedTitle); } @Override @@ -391,9 +362,19 @@ public final class EmulationActivity extends AppCompatActivity } @Override + public void onWindowFocusChanged(boolean hasFocus) + { + if (hasFocus) + { + enableFullscreenImmersive(); + } + } + + @Override protected void onResume() { super.onResume(); + if (!sIsGameCubeGame && mPreferences.getInt("motionControlsEnabled", 0) != 2) mMotionListener.enable(); } @@ -414,28 +395,11 @@ public final class EmulationActivity extends AppCompatActivity @Override public void onBackPressed() { - if (!mDeviceHasTouchScreen) + boolean popResult = getSupportFragmentManager().popBackStackImmediate( + BACKSTACK_NAME_SUBMENU, FragmentManager.POP_BACK_STACK_INCLUSIVE); + if (!popResult) { - boolean popResult = getSupportFragmentManager().popBackStackImmediate( - BACKSTACK_NAME_SUBMENU, FragmentManager.POP_BACK_STACK_INCLUSIVE); - if (!popResult) - { - toggleMenu(); - } - } - else - { - if (backPressedOnce) - { - mEmulationFragment.stopEmulation(); - finish(); - } - else - { - backPressedOnce = true; - Toast.makeText(this, "Press back again to exit", Toast.LENGTH_LONG).show(); - new Handler().postDelayed(() -> backPressedOnce = false, 3000); - } + toggleMenu(); } } @@ -459,14 +423,13 @@ public final class EmulationActivity extends AppCompatActivity private void enableFullscreenImmersive() { - // It would be nice to use IMMERSIVE_STICKY, but that doesn't show the toolbar. - mDecorView.setSystemUiVisibility( + getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | - View.SYSTEM_UI_FLAG_IMMERSIVE); + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } private void updateOrientation() @@ -631,19 +594,12 @@ public final class EmulationActivity extends AppCompatActivity NativeLibrary.LoadState(9); return; - // TV Menu only case MENU_ACTION_SAVE_ROOT: - if (!mDeviceHasTouchScreen) - { - showSubMenu(SaveLoadStateFragment.SaveOrLoad.SAVE); - } + showSubMenu(SaveLoadStateFragment.SaveOrLoad.SAVE); return; case MENU_ACTION_LOAD_ROOT: - if (!mDeviceHasTouchScreen) - { - showSubMenu(SaveLoadStateFragment.SaveOrLoad.LOAD); - } + showSubMenu(SaveLoadStateFragment.SaveOrLoad.LOAD); return; // Save state slots @@ -718,9 +674,9 @@ public final class EmulationActivity extends AppCompatActivity return; case MENU_ACTION_EXIT: - // ATV menu is built using a fragment, this will pop that fragment before emulation ends. - if (TvUtil.isLeanback(getApplicationContext())) - toggleMenu(); // Hide the menu (it will be showing since we just clicked it) + // Hide the menu (it will be showing since we just clicked it) + toggleMenu(); + mEmulationFragment.stopEmulation(); finish(); return; diff --git a/Source/Android/app/src/main/res/layout-television/activity_emulation.xml b/Source/Android/app/src/main/res/layout-television/activity_emulation.xml deleted file mode 100644 index 5e516d04ad..0000000000 --- a/Source/Android/app/src/main/res/layout-television/activity_emulation.xml +++ /dev/null @@ -1,38 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:keepScreenOn="true" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/frame_content"> - - <FrameLayout - android:id="@+id/frame_emulation_fragment" - android:layout_width="match_parent" - android:layout_height="match_parent"/> - - <org.dolphinemu.dolphinemu.ui.NVidiaShieldWorkaroundView - android:layout_width="match_parent" - android:layout_height="match_parent"/> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="horizontal" - android:baselineAligned="false"> - - <FrameLayout - android:id="@+id/frame_menu" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight=".25" - tools:layout="@layout/fragment_ingame_menu"/> - - <FrameLayout - android:id="@+id/frame_submenu" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight=".75"/> - - </LinearLayout> - -</FrameLayout> diff --git a/Source/Android/app/src/main/res/layout/activity_emulation.xml b/Source/Android/app/src/main/res/layout/activity_emulation.xml index 2ebea4fc34..5e516d04ad 100644 --- a/Source/Android/app/src/main/res/layout/activity_emulation.xml +++ b/Source/Android/app/src/main/res/layout/activity_emulation.xml @@ -1,6 +1,8 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" + android:keepScreenOn="true" + xmlns:tools="http://schemas.android.com/tools" android:id="@+id/frame_content"> <FrameLayout @@ -8,4 +10,29 @@ android:layout_width="match_parent" android:layout_height="match_parent"/> + <org.dolphinemu.dolphinemu.ui.NVidiaShieldWorkaroundView + android:layout_width="match_parent" + android:layout_height="match_parent"/> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal" + android:baselineAligned="false"> + + <FrameLayout + android:id="@+id/frame_menu" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight=".25" + tools:layout="@layout/fragment_ingame_menu"/> + + <FrameLayout + android:id="@+id/frame_submenu" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight=".75"/> + + </LinearLayout> + </FrameLayout> diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 1ced8c6969..033f279b4b 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -355,7 +355,7 @@ <string name="emulation_control_joystick_rel_center">Relative Stick Center</string> <string name="emulation_control_rumble">Rumble</string> <string name="emulation_choose_controller">Choose Controller</string> - <string name="emulation_touch_button_help">Swipe down from the top of the screen to access the menu.</string> + <string name="emulation_menu_help">Press Back to access the menu.</string> <string name="emulation_touch_overlay_reset">Reset Overlay</string> <string name="emulation_ir_group">Touch IR Pointer</string> <string name="emulation_ir_sensitivity">IR Sensitivity</string> diff --git a/Source/Android/app/src/main/res/values/styles.xml b/Source/Android/app/src/main/res/values/styles.xml index 8a292d4113..5bb491c418 100644 --- a/Source/Android/app/src/main/res/values/styles.xml +++ b/Source/Android/app/src/main/res/values/styles.xml @@ -29,21 +29,7 @@ <style name="DolphinDialogBase" parent="Theme.AppCompat.DayNight.Dialog.Alert" /> - <style name="DolphinEmulationBase" parent="Theme.AppCompat.DayNight.DarkActionBar"> - <item name="colorPrimary">@color/dolphin_blue</item> - <item name="colorPrimaryDark">@color/dolphin_blue_dark</item> - <item name="colorAccent">@color/dolphin_purple</item> - <item name="android:windowTranslucentNavigation">true</item> - - <item name="android:windowBackground">@android:color/black</item> - - <!-- Enable window content transitions --> - <item name="android:windowContentTransitions">true</item> - <item name="android:windowAllowEnterTransitionOverlap">true</item> - <item name="android:windowAllowReturnTransitionOverlap">true</item> - </style> - - <style name="DolphinEmulationTvBase" parent="Theme.AppCompat.DayNight.NoActionBar"> + <style name="DolphinEmulationBase" parent="Theme.AppCompat.DayNight.NoActionBar"> <item name="colorPrimary">@color/dolphin_blue</item> <item name="colorPrimaryDark">@color/dolphin_blue_dark</item> <item name="colorAccent">@color/dolphin_purple</item> |
