From a524b810603a78afc6503d01e6aeb788ea14401a Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 7 Aug 2022 11:25:51 +0200 Subject: Expand app below system windows --- .../danoeh/antennapod/activity/MainActivity.java | 20 +- app/src/main/res/layout/addfeed.xml | 1 + app/src/main/res/layout/audioplayer_fragment.xml | 469 +++++++++++---------- app/src/main/res/layout/episodes_list_fragment.xml | 3 +- .../main/res/layout/feed_item_list_fragment.xml | 3 +- app/src/main/res/layout/feedinfo.xml | 3 +- .../main/res/layout/feeditem_pager_fragment.xml | 33 +- app/src/main/res/layout/feedsettings.xml | 40 +- app/src/main/res/layout/fragment_itunes_search.xml | 3 +- app/src/main/res/layout/fragment_subscriptions.xml | 3 +- app/src/main/res/layout/nav_list.xml | 15 +- app/src/main/res/layout/queue_fragment.xml | 1 + app/src/main/res/layout/search_fragment.xml | 3 +- app/src/main/res/layout/share_episode_dialog.xml | 7 +- app/src/main/res/layout/swipeactions_row.xml | 10 +- 15 files changed, 325 insertions(+), 289 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index 6abecef57..450a99873 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -19,6 +19,9 @@ import android.widget.EditText; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBarDrawerToggle; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowCompat; +import androidx.core.view.WindowInsetsCompat; import com.google.android.material.appbar.MaterialToolbar; import androidx.core.content.ContextCompat; import androidx.drawerlayout.widget.DrawerLayout; @@ -104,6 +107,7 @@ public class MainActivity extends CastEnabledActivity { if (savedInstanceState != null) { ensureGeneratedViewIdGreaterThan(savedInstanceState.getInt(KEY_GENERATED_VIEW_ID, 0)); } + WindowCompat.setDecorFitsSystemWindows(getWindow(), false); super.onCreate(savedInstanceState); setContentView(R.layout.main); recycledViewPool.setMaxRecycledViews(R.id.view_type_episode_item, 25); @@ -144,11 +148,17 @@ public class MainActivity extends CastEnabledActivity { PreferenceUpgrader.checkUpgrades(this); View bottomSheet = findViewById(R.id.audioplayerFragment); sheetBehavior = (LockableBottomSheetBehavior) BottomSheetBehavior.from(bottomSheet); - sheetBehavior.setPeekHeight((int) getResources().getDimension(R.dimen.external_player_height)); sheetBehavior.setHideable(false); sheetBehavior.setBottomSheetCallback(bottomSheetCallback); } + @Override + public void onAttachedToWindow() { + super.onAttachedToWindow(); + int playerHeight = (int) getResources().getDimension(R.dimen.external_player_height); + sheetBehavior.setPeekHeight(playerHeight + getBottomInset()); + } + /** * View.generateViewId stores the current ID in a static variable. * When the process is killed, the variable gets reset. @@ -238,6 +248,11 @@ public class MainActivity extends CastEnabledActivity { return sheetBehavior; } + private int getBottomInset() { + WindowInsetsCompat insets = ViewCompat.getRootWindowInsets(getWindow().getDecorView()); + return insets == null ? 0 : insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + } + public void setPlayerVisible(boolean visible) { getBottomSheet().setLocked(!visible); if (visible) { @@ -247,7 +262,8 @@ public class MainActivity extends CastEnabledActivity { } FragmentContainerView mainView = findViewById(R.id.main_view); ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mainView.getLayoutParams(); - params.setMargins(0, 0, 0, visible ? (int) getResources().getDimension(R.dimen.external_player_height) : 0); + int externalPlayerHeight = (int) getResources().getDimension(R.dimen.external_player_height); + params.setMargins(0, 0, 0, getBottomInset() + (visible ? externalPlayerHeight : 0)); mainView.setLayoutParams(params); findViewById(R.id.audioplayerFragment).setVisibility(visible ? View.VISIBLE : View.GONE); } diff --git a/app/src/main/res/layout/addfeed.xml b/app/src/main/res/layout/addfeed.xml index 26bc9aa21..30c1a463d 100644 --- a/app/src/main/res/layout/addfeed.xml +++ b/app/src/main/res/layout/addfeed.xml @@ -4,6 +4,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" + android:fitsSystemWindows="true" android:orientation="vertical"> - - - - + android:layout_height="match_parent" + android:fitsSystemWindows="true"> - - - - - + android:layout_alignParentTop="true" + android:minHeight="?attr/actionBarSize" + android:theme="?attr/actionBarTheme" + app:navigationContentDescription="@string/toolbar_back_button_content_description" + app:navigationIcon="@drawable/ic_arrow_down" /> - - - - - + android:layout_height="0dp" + android:layout_above="@id/playtime_layout" + android:layout_below="@id/toolbar" + android:layout_marginBottom="12dp" + android:foreground="?android:windowContentOverlay" + android:orientation="vertical" /> - + android:layout_height="8dp" + android:layout_alignBottom="@id/pager" + android:importantForAccessibility="no" + app:srcCompat="@drawable/bg_gradient" + app:tint="?android:attr/windowBackground" /> - + + android:gravity="center" + android:paddingLeft="24dp" + android:paddingTop="4dp" + android:paddingRight="24dp" + android:paddingBottom="4dp" + android:textColor="@color/white" + android:textSize="16sp" + tools:text="1:06:29" /> - + - + android:layout_alignParentBottom="true" + android:layoutDirection="ltr" + android:orientation="vertical"> - + - + - + - + - + + + android:layout_marginBottom="24dp"> - + - + - + - + + + + + + + + + + + + + - + - + - + - + diff --git a/app/src/main/res/layout/episodes_list_fragment.xml b/app/src/main/res/layout/episodes_list_fragment.xml index 7ad7e5d21..bfe7581fe 100644 --- a/app/src/main/res/layout/episodes_list_fragment.xml +++ b/app/src/main/res/layout/episodes_list_fragment.xml @@ -9,7 +9,8 @@ + android:layout_height="wrap_content" + android:fitsSystemWindows="true"> + android:layout_height="match_parent" + android:fitsSystemWindows="true"> + android:layout_height="match_parent" + android:fitsSystemWindows="true"> + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fitsSystemWindows="true" + android:orientation="vertical"> + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" + android:theme="?attr/actionBarTheme" + app:navigationContentDescription="@string/toolbar_back_button_content_description" + app:navigationIcon="?homeAsUpIndicator" /> + android:id="@+id/pager" + android:layout_width="match_parent" + android:layout_height="match_parent" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/feedsettings.xml b/app/src/main/res/layout/feedsettings.xml index beadf7c75..b9a220a02 100644 --- a/app/src/main/res/layout/feedsettings.xml +++ b/app/src/main/res/layout/feedsettings.xml @@ -1,25 +1,27 @@ - + + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" + android:theme="?attr/actionBarTheme" + android:elevation="4dp" + app:title="@string/feed_settings_label" + app:navigationContentDescription="@string/toolbar_back_button_content_description" + app:navigationIcon="?homeAsUpIndicator" /> + android:id="@+id/settings_fragment_container" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/fragment_itunes_search.xml b/app/src/main/res/layout/fragment_itunes_search.xml index 35472fbde..369928d1d 100644 --- a/app/src/main/res/layout/fragment_itunes_search.xml +++ b/app/src/main/res/layout/fragment_itunes_search.xml @@ -4,7 +4,8 @@ xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:fitsSystemWindows="true"> + android:layout_height="wrap_content" + android:fitsSystemWindows="true"> - + + + android:layout_centerVertical="true" + style="?android:attr/progressBarStyle" /> + diff --git a/app/src/main/res/layout/queue_fragment.xml b/app/src/main/res/layout/queue_fragment.xml index 9bc4e0fa5..0845044f0 100644 --- a/app/src/main/res/layout/queue_fragment.xml +++ b/app/src/main/res/layout/queue_fragment.xml @@ -10,6 +10,7 @@ android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" + android:fitsSystemWindows="true" android:elevation="0dp"> + android:layout_height="match_parent" + android:fitsSystemWindows="true"> - + android:layout_height="wrap_content" + android:layout_marginVertical="8dp" /> - + android:layout_height="wrap_content" /> - + android:layout_height="wrap_content" /> -- cgit v1.2.3