From 79028e924d63f0780b573435fe7dff91f7b957aa Mon Sep 17 00:00:00 2001 From: Equip de Desenvolupadors de PBE Date: Mon, 10 Dec 2012 13:59:40 +0000 Subject: [PATCH] --- res/values/strings.xml | 12 ++++++++++++ res/xml/prefs.xml | 1 + src/com/upc/pbe/upcnews/HLS.java | 5 +++-- src/com/upc/pbe/upcnews/UpcApp.java | 52 +++++++++++++++++++++++++++++----------------------- 4 files changed, 45 insertions(+), 25 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index c1c1a98..820bde0 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -27,5 +27,17 @@ siusplau dirigeixi\'s a la Universitat o escrigui un mail als desenvolupadors.\n\n Necessària la instal·lació de la llibreria Vitamio per reproduïr arxius .ts imanolbarba.myftp.biz/PBE + Quality + Which is the default quality? + + High Quality + Medium Quality + Low Quality + + + 0 + 1 + 2 + \ No newline at end of file diff --git a/res/xml/prefs.xml b/res/xml/prefs.xml index f931580..b251b64 100644 --- a/res/xml/prefs.xml +++ b/res/xml/prefs.xml @@ -1,4 +1,5 @@ + \ No newline at end of file diff --git a/src/com/upc/pbe/upcnews/HLS.java b/src/com/upc/pbe/upcnews/HLS.java index 8aa2a0e..b9a14c2 100644 --- a/src/com/upc/pbe/upcnews/HLS.java +++ b/src/com/upc/pbe/upcnews/HLS.java @@ -3,12 +3,11 @@ package com.upc.pbe.upcnews; import java.io.File; import java.io.IOException; import java.util.ArrayList; - import android.net.TrafficStats; import android.util.Log; //Gestor del protocol HTTP Live Streaming -public class HLS { +public class HLS extends UpcApp{ private static final String TAG = "HLS"; private ArrayList videos; @@ -31,6 +30,8 @@ public class HLS { Log.d(TAG, "Deleted " + files[i].toString()); deleteme.delete(); } + + currentQuality = this.getQuality(); currentVideo = currentQuality = currentSegment = 0; this.videos = parsed; endReached = false; diff --git a/src/com/upc/pbe/upcnews/UpcApp.java b/src/com/upc/pbe/upcnews/UpcApp.java index e2f7c23..2614399 100644 --- a/src/com/upc/pbe/upcnews/UpcApp.java +++ b/src/com/upc/pbe/upcnews/UpcApp.java @@ -8,57 +8,63 @@ import android.preference.PreferenceManager; import android.util.Log; //Instanciacio de la nostra aplicacio -public class UpcApp extends Application implements OnSharedPreferenceChangeListener { +public class UpcApp extends Application implements + OnSharedPreferenceChangeListener { final static String TAG = "Application"; - private SharedPreferences prefs; //Conjunt de preferencies de l'aplicacio - private String url = null; + private SharedPreferences prefs; // Conjunt de preferencies de l'aplicacio + private String url = null; private String desc; - private final static String localPath = Environment.getExternalStorageDirectory().getPath() + "/UPC NEWS/"; + private final static String localPath = Environment + .getExternalStorageDirectory().getPath() + "/UPC NEWS/"; private HLS h; - - public String getLocalPath(){ + + public String getLocalPath() { return localPath; } - - public HLS getHLS() - { + + public HLS getHLS() { return h; } - - public void setHLS(HLS h) - { + + public void setHLS(HLS h) { this.h = h; } - + public String getUrl() { - url = "http://" + prefs.getString("server", getString(R.string.defaultURL)); + url = "http://" + + prefs.getString("server", getString(R.string.defaultURL)); return url; } - public void onCreate() { super.onCreate(); - //Prefs - prefs = PreferenceManager.getDefaultSharedPreferences(this); + // Prefs + prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.registerOnSharedPreferenceChangeListener(this); this.getUrl(); Log.d(TAG, "onCreated"); } - + public SharedPreferences getPrefs() { return prefs; } public void onSharedPreferenceChanged(SharedPreferences arg0, String key) { - Log.d(TAG, "onSharedPreferenceChanged for key: " + key); + Log.d(TAG, "onSharedPreferenceChanged for key: " + key); } - - public void setDesc(String s){ + + public void setDesc(String s) { desc = s; } - - public String getDesc(){ + + public String getDesc() { return desc; } + + public int getQuality() { + int qual = Integer.parseInt(prefs.getString("quality", "0")); + + return qual; + } } \ No newline at end of file -- libgit2 0.22.2