Commit 74eea6c1e5184ac05b2e93a7ebb0110eec5607c1

Authored by Imanol-Mikel Barba Sabariego
1 parent 4a7af269

--no commit message

gen/com/upc/pbe/upcnews/R.java
@@ -16,24 +16,23 @@ public final class R { @@ -16,24 +16,23 @@ public final class R {
16 } 16 }
17 public static final class id { 17 public static final class id {
18 public static final int AbsoluteLayout1=0x7f080005; 18 public static final int AbsoluteLayout1=0x7f080005;
19 - public static final int LinearLayout1=0x7f080003; 19 + public static final int LinearLayout1=0x7f080002;
20 public static final int button=0x7f080008; 20 public static final int button=0x7f080008;
21 - public static final int buttonPlay=0x7f080000;  
22 public static final int imageView1=0x7f080009; 21 public static final int imageView1=0x7f080009;
23 public static final int itemhelp=0x7f08000c; 22 public static final int itemhelp=0x7f08000c;
24 public static final int itemprefs=0x7f08000b; 23 public static final int itemprefs=0x7f08000b;
25 public static final int menu_settings=0x7f08000a; 24 public static final int menu_settings=0x7f08000a;
26 - public static final int textView1=0x7f080001; 25 + public static final int textView1=0x7f080003;
27 public static final int textView2=0x7f080004; 26 public static final int textView2=0x7f080004;
28 public static final int textViewRoute=0x7f080007; 27 public static final int textViewRoute=0x7f080007;
  28 + public static final int textViewTitle=0x7f080000;
29 public static final int textViewXml=0x7f080006; 29 public static final int textViewXml=0x7f080006;
30 - public static final int text_out=0x7f080002; 30 + public static final int text_out=0x7f080001;
31 } 31 }
32 public static final class layout { 32 public static final class layout {
33 - public static final int directori=0x7f030000;  
34 - public static final int dirs=0x7f030001;  
35 - public static final int help=0x7f030002;  
36 - public static final int main_activity=0x7f030003; 33 + public static final int dirs=0x7f030000;
  34 + public static final int help=0x7f030001;
  35 + public static final int main_activity=0x7f030002;
37 } 36 }
38 public static final class menu { 37 public static final class menu {
39 public static final int activity_main=0x7f070000; 38 public static final int activity_main=0x7f070000;
res/layout/directori.xml deleted
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3 - android:layout_width="match_parent"  
4 - android:layout_height="match_parent" >  
5 -  
6 - <Button  
7 - android:id="@+id/buttonPlay"  
8 - style="?android:attr/buttonStyleSmall"  
9 - android:layout_width="wrap_content"  
10 - android:layout_height="wrap_content"  
11 - android:layout_alignParentRight="true"  
12 - android:layout_alignParentTop="true"  
13 - android:layout_marginRight="36dp"  
14 - android:text="@string/desc" />  
15 -  
16 - <TextView  
17 - android:id="@+id/textView1"  
18 - android:layout_width="wrap_content"  
19 - android:layout_height="wrap_content"  
20 - android:layout_alignParentLeft="true"  
21 - android:layout_alignParentTop="true"  
22 - android:layout_marginLeft="42dp"  
23 - android:text="@string/dir"  
24 - android:textAppearance="?android:attr/textAppearanceLarge" />  
25 -  
26 -</RelativeLayout>  
27 \ No newline at end of file 0 \ No newline at end of file
res/layout/dirs.xml
@@ -5,13 +5,14 @@ @@ -5,13 +5,14 @@
5 android:orientation="vertical" > 5 android:orientation="vertical" >
6 6
7 <TextView 7 <TextView
8 - android:id="@+id/textView1" 8 + android:id="@+id/textViewTitle"
9 android:layout_width="wrap_content" 9 android:layout_width="wrap_content"
10 android:layout_height="wrap_content" 10 android:layout_height="wrap_content"
11 - android:layout_gravity="center"  
12 - android:text="@string/directoris" 11 + android:layout_gravity="right"
13 android:textAppearance="?android:attr/textAppearanceLarge" /> 12 android:textAppearance="?android:attr/textAppearanceLarge" />
14 13
  14 + <!-- Vista en llista -->
  15 +
15 <ScrollView 16 <ScrollView
16 android:layout_width="match_parent" 17 android:layout_width="match_parent"
17 android:layout_height="match_parent" > 18 android:layout_height="match_parent" >
@@ -20,6 +21,7 @@ @@ -20,6 +21,7 @@
20 android:id="@+id/text_out" 21 android:id="@+id/text_out"
21 android:layout_width="match_parent" 22 android:layout_width="match_parent"
22 android:layout_height="wrap_content" 23 android:layout_height="wrap_content"
  24 + android:layout_gravity="right"
23 android:textAppearance="?android:attr/textAppearanceMedium" /> 25 android:textAppearance="?android:attr/textAppearanceMedium" />
24 </ScrollView> 26 </ScrollView>
25 27
res/xml/prefs.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > 2 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
3 - <EditTextPreference android:key="s" android:title="@string/url" android:summary="@string/urlhint"/> 3 + <EditTextPreference android:key="server" android:title="@string/url" android:summary="@string/urlhint"/>
4 4
5 5
6 </PreferenceScreen> 6 </PreferenceScreen>
7 \ No newline at end of file 7 \ No newline at end of file
src/com/upc/pbe/upcnews/Descarrega.java
@@ -79,8 +79,7 @@ public class Descarrega extends AsyncTask&lt;Object, Object, Object&gt;{ @@ -79,8 +79,7 @@ public class Descarrega extends AsyncTask&lt;Object, Object, Object&gt;{
79 BufferedReader in = new BufferedReader(new InputStreamReader( 79 BufferedReader in = new BufferedReader(new InputStreamReader(
80 conn.getInputStream())); 80 conn.getInputStream()));
81 Log.d(TAG, "\nDescarregant: \n"); 81 Log.d(TAG, "\nDescarregant: \n");
82 - Log.d(TAG, ">> URL: " + url + " >> Nom: " + nomarxiu  
83 - + " >> Tamany: " + conn.getContentLength() + " bytes"); 82 + Log.d(TAG, ">> URL: " + url + " >> Tamany: " + conn.getContentLength() + " bytes");
84 String inputLine; 83 String inputLine;
85 while ((inputLine = in.readLine()) != null) { 84 while ((inputLine = in.readLine()) != null) {
86 //Log.d(TAG, inputLine); 85 //Log.d(TAG, inputLine);
src/com/upc/pbe/upcnews/Directoris.java
@@ -10,27 +10,32 @@ import android.widget.TextView; @@ -10,27 +10,32 @@ import android.widget.TextView;
10 public class Directoris extends Activity { 10 public class Directoris extends Activity {
11 11
12 final static String TAG = "Directoris"; 12 final static String TAG = "Directoris";
13 - 13 +
  14 + TextView title;
14 TextView textout; 15 TextView textout;
15 String s; 16 String s;
16 17
17 public void onCreate(Bundle savedInstanceState) { 18 public void onCreate(Bundle savedInstanceState) {
18 - 19 + Log.d(TAG, "onCreated");
  20 +
19 super.onCreate(savedInstanceState); 21 super.onCreate(savedInstanceState);
20 setContentView(R.layout.dirs); 22 setContentView(R.layout.dirs);
21 23
22 textout = (TextView) findViewById(R.id.text_out); 24 textout = (TextView) findViewById(R.id.text_out);
  25 + title = (TextView) findViewById(R.id.textViewTitle);
  26 +
  27 + title.setText("Server --> " + ((UpcApp) getApplication()).getUrl());
23 28
24 s = ((UpcApp) getApplication()).getDesc(); 29 s = ((UpcApp) getApplication()).getDesc();
25 HTMLParser pars = new HTMLParser((String) s); 30 HTMLParser pars = new HTMLParser((String) s);
26 ArrayList<String> dirs = pars.parse(); 31 ArrayList<String> dirs = pars.parse();
27 32
28 for (int i = 0; i < dirs.size(); i++) { 33 for (int i = 0; i < dirs.size(); i++) {
29 -  
30 - Log.d(TAG, "Directori " +i);  
31 - textout.append(String.format("\nDirectori: %s\n",dirs.get(i).toString())); 34 +
  35 + Log.d(TAG, "Directori " + i);
  36 + textout.append(String.format("\nDirectori: %s\n", dirs.get(i)
  37 + .toString()));
32 } 38 }
33 39
34 } 40 }
35 -  
36 } 41 }
src/com/upc/pbe/upcnews/MainActivity.java
@@ -37,6 +37,7 @@ public class MainActivity extends Activity implements OnClickListener { @@ -37,6 +37,7 @@ public class MainActivity extends Activity implements OnClickListener {
37 37
38 public boolean onCreateOptionsMenu(Menu menu) { 38 public boolean onCreateOptionsMenu(Menu menu) {
39 getMenuInflater().inflate(R.menu.menu, menu); 39 getMenuInflater().inflate(R.menu.menu, menu);
  40 + Log.d(TAG, "Menu");
40 return true; 41 return true;
41 } 42 }
42 43
@@ -50,7 +51,7 @@ public class MainActivity extends Activity implements OnClickListener { @@ -50,7 +51,7 @@ public class MainActivity extends Activity implements OnClickListener {
50 51
51 Log.d(TAG, "onClicked"); 52 Log.d(TAG, "onClicked");
52 this.descarregar(); 53 this.descarregar();
53 - ((UpcApp)getApplication()).setDesc(html); 54 + ((UpcApp) getApplication()).setDesc(html);
54 startActivity(new Intent(this, Directoris.class)); 55 startActivity(new Intent(this, Directoris.class));
55 56
56 } 57 }
@@ -59,13 +60,7 @@ public class MainActivity extends Activity implements OnClickListener { @@ -59,13 +60,7 @@ public class MainActivity extends Activity implements OnClickListener {
59 Descarrega d = new Descarrega(this.getUrl(), file, folder); 60 Descarrega d = new Descarrega(this.getUrl(), file, folder);
60 Toast.makeText(this, "Download succesfull", Toast.LENGTH_LONG).show(); 61 Toast.makeText(this, "Download succesfull", Toast.LENGTH_LONG).show();
61 html = (String) d.doInBackground(); 62 html = (String) d.doInBackground();
62 -  
63 - //HTMLParser pars = new HTMLParser((String) html);  
64 - //ArrayList<String> dirs = pars.parse();  
65 -  
66 - //showText.setText(dirs.toString());  
67 -  
68 - 63 +
69 } 64 }
70 65
71 public boolean onOptionsItemSelected(MenuItem item) { 66 public boolean onOptionsItemSelected(MenuItem item) {
@@ -76,6 +71,7 @@ public class MainActivity extends Activity implements OnClickListener { @@ -76,6 +71,7 @@ public class MainActivity extends Activity implements OnClickListener {
76 return true; 71 return true;
77 case R.id.itemhelp: 72 case R.id.itemhelp:
78 startActivity(new Intent(this, Help.class)); 73 startActivity(new Intent(this, Help.class));
  74 + Log.d(TAG, "Help");
79 return true; 75 return true;
80 default: 76 default:
81 return false; 77 return false;
src/com/upc/pbe/upcnews/Prefs.java
@@ -2,11 +2,15 @@ package com.upc.pbe.upcnews; @@ -2,11 +2,15 @@ package com.upc.pbe.upcnews;
2 2
3 import android.os.Bundle; 3 import android.os.Bundle;
4 import android.preference.PreferenceActivity; 4 import android.preference.PreferenceActivity;
  5 +import android.util.Log;
5 6
6 public class Prefs extends PreferenceActivity { 7 public class Prefs extends PreferenceActivity {
7 8
  9 + final static String TAG = "Preferences";
  10 +
8 @Override 11 @Override
9 protected void onCreate(Bundle savedInstanceState) { 12 protected void onCreate(Bundle savedInstanceState) {
  13 + Log.d(TAG, "onCreated");
10 super.onCreate(savedInstanceState); 14 super.onCreate(savedInstanceState);
11 addPreferencesFromResource(R.xml.prefs); 15 addPreferencesFromResource(R.xml.prefs);
12 } 16 }
src/com/upc/pbe/upcnews/UpcApp.java
@@ -16,7 +16,7 @@ public class UpcApp extends Application implements OnSharedPreferenceChangeListe @@ -16,7 +16,7 @@ public class UpcApp extends Application implements OnSharedPreferenceChangeListe
16 String desc; 16 String desc;
17 17
18 public String getUrl() { 18 public String getUrl() {
19 - url = "http://" + prefs.getString("s", defaultUrl); 19 + url = "http://" + prefs.getString("server", defaultUrl);
20 return url; 20 return url;
21 } 21 }
22 22