remove unnecessary attribute isLandscape

This commit is contained in:
adbenitez
2023-10-22 19:07:05 +02:00
parent 676e79a43f
commit d2d1a0edb4
3 changed files with 4 additions and 9 deletions
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isLandscape">true</bool>
</resources>
-1
View File
@@ -265,7 +265,6 @@
<attr name="compact" format="boolean" />
</declare-styleable>
<bool name="isLandscape">false</bool>
<!-- if the device is big enough (ex. a tablet) -->
<bool name="isBigScreen">false</bool>
</resources>
@@ -106,7 +106,7 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
// enter fullscreen mode if necessary,
// this is needed here because if the app is opened while already in landscape mode, onConfigurationChanged() is not triggered
setScreenMode();
setScreenMode(getResources().getConfiguration());
webView.setWebChromeClient(new WebChromeClient() {
@Override
@@ -212,13 +212,13 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
Log.i(TAG, "onConfigurationChanged(" + newConfig.orientation + ")");
super.onConfigurationChanged(newConfig);
// orientation might have changed, enter/exit fullscreen mode if needed
setScreenMode();
setScreenMode(newConfig);
}
private void setScreenMode() {
private void setScreenMode(Configuration config) {
// enter/exit fullscreen mode depending on orientation (landscape/portrait),
// on tablets there is enough height so fullscreen mode is never enabled there
boolean enable = getResources().getBoolean(R.bool.isLandscape) && !getResources().getBoolean(R.bool.isBigScreen);
boolean enable = config.orientation == Configuration.ORIENTATION_LANDSCAPE && !getResources().getBoolean(R.bool.isBigScreen);
getWindow().getDecorView().setSystemUiVisibility(enable? View.SYSTEM_UI_FLAG_FULLSCREEN : 0);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {