Commit 0f2135e9963d5c062a15fa5bd5218a489290e811

Authored by Imanol-Mikel Barba Sabariego
1 parent 715b9bcb

Selector de qualitat ben fet

res/values/strings.xml
@@ -42,5 +42,6 @@ @@ -42,5 +42,6 @@
42 </string-array> 42 </string-array>
43 <string name="selectorTitle">Qualitat inicial</string> 43 <string name="selectorTitle">Qualitat inicial</string>
44 <string name="selectorSummary">Sel·lecciona la qualitat inicial de reproducció</string> 44 <string name="selectorSummary">Sel·lecciona la qualitat inicial de reproducció</string>
  45 + <string name="defaultQuality">0</string>
45 46
46 </resources> 47 </resources>
47 \ No newline at end of file 48 \ No newline at end of file
res/xml/prefs.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > 2 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
3 <EditTextPreference android:key="server" android:title="@string/url" android:summary="@string/urlhint" android:defaultValue="@string/defaultURL"/> 3 <EditTextPreference android:key="server" android:title="@string/url" android:summary="@string/urlhint" android:defaultValue="@string/defaultURL"/>
4 - <ListPreference android:key="selector" android:dialogTitle="@string/selectorTitle" android:entries="@array/selectorEntries" android:dialogMessage="@string/selectorSummary" android:entryValues="@array/selectorValues" android:title="@string/selectorTitle" android:summary="@string/selectorSummary"/>  
5 - </PreferenceScreen>  
6 \ No newline at end of file 4 \ No newline at end of file
  5 + <ListPreference android:key="selector" android:entries="@array/selectorEntries" android:entryValues="@array/selectorValues" android:title="@string/selectorTitle" android:summary="@string/selectorSummary" android:defaultValue="@string/defaultQuality"/>
  6 +
  7 + </PreferenceScreen>
src/com/upc/pbe/upcnews/HLS.java
@@ -55,7 +55,7 @@ public class HLS @@ -55,7 +55,7 @@ public class HLS
55 currentQuality = 0; 55 currentQuality = 0;
56 break; 56 break;
57 case 1: 57 case 1:
58 - currentQuality = (qualities.size()-1)/2; 58 + currentQuality = (qualities.size())/2;
59 break; 59 break;
60 case 2: 60 case 2:
61 currentQuality = qualities.size()-1; 61 currentQuality = qualities.size()-1;
src/com/upc/pbe/upcnews/UpcApp.java
@@ -20,7 +20,7 @@ public class UpcApp extends Application implements @@ -20,7 +20,7 @@ public class UpcApp extends Application implements
20 private int quality; 20 private int quality;
21 21
22 public int getQuality(){ 22 public int getQuality(){
23 - quality = (int) prefs.getLong("selector", 0); 23 + quality = (int) Integer.parseInt(prefs.getString("selector", "0"));
24 return quality; 24 return quality;
25 } 25 }
26 26