diff options
author | ByteHamster <info@bytehamster.com> | 2022-08-04 23:09:38 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2022-09-18 18:57:43 +0200 |
commit | ac8114342c4beb90745cfc5bd9235ca219a36b29 (patch) | |
tree | 51997df3f5131e8ab5be1dbebe4f953990cca865 | |
parent | a12854a96b6233540dc54bb417eaa48e1759b131 (diff) | |
download | AntennaPod-ac8114342c4beb90745cfc5bd9235ca219a36b29.zip |
Migrate Toolbars to Material3
37 files changed, 268 insertions, 179 deletions
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 d453af615..6abecef57 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -19,7 +19,7 @@ import android.widget.EditText; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBarDrawerToggle; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.core.content.ContextCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; @@ -198,7 +198,7 @@ public class MainActivity extends CastEnabledActivity { } }; - public void setupToolbarToggle(@NonNull Toolbar toolbar, boolean displayUpArrow) { + public void setupToolbarToggle(@NonNull MaterialToolbar toolbar, boolean displayUpArrow) { if (drawerLayout != null) { // Tablet layout does not have a drawer if (drawerToggle != null) { drawerLayout.removeDrawerListener(drawerToggle); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java index 475a6a109..dbf314876 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java @@ -8,7 +8,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; -import com.joanzapata.iconify.Iconify; import de.danoeh.antennapod.R; import de.danoeh.antennapod.dialog.AllEpisodesFilterDialog; import de.danoeh.antennapod.model.feed.FeedItemFilter; @@ -88,8 +87,6 @@ public class AllEpisodesFragment extends EpisodesListFragment { private void updateFilterUi() { swipeActions.setFilter(getFilter()); if (getFilter().getValues().length > 0) { - txtvInformation.setText("{md-info-outline} " + this.getString(R.string.filtered_label)); - Iconify.addIcons(txtvInformation); txtvInformation.setVisibility(View.VISIBLE); emptyView.setMessage(R.string.no_all_episodes_filtered_label); } else { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java index 95e2eb1aa..5ec7fb091 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java @@ -15,7 +15,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.cardview.widget.CardView; import androidx.fragment.app.Fragment; import androidx.interpolator.view.animation.FastOutSlowInInterpolator; @@ -23,6 +23,7 @@ import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; import com.google.android.material.bottomsheet.BottomSheetBehavior; +import com.google.android.material.elevation.SurfaceColors; import com.google.android.material.snackbar.Snackbar; import de.danoeh.antennapod.core.service.playback.PlaybackService; @@ -73,7 +74,7 @@ import io.reactivex.schedulers.Schedulers; * Shows the audio player. */ public class AudioPlayerFragment extends Fragment implements - ChapterSeekBar.OnSeekBarChangeListener, Toolbar.OnMenuItemClickListener { + ChapterSeekBar.OnSeekBarChangeListener, MaterialToolbar.OnMenuItemClickListener { public static final String TAG = "AudioPlayerFragment"; public static final int POS_COVER = 0; public static final int POS_DESCRIPTION = 1; @@ -91,7 +92,7 @@ public class AudioPlayerFragment extends Fragment implements private ImageButton butFF; private TextView txtvFF; private ImageButton butSkip; - private Toolbar toolbar; + private MaterialToolbar toolbar; private ProgressBar progressIndicator; private CardView cardViewSeek; private TextView txtvSeek; @@ -120,6 +121,7 @@ public class AudioPlayerFragment extends Fragment implements getChildFragmentManager().beginTransaction() .replace(R.id.playerFragment, externalPlayerFragment, ExternalPlayerFragment.TAG) .commit(); + root.findViewById(R.id.playerFragment).setBackgroundColor(SurfaceColors.getColorForElevation(getContext(), 8)); butPlaybackSpeed = root.findViewById(R.id.butPlaybackSpeed); txtvPlaybackSpeed = root.findViewById(R.id.txtvPlaybackSpeed); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java index b781659dc..c7fe3597b 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java @@ -10,7 +10,7 @@ import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.fragment.app.Fragment; import com.google.android.material.snackbar.Snackbar; import com.leinardi.android.speeddial.SpeedDialView; @@ -35,6 +35,7 @@ import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItemFilter; import de.danoeh.antennapod.view.EmptyViewHandler; import de.danoeh.antennapod.view.EpisodeItemListRecyclerView; +import de.danoeh.antennapod.view.LiftOnScrollListener; import de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; @@ -53,7 +54,7 @@ import java.util.List; * Displays all completed downloads and provides a button to delete them. */ public class CompletedDownloadsFragment extends Fragment - implements EpisodeItemListAdapter.OnSelectModeListener, Toolbar.OnMenuItemClickListener { + implements EpisodeItemListAdapter.OnSelectModeListener, MaterialToolbar.OnMenuItemClickListener { public static final String TAG = "DownloadsFragment"; public static final String ARG_SHOW_LOGS = "show_logs"; private static final String KEY_UP_ARROW = "up_arrow"; @@ -73,7 +74,7 @@ public class CompletedDownloadsFragment extends Fragment public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View root = inflater.inflate(R.layout.simple_list_fragment, container, false); - Toolbar toolbar = root.findViewById(R.id.toolbar); + MaterialToolbar toolbar = root.findViewById(R.id.toolbar); toolbar.setTitle(R.string.downloads_label); toolbar.inflateMenu(R.menu.downloads_completed); toolbar.setOnMenuItemClickListener(this); @@ -96,6 +97,7 @@ public class CompletedDownloadsFragment extends Fragment .getInt(PREF_PREVIOUS_EPISODE_COUNT, 5); adapter.setDummyViews(Math.max(1, previousEpisodesCount)); recyclerView.setAdapter(adapter); + recyclerView.addOnScrollListener(new LiftOnScrollListener(root.findViewById(R.id.appbar))); swipeActions = new SwipeActions(this, TAG).attachTo(recyclerView); swipeActions.setFilter(new FeedItemFilter(FeedItemFilter.DOWNLOADED)); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/DiscoveryFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/DiscoveryFragment.java index 274fc5878..e4d751bd9 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/DiscoveryFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/DiscoveryFragment.java @@ -15,7 +15,7 @@ import android.widget.ProgressBar; import android.widget.Spinner; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.fragment.app.Fragment; import de.danoeh.antennapod.net.discovery.ItunesTopListLoader; @@ -103,7 +103,7 @@ public class DiscoveryFragment extends Fragment { adapter = new ItunesAdapter(getActivity(), new ArrayList<>()); gridView.setAdapter(adapter); - Toolbar toolbar = root.findViewById(R.id.toolbar); + MaterialToolbar toolbar = root.findViewById(R.id.toolbar); toolbar.setNavigationOnClickListener(v -> getParentFragmentManager().popBackStack()); //Show information about the podcast when the list item is clicked diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java index fc64cb2a2..26533f50f 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java @@ -11,7 +11,7 @@ import android.view.ViewGroup; import android.widget.AdapterView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import de.danoeh.antennapod.R; import de.danoeh.antennapod.adapter.DownloadLogAdapter; @@ -40,7 +40,7 @@ import java.util.List; * Shows the download log */ public class DownloadLogFragment extends BottomSheetDialogFragment - implements AdapterView.OnItemClickListener, Toolbar.OnMenuItemClickListener { + implements AdapterView.OnItemClickListener, MaterialToolbar.OnMenuItemClickListener { private static final String TAG = "DownloadLogFragment"; private List<DownloadStatus> downloadLog = new ArrayList<>(); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesListFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesListFragment.java index d8b05d207..2d3343abf 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesListFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesListFragment.java @@ -20,6 +20,7 @@ import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.SimpleItemAnimator; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; +import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.snackbar.Snackbar; import com.leinardi.android.speeddial.SpeedDialView; import de.danoeh.antennapod.R; @@ -45,6 +46,7 @@ import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItemFilter; import de.danoeh.antennapod.view.EmptyViewHandler; import de.danoeh.antennapod.view.EpisodeItemListRecyclerView; +import de.danoeh.antennapod.view.LiftOnScrollListener; import de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder; import io.reactivex.Completable; import io.reactivex.Observable; @@ -77,7 +79,7 @@ public abstract class EpisodesListFragment extends Fragment EpisodeItemListAdapter listAdapter; EmptyViewHandler emptyView; SpeedDialView speedDialView; - Toolbar toolbar; + MaterialToolbar toolbar; SwipeActions swipeActions; @NonNull @@ -170,9 +172,10 @@ public abstract class EpisodesListFragment extends Fragment } ((MainActivity) getActivity()).setupToolbarToggle(toolbar, displayUpArrow); - recyclerView = root.findViewById(android.R.id.list); + recyclerView = root.findViewById(R.id.recyclerView); recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool()); setupLoadMoreScrollListener(); + recyclerView.addOnScrollListener(new LiftOnScrollListener(root.findViewById(R.id.appbar))); swipeActions = new SwipeActions(this, getFragmentTag()).attachTo(recyclerView); swipeActions.setFilter(getFilter()); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java index 909d082af..0b6a2aa56 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java @@ -25,7 +25,7 @@ import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.content.res.AppCompatResources; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.documentfile.provider.DocumentFile; import androidx.fragment.app.Fragment; import com.bumptech.glide.Glide; @@ -62,7 +62,7 @@ import java.util.Iterator; /** * Displays information about a feed. */ -public class FeedInfoFragment extends Fragment implements Toolbar.OnMenuItemClickListener { +public class FeedInfoFragment extends Fragment implements MaterialToolbar.OnMenuItemClickListener { private static final String EXTRA_FEED_ID = "de.danoeh.antennapod.extra.feedId"; private static final String TAG = "FeedInfoActivity"; @@ -81,7 +81,7 @@ public class FeedInfoFragment extends Fragment implements Toolbar.OnMenuItemClic private ImageView imgvBackground; private View infoContainer; private View header; - private Toolbar toolbar; + private MaterialToolbar toolbar; public static FeedInfoFragment newInstance(Feed feed) { FeedInfoFragment fragment = new FeedInfoFragment(); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java index 87a9516bb..8cd1b4909 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java @@ -18,7 +18,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.content.res.AppCompatResources; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; @@ -81,7 +81,7 @@ import java.util.List; * Displays a list of FeedItems. */ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItemClickListener, - Toolbar.OnMenuItemClickListener, EpisodeItemListAdapter.OnSelectModeListener { + MaterialToolbar.OnMenuItemClickListener, EpisodeItemListAdapter.OnSelectModeListener { public static final String TAG = "ItemlistFragment"; private static final String ARGUMENT_FEED_ID = "argument.de.danoeh.antennapod.feed_id"; private static final String KEY_UP_ARROW = "up_arrow"; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java index 0c2103d25..3f775c6f2 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java @@ -8,7 +8,7 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.fragment.app.Fragment; import androidx.preference.ListPreference; import androidx.preference.Preference; @@ -61,7 +61,7 @@ public class FeedSettingsFragment extends Fragment { View root = inflater.inflate(R.layout.feedsettings, container, false); long feedId = getArguments().getLong(EXTRA_FEED_ID); - Toolbar toolbar = root.findViewById(R.id.toolbar); + MaterialToolbar toolbar = root.findViewById(R.id.toolbar); toolbar.setNavigationOnClickListener(v -> getParentFragmentManager().popBackStack()); getParentFragmentManager().beginTransaction() diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java index cae49c63e..762d919f4 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java @@ -8,7 +8,7 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.fragment.app.Fragment; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; @@ -31,7 +31,7 @@ import io.reactivex.schedulers.Schedulers; /** * Displays information about a list of FeedItems. */ -public class ItemPagerFragment extends Fragment implements Toolbar.OnMenuItemClickListener { +public class ItemPagerFragment extends Fragment implements MaterialToolbar.OnMenuItemClickListener { private static final String ARG_FEEDITEMS = "feeditems"; private static final String ARG_FEEDITEM_POS = "feeditem_pos"; private static final String KEY_PAGER_ID = "pager_id"; @@ -56,7 +56,7 @@ public class ItemPagerFragment extends Fragment implements Toolbar.OnMenuItemCli private long[] feedItems; private FeedItem item; private Disposable disposable; - private Toolbar toolbar; + private MaterialToolbar toolbar; @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/OnlineSearchFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/OnlineSearchFragment.java index 2fda74296..2198d130f 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/OnlineSearchFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/OnlineSearchFragment.java @@ -5,7 +5,7 @@ import android.content.Intent; import android.os.Bundle; import android.widget.AbsListView; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.fragment.app.Fragment; import androidx.appcompat.widget.SearchView; @@ -142,7 +142,7 @@ public class OnlineSearchFragment extends Fragment { adapter = null; } - private void setupToolbar(Toolbar toolbar) { + private void setupToolbar(MaterialToolbar toolbar) { toolbar.inflateMenu(R.menu.online_search); toolbar.setNavigationOnClickListener(v -> getParentFragmentManager().popBackStack()); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index 70378a4a9..67671188a 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -17,7 +17,7 @@ import android.widget.CheckBox; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.RecyclerView; @@ -54,6 +54,7 @@ import de.danoeh.antennapod.model.feed.FeedItemFilter; import de.danoeh.antennapod.model.feed.SortOrder; import de.danoeh.antennapod.view.EmptyViewHandler; import de.danoeh.antennapod.view.EpisodeItemListRecyclerView; +import de.danoeh.antennapod.view.LiftOnScrollListener; import de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; @@ -69,7 +70,7 @@ import java.util.Locale; /** * Shows all items in the queue. */ -public class QueueFragment extends Fragment implements Toolbar.OnMenuItemClickListener, +public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuItemClickListener, EpisodeItemListAdapter.OnSelectModeListener { public static final String TAG = "QueueFragment"; private static final String KEY_UP_ARROW = "up_arrow"; @@ -78,7 +79,7 @@ public class QueueFragment extends Fragment implements Toolbar.OnMenuItemClickLi private EpisodeItemListRecyclerView recyclerView; private QueueRecyclerAdapter recyclerAdapter; private EmptyViewHandler emptyView; - private Toolbar toolbar; + private MaterialToolbar toolbar; private boolean displayUpArrow; private List<FeedItem> queue; @@ -453,6 +454,7 @@ public class QueueFragment extends Fragment implements Toolbar.OnMenuItemClickLi } recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool()); registerForContextMenu(recyclerView); + recyclerView.addOnScrollListener(new LiftOnScrollListener(root.findViewById(R.id.appbar))); recyclerAdapter = new QueueRecyclerAdapter((MainActivity) getActivity(), swipeActions) { @Override diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java index b40fa4281..80d07681d 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java @@ -17,7 +17,7 @@ import android.widget.ProgressBar; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.SearchView; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -189,7 +189,7 @@ public class SearchFragment extends Fragment { EventBus.getDefault().unregister(this); } - private void setupToolbar(Toolbar toolbar) { + private void setupToolbar(MaterialToolbar toolbar) { toolbar.setTitle(R.string.search_label); toolbar.setNavigationOnClickListener(v -> getParentFragmentManager().popBackStack()); toolbar.inflateMenu(R.menu.search); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java index 252ef8269..738bdb7fa 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java @@ -17,7 +17,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.StringRes; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -29,6 +29,7 @@ import com.leinardi.android.speeddial.SpeedDialView; import de.danoeh.antennapod.dialog.TagSettingsDialog; import de.danoeh.antennapod.ui.statistics.StatisticsFragment; +import de.danoeh.antennapod.view.LiftOnScrollListener; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -69,7 +70,7 @@ import io.reactivex.schedulers.Schedulers; * Fragment for displaying feed subscriptions */ public class SubscriptionFragment extends Fragment - implements Toolbar.OnMenuItemClickListener, + implements MaterialToolbar.OnMenuItemClickListener, SubscriptionsRecyclerAdapter.OnSelectModeListener { public static final String TAG = "SubscriptionFragment"; private static final String PREFS = "SubscriptionFragment"; @@ -87,10 +88,9 @@ public class SubscriptionFragment extends Fragment private RecyclerView subscriptionRecycler; private SubscriptionsRecyclerAdapter subscriptionAdapter; - private FloatingActionButton subscriptionAddButton; private EmptyViewHandler emptyView; private TextView feedsFilteredMsg; - private Toolbar toolbar; + private MaterialToolbar toolbar; private String displayedFolder = null; private boolean displayUpArrow; @@ -152,6 +152,7 @@ public class SubscriptionFragment extends Fragment setColumnNumber(prefs.getInt(PREF_NUM_COLUMNS, getDefaultNumOfColumns())); subscriptionRecycler.addItemDecoration(new SubscriptionsRecyclerAdapter.GridDividerItemDecorator()); registerForContextMenu(subscriptionRecycler); + subscriptionRecycler.addOnScrollListener(new LiftOnScrollListener(root.findViewById(R.id.appbar))); subscriptionAdapter = new SubscriptionsRecyclerAdapter((MainActivity) getActivity()) { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { @@ -164,7 +165,7 @@ public class SubscriptionFragment extends Fragment subscriptionRecycler.setAdapter(subscriptionAdapter); setupEmptyView(); - subscriptionAddButton = root.findViewById(R.id.subscriptions_add); + FloatingActionButton subscriptionAddButton = root.findViewById(R.id.subscriptions_add); subscriptionAddButton.setOnClickListener(view -> { if (getActivity() instanceof MainActivity) { ((MainActivity) getActivity()).loadChildFragment(new AddFeedFragment()); diff --git a/app/src/main/java/de/danoeh/antennapod/ui/home/HomeFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/home/HomeFragment.java index a08907917..f03c6a3fd 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/home/HomeFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/home/HomeFragment.java @@ -28,6 +28,7 @@ import de.danoeh.antennapod.ui.home.sections.EpisodesSurpriseSection; import de.danoeh.antennapod.ui.home.sections.InboxSection; import de.danoeh.antennapod.ui.home.sections.QueueSection; import de.danoeh.antennapod.ui.home.sections.SubscriptionsSection; +import de.danoeh.antennapod.view.LiftOnScrollListener; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.Disposable; @@ -64,6 +65,7 @@ public class HomeFragment extends Fragment implements Toolbar.OnMenuItemClickLis if (savedInstanceState != null) { displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW); } + viewBinding.homeScrollView.setOnScrollChangeListener(new LiftOnScrollListener(viewBinding.appbar)); ((MainActivity) requireActivity()).setupToolbarToggle(viewBinding.toolbar, displayUpArrow); refreshToolbarState(); populateSectionList(); diff --git a/app/src/main/java/de/danoeh/antennapod/view/EmptyViewHandler.java b/app/src/main/java/de/danoeh/antennapod/view/EmptyViewHandler.java index 567918bec..2ecaaa5b3 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/EmptyViewHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/view/EmptyViewHandler.java @@ -7,6 +7,7 @@ import android.widget.AbsListView; import android.widget.FrameLayout;
import android.widget.ListAdapter;
import androidx.annotation.DrawableRes;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
@@ -90,6 +91,13 @@ public class EmptyViewHandler { layoutParams.gravity = Gravity.CENTER;
emptyView.setLayoutParams(layoutParams);
break;
+ } else if (parent instanceof CoordinatorLayout) {
+ parent.addView(emptyView);
+ CoordinatorLayout.LayoutParams layoutParams =
+ (CoordinatorLayout.LayoutParams) emptyView.getLayoutParams();
+ layoutParams.gravity = Gravity.CENTER;
+ emptyView.setLayoutParams(layoutParams);
+ break;
}
parent = (ViewGroup) parent.getParent();
}
diff --git a/app/src/main/java/de/danoeh/antennapod/view/LiftOnScrollListener.java b/app/src/main/java/de/danoeh/antennapod/view/LiftOnScrollListener.java new file mode 100644 index 000000000..f6f06aea6 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/view/LiftOnScrollListener.java @@ -0,0 +1,58 @@ +package de.danoeh.antennapod.view; + +import android.animation.ValueAnimator; +import android.view.View; +import androidx.annotation.NonNull; +import androidx.core.view.ViewCompat; +import androidx.core.widget.NestedScrollView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +/** + * Workaround for app:liftOnScroll flickering when in SwipeRefreshLayout + */ +public class LiftOnScrollListener extends RecyclerView.OnScrollListener + implements NestedScrollView.OnScrollChangeListener { + private final ValueAnimator animator; + private boolean animatingToScrolled = false; + + public LiftOnScrollListener(View appBar) { + animator = ValueAnimator.ofFloat(0, appBar.getContext().getResources().getDisplayMetrics().density * 8); + animator.addUpdateListener(animation -> ViewCompat.setElevation(appBar, (float) animation.getAnimatedValue())); + } + + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + elevate(isScrolled(recyclerView)); + } + + private boolean isScrolled(RecyclerView recyclerView) { + int firstItem = ((LinearLayoutManager) recyclerView.getLayoutManager()).findFirstVisibleItemPosition(); + if (firstItem != 0) { + return true; + } + View firstItemView = recyclerView.getLayoutManager().findViewByPosition(firstItem); + if (firstItemView == null) { + return false; + } else { + return firstItemView.getTop() < 0; + } + } + + @Override + public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { + elevate(scrollY != 0); + } + + private void elevate(boolean isScrolled) { + if (isScrolled == animatingToScrolled) { + return; + } + animatingToScrolled = isScrolled; + if (isScrolled) { + animator.start(); + } else { + animator.reverse(); + } + } +} diff --git a/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java b/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java index 621b6ea95..67c2e2555 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java +++ b/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java @@ -5,7 +5,7 @@ import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; import android.view.ContextThemeWrapper; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout; import de.danoeh.antennapod.R; @@ -13,10 +13,10 @@ import de.danoeh.antennapod.R; public abstract class ToolbarIconTintManager implements AppBarLayout.OnOffsetChangedListener { private final Context context; private final CollapsingToolbarLayout collapsingToolbar; - private final Toolbar toolbar; + private final MaterialToolbar toolbar; private boolean isTinted = false; - public ToolbarIconTintManager(Context context, Toolbar toolbar, CollapsingToolbarLayout collapsingToolbar) { + public ToolbarIconTintManager(Context context, MaterialToolbar toolbar, CollapsingToolbarLayout collapsingToolbar) { this.context = context; this.collapsingToolbar = collapsingToolbar; this.toolbar = toolbar; diff --git a/app/src/main/res/layout/addfeed.xml b/app/src/main/res/layout/addfeed.xml index 8e2fb99fa..26bc9aa21 100644 --- a/app/src/main/res/layout/addfeed.xml +++ b/app/src/main/res/layout/addfeed.xml @@ -6,7 +6,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - <androidx.appcompat.widget.Toolbar + <com.google.android.material.appbar.MaterialToolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/audioplayer_fragment.xml b/app/src/main/res/layout/audioplayer_fragment.xml index 2008a8f33..d8dfe2eb4 100644 --- a/app/src/main/res/layout/audioplayer_fragment.xml +++ b/app/src/main/res/layout/audioplayer_fragment.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - <androidx.appcompat.widget.Toolbar + <com.google.android.material.appbar.MaterialToolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/download_log_fragment.xml b/app/src/main/res/layout/download_log_fragment.xml index eb80d3f5f..08473533b 100644 --- a/app/src/main/res/layout/download_log_fragment.xml +++ b/app/src/main/res/layout/download_log_fragment.xml @@ -6,7 +6,7 @@ android:layout_height="match_parent" android:minHeight="300dp"> - <androidx.appcompat.widget.Toolbar + <com.google.android.material.appbar.MaterialToolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/episodes_list_fragment.xml b/app/src/main/res/layout/episodes_list_fragment.xml index 343d530fd..7ad7e5d21 100644 --- a/app/src/main/res/layout/episodes_list_fragment.xml +++ b/app/src/main/res/layout/episodes_list_fragment.xml @@ -4,47 +4,45 @@ 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:orientation="vertical"> + android:layout_height="match_parent"> - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:minHeight="?attr/actionBarSize" - android:theme="?attr/actionBarTheme" - app:navigationIcon="?homeAsUpIndicator" /> - - <TextView - android:id="@+id/txtvInformation" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground" - android:gravity="center" - android:layout_below="@id/toolbar" - android:paddingTop="2dp" - android:paddingBottom="2dp" - android:visibility="gone" - tools:text="(i) Information" /> + android:layout_height="wrap_content"> + + <com.google.android.material.appbar.MaterialToolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + app:navigationIcon="?homeAsUpIndicator" /> + + <TextView + android:id="@+id/txtvInformation" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:paddingBottom="8dp" + android:text="@string/filtered_label" + android:layout_marginTop="-12dp" + android:layout_marginLeft="60dp" + android:layout_marginStart="60dp" + android:visibility="gone" + tools:visibility="visible" /> + + </com.google.android.material.appbar.AppBarLayout> <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/swipeRefresh" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_below="@+id/txtvInformation"> + android:layout_below="@id/appbar"> <de.danoeh.antennapod.view.EpisodeItemListRecyclerView - android:id="@android:id/list" + android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginTop="0dp" - android:layout_marginBottom="0dp" - android:paddingTop="@dimen/list_vertical_padding" - android:paddingBottom="@dimen/list_vertical_padding" - android:paddingHorizontal="@dimen/additional_horizontal_spacing" - tools:itemCount="13" - tools:listitem="@layout/feeditemlist_item" /> + android:paddingHorizontal="@dimen/additional_horizontal_spacing" /> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> diff --git a/app/src/main/res/layout/feed_item_list_fragment.xml b/app/src/main/res/layout/feed_item_list_fragment.xml index 2cc2b8214..6c950948d 100644 --- a/app/src/main/res/layout/feed_item_list_fragment.xml +++ b/app/src/main/res/layout/feed_item_list_fragment.xml @@ -14,8 +14,6 @@ android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?android:attr/windowBackground" - app:contentScrim="?android:attr/windowBackground" app:scrimAnimationDuration="200" app:layout_scrollFlags="scroll|exitUntilCollapsed"> @@ -33,12 +31,11 @@ layout="@layout/feeditemlist_header" app:layout_collapseMode="parallax" /> - <androidx.appcompat.widget.Toolbar + <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" android:layout_alignParentTop="true" app:navigationIcon="?homeAsUpIndicator" app:layout_collapseMode="pin" /> diff --git a/app/src/main/res/layout/feedinfo.xml b/app/src/main/res/layout/feedinfo.xml index ac9db8fa2..5461d9276 100644 --- a/app/src/main/res/layout/feedinfo.xml +++ b/app/src/main/res/layout/feedinfo.xml @@ -34,7 +34,7 @@ layout="@layout/feeditemlist_header" app:layout_collapseMode="parallax" /> - <androidx.appcompat.widget.Toolbar + <com.google.android.material.appbar.MaterialToolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/feeditem_pager_fragment.xml b/app/src/main/res/layout/feeditem_pager_fragment.xml index 690ac3bc1..2c96e3721 100644 --- a/app/src/main/res/layout/feeditem_pager_fragment.xml +++ b/app/src/main/res/layout/feeditem_pager_fragment.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:orientation="vertical"> - <androidx.appcompat.widget.Toolbar + <com.google.android.material.appbar.MaterialToolbar android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" diff --git a/app/src/main/res/layout/feedsettings.xml b/app/src/main/res/layout/feedsettings.xml index df6e666eb..beadf7c75 100644 --- a/app/src/main/res/layout/feedsettings.xml +++ b/app/src/main/res/layout/feedsettings.xml @@ -5,7 +5,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - <androidx.appcompat.widget.Toolbar + <com.google.android.material.appbar.MaterialToolbar android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" diff --git a/app/src/main/res/layout/fragment_itunes_search.xml b/app/src/main/res/layout/fragment_itunes_search.xml index b20016f68..35472fbde 100644 --- a/app/src/main/res/layout/fragment_itunes_search.xml +++ b/app/src/main/res/layout/fragment_itunes_search.xml @@ -13,7 +13,7 @@ android:orientation="horizontal" android:layout_alignParentTop="true"> - <androidx.appcompat.widget.Toolbar + <com.google.android.material.appbar.MaterialToolbar android:id="@+id/toolbar" android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/fragment_subscriptions.xml b/app/src/main/res/layout/fragment_subscriptions.xml index 7bb652eb4..65ee34c53 100644 --- a/app/src/main/res/layout/fragment_subscriptions.xml +++ b/app/src/main/res/layout/fragment_subscriptions.xml @@ -4,38 +4,40 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> + android:layout_height="match_parent"> - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?attr/actionBarSize" - android:theme="?attr/actionBarTheme" - android:layout_alignParentTop="true" - app:title="@string/subscriptions_label" - app:navigationIcon="?homeAsUpIndicator" /> + android:layout_height="wrap_content"> - <TextView - android:id="@+id/feeds_filtered_message" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@id/toolbar" - android:background="?android:attr/selectableItemBackground" - android:gravity="start" - android:paddingStart="8dp" - android:paddingTop="4dp" - android:paddingEnd="8dp" - android:paddingBottom="8dp" - android:textColor="?android:attr/textColorSecondary" - android:textSize="@dimen/text_size_small" /> + <com.google.android.material.appbar.MaterialToolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + app:title="@string/subscriptions_label" + app:navigationIcon="?homeAsUpIndicator" /> + + <TextView + android:id="@+id/feeds_filtered_message" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingBottom="8dp" + android:text="@string/filtered_label" + android:layout_marginTop="-12dp" + android:layout_marginLeft="60dp" + android:layout_marginStart="60dp" + android:background="?android:attr/selectableItemBackground" + android:visibility="gone" + tools:visibility="visible" /> + + </com.google.android.material.appbar.AppBarLayout> <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/swipeRefresh" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_below="@id/feeds_filtered_message"> + android:layout_below="@id/appbar"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/subscriptions_grid" @@ -54,9 +56,9 @@ android:layout_width="56dp" android:layout_height="56dp" android:layout_margin="16dp" - android:layout_alignParentBottom="true" - android:layout_alignParentEnd="true" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:layout_alignParentBottom="true" android:contentDescription="@string/add_feed_label" app:srcCompat="@drawable/ic_add" /> diff --git a/app/src/main/res/layout/home_fragment.xml b/app/src/main/res/layout/home_fragment.xml index 040e3df34..0c5d872b3 100644 --- a/app/src/main/res/layout/home_fragment.xml +++ b/app/src/main/res/layout/home_fragment.xml @@ -6,14 +6,20 @@ android:layout_height="match_parent" android:orientation="vertical"> - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="?attr/actionBarSize" - android:theme="?attr/actionBarTheme" - app:title="@string/home_label" - app:navigationIcon="?homeAsUpIndicator" /> + android:fitsSystemWindows="true" + android:elevation="0dp"> + + <com.google.android.material.appbar.MaterialToolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + app:title="@string/home_label" /> + + </com.google.android.material.appbar.AppBarLayout> <LinearLayout android:id="@+id/welcomeContainer" @@ -60,6 +66,7 @@ </LinearLayout> <androidx.core.widget.NestedScrollView + android:id="@+id/homeScrollView" android:layout_width="match_parent" android:layout_height="wrap_content"> diff --git a/app/src/main/res/layout/queue_fragment.xml b/app/src/main/res/layout/queue_fragment.xml index db7c55c85..9bc4e0fa5 100644 --- a/app/src/main/res/layout/queue_fragment.xml +++ b/app/src/main/res/layout/queue_fragment.xml @@ -6,40 +6,38 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="?attr/actionBarSize" - android:theme="?attr/actionBarTheme" - android:layout_alignParentTop="true" - app:title="@string/queue_label" - app:navigationIcon="?homeAsUpIndicator" /> - - <TextView - android:id="@+id/info_bar" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@id/toolbar" - android:textSize="12sp" - android:layout_marginTop="-8dp" - android:layout_marginLeft="72dp" - android:layout_marginStart="72dp" - android:layout_marginBottom="4dp" - tools:text="12 Episodes - Time remaining: 12 hours" /> - - <View - android:id="@+id/divider" - android:layout_width="match_parent" - android:layout_height="1dp" - android:layout_below="@id/info_bar" - android:background="?android:attr/listDivider" /> + android:elevation="0dp"> + + <com.google.android.material.appbar.MaterialToolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + app:navigationIcon="?homeAsUpIndicator" + app:title="@string/queue_label" /> + + <TextView + android:id="@+id/info_bar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/toolbar" + android:textSize="12sp" + android:layout_marginTop="-12dp" + android:layout_marginLeft="60dp" + android:layout_marginStart="60dp" + android:layout_marginBottom="8dp" + tools:text="12 Episodes - Time remaining: 12 hours" /> + + </com.google.android.material.appbar.AppBarLayout> <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/swipeRefresh" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_below="@id/divider"> + android:layout_below="@id/appbar"> <de.danoeh.antennapod.view.EpisodeItemListRecyclerView android:id="@+id/recyclerView" diff --git a/app/src/main/res/layout/search_fragment.xml b/app/src/main/res/layout/search_fragment.xml index 5745cf655..daeb88528 100644 --- a/app/src/main/res/layout/search_fragment.xml +++ b/app/src/main/res/layout/search_fragment.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - <androidx.appcompat.widget.Toolbar + <com.google.android.material.appbar.MaterialToolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/simple_list_fragment.xml b/app/src/main/res/layout/simple_list_fragment.xml index 5019edcfd..fc08dccf2 100644 --- a/app/src/main/res/layout/simple_list_fragment.xml +++ b/app/src/main/res/layout/simple_list_fragment.xml @@ -1,35 +1,41 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout +<androidx.coordinatorlayout.widget.CoordinatorLayout 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"> - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="?attr/actionBarSize" - android:theme="?attr/actionBarTheme" - android:layout_alignParentTop="true" - app:navigationIcon="?homeAsUpIndicator" /> + android:fitsSystemWindows="true"> + + <com.google.android.material.appbar.MaterialToolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + app:navigationIcon="?homeAsUpIndicator" /> + + </com.google.android.material.appbar.AppBarLayout> <de.danoeh.antennapod.view.EpisodeItemListRecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingHorizontal="@dimen/additional_horizontal_spacing" - android:layout_below="@id/toolbar" /> + android:layout_below="@id/appbar" + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <ProgressBar android:id="@+id/progLoading" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_centerInParent="true" + android:layout_gravity="center" android:indeterminateOnly="true" android:visibility="gone" /> <include layout="@layout/multi_select_speed_dial" /> -</RelativeLayout> +</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/subscription_selection_activity.xml b/app/src/main/res/layout/subscription_selection_activity.xml index b54e7e4a4..0331923e6 100644 --- a/app/src/main/res/layout/subscription_selection_activity.xml +++ b/app/src/main/res/layout/subscription_selection_activity.xml @@ -20,7 +20,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - <androidx.appcompat.widget.Toolbar + <com.google.android.material.appbar.MaterialToolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/ui/common/src/main/java/de/danoeh/antennapod/ui/common/PagedToolbarFragment.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/PagedToolbarFragment.java index cbdd789db..3d82cb32c 100644 --- a/ui/common/src/main/java/de/danoeh/antennapod/ui/common/PagedToolbarFragment.java +++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/PagedToolbarFragment.java @@ -1,7 +1,7 @@ package de.danoeh.antennapod.ui.common; import androidx.annotation.NonNull; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.fragment.app.Fragment; import androidx.viewpager2.widget.ViewPager2; @@ -10,7 +10,7 @@ import androidx.viewpager2.widget.ViewPager2; * All items share the same general menu items and are just allowed to show/hide them. */ public abstract class PagedToolbarFragment extends Fragment { - private Toolbar toolbar; + private MaterialToolbar toolbar; private ViewPager2 viewPager; /** @@ -24,7 +24,7 @@ public abstract class PagedToolbarFragment extends Fragment { } } - protected void setupPagedToolbar(Toolbar toolbar, ViewPager2 viewPager) { + protected void setupPagedToolbar(MaterialToolbar toolbar, ViewPager2 viewPager) { this.toolbar = toolbar; this.viewPager = viewPager; diff --git a/ui/common/src/main/res/layout/pager_fragment.xml b/ui/common/src/main/res/layout/pager_fragment.xml index ea007892a..3987b871d 100644 --- a/ui/common/src/main/res/layout/pager_fragment.xml +++ b/ui/common/src/main/res/layout/pager_fragment.xml @@ -1,31 +1,37 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" + 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:orientation="vertical"> + + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> + android:layout_height="wrap_content" + android:fitsSystemWindows="true"> - <androidx.appcompat.widget.Toolbar + <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:navigationIcon="?homeAsUpIndicator" - android:id="@+id/toolbar"/> + android:layout_height="?attr/actionBarSize" + app:navigationIcon="?homeAsUpIndicator" /> + + </com.google.android.material.appbar.AppBarLayout> <com.google.android.material.tabs.TabLayout - android:id="@+id/sliding_tabs" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?android:attr/windowBackground" - app:tabBackground="?attr/selectableItemBackground" - app:tabMode="fixed" - app:tabGravity="fill"/> + android:id="@+id/sliding_tabs" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?android:attr/windowBackground" + app:tabBackground="?attr/selectableItemBackground" + app:tabMode="fixed" + app:tabGravity="fill" /> <androidx.viewpager2.widget.ViewPager2 - android:id="@+id/viewpager" - android:layout_width="match_parent" - android:layout_height="match_parent"/> + android:id="@+id/viewpager" + android:layout_width="match_parent" + android:layout_height="match_parent" /> </LinearLayout> diff --git a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/StatisticsFragment.java b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/StatisticsFragment.java index 53a45f248..6dfdc4e8a 100644 --- a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/StatisticsFragment.java +++ b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/StatisticsFragment.java @@ -10,7 +10,7 @@ import android.view.ViewGroup; import android.util.Log; import androidx.annotation.NonNull; -import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.MaterialToolbar; import androidx.fragment.app.Fragment; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; @@ -48,7 +48,7 @@ public class StatisticsFragment extends PagedToolbarFragment { private TabLayout tabLayout; private ViewPager2 viewPager; - private Toolbar toolbar; + private MaterialToolbar toolbar; @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, |