mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 15:27:55 -04:00
Added persistent fullscreen
The app will reopen in fullscreen if it is stopped while in this mode.
This commit is contained in:
parent
8cf7599d04
commit
8605c0cdf2
@ -108,6 +108,8 @@ public class KiwixMobileActivity extends AppCompatActivity
|
|||||||
|
|
||||||
private static final String PREF_ZOOM_ENABLED = "pref_zoom_enabled";
|
private static final String PREF_ZOOM_ENABLED = "pref_zoom_enabled";
|
||||||
|
|
||||||
|
private static final String PREF_FULLSCREEN = "pref_fullscreen";
|
||||||
|
|
||||||
private static final int REQUEST_FILE_SELECT = 1234;
|
private static final int REQUEST_FILE_SELECT = 1234;
|
||||||
|
|
||||||
private static final int REQUEST_PREFERENCES = 1235;
|
private static final int REQUEST_PREFERENCES = 1235;
|
||||||
@ -266,7 +268,6 @@ public class KiwixMobileActivity extends AppCompatActivity
|
|||||||
drawerToggle.syncState();
|
drawerToggle.syncState();
|
||||||
|
|
||||||
mCompatCallback = new CompatFindActionModeCallback(this);
|
mCompatCallback = new CompatFindActionModeCallback(this);
|
||||||
mIsFullscreenOpened = false;
|
|
||||||
mContentFrame = (FrameLayout) findViewById(R.id.content_frame);
|
mContentFrame = (FrameLayout) findViewById(R.id.content_frame);
|
||||||
newTab();
|
newTab();
|
||||||
|
|
||||||
@ -461,6 +462,10 @@ public class KiwixMobileActivity extends AppCompatActivity
|
|||||||
int classicScreenFlag = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
|
int classicScreenFlag = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
|
||||||
getWindow().addFlags(fullScreenFlag);
|
getWindow().addFlags(fullScreenFlag);
|
||||||
getWindow().clearFlags(classicScreenFlag);
|
getWindow().clearFlags(classicScreenFlag);
|
||||||
|
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
|
editor.putBoolean(PREF_FULLSCREEN, true);
|
||||||
|
editor.commit();
|
||||||
mIsFullscreenOpened = true;
|
mIsFullscreenOpened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,6 +479,10 @@ public class KiwixMobileActivity extends AppCompatActivity
|
|||||||
int classicScreenFlag = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
|
int classicScreenFlag = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
|
||||||
getWindow().clearFlags(fullScreenFlag);
|
getWindow().clearFlags(fullScreenFlag);
|
||||||
getWindow().addFlags(classicScreenFlag);
|
getWindow().addFlags(classicScreenFlag);
|
||||||
|
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
|
editor.putBoolean(PREF_FULLSCREEN, false);
|
||||||
|
editor.commit();
|
||||||
mIsFullscreenOpened = false;
|
mIsFullscreenOpened = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -913,6 +922,9 @@ public class KiwixMobileActivity extends AppCompatActivity
|
|||||||
if (requestInitAllMenuItems) {
|
if (requestInitAllMenuItems) {
|
||||||
initAllMenuItems();
|
initAllMenuItems();
|
||||||
}
|
}
|
||||||
|
if (mIsFullscreenOpened) {
|
||||||
|
openFullScreen();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -940,6 +952,7 @@ public class KiwixMobileActivity extends AppCompatActivity
|
|||||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
boolean nightMode = sharedPreferences.getBoolean(PREF_NIGHTMODE, false);
|
boolean nightMode = sharedPreferences.getBoolean(PREF_NIGHTMODE, false);
|
||||||
mIsBacktotopEnabled = sharedPreferences.getBoolean(PREF_BACKTOTOP, false);
|
mIsBacktotopEnabled = sharedPreferences.getBoolean(PREF_BACKTOTOP, false);
|
||||||
|
mIsFullscreenOpened = sharedPreferences.getBoolean(PREF_FULLSCREEN, false);
|
||||||
boolean isZoomEnabled = sharedPreferences.getBoolean(PREF_ZOOM_ENABLED, false);
|
boolean isZoomEnabled = sharedPreferences.getBoolean(PREF_ZOOM_ENABLED, false);
|
||||||
|
|
||||||
if (isZoomEnabled) {
|
if (isZoomEnabled) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user