diff --git a/res/layout/main_activity.xml b/res/layout/main_activity.xml index 6b0389b..0e13cd6 100644 --- a/res/layout/main_activity.xml +++ b/res/layout/main_activity.xml @@ -22,7 +22,7 @@ android:maxHeight="@dimen/lesize" android:maxWidth="@dimen/lesize" android:scaleType="fitCenter" /> - + - - - + android:layout_centerHorizontal="true" + android:layout_marginBottom="20dp" > + + + + + + \ 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 1567262..7d51592 100644 --- a/src/com/upc/pbe/upcnews/HLS.java +++ b/src/com/upc/pbe/upcnews/HLS.java @@ -71,9 +71,34 @@ public class HLS d.descarregarguardar(seg.getURL(), localFolder); double bps = bm.Measure(segmentBytes, startTime); Log.d(TAG, "Velocitat actual (KB/s): " + (bps / 8e3)); - if ((bps < qualities.get(currentQuality).getQuality()) && (bps != -1)) + if ((bps <= qualities.get(currentQuality).getQuality()) && (bps != -1)) { - currentQuality++; + int newQuality; + for(newQuality = 0; newQuality < qualities.size(); newQuality++) + { + if(bps >= qualities.get(newQuality).getQuality()) + { + break; + } + } + currentQuality = newQuality; + currentVideo--; //Corregimos el del loadVideo() + loadVideo(); + } + else if((bps > qualities.get(currentQuality).getQuality()) && (bps != -1)) + { + int newQuality; + for(newQuality = qualities.size(); newQuality <= 0; newQuality--) + { + if(bps <= qualities.get(newQuality).getQuality()) + { + newQuality--; + break; + } + } + currentQuality = newQuality; + currentVideo--; //Corregimos el del loadVideo() + loadVideo(); } return localFolder + seg.getURL().substring(seg.getURL().lastIndexOf("/") + 1, seg.getURL().length()); diff --git a/src/com/upc/pbe/upcnews/MainActivity.java b/src/com/upc/pbe/upcnews/MainActivity.java index be7e0b1..7727b26 100644 --- a/src/com/upc/pbe/upcnews/MainActivity.java +++ b/src/com/upc/pbe/upcnews/MainActivity.java @@ -109,9 +109,9 @@ public class MainActivity extends Activity implements OnClickListener { public boolean onCreateOptionsMenu(Menu menu) { //Determina el funcionament al apretar la tecla d'opcions - getMenuInflater().inflate(R.menu.menu, menu); - Log.d(TAG, "Menu"); - return true; + getMenuInflater().inflate(R.menu.menu, menu); + Log.d(TAG, "Menu"); + return true; } public boolean onOptionsItemSelected(MenuItem item) { @@ -136,6 +136,7 @@ public class MainActivity extends Activity implements OnClickListener { * (NORMAL) Poner la defaultURL al server de PBE * (WISHLIST) Descarga en segundo plano (Mejora dificil) * (WISHLIST) A�adir gif Imanol bailando (Easter eggs? vais en serio? XDDDDDDDDDDDD) + * (LOW) Por qué peta las preferences en mi tablet?? * Borrar esta puta mierda */ } diff --git a/src/com/upc/pbe/upcnews/Prefs.java b/src/com/upc/pbe/upcnews/Prefs.java index a33b207..4dcf98a 100644 --- a/src/com/upc/pbe/upcnews/Prefs.java +++ b/src/com/upc/pbe/upcnews/Prefs.java @@ -19,7 +19,7 @@ public class Prefs extends PreferenceActivity { addPreferencesFromResource(R.xml.prefs); } - @Override + /*@Override public boolean onCreateOptionsMenu(Menu menu) { //Determina el funcionament al apretar la tecla d'opcions getMenuInflater().inflate(R.menu.menu, menu); @@ -40,6 +40,6 @@ public class Prefs extends PreferenceActivity { default: return false; } - } + }*/ } \ No newline at end of file diff --git a/src/com/upc/pbe/upcnews/VideoActivity.java b/src/com/upc/pbe/upcnews/VideoActivity.java index 064cd56..96d97ac 100644 --- a/src/com/upc/pbe/upcnews/VideoActivity.java +++ b/src/com/upc/pbe/upcnews/VideoActivity.java @@ -25,7 +25,14 @@ public class VideoActivity extends Activity { public void onCreate(Bundle savedInstanceState) { //Creem el layout + super.onCreate(savedInstanceState); + //Necesario para las libs + if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this)) + { + return; + } + setContentView(R.layout.activity_video); video = (VideoView) findViewById(R.id.VideoView1); //Creem un listener associat al fi de l'activitat (el fi de cada ts)