Commit 7a2c61c5b3d9c2c593c63f0e584964bc6236dc3a
1 parent
4b2c5405
post clase
Showing
4 changed files
with
72 additions
and
51 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 | - } | ||
17 | - public static final class id { | ||
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 | - } | ||
24 | - public static final class layout { | ||
25 | - public static final int main_activity=0x7f030000; | ||
26 | - } | ||
27 | - public static final class menu { | ||
28 | - public static final int activity_main=0x7f060000; | ||
29 | - } | ||
30 | - public static final class string { | ||
31 | - public static final int app_name=0x7f040000; | ||
32 | - public static final int descarregar=0x7f040003; | ||
33 | - public static final int hint=0x7f040004; | ||
34 | - public static final int menu_settings=0x7f040001; | ||
35 | - public static final int prefs=0x7f040007; | ||
36 | - public static final int title_activity_main=0x7f040002; | ||
37 | - public static final int url=0x7f040005; | ||
38 | - public static final int urlhint=0x7f040006; | ||
39 | - } | ||
40 | - public static final class style { | ||
41 | - public static final int AppTheme=0x7f050000; | ||
42 | - } | ||
43 | -} | 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 | + } | ||
17 | + public static final class id { | ||
18 | + public static final int AbsoluteLayout1=0x7f080003; | ||
19 | + public static final int LinearLayout1=0x7f080000; | ||
20 | + public static final int button=0x7f080006; | ||
21 | + public static final int itemhelp=0x7f080009; | ||
22 | + public static final int itemprefs=0x7f080008; | ||
23 | + public static final int menu_settings=0x7f080007; | ||
24 | + public static final int textView1=0x7f080001; | ||
25 | + public static final int textView2=0x7f080002; | ||
26 | + public static final int textViewRoute=0x7f080005; | ||
27 | + public static final int textViewXml=0x7f080004; | ||
28 | + } | ||
29 | + public static final class layout { | ||
30 | + public static final int help=0x7f030000; | ||
31 | + public static final int main_activity=0x7f030001; | ||
32 | + } | ||
33 | + public static final class menu { | ||
34 | + public static final int activity_main=0x7f070000; | ||
35 | + public static final int menu=0x7f070001; | ||
36 | + } | ||
37 | + public static final class string { | ||
38 | + public static final int app_name=0x7f050000; | ||
39 | + public static final int descarregar=0x7f050003; | ||
40 | + public static final int help=0x7f050008; | ||
41 | + public static final int hint=0x7f050004; | ||
42 | + public static final int menu_settings=0x7f050001; | ||
43 | + public static final int prefs=0x7f050007; | ||
44 | + public static final int title_activity_main=0x7f050002; | ||
45 | + public static final int url=0x7f050005; | ||
46 | + public static final int urlhint=0x7f050006; | ||
47 | + } | ||
48 | + public static final class style { | ||
49 | + public static final int AppTheme=0x7f060000; | ||
50 | + } | ||
51 | + public static final class xml { | ||
52 | + public static final int prefs=0x7f040000; | ||
53 | + } | ||
54 | +} |
res/values/strings.xml
1 | <resources> | 1 | <resources> |
2 | 2 | ||
3 | - <string name="app_name">UPC_NEWS_v0</string> | 3 | + <string name="app_name">UPC_NEWS</string> |
4 | <string name="menu_settings">Settings</string> | 4 | <string name="menu_settings">Settings</string> |
5 | <string name="title_activity_main">MainActivity</string> | 5 | <string name="title_activity_main">MainActivity</string> |
6 | <string name="descarregar">Refresh</string> | 6 | <string name="descarregar">Refresh</string> |
@@ -8,5 +8,6 @@ | @@ -8,5 +8,6 @@ | ||
8 | <string name="url">URL server</string> | 8 | <string name="url">URL server</string> |
9 | <string name="urlhint">Set the route from the server (without http://)</string> | 9 | <string name="urlhint">Set the route from the server (without http://)</string> |
10 | <string name="prefs">Preferences</string> | 10 | <string name="prefs">Preferences</string> |
11 | + <string name="help">Help!</string> | ||
11 | 12 | ||
12 | </resources> | 13 | </resources> |
13 | \ No newline at end of file | 14 | \ No newline at end of file |
src/com/upc/pbe/upcnews/HTMLParser.java
@@ -9,6 +9,7 @@ public class HTMLParser { | @@ -9,6 +9,7 @@ public class HTMLParser { | ||
9 | 9 | ||
10 | public HTMLParser(String code){ | 10 | public HTMLParser(String code){ |
11 | this.code = code; | 11 | this.code = code; |
12 | + directoris = new ArrayList<String>(); | ||
12 | } | 13 | } |
13 | 14 | ||
14 | public ArrayList<String> parse(){ | 15 | public ArrayList<String> parse(){ |
src/com/upc/pbe/upcnews/MainActivity.java
1 | package com.upc.pbe.upcnews; | 1 | package com.upc.pbe.upcnews; |
2 | 2 | ||
3 | 3 | ||
4 | +import java.util.ArrayList; | ||
5 | + | ||
4 | import android.app.Activity; | 6 | import android.app.Activity; |
5 | import android.content.Intent; | 7 | import android.content.Intent; |
6 | import android.os.Bundle; | 8 | import android.os.Bundle; |
@@ -30,8 +32,8 @@ public class MainActivity extends Activity implements OnClickListener { | @@ -30,8 +32,8 @@ public class MainActivity extends Activity implements OnClickListener { | ||
30 | buttonDescarrega.setOnClickListener(this); | 32 | buttonDescarrega.setOnClickListener(this); |
31 | showText = (TextView) findViewById(R.id.textViewXml); | 33 | showText = (TextView) findViewById(R.id.textViewXml); |
32 | showRoute = (TextView) findViewById(R.id.textViewRoute); | 34 | showRoute = (TextView) findViewById(R.id.textViewRoute); |
33 | - | ||
34 | - this.descarregarIMostrar(); | 35 | + this.getUrl(); |
36 | + | ||
35 | } | 37 | } |
36 | 38 | ||
37 | 39 | ||
@@ -51,17 +53,20 @@ public class MainActivity extends Activity implements OnClickListener { | @@ -51,17 +53,20 @@ public class MainActivity extends Activity implements OnClickListener { | ||
51 | Log.d(TAG, "onClicked"); | 53 | Log.d(TAG, "onClicked"); |
52 | this.descarregarIMostrar(); | 54 | this.descarregarIMostrar(); |
53 | 55 | ||
54 | - // HTMLParser pars = new HTMLParser((String) html); | ||
55 | - // ArrayList<String> directoris = pars.parse(); | ||
56 | - // showText.setText((CharSequence) directoris); | 56 | + |
57 | 57 | ||
58 | } | 58 | } |
59 | 59 | ||
60 | public void descarregarIMostrar(){ | 60 | public void descarregarIMostrar(){ |
61 | Descarrega d = new Descarrega(this.getUrl(), file, folder); | 61 | Descarrega d = new Descarrega(this.getUrl(), file, folder); |
62 | Toast.makeText(this, "Download succesfull", Toast.LENGTH_LONG).show(); | 62 | Toast.makeText(this, "Download succesfull", Toast.LENGTH_LONG).show(); |
63 | - CharSequence html = (CharSequence) d.doInBackground(); | ||
64 | - showText.setText(html); | 63 | + String html = (String) d.doInBackground(); |
64 | + showText.setText((CharSequence) html); | ||
65 | + | ||
66 | + HTMLParser pars = new HTMLParser((String) html); | ||
67 | + ArrayList<String> directoris = pars.parse(); | ||
68 | + showText.setText((CharSequence) directoris.toString()); | ||
69 | + | ||
65 | } | 70 | } |
66 | 71 | ||
67 | public boolean onOptionsItemSelected(MenuItem item) { | 72 | public boolean onOptionsItemSelected(MenuItem item) { |
@@ -70,6 +75,9 @@ public class MainActivity extends Activity implements OnClickListener { | @@ -70,6 +75,9 @@ public class MainActivity extends Activity implements OnClickListener { | ||
70 | startActivity(new Intent(this, Prefs.class)); | 75 | startActivity(new Intent(this, Prefs.class)); |
71 | Log.d(TAG, "Preferences"); | 76 | Log.d(TAG, "Preferences"); |
72 | return true; | 77 | return true; |
78 | + case R.id.itemhelp: | ||
79 | + setContentView(R.layout.help); | ||
80 | + return true; | ||
73 | default: | 81 | default: |
74 | return false; | 82 | return false; |
75 | } | 83 | } |