Move 'skip silence' checkbox to playback speed dialog (#6834)
This commit is contained in:
parent
f1e91f9d8b
commit
c5093c9ff9
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
|
@ -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
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<vector android:height="24dp"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="?attr/action_icon_color" android:pathData="M3,17V19H9V17H3M3,5V7H13V5H3M13,21V19H21V17H13V15H11V21H13M7,9V11H3V13H7V15H9V9H7M21,13V11H11V13H21M15,9H17V7H21V5H17V3H15V9Z"/>
|
||||
</vector>
|
|
@ -785,7 +785,6 @@
|
|||
<!-- Audio controls -->
|
||||
<string name="audio_controls">Audio controls</string>
|
||||
<string name="playback_speed">Playback speed</string>
|
||||
<string name="audio_effects">Audio effects</string>
|
||||
<string name="player_switch_to_audio_only">Switch to audio only</string>
|
||||
|
||||
<!-- proxy settings -->
|
||||
|
|
Loading…
Reference in New Issue