From c98ba511cbc433951f787ca9e9bd4472c18e4ab8 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Fri, 4 Dec 2009 14:20:18 -0500 Subject: [PATCH] Fix http://b/2305223 When placed into night mode (dim mode), the DeskClock must restore full brightness any time the user returns to it from another activity. There are two reasons for this: 1. The other activity won't be dim, so it's sort of jarring to return to an almost-black screen. 2. As indicated in bug 2305223, visiting another activity is a useful way to restore the display if it's so dark that you can't see it to find the nightmode toggle button (e.g., ambient lighting is very bright). --- src/com/android/deskclock/DeskClock.java | 37 +++++++++++--------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/src/com/android/deskclock/DeskClock.java b/src/com/android/deskclock/DeskClock.java index 1471c41..3cfcc38 100644 --- a/src/com/android/deskclock/DeskClock.java +++ b/src/com/android/deskclock/DeskClock.java @@ -389,35 +389,21 @@ public class DeskClock extends Activity { mWeatherIconDrawable = mGenieResources.getDrawable(cur.getInt( cur.getColumnIndexOrThrow("iconResId"))); - + mWeatherCurrentTemperatureString = String.format("%d\u00b0", + (cur.getInt(cur.getColumnIndexOrThrow("temperature")))); + mWeatherHighTemperatureString = String.format("%d\u00b0", + (cur.getInt(cur.getColumnIndexOrThrow("highTemperature")))); + mWeatherLowTemperatureString = String.format("%d\u00b0", + (cur.getInt(cur.getColumnIndexOrThrow("lowTemperature")))); mWeatherLocationString = cur.getString( cur.getColumnIndexOrThrow("location")); - - // any of these may be NULL - final int colTemp = cur.getColumnIndexOrThrow("temperature"); - final int colHigh = cur.getColumnIndexOrThrow("highTemperature"); - final int colLow = cur.getColumnIndexOrThrow("lowTemperature"); - - mWeatherCurrentTemperatureString = - cur.isNull(colTemp) - ? "\u2014" - : String.format("%d\u00b0", cur.getInt(colTemp)); - mWeatherHighTemperatureString = - cur.isNull(colHigh) - ? "\u2014" - : String.format("%d\u00b0", cur.getInt(colHigh)); - mWeatherLowTemperatureString = - cur.isNull(colLow) - ? "\u2014" - : String.format("%d\u00b0", cur.getInt(colLow)); } else { Log.w(LOG_TAG, "No weather information available (cur=" + cur +")"); mWeatherIconDrawable = null; + mWeatherHighTemperatureString = ""; + mWeatherLowTemperatureString = ""; mWeatherLocationString = getString(R.string.weather_fetch_failure); - mWeatherCurrentTemperatureString = - mWeatherHighTemperatureString = - mWeatherLowTemperatureString = ""; } mHandy.sendEmptyMessage(UPDATE_WEATHER_DISPLAY_MSG); @@ -515,7 +501,6 @@ public class DeskClock extends Activity { if (mDimmed) { winParams.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; winParams.dimAmount = DIM_BEHIND_AMOUNT_DIMMED; - winParams.buttonBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_OFF; // show the window tint tintView.startAnimation(AnimationUtils.loadAnimation(this, @@ -524,7 +509,6 @@ public class DeskClock extends Activity { } else { winParams.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN); winParams.dimAmount = DIM_BEHIND_AMOUNT_NORMAL; - winParams.buttonBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE; // hide the window tint tintView.startAnimation(AnimationUtils.loadAnimation(this, @@ -556,7 +540,10 @@ public class DeskClock extends Activity { am.setRepeating(AlarmManager.RTC, today.getTimeInMillis(), AlarmManager.INTERVAL_DAY, mMidnightIntent); registerReceiver(mIntentReceiver, filter); - doDim(false); // un-dim when resuming + // un-dim when resuming + mDimmed = false; + doDim(false); + restoreScreen(); // disable screen saver refreshAll(); // will schedule periodic weather fetch -- 2.11.0