diff options
author | Brandon McAnsh <brandon.mcansh@gmail.com> | 2015-07-08 15:32:59 -0400 |
---|---|---|
committer | Brandon McAnsh <brandon.mcansh@gmail.com> | 2015-07-14 10:59:08 -0700 |
commit | 652fb4e2ec0e7fbd30c93709a1d8a28d8f40c19a (patch) | |
tree | 12922c64ca87952d054f5137e833dea3249f2998 /src/com/cyanogenmod/lockclock/ClockWidgetService.java | |
parent | ad1d777e7949d8e58b14d8f748f5e6ac1e267431 (diff) | |
download | android_packages_apps_LockClock-652fb4e2ec0e7fbd30c93709a1d8a28d8f40c19a.tar.gz android_packages_apps_LockClock-652fb4e2ec0e7fbd30c93709a1d8a28d8f40c19a.tar.bz2 android_packages_apps_LockClock-652fb4e2ec0e7fbd30c93709a1d8a28d8f40c19a.zip |
LockClock: Only show timestamp if it can fit
* Currently in a 4x2 widget, the timestamp can be clipped at the bottom presenting a bad UX for the widget
that a user will first see when booting into Trebuchet (at least on bacon, klte, and m7).
* Check if the timestamp can fit based on the same logic as the calendar
Change-Id: I4ae3d55ac9e27f95403d39c41266fd43fa5bcf82
Signed-off-by: Brandon McAnsh <brandon.mcansh@gmail.com>
Diffstat (limited to 'src/com/cyanogenmod/lockclock/ClockWidgetService.java')
-rw-r--r-- | src/com/cyanogenmod/lockclock/ClockWidgetService.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/com/cyanogenmod/lockclock/ClockWidgetService.java b/src/com/cyanogenmod/lockclock/ClockWidgetService.java index 6fa0ab2..8402194 100644 --- a/src/com/cyanogenmod/lockclock/ClockWidgetService.java +++ b/src/com/cyanogenmod/lockclock/ClockWidgetService.java @@ -155,9 +155,13 @@ public class ClockWidgetService extends IntentService { refreshCalendar(remoteViews, id); } // Hide the calendar panel if not visible - remoteViews.setViewVisibility(R.id.calendar_panel, showCalendar ? View.VISIBLE : View.GONE); + remoteViews.setViewVisibility(R.id.calendar_panel, + showCalendar ? View.VISIBLE : View.GONE); - boolean canFitWeather = smallWidget || WidgetUtils.canFitWeather(this, id, digitalClock, isKeyguard); + boolean canFitWeather = smallWidget + || WidgetUtils.canFitWeather(this, id, digitalClock, isKeyguard); + boolean canFitTimestamp = smallWidget + || WidgetUtils.canFitTimestamp(this, id, digitalClock); // Now, if we need to show the actual weather, do so if (showWeather && canFitWeather) { WeatherInfo weatherInfo = Preferences.getCachedWeatherInfo(this); @@ -168,7 +172,10 @@ public class ClockWidgetService extends IntentService { setNoWeatherData(remoteViews, smallWidget); } } - remoteViews.setViewVisibility(R.id.weather_panel, (showWeather && canFitWeather) ? View.VISIBLE : View.GONE); + remoteViews.setViewVisibility(R.id.update_time, + (showWeather && canFitWeather && canFitTimestamp) ? View.VISIBLE : View.GONE); + remoteViews.setViewVisibility(R.id.weather_panel, + (showWeather && canFitWeather) ? View.VISIBLE : View.GONE); // Resize the clock font if needed if (digitalClock) { |