Merge pull request #2300 from ByteHamster/chapter-durations
Added duration to chapters list
This commit is contained in:
commit
4e7402c214
|
@ -60,6 +60,7 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
|
||||||
defaultTextColor = holder.title.getTextColors().getDefaultColor();
|
defaultTextColor = holder.title.getTextColors().getDefaultColor();
|
||||||
holder.start = (TextView) convertView.findViewById(R.id.txtvStart);
|
holder.start = (TextView) convertView.findViewById(R.id.txtvStart);
|
||||||
holder.link = (TextView) convertView.findViewById(R.id.txtvLink);
|
holder.link = (TextView) convertView.findViewById(R.id.txtvLink);
|
||||||
|
holder.duration = (TextView) convertView.findViewById(R.id.txtvDuration);
|
||||||
holder.butPlayChapter = (ImageButton) convertView.findViewById(R.id.butPlayChapter);
|
holder.butPlayChapter = (ImageButton) convertView.findViewById(R.id.butPlayChapter);
|
||||||
convertView.setTag(holder);
|
convertView.setTag(holder);
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,6 +71,16 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
|
||||||
holder.title.setText(sc.getTitle());
|
holder.title.setText(sc.getTitle());
|
||||||
holder.start.setText(Converter.getDurationStringLong((int) sc
|
holder.start.setText(Converter.getDurationStringLong((int) sc
|
||||||
.getStart()));
|
.getStart()));
|
||||||
|
|
||||||
|
long duration;
|
||||||
|
if (position + 1 < media.getChapters().size()) {
|
||||||
|
duration = media.getChapters().get(position + 1).getStart() - sc.getStart();
|
||||||
|
} else {
|
||||||
|
duration = media.getDuration() - sc.getStart();
|
||||||
|
}
|
||||||
|
holder.duration.setText(getContext().getString(R.string.chapter_duration,
|
||||||
|
Converter.getDurationStringLong((int) duration)));
|
||||||
|
|
||||||
if (sc.getLink() != null) {
|
if (sc.getLink() != null) {
|
||||||
holder.link.setVisibility(View.VISIBLE);
|
holder.link.setVisibility(View.VISIBLE);
|
||||||
holder.link.setText(sc.getLink());
|
holder.link.setText(sc.getLink());
|
||||||
|
@ -155,6 +166,7 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
|
||||||
TextView title;
|
TextView title;
|
||||||
TextView start;
|
TextView start;
|
||||||
TextView link;
|
TextView link;
|
||||||
|
TextView duration;
|
||||||
ImageButton butPlayChapter;
|
ImageButton butPlayChapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,16 @@
|
||||||
tools:text="Link"
|
tools:text="Link"
|
||||||
tools:background="@android:color/holo_green_dark" />
|
tools:background="@android:color/holo_green_dark" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtvDuration"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:focusable="false"
|
||||||
|
android:focusableInTouchMode="false"
|
||||||
|
android:maxLines="1"
|
||||||
|
tools:text="Duration"
|
||||||
|
tools:background="@android:color/holo_green_dark" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<include layout="@layout/vertical_list_divider" />
|
<include layout="@layout/vertical_list_divider" />
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
<string name="refresh_label">Refresh</string>
|
<string name="refresh_label">Refresh</string>
|
||||||
<string name="external_storage_error_msg">No external storage is available. Please make sure that external storage is mounted so that the app can work properly.</string>
|
<string name="external_storage_error_msg">No external storage is available. Please make sure that external storage is mounted so that the app can work properly.</string>
|
||||||
<string name="chapters_label">Chapters</string>
|
<string name="chapters_label">Chapters</string>
|
||||||
|
<string name="chapter_duration">Duration: %1$s</string>
|
||||||
<string name="shownotes_label">Shownotes</string>
|
<string name="shownotes_label">Shownotes</string>
|
||||||
<string name="description_label">Description</string>
|
<string name="description_label">Description</string>
|
||||||
<string name="most_recent_prefix">Most recent episode:\u0020</string>
|
<string name="most_recent_prefix">Most recent episode:\u0020</string>
|
||||||
|
|
Loading…
Reference in New Issue