From 7a2c61c5b3d9c2c593c63f0e584964bc6236dc3a Mon Sep 17 00:00:00 2001 From: Equip de Desenvolupadors de PBE Date: Wed, 21 Nov 2012 15:37:39 +0000 Subject: [PATCH] post clase --- gen/com/upc/pbe/upcnews/R.java | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------- res/values/strings.xml | 3 ++- src/com/upc/pbe/upcnews/HTMLParser.java | 1 + src/com/upc/pbe/upcnews/MainActivity.java | 22 +++++++++++++++------- 4 files changed, 72 insertions(+), 51 deletions(-) diff --git a/gen/com/upc/pbe/upcnews/R.java b/gen/com/upc/pbe/upcnews/R.java index 8c7d5c0..f4452e7 100644 --- a/gen/com/upc/pbe/upcnews/R.java +++ b/gen/com/upc/pbe/upcnews/R.java @@ -1,43 +1,54 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package com.upc.pbe.upcnews; - -public final class R { - public static final class attr { - } - public static final class drawable { - public static final int ic_action_search=0x7f020000; - public static final int ic_launcher=0x7f020001; - } - public static final class id { - public static final int AbsoluteLayout1=0x7f070000; - public static final int button=0x7f070003; - public static final int menu_settings=0x7f070004; - public static final int textViewRoute=0x7f070002; - public static final int textViewXml=0x7f070001; - } - public static final class layout { - public static final int main_activity=0x7f030000; - } - public static final class menu { - public static final int activity_main=0x7f060000; - } - public static final class string { - public static final int app_name=0x7f040000; - public static final int descarregar=0x7f040003; - public static final int hint=0x7f040004; - public static final int menu_settings=0x7f040001; - public static final int prefs=0x7f040007; - public static final int title_activity_main=0x7f040002; - public static final int url=0x7f040005; - public static final int urlhint=0x7f040006; - } - public static final class style { - public static final int AppTheme=0x7f050000; - } -} +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package com.upc.pbe.upcnews; + +public final class R { + public static final class attr { + } + public static final class drawable { + public static final int ic_action_search=0x7f020000; + public static final int ic_launcher=0x7f020001; + } + public static final class id { + public static final int AbsoluteLayout1=0x7f080003; + public static final int LinearLayout1=0x7f080000; + public static final int button=0x7f080006; + public static final int itemhelp=0x7f080009; + public static final int itemprefs=0x7f080008; + public static final int menu_settings=0x7f080007; + public static final int textView1=0x7f080001; + public static final int textView2=0x7f080002; + public static final int textViewRoute=0x7f080005; + public static final int textViewXml=0x7f080004; + } + public static final class layout { + public static final int help=0x7f030000; + public static final int main_activity=0x7f030001; + } + public static final class menu { + public static final int activity_main=0x7f070000; + public static final int menu=0x7f070001; + } + public static final class string { + public static final int app_name=0x7f050000; + public static final int descarregar=0x7f050003; + public static final int help=0x7f050008; + public static final int hint=0x7f050004; + public static final int menu_settings=0x7f050001; + public static final int prefs=0x7f050007; + public static final int title_activity_main=0x7f050002; + public static final int url=0x7f050005; + public static final int urlhint=0x7f050006; + } + public static final class style { + public static final int AppTheme=0x7f060000; + } + public static final class xml { + public static final int prefs=0x7f040000; + } +} diff --git a/res/values/strings.xml b/res/values/strings.xml index 4980fe0..7b45412 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,6 +1,6 @@ - UPC_NEWS_v0 + UPC_NEWS Settings MainActivity Refresh @@ -8,5 +8,6 @@ URL server Set the route from the server (without http://) Preferences + Help! \ No newline at end of file diff --git a/src/com/upc/pbe/upcnews/HTMLParser.java b/src/com/upc/pbe/upcnews/HTMLParser.java index 61119ba..04329ae 100644 --- a/src/com/upc/pbe/upcnews/HTMLParser.java +++ b/src/com/upc/pbe/upcnews/HTMLParser.java @@ -9,6 +9,7 @@ public class HTMLParser { public HTMLParser(String code){ this.code = code; + directoris = new ArrayList(); } public ArrayList parse(){ diff --git a/src/com/upc/pbe/upcnews/MainActivity.java b/src/com/upc/pbe/upcnews/MainActivity.java index 3cfa910..822d0bc 100644 --- a/src/com/upc/pbe/upcnews/MainActivity.java +++ b/src/com/upc/pbe/upcnews/MainActivity.java @@ -1,6 +1,8 @@ package com.upc.pbe.upcnews; +import java.util.ArrayList; + import android.app.Activity; import android.content.Intent; import android.os.Bundle; @@ -30,8 +32,8 @@ public class MainActivity extends Activity implements OnClickListener { buttonDescarrega.setOnClickListener(this); showText = (TextView) findViewById(R.id.textViewXml); showRoute = (TextView) findViewById(R.id.textViewRoute); - - this.descarregarIMostrar(); + this.getUrl(); + } @@ -51,17 +53,20 @@ public class MainActivity extends Activity implements OnClickListener { Log.d(TAG, "onClicked"); this.descarregarIMostrar(); - // HTMLParser pars = new HTMLParser((String) html); - // ArrayList directoris = pars.parse(); - // showText.setText((CharSequence) directoris); + } public void descarregarIMostrar(){ Descarrega d = new Descarrega(this.getUrl(), file, folder); Toast.makeText(this, "Download succesfull", Toast.LENGTH_LONG).show(); - CharSequence html = (CharSequence) d.doInBackground(); - showText.setText(html); + String html = (String) d.doInBackground(); + showText.setText((CharSequence) html); + + HTMLParser pars = new HTMLParser((String) html); + ArrayList directoris = pars.parse(); + showText.setText((CharSequence) directoris.toString()); + } public boolean onOptionsItemSelected(MenuItem item) { @@ -70,6 +75,9 @@ public class MainActivity extends Activity implements OnClickListener { startActivity(new Intent(this, Prefs.class)); Log.d(TAG, "Preferences"); return true; + case R.id.itemhelp: + setContentView(R.layout.help); + return true; default: return false; } -- libgit2 0.22.2