diff options
author | quails4Eva <dpetchey@gmail.com> | 2024-01-02 19:17:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-02 20:17:29 +0100 |
commit | c5093c9ff92c1ffba3b886f52541631fd9b554f8 (patch) | |
tree | fea317caf4fc0ee8039040b81de96260d2fd51dc /app/src/main | |
parent | f1e91f9d8b152fb022d227d866e8666d73171a9f (diff) | |
download | AntennaPod-c5093c9ff92c1ffba3b886f52541631fd9b554f8.zip |
Move 'skip silence' checkbox to playback speed dialog (#6834)
Diffstat (limited to 'app/src/main')
7 files changed, 66 insertions, 81 deletions
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 e3473937e..fc371090e 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -567,7 +567,8 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. menu.findItem(R.id.disable_sleeptimer_item).setVisible(controller.sleepTimerActive()); menu.findItem(R.id.player_switch_to_audio_only).setVisible(true); - menu.findItem(R.id.audio_controls).setIcon(R.drawable.ic_sliders); + + menu.findItem(R.id.audio_controls).setVisible(controller.getAudioTracks().size() >= 2); menu.findItem(R.id.playback_speed).setVisible(true); menu.findItem(R.id.player_show_chapters).setVisible(true); return true; 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 a87dccdf5..009f33fe2 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java @@ -10,9 +10,7 @@ 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; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.core.util.playback.PlaybackController; import java.util.List; @@ -37,12 +35,10 @@ public class PlaybackControlsDialog extends DialogFragment { controller = new PlaybackController(getActivity()) { @Override public void loadMediaInfo() { - setupUi(); setupAudioTracks(); } }; controller.init(); - setupUi(); } @Override @@ -62,15 +58,6 @@ public class PlaybackControlsDialog extends DialogFragment { return dialog; } - private void setupUi() { - final CheckBox skipSilence = dialog.findViewById(R.id.skipSilence); - skipSilence.setChecked(UserPreferences.isSkipSilence()); - skipSilence.setOnCheckedChangeListener((buttonView, isChecked) -> { - UserPreferences.setSkipSilence(isChecked); - controller.setSkipSilence(isChecked); - }); - } - private void setupAudioTracks() { List<String> audioTracks = controller.getAudioTracks(); int selectedAudioTrack = controller.getSelectedAudioTrack(); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java index 0367e717b..8de7dce04 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java @@ -6,6 +6,8 @@ import android.os.Looper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.CheckBox; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.GridLayoutManager; @@ -94,6 +96,13 @@ public class VariableSpeedDialog extends BottomSheetDialogFragment { addCurrentSpeedChip.setOnCloseIconClickListener(v -> addCurrentSpeed()); addCurrentSpeedChip.setCloseIconContentDescription(getString(R.string.add_preset)); addCurrentSpeedChip.setOnClickListener(v -> addCurrentSpeed()); + + final CheckBox skipSilence = root.findViewById(R.id.skipSilence); + skipSilence.setChecked(UserPreferences.isSkipSilence()); + skipSilence.setOnCheckedChangeListener((buttonView, isChecked) -> { + UserPreferences.setSkipSilence(isChecked); + controller.setSkipSilence(isChecked); + }); return root; } 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 f2a53ab7e..8b25c0e6a 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java @@ -15,25 +15,16 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.google.android.material.appbar.MaterialToolbar; import androidx.cardview.widget.CardView; import androidx.fragment.app.Fragment; import androidx.interpolator.view.animation.FastOutSlowInInterpolator; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; +import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.android.material.elevation.SurfaceColors; -import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; -import de.danoeh.antennapod.core.util.playback.PlaybackController; -import de.danoeh.antennapod.dialog.MediaPlayerErrorDialog; -import de.danoeh.antennapod.event.playback.BufferUpdateEvent; -import de.danoeh.antennapod.event.playback.PlaybackServiceEvent; -import de.danoeh.antennapod.event.PlayerErrorEvent; -import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent; -import de.danoeh.antennapod.event.playback.SpeedChangedEvent; -import de.danoeh.antennapod.playback.cast.CastEnabledActivity; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -44,23 +35,31 @@ import java.util.List; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.event.FavoritesEvent; -import de.danoeh.antennapod.event.playback.PlaybackPositionEvent; -import de.danoeh.antennapod.model.feed.Chapter; -import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; -import de.danoeh.antennapod.model.feed.FeedItem; -import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; -import de.danoeh.antennapod.storage.preferences.UserPreferences; +import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.util.ChapterUtils; import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.TimeSpeedConverter; -import de.danoeh.antennapod.model.playback.Playable; -import de.danoeh.antennapod.dialog.PlaybackControlsDialog; +import de.danoeh.antennapod.core.util.playback.PlaybackController; +import de.danoeh.antennapod.dialog.MediaPlayerErrorDialog; import de.danoeh.antennapod.dialog.SkipPreferenceDialog; import de.danoeh.antennapod.dialog.SleepTimerDialog; import de.danoeh.antennapod.dialog.VariableSpeedDialog; +import de.danoeh.antennapod.event.FavoritesEvent; +import de.danoeh.antennapod.event.PlayerErrorEvent; +import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; +import de.danoeh.antennapod.event.playback.BufferUpdateEvent; +import de.danoeh.antennapod.event.playback.PlaybackPositionEvent; +import de.danoeh.antennapod.event.playback.PlaybackServiceEvent; +import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent; +import de.danoeh.antennapod.event.playback.SpeedChangedEvent; import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler; +import de.danoeh.antennapod.model.feed.Chapter; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.playback.Playable; +import de.danoeh.antennapod.playback.cast.CastEnabledActivity; +import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.ui.common.PlaybackSpeedIndicatorView; import de.danoeh.antennapod.view.ChapterSeekBar; import de.danoeh.antennapod.view.PlayButton; @@ -503,10 +502,6 @@ public class AudioPlayerFragment extends Fragment implements if (itemId == R.id.disable_sleeptimer_item || itemId == R.id.set_sleeptimer_item) { new SleepTimerDialog().show(getChildFragmentManager(), "SleepTimerDialog"); return true; - } else if (itemId == R.id.audio_controls) { - PlaybackControlsDialog dialog = PlaybackControlsDialog.newInstance(); - dialog.show(getChildFragmentManager(), "playback_controls"); - return true; } else if (itemId == R.id.open_feed_item) { if (feedItem != null) { Intent intent = MainActivity.getIntentToOpenFeed(getContext(), feedItem.getFeedId()); diff --git a/app/src/main/res/layout/audio_controls.xml b/app/src/main/res/layout/audio_controls.xml index 3abb70961..25f38a63f 100644 --- a/app/src/main/res/layout/audio_controls.xml +++ b/app/src/main/res/layout/audio_controls.xml @@ -19,19 +19,6 @@ android:visibility="gone" android:layout_marginBottom="8dp" /> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="20dp" - android:text="@string/audio_effects" - style="@style/AntennaPod.TextView.ListItemPrimaryTitle" /> - - <CheckBox - android:id="@+id/skipSilence" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/pref_skip_silence_title" /> - </LinearLayout> </ScrollView> diff --git a/app/src/main/res/layout/speed_select_dialog.xml b/app/src/main/res/layout/speed_select_dialog.xml index e4d78c3fa..0b9e422a8 100644 --- a/app/src/main/res/layout/speed_select_dialog.xml +++ b/app/src/main/res/layout/speed_select_dialog.xml @@ -1,45 +1,51 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="16dp" - android:orientation="vertical"> + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="16dp"> <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_width="match_parent" + android:layout_height="wrap_content"> <TextView - android:text="@string/playback_speed" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - style="@style/AntennaPod.TextView.ListItemPrimaryTitle"/> + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/playback_speed" + style="@style/AntennaPod.TextView.ListItemPrimaryTitle" /> <com.google.android.material.chip.Chip - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/add_current_speed_chip"/> + android:id="@+id/add_current_speed_chip" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + </LinearLayout> <de.danoeh.antennapod.view.PlaybackSpeedSeekBar - android:id="@+id/speed_seek_bar" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp"> - </de.danoeh.antennapod.view.PlaybackSpeedSeekBar> + android:id="@+id/speed_seek_bar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" /> <TextView - android:text="@string/speed_presets" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - style="@style/AntennaPod.TextView.ListItemPrimaryTitle" - android:layout_marginBottom="8dp"/> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:text="@string/speed_presets" + style="@style/AntennaPod.TextView.ListItemPrimaryTitle" /> <androidx.recyclerview.widget.RecyclerView - android:id="@+id/selected_speeds_grid" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:id="@+id/selected_speeds_grid" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + <CheckBox + android:id="@+id/skipSilence" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/pref_skip_silence_title" /> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/app/src/main/res/menu/mediaplayer.xml b/app/src/main/res/menu/mediaplayer.xml index 5f60fe6f5..be78e9bc9 100644 --- a/app/src/main/res/menu/mediaplayer.xml +++ b/app/src/main/res/menu/mediaplayer.xml @@ -30,9 +30,9 @@ <item android:id="@+id/audio_controls" - android:icon="@drawable/ic_sliders" android:title="@string/audio_controls" - custom:showAsAction="always"> + android:visible="false" + custom:showAsAction="never"> </item> <item |