Commit 74eea6c1e5184ac05b2e93a7ebb0110eec5607c1
1 parent
4a7af269
--no commit message
Showing
9 changed files
with
34 additions
and
55 deletions
gen/com/upc/pbe/upcnews/R.java
... | ... | @@ -16,24 +16,23 @@ public final class R { |
16 | 16 | } |
17 | 17 | public static final class id { |
18 | 18 | public static final int AbsoluteLayout1=0x7f080005; |
19 | - public static final int LinearLayout1=0x7f080003; | |
19 | + public static final int LinearLayout1=0x7f080002; | |
20 | 20 | public static final int button=0x7f080008; |
21 | - public static final int buttonPlay=0x7f080000; | |
22 | 21 | public static final int imageView1=0x7f080009; |
23 | 22 | public static final int itemhelp=0x7f08000c; |
24 | 23 | public static final int itemprefs=0x7f08000b; |
25 | 24 | public static final int menu_settings=0x7f08000a; |
26 | - public static final int textView1=0x7f080001; | |
25 | + public static final int textView1=0x7f080003; | |
27 | 26 | public static final int textView2=0x7f080004; |
28 | 27 | public static final int textViewRoute=0x7f080007; |
28 | + public static final int textViewTitle=0x7f080000; | |
29 | 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 | 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 | 37 | public static final class menu { |
39 | 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 | 0 | \ No newline at end of file |
res/layout/dirs.xml
... | ... | @@ -5,13 +5,14 @@ |
5 | 5 | android:orientation="vertical" > |
6 | 6 | |
7 | 7 | <TextView |
8 | - android:id="@+id/textView1" | |
8 | + android:id="@+id/textViewTitle" | |
9 | 9 | android:layout_width="wrap_content" |
10 | 10 | android:layout_height="wrap_content" |
11 | - android:layout_gravity="center" | |
12 | - android:text="@string/directoris" | |
11 | + android:layout_gravity="right" | |
13 | 12 | android:textAppearance="?android:attr/textAppearanceLarge" /> |
14 | 13 | |
14 | + <!-- Vista en llista --> | |
15 | + | |
15 | 16 | <ScrollView |
16 | 17 | android:layout_width="match_parent" |
17 | 18 | android:layout_height="match_parent" > |
... | ... | @@ -20,6 +21,7 @@ |
20 | 21 | android:id="@+id/text_out" |
21 | 22 | android:layout_width="match_parent" |
22 | 23 | android:layout_height="wrap_content" |
24 | + android:layout_gravity="right" | |
23 | 25 | android:textAppearance="?android:attr/textAppearanceMedium" /> |
24 | 26 | </ScrollView> |
25 | 27 | ... | ... |
res/xml/prefs.xml
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 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 | 6 | </PreferenceScreen> |
7 | 7 | \ No newline at end of file | ... | ... |
src/com/upc/pbe/upcnews/Descarrega.java
... | ... | @@ -79,8 +79,7 @@ public class Descarrega extends AsyncTask<Object, Object, Object>{ |
79 | 79 | BufferedReader in = new BufferedReader(new InputStreamReader( |
80 | 80 | conn.getInputStream())); |
81 | 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 | 83 | String inputLine; |
85 | 84 | while ((inputLine = in.readLine()) != null) { |
86 | 85 | //Log.d(TAG, inputLine); | ... | ... |
src/com/upc/pbe/upcnews/Directoris.java
... | ... | @@ -10,27 +10,32 @@ import android.widget.TextView; |
10 | 10 | public class Directoris extends Activity { |
11 | 11 | |
12 | 12 | final static String TAG = "Directoris"; |
13 | - | |
13 | + | |
14 | + TextView title; | |
14 | 15 | TextView textout; |
15 | 16 | String s; |
16 | 17 | |
17 | 18 | public void onCreate(Bundle savedInstanceState) { |
18 | - | |
19 | + Log.d(TAG, "onCreated"); | |
20 | + | |
19 | 21 | super.onCreate(savedInstanceState); |
20 | 22 | setContentView(R.layout.dirs); |
21 | 23 | |
22 | 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 | 29 | s = ((UpcApp) getApplication()).getDesc(); |
25 | 30 | HTMLParser pars = new HTMLParser((String) s); |
26 | 31 | ArrayList<String> dirs = pars.parse(); |
27 | 32 | |
28 | 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 | 37 | |
38 | 38 | public boolean onCreateOptionsMenu(Menu menu) { |
39 | 39 | getMenuInflater().inflate(R.menu.menu, menu); |
40 | + Log.d(TAG, "Menu"); | |
40 | 41 | return true; |
41 | 42 | } |
42 | 43 | |
... | ... | @@ -50,7 +51,7 @@ public class MainActivity extends Activity implements OnClickListener { |
50 | 51 | |
51 | 52 | Log.d(TAG, "onClicked"); |
52 | 53 | this.descarregar(); |
53 | - ((UpcApp)getApplication()).setDesc(html); | |
54 | + ((UpcApp) getApplication()).setDesc(html); | |
54 | 55 | startActivity(new Intent(this, Directoris.class)); |
55 | 56 | |
56 | 57 | } |
... | ... | @@ -59,13 +60,7 @@ public class MainActivity extends Activity implements OnClickListener { |
59 | 60 | Descarrega d = new Descarrega(this.getUrl(), file, folder); |
60 | 61 | Toast.makeText(this, "Download succesfull", Toast.LENGTH_LONG).show(); |
61 | 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 | 66 | public boolean onOptionsItemSelected(MenuItem item) { |
... | ... | @@ -76,6 +71,7 @@ public class MainActivity extends Activity implements OnClickListener { |
76 | 71 | return true; |
77 | 72 | case R.id.itemhelp: |
78 | 73 | startActivity(new Intent(this, Help.class)); |
74 | + Log.d(TAG, "Help"); | |
79 | 75 | return true; |
80 | 76 | default: |
81 | 77 | return false; | ... | ... |
src/com/upc/pbe/upcnews/Prefs.java
... | ... | @@ -2,11 +2,15 @@ package com.upc.pbe.upcnews; |
2 | 2 | |
3 | 3 | import android.os.Bundle; |
4 | 4 | import android.preference.PreferenceActivity; |
5 | +import android.util.Log; | |
5 | 6 | |
6 | 7 | public class Prefs extends PreferenceActivity { |
7 | 8 | |
9 | + final static String TAG = "Preferences"; | |
10 | + | |
8 | 11 | @Override |
9 | 12 | protected void onCreate(Bundle savedInstanceState) { |
13 | + Log.d(TAG, "onCreated"); | |
10 | 14 | super.onCreate(savedInstanceState); |
11 | 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 | 16 | String desc; |
17 | 17 | |
18 | 18 | public String getUrl() { |
19 | - url = "http://" + prefs.getString("s", defaultUrl); | |
19 | + url = "http://" + prefs.getString("server", defaultUrl); | |
20 | 20 | return url; |
21 | 21 | } |
22 | 22 | ... | ... |