Commit ebb9bbda6dcee3e99bb1672b7c91f8f6173937c2
1 parent
a8bf0d91
HTMLParser comentado
Showing
16 changed files
with
22 additions
and
24 deletions
bin/UPC_NEWS_v0.apk deleted
No preview for this file type
bin/classes.dex deleted
No preview for this file type
bin/classes/com/upc/pbe/upcnews/HTMLParser.class deleted
No preview for this file type
bin/classes/com/upc/pbe/upcnews/Parser.class deleted
No preview for this file type
bin/classes/com/upc/pbe/upcnews/Playlist.class deleted
No preview for this file type
bin/jarlist.cache deleted
bin/res/drawable-hdpi/ic_action_search.png deleted
409 Bytes
bin/res/drawable-hdpi/ic_launcher.png deleted
8.33 KB
bin/res/drawable-ldpi/ic_launcher.png deleted
3.07 KB
bin/res/drawable-mdpi/ic_action_search.png deleted
311 Bytes
bin/res/drawable-mdpi/ic_launcher.png deleted
4.54 KB
bin/res/drawable-xhdpi/ic_action_search.png deleted
491 Bytes
bin/res/drawable-xhdpi/ic_launcher.png deleted
12.7 KB
bin/resources.ap_ deleted
No preview for this file type
gen/com/upc/pbe/upcnews/R.java
@@ -15,33 +15,30 @@ public final class R { | @@ -15,33 +15,30 @@ public final class R { | ||
15 | public static final int ic_launcher=0x7f020001; | 15 | public static final int ic_launcher=0x7f020001; |
16 | } | 16 | } |
17 | public static final class id { | 17 | public static final class id { |
18 | - public static final int AbsoluteLayout1=0x7f080000; | ||
19 | - public static final int button=0x7f080003; | ||
20 | - public static final int itemprefs=0x7f080004; | ||
21 | - public static final int textViewRoute=0x7f080002; | ||
22 | - public static final int textViewXml=0x7f080001; | 18 | + public static final int AbsoluteLayout1=0x7f070000; |
19 | + public static final int button=0x7f070003; | ||
20 | + public static final int menu_settings=0x7f070004; | ||
21 | + public static final int textViewRoute=0x7f070002; | ||
22 | + public static final int textViewXml=0x7f070001; | ||
23 | } | 23 | } |
24 | public static final class layout { | 24 | public static final class layout { |
25 | public static final int main_activity=0x7f030000; | 25 | public static final int main_activity=0x7f030000; |
26 | } | 26 | } |
27 | public static final class menu { | 27 | public static final class menu { |
28 | - public static final int menu=0x7f070000; | 28 | + public static final int activity_main=0x7f060000; |
29 | } | 29 | } |
30 | public static final class string { | 30 | public static final class string { |
31 | - public static final int app_name=0x7f050000; | ||
32 | - public static final int descarregar=0x7f050004; | ||
33 | - public static final int hello_world=0x7f050001; | ||
34 | - public static final int hint=0x7f050005; | ||
35 | - public static final int menu_settings=0x7f050002; | ||
36 | - public static final int prefs=0x7f050008; | ||
37 | - public static final int title_activity_main=0x7f050003; | ||
38 | - public static final int url=0x7f050006; | ||
39 | - public static final int urlhint=0x7f050007; | 31 | + public static final int app_name=0x7f040000; |
32 | + public static final int descarregar=0x7f040004; | ||
33 | + public static final int hello_world=0x7f040001; | ||
34 | + public static final int hint=0x7f040005; | ||
35 | + public static final int menu_settings=0x7f040002; | ||
36 | + public static final int prefs=0x7f040008; | ||
37 | + public static final int title_activity_main=0x7f040003; | ||
38 | + public static final int url=0x7f040006; | ||
39 | + public static final int urlhint=0x7f040007; | ||
40 | } | 40 | } |
41 | public static final class style { | 41 | public static final class style { |
42 | - public static final int AppTheme=0x7f060000; | ||
43 | - } | ||
44 | - public static final class xml { | ||
45 | - public static final int prefs=0x7f040000; | 42 | + public static final int AppTheme=0x7f050000; |
46 | } | 43 | } |
47 | } | 44 | } |
src/com/upc/pbe/upcnews/HTMLParser.java
@@ -12,8 +12,12 @@ public class HTMLParser { | @@ -12,8 +12,12 @@ public class HTMLParser { | ||
12 | } | 12 | } |
13 | 13 | ||
14 | public ArrayList<String> parse(){ | 14 | public ArrayList<String> parse(){ |
15 | - String[] split = code.split("\n"); | ||
16 | - for(int i = 0; i < split.length; i++){ | 15 | + //Separem el codi en linies |
16 | + String[] split = code.split("\n"); | ||
17 | + //Anem mirant cada linia. Si comença amb el tag <li> és un apartat de l'index i ens interessa. Els directoris en | ||
18 | + //HTML contenen una barra "/" seguida d'unes cometes, per tant, busquem la combinació en la linia. Si la conté, | ||
19 | + //la linia conté un directori. Tallem la linia on toca per treure'n el nom i l'afegim a la llista de directoris. | ||
20 | + for(int i = 0; i < split.length; i++){ | ||
17 | if(split[i].startsWith("<li>")){ | 21 | if(split[i].startsWith("<li>")){ |
18 | if(split[i].contains("/\"")){ | 22 | if(split[i].contains("/\"")){ |
19 | directoris.add(split[i].substring(split[i].indexOf('>', 5), split[i].indexOf('<', 5)-1)); | 23 | directoris.add(split[i].substring(split[i].indexOf('>', 5), split[i].indexOf('<', 5)-1)); |