Add chapters button to video player (#6348)
This commit is contained in:
parent
5f00294c29
commit
34553475d9
|
@ -41,6 +41,7 @@ import de.danoeh.antennapod.event.playback.PlaybackPositionEvent;
|
|||
import de.danoeh.antennapod.event.PlayerErrorEvent;
|
||||
import de.danoeh.antennapod.event.playback.PlaybackServiceEvent;
|
||||
import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent;
|
||||
import de.danoeh.antennapod.fragment.ChaptersFragment;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
|
@ -557,6 +558,7 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar.
|
|||
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.playback_speed).setVisible(true);
|
||||
menu.findItem(R.id.player_show_chapters).setVisible(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -566,13 +568,15 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar.
|
|||
switchToAudioOnly = true;
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
} else if (item.getItemId() == android.R.id.home) {
|
||||
Intent intent = new Intent(VideoplayerActivity.this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.player_show_chapters) {
|
||||
new ChaptersFragment().show(getSupportFragmentManager(), ChaptersFragment.TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (controller == null) {
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.util.Log;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
@ -158,8 +159,9 @@ public class ChaptersFragment extends AppCompatDialogFragment {
|
|||
if (adapter == null) {
|
||||
return;
|
||||
}
|
||||
if (media.getChapters() != null && media.getChapters().size() <= 0) {
|
||||
if (media.getChapters() != null && media.getChapters().size() == 0) {
|
||||
dismiss();
|
||||
Toast.makeText(getContext(), R.string.no_chapters_label, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
|
|
@ -65,6 +65,13 @@
|
|||
android:visible="false">
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/player_show_chapters"
|
||||
custom:showAsAction="never"
|
||||
android:title="@string/chapters_label"
|
||||
android:visible="false">
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/share_item"
|
||||
android:menuCategory="container"
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
<string name="error_msg_prefix">An error occurred:</string>
|
||||
<string name="refresh_label">Refresh</string>
|
||||
<string name="chapters_label">Chapters</string>
|
||||
<string name="no_chapters_label">No chapters</string>
|
||||
<string name="chapter_duration">Duration: %1$s</string>
|
||||
<string name="description_label">Description</string>
|
||||
<string name="shownotes_label">Shownotes</string>
|
||||
|
|
Loading…
Reference in New Issue