diff options
author | DvTonder <david.vantonder@gmail.com> | 2016-06-06 22:20:38 -0400 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2016-06-07 12:00:02 +0200 |
commit | e28037aa89b5a7328d986f8001665ef41bf2309d (patch) | |
tree | 337a71739963bdc73de45894e6590ec6af7df09d /src | |
parent | fc8ea240f806aa9c16bc92056db3b158f1480755 (diff) | |
download | android_packages_apps_LockClock-e28037aa89b5a7328d986f8001665ef41bf2309d.tar.gz android_packages_apps_LockClock-e28037aa89b5a7328d986f8001665ef41bf2309d.tar.bz2 android_packages_apps_LockClock-e28037aa89b5a7328d986f8001665ef41bf2309d.zip |
Handle >5 forecast items in cLock Forecast view
Change-Id: Ifd4891b990d89d1a4c535a3efb9c3db39eae7aab
Diffstat (limited to 'src')
-rw-r--r-- | src/com/cyanogenmod/lockclock/weather/ForecastBuilder.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/com/cyanogenmod/lockclock/weather/ForecastBuilder.java b/src/com/cyanogenmod/lockclock/weather/ForecastBuilder.java index 4bb2b84..ed52688 100644 --- a/src/com/cyanogenmod/lockclock/weather/ForecastBuilder.java +++ b/src/com/cyanogenmod/lockclock/weather/ForecastBuilder.java @@ -186,8 +186,14 @@ public class ForecastBuilder { TimeZone MyTimezone = TimeZone.getDefault(); Calendar calendar = new GregorianCalendar(MyTimezone); int weatherTempUnit = w.getTemperatureUnit(); - // Iterate through the forecasts - for (DayForecast d : forecasts) { + int numForecasts = forecasts.size(); + int itemSidePadding = context.getResources().getDimensionPixelSize( + R.dimen.forecast_item_padding_side); + + // Iterate through the Forecasts + for (int count = 0; count < numForecasts; count ++) { + DayForecast d = forecasts.get(count); + // Load the views View forecastItem = inflater.inflate(R.layout.forecast_item, null); @@ -230,6 +236,13 @@ public class ForecastBuilder { // Add the view smallPanel.addView(forecastItem, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1)); + + // Add a divider to the right for all but the last view + if (count < numForecasts - 1) { + View divider = new View(context); + smallPanel.addView(divider, new LinearLayout.LayoutParams( + itemSidePadding, LinearLayout.LayoutParams.MATCH_PARENT)); + } } return true; } |