[Android] AdvOptionsDialog: improve chapter selection
Thomas Guillem
git at videolan.org
Fri Jul 10 20:01:56 CEST 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jul 10 20:01:51 2015 +0200| [b11bf3b7af3da04326e1f721fdb7c43c3694d89e] | committer: Thomas Guillem
AdvOptionsDialog: improve chapter selection
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=b11bf3b7af3da04326e1f721fdb7c43c3694d89e
---
.../org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
index 1782cce..7ba5c93 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -210,9 +210,17 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
return;
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item);
- String chapterDescription;
- for (int i = 0 ; i < chaptersCount ; ++i)
- adapter.insert(chapters[i].name != null ? chapters[i].name : Integer.toString(i), i);
+ for (int i = 0 ; i < chaptersCount ; ++i) {
+ String name;
+ if (chapters[i].name == null || chapters[i].name.equals("")) {
+ StringBuilder sb = new StringBuilder("Chapter ").append(i); /* TODO translate Chapter */
+ if (chapters[i].timeOffset >= 0)
+ sb.append(" - ").append(Strings.millisToString(chapters[i].timeOffset));
+ name = sb.toString();
+ } else
+ name = chapters[i].name;
+ adapter.insert(name, i);
+ }
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mChapters.setAdapter(adapter);
mChapters.setSelection(mService.getChapterIdx());
More information about the Android
mailing list