From 2822a5ee12f05dbd3de8c6d7d58cd5a78d390558 Mon Sep 17 00:00:00 2001 From: Equip de Desenvolupadors de PBE Date: Mon, 10 Dec 2012 11:17:15 +0000 Subject: [PATCH] --- src/com/upc/pbe/upcnews/MainActivity.java | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/com/upc/pbe/upcnews/MainActivity.java b/src/com/upc/pbe/upcnews/MainActivity.java index ca5e252..176be01 100644 --- a/src/com/upc/pbe/upcnews/MainActivity.java +++ b/src/com/upc/pbe/upcnews/MainActivity.java @@ -32,8 +32,7 @@ public class MainActivity extends Activity implements OnClickListener { Log.d(TAG, "onCreated"); //Especifiquem la ruta de descarrega File tempFolder = new File(((UpcApp)getApplication()).getLocalPath()); - if(tempFolder.mkdirs()) - { + if(tempFolder.mkdirs()) { Log.d(TAG,"Directory " + tempFolder.toString() + " created"); } //Creem els botons i text @@ -47,8 +46,7 @@ public class MainActivity extends Activity implements OnClickListener { //Al polsar el boto s'inicia la descarrega Log.d(TAG, "onClicked"); this.descarregar(); - if(!html.equals("EMPTY")) - { + if(!html.equals("EMPTY")) { ((UpcApp) getApplication()).setDesc(html); startActivity(new Intent(this, Directoris.class)); } @@ -59,26 +57,23 @@ public class MainActivity extends Activity implements OnClickListener { //Si hi ha errors, els mostrem en Toasts Descarrega d = new Descarrega(); html="EMPTY"; - try - { + try { html = (String) d.doInBackground(((UpcApp)getApplication()).getUrl()); } - catch(MalformedURLException e) - { + catch(MalformedURLException e) { Toast.makeText(this, "Invalid URL", Toast.LENGTH_LONG).show(); } - catch(IOException e) - { + catch(IOException e) { Toast.makeText(this, "Can't find URL", Toast.LENGTH_LONG).show(); } } - public void onResume(){ + public void onResume() { super.onResume(); updateURL(); } - public void updateURL(){ + public void updateURL() { URLText.setText(((UpcApp)getApplication()).getUrl()); } @@ -92,16 +87,16 @@ public class MainActivity extends Activity implements OnClickListener { public boolean onOptionsItemSelected(MenuItem item) { //Determina el funcionament al clickar en el menu d'opcions switch (item.getItemId()) { - case R.id.itemprefs: - startActivity(new Intent(this, Prefs.class)); - Log.d(TAG, "Preferences"); - return true; - case R.id.itemhelp: - startActivity(new Intent(this, Help.class)); - Log.d(TAG, "Help"); - return true; - default: - return false; + case R.id.itemprefs: + startActivity(new Intent(this, Prefs.class)); + Log.d(TAG, "Preferences"); + return true; + case R.id.itemhelp: + startActivity(new Intent(this, Help.class)); + Log.d(TAG, "Help"); + return true; + default: + return false; } } /* -- libgit2 0.22.2