diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-11-11 16:23:02 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-11-11 16:23:02 +0000 |
commit | 101690f75dc56452bdd568053ac44921ce3dae4e (patch) | |
tree | 83a7a0eec246b1fe2fe5fc2a5624b9fa080cc0a6 /app | |
parent | aa8d0c49c18cf2e6b44f4ee9424742862f101825 (diff) | |
download | infinity-for-reddit-101690f75dc56452bdd568053ac44921ce3dae4e.tar infinity-for-reddit-101690f75dc56452bdd568053ac44921ce3dae4e.tar.gz infinity-for-reddit-101690f75dc56452bdd568053ac44921ce3dae4e.tar.bz2 infinity-for-reddit-101690f75dc56452bdd568053ac44921ce3dae4e.tar.lz infinity-for-reddit-101690f75dc56452bdd568053ac44921ce3dae4e.tar.xz infinity-for-reddit-101690f75dc56452bdd568053ac44921ce3dae4e.tar.zst infinity-for-reddit-101690f75dc56452bdd568053ac44921ce3dae4e.zip |
Fix bottom app bar in ViewSubredditDetailActivity displaying under nav bar.
Diffstat (limited to '')
3 files changed, 17 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java index 478a717c..2d9c17d9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java @@ -239,7 +239,7 @@ public abstract class BaseActivity extends AppCompatActivity { } public int getNavBarHeight() { - if (getDefaultSharedPreferences().getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY, false)) { + if (isImmersiveInterfaceApplicable && immersiveInterface && getDefaultSharedPreferences().getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY, false)) { return 0; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java index 857392ef..cdd6787c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java @@ -6,11 +6,13 @@ import android.content.SharedPreferences; import android.content.res.ColorStateList; import android.os.Build; import android.os.Bundle; +import android.util.DisplayMetrics; import android.view.Gravity; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.view.ViewTreeObserver; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; @@ -255,6 +257,19 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); params.bottomMargin += navBarHeight; fab.setLayoutParams(params); + coordinatorLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + coordinatorLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); + + DisplayMetrics displayMetrics = new DisplayMetrics(); + getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + if (displayMetrics.heightPixels == coordinatorLayout.getHeight()) { + linearLayoutBottomAppBar.setPadding(0, + linearLayoutBottomAppBar.getPaddingTop(), 0, navBarHeight); + } + } + }); showToast = true; } diff --git a/app/src/main/res/layout/activity_view_subreddit_detail.xml b/app/src/main/res/layout/activity_view_subreddit_detail.xml index 4b58eb6d..6020b138 100644 --- a/app/src/main/res/layout/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout/activity_view_subreddit_detail.xml @@ -239,6 +239,7 @@ android:background="?attr/selectableItemBackgroundBorderless" /> </LinearLayout> + </com.google.android.material.bottomappbar.BottomAppBar> <com.google.android.material.floatingactionbutton.FloatingActionButton |