diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 712b6a6..a9a8ba7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -25,6 +25,8 @@
+
+
\ No newline at end of file
diff --git a/gen/com/upc/pbe/upcnews/R.java b/gen/com/upc/pbe/upcnews/R.java
index f7f52ed..6804691 100644
--- a/gen/com/upc/pbe/upcnews/R.java
+++ b/gen/com/upc/pbe/upcnews/R.java
@@ -15,30 +15,48 @@ public final class R {
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 int AbsoluteLayout1=0x7f080005;
+ public static final int LinearLayout1=0x7f080003;
+ public static final int button=0x7f080008;
+ public static final int buttonPlay=0x7f080000;
+ public static final int imageView1=0x7f080009;
+ public static final int itemhelp=0x7f08000c;
+ public static final int itemprefs=0x7f08000b;
+ public static final int menu_settings=0x7f08000a;
+ public static final int textView1=0x7f080001;
+ public static final int textView2=0x7f080004;
+ public static final int textViewRoute=0x7f080007;
+ public static final int textViewXml=0x7f080006;
+ public static final int text_out=0x7f080002;
}
public static final class layout {
- public static final int main_activity=0x7f030000;
+ public static final int directori=0x7f030000;
+ public static final int dirs=0x7f030001;
+ public static final int help=0x7f030002;
+ public static final int main_activity=0x7f030003;
}
public static final class menu {
- public static final int activity_main=0x7f060000;
+ public static final int activity_main=0x7f070000;
+ public static final int menu=0x7f070001;
}
public static final class string {
- public static final int app_name=0x7f040000;
- public static final int descarregar=0x7f040003;
- public static final int help=0x7f040008;
- 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 int app_name=0x7f050000;
+ public static final int desc=0x7f050009;
+ public static final int descarregar=0x7f050003;
+ public static final int dir=0x7f05000a;
+ public static final int directoris=0x7f05000b;
+ 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=0x7f050000;
+ public static final int AppTheme=0x7f060000;
+ }
+ public static final class xml {
+ public static final int prefs=0x7f040000;
}
}
diff --git a/res/layout/directori.xml b/res/layout/directori.xml
new file mode 100644
index 0000000..c95865d
--- /dev/null
+++ b/res/layout/directori.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/dirs.xml b/res/layout/dirs.xml
new file mode 100644
index 0000000..52ffff7
--- /dev/null
+++ b/res/layout/dirs.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/help.xml b/res/layout/help.xml
index d3b3d8f..fa2ae61 100644
--- a/res/layout/help.xml
+++ b/res/layout/help.xml
@@ -10,15 +10,19 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
+ android:layout_weight="0.04"
android:text="@string/help"
android:textAppearance="?android:attr/textAppearanceLarge" />
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/main_activity.xml b/res/layout/main_activity.xml
index 8494f74..72d9d11 100644
--- a/res/layout/main_activity.xml
+++ b/res/layout/main_activity.xml
@@ -5,11 +5,11 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:ignore="Deprecated" >
-
+
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7b45412..3c65aa4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -9,5 +9,8 @@
Set the route from the server (without http://)PreferencesHelp!
+ Play
+ Directory
+ Directoris
\ No newline at end of file
diff --git a/src/com/upc/pbe/upcnews/Directoris.java b/src/com/upc/pbe/upcnews/Directoris.java
new file mode 100644
index 0000000..31e91e1
--- /dev/null
+++ b/src/com/upc/pbe/upcnews/Directoris.java
@@ -0,0 +1,36 @@
+package com.upc.pbe.upcnews;
+
+import java.util.ArrayList;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.TextView;
+
+public class Directoris extends Activity {
+
+ final static String TAG = "Directoris";
+
+ TextView textout;
+ String s;
+
+ public void onCreate(Bundle savedInstanceState) {
+
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.dirs);
+
+ textout = (TextView) findViewById(R.id.text_out);
+
+ s = ((UpcApp) getApplication()).getDesc();
+ HTMLParser pars = new HTMLParser((String) s);
+ ArrayList dirs = pars.parse();
+
+ for (int i = 0; i < dirs.size(); i++) {
+
+ Log.d(TAG, "Directori " +i);
+ textout.append(String.format("\nDirectori: %s\n",dirs.get(i).toString()));
+ }
+
+ }
+
+}
diff --git a/src/com/upc/pbe/upcnews/Help.java b/src/com/upc/pbe/upcnews/Help.java
new file mode 100644
index 0000000..b67636e
--- /dev/null
+++ b/src/com/upc/pbe/upcnews/Help.java
@@ -0,0 +1,24 @@
+package com.upc.pbe.upcnews;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.TextView;
+
+public class Help extends Activity{
+
+ final static String TAG = "Help";
+ final static String HELP = "Help, I need somebody, Help, not just anybody, Help, you know I need someone, help. ";
+
+ public void onCreate(Bundle savedInstanceState) {
+ Log.d(TAG, "onCreated");
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.help);
+ TextView text = (TextView) findViewById(R.id.textView2);
+ text.setText(HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP + HELP);
+}
+ public void onStop(){
+ Log.d(TAG, "onStoped");
+ super.onStop();
+ }
+}
diff --git a/src/com/upc/pbe/upcnews/MainActivity.java b/src/com/upc/pbe/upcnews/MainActivity.java
index 822d0bc..df0ab88 100644
--- a/src/com/upc/pbe/upcnews/MainActivity.java
+++ b/src/com/upc/pbe/upcnews/MainActivity.java
@@ -1,8 +1,5 @@
package com.upc.pbe.upcnews;
-
-import java.util.ArrayList;
-
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
@@ -17,7 +14,9 @@ import android.widget.Toast;
public class MainActivity extends Activity implements OnClickListener {
final static String TAG = "Main";
-
+ static String html;
+
+ Directoris dir;
Button buttonDescarrega;
String file = "ejemplo.xml";
String folder = "Environment.getExternalStorageDirectory.getPath()";
@@ -35,15 +34,14 @@ public class MainActivity extends Activity implements OnClickListener {
this.getUrl();
}
-
-
+
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
-
- public String getUrl(){
- String u = ((UpcApp)getApplication()).getUrl();
+
+ public String getUrl() {
+ String u = ((UpcApp) getApplication()).getUrl();
showRoute.setText("Server: " + u);
return u;
}
@@ -51,21 +49,22 @@ public class MainActivity extends Activity implements OnClickListener {
public void onClick(View v) {
Log.d(TAG, "onClicked");
- this.descarregarIMostrar();
-
-
+ this.descarregar();
+ ((UpcApp)getApplication()).setDesc(html);
+ startActivity(new Intent(this, Directoris.class));
}
-
- public void descarregarIMostrar(){
+
+ public void descarregar() {
Descarrega d = new Descarrega(this.getUrl(), file, folder);
Toast.makeText(this, "Download succesfull", Toast.LENGTH_LONG).show();
- String html = (String) d.doInBackground();
- showText.setText((CharSequence) html);
+ html = (String) d.doInBackground();
+
+ //HTMLParser pars = new HTMLParser((String) html);
+ //ArrayList dirs = pars.parse();
+
+ //showText.setText(dirs.toString());
- HTMLParser pars = new HTMLParser((String) html);
- ArrayList directoris = pars.parse();
- showText.setText((CharSequence) directoris.toString());
}
@@ -75,8 +74,8 @@ 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);
+ case R.id.itemhelp:
+ startActivity(new Intent(this, Help.class));
return true;
default:
return false;
diff --git a/src/com/upc/pbe/upcnews/UpcApp.java b/src/com/upc/pbe/upcnews/UpcApp.java
index 3569fb9..faea7d0 100644
--- a/src/com/upc/pbe/upcnews/UpcApp.java
+++ b/src/com/upc/pbe/upcnews/UpcApp.java
@@ -13,6 +13,7 @@ public class UpcApp extends Application implements OnSharedPreferenceChangeListe
SharedPreferences prefs;
String defaultUrl = "10.0.2.100";
String url = null;
+ String desc;
public String getUrl() {
url = "http://" + prefs.getString("s", defaultUrl);
@@ -42,5 +43,14 @@ public class UpcApp extends Application implements OnSharedPreferenceChangeListe
Log.d(TAG, "onSharedPreferenceChanged for key: " + key);
}
+
+ public void setDesc(String s){
+ desc = s;
+
+ }
+
+ public String getDesc(){
+ return desc;
+ }
}