added preference for default resolution
This commit is contained in:
parent
56e43f411e
commit
07e7167356
|
@ -70,19 +70,28 @@ public class ActionBarHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStreams(VideoInfo.Stream[] streams) {
|
public void setStreams(VideoInfo.Stream[] streams) {
|
||||||
// // TODO: 11.09.15 add auto stream option
|
|
||||||
this.streams = streams;
|
this.streams = streams;
|
||||||
selectedStream = 0;
|
selectedStream = 0;
|
||||||
String[] itemArray = new String[streams.length];
|
String[] itemArray = new String[streams.length];
|
||||||
|
String defaultResolution = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
.getString(context.getString(R.string.defaultResolutionPreference),
|
||||||
|
context.getString(R.string.defaultResolutionListItem));
|
||||||
|
int defaultResolutionPos = 0;
|
||||||
|
|
||||||
for(int i = 0; i < streams.length; i++) {
|
for(int i = 0; i < streams.length; i++) {
|
||||||
itemArray[i] = streams[i].format + " " + streams[i].resolution;
|
itemArray[i] = streams[i].format + " " + streams[i].resolution;
|
||||||
|
if(defaultResolution.equals(streams[i].resolution)) {
|
||||||
|
defaultResolutionPos = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayAdapter<String> itemAdapter = new ArrayAdapter<String>(activity.getBaseContext(),
|
ArrayAdapter<String> itemAdapter = new ArrayAdapter<String>(activity.getBaseContext(),
|
||||||
android.R.layout.simple_spinner_dropdown_item, itemArray);
|
android.R.layout.simple_spinner_dropdown_item, itemArray);
|
||||||
if(activity != null) {
|
if(activity != null) {
|
||||||
activity.getSupportActionBar().setListNavigationCallbacks(itemAdapter
|
ActionBar ab = activity.getSupportActionBar();
|
||||||
|
ab.setListNavigationCallbacks(itemAdapter
|
||||||
,new ForamatItemSelectListener());
|
,new ForamatItemSelectListener());
|
||||||
|
ab.setSelectedNavigationItem(defaultResolutionPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +158,7 @@ public class ActionBarHandler {
|
||||||
// ----------- THE MAGIC MOMENT ---------------
|
// ----------- THE MAGIC MOMENT ---------------
|
||||||
if(!videoTitle.isEmpty()) {
|
if(!videoTitle.isEmpty()) {
|
||||||
if (PreferenceManager.getDefaultSharedPreferences(context)
|
if (PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
.getBoolean("use_external_player", false)) {
|
.getBoolean(context.getString(R.string.useExternalPlayer), false)) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
try {
|
try {
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
|
|
|
@ -27,4 +27,5 @@
|
||||||
<string name="downloadLocationDialogTitle">Download Verzeichnis eingeben</string>
|
<string name="downloadLocationDialogTitle">Download Verzeichnis eingeben</string>
|
||||||
<string name="autoPlayThroughIntentTitle">Automatisch abspielen durch Intent.</string>
|
<string name="autoPlayThroughIntentTitle">Automatisch abspielen durch Intent.</string>
|
||||||
<string name="autoPlayThroughIntentSummary">Startet ein Video automatisch wenn es von einer anderen App aufgerufen wurde.</string>
|
<string name="autoPlayThroughIntentSummary">Startet ein Video automatisch wenn es von einer anderen App aufgerufen wurde.</string>
|
||||||
|
<string name="defaultResolutionPreferenceTitle">Standard Auflösung</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -3,4 +3,12 @@
|
||||||
<string name="downloadPathPreference">download_path_preference</string>
|
<string name="downloadPathPreference">download_path_preference</string>
|
||||||
<string name="useExternalPlayer">use_external_player</string>
|
<string name="useExternalPlayer">use_external_player</string>
|
||||||
<string name="autoPlayThroughIntent">autoplay_through_intent</string>
|
<string name="autoPlayThroughIntent">autoplay_through_intent</string>
|
||||||
|
<string name="defaultResolutionPreference">default_resulution_preference</string>
|
||||||
|
<string-array name="resolutionList">
|
||||||
|
<item>720p</item>
|
||||||
|
<item>360p</item>
|
||||||
|
<item>240p</item>
|
||||||
|
<item>144p</item>
|
||||||
|
</string-array>
|
||||||
|
<string name="defaultResolutionListItem">360p</string>
|
||||||
</resources>
|
</resources>
|
|
@ -27,4 +27,5 @@
|
||||||
<string name="downloadLocationDialogTitle">Enter download path</string>
|
<string name="downloadLocationDialogTitle">Enter download path</string>
|
||||||
<string name="autoPlayThroughIntentTitle">Autoplay through Intent</string>
|
<string name="autoPlayThroughIntentTitle">Autoplay through Intent</string>
|
||||||
<string name="autoPlayThroughIntentSummary">Automatically starts a video when it was called from another app.</string>
|
<string name="autoPlayThroughIntentSummary">Automatically starts a video when it was called from another app.</string>
|
||||||
|
<string name="defaultResolutionPreferenceTitle">Default Resolution</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -21,4 +21,11 @@
|
||||||
android:summary="@string/autoPlayThroughIntentSummary"
|
android:summary="@string/autoPlayThroughIntentSummary"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:key="@string/defaultResolutionPreference"
|
||||||
|
android:title="@string/defaultResolutionPreferenceTitle"
|
||||||
|
android:entries="@array/resolutionList"
|
||||||
|
android:entryValues="@array/resolutionList"
|
||||||
|
android:defaultValue="@string/defaultResolutionListItem"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in New Issue