diff options
| author | Arne Schwabe <arne@rfc2549.org> | 2014-04-20 21:38:19 +0200 |
|---|---|---|
| committer | Arne Schwabe <arne@rfc2549.org> | 2014-05-17 13:08:14 +0200 |
| commit | be26c1845210a1c8824677ed6e2d093073ea5c84 (patch) | |
| tree | 81d02773f4fd9edc5d05b44c770be89994a9c207 /main/res/values | |
| parent | 496878826d638367c129b02e66f992202e0d36c9 (diff) | |
| download | cgeo-be26c1845210a1c8824677ed6e2d093073ea5c84.zip cgeo-be26c1845210a1c8824677ed6e2d093073ea5c84.tar.gz cgeo-be26c1845210a1c8824677ed6e2d093073ea5c84.tar.bz2 | |
Implement ActionBar using AppCompat in cgeo
This a first version of an ActionBar implementation with following properties:
- The application should be usuable (there still might be bugs left from the conversation to Action)
- Provides a more modern feeling on all devices
- gets rid of the "dots of shame" on Android 3.0+ devices
- The Maps classes MUST inherit from Activity instead of ActionBarActivity. There these classes use the old ActionBar on Android 2.3 devices and the real ActionBar on 3.0+
- This can be fixed when cgeo is ported to Google Maps API v2.0 API which usesFragment
- The Dialog classes (CachePopup and WaypointPopup) have been converted to DialogFragments
- The AppCombat themes provide no Theme.Dialog theme
- this will later ease using these Fragment in other Activities
- Use an almost empty activity which just shows the DialogFragment
- Use the 'old' ActionBar but which overflow menu button to fit into Holo Design Style
- Using a real ActionBar for Dialogs is not really support by Android and trying to force the frame into showing an Actionbar on a dialog leeds to strange bugs/effects
- Most of the icon are still the Android 2.3 Menu Icon. These need to be replaced with Holo Style Icons
- for most menu icon the ifRoom and/or withText attributes should be reviewed and set
- The ActionBar of the main Activity is transparent. This is more or less by accident but looks good
- Review Up Action of activities. Is going back to Main Activity always the semantically right thing to do?
- Shortpress/Longpress on the Actionbars Compass Icon for primary/secondary Navigation clashes the normal ActionBar behaviour of long pressing to show the text of the action
This commit contains many fixes and suggestions from rsudev
Diffstat (limited to 'main/res/values')
| -rw-r--r-- | main/res/values/attrs.xml | 1 | ||||
| -rw-r--r-- | main/res/values/strings.xml | 3 | ||||
| -rw-r--r-- | main/res/values/styles.xml | 6 | ||||
| -rw-r--r-- | main/res/values/themes.xml | 63 |
4 files changed, 62 insertions, 11 deletions
diff --git a/main/res/values/attrs.xml b/main/res/values/attrs.xml index ab1db9f..be33f09 100644 --- a/main/res/values/attrs.xml +++ b/main/res/values/attrs.xml @@ -42,7 +42,6 @@ <!-- attributes for custom made preferences --> - <attr name="title" format="string" /> <attr name="text" format="string" /> <attr name="url" format="string" /> <attr name="urlButton" format="string" /> diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml index a9d92d0..0a8d3fd 100644 --- a/main/res/values/strings.xml +++ b/main/res/values/strings.xml @@ -247,6 +247,8 @@ <string name="loc_trying">Trying to Locate</string> <string name="loc_no_addr">Unknown address</string> <string name="loc_gps_disabled">GPS disabled</string> + <string name="menu_centerposition">Center on my position</string> + <!-- standard menu --> <string name="menu_about">About c:geo</string> @@ -1286,4 +1288,5 @@ <!-- shortcuts --> <string name="cgeo_shortcut">c:geo shortcut</string> <string name="create_shortcut">Create shortcut</string> + </resources> diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml index c566122..ffcb6aa 100644 --- a/main/res/values/styles.xml +++ b/main/res/values/styles.xml @@ -70,7 +70,7 @@ <item name="android:padding">2dip</item> <item name="android:scaleType">center</item> <item name="android:focusable">true</item> - <item name="android:src">@drawable/actionbar_home</item> + <item name="android:src">@drawable/actionbar_cgeo</item> <item name="android:background">@drawable/actionbar_button</item> </style> @@ -102,6 +102,10 @@ <item name="android:text">c:geo</item> </style> + <style name="actionbar_myposition"> + <item name="android:button">@drawable/ic_menu_myposition</item> + </style> + <!-- button: full width --> <style name="button_full" parent="button"> <item name="android:layout_width">fill_parent</item> diff --git a/main/res/values/themes.xml b/main/res/values/themes.xml index ed64ef5..c5bdae1 100644 --- a/main/res/values/themes.xml +++ b/main/res/values/themes.xml @@ -1,15 +1,39 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <style name="cgeo_main" parent="android:style/Theme.Wallpaper.NoTitleBar"> + + <style name="cgeo_main" parent="@style/Theme.AppCompat"> + + <!-- copy the style elements of the Wallpaper theme since AppCombat has no Wallpaper theme --> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:colorBackgroundCacheHint">@null</item> + <item name="android:windowShowWallpaper">true</item> + <!-- system elements --> <item name="android:windowContentOverlay">@null</item> + + </style> + + <style name="cgeo" parent="@style/Theme.AppCompat"> + + + <item name="android:buttonStyle">@style/button</item> + <item name="android:editTextStyle">@style/edittext</item> + <item name="android:windowContentOverlay">@null</item> + + <!-- own values: colors --> + <item name="just_color">@color/just_black</item> + <item name="text_color_link">@color/link</item> + <item name="button_color_enabled">@color/button_enabled</item> + <item name="button_color_disabled">@color/button_disabled</item> </style> - <style name="cgeo" parent="android:style/Theme.NoTitleBar"> - <!-- system elements --> + <!-- Identical to cgeo aside from different parent style --> + <style name="cgeo_light" parent="@style/Theme.AppCompat.Light.DarkActionBar"> + + <item name="android:buttonStyle">@style/button</item> <item name="android:editTextStyle">@style/edittext</item> <item name="android:windowContentOverlay">@null</item> @@ -21,6 +45,8 @@ <item name="button_color_disabled">@color/button_disabled</item> </style> + + <style name="dark" parent="cgeo"> <!-- own values: colors --> @@ -50,7 +76,7 @@ <item name="compass">0</item> </style> - <style name="light" parent="cgeo"> + <style name="light" parent="cgeo_light"> <!-- own values: colors --> <item name="android:windowBackground">@color/just_white</item> @@ -80,16 +106,35 @@ <item name="compass">1</item> </style> - <style name="cgeo_popup" parent="android:style/Theme.Dialog"> + + <style name="Theme.AppCompat.Translucent.Light" parent="Theme.AppCompat.Light.DarkActionBar"> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:colorBackgroundCacheHint">@null</item> + <item name="android:windowIsTranslucent">true</item> + <item name="android:windowAnimationStyle">@android:style/Animation</item> + </style> + + <style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat"> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:colorBackgroundCacheHint">@null</item> + <item name="android:windowIsTranslucent">true</item> + <item name="android:windowAnimationStyle">@android:style/Animation</item> + </style> + + <style name="cgeo_popup" parent="Theme.AppCompat.Translucent.Light"> <!-- system elements --> <item name="android:buttonStyle">@style/button</item> <item name="android:editTextStyle">@style/edittext</item> <item name="android:windowNoTitle">true</item> - </style> + </style> <!-- TODO: Popup probably doesn't need all these fields set. Should delete unnecessary ones. --> - <style name="popup_dark" parent="cgeo_popup"> + <style name="popup_dark" parent="Theme.AppCompat.Translucent"> + <!-- system elements --> + <item name="android:buttonStyle">@style/button</item> + <item name="android:editTextStyle">@style/edittext</item> + <item name="android:windowNoTitle">true</item> <!-- own values: colors --> <item name="just_color">@color/just_black</item> @@ -153,7 +198,7 @@ <item name="compass">1</item> </style> - <style name="settings" parent="android:Theme"> + <style name="settings" parent="@style/Theme.AppCompat"> <item name="settings_cloud">@drawable/settings_cloud_white</item> <item name="settings_details">@drawable/settings_details_white</item> <item name="settings_eye">@drawable/settings_eye_white</item> @@ -165,7 +210,7 @@ <item name="settings_info_icon">@drawable/settings_info_icon_white</item> </style> - <style name="settings.light" parent="android:Theme.Light"> + <style name="settings.light" parent="@style/Theme.AppCompat.Light"> <item name="settings_cloud">@drawable/settings_cloud_black</item> <item name="settings_details">@drawable/settings_details_black</item> <item name="settings_eye">@drawable/settings_eye_black</item> |
