Commit 027c9589ad9df26af4d3eacf02db4bcff3e5fd94
1 parent
06f83221
Bug en HLS corregido, funciona de lujo
Showing
5 changed files
with
69 additions
and
29 deletions
res/layout/main_activity.xml
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | android:maxHeight="@dimen/lesize" |
23 | 23 | android:maxWidth="@dimen/lesize" |
24 | 24 | android:scaleType="fitCenter" /> |
25 | - | |
25 | + | |
26 | 26 | <TextView |
27 | 27 | android:id="@+id/textViewXml" |
28 | 28 | android:layout_width="wrap_content" |
... | ... | @@ -46,28 +46,35 @@ |
46 | 46 | android:layout_marginTop="21dp" |
47 | 47 | android:textAppearance="?android:attr/textAppearanceSmall" /> |
48 | 48 | |
49 | - <TextView | |
50 | - android:id="@+id/textViewAlerta" | |
51 | - android:layout_width="wrap_content" | |
52 | - android:layout_height="wrap_content" | |
53 | - android:layout_alignBottom="@+id/imageViewAlerta" | |
54 | - android:layout_alignTop="@+id/imageViewAlerta" | |
55 | - android:layout_toRightOf="@+id/imageViewAlerta" | |
56 | - android:text="@string/alertVitamioNotInstalled" | |
57 | - android:textColor="@color/Orange" | |
58 | - android:visibility="invisible" /> | |
59 | - | |
60 | - <ImageView | |
61 | - android:id="@+id/imageViewAlerta" | |
62 | - android:layout_width="wrap_content" | |
49 | + <RelativeLayout | |
50 | + android:id="@+id/Alerta" | |
51 | + android:layout_width="fill_parent" | |
63 | 52 | android:layout_height="wrap_content" |
64 | 53 | android:layout_above="@+id/button" |
65 | - android:layout_alignLeft="@+id/button" | |
66 | - android:layout_marginBottom="28dp" | |
67 | - android:layout_marginLeft="17dp" | |
68 | - android:layout_marginRight="5dip" | |
69 | - android:contentDescription="@string/alertLogoDescription" | |
70 | - android:src="@android:drawable/ic_dialog_alert" | |
71 | - android:visibility="invisible" /> | |
54 | + android:layout_centerHorizontal="true" | |
55 | + android:layout_marginBottom="20dp" > | |
56 | + | |
57 | + <TextView | |
58 | + android:id="@+id/textViewAlerta" | |
59 | + android:layout_width="wrap_content" | |
60 | + android:layout_height="wrap_content" | |
61 | + android:layout_alignBottom="@+id/imageViewAlerta" | |
62 | + android:layout_alignTop="@+id/imageViewAlerta" | |
63 | + android:layout_centerHorizontal="true" | |
64 | + android:text="@string/alertVitamioNotInstalled" | |
65 | + android:textColor="@color/Orange" | |
66 | + android:visibility="invisible" /> | |
67 | + | |
68 | + <ImageView | |
69 | + android:id="@+id/imageViewAlerta" | |
70 | + android:layout_width="wrap_content" | |
71 | + android:layout_height="wrap_content" | |
72 | + android:layout_marginRight="5dip" | |
73 | + android:layout_toLeftOf="@id/textViewAlerta" | |
74 | + android:contentDescription="@string/alertLogoDescription" | |
75 | + android:src="@android:drawable/ic_dialog_alert" | |
76 | + android:visibility="invisible" /> | |
77 | + | |
78 | + </RelativeLayout> | |
72 | 79 | |
73 | 80 | </RelativeLayout> |
74 | 81 | \ No newline at end of file | ... | ... |
src/com/upc/pbe/upcnews/HLS.java
... | ... | @@ -71,9 +71,34 @@ public class HLS |
71 | 71 | d.descarregarguardar(seg.getURL(), localFolder); |
72 | 72 | double bps = bm.Measure(segmentBytes, startTime); |
73 | 73 | Log.d(TAG, "Velocitat actual (KB/s): " + (bps / 8e3)); |
74 | - if ((bps < qualities.get(currentQuality).getQuality()) && (bps != -1)) | |
74 | + if ((bps <= qualities.get(currentQuality).getQuality()) && (bps != -1)) | |
75 | 75 | { |
76 | - currentQuality++; | |
76 | + int newQuality; | |
77 | + for(newQuality = 0; newQuality < qualities.size(); newQuality++) | |
78 | + { | |
79 | + if(bps >= qualities.get(newQuality).getQuality()) | |
80 | + { | |
81 | + break; | |
82 | + } | |
83 | + } | |
84 | + currentQuality = newQuality; | |
85 | + currentVideo--; //Corregimos el del loadVideo() | |
86 | + loadVideo(); | |
87 | + } | |
88 | + else if((bps > qualities.get(currentQuality).getQuality()) && (bps != -1)) | |
89 | + { | |
90 | + int newQuality; | |
91 | + for(newQuality = qualities.size(); newQuality <= 0; newQuality--) | |
92 | + { | |
93 | + if(bps <= qualities.get(newQuality).getQuality()) | |
94 | + { | |
95 | + newQuality--; | |
96 | + break; | |
97 | + } | |
98 | + } | |
99 | + currentQuality = newQuality; | |
100 | + currentVideo--; //Corregimos el del loadVideo() | |
101 | + loadVideo(); | |
77 | 102 | } |
78 | 103 | return localFolder |
79 | 104 | + seg.getURL().substring(seg.getURL().lastIndexOf("/") + 1, seg.getURL().length()); | ... | ... |
src/com/upc/pbe/upcnews/MainActivity.java
... | ... | @@ -109,9 +109,9 @@ public class MainActivity extends Activity implements OnClickListener { |
109 | 109 | |
110 | 110 | public boolean onCreateOptionsMenu(Menu menu) { |
111 | 111 | //Determina el funcionament al apretar la tecla d'opcions |
112 | - getMenuInflater().inflate(R.menu.menu, menu); | |
113 | - Log.d(TAG, "Menu"); | |
114 | - return true; | |
112 | + getMenuInflater().inflate(R.menu.menu, menu); | |
113 | + Log.d(TAG, "Menu"); | |
114 | + return true; | |
115 | 115 | } |
116 | 116 | |
117 | 117 | public boolean onOptionsItemSelected(MenuItem item) { |
... | ... | @@ -136,6 +136,7 @@ public class MainActivity extends Activity implements OnClickListener { |
136 | 136 | * (NORMAL) Poner la defaultURL al server de PBE |
137 | 137 | * (WISHLIST) Descarga en segundo plano (Mejora dificil) |
138 | 138 | * (WISHLIST) A�adir gif Imanol bailando (Easter eggs? vais en serio? XDDDDDDDDDDDD) |
139 | + * (LOW) Por qué peta las preferences en mi tablet?? | |
139 | 140 | * Borrar esta puta mierda |
140 | 141 | */ |
141 | 142 | } | ... | ... |
src/com/upc/pbe/upcnews/Prefs.java
... | ... | @@ -19,7 +19,7 @@ public class Prefs extends PreferenceActivity { |
19 | 19 | addPreferencesFromResource(R.xml.prefs); |
20 | 20 | } |
21 | 21 | |
22 | - @Override | |
22 | + /*@Override | |
23 | 23 | public boolean onCreateOptionsMenu(Menu menu) { |
24 | 24 | //Determina el funcionament al apretar la tecla d'opcions |
25 | 25 | getMenuInflater().inflate(R.menu.menu, menu); |
... | ... | @@ -40,6 +40,6 @@ public class Prefs extends PreferenceActivity { |
40 | 40 | default: |
41 | 41 | return false; |
42 | 42 | } |
43 | - } | |
43 | + }*/ | |
44 | 44 | |
45 | 45 | } |
46 | 46 | \ No newline at end of file | ... | ... |
src/com/upc/pbe/upcnews/VideoActivity.java
... | ... | @@ -25,7 +25,14 @@ public class VideoActivity extends Activity { |
25 | 25 | public void onCreate(Bundle savedInstanceState) { |
26 | 26 | |
27 | 27 | //Creem el layout |
28 | + | |
28 | 29 | super.onCreate(savedInstanceState); |
30 | + //Necesario para las libs | |
31 | + if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this)) | |
32 | + { | |
33 | + return; | |
34 | + } | |
35 | + | |
29 | 36 | setContentView(R.layout.activity_video); |
30 | 37 | video = (VideoView) findViewById(R.id.VideoView1); |
31 | 38 | //Creem un listener associat al fi de l'activitat (el fi de cada ts) | ... | ... |