use isBigScreen and isLandscape attrs

This commit is contained in:
adbenitez
2023-09-25 13:17:55 +02:00
parent 287e1d25b0
commit b4fe0b30e7
4 changed files with 6 additions and 7 deletions
+1 -2
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- in small devices (e.i. not tablets) in landscape height is low, better enter fullscreen -->
<bool name="webxdcFullscreen">true</bool>
<bool name="isLandscape">true</bool>
</resources>
+1 -2
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- if the device is big enough (ex. a tablet), there is no need to enter fullscreen -->
<bool name="webxdcFullscreen">false</bool>
<bool name="isBigScreen">true</bool>
</resources>
+3 -2
View File
@@ -258,6 +258,7 @@
<attr name="compact" format="boolean" />
</declare-styleable>
<!-- in portrait mode there is enough height, no need to enter fullscreen -->
<bool name="webxdcFullscreen">false</bool>
<bool name="isLandscape">false</bool>
<!-- if the device is big enough (ex. a tablet) -->
<bool name="isBigScreen">false</bool>
</resources>
@@ -214,7 +214,7 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
private void setScreenMode() {
// enter/exit fullscreen mode depending on orientation (landscape/portrait),
// on tablets there is enought height so fullscreen mode is never enabled there
boolean enable = getResources().getBoolean(R.bool.webxdcFullscreen);
boolean enable = getResources().getBoolean(R.bool.isLandscape) && !getResources().getBoolean(R.bool.isBigScreen);
getWindow().getDecorView().setSystemUiVisibility(enable? View.SYSTEM_UI_FLAG_FULLSCREEN : 0);
if (enable) {
getSupportActionBar().hide();