WeatherInformation: working on preferences activity.
authorgu.martinm@gmail.com <gu.martinm@gmail.com>
Mon, 31 Mar 2014 16:16:01 +0000 (18:16 +0200)
committergu.martinm@gmail.com <gu.martinm@gmail.com>
Mon, 31 Mar 2014 16:16:01 +0000 (18:16 +0200)
Android/WeatherInformation/AndroidManifest.xml
Android/WeatherInformation/res/drawable-hdpi/ic_menu_settings_holo_light.png [new file with mode: 0644]
Android/WeatherInformation/res/menu/weather_main_menu.xml [new file with mode: 0644]
Android/WeatherInformation/res/values-v11/styles.xml
Android/WeatherInformation/res/values-v14/styles.xml
Android/WeatherInformation/res/values/strings.xml
Android/WeatherInformation/res/values/styles.xml
Android/WeatherInformation/src/de/example/exampletdd/WeatherInformationActivity.java
Android/WeatherInformation/tests/gen/de/example/exampletdd/test/BuildConfig.java [new file with mode: 0644]
Android/WeatherInformation/tests/gen/de/example/exampletdd/test/R.java [new file with mode: 0644]

index c568896..2a24350 100644 (file)
         android:allowBackup="true"
         android:icon="@drawable/ic_launcher"
         android:label="@string/app_name"
-        android:theme="@android:style/Theme.Holo" >
+        android:theme="@style/AppTheme" >
         <activity
             android:name="de.example.exampletdd.WeatherInformationActivity"
-            android:label="@string/app_name" >
+            android:uiOptions="splitActionBarWhenNarrow"
+            android:label="@string/app_name"
+            android:hardwareAccelerated="false">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
diff --git a/Android/WeatherInformation/res/drawable-hdpi/ic_menu_settings_holo_light.png b/Android/WeatherInformation/res/drawable-hdpi/ic_menu_settings_holo_light.png
new file mode 100644 (file)
index 0000000..577e055
Binary files /dev/null and b/Android/WeatherInformation/res/drawable-hdpi/ic_menu_settings_holo_light.png differ
diff --git a/Android/WeatherInformation/res/menu/weather_main_menu.xml b/Android/WeatherInformation/res/menu/weather_main_menu.xml
new file mode 100644 (file)
index 0000000..de8a451
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item
+        android:id="@+id/weather_menu_settings"
+        android:menuCategory="system"
+        android:title="@string/action_settings"
+        android:titleCondensed="@string/action_settings"
+        android:checked="false"
+        android:visible="true"
+        android:checkable="false"
+        android:enabled="true"
+        android:onClick="onMenuSettings"
+        android:showAsAction="ifRoom|withText">
+    </item>
+    
+
+</menu>
index 3c02242..4460dcf 100644 (file)
@@ -4,7 +4,7 @@
         Base application theme for API 11+. This theme completely replaces
         AppBaseTheme from res/values/styles.xml on API 11+ devices.
     -->
-    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+    <style name="AppBaseTheme" parent="android:Theme.Holo">
         <!-- API 11 theme customizations can go here. -->
     </style>
 
index a91fd03..3e61a52 100644 (file)
@@ -5,7 +5,7 @@
         AppBaseTheme from BOTH res/values/styles.xml and
         res/values-v11/styles.xml on API 14+ devices.
     -->
-    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+    <style name="AppBaseTheme" parent="android:Theme.Holo">
         <!-- API 14 theme customizations can go here. -->
     </style>
 
index 56a3a09..27fe592 100644 (file)
@@ -22,5 +22,6 @@
     <string name="error_dialog_connection_tiemout">Connection error timeout</string>
     <string name="error_dialog_generic_error">Impossible to receive weather data.</string>
     <string name="icon_weather_description">Icon weather</string>
+    <string name="header_action_bar">Weather Information</string>
 
 </resources>
index 6ce89c7..a2374b4 100644 (file)
@@ -4,7 +4,7 @@
         Base application theme, dependent on API level. This theme is replaced
         by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
     -->
-    <style name="AppBaseTheme" parent="android:Theme.Light">
+    <style name="AppBaseTheme" parent="android:Theme.Holo">
         <!--
             Theme customizations available in newer API levels can go in
             res/values-vXX/styles.xml, while customizations related to
index f785e3f..569c903 100644 (file)
@@ -1,7 +1,10 @@
 package de.example.exampletdd;
 
+import android.app.ActionBar;
 import android.app.Activity;
 import android.app.DialogFragment;
+import android.content.ComponentName;
+import android.content.Intent;
 import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuItem;
@@ -18,6 +21,12 @@ public class WeatherInformationActivity extends Activity implements ErrorMessage
     protected void onCreate(final Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         this.setContentView(R.layout.activity_main);
+        
+        final ActionBar actionBar = getActionBar();
+
+        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
+        actionBar.setTitle(getResources().getString(R.string.header_action_bar));
 
         // Better using xml files.
         // final WeatherDataFragment weatherDataFragment = new WeatherDataFragment();
@@ -45,10 +54,18 @@ public class WeatherInformationActivity extends Activity implements ErrorMessage
         // Handle action bar item clicks here. The action bar will
         // automatically handle clicks on the Home/Up button, so long
         // as you specify a parent activity in AndroidManifest.xml.
-        final int id = item.getItemId();
-        if (id == R.id.action_settings) {
-            return true;
+        super.onOptionsItemSelected(item);
+        switch (item.getItemId()) {
+            case R.id.weather_menu_settings:
+                final Intent intent = new Intent("de.example.exampletdd.WEATHERINFO").
+                setComponent(new ComponentName("de.example.exampletdd",
+                        "de.example.exampletdd.WeatherInformationSettings"));
+                this.startActivity(intent);
+                return true;
+            default:
+                break;
         }
+
         return super.onOptionsItemSelected(item);
     }
 
diff --git a/Android/WeatherInformation/tests/gen/de/example/exampletdd/test/BuildConfig.java b/Android/WeatherInformation/tests/gen/de/example/exampletdd/test/BuildConfig.java
new file mode 100644 (file)
index 0000000..4da8fd7
--- /dev/null
@@ -0,0 +1,6 @@
+/** Automatically generated file. DO NOT MODIFY */
+package de.example.exampletdd.test;
+
+public final class BuildConfig {
+    public final static boolean DEBUG = true;
+}
\ No newline at end of file
diff --git a/Android/WeatherInformation/tests/gen/de/example/exampletdd/test/R.java b/Android/WeatherInformation/tests/gen/de/example/exampletdd/test/R.java
new file mode 100644 (file)
index 0000000..e4a8d5e
--- /dev/null
@@ -0,0 +1,19 @@
+/* AUTO-GENERATED FILE.  DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found.  It
+ * should not be modified by hand.
+ */
+
+package de.example.exampletdd.test;
+
+public final class R {
+    public static final class attr {
+    }
+    public static final class drawable {
+        public static final int ic_launcher=0x7f020000;
+    }
+    public static final class string {
+        public static final int app_name=0x7f030000;
+    }
+}