diff options
author | DvTonder <david.vantonder@gmail.com> | 2013-11-04 00:10:27 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-11-04 00:10:27 +0000 |
commit | 41e555333e088e2b8d72ce67994babfa5d6a54dc (patch) | |
tree | 12a4f334354c861584faf495703ea4f1686c8879 | |
parent | 9419703756243332261ca1d045326b8e5c97737d (diff) | |
parent | c84f094b9f08a8369f7f41627bf87b9146aaea8b (diff) | |
download | android_packages_apps_LockClock-41e555333e088e2b8d72ce67994babfa5d6a54dc.tar.gz android_packages_apps_LockClock-41e555333e088e2b8d72ce67994babfa5d6a54dc.tar.bz2 android_packages_apps_LockClock-41e555333e088e2b8d72ce67994babfa5d6a54dc.zip |
Merge "LockClock: More user friendly weather "no data" message" into cm-10.2
-rw-r--r-- | res/layout/weather_panel.xml | 25 | ||||
-rwxr-xr-x | src/com/cyanogenmod/lockclock/ClockWidgetService.java | 36 | ||||
-rwxr-xr-x | src/com/cyanogenmod/lockclock/misc/Constants.java | 2 |
3 files changed, 47 insertions, 16 deletions
diff --git a/res/layout/weather_panel.xml b/res/layout/weather_panel.xml index 75c9221..5401081 100644 --- a/res/layout/weather_panel.xml +++ b/res/layout/weather_panel.xml @@ -22,6 +22,31 @@ android:orientation="horizontal" android:background="?android:attr/selectableItemBackground" > + <TextView + android:id="@+id/weather_no_data" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:textSize="12sp" + android:singleLine="true" + android:ellipsize="marquee" + android:textColor="?android:attr/textColorPrimary" + android:paddingTop="8dip" + style="@style/label_shadow" + android:visibility="gone" /> + + <TextView + android:id="@+id/weather_refresh" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:layout_below="@id/weather_no_data" + android:textSize="12sp" + android:paddingBottom="8dip" + android:textColor="?android:attr/textColorSecondary" + style="@style/label_shadow" + android:visibility="gone" /> + <ImageView android:id="@+id/weather_image" android:layout_width="wrap_content" diff --git a/src/com/cyanogenmod/lockclock/ClockWidgetService.java b/src/com/cyanogenmod/lockclock/ClockWidgetService.java index 8cb67b9..1cf5609 100755 --- a/src/com/cyanogenmod/lockclock/ClockWidgetService.java +++ b/src/com/cyanogenmod/lockclock/ClockWidgetService.java @@ -451,27 +451,33 @@ public class ClockWidgetService extends IntentService { * There is no data to display, display 'empty' fields and the 'Tap to reload' message */ private void setNoWeatherData(RemoteViews weatherViews, boolean smallWidget) { - boolean defaultIcons = !Preferences.useAlternateWeatherIcons(this); - final Resources res = getBaseContext().getResources(); int color = Preferences.weatherFontColor(this); - // Weather Image - Either the default or alternate set - weatherViews.setImageViewResource(R.id.weather_image, - defaultIcons ? R.drawable.weather_na : R.drawable.weather2_na); - + // Hide the normal weather stuff + String noData = getString(R.string.weather_cannot_reach_provider, getString(R.string.weather_source)); + weatherViews.setViewVisibility(R.id.weather_image, View.INVISIBLE); if (!smallWidget) { - weatherViews.setTextViewText(R.id.weather_city, res.getString(R.string.weather_no_data)); - weatherViews.setViewVisibility(R.id.weather_city, View.VISIBLE); + weatherViews.setViewVisibility(R.id.weather_city, View.GONE); weatherViews.setViewVisibility(R.id.update_time, View.GONE); - weatherViews.setTextColor(R.id.weather_city, color); + weatherViews.setViewVisibility(R.id.weather_temps_panel, View.GONE); + weatherViews.setViewVisibility(R.id.weather_condition, View.GONE); + + // Set up the no data and refresh indicators + weatherViews.setTextViewText(R.id.weather_no_data, noData); + weatherViews.setTextViewText(R.id.weather_refresh, getString(R.string.weather_tap_to_refresh)); + weatherViews.setTextColor(R.id.weather_no_data, color); + weatherViews.setTextColor(R.id.weather_refresh, color); + weatherViews.setViewVisibility(R.id.weather_no_data, View.VISIBLE); + weatherViews.setViewVisibility(R.id.weather_refresh, View.VISIBLE); + } else { + weatherViews.setTextViewText(R.id.weather_temp, noData); + weatherViews.setTextViewText(R.id.weather_condition, getString(R.string.weather_tap_to_refresh)); + weatherViews.setTextColor(R.id.weather_temp, color); + weatherViews.setTextColor(R.id.weather_condition, color); } - weatherViews.setViewVisibility(R.id.weather_temps_panel, View.GONE); - weatherViews.setTextViewText(R.id.weather_condition, res.getString(R.string.weather_tap_to_refresh)); - weatherViews.setTextColor(R.id.weather_condition, color); - - // Register an onClickListener on Weather - setWeatherClickListener(weatherViews); + // Register an onClickListener on Weather with the default (Refresh) action + setWeatherClickListener(weatherViews, true); } private void setWeatherClickListener(RemoteViews weatherViews) { diff --git a/src/com/cyanogenmod/lockclock/misc/Constants.java b/src/com/cyanogenmod/lockclock/misc/Constants.java index 535dcb0..0c7aa11 100755 --- a/src/com/cyanogenmod/lockclock/misc/Constants.java +++ b/src/com/cyanogenmod/lockclock/misc/Constants.java @@ -67,7 +67,7 @@ public class Constants { public static final String WEATHER_LAST_UPDATE = "last_weather_update"; public static final String WEATHER_DATA = "weather_data"; - public static final int MAX_CALENDAR_ITEMS = 10; + public static final int MAX_CALENDAR_ITEMS = 30; public static final long CALENDAR_UPCOMING_EVENTS_FROM_HOUR = 20L; public static final int CALENDAR_FORMAT_TIME = DateUtils.FORMAT_SHOW_TIME |