diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-11-12 02:18:22 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-11-12 02:18:22 +0000 |
commit | f9834f644c15b0b9e3be4c83a580506aec30ccfe (patch) | |
tree | e1f53152454a0aa90616279f4dcfea5aea5b19ee | |
parent | 101690f75dc56452bdd568053ac44921ce3dae4e (diff) | |
download | infinity-for-reddit-f9834f644c15b0b9e3be4c83a580506aec30ccfe.tar infinity-for-reddit-f9834f644c15b0b9e3be4c83a580506aec30ccfe.tar.gz infinity-for-reddit-f9834f644c15b0b9e3be4c83a580506aec30ccfe.tar.bz2 infinity-for-reddit-f9834f644c15b0b9e3be4c83a580506aec30ccfe.tar.lz infinity-for-reddit-f9834f644c15b0b9e3be4c83a580506aec30ccfe.tar.xz infinity-for-reddit-f9834f644c15b0b9e3be4c83a580506aec30ccfe.tar.zst infinity-for-reddit-f9834f644c15b0b9e3be4c83a580506aec30ccfe.zip |
Get actual screen height in ViewSubredditDetailActivity.
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java | 10 |
1 files changed, 6 insertions, 4 deletions
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 cdd6787c..fd7f23a5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java @@ -4,9 +4,10 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.ColorStateList; +import android.graphics.Point; import android.os.Build; import android.os.Bundle; -import android.util.DisplayMetrics; +import android.view.Display; import android.view.Gravity; import android.view.KeyEvent; import android.view.Menu; @@ -262,9 +263,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp public void onGlobalLayout() { coordinatorLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); - DisplayMetrics displayMetrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - if (displayMetrics.heightPixels == coordinatorLayout.getHeight()) { + Display display = getWindowManager().getDefaultDisplay(); + Point size = new Point(); + display.getRealSize(size); + if (size.y == coordinatorLayout.getHeight()) { linearLayoutBottomAppBar.setPadding(0, linearLayoutBottomAppBar.getPaddingTop(), 0, navBarHeight); } |