Commit c385a99a3968e495249089ad387651acf450eb3d

Authored by Imanol-Mikel Barba Sabariego
1 parent 9e63fae1

--no commit message

src/com/upc/pbe/upcnews/Directoris.java
@@ -8,6 +8,8 @@ import android.content.Intent; @@ -8,6 +8,8 @@ import android.content.Intent;
8 import android.os.Bundle; 8 import android.os.Bundle;
9 import android.util.Log; 9 import android.util.Log;
10 import android.view.KeyEvent; 10 import android.view.KeyEvent;
  11 +import android.view.Menu;
  12 +import android.view.MenuItem;
11 import android.view.View; 13 import android.view.View;
12 import android.widget.AdapterView; 14 import android.widget.AdapterView;
13 import android.widget.ListView; 15 import android.widget.ListView;
@@ -131,4 +133,27 @@ public class Directoris extends Activity implements OnItemClickListener { @@ -131,4 +133,27 @@ public class Directoris extends Activity implements OnItemClickListener {
131 } 133 }
132 return super.onKeyDown(keyCode, event); 134 return super.onKeyDown(keyCode, event);
133 } 135 }
  136 +
  137 + public boolean onCreateOptionsMenu(Menu menu) {
  138 + //Determina el funcionament al apretar la tecla d'opcions
  139 + getMenuInflater().inflate(R.menu.menu, menu);
  140 + Log.d(TAG, "Menu");
  141 + return true;
  142 + }
  143 +
  144 + public boolean onOptionsItemSelected(MenuItem item) {
  145 + //Determina el funcionament al clickar en el menu d'opcions
  146 + switch (item.getItemId()) {
  147 + case R.id.itemprefs:
  148 + startActivity(new Intent(this, Prefs.class));
  149 + Log.d(TAG, "Preferencies");
  150 + return true;
  151 + case R.id.itemhelp:
  152 + startActivity(new Intent(this, Help.class));
  153 + Log.d(TAG, "Help");
  154 + return true;
  155 + default:
  156 + return false;
  157 + }
  158 + }
134 } 159 }
135 \ No newline at end of file 160 \ No newline at end of file
src/com/upc/pbe/upcnews/Help.java
1 package com.upc.pbe.upcnews; 1 package com.upc.pbe.upcnews;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
  4 +import android.content.Intent;
4 import android.os.Bundle; 5 import android.os.Bundle;
5 import android.util.Log; 6 import android.util.Log;
  7 +import android.view.Menu;
  8 +import android.view.MenuItem;
6 9
7 //Menu Help 10 //Menu Help
8 public class Help extends Activity{ 11 public class Help extends Activity{
@@ -18,4 +21,25 @@ public class Help extends Activity{ @@ -18,4 +21,25 @@ public class Help extends Activity{
18 Log.d(TAG, "onStopped"); 21 Log.d(TAG, "onStopped");
19 super.onStop(); 22 super.onStop();
20 } 23 }
  24 +
  25 + public boolean onCreateOptionsMenu(Menu menu) {
  26 + //Determina el funcionament al apretar la tecla d'opcions
  27 + getMenuInflater().inflate(R.menu.menu, menu);
  28 + Log.d(TAG, "Menu");
  29 + return true;
  30 + }
  31 +
  32 + public boolean onOptionsItemSelected(MenuItem item) {
  33 + //Determina el funcionament al clickar en el menu d'opcions
  34 + switch (item.getItemId()) {
  35 + case R.id.itemprefs:
  36 + startActivity(new Intent(this, Prefs.class));
  37 + Log.d(TAG, "Preferencies");
  38 + return true;
  39 + case R.id.itemhelp:
  40 + return true;
  41 + default:
  42 + return false;
  43 + }
  44 + }
21 } 45 }
src/com/upc/pbe/upcnews/MainActivity.java
@@ -105,7 +105,7 @@ public class MainActivity extends Activity implements OnClickListener { @@ -105,7 +105,7 @@ public class MainActivity extends Activity implements OnClickListener {
105 * (SEVERE) Crash preferences (Me sigue saliendo O.o) 105 * (SEVERE) Crash preferences (Me sigue saliendo O.o)
106 * (NORMAL) Poner la defaultURL al server de PBE 106 * (NORMAL) Poner la defaultURL al server de PBE
107 * (WISHLIST) Descarga en segundo plano (Mejora dificil) 107 * (WISHLIST) Descarga en segundo plano (Mejora dificil)
108 - * (WISHLIST) A�adir gif Imanol bailando (Easter eggs? váis en serio? XDDDDDDDDDDDD) 108 + * (WISHLIST) Añadir gif Imanol bailando (Easter eggs? vais en serio? XDDDDDDDDDDDD)
109 * Borrar esta puta mierda 109 * Borrar esta puta mierda
110 */ 110 */
111 } 111 }
src/com/upc/pbe/upcnews/Prefs.java
1 package com.upc.pbe.upcnews; 1 package com.upc.pbe.upcnews;
2 2
  3 +import android.content.Intent;
3 import android.os.Bundle; 4 import android.os.Bundle;
4 import android.preference.PreferenceActivity; 5 import android.preference.PreferenceActivity;
5 import android.util.Log; 6 import android.util.Log;
6 import android.view.Menu; 7 import android.view.Menu;
  8 +import android.view.MenuItem;
7 9
8 //Menu de preferencies 10 //Menu de preferencies
9 public class Prefs extends PreferenceActivity { 11 public class Prefs extends PreferenceActivity {
@@ -19,7 +21,25 @@ public class Prefs extends PreferenceActivity { @@ -19,7 +21,25 @@ public class Prefs extends PreferenceActivity {
19 21
20 @Override 22 @Override
21 public boolean onCreateOptionsMenu(Menu menu) { 23 public boolean onCreateOptionsMenu(Menu menu) {
22 - return false; 24 + //Determina el funcionament al apretar la tecla d'opcions
  25 + getMenuInflater().inflate(R.menu.menu, menu);
  26 + Log.d(TAG, "Menu");
  27 + return true;
  28 + }
  29 +
  30 + @Override
  31 + public boolean onOptionsItemSelected(MenuItem item) {
  32 + //Determina el funcionament al clickar en el menu d'opcions
  33 + switch (item.getItemId()) {
  34 + case R.id.itemprefs:
  35 + return true;
  36 + case R.id.itemhelp:
  37 + startActivity(new Intent(this, Help.class));
  38 + Log.d(TAG, "Help");
  39 + return true;
  40 + default:
  41 + return false;
  42 + }
23 } 43 }
24 44
25 } 45 }
26 \ No newline at end of file 46 \ No newline at end of file