diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2022-04-22 22:11:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 22:11:12 +0200 |
commit | 8775031b20cbb10876b36541f346e0a0efdad1cb (patch) | |
tree | 62f741e967cad976c4cc6b0eec21a3c2d0734213 /app | |
parent | a01c24984e90434924efb1199a1f39a99cb2f226 (diff) | |
download | AntennaPod-8775031b20cbb10876b36541f346e0a0efdad1cb.zip |
Podcast page re-design (#5842)
Makes the settings button more visible, following a mock-up on the forum
Diffstat (limited to 'app')
7 files changed, 247 insertions, 266 deletions
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 f070baebf..7902a4988 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java @@ -139,6 +139,7 @@ public class FeedInfoFragment extends Fragment implements Toolbar.OnMenuItemClic infoContainer = root.findViewById(R.id.infoContainer); root.findViewById(R.id.butShowInfo).setVisibility(View.INVISIBLE); root.findViewById(R.id.butShowSettings).setVisibility(View.INVISIBLE); + root.findViewById(R.id.butFilter).setVisibility(View.INVISIBLE); // https://github.com/bumptech/glide/issues/529 imgvBackground.setColorFilter(new LightingColorFilter(0xff828282, 0x000000)); 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 111664262..4b367fe42 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java @@ -15,10 +15,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; -import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.ProgressBar; -import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -26,14 +22,10 @@ import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; -import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.appbar.CollapsingToolbarLayout; import com.google.android.material.snackbar.Snackbar; import com.joanzapata.iconify.Iconify; -import com.joanzapata.iconify.widget.IconTextView; import com.leinardi.android.speeddial.SpeedDialView; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; @@ -45,13 +37,14 @@ import de.danoeh.antennapod.core.glide.ApGlideSettings; import de.danoeh.antennapod.core.glide.FastBlurTransformation; import de.danoeh.antennapod.core.menuhandler.MenuItemUtils; import de.danoeh.antennapod.core.service.download.DownloadService; -import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.util.FeedItemPermutors; import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.gui.MoreContentListFooterUtil; +import de.danoeh.antennapod.databinding.FeedItemListFragmentBinding; +import de.danoeh.antennapod.databinding.MultiSelectSpeedDialBinding; import de.danoeh.antennapod.dialog.DownloadLogDetailsDialog; import de.danoeh.antennapod.dialog.FilterDialog; import de.danoeh.antennapod.dialog.RemoveFeedDialog; @@ -67,10 +60,10 @@ import de.danoeh.antennapod.fragment.actions.EpisodeMultiSelectActionHandler; import de.danoeh.antennapod.fragment.swipeactions.SwipeActions; import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler; import de.danoeh.antennapod.menuhandler.FeedMenuHandler; +import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItemFilter; -import de.danoeh.antennapod.view.EpisodeItemListRecyclerView; import de.danoeh.antennapod.view.ToolbarIconTintManager; import de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder; import io.reactivex.Maybe; @@ -98,29 +91,14 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem private FeedItemListAdapter adapter; private SwipeActions swipeActions; private MoreContentListFooterUtil nextPageLoader; - - private ProgressBar progressBar; - private EpisodeItemListRecyclerView recyclerView; - private TextView txtvTitle; - private IconTextView txtvFailure; - private ImageView imgvBackground; - private ImageView imgvCover; - private TextView txtvInformation; - private TextView txtvAuthor; - private TextView txtvUpdatesDisabled; - private ImageButton butShowInfo; - private ImageButton butShowSettings; - private View header; - private Toolbar toolbar; - private SpeedDialView speedDialView; - private boolean displayUpArrow; - private long feedID; private Feed feed; private boolean headerCreated = false; private boolean isUpdatingFeed; private Disposable disposable; + private FeedItemListFragmentBinding viewBinding; + private MultiSelectSpeedDialBinding speedDialBinding; /** * Creates new ItemlistFragment which shows the Feeditems of a specific @@ -140,7 +118,6 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setRetainInstance(true); Bundle args = getArguments(); Validate.notNull(args); @@ -151,84 +128,63 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View root = inflater.inflate(R.layout.feed_item_list_fragment, container, false); - toolbar = root.findViewById(R.id.toolbar); - toolbar.inflateMenu(R.menu.feedlist); - toolbar.setOnMenuItemClickListener(this); + viewBinding = FeedItemListFragmentBinding.inflate(inflater); + speedDialBinding = MultiSelectSpeedDialBinding.bind(viewBinding.getRoot()); + viewBinding.toolbar.inflateMenu(R.menu.feedlist); + viewBinding.toolbar.setOnMenuItemClickListener(this); displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0; if (savedInstanceState != null) { displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW); } - ((MainActivity) getActivity()).setupToolbarToggle(toolbar, displayUpArrow); + ((MainActivity) getActivity()).setupToolbarToggle(viewBinding.toolbar, displayUpArrow); refreshToolbarState(); - recyclerView = root.findViewById(R.id.recyclerView); - recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool()); - - progressBar = root.findViewById(R.id.progLoading); - progressBar.setVisibility(View.VISIBLE); - txtvTitle = root.findViewById(R.id.txtvTitle); - txtvAuthor = root.findViewById(R.id.txtvAuthor); - imgvBackground = root.findViewById(R.id.imgvBackground); - imgvCover = root.findViewById(R.id.imgvCover); - butShowInfo = root.findViewById(R.id.butShowInfo); - butShowSettings = root.findViewById(R.id.butShowSettings); - txtvInformation = root.findViewById(R.id.txtvInformation); - txtvFailure = root.findViewById(R.id.txtvFailure); - txtvUpdatesDisabled = root.findViewById(R.id.txtvUpdatesDisabled); - header = root.findViewById(R.id.headerContainer); - AppBarLayout appBar = root.findViewById(R.id.appBar); - CollapsingToolbarLayout collapsingToolbar = root.findViewById(R.id.collapsing_toolbar); - - ToolbarIconTintManager iconTintManager = new ToolbarIconTintManager(getContext(), toolbar, collapsingToolbar) { + viewBinding.recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool()); + viewBinding.progLoading.setVisibility(View.VISIBLE); + ToolbarIconTintManager iconTintManager = new ToolbarIconTintManager( + getContext(), viewBinding.toolbar, viewBinding.collapsingToolbar) { @Override protected void doTint(Context themedContext) { - toolbar.getMenu().findItem(R.id.sort_items) - .setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_sort)); - toolbar.getMenu().findItem(R.id.filter_items) - .setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_filter)); - toolbar.getMenu().findItem(R.id.refresh_item) + viewBinding.toolbar.getMenu().findItem(R.id.refresh_item) .setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_refresh)); - toolbar.getMenu().findItem(R.id.action_search) + viewBinding.toolbar.getMenu().findItem(R.id.action_search) .setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_search)); } }; iconTintManager.updateTint(); - appBar.addOnOffsetChangedListener(iconTintManager); + viewBinding.appBar.addOnOffsetChangedListener(iconTintManager); - nextPageLoader = new MoreContentListFooterUtil(root.findViewById(R.id.more_content_list_footer)); + nextPageLoader = new MoreContentListFooterUtil(viewBinding.moreContent.moreContentListFooter); nextPageLoader.setClickListener(() -> { if (feed != null) { DBTasks.loadNextPageOfFeed(getActivity(), feed, false); } }); - recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { + viewBinding.recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(@NonNull RecyclerView view, int deltaX, int deltaY) { super.onScrolled(view, deltaX, deltaY); boolean hasMorePages = feed != null && feed.isPaged() && feed.getNextPageLink() != null; nextPageLoader.getRoot().setVisibility( - (recyclerView.isScrolledToBottom() && hasMorePages) ? View.VISIBLE : View.GONE); + (viewBinding.recyclerView.isScrolledToBottom() && hasMorePages) ? View.VISIBLE : View.GONE); } }); EventBus.getDefault().register(this); - SwipeRefreshLayout swipeRefreshLayout = root.findViewById(R.id.swipeRefresh); - swipeRefreshLayout.setDistanceToTriggerSync(getResources().getInteger(R.integer.swipe_refresh_distance)); - swipeRefreshLayout.setOnRefreshListener(() -> { + viewBinding.swipeRefresh.setDistanceToTriggerSync(getResources().getInteger(R.integer.swipe_refresh_distance)); + viewBinding.swipeRefresh.setOnRefreshListener(() -> { DBTasks.forceRefreshFeed(requireContext(), feed, true); - new Handler(Looper.getMainLooper()).postDelayed(() -> swipeRefreshLayout.setRefreshing(false), + new Handler(Looper.getMainLooper()).postDelayed(() -> viewBinding.swipeRefresh.setRefreshing(false), getResources().getInteger(R.integer.swipe_to_refresh_duration_in_ms)); }); loadItems(); // Init action UI (via a FAB Speed Dial) - speedDialView = root.findViewById(R.id.fabSD); - speedDialView.setOverlayLayout(root.findViewById(R.id.fabSDOverlay)); - speedDialView.inflate(R.menu.episodes_apply_action_speeddial); - speedDialView.setOnChangeListener(new SpeedDialView.OnChangeListener() { + speedDialBinding.fabSD.setOverlayLayout(speedDialBinding.fabSDOverlay); + speedDialBinding.fabSD.inflate(R.menu.episodes_apply_action_speeddial); + speedDialBinding.fabSD.setOnChangeListener(new SpeedDialView.OnChangeListener() { @Override public boolean onMainActionSelected() { return false; @@ -239,17 +195,17 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem if (open && adapter.getSelectedCount() == 0) { ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.no_items_selected, Snackbar.LENGTH_SHORT); - speedDialView.close(); + speedDialBinding.fabSD.close(); } } }); - speedDialView.setOnActionSelectedListener(actionItem -> { + speedDialBinding.fabSD.setOnActionSelectedListener(actionItem -> { new EpisodeMultiSelectActionHandler(((MainActivity) getActivity()), adapter.getSelectedItems()) .handleAction(actionItem.getId()); adapter.endSelectMode(); return true; }); - return root; + return viewBinding.getRoot(); } @Override @@ -279,18 +235,20 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem if (feed == null) { return; } - toolbar.getMenu().findItem(R.id.visit_website_item).setVisible(feed.getLink() != null); + viewBinding.toolbar.getMenu().findItem(R.id.visit_website_item).setVisible(feed.getLink() != null); - isUpdatingFeed = MenuItemUtils.updateRefreshMenuItem(toolbar.getMenu(), + isUpdatingFeed = MenuItemUtils.updateRefreshMenuItem(viewBinding.toolbar.getMenu(), R.id.refresh_item, updateRefreshMenuItemChecker); - FeedMenuHandler.onPrepareOptionsMenu(toolbar.getMenu(), feed); + FeedMenuHandler.onPrepareOptionsMenu(viewBinding.toolbar.getMenu(), feed); } @Override public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); int horizontalSpacing = (int) getResources().getDimension(R.dimen.additional_horizontal_spacing); - header.setPadding(horizontalSpacing, header.getPaddingTop(), horizontalSpacing, header.getPaddingBottom()); + viewBinding.header.headerContainer.setPadding( + horizontalSpacing, viewBinding.header.headerContainer.getPaddingTop(), + horizontalSpacing, viewBinding.header.headerContainer.getPaddingBottom()); } @Override @@ -391,7 +349,8 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem public void onEventMainThread(PlaybackPositionEvent event) { if (adapter != null) { for (int i = 0; i < adapter.getItemCount(); i++) { - EpisodeItemViewHolder holder = (EpisodeItemViewHolder) recyclerView.findViewHolderForAdapterPosition(i); + EpisodeItemViewHolder holder = (EpisodeItemViewHolder) + viewBinding.recyclerView.findViewHolderForAdapterPosition(i); if (holder != null && holder.isCurrentlyPlayingItem()) { holder.notifyPlaybackPositionUpdated(event); break; @@ -414,18 +373,18 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem public void onStartSelectMode() { swipeActions.detach(); if (feed.isLocalFeed()) { - speedDialView.removeActionItemById(R.id.download_batch); - speedDialView.removeActionItemById(R.id.delete_batch); + speedDialBinding.fabSD.removeActionItemById(R.id.download_batch); + speedDialBinding.fabSD.removeActionItemById(R.id.delete_batch); } - speedDialView.setVisibility(View.VISIBLE); + speedDialBinding.fabSD.setVisibility(View.VISIBLE); refreshToolbarState(); } @Override public void onEndSelectMode() { - speedDialView.close(); - speedDialView.setVisibility(View.GONE); - swipeActions.attachTo(recyclerView); + speedDialBinding.fabSD.close(); + speedDialBinding.fabSD.setVisibility(View.GONE); + swipeActions.attachTo(viewBinding.recyclerView); } private void updateUi() { @@ -466,13 +425,13 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem return; } if (adapter == null) { - recyclerView.setAdapter(null); + viewBinding.recyclerView.setAdapter(null); adapter = new FeedItemListAdapter((MainActivity) getActivity()); adapter.setOnSelectModeListener(this); - recyclerView.setAdapter(adapter); - swipeActions = new SwipeActions(this, TAG).attachTo(recyclerView); + viewBinding.recyclerView.setAdapter(adapter); + swipeActions = new SwipeActions(this, TAG).attachTo(viewBinding.recyclerView); } - progressBar.setVisibility(View.GONE); + viewBinding.progLoading.setVisibility(View.GONE); if (feed != null) { adapter.updateItems(feed.getItems()); swipeActions.setFilter(feed.getItemFilter()); @@ -484,31 +443,33 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem private void refreshHeaderView() { setupHeaderView(); - if (recyclerView == null || feed == null) { + if (viewBinding == null || feed == null) { Log.e(TAG, "Unable to refresh header view"); return; } loadFeedImage(); if (feed.hasLastUpdateFailed()) { - txtvFailure.setVisibility(View.VISIBLE); + viewBinding.header.txtvFailure.setVisibility(View.VISIBLE); } else { - txtvFailure.setVisibility(View.GONE); + viewBinding.header.txtvFailure.setVisibility(View.GONE); } if (!feed.getPreferences().getKeepUpdated()) { - txtvUpdatesDisabled.setText("{md-pause-circle-outline} " + this.getString(R.string.updates_disabled_label)); - Iconify.addIcons(txtvUpdatesDisabled); - txtvUpdatesDisabled.setVisibility(View.VISIBLE); + viewBinding.header.txtvUpdatesDisabled.setText("{md-pause-circle-outline} " + + this.getString(R.string.updates_disabled_label)); + Iconify.addIcons(viewBinding.header.txtvUpdatesDisabled); + viewBinding.header.txtvUpdatesDisabled.setVisibility(View.VISIBLE); } else { - txtvUpdatesDisabled.setVisibility(View.GONE); + viewBinding.header.txtvUpdatesDisabled.setVisibility(View.GONE); } - txtvTitle.setText(feed.getTitle()); - txtvAuthor.setText(feed.getAuthor()); + viewBinding.header.txtvTitle.setText(feed.getTitle()); + viewBinding.header.txtvAuthor.setText(feed.getAuthor()); if (feed.getItemFilter() != null) { FeedItemFilter filter = feed.getItemFilter(); if (filter.getValues().length > 0) { - txtvInformation.setText("{md-info-outline} " + this.getString(R.string.filtered_label)); - Iconify.addIcons(txtvInformation); - txtvInformation.setOnClickListener((l) -> { + viewBinding.header.txtvInformation.setText("{md-info-outline} " + + this.getString(R.string.filtered_label)); + Iconify.addIcons(viewBinding.header.txtvInformation); + viewBinding.header.txtvInformation.setOnClickListener((l) -> { FilterDialog filterDialog = new FilterDialog(requireContext(), feed.getItemFilter()) { @Override protected void updateFilter(Set<String> filterValues) { @@ -519,12 +480,12 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem filterDialog.openDialog(); }); - txtvInformation.setVisibility(View.VISIBLE); + viewBinding.header.txtvInformation.setVisibility(View.VISIBLE); } else { - txtvInformation.setVisibility(View.GONE); + viewBinding.header.txtvInformation.setVisibility(View.GONE); } } else { - txtvInformation.setVisibility(View.GONE); + viewBinding.header.txtvInformation.setVisibility(View.GONE); } } @@ -534,18 +495,24 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem } // https://github.com/bumptech/glide/issues/529 - imgvBackground.setColorFilter(new LightingColorFilter(0xff666666, 0x000000)); - butShowInfo.setVisibility(View.VISIBLE); - butShowInfo.setOnClickListener(v -> showFeedInfo()); - imgvCover.setOnClickListener(v -> showFeedInfo()); - butShowSettings.setVisibility(View.VISIBLE); - butShowSettings.setOnClickListener(v -> { + viewBinding.imgvBackground.setColorFilter(new LightingColorFilter(0xff666666, 0x000000)); + viewBinding.header.butShowInfo.setOnClickListener(v -> showFeedInfo()); + viewBinding.header.imgvCover.setOnClickListener(v -> showFeedInfo()); + viewBinding.header.butShowSettings.setOnClickListener(v -> { if (feed != null) { FeedSettingsFragment fragment = FeedSettingsFragment.newInstance(feed); ((MainActivity) getActivity()).loadChildFragment(fragment, TransitionEffect.SLIDE); } }); - txtvFailure.setOnClickListener(v -> showErrorDetails()); + viewBinding.header.butFilter.setOnClickListener( + v -> new FilterDialog(getContext(), feed.getItemFilter()) { + @Override + protected void updateFilter(Set<String> filterValues) { + feed.setItemFilter(filterValues.toArray(new String[0])); + DBWriter.setFeedItemsFilter(feed.getId(), filterValues); + } + }.openDialog()); + viewBinding.header.txtvFailure.setOnClickListener(v -> showErrorDetails()); headerCreated = true; } @@ -589,7 +556,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .transform(new FastBlurTransformation()) .dontAnimate()) - .into(imgvBackground); + .into(viewBinding.imgvBackground); Glide.with(getActivity()) .load(feed.getImageUrl()) @@ -599,7 +566,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate()) - .into(imgvCover); + .into(viewBinding.header.imgvCover); } private void loadItems() { @@ -644,10 +611,10 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem } switch (event.getKeyCode()) { case KeyEvent.KEYCODE_T: - recyclerView.smoothScrollToPosition(0); + viewBinding.recyclerView.smoothScrollToPosition(0); break; case KeyEvent.KEYCODE_B: - recyclerView.smoothScrollToPosition(adapter.getItemCount() - 1); + viewBinding.recyclerView.smoothScrollToPosition(adapter.getItemCount() - 1); break; default: break; diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java index 3396040f9..bfe269caa 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java @@ -5,23 +5,17 @@ import android.content.DialogInterface; import android.util.Log; import android.view.Menu; import android.view.MenuItem; - import androidx.annotation.NonNull; - -import org.apache.commons.lang3.StringUtils; - -import java.util.Set; - import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.dialog.ConfirmationDialog; -import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.ShareUtils; -import de.danoeh.antennapod.model.feed.SortOrder; -import de.danoeh.antennapod.dialog.FilterDialog; import de.danoeh.antennapod.dialog.IntraFeedSortDialog; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.SortOrder; +import org.apache.commons.lang3.StringUtils; /** * Handles interactions with the FeedItemMenu. @@ -62,8 +56,6 @@ public class FeedMenuHandler { DBTasks.forceRefreshCompleteFeed(context, selectedFeed); } else if (itemId == R.id.sort_items) { showSortDialog(context, selectedFeed); - } else if (itemId == R.id.filter_items) { - showFilterDialog(context, selectedFeed); } else if (itemId == R.id.mark_all_read_item) { ConfirmationDialog conDialog = new ConfirmationDialog(context, R.string.mark_all_read_label, @@ -87,19 +79,6 @@ public class FeedMenuHandler { return true; } - private static void showFilterDialog(Context context, Feed selectedFeed) { - FilterDialog filterDialog = new FilterDialog(context, selectedFeed.getItemFilter()) { - @Override - protected void updateFilter(Set<String> filterValues) { - selectedFeed.setItemFilter(filterValues.toArray(new String[0])); - DBWriter.setFeedItemsFilter(selectedFeed.getId(), filterValues); - } - }; - - filterDialog.openDialog(); - } - - private static void showSortDialog(Context context, Feed selectedFeed) { IntraFeedSortDialog sortDialog = new IntraFeedSortDialog(context, selectedFeed.getSortOrder(), selectedFeed.isLocalFeed()) { @Override 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 734ce64dd..2f175770f 100644 --- a/app/src/main/res/layout/feed_item_list_fragment.xml +++ b/app/src/main/res/layout/feed_item_list_fragment.xml @@ -22,19 +22,16 @@ <ImageView android:id="@+id/imgvBackground" android:layout_width="match_parent" - android:layout_height="232dp" + android:layout_height="match_parent" android:background="@color/image_readability_tint" style="@style/BigBlurryBackground" app:layout_collapseMode="parallax" app:layout_collapseParallaxMultiplier="0.6" /> <include - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="bottom" + android:id="@+id/header" layout="@layout/feeditemlist_header" - app:layout_collapseMode="parallax" - app:layout_collapseParallaxMultiplier="0.6" /> + app:layout_collapseMode="parallax" /> <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" @@ -73,6 +70,7 @@ android:visibility="gone" /> <include + android:id="@+id/more_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" diff --git a/app/src/main/res/layout/feedinfo.xml b/app/src/main/res/layout/feedinfo.xml index b0a73cb97..ac9db8fa2 100644 --- a/app/src/main/res/layout/feedinfo.xml +++ b/app/src/main/res/layout/feedinfo.xml @@ -23,19 +23,16 @@ <ImageView android:id="@+id/imgvBackground" android:layout_width="match_parent" - android:layout_height="232dp" + android:layout_height="match_parent" android:background="@color/image_readability_tint" style="@style/BigBlurryBackground" app:layout_collapseMode="parallax" app:layout_collapseParallaxMultiplier="0.6" /> <include - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="bottom" + android:id="@+id/header" layout="@layout/feeditemlist_header" - app:layout_collapseMode="parallax" - app:layout_collapseParallaxMultiplier="0.6" /> + app:layout_collapseMode="parallax" /> <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" diff --git a/app/src/main/res/layout/feeditemlist_header.xml b/app/src/main/res/layout/feeditemlist_header.xml index 9e83051d6..6d96141a2 100644 --- a/app/src/main/res/layout/feeditemlist_header.xml +++ b/app/src/main/res/layout/feeditemlist_header.xml @@ -1,134 +1,181 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout - xmlns:tools="http://schemas.android.com/tools" - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/headerContainer" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingHorizontal="@dimen/additional_horizontal_spacing" + android:layout_marginTop="?attr/actionBarSize" + android:orientation="vertical"> + + <RelativeLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/headerContainer" - android:paddingHorizontal="@dimen/additional_horizontal_spacing" - android:orientation="vertical"> + android:layout_height="156dp" + android:orientation="horizontal" + android:gravity="bottom"> - <LinearLayout + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" + android:padding="8dp" + android:background="@color/image_readability_tint" android:orientation="horizontal" - android:padding="16dp" - android:layout_marginBottom="16dp" - android:gravity="center_vertical"> + android:layout_alignParentBottom="true"> + + <View + android:layout_width="148dp" + android:layout_height="match_parent" /> + + <ImageButton + android:id="@+id/butShowInfo" + android:layout_width="40dp" + android:layout_height="40dp" + android:background="?attr/selectableItemBackground" + android:contentDescription="@string/show_info_label" + android:layout_marginLeft="-8dp" + android:layout_marginStart="-8dp" + android:scaleType="fitXY" + android:padding="8dp" + app:srcCompat="@drawable/ic_info_white" + tools:visibility="visible" /> + + <ImageButton + android:id="@+id/butFilter" + android:layout_width="40dp" + android:layout_height="40dp" + android:background="?attr/selectableItemBackground" + android:contentDescription="@string/filter" + android:scaleType="fitXY" + android:padding="8dp" + app:srcCompat="@drawable/ic_filter_white" + tools:visibility="visible" /> + + <ImageButton + android:id="@+id/butShowSettings" + android:layout_width="40dp" + android:layout_height="40dp" + android:background="?attr/selectableItemBackground" + android:contentDescription="@string/show_feed_settings_label" + android:scaleType="fitXY" + android:padding="8dp" + app:srcCompat="@drawable/ic_settings_white" + tools:visibility="visible" /> + + </LinearLayout> <ImageView + android:layout_width="12dp" + android:layout_height="12dp" + android:layout_alignParentBottom="true" + android:layout_alignParentLeft="true" + android:scaleType="fitXY" + android:src="@drawable/ic_rounded_corner_left" /> + + <ImageView + android:layout_width="12dp" + android:layout_height="12dp" + android:layout_alignParentBottom="true" + android:layout_alignParentRight="true" + android:scaleType="fitXY" + android:src="@drawable/ic_rounded_corner_right" /> + + <androidx.cardview.widget.CardView + android:id="@+id/coverHolder" + android:layout_width="124dp" + android:layout_height="124dp" + android:layout_marginBottom="24dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_alignParentBottom="true" + app:cardBackgroundColor="@color/non_square_icon_background" + app:cardCornerRadius="8dp" + app:cardPreventCornerOverlap="false" + app:cardElevation="0dp"> + + <ImageView android:id="@+id/imgvCover" - android:layout_width="100dp" - android:layout_height="100dp" - android:layout_marginRight="16dp" - android:layout_marginEnd="16dp" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_centerVertical="true" android:importantForAccessibility="no" - tools:src="@tools:sample/avatars" - tools:background="@android:color/holo_green_dark"/> + tools:src="@tools:sample/avatars" /> + + </androidx.cardview.widget.CardView> <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_toEndOf="@id/coverHolder" + android:layout_alignTop="@id/coverHolder" + android:layout_marginEnd="16dp" + android:orientation="vertical"> + + <TextView + android:id="@+id/txtvTitle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical"> - <TextView - android:id="@+id/txtvTitle" - style="@style/AntennaPod.TextView.Heading" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:ellipsize="end" - android:maxLines="2" - android:shadowColor="@color/black" - android:shadowRadius="2" - android:textColor="@color/white" - tools:text="Podcast title" - tools:background="@android:color/holo_green_dark"/> + android:ellipsize="end" + android:maxLines="2" + android:shadowColor="@color/black" + android:shadowRadius="2" + android:textColor="@color/white" + style="@style/AntennaPod.TextView.Heading" + tools:text="Podcast title" /> <TextView - android:id="@+id/txtvAuthor" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:ellipsize="end" - android:maxLines="2" - android:shadowColor="@color/black" - android:shadowRadius="2" - android:textColor="@color/white" - android:textSize="@dimen/text_size_small" - tools:text="Podcast author" - tools:background="@android:color/holo_green_dark"/> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - <ImageButton - android:id="@+id/butShowInfo" - android:layout_width="40dp" - android:layout_height="40dp" - android:background="?attr/selectableItemBackground" - android:contentDescription="@string/show_info_label" - app:srcCompat="@drawable/ic_info_white" - tools:background="@android:color/holo_green_dark" - android:layout_marginLeft="-8dp" - android:layout_marginStart="-8dp" - android:scaleType="fitXY" - android:visibility="invisible" - tools:visibility="visible" - android:padding="8dp"/> - - <ImageButton - android:id="@+id/butShowSettings" - android:layout_width="40dp" - android:layout_height="40dp" - android:background="?attr/selectableItemBackground" - android:contentDescription="@string/show_feed_settings_label" - app:srcCompat="@drawable/ic_settings_white" - tools:background="@android:color/holo_green_dark" - android:scaleType="fitXY" - android:visibility="invisible" - tools:visibility="visible" - android:padding="8dp"/> - </LinearLayout> + android:id="@+id/txtvAuthor" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ellipsize="end" + android:maxLines="2" + android:shadowColor="@color/black" + android:shadowRadius="2" + android:textColor="@color/white" + android:textSize="@dimen/text_size_small" + tools:text="Podcast author" /> </LinearLayout> - </LinearLayout> + </RelativeLayout> <com.joanzapata.iconify.widget.IconTextView - android:id="@+id/txtvFailure" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:padding="2dp" - android:background="@color/download_failed_red" - android:gravity="center" - android:textColor="@color/white" - android:visibility="gone" - android:text="@string/refresh_failed_msg" - tools:visibility="visible" - tools:text="(!) Last refresh failed"/> + android:id="@+id/txtvFailure" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="2dp" + android:background="@color/download_failed_red" + android:gravity="center" + android:textColor="@color/white" + android:visibility="gone" + android:text="@string/refresh_failed_msg" + tools:visibility="visible" + tools:text="(!) Last refresh failed" /> <TextView - android:id="@+id/txtvInformation" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:padding="2dp" - android:background="?android:attr/windowBackground" - android:foreground="?android:attr/selectableItemBackground" - android:visibility="gone" - android:gravity="center" - android:textColor="?attr/colorAccent" - tools:visibility="visible" - tools:text="(i) Information"/> + android:id="@+id/txtvInformation" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="2dp" + android:background="?android:attr/windowBackground" + android:foreground="?android:attr/selectableItemBackground" + android:visibility="gone" + android:gravity="center" + android:textColor="?attr/colorAccent" + tools:visibility="visible" + tools:text="(i) Information" /> <TextView - android:id="@+id/txtvUpdatesDisabled" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:padding="2dp" - android:background="?android:attr/windowBackground" - android:visibility="gone" - android:gravity="center" - android:textColor="?attr/colorAccent" - tools:visibility="visible" - tools:text="Updates disabled"/> + android:id="@+id/txtvUpdatesDisabled" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="2dp" + android:background="?android:attr/windowBackground" + android:visibility="gone" + android:gravity="center" + android:textColor="?attr/colorAccent" + tools:visibility="visible" + tools:text="Updates disabled" /> + </LinearLayout> diff --git a/app/src/main/res/menu/feedlist.xml b/app/src/main/res/menu/feedlist.xml index 4c5050f82..2086ff547 100644 --- a/app/src/main/res/menu/feedlist.xml +++ b/app/src/main/res/menu/feedlist.xml @@ -4,17 +4,9 @@ <item android:id="@+id/sort_items" - android:icon="@drawable/ic_sort" android:menuCategory="container" android:title="@string/sort" - custom:showAsAction="always"> - </item> - <item - android:id="@+id/filter_items" - android:icon="@drawable/ic_filter" - android:menuCategory="container" - android:title="@string/filter" - custom:showAsAction="always"> + custom:showAsAction="never"> </item> <item android:id="@+id/refresh_item" |