Commit 100b85051961ff65aee686f7845b83d7debd7cf3
1 parent
c002124c
--no commit message
Showing
4 changed files
with
84 additions
and
81 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 drawable { | ||
14 | - public static final int ic_action_search=0x7f020000; | ||
15 | - public static final int ic_launcher=0x7f020001; | ||
16 | - public static final int ic_menu_name=0x7f020002; | ||
17 | - } | ||
18 | - public static final class id { | ||
19 | - public static final int AbsoluteLayout1=0x7f080009; | ||
20 | - public static final int ImageView01=0x7f08000b; | ||
21 | - public static final int ImageView1=0x7f08000a; | ||
22 | - public static final int LinearLayout1=0x7f080000; | ||
23 | - public static final int button=0x7f08000e; | ||
24 | - public static final int button1=0x7f080002; | ||
25 | - public static final int button2=0x7f080003; | ||
26 | - public static final int button3=0x7f080004; | ||
27 | - public static final int button4=0x7f080005; | ||
28 | - public static final int button5=0x7f080006; | ||
29 | - public static final int itemhelp=0x7f080011; | ||
30 | - public static final int itemprefs=0x7f080010; | ||
31 | - public static final int menu_settings=0x7f08000f; | ||
32 | - public static final int textView1=0x7f080007; | ||
33 | - public static final int textView2=0x7f080008; | ||
34 | - public static final int textViewRoute=0x7f08000c; | ||
35 | - public static final int textViewTitle=0x7f080001; | ||
36 | - public static final int textViewXml=0x7f08000d; | ||
37 | - } | ||
38 | - public static final class layout { | ||
39 | - public static final int dirs=0x7f030000; | ||
40 | - public static final int help=0x7f030001; | ||
41 | - public static final int main_activity=0x7f030002; | ||
42 | - } | ||
43 | - public static final class menu { | ||
44 | - public static final int activity_main=0x7f070000; | ||
45 | - public static final int menu=0x7f070001; | ||
46 | - } | ||
47 | - public static final class string { | ||
48 | - public static final int app_name=0x7f050000; | ||
49 | - public static final int button=0x7f05000c; | ||
50 | - public static final int button1=0x7f05000d; | ||
51 | - public static final int desc=0x7f050009; | ||
52 | - public static final int descarregar=0x7f050003; | ||
53 | - public static final int dir=0x7f05000a; | ||
54 | - public static final int directoris=0x7f05000b; | ||
55 | - public static final int help=0x7f050008; | ||
56 | - public static final int hint=0x7f050004; | ||
57 | - public static final int logodescription=0x7f05000f; | ||
58 | - public static final int menu_settings=0x7f050001; | ||
59 | - public static final int prefs=0x7f050007; | ||
60 | - public static final int title=0x7f05000e; | ||
61 | - public static final int title_activity_main=0x7f050002; | ||
62 | - public static final int url=0x7f050005; | ||
63 | - public static final int urlhint=0x7f050006; | ||
64 | - } | ||
65 | - public static final class style { | ||
66 | - public static final int AppTheme=0x7f060000; | ||
67 | - } | ||
68 | - public static final class xml { | ||
69 | - public static final int prefs=0x7f040000; | ||
70 | - } | ||
71 | -} | 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 drawable { | ||
14 | + public static final int ic_action_search=0x7f020000; | ||
15 | + public static final int ic_launcher=0x7f020001; | ||
16 | + public static final int ic_menu_name=0x7f020002; | ||
17 | + } | ||
18 | + public static final class id { | ||
19 | + public static final int AbsoluteLayout1=0x7f080009; | ||
20 | + public static final int ImageView01=0x7f08000b; | ||
21 | + public static final int ImageView1=0x7f08000a; | ||
22 | + public static final int LinearLayout1=0x7f080000; | ||
23 | + public static final int button=0x7f08000e; | ||
24 | + public static final int button1=0x7f080002; | ||
25 | + public static final int button2=0x7f080003; | ||
26 | + public static final int button3=0x7f080004; | ||
27 | + public static final int button4=0x7f080005; | ||
28 | + public static final int button5=0x7f080006; | ||
29 | + public static final int itemhelp=0x7f080011; | ||
30 | + public static final int itemprefs=0x7f080010; | ||
31 | + public static final int menu_settings=0x7f08000f; | ||
32 | + public static final int textView1=0x7f080007; | ||
33 | + public static final int textView2=0x7f080008; | ||
34 | + public static final int textViewRoute=0x7f08000c; | ||
35 | + public static final int textViewTitle=0x7f080001; | ||
36 | + public static final int textViewXml=0x7f08000d; | ||
37 | + } | ||
38 | + public static final class layout { | ||
39 | + public static final int dirs=0x7f030000; | ||
40 | + public static final int help=0x7f030001; | ||
41 | + public static final int main_activity=0x7f030002; | ||
42 | + } | ||
43 | + public static final class menu { | ||
44 | + public static final int activity_main=0x7f070000; | ||
45 | + public static final int menu=0x7f070001; | ||
46 | + } | ||
47 | + public static final class string { | ||
48 | + public static final int app_name=0x7f050000; | ||
49 | + public static final int button=0x7f05000c; | ||
50 | + public static final int button1=0x7f05000d; | ||
51 | + public static final int desc=0x7f050009; | ||
52 | + public static final int descarregar=0x7f050003; | ||
53 | + public static final int dir=0x7f05000a; | ||
54 | + public static final int directoris=0x7f05000b; | ||
55 | + public static final int help=0x7f050008; | ||
56 | + public static final int hint=0x7f050004; | ||
57 | + public static final int logodescription=0x7f05000f; | ||
58 | + public static final int menu_settings=0x7f050001; | ||
59 | + public static final int prefs=0x7f050007; | ||
60 | + public static final int title=0x7f05000e; | ||
61 | + public static final int title_activity_main=0x7f050002; | ||
62 | + public static final int url=0x7f050005; | ||
63 | + public static final int urlhint=0x7f050006; | ||
64 | + } | ||
65 | + public static final class style { | ||
66 | + public static final int AppTheme=0x7f060000; | ||
67 | + } | ||
68 | + public static final class xml { | ||
69 | + public static final int prefs=0x7f040000; | ||
70 | + } | ||
71 | +} |
src/com/upc/pbe/upcnews/Descarrega.java
@@ -23,15 +23,17 @@ public class Descarrega extends AsyncTask<Object, Object, Object>{ | @@ -23,15 +23,17 @@ public class Descarrega extends AsyncTask<Object, Object, Object>{ | ||
23 | private String html; | 23 | private String html; |
24 | private File arxiu; | 24 | private File arxiu; |
25 | 25 | ||
26 | - public Descarrega(String url, String nomarxiu, String carpeta) { | ||
27 | - this.url = url; | 26 | + public Descarrega(String nomarxiu, String carpeta) { |
27 | + | ||
28 | this.nomarxiu = nomarxiu; | 28 | this.nomarxiu = nomarxiu; |
29 | this.carpeta = carpeta; | 29 | this.carpeta = carpeta; |
30 | this.html = null; | 30 | this.html = null; |
31 | this.arxiu = null; | 31 | this.arxiu = null; |
32 | } | 32 | } |
33 | 33 | ||
34 | - public void descarregarguardar() { | 34 | + public void descarregarguardar(String u) { |
35 | + | ||
36 | + this.url = u; | ||
35 | // Creem el directori | 37 | // Creem el directori |
36 | File dir = new File(carpeta); | 38 | File dir = new File(carpeta); |
37 | if (!dir.exists()) { | 39 | if (!dir.exists()) { |
@@ -73,7 +75,8 @@ public class Descarrega extends AsyncTask<Object, Object, Object>{ | @@ -73,7 +75,8 @@ public class Descarrega extends AsyncTask<Object, Object, Object>{ | ||
73 | 75 | ||
74 | 76 | ||
75 | 77 | ||
76 | - protected String doInBackground() { | 78 | + protected String doInBackground(String u) { |
79 | + this.url = u; | ||
77 | try { | 80 | try { |
78 | URLConnection conn = new URL(url).openConnection(); | 81 | URLConnection conn = new URL(url).openConnection(); |
79 | BufferedReader in = new BufferedReader(new InputStreamReader( | 82 | BufferedReader in = new BufferedReader(new InputStreamReader( |
src/com/upc/pbe/upcnews/Directoris.java
@@ -106,8 +106,8 @@ public class Directoris extends Activity implements OnClickListener { | @@ -106,8 +106,8 @@ public class Directoris extends Activity implements OnClickListener { | ||
106 | 106 | ||
107 | //Descarrega de la pàgina HTML del directori i busqueda d'un .m3u8 en ella | 107 | //Descarrega de la pàgina HTML del directori i busqueda d'un .m3u8 en ella |
108 | Log.d(TAG, "Click on " + b.getText()); | 108 | Log.d(TAG, "Click on " + b.getText()); |
109 | - d = new Descarrega(url + "/" + b.getText() + "/", file, folder); | ||
110 | - String str = d.doInBackground(); | 109 | + d = new Descarrega(file, folder); |
110 | + String str = d.doInBackground(url + "/" + b.getText() + "/"); | ||
111 | HTMLParser pars = new HTMLParser(); | 111 | HTMLParser pars = new HTMLParser(); |
112 | String urlvideo = pars.findvideo(str, url + "/" + b.getText() + "/"); | 112 | String urlvideo = pars.findvideo(str, url + "/" + b.getText() + "/"); |
113 | Log.d(TAG, urlvideo); | 113 | Log.d(TAG, urlvideo); |
@@ -116,8 +116,8 @@ public class Directoris extends Activity implements OnClickListener { | @@ -116,8 +116,8 @@ public class Directoris extends Activity implements OnClickListener { | ||
116 | if (urlvideo.equalsIgnoreCase("No s'ha trobat")) { | 116 | if (urlvideo.equalsIgnoreCase("No s'ha trobat")) { |
117 | Toast.makeText(this, "The directory " + b.getText() + " does not contain any '.m3u8' file", Toast.LENGTH_LONG).show(); | 117 | Toast.makeText(this, "The directory " + b.getText() + " does not contain any '.m3u8' file", Toast.LENGTH_LONG).show(); |
118 | } else { | 118 | } else { |
119 | - d = new Descarrega(urlvideo, file, folder); | ||
120 | - String m3u8 = d.doInBackground(); | 119 | + d = new Descarrega(file, folder); |
120 | + String m3u8 = d.doInBackground(urlvideo); | ||
121 | Parser p = new Parser(); | 121 | Parser p = new Parser(); |
122 | try { | 122 | try { |
123 | ArrayList<ParentList> m3u8parsed = p.parseFile(m3u8); | 123 | ArrayList<ParentList> m3u8parsed = p.parseFile(m3u8); |
src/com/upc/pbe/upcnews/MainActivity.java
@@ -81,9 +81,9 @@ public class MainActivity extends Activity implements OnClickListener { | @@ -81,9 +81,9 @@ public class MainActivity extends Activity implements OnClickListener { | ||
81 | } | 81 | } |
82 | 82 | ||
83 | public void descarregar() { | 83 | public void descarregar() { |
84 | - Descarrega d = new Descarrega(this.getUrl(), file, folder); | 84 | + Descarrega d = new Descarrega(file, folder); |
85 | Toast.makeText(this, "Download succesfull", Toast.LENGTH_LONG).show(); | 85 | Toast.makeText(this, "Download succesfull", Toast.LENGTH_LONG).show(); |
86 | - html = (String) d.doInBackground(); | 86 | + html = (String) d.doInBackground(this.getUrl()); |
87 | } | 87 | } |
88 | 88 | ||
89 | public boolean onOptionsItemSelected(MenuItem item) { | 89 | public boolean onOptionsItemSelected(MenuItem item) { |