Commit 2822a5ee12f05dbd3de8c6d7d58cd5a78d390558
1 parent
0ddda711
--no commit message
Showing
1 changed file
with
17 additions
and
22 deletions
src/com/upc/pbe/upcnews/MainActivity.java
... | ... | @@ -32,8 +32,7 @@ public class MainActivity extends Activity implements OnClickListener { |
32 | 32 | Log.d(TAG, "onCreated"); |
33 | 33 | //Especifiquem la ruta de descarrega |
34 | 34 | File tempFolder = new File(((UpcApp)getApplication()).getLocalPath()); |
35 | - if(tempFolder.mkdirs()) | |
36 | - { | |
35 | + if(tempFolder.mkdirs()) { | |
37 | 36 | Log.d(TAG,"Directory " + tempFolder.toString() + " created"); |
38 | 37 | } |
39 | 38 | //Creem els botons i text |
... | ... | @@ -47,8 +46,7 @@ public class MainActivity extends Activity implements OnClickListener { |
47 | 46 | //Al polsar el boto s'inicia la descarrega |
48 | 47 | Log.d(TAG, "onClicked"); |
49 | 48 | this.descarregar(); |
50 | - if(!html.equals("EMPTY")) | |
51 | - { | |
49 | + if(!html.equals("EMPTY")) { | |
52 | 50 | ((UpcApp) getApplication()).setDesc(html); |
53 | 51 | startActivity(new Intent(this, Directoris.class)); |
54 | 52 | } |
... | ... | @@ -59,26 +57,23 @@ public class MainActivity extends Activity implements OnClickListener { |
59 | 57 | //Si hi ha errors, els mostrem en Toasts |
60 | 58 | Descarrega d = new Descarrega(); |
61 | 59 | html="EMPTY"; |
62 | - try | |
63 | - { | |
60 | + try { | |
64 | 61 | html = (String) d.doInBackground(((UpcApp)getApplication()).getUrl()); |
65 | 62 | } |
66 | - catch(MalformedURLException e) | |
67 | - { | |
63 | + catch(MalformedURLException e) { | |
68 | 64 | Toast.makeText(this, "Invalid URL", Toast.LENGTH_LONG).show(); |
69 | 65 | } |
70 | - catch(IOException e) | |
71 | - { | |
66 | + catch(IOException e) { | |
72 | 67 | Toast.makeText(this, "Can't find URL", Toast.LENGTH_LONG).show(); |
73 | 68 | } |
74 | 69 | } |
75 | 70 | |
76 | - public void onResume(){ | |
71 | + public void onResume() { | |
77 | 72 | super.onResume(); |
78 | 73 | updateURL(); |
79 | 74 | } |
80 | 75 | |
81 | - public void updateURL(){ | |
76 | + public void updateURL() { | |
82 | 77 | URLText.setText(((UpcApp)getApplication()).getUrl()); |
83 | 78 | } |
84 | 79 | |
... | ... | @@ -92,16 +87,16 @@ public class MainActivity extends Activity implements OnClickListener { |
92 | 87 | public boolean onOptionsItemSelected(MenuItem item) { |
93 | 88 | //Determina el funcionament al clickar en el menu d'opcions |
94 | 89 | switch (item.getItemId()) { |
95 | - case R.id.itemprefs: | |
96 | - startActivity(new Intent(this, Prefs.class)); | |
97 | - Log.d(TAG, "Preferences"); | |
98 | - return true; | |
99 | - case R.id.itemhelp: | |
100 | - startActivity(new Intent(this, Help.class)); | |
101 | - Log.d(TAG, "Help"); | |
102 | - return true; | |
103 | - default: | |
104 | - return false; | |
90 | + case R.id.itemprefs: | |
91 | + startActivity(new Intent(this, Prefs.class)); | |
92 | + Log.d(TAG, "Preferences"); | |
93 | + return true; | |
94 | + case R.id.itemhelp: | |
95 | + startActivity(new Intent(this, Help.class)); | |
96 | + Log.d(TAG, "Help"); | |
97 | + return true; | |
98 | + default: | |
99 | + return false; | |
105 | 100 | } |
106 | 101 | } |
107 | 102 | /* | ... | ... |