From 9b65b27d56b6c0b9ab16f4bd801fb856f13ae213 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Fri, 23 Oct 2020 22:56:15 +0800 Subject: Fix immersive interface in ViewMultiRedditDetailActivity on Android 11. --- .../Activity/ViewMultiRedditDetailActivity.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java index b2280232..1af66861 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java @@ -6,6 +6,7 @@ import android.os.Build; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; +import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.Toast; @@ -121,7 +122,13 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT } if (isImmersiveInterface()) { - window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + coordinatorLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); + } else { + window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); + } adjustToolbar(toolbar); } } -- cgit v1.2.3