diff options
author | David van Tonder <david.vantonder@gmail.com> | 2012-06-02 09:27:09 -0400 |
---|---|---|
committer | David van Tonder <david.vantonder@gmail.com> | 2012-06-02 09:53:14 -0400 |
commit | e9fad2d421d6616fd1dd602e18db351fb6e74bd8 (patch) | |
tree | 751bdc771b10f3916a0a0b55902f60d02e099b6c /policy | |
parent | 2038c769746d8453be1e4a10d22a70e8b0d09f89 (diff) | |
download | frameworks_base-e9fad2d421d6616fd1dd602e18db351fb6e74bd8.zip frameworks_base-e9fad2d421d6616fd1dd602e18db351fb6e74bd8.tar.gz frameworks_base-e9fad2d421d6616fd1dd602e18db351fb6e74bd8.tar.bz2 |
Lock screen weather: Simplified 'no-data' layout & refresh indicator
This commit simplifies the no-data layout of the lock screen weather by
replacing confused Cid, adding "No data" text and hiding the temperatures
on the right. It also adds a simple "Refreshing" indicator when the user
taps on the weather panel to refresh.
Screenshots:
Change-Id: Ide0bf3134add99ea0b27b90a36f063c37dddb90b
http://dl.dropbox.com/u/50993944/Screenshot_2012-06-02-08-56-36.png
http://dl.dropbox.com/u/50993944/Screenshot_2012-06-02-09-51-47.png
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java index 4623526..a9e61d6 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java @@ -89,8 +89,8 @@ class KeyguardStatusViewManager implements OnClickListener { private TextView mOwnerInfoView; private TextView mAlarmStatusView; private TransportControlView mTransportView; - private RelativeLayout mWeatherPanel; - private TextView mWeatherCity, mWeatherCondition, mWeatherLowHigh, mWeatherTemp, mUpdateTime; + private RelativeLayout mWeatherPanel, mWeatherTempsPanel; + private TextView mWeatherCity, mWeatherCondition, mWeatherLowHigh, mWeatherTemp, mWeatherUpdateTime; private ImageView mWeatherImage; private LinearLayout mCalendarPanel; private TextView mCalendarEventTitle, mCalendarEventDetails; @@ -211,7 +211,8 @@ class KeyguardStatusViewManager implements OnClickListener { mWeatherImage = (ImageView) findViewById(R.id.weather_image); mWeatherTemp = (TextView) findViewById(R.id.weather_temp); mWeatherLowHigh = (TextView) findViewById(R.id.weather_low_high); - mUpdateTime = (TextView) findViewById(R.id.update_time); + mWeatherUpdateTime = (TextView) findViewById(R.id.update_time); + mWeatherTempsPanel = (RelativeLayout) findViewById(R.id.weather_temps_panel); // Hide Weather panel view until we know we need to show it. if (mWeatherPanel != null) { @@ -361,6 +362,7 @@ class KeyguardStatusViewManager implements OnClickListener { private void refreshWeather() { final ContentResolver resolver = getContext().getContentResolver(); boolean showWeather = Settings.System.getInt(resolver,Settings.System.LOCKSCREEN_WEATHER, 0) == 1; + if (showWeather) { final long interval = Settings.System.getLong(resolver, Settings.System.WEATHER_UPDATE_INTERVAL, 60); // Default to hourly @@ -395,27 +397,6 @@ class KeyguardStatusViewManager implements OnClickListener { Settings.System.WEATHER_INVERT_LOWHIGH, 0) == 1; if (mWeatherPanel != null) { - if (mWeatherCity != null) { - mWeatherCity.setText(w.city); - mWeatherCity.setVisibility(showLocation ? View.VISIBLE : View.GONE); - } - if (mWeatherCondition != null) { - mWeatherCondition.setText(w.condition); - } - if (mUpdateTime != null) { - Date lastTime = new Date(mWeatherInfo.last_sync); - String date = DateFormat.getDateFormat(getContext()).format(lastTime); - String time = DateFormat.getTimeFormat(getContext()).format(lastTime); - mUpdateTime.setText(date + " " + time); - mUpdateTime.setVisibility(showTimestamp ? View.VISIBLE : View.GONE); - } - if (mWeatherTemp != null) { - mWeatherTemp.setText(w.temp); - } - if (mWeatherLowHigh != null) { - mWeatherLowHigh.setText(invertLowhigh ? w.high + " | " + w.low : w.low + " | " + w.high); - } - if (mWeatherImage != null) { String conditionCode = w.condition_code; String condition_filename = "weather_" + conditionCode; @@ -431,6 +412,26 @@ class KeyguardStatusViewManager implements OnClickListener { mWeatherImage.setImageResource(R.drawable.weather_na); } } + if (mWeatherCity != null) { + mWeatherCity.setText(w.city); + mWeatherCity.setVisibility(showLocation ? View.VISIBLE : View.GONE); + } + if (mWeatherCondition != null) { + mWeatherCondition.setText(w.condition); + mWeatherCondition.setVisibility(View.VISIBLE); + } + if (mWeatherUpdateTime != null) { + Date lastTime = new Date(mWeatherInfo.last_sync); + String date = DateFormat.getDateFormat(getContext()).format(lastTime); + String time = DateFormat.getTimeFormat(getContext()).format(lastTime); + mWeatherUpdateTime.setText(date + " " + time); + mWeatherUpdateTime.setVisibility(showTimestamp ? View.VISIBLE : View.GONE); + } + if (mWeatherTempsPanel != null && mWeatherTemp != null && mWeatherLowHigh != null) { + mWeatherTemp.setText(w.temp); + mWeatherLowHigh.setText(invertLowhigh ? w.high + " | " + w.low : w.low + " | " + w.high); + mWeatherTempsPanel.setVisibility(View.VISIBLE); + } // Show the Weather panel view mWeatherPanel.setVisibility(View.VISIBLE); @@ -442,29 +443,23 @@ class KeyguardStatusViewManager implements OnClickListener { * 'Tap to reload' message */ private void setNoWeatherData() { - final ContentResolver resolver = getContext().getContentResolver(); - boolean useMetric = Settings.System.getInt(resolver, - Settings.System.WEATHER_USE_METRIC, 1) == 1; if (mWeatherPanel != null) { + if (mWeatherImage != null) { + mWeatherImage.setImageResource(R.drawable.weather_na); + } if (mWeatherCity != null) { - mWeatherCity.setText("CM Weather"); //Hard coding this on purpose + mWeatherCity.setText(R.string.weather_no_data); mWeatherCity.setVisibility(View.VISIBLE); } if (mWeatherCondition != null) { mWeatherCondition.setText(R.string.weather_tap_to_refresh); } - if (mUpdateTime != null) { - mUpdateTime.setVisibility(View.GONE); - } - if (mWeatherTemp != null) { - mWeatherTemp.setText(useMetric ? "0°c" : "0°f"); + if (mWeatherUpdateTime != null) { + mWeatherUpdateTime.setVisibility(View.GONE); } - if (mWeatherLowHigh != null) { - mWeatherLowHigh.setText("0° | 0°"); - } - if (mWeatherImage != null) { - mWeatherImage.setImageResource(R.drawable.weather_na_cid); + if (mWeatherTempsPanel != null ) { + mWeatherTempsPanel.setVisibility(View.GONE); } // Show the Weather panel view @@ -1016,6 +1011,11 @@ class KeyguardStatusViewManager implements OnClickListener { if (v == mEmergencyCallButton) { mCallback.takeEmergencyCallAction(); } else if (v == mWeatherPanel) { + // Indicate we are refreshing + if (mWeatherCondition != null) { + mWeatherCondition.setText(R.string.weather_refreshing); + } + mCallback.pokeWakelock(); if (!mHandler.hasMessages(QUERY_WEATHER)) { mHandler.sendEmptyMessage(QUERY_WEATHER); |