diff options
Diffstat (limited to 'ui')
7 files changed, 36 insertions, 108 deletions
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/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml index d6b80f6fd..a2aa6ecef 100644 --- a/ui/i18n/src/main/res/values/strings.xml +++ b/ui/i18n/src/main/res/values/strings.xml @@ -76,6 +76,7 @@ <string name="drawer_feed_counter_inbox">Number of episodes in the inbox</string> <string name="drawer_feed_counter_unplayed">Number of unplayed episodes</string> <string name="drawer_feed_counter_downloaded">Number of downloaded episodes</string> + <string name="drawer_feed_counter_downloaded_unplayed">Number of downloaded and unplayed episodes</string> <string name="drawer_feed_counter_none">None</string> <!-- Bug report activity --> 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) -> { |