Commit 827f4218701cbfc2aeb6c82dbe2da0511aeb1044
1 parent
dc98f37f
Changed List to Video
Showing
7 changed files
with
102 additions
and
100 deletions
gen/com/upc/pbe/upcnews/R.java
1 | -/* AUTO-GENERATED FILE. DO NOT MODIFY. | ||
2 | - * | ||
3 | - * This class was automatically generated by the | ||
4 | - * aapt tool from the resource data it found. It | ||
5 | - * should not be modified by hand. | ||
6 | - */ | ||
7 | - | ||
8 | -package com.upc.pbe.upcnews; | ||
9 | - | ||
10 | -public final class R { | ||
11 | - public static final class attr { | ||
12 | - } | ||
13 | - public static final class color { | ||
14 | - public static final int backgroundmain=0x7f050000; | ||
15 | - } | ||
16 | - public static final class dimen { | ||
17 | - public static final int TitleSize=0x7f060000; | ||
18 | - } | ||
19 | - public static final class drawable { | ||
20 | - public static final int ic_action_search=0x7f020000; | ||
21 | - public static final int ic_launcher=0x7f020001; | ||
22 | - public static final int ic_ledarklogo=0x7f020002; | ||
23 | - public static final int ic_menu_name=0x7f020003; | ||
24 | - public static final int ic_startbutton=0x7f020004; | ||
25 | - public static final int startbuttontoggle=0x7f020005; | ||
26 | - } | ||
27 | - public static final class id { | ||
28 | - public static final int AbsoluteLayout1=0x7f0a0006; | ||
29 | - public static final int LinearLayout1=0x7f0a0001; | ||
30 | - public static final int button=0x7f0a0008; | ||
31 | - public static final int itemhelp=0x7f0a000c; | ||
32 | - public static final int itemprefs=0x7f0a000b; | ||
33 | - public static final int listView1=0x7f0a0003; | ||
34 | - public static final int menu_settings=0x7f0a000a; | ||
35 | - public static final int rowTextView=0x7f0a0009; | ||
36 | - public static final int textView1=0x7f0a0004; | ||
37 | - public static final int textView2=0x7f0a0005; | ||
38 | - public static final int textViewTitle=0x7f0a0002; | ||
39 | - public static final int textViewXml=0x7f0a0007; | ||
40 | - public static final int videoView1=0x7f0a0000; | ||
41 | - } | ||
42 | - public static final class layout { | ||
43 | - public static final int activity_video=0x7f030000; | ||
44 | - public static final int dirs=0x7f030001; | ||
45 | - public static final int help=0x7f030002; | ||
46 | - public static final int main_activity=0x7f030003; | ||
47 | - public static final int rowlayout=0x7f030004; | ||
48 | - } | ||
49 | - public static final class menu { | ||
50 | - public static final int activity_main=0x7f090000; | ||
51 | - public static final int activity_video=0x7f090001; | ||
52 | - public static final int menu=0x7f090002; | ||
53 | - } | ||
54 | - public static final class string { | ||
55 | - public static final int app_name=0x7f070000; | ||
56 | - public static final int button=0x7f07000c; | ||
57 | - public static final int button1=0x7f07000d; | ||
58 | - public static final int desc=0x7f070009; | ||
59 | - public static final int descarregar=0x7f070003; | ||
60 | - public static final int dir=0x7f07000a; | ||
61 | - public static final int directoris=0x7f07000b; | ||
62 | - public static final int hello_world=0x7f070010; | ||
63 | - public static final int help=0x7f070008; | ||
64 | - public static final int hint=0x7f070004; | ||
65 | - public static final int menu_settings=0x7f070001; | ||
66 | - public static final int prefs=0x7f070007; | ||
67 | - public static final int startbuttondescription=0x7f07000f; | ||
68 | - public static final int title=0x7f07000e; | ||
69 | - public static final int title_activity_main=0x7f070002; | ||
70 | - public static final int title_activity_video=0x7f070011; | ||
71 | - public static final int url=0x7f070005; | ||
72 | - public static final int urlhint=0x7f070006; | ||
73 | - } | ||
74 | - public static final class style { | ||
75 | - public static final int AppTheme=0x7f080000; | ||
76 | - } | ||
77 | - public static final class xml { | ||
78 | - public static final int prefs=0x7f040000; | ||
79 | - } | ||
80 | -} | 1 | +/* AUTO-GENERATED FILE. DO NOT MODIFY. |
2 | + * | ||
3 | + * This class was automatically generated by the | ||
4 | + * aapt tool from the resource data it found. It | ||
5 | + * should not be modified by hand. | ||
6 | + */ | ||
7 | + | ||
8 | +package com.upc.pbe.upcnews; | ||
9 | + | ||
10 | +public final class R { | ||
11 | + public static final class attr { | ||
12 | + } | ||
13 | + public static final class color { | ||
14 | + public static final int backgroundmain=0x7f050000; | ||
15 | + } | ||
16 | + public static final class dimen { | ||
17 | + public static final int TitleSize=0x7f060000; | ||
18 | + } | ||
19 | + public static final class drawable { | ||
20 | + public static final int ic_action_search=0x7f020000; | ||
21 | + public static final int ic_launcher=0x7f020001; | ||
22 | + public static final int ic_ledarklogo=0x7f020002; | ||
23 | + public static final int ic_menu_name=0x7f020003; | ||
24 | + public static final int ic_startbutton=0x7f020004; | ||
25 | + public static final int startbuttontoggle=0x7f020005; | ||
26 | + } | ||
27 | + public static final class id { | ||
28 | + public static final int LinearLayout1=0x7f0a0001; | ||
29 | + public static final int RelativeLayout1=0x7f0a0006; | ||
30 | + public static final int button=0x7f0a0007; | ||
31 | + public static final int itemhelp=0x7f0a000c; | ||
32 | + public static final int itemprefs=0x7f0a000b; | ||
33 | + public static final int listView1=0x7f0a0003; | ||
34 | + public static final int menu_settings=0x7f0a000a; | ||
35 | + public static final int rowTextView=0x7f0a0009; | ||
36 | + public static final int textView1=0x7f0a0004; | ||
37 | + public static final int textView2=0x7f0a0005; | ||
38 | + public static final int textViewTitle=0x7f0a0002; | ||
39 | + public static final int textViewXml=0x7f0a0008; | ||
40 | + public static final int videoView1=0x7f0a0000; | ||
41 | + } | ||
42 | + public static final class layout { | ||
43 | + public static final int activity_video=0x7f030000; | ||
44 | + public static final int dirs=0x7f030001; | ||
45 | + public static final int help=0x7f030002; | ||
46 | + public static final int main_activity=0x7f030003; | ||
47 | + public static final int rowlayout=0x7f030004; | ||
48 | + } | ||
49 | + public static final class menu { | ||
50 | + public static final int activity_main=0x7f090000; | ||
51 | + public static final int activity_video=0x7f090001; | ||
52 | + public static final int menu=0x7f090002; | ||
53 | + } | ||
54 | + public static final class string { | ||
55 | + public static final int app_name=0x7f070000; | ||
56 | + public static final int button=0x7f07000c; | ||
57 | + public static final int button1=0x7f07000d; | ||
58 | + public static final int desc=0x7f070009; | ||
59 | + public static final int descarregar=0x7f070003; | ||
60 | + public static final int dir=0x7f07000a; | ||
61 | + public static final int directoris=0x7f07000b; | ||
62 | + public static final int hello_world=0x7f070010; | ||
63 | + public static final int help=0x7f070008; | ||
64 | + public static final int hint=0x7f070004; | ||
65 | + public static final int menu_settings=0x7f070001; | ||
66 | + public static final int prefs=0x7f070007; | ||
67 | + public static final int startbuttondescription=0x7f07000f; | ||
68 | + public static final int title=0x7f07000e; | ||
69 | + public static final int title_activity_main=0x7f070002; | ||
70 | + public static final int title_activity_video=0x7f070011; | ||
71 | + public static final int url=0x7f070005; | ||
72 | + public static final int urlhint=0x7f070006; | ||
73 | + } | ||
74 | + public static final class style { | ||
75 | + public static final int AppTheme=0x7f080000; | ||
76 | + } | ||
77 | + public static final class xml { | ||
78 | + public static final int prefs=0x7f040000; | ||
79 | + } | ||
80 | +} |
res/layout/main_activity.xml
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | android:contentDescription="@string/startbuttondescription" | 19 | android:contentDescription="@string/startbuttondescription" |
20 | android:focusable="false" | 20 | android:focusable="false" |
21 | android:focusableInTouchMode="false" /> | 21 | android:focusableInTouchMode="false" /> |
22 | - | 22 | + |
23 | <TextView | 23 | <TextView |
24 | android:id="@+id/textViewXml" | 24 | android:id="@+id/textViewXml" |
25 | android:layout_width="wrap_content" | 25 | android:layout_width="wrap_content" |
src/com/upc/pbe/upcnews/HLS.java
@@ -7,22 +7,26 @@ public class HLS { | @@ -7,22 +7,26 @@ public class HLS { | ||
7 | static final String TAG = "HLS"; | 7 | static final String TAG = "HLS"; |
8 | 8 | ||
9 | ArrayList<ParentList> videos; | 9 | ArrayList<ParentList> videos; |
10 | - int numvideo; | 10 | + int video; |
11 | int quality; //0 es la mรกs alta | 11 | int quality; //0 es la mรกs alta |
12 | 12 | ||
13 | public HLS(ArrayList<ParentList> parsed) | 13 | public HLS(ArrayList<ParentList> parsed) |
14 | { | 14 | { |
15 | this.videos = parsed; | 15 | this.videos = parsed; |
16 | - numvideo = 0; | 16 | + video = 0; |
17 | quality = 0; | 17 | quality = 0; |
18 | } | 18 | } |
19 | 19 | ||
20 | public void start() | 20 | public void start() |
21 | { | 21 | { |
22 | - for(int i = 0 ; i < videos.get(numvideo).getLists().get(quality).getSegments().size() ; i++) | 22 | + int currentVideo = 0; |
23 | + for(video = 0; video < videos.size(); video++) | ||
23 | { | 24 | { |
24 | - Segment seg = videos.get(numvideo).getLists().get(quality).getSegments().get(i); | 25 | + ArrayList<Video> qualities = videos.get(video).getLists(); |
26 | + while(i > videos.get(quality).getLists()) | ||
27 | + { | ||
28 | + Segment seg = videos.get(video).getLists().get(quality).getSegments().get(i); | ||
29 | + } | ||
25 | } | 30 | } |
26 | } | 31 | } |
27 | - | ||
28 | } | 32 | } |
src/com/upc/pbe/upcnews/MainActivity.java
@@ -31,8 +31,6 @@ public class MainActivity extends Activity implements OnClickListener { | @@ -31,8 +31,6 @@ public class MainActivity extends Activity implements OnClickListener { | ||
31 | public void onCreate(Bundle savedInstanceState) { | 31 | public void onCreate(Bundle savedInstanceState) { |
32 | /* | 32 | /* |
33 | * FALTA: | 33 | * FALTA: |
34 | - * Boton de un color mas oscuro al darle | ||
35 | - * Boton y texto centrados | ||
36 | * Boton mayor resolucion | 34 | * Boton mayor resolucion |
37 | */ | 35 | */ |
38 | super.onCreate(savedInstanceState); | 36 | super.onCreate(savedInstanceState); |
src/com/upc/pbe/upcnews/ParentList.java
@@ -8,7 +8,7 @@ public class ParentList | @@ -8,7 +8,7 @@ public class ParentList | ||
8 | private int currentQuality; | 8 | private int currentQuality; |
9 | private String Type, Name; | 9 | private String Type, Name; |
10 | private boolean Default; //Estos 3 รบltimos son para los ext-x-media, los ext-x-stream lo IGNORAN | 10 | private boolean Default; //Estos 3 รบltimos son para los ext-x-media, los ext-x-stream lo IGNORAN |
11 | - private ArrayList<List> lists; //per cada qualitat | 11 | + private ArrayList<Video> lists; //per cada qualitat |
12 | 12 | ||
13 | 13 | ||
14 | public ParentList(String ID) | 14 | public ParentList(String ID) |
@@ -18,7 +18,7 @@ public class ParentList | @@ -18,7 +18,7 @@ public class ParentList | ||
18 | Type = ""; | 18 | Type = ""; |
19 | Name = ""; | 19 | Name = ""; |
20 | Default = false; | 20 | Default = false; |
21 | - lists = new ArrayList<List>(); //Lista de CALIDADES | 21 | + lists = new ArrayList<Video>(); //Lista de CALIDADES |
22 | } | 22 | } |
23 | 23 | ||
24 | public String getID() | 24 | public String getID() |
@@ -67,7 +67,7 @@ public class ParentList | @@ -67,7 +67,7 @@ public class ParentList | ||
67 | Name = n; | 67 | Name = n; |
68 | } | 68 | } |
69 | 69 | ||
70 | - public ArrayList<List> getLists() | 70 | + public ArrayList<Video> getLists() |
71 | { | 71 | { |
72 | return lists; | 72 | return lists; |
73 | } | 73 | } |
src/com/upc/pbe/upcnews/Parser.java
@@ -40,7 +40,7 @@ public class Parser | @@ -40,7 +40,7 @@ public class Parser | ||
40 | { | 40 | { |
41 | ArrayList<ParentList> lists = new ArrayList<ParentList>(); | 41 | ArrayList<ParentList> lists = new ArrayList<ParentList>(); |
42 | lists.add(new ParentList("")); | 42 | lists.add(new ParentList("")); |
43 | - lists.get(0).getLists().add(new List(-1)); | 43 | + lists.get(0).getLists().add(new Video(-1)); |
44 | String[] lines = file.split("\n"); | 44 | String[] lines = file.split("\n"); |
45 | for (int i = 0; i < lines.length; i++) | 45 | for (int i = 0; i < lines.length; i++) |
46 | { | 46 | { |
@@ -97,7 +97,7 @@ public class Parser | @@ -97,7 +97,7 @@ public class Parser | ||
97 | 97 | ||
98 | private void sortQuality(ParentList ppls) | 98 | private void sortQuality(ParentList ppls) |
99 | { | 99 | { |
100 | - ArrayList<List> lists = ppls.getLists(); | 100 | + ArrayList<Video> lists = ppls.getLists(); |
101 | if (lists.get(0).getQuality() == -1) | 101 | if (lists.get(0).getQuality() == -1) |
102 | { | 102 | { |
103 | /* | 103 | /* |
@@ -116,7 +116,7 @@ public class Parser | @@ -116,7 +116,7 @@ public class Parser | ||
116 | if (lists.get(i).getQuality() < lists.get(i + 1).getQuality()) | 116 | if (lists.get(i).getQuality() < lists.get(i + 1).getQuality()) |
117 | { | 117 | { |
118 | sorted = false; | 118 | sorted = false; |
119 | - List aux = lists.get(i); | 119 | + Video aux = lists.get(i); |
120 | lists.set(i, lists.get(i + 1)); | 120 | lists.set(i, lists.get(i + 1)); |
121 | lists.set(i + 1, aux); | 121 | lists.set(i + 1, aux); |
122 | } | 122 | } |
@@ -141,7 +141,7 @@ public class Parser | @@ -141,7 +141,7 @@ public class Parser | ||
141 | else | 141 | else |
142 | { | 142 | { |
143 | ParentList ppls = lists.get(currentList); | 143 | ParentList ppls = lists.get(currentList); |
144 | - List pls = ppls.getLists().get(ppls.getLists().size() - 1); | 144 | + Video pls = ppls.getLists().get(ppls.getLists().size() - 1); |
145 | if (!validated) | 145 | if (!validated) |
146 | { | 146 | { |
147 | if (line.equals(STARTWORD)) | 147 | if (line.equals(STARTWORD)) |
@@ -316,7 +316,7 @@ public class Parser | @@ -316,7 +316,7 @@ public class Parser | ||
316 | } | 316 | } |
317 | else | 317 | else |
318 | { | 318 | { |
319 | - ppls.getLists().add(new List(bandwidth)); | 319 | + ppls.getLists().add(new Video(bandwidth)); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | else if (extTag[0].equals("#EXT-X-MEDIA")) | 322 | else if (extTag[0].equals("#EXT-X-MEDIA")) |
@@ -420,7 +420,7 @@ public class Parser | @@ -420,7 +420,7 @@ public class Parser | ||
420 | + " has missing arguments"); | 420 | + " has missing arguments"); |
421 | } | 421 | } |
422 | Parser p = new Parser(URI.substring(0, URI.lastIndexOf("/") + 1), caller); | 422 | Parser p = new Parser(URI.substring(0, URI.lastIndexOf("/") + 1), caller); |
423 | - List newList = p.parseFile(download.doInBackground(URI)).get(0).getLists().get(0); | 423 | + Video newList = p.parseFile(download.doInBackground(URI)).get(0).getLists().get(0); |
424 | if (!GroupID.equals(ppls.getID())) | 424 | if (!GroupID.equals(ppls.getID())) |
425 | { | 425 | { |
426 | if (ppls.getID().equals("")) | 426 | if (ppls.getID().equals("")) |
@@ -513,7 +513,7 @@ public class Parser | @@ -513,7 +513,7 @@ public class Parser | ||
513 | */ | 513 | */ |
514 | expectList = false; | 514 | expectList = false; |
515 | Parser p = new Parser(line.substring(0, line.lastIndexOf("/") + 1), caller); | 515 | Parser p = new Parser(line.substring(0, line.lastIndexOf("/") + 1), caller); |
516 | - List newList = p.parseFile(download.doInBackground(line)).get(0).getLists().get(0); | 516 | + Video newList = p.parseFile(download.doInBackground(line)).get(0).getLists().get(0); |
517 | pls.setMaxDuration(newList.getMaxDuration()); | 517 | pls.setMaxDuration(newList.getMaxDuration()); |
518 | pls.setSequence(newList.getSequence()); | 518 | pls.setSequence(newList.getSequence()); |
519 | for (int i = 0; i < newList.getSegments().size(); i++) | 519 | for (int i = 0; i < newList.getSegments().size(); i++) |
src/com/upc/pbe/upcnews/List.java renamed to src/com/upc/pbe/upcnews/Video.java
@@ -2,7 +2,7 @@ package com.upc.pbe.upcnews; | @@ -2,7 +2,7 @@ package com.upc.pbe.upcnews; | ||
2 | 2 | ||
3 | import java.util.ArrayList; | 3 | import java.util.ArrayList; |
4 | 4 | ||
5 | -public class List | 5 | +public class Video |
6 | { | 6 | { |
7 | 7 | ||
8 | private int quality; | 8 | private int quality; |
@@ -10,7 +10,7 @@ public class List | @@ -10,7 +10,7 @@ public class List | ||
10 | private int maxDuration; | 10 | private int maxDuration; |
11 | private ArrayList<Segment> segments; //Lista de SEGMENTOS | 11 | private ArrayList<Segment> segments; //Lista de SEGMENTOS |
12 | 12 | ||
13 | - public List(int q) | 13 | + public Video(int q) |
14 | { | 14 | { |
15 | quality = q; | 15 | quality = q; |
16 | segments = new ArrayList<Segment>(); | 16 | segments = new ArrayList<Segment>(); |