Switch back to non-transparent navigation bar (#6111)

This commit is contained in:
ByteHamster 2022-11-27 12:42:42 +01:00 committed by GitHub
parent 3973f450be
commit 6c4c51994d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 88 additions and 32 deletions

View File

@ -18,6 +18,7 @@ import android.widget.EditText;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import androidx.core.view.WindowCompat; import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsCompat; import androidx.core.view.WindowInsetsCompat;
@ -114,6 +115,12 @@ public class MainActivity extends CastEnabledActivity {
navDrawer = findViewById(R.id.navDrawerFragment); navDrawer = findViewById(R.id.navDrawerFragment);
setNavDrawerSize(); setNavDrawerSize();
// Consume navigation bar insets - we apply them in setPlayerVisible()
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main_view), (v, insets) ->
new WindowInsetsCompat.Builder(insets)
.setInsets(WindowInsetsCompat.Type.navigationBars(), Insets.NONE)
.build());
final FragmentManager fm = getSupportFragmentManager(); final FragmentManager fm = getSupportFragmentManager();
if (fm.findFragmentByTag(MAIN_FRAGMENT_TAG) == null) { if (fm.findFragmentByTag(MAIN_FRAGMENT_TAG) == null) {
if (!UserPreferences.DEFAULT_PAGE_REMEMBER.equals(UserPreferences.getDefaultPage())) { if (!UserPreferences.DEFAULT_PAGE_REMEMBER.equals(UserPreferences.getDefaultPage())) {

View File

@ -42,6 +42,7 @@ import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler; import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
import de.danoeh.antennapod.view.EmptyViewHandler; import de.danoeh.antennapod.view.EmptyViewHandler;
import de.danoeh.antennapod.view.EpisodeItemListRecyclerView; import de.danoeh.antennapod.view.EpisodeItemListRecyclerView;
import de.danoeh.antennapod.view.LiftOnScrollListener;
import de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder; import de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
@ -139,6 +140,7 @@ public class SearchFragment extends Fragment {
} }
}; };
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
recyclerView.addOnScrollListener(new LiftOnScrollListener(layout.findViewById(R.id.appbar)));
RecyclerView recyclerViewFeeds = layout.findViewById(R.id.recyclerViewFeeds); RecyclerView recyclerViewFeeds = layout.findViewById(R.id.recyclerViewFeeds);
LinearLayoutManager layoutManagerFeeds = new LinearLayoutManager(getActivity()); LinearLayoutManager layoutManagerFeeds = new LinearLayoutManager(getActivity());

View File

@ -4,17 +4,25 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.AppBarLayout
android:id="@+id/toolbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize" android:fitsSystemWindows="true"
android:theme="?attr/actionBarTheme" android:elevation="0dp">
app:title="@string/add_feed_label"
app:navigationIcon="?homeAsUpIndicator" /> <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:title="@string/add_feed_label"
app:navigationIcon="?homeAsUpIndicator" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -4,25 +4,32 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.AppBarLayout
android:id="@+id/toolbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:minHeight="?attr/actionBarSize" android:fitsSystemWindows="true"
android:orientation="horizontal" android:elevation="0dp">
android:theme="?attr/actionBarTheme"
app:navigationIcon="?homeAsUpIndicator" <com.google.android.material.appbar.MaterialToolbar
app:title="@string/discover" /> android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:title="@string/discover"
app:navigationIcon="?homeAsUpIndicator" />
</com.google.android.material.appbar.AppBarLayout>
<GridView <GridView
android:id="@+id/gridView" android:id="@+id/gridView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@id/toolbar" android:layout_below="@id/appbar"
android:clipToPadding="false" android:clipToPadding="false"
android:columnWidth="400dp" android:columnWidth="400dp"
android:gravity="center" android:gravity="center"

View File

@ -3,23 +3,31 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.AppBarLayout
android:id="@+id/toolbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize" android:fitsSystemWindows="true"
android:theme="?attr/actionBarTheme" android:elevation="0dp">
app:navigationIcon="?homeAsUpIndicator"
app:title="@string/search_label" /> <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:title="@string/search_label"
app:navigationIcon="?homeAsUpIndicator" />
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.chip.Chip <com.google.android.material.chip.Chip
android:id="@+id/feed_title_chip" android:id="@+id/feed_title_chip"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/toolbar" android:layout_below="@id/appbar"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="0dp" android:layout_marginRight="0dp"
android:visibility="gone" android:visibility="gone"

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light">
<!-- To make icons visible -->
<item name="android:statusBarColor">@color/grey600</item>
<item name="android:navigationBarColor">@color/grey600</item>
</style>
</resources>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
<!-- To make icons visible -->
<item name="android:navigationBarColor">@color/grey600</item>
</style>
</resources>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:navigationBarColor">@color/background_light</item>
<item name="android:navigationBarDividerColor">@color/navigation_bar_divider_light</item>
<item name="android:windowLightNavigationBar">true</item>
</style>
</resources>

View File

@ -25,6 +25,7 @@
<color name="non_square_icon_background">#22777777</color> <color name="non_square_icon_background">#22777777</color>
<color name="seek_background_light">#90000000</color> <color name="seek_background_light">#90000000</color>
<color name="seek_background_dark">#905B5B5B</color> <color name="seek_background_dark">#905B5B5B</color>
<color name="navigation_bar_divider_light">#1F000000</color>
<color name="accent_light">#0078C2</color> <color name="accent_light">#0078C2</color>
<color name="accent_light_alpha">#250078C2</color> <color name="accent_light_alpha">#250078C2</color>

View File

@ -36,10 +36,6 @@
<item name="icon_gray">#25365A</item> <item name="icon_gray">#25365A</item>
<item name="android:splitMotionEvents">false</item> <item name="android:splitMotionEvents">false</item>
<item name="android:fitsSystemWindows">false</item> <item name="android:fitsSystemWindows">false</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
<item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item> <item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item>
</style> </style>
@ -80,10 +76,9 @@
<item name="android:splitMotionEvents">false</item> <item name="android:splitMotionEvents">false</item>
<item name="android:fitsSystemWindows">false</item> <item name="android:fitsSystemWindows">false</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item> <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item> <item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">false</item>
<item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item> <item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">@color/background_darktheme</item>
</style> </style>
<style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack"> <style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack">
@ -104,6 +99,7 @@
<item name="android:actionBarStyle">@color/black</item> <item name="android:actionBarStyle">@color/black</item>
<item name="background_elevated">@color/black</item> <item name="background_elevated">@color/black</item>
<item name="android:textColorHint">@color/medium_gray</item> <item name="android:textColorHint">@color/medium_gray</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">@color/black</item>
</style> </style>
<style name="Theme.AntennaPod.Light.NoTitle" parent="Theme.AntennaPod.Light"> <style name="Theme.AntennaPod.Light.NoTitle" parent="Theme.AntennaPod.Light">