diff options
-rw-r--r-- | core/res/res/drawable-hdpi/weather_na_cid.png | bin | 4346 -> 0 bytes | |||
-rw-r--r-- | core/res/res/drawable-mdpi/weather_na_cid.png | bin | 2938 -> 0 bytes | |||
-rw-r--r-- | core/res/res/drawable-xhdpi/weather_na_cid.png | bin | 4124 -> 0 bytes | |||
-rw-r--r-- | core/res/res/layout-sw600dp/keyguard_screen_status_land.xml | 1 | ||||
-rw-r--r-- | core/res/res/layout-sw600dp/keyguard_screen_status_port.xml | 1 | ||||
-rw-r--r-- | core/res/res/layout/keyguard_screen_tab_unlock.xml | 3 | ||||
-rw-r--r-- | core/res/res/layout/keyguard_screen_tab_unlock_land.xml | 1 | ||||
-rwxr-xr-x | core/res/res/values/strings.xml | 2 | ||||
-rw-r--r-- | policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java | 76 |
9 files changed, 45 insertions, 39 deletions
diff --git a/core/res/res/drawable-hdpi/weather_na_cid.png b/core/res/res/drawable-hdpi/weather_na_cid.png Binary files differdeleted file mode 100644 index 92759cb..0000000 --- a/core/res/res/drawable-hdpi/weather_na_cid.png +++ /dev/null diff --git a/core/res/res/drawable-mdpi/weather_na_cid.png b/core/res/res/drawable-mdpi/weather_na_cid.png Binary files differdeleted file mode 100644 index 52f4e27..0000000 --- a/core/res/res/drawable-mdpi/weather_na_cid.png +++ /dev/null diff --git a/core/res/res/drawable-xhdpi/weather_na_cid.png b/core/res/res/drawable-xhdpi/weather_na_cid.png Binary files differdeleted file mode 100644 index daa2bfb..0000000 --- a/core/res/res/drawable-xhdpi/weather_na_cid.png +++ /dev/null diff --git a/core/res/res/layout-sw600dp/keyguard_screen_status_land.xml b/core/res/res/layout-sw600dp/keyguard_screen_status_land.xml index c65d019..b8acc9c 100644 --- a/core/res/res/layout-sw600dp/keyguard_screen_status_land.xml +++ b/core/res/res/layout-sw600dp/keyguard_screen_status_land.xml @@ -101,6 +101,7 @@ </RelativeLayout> <RelativeLayout + android:id="@+id/weather_temps_panel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/weather_image" diff --git a/core/res/res/layout-sw600dp/keyguard_screen_status_port.xml b/core/res/res/layout-sw600dp/keyguard_screen_status_port.xml index 6d313df..ea461d2 100644 --- a/core/res/res/layout-sw600dp/keyguard_screen_status_port.xml +++ b/core/res/res/layout-sw600dp/keyguard_screen_status_port.xml @@ -103,6 +103,7 @@ </RelativeLayout> <RelativeLayout + android:id="@+id/weather_temps_panel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/weather_image" diff --git a/core/res/res/layout/keyguard_screen_tab_unlock.xml b/core/res/res/layout/keyguard_screen_tab_unlock.xml index 4445588..535188e 100644 --- a/core/res/res/layout/keyguard_screen_tab_unlock.xml +++ b/core/res/res/layout/keyguard_screen_tab_unlock.xml @@ -163,9 +163,10 @@ android:textSize="6sp" android:textColor="?android:attr/textColorSecondary" /> - </RelativeLayout> + </RelativeLayout> <RelativeLayout + android:id="@+id/weather_temps_panel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/weather_image" diff --git a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml index 8ea4f6b..b3b8ef1 100644 --- a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml +++ b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml @@ -163,6 +163,7 @@ </RelativeLayout> <RelativeLayout + android:id="@+id/weather_temps_panel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/weather_image" diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 537926b..7a49539 100755 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3507,6 +3507,8 @@ <string name="weather_NW">NW</string> <!-- Lock screen Weather - error messages --> + <string name="weather_no_data">No data</string> <string name="weather_tap_to_refresh">Tap to refresh</string> + <string name="weather_refreshing">Refreshing</string> </resources> 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); |