diff --git a/src/com/upc/pbe/upcnews/Directoris.java b/src/com/upc/pbe/upcnews/Directoris.java index a63f585..c112a70 100644 --- a/src/com/upc/pbe/upcnews/Directoris.java +++ b/src/com/upc/pbe/upcnews/Directoris.java @@ -8,6 +8,8 @@ import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; @@ -131,4 +133,27 @@ public class Directoris extends Activity implements OnItemClickListener { } return super.onKeyDown(keyCode, event); } + + public boolean onCreateOptionsMenu(Menu menu) { + //Determina el funcionament al apretar la tecla d'opcions + getMenuInflater().inflate(R.menu.menu, menu); + Log.d(TAG, "Menu"); + return true; + } + + 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, "Preferencies"); + return true; + case R.id.itemhelp: + startActivity(new Intent(this, Help.class)); + Log.d(TAG, "Help"); + return true; + default: + return false; + } + } } \ No newline at end of file diff --git a/src/com/upc/pbe/upcnews/Help.java b/src/com/upc/pbe/upcnews/Help.java index ca2eaf1..e434584 100644 --- a/src/com/upc/pbe/upcnews/Help.java +++ b/src/com/upc/pbe/upcnews/Help.java @@ -1,8 +1,11 @@ package com.upc.pbe.upcnews; import android.app.Activity; +import android.content.Intent; import android.os.Bundle; import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; //Menu Help public class Help extends Activity{ @@ -18,4 +21,25 @@ public class Help extends Activity{ Log.d(TAG, "onStopped"); super.onStop(); } + + public boolean onCreateOptionsMenu(Menu menu) { + //Determina el funcionament al apretar la tecla d'opcions + getMenuInflater().inflate(R.menu.menu, menu); + Log.d(TAG, "Menu"); + return true; + } + + 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, "Preferencies"); + return true; + case R.id.itemhelp: + return true; + default: + return false; + } + } } diff --git a/src/com/upc/pbe/upcnews/MainActivity.java b/src/com/upc/pbe/upcnews/MainActivity.java index 9dd4658..befbabc 100644 --- a/src/com/upc/pbe/upcnews/MainActivity.java +++ b/src/com/upc/pbe/upcnews/MainActivity.java @@ -105,7 +105,7 @@ public class MainActivity extends Activity implements OnClickListener { * (SEVERE) Crash preferences (Me sigue saliendo O.o) * (NORMAL) Poner la defaultURL al server de PBE * (WISHLIST) Descarga en segundo plano (Mejora dificil) - * (WISHLIST) A�adir gif Imanol bailando (Easter eggs? váis en serio? XDDDDDDDDDDDD) + * (WISHLIST) Añadir gif Imanol bailando (Easter eggs? vais en serio? XDDDDDDDDDDDD) * Borrar esta puta mierda */ } diff --git a/src/com/upc/pbe/upcnews/Prefs.java b/src/com/upc/pbe/upcnews/Prefs.java index f489524..a33b207 100644 --- a/src/com/upc/pbe/upcnews/Prefs.java +++ b/src/com/upc/pbe/upcnews/Prefs.java @@ -1,9 +1,11 @@ package com.upc.pbe.upcnews; +import android.content.Intent; import android.os.Bundle; import android.preference.PreferenceActivity; import android.util.Log; import android.view.Menu; +import android.view.MenuItem; //Menu de preferencies public class Prefs extends PreferenceActivity { @@ -19,7 +21,25 @@ public class Prefs extends PreferenceActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { - return false; + //Determina el funcionament al apretar la tecla d'opcions + getMenuInflater().inflate(R.menu.menu, menu); + Log.d(TAG, "Menu"); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + //Determina el funcionament al clickar en el menu d'opcions + switch (item.getItemId()) { + case R.id.itemprefs: + return true; + case R.id.itemhelp: + startActivity(new Intent(this, Help.class)); + Log.d(TAG, "Help"); + return true; + default: + return false; + } } } \ No newline at end of file