diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-05-03 14:50:20 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-05-03 14:50:20 +0000 |
commit | 3c1ecfdee0937d7294b12ec79ba6f60d320fa17d (patch) | |
tree | b236675912608e127b2e2759a6794a485b32fe9e /app/src/main/java/ml/docilealligator/infinityforreddit | |
parent | 6c837186887059cf159352ba6d0dd0f841537fc2 (diff) | |
download | infinity-for-reddit-3c1ecfdee0937d7294b12ec79ba6f60d320fa17d.tar infinity-for-reddit-3c1ecfdee0937d7294b12ec79ba6f60d320fa17d.tar.gz infinity-for-reddit-3c1ecfdee0937d7294b12ec79ba6f60d320fa17d.tar.bz2 infinity-for-reddit-3c1ecfdee0937d7294b12ec79ba6f60d320fa17d.tar.lz infinity-for-reddit-3c1ecfdee0937d7294b12ec79ba6f60d320fa17d.tar.xz infinity-for-reddit-3c1ecfdee0937d7294b12ec79ba6f60d320fa17d.tar.zst infinity-for-reddit-3c1ecfdee0937d7294b12ec79ba6f60d320fa17d.zip |
Fix https://github.com/Docile-Alligator/Infinity-For-Reddit/issues/1414
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java index 07840a95..f819fe17 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java @@ -44,6 +44,10 @@ import androidx.appcompat.app.AppCompatDelegate; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; +import androidx.core.graphics.Insets; +import androidx.core.view.OnApplyWindowInsetsListener; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.ExoPlayer; @@ -343,19 +347,18 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe dataSavingModeDefaultResolution = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.REDDIT_VIDEO_DEFAULT_RESOLUTION, "360")); if (!mSharedPreferences.getBoolean(SharedPreferencesUtils.VIDEO_PLAYER_IGNORE_NAV_BAR, false)) { - if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) { - //Set player controller bottom margin in order to display it above the navbar - int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); - LinearLayout controllerLinearLayout = findViewById(R.id.linear_layout_exo_playback_control_view); - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) controllerLinearLayout.getLayoutParams(); - params.bottomMargin = resources.getDimensionPixelSize(resourceId); - } else { - //Set player controller right margin in order to display it above the navbar - int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); - LinearLayout controllerLinearLayout = findViewById(R.id.linear_layout_exo_playback_control_view); - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) controllerLinearLayout.getLayoutParams(); - params.rightMargin = resources.getDimensionPixelSize(resourceId); - } + LinearLayout controllerLinearLayout = findViewById(R.id.linear_layout_exo_playback_control_view); + ViewCompat.setOnApplyWindowInsetsListener(controllerLinearLayout, new OnApplyWindowInsetsListener() { + @NonNull + @Override + public WindowInsetsCompat onApplyWindowInsets(@NonNull View v, @NonNull WindowInsetsCompat insets) { + Insets systemBar = insets.getInsets(WindowInsetsCompat.Type.systemBars()); + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) controllerLinearLayout.getLayoutParams(); + params.bottomMargin = systemBar.bottom; + params.rightMargin = systemBar.right; + return WindowInsetsCompat.CONSUMED; + } + }); } haulerView.setOnDragDismissedListener(dragDirection -> { |