WeatherInformation: About activity
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Mon, 3 Nov 2014 03:15:29 +0000 (04:15 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Mon, 3 Nov 2014 03:15:29 +0000 (04:15 +0100)
Android/WeatherInformation/app/src/main/AndroidManifest.xml
Android/WeatherInformation/app/src/main/java/de/example/exampletdd/AboutActivity.java [new file with mode: 0644]
Android/WeatherInformation/app/src/main/java/de/example/exampletdd/WeatherTabsActivity.java
Android/WeatherInformation/app/src/main/res/layout/weather_about.xml [new file with mode: 0644]
Android/WeatherInformation/app/src/main/res/menu/weather_main_menu.xml
Android/WeatherInformation/app/src/main/res/values/strings.xml
Android/WeatherInformation/app/src/main/res/values/styles.xml

index a628b0b..0cbe4d9 100644 (file)
     <uses-feature
         android:glEsVersion="0x00020000"
         android:required="true" />
-    
+
     <!-- TODO: http://developer.android.com/guide/topics/manifest/supports-screens-element.html -->
     <!-- TODO: supporting multiple layouts/languages http://developer.android.com/guide/practices/screens_support.html -->
     <compatible-screens>
-       <screen android:screenSize="normal" android:screenDensity="xhdpi" />
-       </compatible-screens>
+        <screen
+            android:screenDensity="xhdpi"
+            android:screenSize="normal" />
+    </compatible-screens>
+
     <supports-screens android:smallScreens="false" />
 
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
     <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
-    
-    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> 
-    
+    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+
     <application
         android:allowBackup="true"
         android:icon="@drawable/ic_launcher"
         android:label="@string/app_name"
         android:logo="@drawable/ic_launcher"
-        android:theme="@style/AppTheme"
-        android:supportsRtl="false">
-
-        <activity android:name="de.example.exampletdd.WeatherTabsActivity"
+        android:supportsRtl="false"
+        android:theme="@style/AppTheme" >
+        <activity
+            android:name=".WeatherTabsActivity"
             android:hardwareAccelerated="false"
-            android:uiOptions="splitActionBarWhenNarrow"
-            android:launchMode="singleTop" >
+            android:launchMode="singleTop"
+            android:uiOptions="splitActionBarWhenNarrow" >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
-        <activity android:name="de.example.exampletdd.WeatherInformationPreferencesActivity"
-            android:parentActivityName="de.example.exampletdd.WeatherTabsActivity" >
+        <activity
+            android:name=".WeatherInformationPreferencesActivity"
+            android:parentActivityName=".WeatherTabsActivity" >
             <intent-filter>
                 <action android:name="android.intent.action.WEATHERINFORMATIONSETTINGS" />
+
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
             <intent-filter>
-                               <action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
-                               <category android:name="android.intent.category.DEFAULT" />
+                <action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
+
+                <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
-        <activity android:name="de.example.exampletdd.MapActivity"
-            android:parentActivityName="de.example.exampletdd.WeatherTabsActivity" >
+        <activity
+            android:name=".MapActivity"
+            android:parentActivityName=".WeatherTabsActivity" >
             <intent-filter>
                 <action android:name="android.intent.action.WEATHERINFORMATIONMAP" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
-        <activity android:name="de.example.exampletdd.SpecificActivity"
-            android:parentActivityName="de.example.exampletdd.WeatherTabsActivity"
-            android:exported="false" >
+        <activity
+            android:name=".SpecificActivity"
+            android:exported="false"
+            android:parentActivityName=".WeatherTabsActivity" >
             <intent-filter>
                 <action android:name="android.intent.action.WEATHERINFORMATIONSPECIFICDATA" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
-        <activity android:name="de.example.exampletdd.widget.WidgetConfigure"
-            android:taskAffinity=""
-            android:excludeFromRecents="true">
+        <activity
+            android:name=".widget.WidgetConfigure"
+            android:excludeFromRecents="true"
+            android:taskAffinity="" >
+            <intent-filter>
+                <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
+            </intent-filter>
+        </activity>
+        <activity
+            android:name=".AboutActivity"
+            android:label="@string/title_activity_about"
+            android:parentActivityName=".WeatherTabsActivity" >
             <intent-filter>
-                <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
+                <action android:name="android.intent.action.WEATHERINFORMATIONABOUT" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
-        
-        <receiver android:name="de.example.exampletdd.WeatherInformationBootReceiver"
-            android:enabled="true">
+
+        <receiver
+            android:name=".WeatherInformationBootReceiver"
+            android:enabled="true" >
             <intent-filter>
-                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
+                <action android:name="android.intent.action.BOOT_COMPLETED" />
             </intent-filter>
         </receiver>
-        <receiver android:name="de.example.exampletdd.widget.WidgetProvider" >
+        <receiver android:name=".widget.WidgetProvider" >
             <intent-filter>
                 <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
             </intent-filter>
-            <meta-data android:name="android.appwidget.provider"
-                       android:resource="@xml/appwidget_provider" />
+
+            <meta-data
+                android:name="android.appwidget.provider"
+                android:resource="@xml/appwidget_provider" />
         </receiver>
 
         <!-- Service to update Notification -->
-        <service android:name="de.example.exampletdd.NotificationIntentService"
-            android:exported="false"
-            android:enabled="true" />
-        
+        <service
+            android:name=".NotificationIntentService"
+            android:enabled="true"
+            android:exported="false" />
+
         <!-- Service to update Widget -->
-               <service android:name="de.example.exampletdd.WidgetIntentService"
-                   android:exported="false"
-            android:enabled="true" />
-        
+        <service
+            android:name=".WidgetIntentService"
+            android:enabled="true"
+            android:exported="false" />
 
         <meta-data
             android:name="com.google.android.maps.v2.API_KEY"
diff --git a/Android/WeatherInformation/app/src/main/java/de/example/exampletdd/AboutActivity.java b/Android/WeatherInformation/app/src/main/java/de/example/exampletdd/AboutActivity.java
new file mode 100644 (file)
index 0000000..9589219
--- /dev/null
@@ -0,0 +1,45 @@
+package de.example.exampletdd;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.View;
+
+
+public class AboutActivity extends Activity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.weather_about);
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+
+        final ActionBar actionBar = this.getActionBar();
+        actionBar.setTitle(this.getString(R.string.weather_about_action));
+    }
+
+    public void onClickLegalInformation(final View view) {
+
+    }
+
+    public void onClickSourceCode(final View view) {
+        final String url = this.getString(R.string.application_source_code_url);
+        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+    }
+
+    public void onClickRemoteData(final View view) {
+        final String url = this.getString(R.string.openweahtermap_url);
+        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+    }
+
+    public void onClickMyWeb(final View view) {
+        final String url = this.getString(R.string.my_url);
+        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+    }
+}
index 168ab2e..384e759 100644 (file)
@@ -105,6 +105,12 @@ public class WeatherTabsActivity extends FragmentActivity {
                                        "de.example.exampletdd.MapActivity"));
             this.startActivity(intent);
             return true;
+        } else if (itemId == R.id.weather_menu_about) {
+            intent = new Intent("de.example.exampletdd.WEATHERINFO").
+                    setComponent(new ComponentName("de.example.exampletdd",
+                            "de.example.exampletdd.AboutActivity"));
+            this.startActivity(intent);
+            return true;
         } else {
         }
 
diff --git a/Android/WeatherInformation/app/src/main/res/layout/weather_about.xml b/Android/WeatherInformation/app/src/main/res/layout/weather_about.xml
new file mode 100644 (file)
index 0000000..272ec84
--- /dev/null
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:orientation="vertical"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:contentDescription="@string/icon_weather_description"
+            android:orientation="horizontal"
+            android:src="@drawable/ic_launcher" />
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:text="@string/weather_about_application"
+            android:textColor="?android:attr/colorForeground"
+            android:padding="5dp"
+            android:layout_gravity="start" />
+        <View style="@style/Divider"/>
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:text="@string/weather_about_application_version"
+            android:padding="20dp"
+            android:layout_gravity="start" />
+
+        <TextView
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:text="@string/weather_about_application_legal"
+            android:padding="20dp"
+            android:layout_gravity="start"
+            android:clickable="true"
+            android:onClick="onClickLegalInformation"/>
+
+        <TextView
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:text="@string/weather_about_application_source_code"
+            android:padding="20dp"
+            android:layout_gravity="start"
+            android:clickable="true"
+            android:onClick="onClickSourceCode"/>
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:text="@string/weather_about_application_remote_data"
+            android:textColor="?android:attr/colorForeground"
+            android:padding="5dp"
+            android:layout_gravity="start" />
+        <View style="@style/Divider"/>
+
+        <TextView
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:text="@string/weather_about_application_remote_data_openweathermap"
+            android:padding="20dp"
+            android:layout_gravity="start"
+            android:clickable="true"
+            android:onClick="onClickRemoteData"/>
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:text="@string/weather_about_application_developer"
+            android:textColor="?android:attr/colorForeground"
+            android:padding="5dp"
+            android:layout_gravity="start" />
+        <View style="@style/Divider"/>
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:text="@string/weather_about_application_developer_name"
+            android:padding="20dp"
+            android:layout_gravity="start" />
+
+        <TextView
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:text="@string/weather_about_application_developer_web"
+            android:padding="20dp"
+            android:layout_gravity="start"
+            android:clickable="true"
+            android:onClick="onClickMyWeb"/>
+    </LinearLayout>
+</ScrollView>
\ No newline at end of file
index f3f36c8..714e6a8 100644 (file)
@@ -2,8 +2,7 @@
 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
     
     
-    <item
-        android:id="@+id/weather_menu_settings"
+    <item android:id="@+id/weather_menu_settings"
         android:menuCategory="system"
         android:title="@string/weather_preferences_action_settings"
         android:titleCondensed="@string/weather_preferences_action_settings"
@@ -14,8 +13,7 @@
         android:icon="@drawable/ic_action_settings"
         android:showAsAction="ifRoom">
     </item>
-    <item
-        android:id="@+id/weather_menu_map"
+    <item android:id="@+id/weather_menu_map"
         android:icon="@drawable/ic_action_map"
         android:showAsAction="ifRoom"
         android:visible="true"
         android:title="@string/weather_map_action_map"
         android:titleCondensed="@string/weather_map_action_map">
     </item>
-    
+    <item android:id="@+id/weather_menu_about"
+        android:showAsAction="never"
+        android:visible="true"
+        android:checkable="false"
+        android:enabled="true"
+        android:checked="false"
+        android:orderInCategory="100"
+        android:title="@string/weather_about_action"
+        android:titleCondensed="@string/weather_about_action">
+    </item>
 
 </menu>
index 746757d..f1fec65 100644 (file)
@@ -2,8 +2,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android">
 
     <string name="app_name">Weather Information</string>
-    <string name="icon_weather_description">Icon weather</string> 
-
+    <string name="icon_weather_description">Icon weather</string>
 
     <!-- Activities Current, Overview and Specific -->
     <string name="text_field_sun_rise">SUN RISE</string>
@@ -19,7 +18,6 @@
     <string name="text_units_percent">%</string>
     <string name="text_field_remote_error">No data available</string>
 
-
     <!-- Preferences Acitivity -->
     <string name="weather_preferences_action_settings">Settings</string>
     <string name="weather_preferences_units">Units</string>
@@ -58,8 +56,6 @@
     <string name="weather_preferences_pressure_human_value_pascal">pascal</string>
     <string name="weather_preferences_pressure_human_value_standard_atm">standard atmosphere</string>
 
-
-
     <!-- Widget Preferences Activity -->
     <string name="widget_preferences_action_settings">Settings</string>
     <string name="widget_preferences_button_refresh">Refresh</string>
     <string name="widget_preferences_country_switch_off">OFF</string>
     <string name="widget_preferences_country_switch_on">ON</string>
 
-
     <!-- Map Activity -->
     <string name="weather_map_action_map">Select Location</string>
     <string name="city_not_found">city not found</string>
     <string name="country_not_found">country not found</string>
-    <string name="progress_dialog_generic_message">Please wait&#8230;</string>
+    <string name="progress_dialog_generic_message">Please wait</string>
     <string name="weather_map_button_savelocation">Save Location</string>
-       <string name="weather_map_button_getlocation">Get Location</string>
-       
-       
-       <!-- DO NOT TRANSLATE -->
-       <string name="uri_api_weather_today">http://api.openweathermap.org/data/{0}/weather?lat={1}&amp;lon={2}&amp;cnt=1</string>
+    <string name="weather_map_button_getlocation">Get Location</string>
+
+    <!-- About Activity -->
+    <string name="weather_about_action">About</string>
+    <string name="weather_about_application">APPLICATION</string>
+    <string name="weather_about_application_version">Version 1.0</string>
+    <string name="weather_about_application_legal">Legal information</string>
+    <string name="weather_about_application_source_code">Source code</string>
+    <string name="weather_about_application_remote_data">REMOTE DATA</string>
+    <string name="weather_about_application_remote_data_openweathermap">OpenWeatherMap</string>
+    <string name="weather_about_application_developer">DEVELOPER</string>
+    <string name="weather_about_application_developer_name">Gustavo Martin Morcuende</string>
+    <string name="weather_about_application_developer_web">Web</string>
+
+    <!-- DO NOT TRANSLATE -->
+    <string name="uri_api_weather_today">http://api.openweathermap.org/data/{0}/weather?lat={1}&amp;lon={2}&amp;cnt=1</string>
     <string name="uri_api_weather_forecast">http://api.openweathermap.org/data/{0}/forecast/daily?lat={1}&amp;lon={2}&amp;cnt={3}&amp;mode=json</string>
     <string name="api_version">2.5</string>
+    <string name="application_source_code_url">https://github.com/gumartinm/JavaForFun/tree/master/Android/WeatherInformation</string>
+    <string name="my_url">http://gumartinm.name</string>
+    <string name="openweahtermap_url">http://openweathermap.org/</string>
+    <string name="title_activity_about">About</string>
+    <string name="hello_world">Hello world!</string>
+    <string name="action_settings">Settings</string>
+
 </resources>
index 3563070..b301e1b 100644 (file)
@@ -26,6 +26,5 @@
     </style>
 
     <color name="weather_time_of_day_color_title">#48aed4</color>
-    <color name="widget_background_holo_dark">#ff000000</color>
 
 </resources>