diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2022-09-18 21:42:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-18 21:42:21 +0200 |
commit | 261c7982defc86607a45acaba01c913abe0e6582 (patch) | |
tree | 019b84db0cce18b8a7d4ce0a9a50adc7f05b969e | |
parent | 8426e32fe8c485b14fc33081313c0909e54bd618 (diff) | |
parent | cbff160bd549ee4e093491512acd99970cd9a2b6 (diff) | |
download | AntennaPod-261c7982defc86607a45acaba01c913abe0e6582.zip |
Merge pull request #6002 from ByteHamster/material3
Material Design 3
107 files changed, 866 insertions, 978 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/dialogs/ShareDialogTest.java b/app/src/androidTest/java/de/test/antennapod/dialogs/ShareDialogTest.java index 49a252ea1..58a4a0bb6 100644 --- a/app/src/androidTest/java/de/test/antennapod/dialogs/ShareDialogTest.java +++ b/app/src/androidTest/java/de/test/antennapod/dialogs/ShareDialogTest.java @@ -59,7 +59,7 @@ public class ShareDialogTest { onDrawerItem(withText(R.string.episodes_label)).perform(click()); Matcher<View> allEpisodesMatcher; - allEpisodesMatcher = Matchers.allOf(withId(android.R.id.list), isDisplayed(), hasMinimumChildCount(2)); + allEpisodesMatcher = Matchers.allOf(withId(R.id.recyclerView), isDisplayed(), hasMinimumChildCount(2)); onView(isRoot()).perform(waitForView(allEpisodesMatcher, 1000)); onView(allEpisodesMatcher).perform(actionOnItemAtPosition(0, click())); onView(first(EspressoTestUtils.actionBarOverflow())).perform(click()); diff --git a/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java b/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java index 97c199e26..c0e86d046 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java @@ -81,12 +81,24 @@ public class NavigationDrawerTest { UserPreferences.setHiddenDrawerItems(new ArrayList<>()); activityRule.launchActivity(new Intent()); + // home + openNavDrawer(); + onDrawerItem(withText(R.string.home_label)).perform(click()); + onView(isRoot()).perform(waitForView(allOf(isDescendantOfA(withId(R.id.toolbar)), + withText(R.string.home_label)), 1000)); + // queue openNavDrawer(); onDrawerItem(withText(R.string.queue_label)).perform(click()); onView(isRoot()).perform(waitForView(allOf(isDescendantOfA(withId(R.id.toolbar)), withText(R.string.queue_label)), 1000)); + // Inbox + openNavDrawer(); + onDrawerItem(withText(R.string.inbox_label)).perform(click()); + onView(isRoot()).perform(waitForView(allOf(isDescendantOfA(withId(R.id.toolbar)), + withText(R.string.inbox_label)), 1000)); + // episodes openNavDrawer(); onDrawerItem(withText(R.string.episodes_label)).perform(click()); @@ -143,6 +155,7 @@ public class NavigationDrawerTest { openNavDrawer(); onDrawerItem(withText(R.string.queue_label)).perform(longClick()); onView(withText(R.string.episodes_label)).perform(click()); + onView(withId(R.id.contentPanel)).perform(swipeUp()); onView(withText(R.string.playback_history_label)).perform(click()); onView(withText(R.string.confirm_label)).perform(click()); @@ -160,8 +173,9 @@ public class NavigationDrawerTest { openNavDrawer(); onView(first(withText(R.string.queue_label))).perform(longClick()); - onView(withText(R.string.downloads_label)).perform(click()); onView(withText(R.string.queue_label)).perform(click()); + onView(withId(R.id.contentPanel)).perform(swipeUp()); + onView(withText(R.string.downloads_label)).perform(click()); onView(withText(R.string.confirm_label)).perform(click()); hidden = UserPreferences.getHiddenDrawerItems(); @@ -184,7 +198,7 @@ public class NavigationDrawerTest { onView(allOf(withText(title), isDisplayed())).perform(click()); if (i == 3) { - onView(withId(R.id.select_dialog_listview)).perform(swipeUp()); + onView(withId(R.id.contentPanel)).perform(swipeUp()); } } @@ -206,6 +220,7 @@ public class NavigationDrawerTest { openNavDrawer(); onView(first(withText(R.string.queue_label))).perform(longClick()); + onView(withId(R.id.contentPanel)).perform(swipeUp()); onView(first(withText(R.string.downloads_label))).perform(click()); onView(withText(R.string.confirm_label)).perform(click()); diff --git a/app/src/free/java/de/danoeh/antennapod/dialog/RatingDialog.java b/app/src/free/java/de/danoeh/antennapod/dialog/RatingDialog.java index 255da6eaf..3973a538d 100644 --- a/app/src/free/java/de/danoeh/antennapod/dialog/RatingDialog.java +++ b/app/src/free/java/de/danoeh/antennapod/dialog/RatingDialog.java @@ -11,6 +11,7 @@ import java.lang.ref.WeakReference; import java.util.concurrent.TimeUnit; import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.util.IntentUtils; @@ -101,7 +102,7 @@ public class RatingDialog { if (context == null) { return null; } - return new AlertDialog.Builder(context) + return new MaterialAlertDialogBuilder(context) .setTitle(R.string.rating_title) .setMessage(R.string.rating_message) .setPositiveButton(R.string.rating_now_label, (dialog, which) -> rateNow()) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java index 64e5a109c..96f7e9aa2 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java @@ -9,7 +9,7 @@ import android.util.Log; import com.google.android.material.snackbar.Snackbar; import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ShareCompat; import androidx.core.content.FileProvider; @@ -79,7 +79,7 @@ public class BugReportActivity extends AppCompatActivity { @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == R.id.export_logcat) { - AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); + MaterialAlertDialogBuilder alertBuilder = new MaterialAlertDialogBuilder(this); alertBuilder.setMessage(R.string.confirm_export_log_dialog_message); alertBuilder.setPositiveButton(R.string.confirm_label, (dialog, which) -> { exportLog(); 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..450a99873 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -19,7 +19,10 @@ import android.widget.EditText; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBarDrawerToggle; -import androidx.appcompat.widget.Toolbar; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowCompat; +import androidx.core.view.WindowInsetsCompat; +import com.google.android.material.appbar.MaterialToolbar; import androidx.core.content.ContextCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; @@ -104,6 +107,7 @@ public class MainActivity extends CastEnabledActivity { if (savedInstanceState != null) { ensureGeneratedViewIdGreaterThan(savedInstanceState.getInt(KEY_GENERATED_VIEW_ID, 0)); } + WindowCompat.setDecorFitsSystemWindows(getWindow(), false); super.onCreate(savedInstanceState); setContentView(R.layout.main); recycledViewPool.setMaxRecycledViews(R.id.view_type_episode_item, 25); @@ -144,11 +148,17 @@ public class MainActivity extends CastEnabledActivity { PreferenceUpgrader.checkUpgrades(this); View bottomSheet = findViewById(R.id.audioplayerFragment); sheetBehavior = (LockableBottomSheetBehavior) BottomSheetBehavior.from(bottomSheet); - sheetBehavior.setPeekHeight((int) getResources().getDimension(R.dimen.external_player_height)); sheetBehavior.setHideable(false); sheetBehavior.setBottomSheetCallback(bottomSheetCallback); } + @Override + public void onAttachedToWindow() { + super.onAttachedToWindow(); + int playerHeight = (int) getResources().getDimension(R.dimen.external_player_height); + sheetBehavior.setPeekHeight(playerHeight + getBottomInset()); + } + /** * View.generateViewId stores the current ID in a static variable. * When the process is killed, the variable gets reset. @@ -198,7 +208,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); @@ -238,6 +248,11 @@ public class MainActivity extends CastEnabledActivity { return sheetBehavior; } + private int getBottomInset() { + WindowInsetsCompat insets = ViewCompat.getRootWindowInsets(getWindow().getDecorView()); + return insets == null ? 0 : insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + } + public void setPlayerVisible(boolean visible) { getBottomSheet().setLocked(!visible); if (visible) { @@ -247,7 +262,8 @@ public class MainActivity extends CastEnabledActivity { } FragmentContainerView mainView = findViewById(R.id.main_view); ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mainView.getLayoutParams(); - params.setMargins(0, 0, 0, visible ? (int) getResources().getDimension(R.dimen.external_player_height) : 0); + int externalPlayerHeight = (int) getResources().getDimension(R.dimen.external_player_height); + params.setMargins(0, 0, 0, getBottomInset() + (visible ? externalPlayerHeight : 0)); mainView.setLayoutParams(params); findViewById(R.id.audioplayerFragment).setVisibility(visible ? View.VISIBLE : View.GONE); } diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index 67647b999..67394018f 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -22,7 +22,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NavUtils; import com.bumptech.glide.Glide; @@ -156,7 +156,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { } private void showNoPodcastFoundError() { - runOnUiThread(() -> new AlertDialog.Builder(OnlineFeedViewActivity.this) + runOnUiThread(() -> new MaterialAlertDialogBuilder(OnlineFeedViewActivity.this) .setNeutralButton(android.R.string.ok, (dialog, which) -> finish()) .setTitle(R.string.error_label) .setMessage(R.string.null_value_podcast_error) @@ -588,7 +588,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { @UiThread private void showErrorDialog(String errorMsg, String details) { if (!isFinishing() && !isPaused) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this); builder.setTitle(R.string.error_label); if (errorMsg != null) { String total = errorMsg + "\n\n" + details; @@ -662,7 +662,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { startFeedDownload(selectedUrl); }; - AlertDialog.Builder ab = new AlertDialog.Builder(OnlineFeedViewActivity.this) + MaterialAlertDialogBuilder ab = new MaterialAlertDialogBuilder(OnlineFeedViewActivity.this) .setTitle(R.string.feeds_label) .setCancelable(true) .setOnCancelListener(dialog -> finish()) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportActivity.java index c10956ab3..f92d422d0 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportActivity.java @@ -20,7 +20,7 @@ import android.widget.Toast; import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts.RequestPermission; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import de.danoeh.antennapod.R; @@ -128,7 +128,7 @@ public class OpmlImportActivity extends AppCompatActivity { void importUri(@Nullable Uri uri) { if (uri == null) { - new AlertDialog.Builder(this) + new MaterialAlertDialogBuilder(this) .setMessage(R.string.opml_import_error_no_file) .setPositiveButton(android.R.string.ok, null) .show(); @@ -202,7 +202,7 @@ public class OpmlImportActivity extends AppCompatActivity { if (isGranted) { startImport(); } else { - new AlertDialog.Builder(this) + new MaterialAlertDialogBuilder(this) .setMessage(R.string.opml_import_ask_read_permission) .setPositiveButton(android.R.string.ok, (dialog, which) -> requestPermission()) @@ -240,7 +240,7 @@ public class OpmlImportActivity extends AppCompatActivity { viewBinding.feedlist.setAdapter(listAdapter); }, e -> { viewBinding.progressBar.setVisibility(View.GONE); - AlertDialog.Builder alert = new AlertDialog.Builder(this); + MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(this); alert.setTitle(R.string.error_label); alert.setMessage(getString(R.string.opml_reader_error) + e.getMessage()); alert.setNeutralButton(android.R.string.ok, (dialog, which) -> dialog.dismiss()); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java index 200154bc2..8a36b3068 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java @@ -10,7 +10,7 @@ import android.view.View; import android.view.inputmethod.InputMethodManager; import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.appcompat.app.AppCompatActivity; import androidx.preference.PreferenceFragmentCompat; @@ -155,7 +155,7 @@ public class PreferenceActivity extends AppCompatActivity implements SearchPrefe public void onSearchResultClicked(SearchPreferenceResult result) { int screen = result.getResourceFile(); if (screen == R.xml.feed_settings) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this); builder.setTitle(R.string.feed_settings_label); builder.setMessage(R.string.pref_feed_settings_dialog_msg); builder.setPositiveButton(android.R.string.ok, null); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java index 048d04939..65a5bf507 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -31,7 +31,7 @@ import android.widget.EditText; import android.widget.FrameLayout; import android.widget.SeekBar; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.core.view.WindowCompat; import androidx.interpolator.view.animation.FastOutSlowInInterpolator; import com.bumptech.glide.Glide; @@ -543,7 +543,7 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. @Subscribe(threadMode = ThreadMode.MAIN) public void onMediaPlayerError(PlayerErrorEvent event) { - final AlertDialog.Builder errorDialog = new AlertDialog.Builder(VideoplayerActivity.this); + final MaterialAlertDialogBuilder errorDialog = new MaterialAlertDialogBuilder(VideoplayerActivity.this); errorDialog.setTitle(R.string.error_label); errorDialog.setMessage(event.getMessage()); errorDialog.setNeutralButton(android.R.string.ok, (dialog, which) -> finish()); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/FeedDiscoverAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/FeedDiscoverAdapter.java index 3628b4bee..5e2c091e9 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/FeedDiscoverAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/FeedDiscoverAdapter.java @@ -5,6 +5,8 @@ import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import com.bumptech.glide.Glide; +import com.bumptech.glide.load.resource.bitmap.FitCenter; +import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.request.RequestOptions; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; @@ -65,7 +67,8 @@ public class FeedDiscoverAdapter extends BaseAdapter { .load(podcast.imageUrl) .apply(new RequestOptions() .placeholder(R.color.light_gray) - .fitCenter() + .transform(new FitCenter(), new RoundedCorners((int) + (8 * mainActivityRef.get().getResources().getDisplayMetrics().density))) .dontAnimate()) .into(holder.imageView); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java index c1df44da3..29f9d3e44 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java @@ -10,14 +10,15 @@ import android.view.LayoutInflater; import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import androidx.preference.PreferenceManager; -import android.util.TypedValue; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; -import androidx.appcompat.app.AlertDialog; +import com.bumptech.glide.load.resource.bitmap.FitCenter; +import com.bumptech.glide.load.resource.bitmap.RoundedCorners; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; @@ -208,12 +209,7 @@ public class NavListAdapter extends RecyclerView.Adapter<NavListAdapter.Holder> holder.itemView.setOnCreateContextMenuListener(itemAccess); } if (viewType != VIEW_TYPE_SECTION_DIVIDER) { - TypedValue typedValue = new TypedValue(); - - activity.get().getTheme().resolveAttribute(itemAccess.isSelected(position) - ? R.attr.drawer_activated_color : android.R.attr.windowBackground, typedValue, true); - holder.itemView.setBackgroundResource(typedValue.resourceId); - + holder.itemView.setSelected(itemAccess.isSelected(position)); holder.itemView.setOnClickListener(v -> itemAccess.onItemClick(position)); holder.itemView.setOnLongClickListener(v -> itemAccess.onItemLongClick(position)); holder.itemView.setOnTouchListener((v, e) -> { @@ -271,7 +267,7 @@ public class NavListAdapter extends RecyclerView.Adapter<NavListAdapter.Holder> Iconify.addIcons(holder.count); holder.count.setVisibility(View.VISIBLE); holder.count.setOnClickListener(v -> - new AlertDialog.Builder(context) + new MaterialAlertDialogBuilder(context) .setTitle(R.string.episode_cache_full_title) .setMessage(R.string.episode_cache_full_message) .setPositiveButton(android.R.string.ok, null) @@ -331,7 +327,8 @@ public class NavListAdapter extends RecyclerView.Adapter<NavListAdapter.Holder> .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) - .fitCenter() + .transform(new FitCenter(), + new RoundedCorners((int) (4 * context.getResources().getDisplayMetrics().density))) .dontAnimate()) .into(holder.image); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/MobileDownloadHelper.java b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/MobileDownloadHelper.java index 6d8af23c0..4c68a559d 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/MobileDownloadHelper.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/MobileDownloadHelper.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.adapter.actionbutton; import android.content.Context; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.service.download.DownloadRequestCreator; import de.danoeh.antennapod.core.service.download.DownloadService; @@ -24,7 +24,7 @@ class MobileDownloadHelper { } static void confirmMobileDownload(final Context context, final FeedItem item) { - AlertDialog.Builder builder = new AlertDialog.Builder(context) + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context) .setTitle(R.string.confirm_mobile_download_dialog_title) .setMessage(R.string.confirm_mobile_download_dialog_message) .setPositiveButton(context.getText(R.string.confirm_mobile_download_dialog_enable_temporarily), diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/AuthenticationDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/AuthenticationDialog.java index 160afcf86..38ee82155 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/AuthenticationDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/AuthenticationDialog.java @@ -4,14 +4,14 @@ import android.content.Context; import android.text.method.HideReturnsTransformationMethod; import android.text.method.PasswordTransformationMethod; import android.view.LayoutInflater; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; import de.danoeh.antennapod.databinding.AuthenticationDialogBinding; /** * Displays a dialog with a username and password text field and an optional checkbox to save username and preferences. */ -public abstract class AuthenticationDialog extends AlertDialog.Builder { +public abstract class AuthenticationDialog extends MaterialAlertDialogBuilder { boolean passwordHidden = true; public AuthenticationDialog(Context context, int titleRes, boolean enableUsernameField, diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java index fc34292cf..47cc60205 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java @@ -4,6 +4,7 @@ import android.content.Context; import android.view.View; import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.core.util.Consumer; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -15,7 +16,7 @@ public class ChooseDataFolderDialog { public static void showDialog(final Context context, Consumer<String> handlerFunc) { View content = View.inflate(context, R.layout.choose_data_folder_dialog, null); - AlertDialog dialog = new AlertDialog.Builder(context) + AlertDialog dialog = new MaterialAlertDialogBuilder(context) .setView(content) .setTitle(R.string.choose_data_directory) .setMessage(R.string.choose_data_directory_message) diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/DownloadLogDetailsDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/DownloadLogDetailsDialog.java index 50fb0651f..023d0a152 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/DownloadLogDetailsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/DownloadLogDetailsDialog.java @@ -6,6 +6,7 @@ import android.content.Context; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.core.storage.DBReader; @@ -14,7 +15,7 @@ import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.FeedMedia; import org.greenrobot.eventbus.EventBus; -public class DownloadLogDetailsDialog extends AlertDialog.Builder { +public class DownloadLogDetailsDialog extends MaterialAlertDialogBuilder { public DownloadLogDetailsDialog(@NonNull Context context, DownloadStatus status) { super(context); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/EpisodeFilterDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/EpisodeFilterDialog.java index 595f37e40..ff58fb1a2 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/EpisodeFilterDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/EpisodeFilterDialog.java @@ -6,7 +6,7 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.RadioButton; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; import de.danoeh.antennapod.model.feed.FeedFilter; @@ -14,7 +14,7 @@ import de.danoeh.antennapod.model.feed.FeedFilter; /** * Displays a dialog with a text box for filtering episodes and two radio buttons for exclusion/inclusion */ -public abstract class EpisodeFilterDialog extends AlertDialog.Builder { +public abstract class EpisodeFilterDialog extends MaterialAlertDialogBuilder { private final FeedFilter initialFilter; public EpisodeFilterDialog(Context context, FeedFilter filter) { diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/FeedPreferenceSkipDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/FeedPreferenceSkipDialog.java index 0e5a064eb..77c9ff67e 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/FeedPreferenceSkipDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/FeedPreferenceSkipDialog.java @@ -3,13 +3,13 @@ package de.danoeh.antennapod.dialog; import android.content.Context; import android.view.View; import android.widget.EditText; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; /** * Displays a dialog with a username and password text field and an optional checkbox to save username and preferences. */ -public abstract class FeedPreferenceSkipDialog extends AlertDialog.Builder { +public abstract class FeedPreferenceSkipDialog extends MaterialAlertDialogBuilder { public FeedPreferenceSkipDialog(Context context, int skipIntroInitialValue, int skipEndInitialValue) { diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/FeedRefreshIntervalDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/FeedRefreshIntervalDialog.java index f97940f8b..e6074da7f 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/FeedRefreshIntervalDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/FeedRefreshIntervalDialog.java @@ -7,7 +7,7 @@ import android.text.format.DateFormat; import android.view.LayoutInflater; import android.view.View; import android.widget.ArrayAdapter; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.download.AutoUpdateManager; @@ -26,7 +26,7 @@ public class FeedRefreshIntervalDialog { } public void show() { - AlertDialog.Builder builder = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setTitle(R.string.feed_refresh_title); builder.setMessage(R.string.feed_refresh_sum); viewBinding = FeedRefreshDialogBinding.inflate(LayoutInflater.from(context)); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/FeedSortDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/FeedSortDialog.java index b89d05f88..c89ef8159 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/FeedSortDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/FeedSortDialog.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.dialog; import android.content.Context; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import org.greenrobot.eventbus.EventBus; @@ -15,7 +15,7 @@ import de.danoeh.antennapod.core.preferences.UserPreferences; public class FeedSortDialog { public static void showDialog(Context context) { - AlertDialog.Builder dialog = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(context); dialog.setTitle(context.getString(R.string.pref_nav_drawer_feed_order_title)); dialog.setNegativeButton(android.R.string.cancel, (d, listener) -> d.dismiss()); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/IntraFeedSortDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/IntraFeedSortDialog.java index 40afddb6c..dc8cf65ba 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/IntraFeedSortDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/IntraFeedSortDialog.java @@ -4,7 +4,7 @@ import android.content.Context; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; import de.danoeh.antennapod.model.feed.SortOrder; @@ -39,8 +39,8 @@ public abstract class IntraFeedSortDialog { public void openDialog() { int idxCurrentSort = getCurrentSortOrderIndex(); - AlertDialog.Builder builder = - new AlertDialog.Builder(context) + MaterialAlertDialogBuilder builder = + new MaterialAlertDialogBuilder(context) .setTitle(R.string.sort) .setSingleChoiceItems(sortItems, idxCurrentSort, (dialog, idxNewSort) -> { updateSort(sortValues[idxNewSort]); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/ItemFilterDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/ItemFilterDialog.java index ae938a6ec..0118eb74e 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/ItemFilterDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/ItemFilterDialog.java @@ -5,15 +5,16 @@ import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Button; import android.widget.LinearLayout; -import android.widget.RadioButton; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.google.android.material.bottomsheet.BottomSheetDialogFragment; +import com.google.android.material.button.MaterialButtonToggleGroup; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.feed.FeedItemFilterGroup; +import de.danoeh.antennapod.databinding.FilterDialogRowBinding; import de.danoeh.antennapod.model.feed.FeedItemFilter; -import de.danoeh.antennapod.ui.common.RecursiveRadioGroup; import java.util.HashSet; import java.util.Set; @@ -32,22 +33,21 @@ public abstract class ItemFilterDialog extends BottomSheetDialogFragment { FeedItemFilter filter = (FeedItemFilter) getArguments().getSerializable(ARGUMENT_FILTER); for (FeedItemFilterGroup item : FeedItemFilterGroup.values()) { - RecursiveRadioGroup row = (RecursiveRadioGroup) inflater.inflate(R.layout.filter_dialog_row, null, false); - row.setOnCheckedChangeListener((group, checkedId) -> onFilterChanged(getNewFilterValues())); - RadioButton filter1 = row.findViewById(R.id.filter_dialog_radioButton1); - RadioButton filter2 = row.findViewById(R.id.filter_dialog_radioButton2); - filter1.setText(item.values[0].displayName); - filter1.setTag(item.values[0].filterId); - filter2.setText(item.values[1].displayName); - filter2.setTag(item.values[1].filterId); - rows.addView(row); + FilterDialogRowBinding binding = FilterDialogRowBinding.inflate(inflater); + binding.getRoot().addOnButtonCheckedListener( + (group, checkedId, isChecked) -> onFilterChanged(getNewFilterValues())); + binding.filterButton1.setText(item.values[0].displayName); + binding.filterButton1.setTag(item.values[0].filterId); + binding.filterButton2.setText(item.values[1].displayName); + binding.filterButton2.setTag(item.values[1].filterId); + rows.addView(binding.getRoot()); } for (String filterId : filter.getValues()) { if (!TextUtils.isEmpty(filterId)) { - RadioButton button = layout.findViewWithTag(filterId); + Button button = layout.findViewWithTag(filterId); if (button != null) { - button.setChecked(true); + ((MaterialButtonToggleGroup) button.getParent()).check(button.getId()); } } } @@ -57,16 +57,18 @@ public abstract class ItemFilterDialog extends BottomSheetDialogFragment { protected Set<String> getNewFilterValues() { final Set<String> newFilterValues = new HashSet<>(); for (int i = 0; i < rows.getChildCount(); i++) { - if (!(rows.getChildAt(i) instanceof RecursiveRadioGroup)) { + if (!(rows.getChildAt(i) instanceof MaterialButtonToggleGroup)) { continue; } - RecursiveRadioGroup group = (RecursiveRadioGroup) rows.getChildAt(i); - if (group.getCheckedButton() != null) { - String tag = (String) group.getCheckedButton().getTag(); - if (tag != null) { // Clear buttons use no tag - newFilterValues.add((String) group.getCheckedButton().getTag()); - } + MaterialButtonToggleGroup group = (MaterialButtonToggleGroup) rows.getChildAt(i); + if (group.getCheckedButtonId() == View.NO_ID) { + continue; + } + String tag = (String) group.findViewById(group.getCheckedButtonId()).getTag(); + if (tag == null) { // Clear buttons use no tag + continue; } + newFilterValues.add(tag); } return newFilterValues; } diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java index 841c121e9..eb3e42a6f 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java @@ -7,6 +7,7 @@ import android.os.Looper; import android.view.View; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.fragment.app.DialogFragment; import android.widget.Button; import android.widget.CheckBox; @@ -54,7 +55,7 @@ public class PlaybackControlsDialog extends DialogFragment { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - dialog = new AlertDialog.Builder(getContext()) + dialog = new MaterialAlertDialogBuilder(getContext()) .setTitle(R.string.audio_controls) .setView(R.layout.audio_controls) .setPositiveButton(R.string.close_label, null).create(); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/ProxyDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/ProxyDialog.java index 266724e78..cc152f783 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/ProxyDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/ProxyDialog.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.res.TypedArray; import android.os.Build; import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.core.content.ContextCompat; import android.text.Editable; import android.text.TextUtils; @@ -62,7 +63,7 @@ public class ProxyDialog { View content = View.inflate(context, R.layout.proxy_settings, null); spType = content.findViewById(R.id.spType); - dialog = new AlertDialog.Builder(context) + dialog = new MaterialAlertDialogBuilder(context) .setTitle(R.string.pref_proxy_title) .setView(content) .setNegativeButton(R.string.cancel_label, null) diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/RenameItemDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/RenameItemDialog.java index 52240606e..e6c5808f8 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/RenameItemDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/RenameItemDialog.java @@ -8,6 +8,7 @@ import java.util.List; import android.view.LayoutInflater; import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.storage.NavDrawerData; import de.danoeh.antennapod.model.feed.Feed; @@ -41,7 +42,7 @@ public class RenameItemDialog { String title = feed != null ? feed.getTitle() : drawerItem.getTitle(); binding.urlEditText.setText(title); - AlertDialog dialog = new AlertDialog.Builder(activity) + AlertDialog dialog = new MaterialAlertDialogBuilder(activity) .setView(binding.getRoot()) .setTitle(feed != null ? R.string.rename_feed_label : R.string.rename_tag_label) .setPositiveButton(android.R.string.ok, (d, input) -> { diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SkipPreferenceDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SkipPreferenceDialog.java index 2b8976635..8362f6863 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SkipPreferenceDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SkipPreferenceDialog.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.dialog; import android.content.Context; import android.widget.TextView; import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import java.text.NumberFormat; import java.util.Locale; @@ -34,7 +35,7 @@ public class SkipPreferenceDialog { "%d %s", values[i], context.getString(R.string.time_seconds)); } - AlertDialog.Builder builder = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setTitle(direction == SkipDirection.SKIP_FORWARD ? R.string.pref_fast_forward : R.string.pref_rewind); builder.setSingleChoiceItems(choices, checked, null); builder.setNegativeButton(R.string.cancel_label, null); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java index 8cd34b5f8..5a4adf6a4 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java @@ -14,7 +14,7 @@ import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.fragment.app.DialogFragment; import com.google.android.material.snackbar.Snackbar; import de.danoeh.antennapod.R; @@ -64,7 +64,7 @@ public class SleepTimerDialog extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { View content = View.inflate(getContext(), R.layout.time_dialog, null); - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); builder.setTitle(R.string.sleep_timer_label); builder.setView(content); builder.setPositiveButton(R.string.close_label, null); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/StreamingConfirmationDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/StreamingConfirmationDialog.java index a38463c4a..1edc580a8 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/StreamingConfirmationDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/StreamingConfirmationDialog.java @@ -1,7 +1,7 @@ package de.danoeh.antennapod.dialog; import android.content.Context; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.model.playback.Playable; @@ -17,7 +17,7 @@ public class StreamingConfirmationDialog { } public void show() { - new AlertDialog.Builder(context) + new MaterialAlertDialogBuilder(context) .setTitle(R.string.stream_label) .setMessage(R.string.confirm_mobile_streaming_notification_message) .setPositiveButton(R.string.confirm_mobile_streaming_button_once, (dialog, which) -> stream()) diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java index a468794cb..f9d17f37b 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java @@ -4,11 +4,13 @@ import android.content.Context; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; +import android.widget.Button; import android.widget.LinearLayout; -import android.widget.RadioButton; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.button.MaterialButtonToggleGroup; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import de.danoeh.antennapod.databinding.FilterDialogRowBinding; import org.greenrobot.eventbus.EventBus; import java.util.Arrays; @@ -20,13 +22,12 @@ import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.model.feed.SubscriptionsFilter; import de.danoeh.antennapod.core.feed.SubscriptionsFilterGroup; import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.ui.common.RecursiveRadioGroup; public class SubscriptionsFilterDialog { public static void showDialog(Context context) { SubscriptionsFilter subscriptionsFilter = UserPreferences.getSubscriptionsFilter(); final Set<String> filterValues = new HashSet<>(Arrays.asList(subscriptionsFilter.getValues())); - AlertDialog.Builder builder = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setTitle(context.getString(R.string.pref_filter_feed_title)); LayoutInflater inflater = LayoutInflater.from(context); @@ -35,39 +36,42 @@ public class SubscriptionsFilterDialog { builder.setView(layout); for (SubscriptionsFilterGroup item : SubscriptionsFilterGroup.values()) { - RecursiveRadioGroup row = (RecursiveRadioGroup) inflater.inflate(R.layout.filter_dialog_row, null); - RadioButton filter1 = row.findViewById(R.id.filter_dialog_radioButton1); - RadioButton filter2 = row.findViewById(R.id.filter_dialog_radioButton2); - filter1.setText(item.values[0].displayName); - filter1.setTag(item.values[0].filterId); + FilterDialogRowBinding binding = FilterDialogRowBinding.inflate(inflater); + binding.filterButton1.setText(item.values[0].displayName); + binding.filterButton1.setTag(item.values[0].filterId); if (item.values.length == 2) { - filter2.setText(item.values[1].displayName); - filter2.setTag(item.values[1].filterId); + binding.filterButton2.setText(item.values[1].displayName); + binding.filterButton2.setTag(item.values[1].filterId); } else { - filter2.setVisibility(View.GONE); + binding.filterButton2.setVisibility(View.GONE); } - rows.addView(row); + rows.addView(binding.getRoot()); } for (String filterId : filterValues) { if (!TextUtils.isEmpty(filterId)) { - ((RadioButton) layout.findViewWithTag(filterId)).setChecked(true); + Button button = layout.findViewWithTag(filterId); + if (button != null) { + ((MaterialButtonToggleGroup) button.getParent()).check(button.getId()); + } } } builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> { filterValues.clear(); for (int i = 0; i < rows.getChildCount(); i++) { - if (!(rows.getChildAt(i) instanceof RecursiveRadioGroup)) { + if (!(rows.getChildAt(i) instanceof MaterialButtonToggleGroup)) { + continue; + } + MaterialButtonToggleGroup group = (MaterialButtonToggleGroup) rows.getChildAt(i); + if (group.getCheckedButtonId() == View.NO_ID) { continue; } - RecursiveRadioGroup group = (RecursiveRadioGroup) rows.getChildAt(i); - if (group.getCheckedButton() != null) { - String tag = (String) group.getCheckedButton().getTag(); - if (tag != null) { // Clear buttons use no tag - filterValues.add((String) group.getCheckedButton().getTag()); - } + String tag = (String) group.findViewById(group.getCheckedButtonId()).getTag(); + if (tag == null) { // Clear buttons use no tag + continue; } + filterValues.add(tag); } updateFilter(filterValues); }); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java index 6849e641b..a4ed7ac8c 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java @@ -8,6 +8,7 @@ import android.view.LayoutInflater; import android.view.View; import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.appcompat.content.res.AppCompatResources; import androidx.core.graphics.drawable.DrawableCompat; import androidx.gridlayout.widget.GridLayout; @@ -52,7 +53,7 @@ public class SwipeActionsDialog { leftAction = actions.left; rightAction = actions.right; - final AlertDialog.Builder builder = new AlertDialog.Builder(context); + final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); keys = SwipeActions.swipeActions; @@ -128,7 +129,7 @@ public class SwipeActionsDialog { } private void showPicker(SwipeactionsRowBinding view, int direction) { - AlertDialog.Builder builder = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setTitle(direction == LEFT ? R.string.swipe_left : R.string.swipe_right); SwipeactionsPickerBinding picker = SwipeactionsPickerBinding.inflate(LayoutInflater.from(context)); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/TagSettingsDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/TagSettingsDialog.java index 8f5f1b802..47a706c86 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/TagSettingsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/TagSettingsDialog.java @@ -10,7 +10,7 @@ import android.view.ViewGroup; import android.widget.ArrayAdapter; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.fragment.app.DialogFragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -85,7 +85,7 @@ public class TagSettingsDialog extends DialogFragment { viewBinding.commonTagsInfo.setVisibility(View.VISIBLE); } - AlertDialog.Builder dialog = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(getContext()); dialog.setView(viewBinding.getRoot()); dialog.setTitle(R.string.feed_tags_label); dialog.setPositiveButton(android.R.string.ok, (d, input) -> { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java index ab6d5a302..4b6beac13 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java @@ -20,7 +20,7 @@ import androidx.activity.result.contract.ActivityResultContracts.GetContent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.documentfile.provider.DocumentFile; import androidx.fragment.app.Fragment; import com.google.android.material.snackbar.Snackbar; @@ -132,7 +132,7 @@ public class AddFeedFragment extends Fragment { } private void showAddViaUrlDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); builder.setTitle(R.string.add_podcast_by_url); final EditTextDialogBinding dialogBinding = EditTextDialogBinding.inflate(getLayoutInflater()); dialogBinding.urlEditText.setHint(R.string.add_podcast_by_url_hint); 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..5a00e0e96 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java @@ -14,8 +14,8 @@ 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.dialog.MaterialAlertDialogBuilder; +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); @@ -397,7 +399,7 @@ public class AudioPlayerFragment extends Fragment implements @Subscribe(threadMode = ThreadMode.MAIN) public void mediaPlayerError(PlayerErrorEvent event) { - final AlertDialog.Builder errorDialog = new AlertDialog.Builder(getContext()); + final MaterialAlertDialogBuilder errorDialog = new MaterialAlertDialogBuilder(getContext()); errorDialog.setTitle(R.string.error_label); errorDialog.setMessage(event.getMessage()); errorDialog.setPositiveButton(android.R.string.ok, (dialog, which) -> diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java index de63227e5..8304b8f58 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java @@ -11,7 +11,7 @@ import android.widget.RelativeLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.appcompat.app.AppCompatDialogFragment; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; @@ -47,7 +47,7 @@ public class ChaptersFragment extends AppCompatDialogFragment { @NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { - return new AlertDialog.Builder(requireContext()) + return new MaterialAlertDialogBuilder(requireContext()) .setTitle(getString(R.string.chapters_label)) .setView(onCreateView(getLayoutInflater())) .setNegativeButton(getString(R.string.cancel_label), null) //dismisses 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..29074567c 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java @@ -23,9 +23,9 @@ import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; 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(); @@ -292,7 +292,7 @@ public class FeedInfoFragment extends Fragment implements Toolbar.OnMenuItemClic boolean handled = FeedMenuHandler.onOptionsItemClicked(getContext(), item, feed); if (item.getItemId() == R.id.reconnect_local_folder && Build.VERSION.SDK_INT >= 21) { - AlertDialog.Builder alert = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(getContext()); alert.setMessage(R.string.reconnect_local_folder_warning); alert.setPositiveButton(android.R.string.ok, (dialog, which) -> { try { 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..1999d7294 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java @@ -7,8 +7,8 @@ import android.view.View; 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.dialog.MaterialAlertDialogBuilder; +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() @@ -216,7 +216,7 @@ public class FeedSettingsFragment extends Fragment { }); viewBinding.useGlobalCheckbox.setChecked(speed == FeedPreferences.SPEED_USE_GLOBAL); viewBinding.seekBar.updateSpeed(speed == FeedPreferences.SPEED_USE_GLOBAL ? 1 : speed); - new AlertDialog.Builder(getContext()) + new MaterialAlertDialogBuilder(getContext()) .setTitle(R.string.playback_speed) .setView(viewBinding.getRoot()) .setPositiveButton(android.R.string.ok, (dialog, which) -> { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java index 375356c2c..a6f1a96f7 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java @@ -296,7 +296,7 @@ public class ItemFragment extends Fragment { .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .transform(new FitCenter(), - new RoundedCorners((int) (4 * getResources().getDisplayMetrics().density))) + new RoundedCorners((int) (8 * getResources().getDisplayMetrics().density))) .dontAnimate(); Glide.with(getActivity()) 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..c54374059 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -16,8 +16,8 @@ import android.view.ViewGroup; 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.dialog.MaterialAlertDialogBuilder; +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; @@ -347,7 +348,7 @@ public class QueueFragment extends Fragment implements Toolbar.OnMenuItemClickLi if (!shouldShowLockWarning) { setQueueLocked(true); } else { - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); builder.setTitle(R.string.lock_queue); builder.setMessage(R.string.queue_lock_warning); @@ -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/fragment/actions/FeedMultiSelectActionHandler.java b/app/src/main/java/de/danoeh/antennapod/fragment/actions/FeedMultiSelectActionHandler.java index 5cd0f26ab..203a64c32 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/actions/FeedMultiSelectActionHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/actions/FeedMultiSelectActionHandler.java @@ -3,7 +3,7 @@ package de.danoeh.antennapod.fragment.actions; import android.util.Log; import androidx.annotation.PluralsRes; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.core.util.Consumer; import com.google.android.material.snackbar.Snackbar; @@ -75,7 +75,7 @@ public class FeedMultiSelectActionHandler { viewBinding.currentSpeedLabel.setAlpha(isChecked ? 0.4f : 1f); }); viewBinding.seekBar.updateSpeed(1.0f); - new AlertDialog.Builder(activity) + new MaterialAlertDialogBuilder(activity) .setTitle(R.string.playback_speed) .setView(viewBinding.getRoot()) .setPositiveButton(android.R.string.ok, (dialog, which) -> { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/ImportExportPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/ImportExportPreferencesFragment.java index 075d01b8b..3b4368464 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/ImportExportPreferencesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/ImportExportPreferencesFragment.java @@ -16,7 +16,7 @@ import androidx.activity.result.contract.ActivityResultContracts.GetContent; import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult; import androidx.annotation.NonNull; import androidx.annotation.StringRes; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.core.app.ShareCompat; import androidx.core.content.FileProvider; import androidx.preference.PreferenceFragmentCompat; @@ -166,7 +166,7 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat { private void importDatabase() { // setup the alert builder - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity()); builder.setTitle(R.string.database_import_label); builder.setMessage(R.string.database_import_warning); @@ -183,7 +183,7 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat { } private void showDatabaseImportSuccessDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); builder.setTitle(R.string.successful_import_label); builder.setMessage(R.string.import_ok); builder.setCancelable(false); @@ -192,7 +192,7 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat { } private void showExportSuccessDialog(String path, Uri streamUri, Export exportType) { - final AlertDialog.Builder alert = new AlertDialog.Builder(getContext()); + final MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(getContext()); alert.setNeutralButton(android.R.string.ok, (dialog, which) -> dialog.dismiss()); alert.setTitle(R.string.export_success_title); alert.setMessage(getContext().getString(R.string.export_success_sum, path)); @@ -209,7 +209,7 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat { private void showExportErrorDialog(final Throwable error) { progressDialog.dismiss(); - final AlertDialog.Builder alert = new AlertDialog.Builder(getContext()); + final MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(getContext()); alert.setPositiveButton(android.R.string.ok, (dialog, which) -> dialog.dismiss()); alert.setTitle(R.string.export_error_label); alert.setMessage(error.getMessage()); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java index 7a0b47937..91bb00437 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java @@ -5,7 +5,7 @@ import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.os.Bundle; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.appcompat.app.AppCompatActivity; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; @@ -132,7 +132,7 @@ public class MainPreferencesFragment extends PreferenceFragmentCompat { }); findPreference(PREF_STATISTICS).setOnPreferenceClickListener( preference -> { - new AlertDialog.Builder(getContext()) + new MaterialAlertDialogBuilder(getContext()) .setMessage(R.string.statistics_moved) .setPositiveButton(android.R.string.ok, null) .show(); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java index ef6dabe24..64e75acfe 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java @@ -5,9 +5,10 @@ import android.os.Build; import android.os.Bundle; import android.widget.ListView; import androidx.appcompat.app.AlertDialog; +import com.google.android.material.snackbar.Snackbar; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.core.app.ActivityCompat; import androidx.preference.PreferenceFragmentCompat; -import com.google.android.material.snackbar.Snackbar; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.core.preferences.UserPreferences; @@ -98,7 +99,7 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat { } } - AlertDialog.Builder builder = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setTitle(String.format(context.getResources().getString( R.string.pref_compact_notification_buttons_dialog_title), 2)); builder.setMultiChoiceItems(allButtonNames, checked, (dialog, which, isChecked) -> { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/LicensesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/LicensesFragment.java index 38e532aed..8b86d106e 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/LicensesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/LicensesFragment.java @@ -6,7 +6,7 @@ import android.widget.ListView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.fragment.app.ListFragment; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.PreferenceActivity; @@ -81,7 +81,7 @@ public class LicensesFragment extends ListFragment { LicenseItem item = licenses.get(position); CharSequence[] items = {"View website", "View license"}; - new AlertDialog.Builder(getContext()) + new MaterialAlertDialogBuilder(getContext()) .setTitle(item.title) .setItems(items, (dialog, which) -> { if (which == 0) { @@ -102,7 +102,7 @@ public class LicensesFragment extends ListFragment { licenseText.append(line).append("\n"); } - new AlertDialog.Builder(getContext()) + new MaterialAlertDialogBuilder(getContext()) .setMessage(licenseText) .show(); } catch (IOException e) { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/dialog/PreferenceListDialog.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/dialog/PreferenceListDialog.java index d5c487d1d..b6a11c001 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/dialog/PreferenceListDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/dialog/PreferenceListDialog.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.fragment.preferences.dialog; import android.content.Context; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; @@ -29,7 +29,7 @@ public class PreferenceListDialog { public void openDialog(String[] items) { - AlertDialog.Builder builder = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setTitle(title); builder.setSingleChoiceItems(items, selectedPos, (dialog, which) -> { selectedPos = which; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/dialog/PreferenceSwitchDialog.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/dialog/PreferenceSwitchDialog.java index cc7c92194..69319c11e 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/dialog/PreferenceSwitchDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/dialog/PreferenceSwitchDialog.java @@ -4,7 +4,7 @@ import android.content.Context; import android.view.LayoutInflater; import android.view.View; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.appcompat.widget.SwitchCompat; import de.danoeh.antennapod.R; @@ -33,7 +33,7 @@ public class PreferenceSwitchDialog { public void openDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setTitle(title); LayoutInflater inflater = LayoutInflater.from(this.context); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java index e3e069868..e340d6c1d 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java @@ -15,7 +15,7 @@ import android.widget.TextView; import android.widget.ViewFlipper; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.fragment.app.DialogFragment; import com.google.android.material.button.MaterialButton; import de.danoeh.antennapod.R; @@ -62,7 +62,7 @@ public class GpodderAuthenticationFragment extends DialogFragment { @NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { - AlertDialog.Builder dialog = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(getContext()); dialog.setTitle(R.string.gpodnetauth_login_butLabel); dialog.setNegativeButton(R.string.cancel_label, null); dialog.setCancelable(false); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/NextcloudAuthenticationFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/NextcloudAuthenticationFragment.java index 2e9260c1d..3578dace5 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/NextcloudAuthenticationFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/NextcloudAuthenticationFragment.java @@ -6,7 +6,7 @@ import android.os.Bundle; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.fragment.app.DialogFragment; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; @@ -30,7 +30,7 @@ public class NextcloudAuthenticationFragment extends DialogFragment @NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { - AlertDialog.Builder dialog = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(getContext()); dialog.setTitle(R.string.gpodnetauth_login_butLabel); dialog.setNegativeButton(R.string.cancel_label, null); dialog.setCancelable(false); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/SynchronizationPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/SynchronizationPreferencesFragment.java index 8cb7f45db..2ac1f78df 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/SynchronizationPreferencesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/SynchronizationPreferencesFragment.java @@ -13,7 +13,7 @@ import android.widget.ListAdapter; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.core.text.HtmlCompat; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; @@ -149,7 +149,7 @@ public class SynchronizationPreferencesFragment extends PreferenceFragmentCompat } private void chooseProviderAndLogin() { - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); builder.setTitle(R.string.dialog_choose_sync_service_title); SynchronizationProviderViewData[] providers = SynchronizationProviderViewData.values(); @@ -199,8 +199,7 @@ public class SynchronizationPreferencesFragment extends PreferenceFragmentCompat updateScreen(); }); - AlertDialog dialog = builder.create(); - dialog.show(); + builder.show(); } private boolean isProviderSelected(@NonNull SynchronizationProviderViewData provider) { diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/NumberPickerPreference.java b/app/src/main/java/de/danoeh/antennapod/preferences/NumberPickerPreference.java index 484d56e96..a15c6d6b2 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/NumberPickerPreference.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/NumberPickerPreference.java @@ -2,6 +2,7 @@ package de.danoeh.antennapod.preferences; import android.content.Context; import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.preference.Preference; import android.text.InputFilter; import android.util.AttributeSet; @@ -78,7 +79,7 @@ public class NumberPickerPreference extends Preference { return ""; }}); - AlertDialog dialog = new AlertDialog.Builder(context) + AlertDialog dialog = new MaterialAlertDialogBuilder(context) .setTitle(getTitle()) .setView(view) .setNegativeButton(android.R.string.cancel, null) 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..0b6ede087 100644 --- a/app/src/main/res/layout/addfeed.xml +++ b/app/src/main/res/layout/addfeed.xml @@ -4,9 +4,10 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" + android:fitsSystemWindows="true" android:orientation="vertical"> - <androidx.appcompat.widget.Toolbar + <com.google.android.material.appbar.MaterialToolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -20,7 +21,7 @@ android:layout_height="wrap_content" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" - app:cardCornerRadius="4dp" + app:cardCornerRadius="8dp" app:cardElevation="4dp"> <LinearLayout diff --git a/app/src/main/res/layout/audioplayer_fragment.xml b/app/src/main/res/layout/audioplayer_fragment.xml index 2008a8f33..9b1650a76 100644 --- a/app/src/main/res/layout/audioplayer_fragment.xml +++ b/app/src/main/res/layout/audioplayer_fragment.xml @@ -1,276 +1,283 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout +<FrameLayout 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" android:layout_width="match_parent" android:layout_height="match_parent"> - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:minHeight="?attr/actionBarSize" - android:theme="?attr/actionBarTheme" - app:navigationContentDescription="@string/toolbar_back_button_content_description" - app:navigationIcon="@drawable/ic_arrow_down" /> - <androidx.fragment.app.FragmentContainerView android:id="@+id/playerFragment" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_alignParentTop="true" + android:layout_gravity="top" android:background="?attr/background_elevated" android:elevation="8dp" tools:layout_height="@dimen/external_player_height" /> - <androidx.viewpager2.widget.ViewPager2 - android:id="@+id/pager" + <RelativeLayout android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_above="@id/playtime_layout" - android:layout_below="@id/toolbar" - android:layout_marginBottom="12dp" - android:foreground="?android:windowContentOverlay" - android:orientation="vertical" /> + android:layout_height="match_parent" + android:fitsSystemWindows="true"> - <ImageView - android:layout_width="match_parent" - android:layout_height="8dp" - android:layout_alignBottom="@id/pager" - android:importantForAccessibility="no" - app:srcCompat="@drawable/bg_gradient" - app:tint="?android:attr/windowBackground" /> - - <androidx.cardview.widget.CardView - android:id="@+id/cardViewSeek" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignBottom="@+id/pager" - android:layout_centerHorizontal="true" - android:layout_marginLeft="16dp" - android:layout_marginRight="16dp" - android:layout_marginBottom="12dp" - android:alpha="0" - app:cardBackgroundColor="?attr/seek_background" - app:cardCornerRadius="8dp" - app:cardElevation="0dp" - tools:alpha="1"> - - <TextView - android:id="@+id/txtvSeek" - android:layout_width="wrap_content" + <com.google.android.material.appbar.MaterialToolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="center" - android:paddingLeft="24dp" - android:paddingTop="4dp" - android:paddingRight="24dp" - android:paddingBottom="4dp" - android:textColor="@color/white" - android:textSize="16sp" - tools:text="1:06:29" /> + android:layout_alignParentTop="true" + android:minHeight="?attr/actionBarSize" + android:theme="?attr/actionBarTheme" + app:navigationContentDescription="@string/toolbar_back_button_content_description" + app:navigationIcon="@drawable/ic_arrow_down" /> - </androidx.cardview.widget.CardView> - - <LinearLayout - android:id="@+id/playtime_layout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layoutDirection="ltr" - android:orientation="vertical"> - - <de.danoeh.antennapod.view.ChapterSeekBar - android:id="@+id/sbPosition" + <androidx.viewpager2.widget.ViewPager2 + android:id="@+id/pager" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginLeft="8dp" - android:layout_marginRight="8dp" - android:clickable="true" - android:max="500" - tools:progress="100" /> + android:layout_height="0dp" + android:layout_above="@id/playtime_layout" + android:layout_below="@id/toolbar" + android:layout_marginBottom="12dp" + android:foreground="?android:windowContentOverlay" + android:orientation="vertical" /> - <RelativeLayout + <ImageView android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="4dp" - android:layout_marginBottom="4dp" - android:paddingLeft="8dp" - android:paddingRight="8dp"> + android:layout_height="8dp" + android:layout_alignBottom="@id/pager" + android:importantForAccessibility="no" + app:srcCompat="@drawable/bg_gradient" + app:tint="?android:attr/windowBackground" /> - <TextView - android:id="@+id/txtvPosition" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentStart="true" - android:layout_alignParentLeft="true" - android:layout_marginStart="16dp" - android:layout_marginLeft="16dp" - android:text="@string/position_default_label" - android:textColor="?android:attr/textColorSecondary" - android:textSize="@dimen/text_size_micro" /> + <androidx.cardview.widget.CardView + android:id="@+id/cardViewSeek" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBottom="@+id/pager" + android:layout_centerHorizontal="true" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_marginBottom="12dp" + android:alpha="0" + app:cardBackgroundColor="?attr/seek_background" + app:cardCornerRadius="8dp" + app:cardElevation="0dp" + tools:alpha="1"> <TextView - android:id="@+id/txtvLength" + android:id="@+id/txtvSeek" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" - android:layout_marginEnd="16dp" - android:layout_marginRight="16dp" - android:background="?android:attr/selectableItemBackground" - android:text="@string/position_default_label" - android:textColor="?android:attr/textColorSecondary" - android:textSize="@dimen/text_size_micro" /> + android:gravity="center" + android:paddingLeft="24dp" + android:paddingTop="4dp" + android:paddingRight="24dp" + android:paddingBottom="4dp" + android:textColor="@color/white" + android:textSize="16sp" + tools:text="1:06:29" /> - </RelativeLayout> + </androidx.cardview.widget.CardView> - <RelativeLayout - android:id="@+id/player_control" + <LinearLayout + android:id="@+id/playtime_layout" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="24dp"> + android:layout_alignParentBottom="true" + android:layoutDirection="ltr" + android:orientation="vertical"> - <de.danoeh.antennapod.view.PlayButton - android:id="@+id/butPlay" - android:layout_width="@dimen/audioplayer_playercontrols_length_big" - android:layout_height="@dimen/audioplayer_playercontrols_length_big" - android:layout_centerHorizontal="true" - android:layout_centerVertical="true" - android:layout_marginStart="@dimen/audioplayer_playercontrols_margin" - android:layout_marginLeft="@dimen/audioplayer_playercontrols_margin" - android:layout_marginEnd="@dimen/audioplayer_playercontrols_margin" - android:layout_marginRight="@dimen/audioplayer_playercontrols_margin" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/pause_label" - android:padding="8dp" - android:scaleType="fitCenter" - app:srcCompat="@drawable/ic_play_48dp" - tools:srcCompat="@drawable/ic_play_48dp" /> + <de.danoeh.antennapod.view.ChapterSeekBar + android:id="@+id/sbPosition" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" + android:clickable="true" + android:max="500" + tools:progress="100" /> - <de.danoeh.antennapod.ui.common.CircularProgressBar - android:layout_width="@dimen/audioplayer_playercontrols_length_big" - android:layout_height="@dimen/audioplayer_playercontrols_length_big" - android:layout_centerHorizontal="true" - android:layout_centerVertical="true" - android:layout_marginStart="16dp" - android:layout_marginLeft="16dp" - android:layout_marginEnd="16dp" - android:layout_marginRight="16dp" - app:foregroundColor="?attr/action_icon_color" /> + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="4dp" + android:layout_marginBottom="4dp" + android:paddingLeft="8dp" + android:paddingRight="8dp"> - <ProgressBar - android:id="@+id/progLoading" - android:layout_width="@dimen/audioplayer_playercontrols_length_big" - android:layout_height="@dimen/audioplayer_playercontrols_length_big" - android:layout_centerHorizontal="true" - android:layout_centerVertical="true" - android:visibility="gone" - style="?android:attr/progressBarStyle" /> + <TextView + android:id="@+id/txtvPosition" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" + android:layout_marginStart="16dp" + android:layout_marginLeft="16dp" + android:text="@string/position_default_label" + android:textColor="?android:attr/textColorSecondary" + android:textSize="@dimen/text_size_micro" /> - <ImageButton - android:id="@+id/butRev" - android:layout_width="@dimen/audioplayer_playercontrols_length" - android:layout_height="@dimen/audioplayer_playercontrols_length" - android:layout_centerVertical="true" - android:layout_marginStart="@dimen/audioplayer_playercontrols_margin" - android:layout_marginLeft="@dimen/audioplayer_playercontrols_margin" - android:layout_toStartOf="@id/butPlay" - android:layout_toLeftOf="@id/butPlay" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/rewind_label" - android:scaleType="fitCenter" - app:srcCompat="@drawable/ic_fast_rewind" - tools:srcCompat="@drawable/ic_fast_rewind" /> + <TextView + android:id="@+id/txtvLength" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" + android:background="?android:attr/selectableItemBackground" + android:text="@string/position_default_label" + android:textColor="?android:attr/textColorSecondary" + android:textSize="@dimen/text_size_micro" /> - <TextView - android:id="@+id/txtvRev" - android:layout_width="wrap_content" + </RelativeLayout> + + <RelativeLayout + android:id="@+id/player_control" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_below="@id/butRev" - android:layout_alignStart="@id/butRev" - android:layout_alignLeft="@id/butRev" - android:layout_alignEnd="@id/butRev" - android:layout_alignRight="@id/butRev" - android:clickable="false" - android:gravity="center" - android:text="30" - android:textColor="?android:attr/textColorSecondary" - android:textSize="12sp" /> + android:layout_marginBottom="24dp"> - <de.danoeh.antennapod.ui.common.PlaybackSpeedIndicatorView - android:id="@+id/butPlaybackSpeed" - android:layout_width="@dimen/audioplayer_playercontrols_length" - android:layout_height="@dimen/audioplayer_playercontrols_length" - android:layout_centerVertical="true" - android:layout_toStartOf="@id/butRev" - android:layout_toLeftOf="@id/butRev" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/playback_speed" - app:foregroundColor="?attr/action_icon_color" - tools:srcCompat="@drawable/ic_playback_speed" /> + <de.danoeh.antennapod.view.PlayButton + android:id="@+id/butPlay" + android:layout_width="@dimen/audioplayer_playercontrols_length_big" + android:layout_height="@dimen/audioplayer_playercontrols_length_big" + android:layout_centerHorizontal="true" + android:layout_centerVertical="true" + android:layout_marginStart="@dimen/audioplayer_playercontrols_margin" + android:layout_marginLeft="@dimen/audioplayer_playercontrols_margin" + android:layout_marginEnd="@dimen/audioplayer_playercontrols_margin" + android:layout_marginRight="@dimen/audioplayer_playercontrols_margin" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/pause_label" + android:padding="8dp" + android:scaleType="fitCenter" + app:srcCompat="@drawable/ic_play_48dp" + tools:srcCompat="@drawable/ic_play_48dp" /> - <TextView - android:id="@+id/txtvPlaybackSpeed" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_below="@id/butPlaybackSpeed" - android:layout_alignStart="@id/butPlaybackSpeed" - android:layout_alignLeft="@id/butPlaybackSpeed" - android:layout_alignEnd="@id/butPlaybackSpeed" - android:layout_alignRight="@id/butPlaybackSpeed" - android:clickable="false" - android:gravity="center" - android:text="1.00" - android:textColor="?android:attr/textColorSecondary" - android:textSize="12sp" /> + <de.danoeh.antennapod.ui.common.CircularProgressBar + android:layout_width="@dimen/audioplayer_playercontrols_length_big" + android:layout_height="@dimen/audioplayer_playercontrols_length_big" + android:layout_centerHorizontal="true" + android:layout_centerVertical="true" + android:layout_marginStart="16dp" + android:layout_marginLeft="16dp" + android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" + app:foregroundColor="?attr/action_icon_color" /> - <ImageButton - android:id="@+id/butFF" - android:layout_width="@dimen/audioplayer_playercontrols_length" - android:layout_height="@dimen/audioplayer_playercontrols_length" - android:layout_centerVertical="true" - android:layout_marginEnd="@dimen/audioplayer_playercontrols_margin" - android:layout_marginRight="@dimen/audioplayer_playercontrols_margin" - android:layout_toEndOf="@id/butPlay" - android:layout_toRightOf="@id/butPlay" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/fast_forward_label" - android:scaleType="fitCenter" - app:srcCompat="@drawable/ic_fast_forward" - tools:srcCompat="@drawable/ic_fast_forward" /> + <ProgressBar + android:id="@+id/progLoading" + android:layout_width="@dimen/audioplayer_playercontrols_length_big" + android:layout_height="@dimen/audioplayer_playercontrols_length_big" + android:layout_centerHorizontal="true" + android:layout_centerVertical="true" + android:visibility="gone" + style="?android:attr/progressBarStyle" /> - <TextView - android:id="@+id/txtvFF" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_below="@id/butFF" - android:layout_alignStart="@id/butFF" - android:layout_alignLeft="@id/butFF" - android:layout_alignEnd="@id/butFF" - android:layout_alignRight="@id/butFF" - android:clickable="false" - android:gravity="center" - android:text="30" - android:textColor="?android:attr/textColorSecondary" - android:textSize="12sp" /> + <ImageButton + android:id="@+id/butRev" + android:layout_width="@dimen/audioplayer_playercontrols_length" + android:layout_height="@dimen/audioplayer_playercontrols_length" + android:layout_centerVertical="true" + android:layout_marginStart="@dimen/audioplayer_playercontrols_margin" + android:layout_marginLeft="@dimen/audioplayer_playercontrols_margin" + android:layout_toStartOf="@id/butPlay" + android:layout_toLeftOf="@id/butPlay" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/rewind_label" + android:scaleType="fitCenter" + app:srcCompat="@drawable/ic_fast_rewind" + tools:srcCompat="@drawable/ic_fast_rewind" /> + + <TextView + android:id="@+id/txtvRev" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/butRev" + android:layout_alignStart="@id/butRev" + android:layout_alignLeft="@id/butRev" + android:layout_alignEnd="@id/butRev" + android:layout_alignRight="@id/butRev" + android:clickable="false" + android:gravity="center" + android:text="30" + android:textColor="?android:attr/textColorSecondary" + android:textSize="12sp" /> + + <de.danoeh.antennapod.ui.common.PlaybackSpeedIndicatorView + android:id="@+id/butPlaybackSpeed" + android:layout_width="@dimen/audioplayer_playercontrols_length" + android:layout_height="@dimen/audioplayer_playercontrols_length" + android:layout_centerVertical="true" + android:layout_toStartOf="@id/butRev" + android:layout_toLeftOf="@id/butRev" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/playback_speed" + app:foregroundColor="?attr/action_icon_color" + tools:srcCompat="@drawable/ic_playback_speed" /> + + <TextView + android:id="@+id/txtvPlaybackSpeed" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/butPlaybackSpeed" + android:layout_alignStart="@id/butPlaybackSpeed" + android:layout_alignLeft="@id/butPlaybackSpeed" + android:layout_alignEnd="@id/butPlaybackSpeed" + android:layout_alignRight="@id/butPlaybackSpeed" + android:clickable="false" + android:gravity="center" + android:text="1.00" + android:textColor="?android:attr/textColorSecondary" + android:textSize="12sp" /> + + <ImageButton + android:id="@+id/butFF" + android:layout_width="@dimen/audioplayer_playercontrols_length" + android:layout_height="@dimen/audioplayer_playercontrols_length" + android:layout_centerVertical="true" + android:layout_marginEnd="@dimen/audioplayer_playercontrols_margin" + android:layout_marginRight="@dimen/audioplayer_playercontrols_margin" + android:layout_toEndOf="@id/butPlay" + android:layout_toRightOf="@id/butPlay" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/fast_forward_label" + android:scaleType="fitCenter" + app:srcCompat="@drawable/ic_fast_forward" + tools:srcCompat="@drawable/ic_fast_forward" /> + + <TextView + android:id="@+id/txtvFF" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/butFF" + android:layout_alignStart="@id/butFF" + android:layout_alignLeft="@id/butFF" + android:layout_alignEnd="@id/butFF" + android:layout_alignRight="@id/butFF" + android:clickable="false" + android:gravity="center" + android:text="30" + android:textColor="?android:attr/textColorSecondary" + android:textSize="12sp" /> + + <ImageButton + android:id="@+id/butSkip" + android:layout_width="@dimen/audioplayer_playercontrols_length" + android:layout_height="@dimen/audioplayer_playercontrols_length" + android:layout_centerVertical="true" + android:layout_toEndOf="@id/butFF" + android:layout_toRightOf="@id/butFF" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/skip_episode_label" + android:scaleType="fitCenter" + app:srcCompat="@drawable/ic_skip_48dp" + tools:srcCompat="@drawable/ic_skip_48dp" /> - <ImageButton - android:id="@+id/butSkip" - android:layout_width="@dimen/audioplayer_playercontrols_length" - android:layout_height="@dimen/audioplayer_playercontrols_length" - android:layout_centerVertical="true" - android:layout_toEndOf="@id/butFF" - android:layout_toRightOf="@id/butFF" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/skip_episode_label" - android:scaleType="fitCenter" - app:srcCompat="@drawable/ic_skip_48dp" - tools:srcCompat="@drawable/ic_skip_48dp" /> + </RelativeLayout> - </RelativeLayout> + </LinearLayout> - </LinearLayout> + </RelativeLayout> -</RelativeLayout> +</FrameLayout> 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..bfe7581fe 100644 --- a/app/src/main/res/layout/episodes_list_fragment.xml +++ b/app/src/main/res/layout/episodes_list_fragment.xml @@ -4,47 +4,46 @@ 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" /> + android:fitsSystemWindows="true"> - <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" /> + <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..043929e32 100644 --- a/app/src/main/res/layout/feed_item_list_fragment.xml +++ b/app/src/main/res/layout/feed_item_list_fragment.xml @@ -3,7 +3,8 @@ 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:layout_height="match_parent" + android:fitsSystemWindows="true"> <com.google.android.material.appbar.AppBarLayout android:id="@+id/appBar" @@ -14,8 +15,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 +32,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..af4aa2570 100644 --- a/app/src/main/res/layout/feedinfo.xml +++ b/app/src/main/res/layout/feedinfo.xml @@ -4,7 +4,8 @@ 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:layout_height="match_parent" + android:fitsSystemWindows="true"> <com.google.android.material.appbar.AppBarLayout android:id="@+id/appBar" @@ -34,7 +35,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..604e7a703 100644 --- a/app/src/main/res/layout/feeditem_pager_fragment.xml +++ b/app/src/main/res/layout/feeditem_pager_fragment.xml @@ -1,23 +1,24 @@ <?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" - android:layout_height="match_parent" - android:layout_width="match_parent" - android:orientation="vertical"> + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fitsSystemWindows="true" + android:orientation="vertical"> - <androidx.appcompat.widget.Toolbar - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?attr/actionBarSize" - android:theme="?attr/actionBarTheme" - app:navigationContentDescription="@string/toolbar_back_button_content_description" - app:navigationIcon="?homeAsUpIndicator" - android:id="@+id/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:navigationContentDescription="@string/toolbar_back_button_content_description" + app:navigationIcon="?homeAsUpIndicator" /> <androidx.viewpager2.widget.ViewPager2 - android:id="@+id/pager" - android:layout_width="match_parent" - android:layout_height="match_parent"/> + android:id="@+id/pager" + android:layout_width="match_parent" + android:layout_height="match_parent" /> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/app/src/main/res/layout/feedsettings.xml b/app/src/main/res/layout/feedsettings.xml index df6e666eb..b9a220a02 100644 --- a/app/src/main/res/layout/feedsettings.xml +++ b/app/src/main/res/layout/feedsettings.xml @@ -1,25 +1,27 @@ <?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" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fitsSystemWindows="true" + android:orientation="vertical"> - <androidx.appcompat.widget.Toolbar - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?attr/actionBarSize" - android:theme="?attr/actionBarTheme" - app:title="@string/feed_settings_label" - app:navigationContentDescription="@string/toolbar_back_button_content_description" - app:navigationIcon="?homeAsUpIndicator" - android:elevation="4dp" - android:id="@+id/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:elevation="4dp" + app:title="@string/feed_settings_label" + app:navigationContentDescription="@string/toolbar_back_button_content_description" + app:navigationIcon="?homeAsUpIndicator" /> <androidx.fragment.app.FragmentContainerView - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:id="@+id/settings_fragment_container" /> + android:id="@+id/settings_fragment_container" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" /> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/app/src/main/res/layout/filter_dialog_row.xml b/app/src/main/res/layout/filter_dialog_row.xml index 7ecfc8223..a551b5db9 100644 --- a/app/src/main/res/layout/filter_dialog_row.xml +++ b/app/src/main/res/layout/filter_dialog_row.xml @@ -1,66 +1,24 @@ <?xml version="1.0" encoding="utf-8"?> -<de.danoeh.antennapod.ui.common.RecursiveRadioGroup +<com.google.android.material.button.MaterialButtonToggleGroup 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:paddingBottom="8dp" - android:orientation="horizontal"> + android:layout_height="wrap_content" + android:weightSum="2" + app:singleSelection="true"> - <androidx.cardview.widget.CardView + <Button + android:id="@+id/filterButton1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:clipChildren="true" - android:layout_gravity="center_vertical" - app:cardCornerRadius="32dp" - app:cardElevation="0dp"> + style="?attr/materialButtonOutlinedStyle" /> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="horizontal"> - - <RadioButton - android:id="@+id/filter_dialog_radioButton1" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_marginEnd="2dp" - android:layout_marginRight="2dp" - android:layout_weight="1" - android:background="?attr/filter_dialog_button_background" - android:minHeight="40dp" - android:foreground="?android:attr/selectableItemBackground" - android:checked="false" - android:gravity="center" - android:textColor="@color/filter_dialog_button_text" - style="@style/NoButtonRadio" /> - - <RadioButton - android:id="@+id/filter_dialog_radioButton2" - android:layout_width="0dp" - android:layout_height="match_parent" - android:minHeight="40dp" - android:layout_weight="1" - android:background="?attr/filter_dialog_button_background" - android:foreground="?android:attr/selectableItemBackground" - android:checked="false" - android:gravity="center" - android:textColor="@color/filter_dialog_button_text" - style="@style/NoButtonRadio" /> - - </LinearLayout> - - </androidx.cardview.widget.CardView> - - <RadioButton - android:id="@+id/filter_dialog_clear" - android:layout_width="40dp" - android:layout_height="40dp" - android:background="@drawable/ic_filter_close" - android:foreground="?android:attr/selectableItemBackground" - android:layout_gravity="center_vertical" - android:checked="true" - style="@style/NoButtonRadio" /> + <Button + android:id="@+id/filterButton2" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + style="?attr/materialButtonOutlinedStyle" /> -</de.danoeh.antennapod.ui.common.RecursiveRadioGroup> +</com.google.android.material.button.MaterialButtonToggleGroup> diff --git a/app/src/main/res/layout/fragment_itunes_search.xml b/app/src/main/res/layout/fragment_itunes_search.xml index b20016f68..369928d1d 100644 --- a/app/src/main/res/layout/fragment_itunes_search.xml +++ b/app/src/main/res/layout/fragment_itunes_search.xml @@ -4,7 +4,8 @@ xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:fitsSystemWindows="true"> <LinearLayout android:id="@+id/browsing" @@ -13,7 +14,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..b19387cb0 100644 --- a/app/src/main/res/layout/fragment_subscriptions.xml +++ b/app/src/main/res/layout/fragment_subscriptions.xml @@ -4,38 +4,41 @@ 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:fitsSystemWindows="true"> - <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 +57,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/nav_list.xml b/app/src/main/res/layout/nav_list.xml index a24ea3fba..52fde0a5f 100644 --- a/app/src/main/res/layout/nav_list.xml +++ b/app/src/main/res/layout/nav_list.xml @@ -1,16 +1,19 @@ -<?xml version='1.0' encoding='utf-8'?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/nav_layout" android:layout_width="match_parent" android:layout_height="match_parent" + android:fitsSystemWindows="true" android:background="?android:attr/windowBackground"> <LinearLayout android:id="@+id/nav_settings" android:layout_width="match_parent" android:layout_height="@dimen/listitem_iconwithtext_height" + android:fitsSystemWindows="true" android:layout_alignParentBottom="true" android:background="?attr/selectableItemBackground" android:contentDescription="@string/settings_label" @@ -46,6 +49,7 @@ android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/text_size_navdrawer" tools:background="@android:color/holo_green_light" /> + </LinearLayout> <View @@ -73,9 +77,10 @@ tools:listitem="@layout/nav_listitem" /> <ProgressBar - style="?android:attr/progressBarStyle" + android:id="@+id/progressBar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:id="@+id/progressBar" - android:layout_centerVertical="true"/> + android:layout_centerVertical="true" + style="?android:attr/progressBarStyle" /> + </RelativeLayout> diff --git a/app/src/main/res/layout/nav_listitem.xml b/app/src/main/res/layout/nav_listitem.xml index 37b629abb..0aca5eb7d 100644 --- a/app/src/main/res/layout/nav_listitem.xml +++ b/app/src/main/res/layout/nav_listitem.xml @@ -1,17 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="@dimen/listitem_iconwithtext_height" - android:foreground="?attr/selectableItemBackground" - android:orientation="vertical"> + android:orientation="vertical" + android:layout_marginHorizontal="8dp" + android:background="@drawable/drawer_item_background"> <ImageView android:id="@+id/imgvCover" android:layout_width="@dimen/thumbnail_length_navlist" android:layout_height="@dimen/thumbnail_length_navlist" + android:importantForAccessibility="no" android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:layout_centerVertical="true" @@ -21,7 +23,6 @@ android:layout_marginBottom="4dp" android:adjustViewBounds="true" android:cropToPadding="true" - android:importantForAccessibility="no" android:scaleType="centerInside" tools:src="@drawable/ic_download_black" /> diff --git a/app/src/main/res/layout/queue_fragment.xml b/app/src/main/res/layout/queue_fragment.xml index db7c55c85..0845044f0 100644 --- a/app/src/main/res/layout/queue_fragment.xml +++ b/app/src/main/res/layout/queue_fragment.xml @@ -6,40 +6,39 @@ 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: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: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/quick_feed_discovery_item.xml b/app/src/main/res/layout/quick_feed_discovery_item.xml index c3a32f019..4407eb2f5 100644 --- a/app/src/main/res/layout/quick_feed_discovery_item.xml +++ b/app/src/main/res/layout/quick_feed_discovery_item.xml @@ -1,22 +1,21 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:squareImageView="http://schemas.android.com/apk/de.danoeh.antennapod" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="4dp" - android:clipToPadding="false"> + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:squareImageView="http://schemas.android.com/apk/de.danoeh.antennapod" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="4dp" + android:clipToPadding="false"> <de.danoeh.antennapod.ui.common.SquareImageView - android:id="@+id/discovery_cover" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:elevation="4dp" - android:outlineProvider="bounds" - android:foreground="?android:attr/selectableItemBackground" - squareImageView:direction="width" - tools:src="@android:drawable/sym_def_app_icon"/> + android:id="@+id/discovery_cover" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:elevation="4dp" + android:outlineProvider="background" + android:foreground="?android:attr/selectableItemBackground" + squareImageView:direction="width" + tools:src="@tools:sample/avatars" /> </LinearLayout> - diff --git a/app/src/main/res/layout/search_fragment.xml b/app/src/main/res/layout/search_fragment.xml index 5745cf655..3fded8725 100644 --- a/app/src/main/res/layout/search_fragment.xml +++ b/app/src/main/res/layout/search_fragment.xml @@ -3,9 +3,10 @@ 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:layout_height="match_parent" + 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" diff --git a/app/src/main/res/layout/share_episode_dialog.xml b/app/src/main/res/layout/share_episode_dialog.xml index 9d0a2f38d..7be941599 100644 --- a/app/src/main/res/layout/share_episode_dialog.xml +++ b/app/src/main/res/layout/share_episode_dialog.xml @@ -41,11 +41,10 @@ </RadioGroup> - <View + <com.google.android.material.divider.MaterialDivider android:layout_width="match_parent" - android:layout_height="1dp" - android:layout_marginVertical="8dp" - android:background="?attr/background_elevated" /> + android:layout_height="wrap_content" + android:layout_marginVertical="8dp" /> <CheckBox android:id="@+id/share_position_checkbox" 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/app/src/main/res/layout/swipeactions_row.xml b/app/src/main/res/layout/swipeactions_row.xml index df55d3f89..2e5323e1a 100644 --- a/app/src/main/res/layout/swipeactions_row.xml +++ b/app/src/main/res/layout/swipeactions_row.xml @@ -45,15 +45,15 @@ </RelativeLayout> - <View + <com.google.android.material.divider.MaterialDivider android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?attr/background_elevated" /> + android:layout_height="wrap_content" /> <LinearLayout android:id="@+id/previewContainer" android:layout_width="match_parent" android:layout_height="76dp" + android:background="?attr/background_color" android:gravity="center" android:foreground="?attr/selectableItemBackground" android:orientation="horizontal"> @@ -76,9 +76,8 @@ </LinearLayout> - <View + <com.google.android.material.divider.MaterialDivider android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?attr/background_elevated" /> + android:layout_height="wrap_content" /> </LinearLayout> diff --git a/build.gradle b/build.gradle index 376e0048c..b2ce372dc 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,7 @@ project.ext { recyclerViewVersion = "1.2.1" viewPager2Version = "1.1.0-beta01" workManagerVersion = "2.3.4" - googleMaterialVersion = "1.4.0" + googleMaterialVersion = "1.6.0" // Third-party commonslangVersion = "3.6" diff --git a/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java index 47b5dcd09..b964c7508 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java +++ b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.core.dialog; import android.content.Context; import android.content.DialogInterface; import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import android.util.Log; import de.danoeh.antennapod.core.R; @@ -43,7 +44,7 @@ public abstract class ConfirmationDialog { public abstract void onConfirmButtonPressed(DialogInterface dialog); public final AlertDialog createNewDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setTitle(titleId); builder.setMessage(message); builder.setPositiveButton(positiveText != 0 ? positiveText : R.string.confirm_label, diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java b/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java index 674082a13..e79be8019 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java @@ -4,7 +4,7 @@ import android.content.Context; import android.util.Log; import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.work.Constraints; import androidx.work.Data; import androidx.work.ExistingPeriodicWorkPolicy; @@ -131,7 +131,7 @@ public class AutoUpdateManager { } private static void confirmMobileAllFeedsRefresh(final Context context) { - AlertDialog.Builder builder = new AlertDialog.Builder(context) + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context) .setTitle(R.string.feed_refresh_title) .setMessage(R.string.confirm_mobile_feed_refresh_dialog_message) .setPositiveButton(R.string.confirm_mobile_streaming_button_once, diff --git a/core/src/main/res/color/filter_dialog_button_text.xml b/core/src/main/res/color/filter_dialog_button_text.xml deleted file mode 100644 index fea8b3e74..000000000 --- a/core/src/main/res/color/filter_dialog_button_text.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="?attr/colorOnSecondary" android:state_checked="true" /> - <item android:color="?android:textColorPrimary" /> -</selector>
\ No newline at end of file diff --git a/core/src/main/res/color/filter_dialog_clear_dark.xml b/core/src/main/res/color/filter_dialog_clear_dark.xml deleted file mode 100644 index 88e022d0f..000000000 --- a/core/src/main/res/color/filter_dialog_clear_dark.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="@color/dialog_filter_inactive_dark" android:state_checked="true" /> - <item android:color="@color/dialog_filter_clear_inactive_dark" /> -</selector>
\ No newline at end of file diff --git a/core/src/main/res/color/filter_dialog_clear_light.xml b/core/src/main/res/color/filter_dialog_clear_light.xml deleted file mode 100644 index 9d513f72a..000000000 --- a/core/src/main/res/color/filter_dialog_clear_light.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="@color/dialog_filter_inactive_light" android:state_checked="true" /> - <item android:color="@color/dialog_filter_clear_inactive_light" /> -</selector>
\ No newline at end of file diff --git a/core/src/main/res/drawable-v21/drawer_item_background.xml b/core/src/main/res/drawable-v21/drawer_item_background.xml new file mode 100644 index 000000000..1992158cc --- /dev/null +++ b/core/src/main/res/drawable-v21/drawer_item_background.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?attr/currently_playing_background"> + <item android:id="@android:id/mask"> + <shape android:shape="rectangle"> + <solid android:color="@color/black"/> + <corners android:radius="32dp"/> + </shape> + </item> + <item> + <selector> + <item android:state_selected="true"> + <shape android:shape="rectangle"> + <solid android:color="?attr/drawer_activated_color"/> + <corners android:radius="32dp"/> + </shape> + </item> + <item android:drawable="@android:color/transparent" /> + </selector> + </item> +</ripple> diff --git a/core/src/main/res/drawable-v21/ic_filter_close.xml b/core/src/main/res/drawable-v21/ic_filter_close.xml deleted file mode 100644 index 9e0a26905..000000000 --- a/core/src/main/res/drawable-v21/ic_filter_close.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> - - <item - android:bottom="5dp" - android:left="5dp" - android:right="5dp" - android:top="5dp"> - - <shape android:shape="oval"> - <stroke - android:width="4dp" - android:color="?attr/filter_dialog_clear" /> - </shape> - </item> - - <!-- x --> - <item - android:bottom="12dp" - android:left="12dp" - android:right="12dp" - android:top="12dp"> - <rotate - android:fromDegrees="135" - android:pivotX="50%" - android:pivotY="50%" - android:toDegrees="135"> - <shape android:shape="line"> - <stroke - android:width="4dp" - android:color="?attr/filter_dialog_clear" /> - </shape> - </rotate> - </item> - - <item - android:bottom="12dp" - android:left="12dp" - android:right="12dp" - android:top="12dp"> - <rotate - android:fromDegrees="45" - android:pivotX="50%" - android:pivotY="50%" - android:toDegrees="45"> - <shape android:shape="line"> - <stroke - android:width="4dp" - android:color="?attr/filter_dialog_clear" /> - </shape> - - </rotate> - </item> - -</layer-list>
\ No newline at end of file diff --git a/core/src/main/res/drawable/drawer_item_background.xml b/core/src/main/res/drawable/drawer_item_background.xml new file mode 100644 index 000000000..a0ec893a8 --- /dev/null +++ b/core/src/main/res/drawable/drawer_item_background.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true"> + <shape android:shape="rectangle"> + <solid android:color="?attr/currently_playing_background"/> + <corners android:radius="32dp"/> + </shape> + </item> + <item android:state_selected="true"> + <shape android:shape="rectangle"> + <solid android:color="?attr/drawer_activated_color" /> + <corners android:radius="32dp" /> + </shape> + </item> + <item android:drawable="@android:color/transparent" /> +</selector> diff --git a/core/src/main/res/drawable/filter_dialog_background_dark.xml b/core/src/main/res/drawable/filter_dialog_background_dark.xml deleted file mode 100644 index 9ea827147..000000000 --- a/core/src/main/res/drawable/filter_dialog_background_dark.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:drawable="@color/accent_dark" android:state_checked="true"/> - <item android:drawable="@color/dialog_filter_inactive_dark" /> -</selector>
\ No newline at end of file diff --git a/core/src/main/res/drawable/filter_dialog_background_light.xml b/core/src/main/res/drawable/filter_dialog_background_light.xml deleted file mode 100644 index 09af585a6..000000000 --- a/core/src/main/res/drawable/filter_dialog_background_light.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:drawable="@color/accent_light" android:state_checked="true"/> - <item android:drawable="@color/dialog_filter_inactive_light" /> -</selector>
\ No newline at end of file diff --git a/core/src/main/res/drawable/ic_filter_close.xml b/core/src/main/res/drawable/ic_filter_close.xml deleted file mode 100644 index 4d7eedb30..000000000 --- a/core/src/main/res/drawable/ic_filter_close.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> - <!-- Fall-back for old Android devices that do not support attrs as colors --> - <item - android:bottom="5dp" - android:left="5dp" - android:right="5dp" - android:top="5dp"> - - <shape android:shape="oval"> - <stroke - android:width="4dp" - android:color="#555" /> - </shape> - </item> - - <!-- x --> - <item - android:bottom="12dp" - android:left="12dp" - android:right="12dp" - android:top="12dp"> - <rotate - android:fromDegrees="135" - android:pivotX="50%" - android:pivotY="50%" - android:toDegrees="135"> - <shape android:shape="line"> - <stroke - android:width="4dp" - android:color="#555" /> - </shape> - </rotate> - </item> - - <item - android:bottom="12dp" - android:left="12dp" - android:right="12dp" - android:top="12dp"> - <rotate - android:fromDegrees="45" - android:pivotX="50%" - android:pivotY="50%" - android:toDegrees="45"> - <shape android:shape="line"> - <stroke - android:width="4dp" - android:color="#555" /> - </shape> - - </rotate> - </item> - -</layer-list>
\ No newline at end of file diff --git a/core/src/main/res/values-v21/styles.xml b/core/src/main/res/values-v21/styles.xml deleted file mode 100644 index 349ca3213..000000000 --- a/core/src/main/res/values-v21/styles.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light"> - <item name="android:windowContentTransitions">true</item> - <!-- To make icons visible --> - <item name="android:statusBarColor">@color/grey600</item> - <item name="android:navigationBarColor">@color/grey600</item> - </style> - - <style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark"> - <item name="android:windowContentTransitions">true</item> - <item name="android:statusBarColor">@color/background_darktheme</item> - <item name="android:navigationBarColor">@color/background_darktheme</item> - </style> - - <style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack"> - <item name="android:statusBarColor">@color/black</item> - <item name="android:navigationBarColor">@color/black</item> - </style> -</resources>
\ No newline at end of file diff --git a/core/src/main/res/values-v23/styles.xml b/core/src/main/res/values-v23/styles.xml deleted file mode 100644 index 33c64ad4a..000000000 --- a/core/src/main/res/values-v23/styles.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light"> - <item name="android:windowContentTransitions">true</item> - <item name="android:statusBarColor">@color/background_light</item> - <item name="android:windowLightStatusBar">true</item> - <item name="android:navigationBarColor">@color/grey600</item> - </style> - - <style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark"> - <item name="android:windowContentTransitions">true</item> - <item name="android:statusBarColor">@color/background_darktheme</item> - <item name="android:windowLightStatusBar">false</item> - <item name="android:navigationBarColor">@color/background_darktheme</item> - </style> - - <style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack"> - <item name="android:statusBarColor">@color/black</item> - <item name="android:navigationBarColor">@color/black</item> - </style> -</resources>
\ No newline at end of file diff --git a/core/src/main/res/values-v27/styles.xml b/core/src/main/res/values-v27/styles.xml deleted file mode 100644 index a28090155..000000000 --- a/core/src/main/res/values-v27/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light"> - <item name="android:windowContentTransitions">true</item> - <item name="android:statusBarColor">@color/background_light</item> - <item name="android:windowLightStatusBar">true</item> - <item name="android:navigationBarColor">@color/background_light</item> - <item name="android:navigationBarDividerColor">@color/navigation_bar_divider_light</item> - <item name="android:windowLightNavigationBar">true</item> - </style> -</resources>
\ No newline at end of file diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml index 6f88b6d51..d2207bbfb 100644 --- a/core/src/main/res/values/attrs.xml +++ b/core/src/main/res/values/attrs.xml @@ -10,8 +10,6 @@ <attr name="scrollbar_thumb" format="reference"/> <attr name="background_color" format="color"/> <attr name="background_elevated" format="color"/> - <attr name="filter_dialog_clear" format="color"/> - <attr name="filter_dialog_button_background" format="reference"/> <attr name="seek_background" format="color" /> <attr name="icon_red" format="color" /> <attr name="icon_yellow" format="color" /> diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml index 859b64367..d948fc2bb 100644 --- a/core/src/main/res/values/colors.xml +++ b/core/src/main/res/values/colors.xml @@ -25,19 +25,14 @@ <color name="non_square_icon_background">#22777777</color> <color name="seek_background_light">#90000000</color> <color name="seek_background_dark">#905B5B5B</color> - <color name="navigation_bar_divider_light">#1F000000</color> <color name="accent_light">#0078C2</color> + <color name="accent_light_alpha">#250078C2</color> <color name="accent_dark">#3D8BFF</color> + <color name="accent_dark_alpha">#253D8BFF</color> <color name="icon_background_gradient_start">#0ba2ff</color> <color name="icon_background_gradient_end">#0878ff</color> <color name="master_switch_background_light">#DDDDDD</color> <color name="master_switch_background_dark">#191919</color> - - <!-- filter dialog --> - <color name="dialog_filter_clear_inactive_light">#666666</color> - <color name="dialog_filter_clear_inactive_dark">#bbbbbb</color> - <color name="dialog_filter_inactive_light">#eeeeee</color> - <color name="dialog_filter_inactive_dark">#555555</color> </resources> diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index 72c4eef18..34cd04b1b 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -5,54 +5,64 @@ <!-- Room for API dependent attributes --> </style> - <style name="Theme.Base.AntennaPod.Light" parent="Theme.MaterialComponents.Light"> + <style name="Theme.Base.AntennaPod.Light" parent="Theme.Material3.Light"> <item name="colorPrimary">@color/accent_light</item> <item name="colorAccent">@color/accent_light</item> <item name="colorSecondary">@color/accent_light</item> <item name="colorOnSecondary">@color/white</item> <item name="progressBarTheme">@style/ProgressBarLight</item> <item name="colorPrimaryDark">@color/accent_light</item> + <item name="colorPrimaryContainer">@color/accent_light</item> + <item name="colorOnPrimaryContainer">@color/white</item> <item name="android:windowBackground">@color/background_light</item> + <item name="colorSurface">@color/background_light</item> <item name="background_color">@color/background_light</item> <item name="actionBarStyle">@style/Widget.AntennaPod.ActionBar.Light</item> <item name="background_elevated">@color/background_elevated_light</item> <item name="master_switch_background">@color/master_switch_background_light</item> <item name="currently_playing_background">@color/highlight_light</item> <item name="action_icon_color">@color/black</item> - <item name="drawer_activated_color">@color/highlight_light</item> + <item name="drawer_activated_color">@color/accent_light_alpha</item> <item name="android:textAllCaps">false</item> <item name="android:textColorHint">@color/grey600</item> <item name="seek_background">@color/seek_background_light</item> <item name="navigation_up">@drawable/navigation_up</item> <item name="dragview_background">@drawable/ic_drag_lighttheme</item> <item name="scrollbar_thumb">@drawable/scrollbar_thumb_light</item> - <item name="filter_dialog_clear">@color/filter_dialog_clear_light</item> - <item name="filter_dialog_button_background">@drawable/filter_dialog_background_light</item> <item name="icon_red">#CF1800</item> <item name="icon_yellow">#F59F00</item> <item name="icon_green">#008537</item> <item name="icon_purple">#5F1984</item> <item name="icon_gray">#25365A</item> <item name="android:splitMotionEvents">false</item> + <item name="android:fitsSystemWindows">false</item> + <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item> + <item name="android:navigationBarColor" tools:targetApi="lollipop">@android:color/transparent</item> + <item name="android:windowLightStatusBar" tools:targetApi="m">true</item> + <item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item> + <item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item> </style> <style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark"> <!-- Room for API dependent attributes --> </style> - <style name="Theme.Base.AntennaPod.Dark" parent="Theme.MaterialComponents"> + <style name="Theme.Base.AntennaPod.Dark" parent="Theme.Material3.Dark"> <item name="colorAccent">@color/accent_dark</item> <item name="colorSecondary">@color/accent_dark</item> <item name="colorOnSecondary">@color/black</item> <item name="colorPrimary">@color/accent_dark</item> <item name="colorPrimaryDark">@color/background_darktheme</item> + <item name="colorPrimaryContainer">@color/accent_dark</item> + <item name="colorOnPrimaryContainer">@color/black</item> <item name="android:windowBackground">@color/background_darktheme</item> + <item name="colorSurface">@color/background_darktheme</item> <item name="background_color">@color/background_darktheme</item> <item name="actionBarStyle">@style/Widget.AntennaPod.ActionBar.Dark</item> <item name="background_elevated">@color/background_elevated_darktheme</item> <item name="colorControlNormal">@color/white</item> <item name="progressBarTheme">@style/ProgressBarDark</item> - <item name="drawer_activated_color">@color/highlight_dark</item> + <item name="drawer_activated_color">@color/accent_dark_alpha</item> <item name="master_switch_background">@color/master_switch_background_dark</item> <item name="currently_playing_background">@color/highlight_dark</item> <item name="action_icon_color">@color/white</item> @@ -62,14 +72,18 @@ <item name="navigation_up">@drawable/navigation_up_dark</item> <item name="dragview_background">@drawable/ic_drag_darktheme</item> <item name="scrollbar_thumb">@drawable/scrollbar_thumb_dark</item> - <item name="filter_dialog_clear">@color/filter_dialog_clear_dark</item> - <item name="filter_dialog_button_background">@drawable/filter_dialog_background_dark</item> <item name="icon_red">#CF1800</item> <item name="icon_yellow">#F59F00</item> <item name="icon_green">#008537</item> <item name="icon_purple">#AA55D8</item> <item name="icon_gray">#CDD9E4</item> <item name="android:splitMotionEvents">false</item> + <item name="android:fitsSystemWindows">false</item> + <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item> + <item name="android:navigationBarColor" tools:targetApi="lollipop">@android:color/transparent</item> + <item name="android:windowLightStatusBar" tools:targetApi="m">false</item> + <item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">false</item> + <item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item> </style> <style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack"> @@ -85,6 +99,7 @@ <item name="android:color">@color/white</item> <item name="android:colorBackground">@color/black</item> <item name="android:windowBackground">@color/black</item> + <item name="colorSurface">@color/black</item> <item name="background_color">@color/black</item> <item name="android:actionBarStyle">@color/black</item> <item name="background_elevated">@color/black</item> @@ -147,7 +162,7 @@ <item name="android:windowExitAnimation">@android:anim/fade_out</item> </style> - <style name="Theme.AntennaPod.Splash" parent="Theme.MaterialComponents.NoActionBar"> + <style name="Theme.AntennaPod.Splash" parent="Theme.Material3.Dark.NoActionBar"> <item name="android:windowBackground">@drawable/bg_splash</item> <item name="colorPrimary">@color/icon_background_gradient_start</item> <item name="colorPrimaryDark">@color/icon_background_gradient_start</item> @@ -210,15 +225,15 @@ <item name="fastScrollVerticalTrackDrawable">@drawable/scrollbar_track</item> </style> - <style name="Widget.AntennaPod.ActionBar.Light" parent="Widget.MaterialComponents.Light.ActionBar.Solid"> + <style name="Widget.AntennaPod.ActionBar.Light" parent="Widget.Material3.Light.ActionBar.Solid"> <item name="background">@color/background_light</item> </style> - <style name="Widget.AntennaPod.ActionBar.Dark" parent="Widget.MaterialComponents.Light.ActionBar.Solid"> + <style name="Widget.AntennaPod.ActionBar.Dark" parent="Widget.Material3.Light.ActionBar.Solid"> <item name="background">@color/background_darktheme</item> </style> - <style name="Widget.AntennaPod.ActionBar.Black" parent="Widget.MaterialComponents.Light.ActionBar.Solid"> + <style name="Widget.AntennaPod.ActionBar.Black" parent="Widget.Material3.Light.ActionBar.Solid"> <item name="background">@color/black</item> </style> @@ -231,9 +246,4 @@ <item name="android:clickable">true</item> </style> - <style name="NoButtonRadio" parent="Widget.MaterialComponents.CompoundButton.RadioButton"> - <item name="buttonCompat">@null</item> <!-- For Android 4.4 --> - <item name="android:button">@null</item> - </style> - </resources> 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/java/de/danoeh/antennapod/ui/common/RecursiveRadioGroup.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/RecursiveRadioGroup.java deleted file mode 100644 index 578208be4..000000000 --- a/ui/common/src/main/java/de/danoeh/antennapod/ui/common/RecursiveRadioGroup.java +++ /dev/null @@ -1,79 +0,0 @@ -package de.danoeh.antennapod.ui.common; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.View; -import android.view.ViewGroup; -import android.widget.LinearLayout; -import android.widget.RadioButton; -import android.widget.RadioGroup; -import androidx.annotation.Nullable; - -import java.util.ArrayList; - -/** - * An alternative to {@link android.widget.RadioGroup} that allows to nest children. - * Basend on https://stackoverflow.com/a/14309274. - */ -public class RecursiveRadioGroup extends LinearLayout { - private final ArrayList<RadioButton> radioButtons = new ArrayList<>(); - private RadioButton checkedButton = null; - @Nullable - private RadioGroup.OnCheckedChangeListener checkedChangeListener; - - public RecursiveRadioGroup(Context context) { - super(context); - } - - public RecursiveRadioGroup(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public RecursiveRadioGroup(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - public void addView(View child, int index, ViewGroup.LayoutParams params) { - super.addView(child, index, params); - parseChild(child); - } - - public void setOnCheckedChangeListener(@Nullable RadioGroup.OnCheckedChangeListener listener) { - checkedChangeListener = listener; - } - - public void parseChild(final View child) { - if (child instanceof RadioButton) { - RadioButton button = (RadioButton) child; - radioButtons.add(button); - button.setOnCheckedChangeListener((buttonView, isChecked) -> { - if (!isChecked) { - return; - } - checkedButton = (RadioButton) buttonView; - if (checkedChangeListener != null) { - checkedChangeListener.onCheckedChanged(null, checkedButton.getId()); - } - - for (RadioButton view : radioButtons) { - if (view != buttonView) { - view.setChecked(false); - } - } - }); - } else if (child instanceof ViewGroup) { - parseChildren((ViewGroup) child); - } - } - - public void parseChildren(final ViewGroup child) { - for (int i = 0; i < child.getChildCount(); i++) { - parseChild(child.getChildAt(i)); - } - } - - public RadioButton getCheckedButton() { - return checkedButton; - } -} 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, diff --git a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/feed/FeedStatisticsDialogFragment.java b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/feed/FeedStatisticsDialogFragment.java index f0308e364..f3a063aac 100644 --- a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/feed/FeedStatisticsDialogFragment.java +++ b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/feed/FeedStatisticsDialogFragment.java @@ -5,7 +5,7 @@ import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.fragment.app.DialogFragment; import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter; @@ -27,7 +27,7 @@ public class FeedStatisticsDialogFragment extends DialogFragment { @NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { - AlertDialog.Builder dialog = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(getContext()); dialog.setPositiveButton(android.R.string.ok, null); dialog.setNeutralButton(R.string.open_podcast, (dialogInterface, i) -> { long feedId = getArguments().getLong(EXTRA_FEED_ID); diff --git a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/StatisticsFilterDialog.java b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/StatisticsFilterDialog.java index 567edd2bf..8efdcf603 100644 --- a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/StatisticsFilterDialog.java +++ b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/subscriptions/StatisticsFilterDialog.java @@ -4,7 +4,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.view.LayoutInflater; import android.widget.ArrayAdapter; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.core.util.Pair; import de.danoeh.antennapod.event.StatisticsEvent; import de.danoeh.antennapod.ui.statistics.R; @@ -40,7 +40,7 @@ public class StatisticsFilterDialog { public void show() { StatisticsFilterDialogBinding dialogBinding = StatisticsFilterDialogBinding.inflate( LayoutInflater.from(context)); - AlertDialog.Builder builder = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setView(dialogBinding.getRoot()); builder.setTitle(R.string.filter); dialogBinding.includeMarkedCheckbox.setOnCheckedChangeListener((compoundButton, checked) -> { |