Commit 0ba605e6e26475194551d0aa2d0feb34fba90fce
1 parent
a3a97c8f
--no commit message
Showing
4 changed files
with
18 additions
and
31 deletions
src/com/upc/pbe/upcnews/Directoris.java
@@ -43,9 +43,7 @@ public class Directoris extends Activity implements OnClickListener { | @@ -43,9 +43,7 @@ public class Directoris extends Activity implements OnClickListener { | ||
43 | Log.d(TAG, "Directori " + dirs.get(i).toString()); | 43 | Log.d(TAG, "Directori " + dirs.get(i).toString()); |
44 | buttons.get(i).setVisibility(View.VISIBLE); | 44 | buttons.get(i).setVisibility(View.VISIBLE); |
45 | buttons.get(i).setText(dirs.get(i)); | 45 | buttons.get(i).setText(dirs.get(i)); |
46 | - | ||
47 | } | 46 | } |
48 | - | ||
49 | } | 47 | } |
50 | 48 | ||
51 | public boolean onCreateOptionsMenu(Menu menu) { | 49 | public boolean onCreateOptionsMenu(Menu menu) { |
@@ -70,37 +68,34 @@ public class Directoris extends Activity implements OnClickListener { | @@ -70,37 +68,34 @@ public class Directoris extends Activity implements OnClickListener { | ||
70 | } | 68 | } |
71 | 69 | ||
72 | public void onClick(View c) { | 70 | public void onClick(View c) { |
73 | - | ||
74 | switch (c.getId()) { | 71 | switch (c.getId()) { |
75 | - | ||
76 | - case R.id.button1: { | ||
77 | - this.buttonClicked(buttons.get(0)); | ||
78 | - break; | ||
79 | - | ||
80 | - } | ||
81 | - case R.id.button2: { | ||
82 | - this.buttonClicked(buttons.get(1)); | ||
83 | - break; | ||
84 | - } | ||
85 | - case R.id.button3: { | ||
86 | - this.buttonClicked(buttons.get(2)); | ||
87 | - break; | ||
88 | - } | ||
89 | - case R.id.button4: { | ||
90 | - this.buttonClicked(buttons.get(3)); | ||
91 | - break; | ||
92 | - } | 72 | + case R.id.button1: { |
73 | + this.buttonClicked(buttons.get(0)); | ||
74 | + break; | ||
75 | + | ||
76 | + } | ||
77 | + case R.id.button2: { | ||
78 | + this.buttonClicked(buttons.get(1)); | ||
79 | + break; | ||
80 | + } | ||
81 | + case R.id.button3: { | ||
82 | + this.buttonClicked(buttons.get(2)); | ||
83 | + break; | ||
84 | + } | ||
85 | + case R.id.button4: { | ||
86 | + this.buttonClicked(buttons.get(3)); | ||
87 | + break; | ||
88 | + } | ||
93 | } | 89 | } |
94 | } | 90 | } |
95 | 91 | ||
96 | public void crearButtons() { | 92 | public void crearButtons() { |
97 | - | ||
98 | buttons.add((Button) findViewById(R.id.button1)); | 93 | buttons.add((Button) findViewById(R.id.button1)); |
99 | buttons.add((Button) findViewById(R.id.button2)); | 94 | buttons.add((Button) findViewById(R.id.button2)); |
100 | buttons.add((Button) findViewById(R.id.button3)); | 95 | buttons.add((Button) findViewById(R.id.button3)); |
101 | buttons.add((Button) findViewById(R.id.button4)); | 96 | buttons.add((Button) findViewById(R.id.button4)); |
102 | buttons.add((Button) findViewById(R.id.button5)); | 97 | buttons.add((Button) findViewById(R.id.button5)); |
103 | - | 98 | + |
104 | for (int i = 0; i < buttons.size(); i++) { | 99 | for (int i = 0; i < buttons.size(); i++) { |
105 | buttons.get(i).setOnClickListener(this); | 100 | buttons.get(i).setOnClickListener(this); |
106 | buttons.get(i).setVisibility(View.GONE); | 101 | buttons.get(i).setVisibility(View.GONE); |
@@ -108,7 +103,6 @@ public class Directoris extends Activity implements OnClickListener { | @@ -108,7 +103,6 @@ public class Directoris extends Activity implements OnClickListener { | ||
108 | } | 103 | } |
109 | 104 | ||
110 | public void buttonClicked(Button b) { | 105 | public void buttonClicked(Button b) { |
111 | - | ||
112 | Log.d(TAG, "Click on " + b.getText()); | 106 | Log.d(TAG, "Click on " + b.getText()); |
113 | d = new Descarrega(url + "/" + b.getText() + "/", file, folder); | 107 | d = new Descarrega(url + "/" + b.getText() + "/", file, folder); |
114 | String str = d.doInBackground(); | 108 | String str = d.doInBackground(); |
src/com/upc/pbe/upcnews/HTMLParser.java
src/com/upc/pbe/upcnews/MainActivity.java
@@ -72,13 +72,9 @@ public class MainActivity extends Activity implements OnClickListener { | @@ -72,13 +72,9 @@ public class MainActivity extends Activity implements OnClickListener { | ||
72 | 72 | ||
73 | public void onClick(View v) { | 73 | public void onClick(View v) { |
74 | Log.d(TAG, "onClicked"); | 74 | Log.d(TAG, "onClicked"); |
75 | - | ||
76 | - | ||
77 | - | ||
78 | this.descarregar(); | 75 | this.descarregar(); |
79 | ((UpcApp) getApplication()).setDesc(html); | 76 | ((UpcApp) getApplication()).setDesc(html); |
80 | startActivity(new Intent(this, Directoris.class)); | 77 | startActivity(new Intent(this, Directoris.class)); |
81 | - | ||
82 | } | 78 | } |
83 | 79 | ||
84 | public void descarregar() { | 80 | public void descarregar() { |
@@ -101,5 +97,4 @@ public class MainActivity extends Activity implements OnClickListener { | @@ -101,5 +97,4 @@ public class MainActivity extends Activity implements OnClickListener { | ||
101 | return false; | 97 | return false; |
102 | } | 98 | } |
103 | } | 99 | } |
104 | - | ||
105 | } | 100 | } |
106 | \ No newline at end of file | 101 | \ No newline at end of file |
src/com/upc/pbe/upcnews/UpcApp.java
@@ -52,5 +52,4 @@ public class UpcApp extends Application implements OnSharedPreferenceChangeListe | @@ -52,5 +52,4 @@ public class UpcApp extends Application implements OnSharedPreferenceChangeListe | ||
52 | public String getDesc(){ | 52 | public String getDesc(){ |
53 | return desc; | 53 | return desc; |
54 | } | 54 | } |
55 | - | ||
56 | } | 55 | } |