Try to fix fullscreen

This commit is contained in:
tehcneko committed 2022-01-23 20:54:34 +08:00
1 parent 967f74ea06
commit 270fa52220
3 files changed
+24 -5

No files matched your search

@@ -387,12 +387,14 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
mGalleryProvider.setGLRoot(mGLRootView);
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
insetsController = ViewCompat.getWindowInsetsController(getWindow().getDecorView());
insetsController = WindowCompat.getInsetsController(getWindow(), getWindow().getDecorView());
if (insetsController != null) {
if (Settings.getReadingFullscreen()) {
insetsController.setSystemBarsBehavior(WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
// This does not hide navigation bar sometimes on 31, framework bug???
insetsController.hide(WindowInsetsCompat.Type.systemBars());
} else {
insetsController.setSystemBarsBehavior(WindowInsetsControllerCompat.BEHAVIOR_SHOW_BARS_BY_TOUCH);
insetsController.show(WindowInsetsCompat.Type.systemBars());
}
boolean night = ConfigurationKt.isNight(getResources().getConfiguration());
@@ -24,6 +24,7 @@ import android.widget.LinearLayout;
import android.widget.SeekBar;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.hippo.ehviewer.R;
import com.hippo.yorozuya.ViewUtils;
@@ -35,14 +36,31 @@ public class SeekBarPanel extends LinearLayout {
public SeekBarPanel(Context context) {
super(context);
init();
}
public SeekBarPanel(Context context, AttributeSet attrs) {
public SeekBarPanel(Context context, @Nullable @org.jetbrains.annotations.Nullable AttributeSet attrs) {
super(context, attrs);
init();
}
public SeekBarPanel(Context context, AttributeSet attrs, int defStyleAttr) {
public SeekBarPanel(Context context, @Nullable @org.jetbrains.annotations.Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public SeekBarPanel(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}
private void init() {
post(() -> {
var rootWindowInsets = getRootWindowInsets();
if (rootWindowInsets != null) {
setPadding(0, 0, 0, rootWindowInsets.getSystemWindowInsetBottom());
}
});
}
@Override