Using EmptyViewHandler for chapters fragment
This commit is contained in:
parent
a409f439ac
commit
94ba9dfd46
|
@ -15,6 +15,7 @@ import de.danoeh.antennapod.core.feed.Chapter;
|
|||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||
|
||||
import de.danoeh.antennapod.view.EmptyViewHandler;
|
||||
import io.reactivex.Maybe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
@ -25,6 +26,7 @@ public class ChaptersFragment extends ListFragment {
|
|||
private ChaptersListAdapter adapter;
|
||||
private PlaybackController controller;
|
||||
private Disposable disposable;
|
||||
private EmptyViewHandler emptyView;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -36,6 +38,12 @@ public class ChaptersFragment extends ListFragment {
|
|||
final int vertPadding = getResources().getDimensionPixelSize(R.dimen.list_vertical_padding);
|
||||
lv.setPadding(0, vertPadding, 0, vertPadding);
|
||||
|
||||
emptyView = new EmptyViewHandler(getContext());
|
||||
emptyView.attachToListView(lv);
|
||||
emptyView.setIcon(R.attr.ic_bookmark);
|
||||
emptyView.setTitle(R.string.no_chapters_head_label);
|
||||
emptyView.setMessage(R.string.no_chapters_label);
|
||||
|
||||
adapter = new ChaptersListAdapter(getActivity(), 0, pos -> {
|
||||
Chapter chapter = (Chapter) getListAdapter().getItem(pos);
|
||||
controller.seekToChapter(chapter);
|
||||
|
@ -118,10 +126,7 @@ public class ChaptersFragment extends ListFragment {
|
|||
if (adapter != null) {
|
||||
adapter.setMedia(media);
|
||||
adapter.notifyDataSetChanged();
|
||||
if (media == null || media.getChapters() == null || media.getChapters().size() == 0) {
|
||||
setEmptyText(getString(R.string.no_chapters_label));
|
||||
} else {
|
||||
setEmptyText(null);
|
||||
if (media != null && media.getChapters() != null && media.getChapters().size() != 0) {
|
||||
scrollTo(getCurrentChapter(media));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#b4b4b4"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFb4b4b4" android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
|
@ -61,6 +61,7 @@
|
|||
<attr name="ic_known_issues" format="reference" />
|
||||
<attr name="master_switch_background" format="color"/>
|
||||
<attr name="currently_playing_background" format="color"/>
|
||||
<attr name="ic_bookmark" format="reference"/>
|
||||
|
||||
<!-- Used in itemdescription -->
|
||||
<attr name="non_transparent_background" format="reference"/>
|
||||
|
|
|
@ -315,7 +315,6 @@
|
|||
<string name="no_items_header_label">No queued episodes</string>
|
||||
<string name="no_items_label">Add an episode by downloading it, or long press an episode and select \"Add to queue\".</string>
|
||||
<string name="no_feeds_label">You haven\'t subscribed to any podcasts yet.</string>
|
||||
<string name="no_chapters_label">This episode has no chapters.</string>
|
||||
<string name="no_shownotes_label">This episode has no shownotes.</string>
|
||||
<string name="no_run_downloads_head_label">No downloads running</string>
|
||||
<string name="no_run_downloads_label">You can download episodes on the podcast details screen.</string>
|
||||
|
@ -331,6 +330,8 @@
|
|||
<string name="no_new_episodes_label">When new episodes arrive, they will be shown here.</string>
|
||||
<string name="no_fav_episodes_head_label">No favorite episodes</string>
|
||||
<string name="no_fav_episodes_label">You can add episodes to the favorites by long-pressing them.</string>
|
||||
<string name="no_chapters_head_label">No chapters</string>
|
||||
<string name="no_chapters_label">This episode has no chapters.</string>
|
||||
|
||||
<!-- Preferences -->
|
||||
<string name="storage_pref">Storage</string>
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<item name="ic_question_answer">@drawable/ic_forum_grey600_24dp</item>
|
||||
<item name="ic_bug">@drawable/ic_bug_grey600_24dp</item>
|
||||
<item name="ic_known_issues">@drawable/ic_format_list_bulleted_grey600_24dp</item>
|
||||
|
||||
<item name="ic_bookmark">@drawable/ic_bookmark_grey600_24dp</item>
|
||||
<item name="master_switch_background">@color/master_switch_background_light</item>
|
||||
<item name="currently_playing_background">@color/highlight_light</item>
|
||||
|
||||
|
@ -155,6 +155,7 @@
|
|||
<item name="ic_question_answer">@drawable/ic_baseline_question_answer_white_24dp</item>
|
||||
<item name="ic_bug">@drawable/ic_bug_white_24dp</item>
|
||||
<item name="ic_known_issues">@drawable/ic_format_list_bulleted_white_24dp</item>
|
||||
<item name="ic_bookmark">@drawable/ic_bookmark_white_24dp</item>
|
||||
<item name="master_switch_background">@color/master_switch_background_dark</item>
|
||||
<item name="currently_playing_background">@color/highlight_dark</item>
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
|
|
Loading…
Reference in New Issue