void applyFullscreen(boolean alreadyStarted) { boolean hasActionBar = ActionBarCompat.earlyHasActionBar(); cachedFullscreen = prefs.getBoolean(FULLSCREEN_KEY, false); if (cachedFullscreen) { if (hasActionBar) { handler.post( new Runnable() { public void run() { actionBarCompat.lightsOut(getWindow(), gameView, true); } }); } else if (alreadyStarted) { // This is the only way to change the theme if (!startedFullscreen) restartOnResume = true; } else { setTheme(android.R.style.Theme_NoTitleBar_Fullscreen); } } else { if (hasActionBar) { final boolean fAlreadyStarted = alreadyStarted; handler.post( new Runnable() { public void run() { actionBarCompat.lightsOut(getWindow(), gameView, false); // This shouldn't be necessary but is on Galaxy Tab 10.1 if (fAlreadyStarted && startedFullscreen) restartOnResume = true; } }); } else if (alreadyStarted && startedFullscreen) { // This is the only way to change the theme restartOnResume = true; } // else leave it as default non-fullscreen } }
void startGame(final int which, final String savedGame) { Log.d( TAG, "startGame: " + which + ", " + ((savedGame == null) ? "null" : (savedGame.length() + " bytes"))); if (progress != null) { Log.e(TAG, "startGame while already starting!"); return; } showProgress((savedGame == null) ? R.string.starting : R.string.resuming); if (gameRunning) { gameView.clear(); stopNative(); solveEnabled = false; changedState(false, false); customVisible = false; setStatusBarVisibility(false); } if (ActionBarCompat.earlyHasActionBar() && !prefs.getBoolean(UNDO_REDO_KBD_KEY, false)) { maybeUndoRedo = ""; } setKeys("", SmallKeyboard.ARROWS_LEFT_RIGHT_CLICK); if (typeMenu != null) for (Integer i : gameTypes.keySet()) typeMenu.removeItem(i); gameTypes.clear(); gameRunning = true; gameView.keysHandled = 0; (worker = new Thread("startGame") { public void run() { init(gameView, which, savedGame); if (!gameRunning) return; // stopNative or abort was called helpTopic = htmlHelpTopic(); handler.obtainMessage(MsgType.DONE.ordinal(), htmlHelpTopic()).sendToTarget(); } }) .start(); }