Commit f1d268b7500c8ff0ed6f7c7250f9c02f9e090325

Authored by Imanol-Mikel Barba Sabariego
1 parent ebb9bbda

Ja funciona lo de canviar el server. I alguna altra petita modificació

bin/UPC_NEWS_v0.apk 0 → 100644
No preview for this file type
bin/classes.dex 0 → 100644
No preview for this file type
bin/classes/com/upc/pbe/upcnews/HTMLParser.class 0 → 100644
No preview for this file type
bin/classes/com/upc/pbe/upcnews/Parser.class 0 → 100644
No preview for this file type
bin/classes/com/upc/pbe/upcnews/Playlist.class 0 → 100644
No preview for this file type
bin/jarlist.cache 0 → 100644
  1 +# cache for current jar dependecy. DO NOT EDIT.
  2 +# format is <lastModified> <length> <SHA-1> <path>
  3 +# Encoding is UTF-8
... ...
bin/res/drawable-hdpi/ic_action_search.png 0 → 100644

409 Bytes

bin/res/drawable-hdpi/ic_launcher.png 0 → 100644

8.33 KB

bin/res/drawable-ldpi/ic_launcher.png 0 → 100644

3.07 KB

bin/res/drawable-mdpi/ic_action_search.png 0 → 100644

311 Bytes

bin/res/drawable-mdpi/ic_launcher.png 0 → 100644

4.54 KB

bin/res/drawable-xhdpi/ic_action_search.png 0 → 100644

491 Bytes

bin/res/drawable-xhdpi/ic_launcher.png 0 → 100644

12.7 KB

bin/resources.ap_ 0 → 100644
No preview for this file type
gen/com/upc/pbe/upcnews/R.java
... ... @@ -15,30 +15,34 @@ public final class R {
15 15 public static final int ic_launcher=0x7f020001;
16 16 }
17 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;
  18 + public static final int AbsoluteLayout1=0x7f080000;
  19 + public static final int button=0x7f080003;
  20 + public static final int itemprefs=0x7f080005;
  21 + public static final int menu_settings=0x7f080004;
  22 + public static final int textViewRoute=0x7f080002;
  23 + public static final int textViewXml=0x7f080001;
23 24 }
24 25 public static final class layout {
25 26 public static final int main_activity=0x7f030000;
26 27 }
27 28 public static final class menu {
28   - public static final int activity_main=0x7f060000;
  29 + public static final int activity_main=0x7f070000;
  30 + public static final int menu=0x7f070001;
29 31 }
30 32 public static final class string {
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;
  33 + public static final int app_name=0x7f050000;
  34 + public static final int descarregar=0x7f050003;
  35 + public static final int hint=0x7f050004;
  36 + public static final int menu_settings=0x7f050001;
  37 + public static final int prefs=0x7f050007;
  38 + public static final int title_activity_main=0x7f050002;
  39 + public static final int url=0x7f050005;
  40 + public static final int urlhint=0x7f050006;
40 41 }
41 42 public static final class style {
42   - public static final int AppTheme=0x7f050000;
  43 + public static final int AppTheme=0x7f060000;
  44 + }
  45 + public static final class xml {
  46 + public static final int prefs=0x7f040000;
43 47 }
44 48 }
... ...
res/layout/main_activity.xml
... ... @@ -5,7 +5,7 @@
5 5 android:layout_width="wrap_content"
6 6 android:layout_height="match_parent"
7 7 tools:ignore="Deprecated" >
8   -
  8 +
9 9 <TextView
10 10 android:id="@+id/textViewXml"
11 11 android:layout_width="301dp"
... ... @@ -16,7 +16,7 @@
16 16 android:hint="@string/hint"
17 17 android:scrollbarStyle="insideInset"
18 18 android:scrollbars="vertical" />
19   -
  19 +
20 20 <TextView
21 21 android:id="@+id/textViewRoute"
22 22 android:layout_width="250dp"
... ...
res/values/strings.xml
1 1 <resources>
2 2  
3 3 <string name="app_name">UPC_NEWS_v0</string>
4   - <string name="hello_world">Hello world!</string>
5 4 <string name="menu_settings">Settings</string>
6 5 <string name="title_activity_main">MainActivity</string>
7   - <string name="descarregar">Start</string>
8   - <string name="hint">Click to Start Button...</string>
  6 + <string name="descarregar">Refresh</string>
  7 + <string name="hint">Click to Start Button.</string>
9 8 <string name="url">URL server</string>
10   - <string name="urlhint">Set the route from the server</string>
  9 + <string name="urlhint">Set the route from the server (without http://)</string>
11 10 <string name="prefs">Preferences</string>
12 11  
13 12 </resources>
14 13 \ No newline at end of file
... ...
src/com/upc/pbe/upcnews/MainActivity.java
... ... @@ -17,7 +17,6 @@ public class MainActivity extends Activity implements OnClickListener {
17 17 final static String TAG = "Main";
18 18  
19 19 Button buttonDescarrega;
20   - String url = "http://www.google.es";
21 20 String file = "ejemplo.xml";
22 21 String folder = "Environment.getExternalStorageDirectory.getPath()"; // hauria de ser /sdcard/downloads
23 22 TextView showText, showRoute;
... ... @@ -31,27 +30,39 @@ public class MainActivity extends Activity implements OnClickListener {
31 30 buttonDescarrega.setOnClickListener(this);
32 31 showText = (TextView) findViewById(R.id.textViewXml);
33 32 showRoute = (TextView) findViewById(R.id.textViewRoute);
34   - showRoute.setText("Server: " + url);
  33 +
  34 + this.descarregarIMostrar();
35 35 }
36 36  
  37 +
37 38 public boolean onCreateOptionsMenu(Menu menu) {
38 39 getMenuInflater().inflate(R.menu.menu, menu);
39 40 return true;
40 41 }
  42 +
  43 + public String getUrl(){
  44 + String u = ((UpcApp)getApplication()).getUrl();
  45 + showRoute.setText("Server: " + u);
  46 + return u;
  47 + }
41 48  
42 49 public void onClick(View v) {
43 50  
44 51 Log.d(TAG, "onClicked");
45   - Descarrega d = new Descarrega(url, file, folder);
46   - Toast.makeText(this, "Download succesfull", Toast.LENGTH_LONG).show();
47   - CharSequence html = (CharSequence) d.doInBackground();
48   - showText.setText(html);
  52 + this.descarregarIMostrar();
49 53  
50 54 // HTMLParser pars = new HTMLParser((String) html);
51 55 // ArrayList<String> directoris = pars.parse();
52 56 // showText.setText((CharSequence) directoris);
53 57  
54 58 }
  59 +
  60 + public void descarregarIMostrar(){
  61 + Descarrega d = new Descarrega(this.getUrl(), file, folder);
  62 + Toast.makeText(this, "Download succesfull", Toast.LENGTH_LONG).show();
  63 + CharSequence html = (CharSequence) d.doInBackground();
  64 + showText.setText(html);
  65 + }
55 66  
56 67 public boolean onOptionsItemSelected(MenuItem item) {
57 68 switch (item.getItemId()) {
... ...