diff options
author | DvTonder <david.vantonder@gmail.com> | 2015-02-09 19:47:08 -0500 |
---|---|---|
committer | DvTonder <david.vantonder@gmail.com> | 2015-02-09 22:08:14 -0500 |
commit | bc4e4bdb4bf017f6730032f415565fcaf45f5e2d (patch) | |
tree | 8d2aef024ba0cc788f84fbdc163e82e62487e5a5 | |
parent | a519899c4b6103dc69bfba72f964f9d2a1a4c39f (diff) | |
download | android_packages_apps_LockClock-bc4e4bdb4bf017f6730032f415565fcaf45f5e2d.tar.gz android_packages_apps_LockClock-bc4e4bdb4bf017f6730032f415565fcaf45f5e2d.tar.bz2 android_packages_apps_LockClock-bc4e4bdb4bf017f6730032f415565fcaf45f5e2d.zip |
LockClock: Materialize the UI and update for Lollipop
Change-Id: I8128e7aa94bca26b012d63c1bb95bd09d31db7e0
45 files changed, 111 insertions, 87 deletions
@@ -19,7 +19,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-java-files-under, src) -LOCAL_SDK_VERSION := 19 +LOCAL_SDK_VERSION := 21 LOCAL_PACKAGE_NAME := LockClock LOCAL_PROGUARD_FLAG_FILES := proguard.flags LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true diff --git a/project.properties b/project.properties index a3ee5ab..6e18427 100644 --- a/project.properties +++ b/project.properties @@ -11,4 +11,4 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-17 +target=android-21 diff --git a/res/drawable-hdpi/calendar_preferences.png b/res/drawable-hdpi/calendar_preferences.png Binary files differindex 7568ebc..993aa62 100644 --- a/res/drawable-hdpi/calendar_preferences.png +++ b/res/drawable-hdpi/calendar_preferences.png diff --git a/res/drawable-hdpi/clock_preferences.png b/res/drawable-hdpi/clock_preferences.png Binary files differindex 65f909a..7de0d62 100755..100644 --- a/res/drawable-hdpi/clock_preferences.png +++ b/res/drawable-hdpi/clock_preferences.png diff --git a/res/drawable-hdpi/ic_menu_done.png b/res/drawable-hdpi/ic_menu_done.png Binary files differnew file mode 100644 index 0000000..e502447 --- /dev/null +++ b/res/drawable-hdpi/ic_menu_done.png diff --git a/res/drawable-hdpi/ic_menu_done_holo_light.png b/res/drawable-hdpi/ic_menu_done_holo_light.png Binary files differdeleted file mode 100644 index d8662e3..0000000 --- a/res/drawable-hdpi/ic_menu_done_holo_light.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_menu_refresh.png b/res/drawable-hdpi/ic_menu_refresh.png Binary files differnew file mode 100644 index 0000000..5f89fc2 --- /dev/null +++ b/res/drawable-hdpi/ic_menu_refresh.png diff --git a/res/drawable-hdpi/ic_menu_refresh_holo_dark.png b/res/drawable-hdpi/ic_menu_refresh_holo_dark.png Binary files differdeleted file mode 100644 index 69ac31b..0000000 --- a/res/drawable-hdpi/ic_menu_refresh_holo_dark.png +++ /dev/null diff --git a/res/drawable-hdpi/weather_preferences.png b/res/drawable-hdpi/weather_preferences.png Binary files differindex 2ef8730..83e30a1 100644 --- a/res/drawable-hdpi/weather_preferences.png +++ b/res/drawable-hdpi/weather_preferences.png diff --git a/res/drawable-mdpi/calendar_preferences.png b/res/drawable-mdpi/calendar_preferences.png Binary files differindex 205fc00..d2f6ab8 100644 --- a/res/drawable-mdpi/calendar_preferences.png +++ b/res/drawable-mdpi/calendar_preferences.png diff --git a/res/drawable-mdpi/clock_preferences.png b/res/drawable-mdpi/clock_preferences.png Binary files differindex 3f53090..d71ba94 100644 --- a/res/drawable-mdpi/clock_preferences.png +++ b/res/drawable-mdpi/clock_preferences.png diff --git a/res/drawable-mdpi/ic_menu_done.png b/res/drawable-mdpi/ic_menu_done.png Binary files differnew file mode 100644 index 0000000..f42a0e2 --- /dev/null +++ b/res/drawable-mdpi/ic_menu_done.png diff --git a/res/drawable-mdpi/ic_menu_done_holo_light.png b/res/drawable-mdpi/ic_menu_done_holo_light.png Binary files differdeleted file mode 100644 index a17b6a7..0000000 --- a/res/drawable-mdpi/ic_menu_done_holo_light.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_menu_refresh.png b/res/drawable-mdpi/ic_menu_refresh.png Binary files differnew file mode 100644 index 0000000..cd16fdd --- /dev/null +++ b/res/drawable-mdpi/ic_menu_refresh.png diff --git a/res/drawable-mdpi/ic_menu_refresh_holo_dark.png b/res/drawable-mdpi/ic_menu_refresh_holo_dark.png Binary files differdeleted file mode 100644 index f68aacf..0000000 --- a/res/drawable-mdpi/ic_menu_refresh_holo_dark.png +++ /dev/null diff --git a/res/drawable-mdpi/weather_preferences.png b/res/drawable-mdpi/weather_preferences.png Binary files differindex d7c1882..0c35303 100644 --- a/res/drawable-mdpi/weather_preferences.png +++ b/res/drawable-mdpi/weather_preferences.png diff --git a/res/drawable-xhdpi/calendar_preferences.png b/res/drawable-xhdpi/calendar_preferences.png Binary files differindex 41f962d..e1fbd9d 100644 --- a/res/drawable-xhdpi/calendar_preferences.png +++ b/res/drawable-xhdpi/calendar_preferences.png diff --git a/res/drawable-xhdpi/clock_preferences.png b/res/drawable-xhdpi/clock_preferences.png Binary files differindex ca8cac6..5104b41 100644 --- a/res/drawable-xhdpi/clock_preferences.png +++ b/res/drawable-xhdpi/clock_preferences.png diff --git a/res/drawable-xhdpi/ic_menu_done.png b/res/drawable-xhdpi/ic_menu_done.png Binary files differnew file mode 100644 index 0000000..f801e7a --- /dev/null +++ b/res/drawable-xhdpi/ic_menu_done.png diff --git a/res/drawable-xhdpi/ic_menu_done_holo_light.png b/res/drawable-xhdpi/ic_menu_done_holo_light.png Binary files differdeleted file mode 100644 index 2e06dd0..0000000 --- a/res/drawable-xhdpi/ic_menu_done_holo_light.png +++ /dev/null diff --git a/res/drawable-xhdpi/ic_menu_refresh.png b/res/drawable-xhdpi/ic_menu_refresh.png Binary files differnew file mode 100644 index 0000000..72128fe --- /dev/null +++ b/res/drawable-xhdpi/ic_menu_refresh.png diff --git a/res/drawable-xhdpi/ic_menu_refresh_holo_dark.png b/res/drawable-xhdpi/ic_menu_refresh_holo_dark.png Binary files differdeleted file mode 100644 index 3db90ee..0000000 --- a/res/drawable-xhdpi/ic_menu_refresh_holo_dark.png +++ /dev/null diff --git a/res/drawable-xhdpi/weather_preferences.png b/res/drawable-xhdpi/weather_preferences.png Binary files differindex ca3d369..1d9ddf6 100644 --- a/res/drawable-xhdpi/weather_preferences.png +++ b/res/drawable-xhdpi/weather_preferences.png diff --git a/res/drawable-xxhdpi/calendar_preferences.png b/res/drawable-xxhdpi/calendar_preferences.png Binary files differindex 06f9c33..8b4a912 100644 --- a/res/drawable-xxhdpi/calendar_preferences.png +++ b/res/drawable-xxhdpi/calendar_preferences.png diff --git a/res/drawable-xxhdpi/clock_preferences.png b/res/drawable-xxhdpi/clock_preferences.png Binary files differindex ecf135b..9ef3ca3 100644 --- a/res/drawable-xxhdpi/clock_preferences.png +++ b/res/drawable-xxhdpi/clock_preferences.png diff --git a/res/drawable-xxhdpi/ic_menu_done.png b/res/drawable-xxhdpi/ic_menu_done.png Binary files differnew file mode 100644 index 0000000..8789284 --- /dev/null +++ b/res/drawable-xxhdpi/ic_menu_done.png diff --git a/res/drawable-xxhdpi/ic_menu_done_holo_light.png b/res/drawable-xxhdpi/ic_menu_done_holo_light.png Binary files differdeleted file mode 100644 index fdecbe1..0000000 --- a/res/drawable-xxhdpi/ic_menu_done_holo_light.png +++ /dev/null diff --git a/res/drawable-xxhdpi/ic_menu_refresh.png b/res/drawable-xxhdpi/ic_menu_refresh.png Binary files differnew file mode 100644 index 0000000..d271d8e --- /dev/null +++ b/res/drawable-xxhdpi/ic_menu_refresh.png diff --git a/res/drawable-xxhdpi/ic_menu_refresh_holo_dark.png b/res/drawable-xxhdpi/ic_menu_refresh_holo_dark.png Binary files differdeleted file mode 100644 index 088d76b..0000000 --- a/res/drawable-xxhdpi/ic_menu_refresh_holo_dark.png +++ /dev/null diff --git a/res/drawable-xxhdpi/weather_preferences.png b/res/drawable-xxhdpi/weather_preferences.png Binary files differindex 39d741f..a92c8c0 100644 --- a/res/drawable-xxhdpi/weather_preferences.png +++ b/res/drawable-xxhdpi/weather_preferences.png diff --git a/res/layout/forecast_activity.xml b/res/layout/forecast_activity.xml index 77840f5..1ac7635 100644 --- a/res/layout/forecast_activity.xml +++ b/res/layout/forecast_activity.xml @@ -51,7 +51,7 @@ android:layout_alignParentRight="true" android:layout_centerVertical="true" android:padding="8dp" - android:src="@drawable/ic_menu_refresh_holo_dark" + android:src="@drawable/ic_menu_refresh" android:background="?android:attr/selectableItemBackground" /> </RelativeLayout> diff --git a/res/layout/preference_header_item.xml b/res/layout/preference_header_item.xml index fb57a79..ae861ab 100644 --- a/res/layout/preference_header_item.xml +++ b/res/layout/preference_header_item.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> + <!-- Copyright (C) 2013 The CyanogenMod Project (DvTonder) Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,16 +19,19 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="48dp" android:background="?android:attr/activatedBackgroundIndicator" android:gravity="center_vertical" + android:minHeight="48dp" android:paddingEnd="?android:attr/scrollbarSize"> <LinearLayout android:layout_width="wrap_content" - android:layout_marginStart="6dip" + android:layout_height="wrap_content" + android:layout_marginRight="6dip" android:layout_marginEnd="6dip" - android:layout_height="wrap_content"> + android:layout_marginLeft="6dip" + android:layout_marginStart="6dip"> + <ImageView android:id="@+id/icon" android:layout_width="wrap_content" @@ -36,31 +40,31 @@ </LinearLayout> <RelativeLayout - android:layout_width="wrap_content" + android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="2dip" + android:layout_marginBottom="6dip" android:layout_marginEnd="6dip" + android:layout_marginStart="2dip" android:layout_marginTop="6dip" - android:layout_marginBottom="6dip" android:layout_weight="1"> - <TextView android:id="@+id/title" + <TextView + android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:singleLine="true" - android:textAppearance="?android:attr/textAppearanceMedium" android:ellipsize="marquee" - android:fadingEdge="horizontal" /> + android:fadingEdge="horizontal" + android:singleLine="true" + android:textAppearance="?android:attr/textAppearanceMedium" /> - <TextView android:id="@+id/summary" + <TextView + android:id="@+id/summary" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_below="@id/title" android:layout_alignStart="@id/title" - android:textAppearance="?android:attr/textAppearanceSmall" + android:layout_below="@id/title" android:ellipsize="end" - android:maxLines="2" /> - + android:maxLines="2" + android:textAppearance="?android:attr/textAppearanceSmall" /> </RelativeLayout> - </LinearLayout> diff --git a/res/menu/options_menu.xml b/res/menu/options_menu.xml index 16758af..a8d478f 100644 --- a/res/menu/options_menu.xml +++ b/res/menu/options_menu.xml @@ -16,7 +16,7 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_done" - android:icon="@drawable/ic_menu_done_holo_light" + android:icon="@drawable/ic_menu_done" android:title="@string/menu_done" android:showAsAction="ifRoom|withText" /> </menu> diff --git a/res/values/colors.xml b/res/values/colors.xml index 8e701e8..3ad8929 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -23,4 +23,9 @@ <color name="list_selector_focused">#cc33b5e5</color> <color name="list_selector_activated">#4d33b5e5</color> + <!-- Material design app colors --> + <color name="colorPrimary">#3462b3</color> + <color name="colorPrimaryDark">#294d8c</color> + <color name="colorAccent">#3462b3</color> + </resources> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index fab4cea..0c411ef 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -23,7 +23,7 @@ <dimen name="widget_medium_font_size">48dp</dimen> <dimen name="label_font_size">14sp</dimen> - <dimen name="min_digital_widget_width">160dip</dimen> + <dimen name="min_digital_widget_width">180dip</dimen> <dimen name="min_digital_widget_height">140dip</dimen> <dimen name="min_digital_widget_resize_width">160dip</dimen> <dimen name="min_digital_widget_resize_height">40dip</dimen> diff --git a/res/values/styles.xml b/res/values/styles.xml index 8320b54..bf58993 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -24,19 +24,16 @@ <style name="label_bold" parent="@style/label_shadow"> <item name="android:textSize">@dimen/label_font_size</item> <item name="android:textStyle">bold</item> - <item name="android:textAllCaps">true</item> <item name="android:fontFamily">sans-serif-condensed</item> </style> <style name="label_thin" parent="@style/label_shadow"> <item name="android:textSize">@dimen/label_font_size</item> - <item name="android:textAllCaps">true</item> <item name="android:fontFamily">sans-serif-condensed</item> </style> <style name="label_small" parent="@style/label_shadow"> <item name="android:textSize">12sp</item> - <item name="android:textAllCaps">true</item> <item name="android:fontFamily">sans-serif-condensed</item> </style> @@ -87,8 +84,25 @@ <item name="android:windowAnimationStyle">@null</item> </style> - <style name="Theme.Main" parent="@android:style/Theme.Holo"> - <item name="android:actionBarStyle">@android:style/Widget.Holo.ActionBar.Solid</item> + <style name="Theme.Main" parent="@android:style/Theme.Material.Light.DarkActionBar"> + <!-- Main theme colors --> + <item name="android:colorPrimary">@color/colorPrimary</item> + <item name="android:colorPrimaryDark">@color/colorPrimaryDark</item> + <item name="android:colorAccent">@color/colorAccent</item> + <!-- One can also set colorControlNormal, colorControlActivated + colorControlHighlight, and colorSwitchThumbNormal. --> + + <!-- App behaviour --> + <item name="android:fadeScrollbars">true</item> + <item name="android:windowDrawsSystemBarBackgrounds">true</item> + <item name="android:statusBarColor">@color/colorPrimaryDark</item> + <item name="android:alertDialogTheme">@style/Theme.AlertDialog</item> + + </style> + + <style name="Theme.AlertDialog" parent="android:Theme.Material.Light.Dialog.Alert"> + <item name="android:colorPrimary">@color/colorPrimary</item> + <item name="android:colorAccent">@color/colorAccent</item> </style> </resources> diff --git a/res/xml/lock_clock.xml b/res/xml/lock_clock.xml index d19588c..3fd94c9 100644 --- a/res/xml/lock_clock.xml +++ b/res/xml/lock_clock.xml @@ -21,7 +21,7 @@ android:previewImage="@drawable/lock_clock_preview" android:initialLayout="@layout/appwidget" android:resizeMode="vertical|horizontal" - android:minResizeWidth="@dimen/min_digital_widget_resize_width" + android:minResizeWidth="@dimen/min_digital_widget_width" android:minResizeHeight="@dimen/min_digital_widget_resize_height" android:widgetCategory="keyguard|home_screen" android:configure="com.cyanogenmod.lockclock.preference.Preferences" diff --git a/res/xml/preferences_calendar.xml b/res/xml/preferences_calendar.xml index f6b5f87..b686bcf 100755..100644 --- a/res/xml/preferences_calendar.xml +++ b/res/xml/preferences_calendar.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2009 The CyanogenMod Project (DvTonder) + +<!-- Copyright (C) 2015 The CyanogenMod Project (DvTonder) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,10 +19,9 @@ android:key="calendar_settings" android:title="@string/calendar_category"> - <PreferenceCategory - android:title="@string/general_category" > + <PreferenceCategory android:title="@string/general_category"> - <CheckBoxPreference + <SwitchPreference android:key="show_calendar" android:title="@string/calendar_title" android:defaultValue="false" /> @@ -44,24 +44,23 @@ android:entries="@array/calendar_lookahead_entries" android:entryValues="@array/calendar_lookahead_values" /> - <CheckBoxPreference + <SwitchPreference android:key="calendar_reminders_only" android:dependency="show_calendar" android:title="@string/calendar_reminders_only_title" android:summary="@string/calendar_reminders_only_summary" android:defaultValue="false" /> - <CheckBoxPreference + <SwitchPreference android:key="calendar_hide_allday" android:dependency="show_calendar" android:title="@string/calendar_hide_allday_title" android:defaultValue="false" /> </PreferenceCategory> - <PreferenceCategory - android:title="@string/display_category" > + <PreferenceCategory android:title="@string/display_category"> - <CheckBoxPreference + <SwitchPreference android:key="calendar_icon" android:dependency="show_calendar" android:title="@string/calendar_icon_title" @@ -104,17 +103,16 @@ android:entryValues="@array/font_color_values" /> </PreferenceCategory> - <PreferenceCategory - android:title="@string/calendar_upcoming_events_category" > + <PreferenceCategory android:title="@string/calendar_upcoming_events_category"> - <CheckBoxPreference + <SwitchPreference android:key="calendar_highlight_upcoming_events" android:dependency="show_calendar" android:title="@string/calendar_highlight_upcoming_events_title" android:summary="@string/calendar_highlight_upcoming_events_summary" android:defaultValue="false" /> - <CheckBoxPreference + <SwitchPreference android:key="calendar_highlight_upcoming_events_bold" android:dependency="calendar_highlight_upcoming_events" android:title="@string/calendar_highlight_upcoming_events_bold" diff --git a/res/xml/preferences_clock.xml b/res/xml/preferences_clock.xml index fbc96cc..8eca8fe 100644 --- a/res/xml/preferences_clock.xml +++ b/res/xml/preferences_clock.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2009 The CyanogenMod Project (DvTonder) + +<!-- Copyright (C) 2015 The CyanogenMod Project (DvTonder) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,43 +19,41 @@ android:key="clock_settings" android:title="@string/clock_category"> - <PreferenceCategory - android:title="@string/general_category" > + <PreferenceCategory android:title="@string/general_category"> - <CheckBoxPreference + <SwitchPreference android:key="clock_digital" android:title="@string/use_digital_clock_title" android:summary="@string/use_digital_clock_summary" android:defaultValue="true" /> - <CheckBoxPreference + <SwitchPreference android:key="clock_show_alarm" android:title="@string/show_alarm_title" android:defaultValue="true" /> </PreferenceCategory> - <PreferenceCategory - android:title="@string/display_category" > + <PreferenceCategory android:title="@string/display_category"> - <CheckBoxPreference + <SwitchPreference android:key="clock_font" android:title="@string/clock_font_title" android:dependency="clock_digital" android:defaultValue="false" /> - <CheckBoxPreference + <SwitchPreference android:key="clock_font_minutes" android:title="@string/clock_font_minutes_title" android:dependency="clock_digital" android:defaultValue="false" /> - <CheckBoxPreference + <SwitchPreference android:key="clock_am_pm_indicator" android:title="@string/clock_am_pm_title" android:dependency="clock_digital" - android:defaultValue="false"/> + android:defaultValue="false" /> - <CheckBoxPreference + <SwitchPreference android:key="clock_font_date" android:title="@string/clock_font_date_title" android:defaultValue="true" /> diff --git a/res/xml/preferences_weather.xml b/res/xml/preferences_weather.xml index fd78983..b017948 100644 --- a/res/xml/preferences_weather.xml +++ b/res/xml/preferences_weather.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2009 The CyanogenMod Project (DvTonder) + +<!-- Copyright (C) 2015 The CyanogenMod Project (DvTonder) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,10 +19,9 @@ android:key="weather_settings" android:title="@string/weather_category"> - <PreferenceCategory - android:title="@string/general_category" > + <PreferenceCategory android:title="@string/general_category"> - <CheckBoxPreference + <SwitchPreference android:key="show_weather" android:title="@string/weather_enable" android:defaultValue="true" /> @@ -43,7 +43,7 @@ android:entryValues="@array/weather_interval_values" android:title="@string/weather_refresh_interval" /> - <CheckBoxPreference + <SwitchPreference android:key="weather_use_custom_location" android:dependency="show_weather" android:title="@string/weather_use_custom_location" @@ -57,8 +57,7 @@ android:title="@string/weather_custom_location_title" /> </PreferenceCategory> - <PreferenceCategory - android:title="@string/display_category" > + <PreferenceCategory android:title="@string/display_category"> <com.cyanogenmod.lockclock.preference.IconSelectionPreference android:key="weather_icons" @@ -66,31 +65,31 @@ android:dialogTitle="@string/weather_icon_set_title" android:defaultValue="color" /> - <CheckBoxPreference + <SwitchPreference android:key="weather_show_when_minimized" android:dependency="show_weather" android:title="@string/weather_show_when_minimized_title" android:summary="@string/weather_show_when_minimized_summary" android:defaultValue="true" /> - <CheckBoxPreference + <SwitchPreference android:key="weather_use_metric" android:dependency="show_weather" android:title="@string/weather_use_metric" /> - <CheckBoxPreference + <SwitchPreference android:key="weather_show_location" android:dependency="show_weather" android:title="@string/weather_show_location_title" android:defaultValue="true" /> - <CheckBoxPreference + <SwitchPreference android:key="weather_show_timestamp" android:dependency="show_weather" android:title="@string/weather_show_timestamp_title" android:defaultValue="true" /> - <CheckBoxPreference + <SwitchPreference android:key="weather_invert_lowhigh" android:dependency="show_weather" android:title="@string/weather_invert_lowhigh" diff --git a/src/com/cyanogenmod/lockclock/ClockWidgetService.java b/src/com/cyanogenmod/lockclock/ClockWidgetService.java index 31a7837..2c3c57a 100755..100644 --- a/src/com/cyanogenmod/lockclock/ClockWidgetService.java +++ b/src/com/cyanogenmod/lockclock/ClockWidgetService.java @@ -338,21 +338,18 @@ public class ClockWidgetService extends IntentService { if (!smallWidget) { if (Preferences.useBoldFontForDateAndAlarms(this)) { - alarmViews.setTextViewText(R.id.nextAlarm_bold, - nextAlarm.toString().toUpperCase(Locale.getDefault())); + alarmViews.setTextViewText(R.id.nextAlarm_bold, nextAlarm); alarmViews.setViewVisibility(R.id.nextAlarm_bold, View.VISIBLE); alarmViews.setViewVisibility(R.id.nextAlarm_regular, View.GONE); alarmViews.setTextColor(R.id.nextAlarm_bold, color); } else { - alarmViews.setTextViewText(R.id.nextAlarm_regular, - nextAlarm.toString().toUpperCase(Locale.getDefault())); + alarmViews.setTextViewText(R.id.nextAlarm_regular, nextAlarm); alarmViews.setViewVisibility(R.id.nextAlarm_regular, View.VISIBLE); alarmViews.setViewVisibility(R.id.nextAlarm_bold, View.GONE); alarmViews.setTextColor(R.id.nextAlarm_regular, color); } } else { - alarmViews.setTextViewText(R.id.nextAlarm, - nextAlarm.toString().toUpperCase(Locale.getDefault())); + alarmViews.setTextViewText(R.id.nextAlarm, nextAlarm); alarmViews.setViewVisibility(R.id.nextAlarm, View.VISIBLE); alarmViews.setTextColor(R.id.nextAlarm, color); } @@ -374,14 +371,23 @@ public class ClockWidgetService extends IntentService { * @return A formatted string of the next alarm or null if there is no next alarm. */ private String getNextAlarm() { - String nextAlarm = Settings.System.getString( - getContentResolver(), Settings.System.NEXT_ALARM_FORMATTED); - if (nextAlarm == null || TextUtils.isEmpty(nextAlarm)) { - return null; + String nextAlarm = null; + + AlarmManager am =(AlarmManager) getSystemService(Context.ALARM_SERVICE); + AlarmManager.AlarmClockInfo alarmClock = am.getNextAlarmClock(); + if (alarmClock != null) { + nextAlarm = getNextAlarmFormattedTime(this, alarmClock.getTriggerTime()); } + return nextAlarm; } + private static String getNextAlarmFormattedTime(Context context, long time) { + String skeleton = DateFormat.is24HourFormat(context) ? "EHm" : "Ehma"; + String pattern = DateFormat.getBestDateTimePattern(Locale.getDefault(), skeleton); + return (String) DateFormat.format(pattern, time); + } + //=============================================================================================== // Weather related functionality //=============================================================================================== diff --git a/src/com/cyanogenmod/lockclock/preference/CalendarPreferences.java b/src/com/cyanogenmod/lockclock/preference/CalendarPreferences.java index a192efd..e125929 100644 --- a/src/com/cyanogenmod/lockclock/preference/CalendarPreferences.java +++ b/src/com/cyanogenmod/lockclock/preference/CalendarPreferences.java @@ -112,8 +112,8 @@ public class CalendarPreferences extends PreferenceFragment implements private static final int DISPLAY_NAME_INDEX = 1; static CalendarEntries findCalendars(Context context) { - List<CharSequence> entries = new ArrayList<CharSequence>(); - List<CharSequence> entryValues = new ArrayList<CharSequence>(); + List<CharSequence> entries = new ArrayList<>(); + List<CharSequence> entryValues = new ArrayList<>(); ContentResolver cr = context.getContentResolver(); Cursor calendarCursor = cr.query(uri, projection, null, null, null); diff --git a/src/com/cyanogenmod/lockclock/preference/ClockPreferences.java b/src/com/cyanogenmod/lockclock/preference/ClockPreferences.java index 7a85a8c..88a6acc 100644 --- a/src/com/cyanogenmod/lockclock/preference/ClockPreferences.java +++ b/src/com/cyanogenmod/lockclock/preference/ClockPreferences.java @@ -21,10 +21,10 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Bundle; -import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceFragment; +import android.preference.SwitchPreference; import android.text.format.DateFormat; import com.cyanogenmod.lockclock.ClockWidgetProvider; @@ -37,7 +37,7 @@ public class ClockPreferences extends PreferenceFragment implements private Context mContext; private ListPreference mClockFontColor; private ListPreference mAlarmFontColor; - private CheckBoxPreference mAmPmToggle; + private SwitchPreference mAmPmToggle; @Override public void onCreate(Bundle savedInstanceState) { @@ -48,7 +48,7 @@ public class ClockPreferences extends PreferenceFragment implements mContext = getActivity(); mClockFontColor = (ListPreference) findPreference(Constants.CLOCK_FONT_COLOR); mAlarmFontColor = (ListPreference) findPreference(Constants.CLOCK_ALARM_FONT_COLOR); - mAmPmToggle = (CheckBoxPreference) findPreference(Constants.CLOCK_AM_PM_INDICATOR); + mAmPmToggle = (SwitchPreference) findPreference(Constants.CLOCK_AM_PM_INDICATOR); updateFontColorsSummary(); updateAmPmToggle(); diff --git a/src/com/cyanogenmod/lockclock/preference/WeatherPreferences.java b/src/com/cyanogenmod/lockclock/preference/WeatherPreferences.java index 94537c0..97dcef6 100644 --- a/src/com/cyanogenmod/lockclock/preference/WeatherPreferences.java +++ b/src/com/cyanogenmod/lockclock/preference/WeatherPreferences.java @@ -25,11 +25,11 @@ import android.content.Intent; import android.content.SharedPreferences; import android.location.LocationManager; import android.os.Bundle; -import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceFragment; +import android.preference.SwitchPreference; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; @@ -53,13 +53,13 @@ public class WeatherPreferences extends PreferenceFragment implements Constants.WEATHER_REFRESH_INTERVAL }; - private CheckBoxPreference mUseCustomLoc; + private SwitchPreference mUseCustomLoc; private EditTextPreference mCustomWeatherLoc; private ListPreference mFontColor; private ListPreference mTimestampFontColor; - private CheckBoxPreference mUseMetric; + private SwitchPreference mUseMetric; private IconSelectionPreference mIconSet; - private CheckBoxPreference mUseCustomlocation; + private SwitchPreference mUseCustomlocation; private Context mContext; private ContentResolver mResolver; @@ -73,13 +73,13 @@ public class WeatherPreferences extends PreferenceFragment implements mResolver = mContext.getContentResolver(); // Load items that need custom summaries etc. - mUseCustomLoc = (CheckBoxPreference) findPreference(Constants.WEATHER_USE_CUSTOM_LOCATION); + mUseCustomLoc = (SwitchPreference) findPreference(Constants.WEATHER_USE_CUSTOM_LOCATION); mCustomWeatherLoc = (EditTextPreference) findPreference(Constants.WEATHER_CUSTOM_LOCATION_CITY); mFontColor = (ListPreference) findPreference(Constants.WEATHER_FONT_COLOR); mTimestampFontColor = (ListPreference) findPreference(Constants.WEATHER_TIMESTAMP_FONT_COLOR); mIconSet = (IconSelectionPreference) findPreference(Constants.WEATHER_ICONS); - mUseMetric = (CheckBoxPreference) findPreference(Constants.WEATHER_USE_METRIC); - mUseCustomlocation = (CheckBoxPreference) findPreference(Constants.WEATHER_USE_CUSTOM_LOCATION); + mUseMetric = (SwitchPreference) findPreference(Constants.WEATHER_USE_METRIC); + mUseCustomlocation = (SwitchPreference) findPreference(Constants.WEATHER_USE_CUSTOM_LOCATION); // At first placement/start default the use of Metric units based on locale // If we had a previously set value already, this will just reset the same value diff --git a/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java b/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java index 64fd5c6..662bab4 100755..100644 --- a/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java +++ b/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java @@ -26,7 +26,6 @@ import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.location.LocationProvider; -import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.IBinder; |