Improve search bar design on add podcast screen (#7249)

* Improve search bar design on add podcast screen

The search bar now looks more up to date with modern android styles.

* Fix colorPrimaryContainer in default color schemes

The color should be usable as the background for containers with a tint
of the accent color, but it was set to the full accent color.
Now it is much more in line with how it should work.
This commit is contained in:
flofriday 2024-07-01 12:25:36 +02:00 committed by GitHub
parent e51b0a3695
commit 2b7ed4055f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 63 additions and 53 deletions

View File

@ -19,6 +19,8 @@ import androidx.activity.result.contract.ActivityResultContracts.GetContent;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import androidx.core.widget.NestedScrollView;
import androidx.documentfile.provider.DocumentFile; import androidx.documentfile.provider.DocumentFile;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
@ -39,6 +41,7 @@ import de.danoeh.antennapod.net.discovery.PodcastIndexPodcastSearcher;
import de.danoeh.antennapod.ui.appstartintent.OnlineFeedviewActivityStarter; import de.danoeh.antennapod.ui.appstartintent.OnlineFeedviewActivityStarter;
import de.danoeh.antennapod.ui.discovery.OnlineSearchFragment; import de.danoeh.antennapod.ui.discovery.OnlineSearchFragment;
import de.danoeh.antennapod.ui.screen.feed.FeedItemlistFragment; import de.danoeh.antennapod.ui.screen.feed.FeedItemlistFragment;
import de.danoeh.antennapod.ui.view.LiftOnScrollListener;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
@ -77,6 +80,9 @@ public class AddFeedFragment extends Fragment {
} }
((MainActivity) getActivity()).setupToolbarToggle(viewBinding.toolbar, displayUpArrow); ((MainActivity) getActivity()).setupToolbarToggle(viewBinding.toolbar, displayUpArrow);
NestedScrollView scrollView = viewBinding.getRoot().findViewById(R.id.scrollView);
scrollView.setOnScrollChangeListener(new LiftOnScrollListener(viewBinding.appbar));
viewBinding.searchItunesButton.setOnClickListener(v viewBinding.searchItunesButton.setOnClickListener(v
-> activity.loadChildFragment(OnlineSearchFragment.newInstance(ItunesPodcastSearcher.class))); -> activity.loadChildFragment(OnlineSearchFragment.newInstance(ItunesPodcastSearcher.class)));
viewBinding.searchFyydButton.setOnClickListener(v viewBinding.searchFyydButton.setOnClickListener(v

View File

@ -10,8 +10,7 @@
android:id="@+id/appbar" 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:fitsSystemWindows="true" android:fitsSystemWindows="true">
android:elevation="0dp">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
@ -24,18 +23,33 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.cardview.widget.CardView <androidx.core.widget.NestedScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_marginLeft="16dp" android:layout_weight="1"
android:layout_marginRight="16dp" android:scrollbars="vertical">
app:cardCornerRadius="8dp"
app:cardElevation="4dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingBottom="16dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_marginTop="8dp"
app:cardCornerRadius="28dp"
app:cardElevation="0dp">
<LinearLayout
android:id="@+id/searchbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="?attr/colorPrimaryContainer">
<ImageView <ImageView
android:id="@+id/searchButton" android:id="@+id/searchButton"
@ -68,18 +82,6 @@
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<androidx.fragment.app.FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/quickFeedDiscovery" android:id="@+id/quickFeedDiscovery"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -152,6 +154,6 @@
</LinearLayout> </LinearLayout>
</ScrollView> </androidx.core.widget.NestedScrollView>
</LinearLayout> </LinearLayout>

View File

@ -39,8 +39,8 @@
<item name="colorSecondary">@color/accent_light</item> <item name="colorSecondary">@color/accent_light</item>
<item name="colorOnSecondary">@color/white</item> <item name="colorOnSecondary">@color/white</item>
<item name="colorPrimaryDark">@color/accent_light</item> <item name="colorPrimaryDark">@color/accent_light</item>
<item name="colorPrimaryContainer">@color/accent_light</item> <item name="colorPrimaryContainer">#D6E6F3</item>
<item name="colorOnPrimaryContainer">@color/white</item> <item name="colorOnPrimaryContainer">@color/black</item>
<item name="android:colorBackground">@color/background_light</item> <item name="android:colorBackground">@color/background_light</item>
<item name="colorSurface">@color/background_light</item> <item name="colorSurface">@color/background_light</item>
<item name="colorSurfaceVariant">#D3DCE0</item> <item name="colorSurfaceVariant">#D3DCE0</item>
@ -83,8 +83,8 @@
<item name="colorSecondary">@color/accent_dark</item> <item name="colorSecondary">@color/accent_dark</item>
<item name="colorOnSecondary">@color/black</item> <item name="colorOnSecondary">@color/black</item>
<item name="colorPrimaryDark">@color/accent_dark</item> <item name="colorPrimaryDark">@color/accent_dark</item>
<item name="colorPrimaryContainer">@color/accent_dark</item> <item name="colorPrimaryContainer">#29374E</item>
<item name="colorOnPrimaryContainer">@color/black</item> <item name="colorOnPrimaryContainer">@color/white</item>
<item name="android:colorBackground">@color/background_darktheme</item> <item name="android:colorBackground">@color/background_darktheme</item>
<item name="colorSurface">@color/background_darktheme</item> <item name="colorSurface">@color/background_darktheme</item>
<item name="colorSurfaceVariant">#2F3B4F</item> <item name="colorSurfaceVariant">#2F3B4F</item>
@ -108,6 +108,8 @@
<item name="background_color">@color/black</item> <item name="background_color">@color/black</item>
<item name="background_elevated">@color/black</item> <item name="background_elevated">@color/black</item>
<item name="android:navigationBarColor">@color/black</item> <item name="android:navigationBarColor">@color/black</item>
<item name="colorPrimaryContainer">#0D182B</item>
<item name="colorOnPrimaryContainer">@color/white</item>
</style> </style>
<style name="Theme.AntennaPod.Dynamic.Light.NoTitle" parent="Theme.AntennaPod.Dynamic.Light"> <style name="Theme.AntennaPod.Dynamic.Light.NoTitle" parent="Theme.AntennaPod.Dynamic.Light">