diff --git a/res/layout/help.xml b/res/layout/help.xml new file mode 100644 index 0000000..d3b3d8f --- /dev/null +++ b/res/layout/help.xml @@ -0,0 +1,24 @@ + + + + + + + + \ No newline at end of file diff --git a/res/menu/menu.xml b/res/menu/menu.xml new file mode 100644 index 0000000..7b42946 --- /dev/null +++ b/res/menu/menu.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/res/xml/prefs.xml b/res/xml/prefs.xml new file mode 100644 index 0000000..29c1127 --- /dev/null +++ b/res/xml/prefs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/com/upc/pbe/upcnews/Prefs.java b/src/com/upc/pbe/upcnews/Prefs.java new file mode 100644 index 0000000..264d0ed --- /dev/null +++ b/src/com/upc/pbe/upcnews/Prefs.java @@ -0,0 +1,14 @@ +package com.upc.pbe.upcnews; + +import android.os.Bundle; +import android.preference.PreferenceActivity; + +public class Prefs extends PreferenceActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.prefs); + } + +} \ No newline at end of file diff --git a/src/com/upc/pbe/upcnews/UpcApp.java b/src/com/upc/pbe/upcnews/UpcApp.java new file mode 100644 index 0000000..3569fb9 --- /dev/null +++ b/src/com/upc/pbe/upcnews/UpcApp.java @@ -0,0 +1,46 @@ +package com.upc.pbe.upcnews; + +import android.app.Application; +import android.content.SharedPreferences; +import android.content.SharedPreferences.OnSharedPreferenceChangeListener; +import android.preference.PreferenceManager; +import android.util.Log; + + +public class UpcApp extends Application implements OnSharedPreferenceChangeListener { + + final static String TAG = "Application"; + SharedPreferences prefs; + String defaultUrl = "10.0.2.100"; + String url = null; + + public String getUrl() { + url = "http://" + prefs.getString("s", defaultUrl); + return url; + } + + + public void onCreate() { + super.onCreate(); + + //Prefs + prefs = PreferenceManager.getDefaultSharedPreferences(this); + prefs.registerOnSharedPreferenceChangeListener(this); + this.getUrl(); + Log.d(TAG, "onCreated"); + } + + + + public SharedPreferences getPrefs() { + return prefs; + } + + + public void onSharedPreferenceChanged(SharedPreferences arg0, String key) { + + Log.d(TAG, "onSharedPreferenceChanged for key: " + key); + + } + +}