Loading policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java +12 −4 Original line number Diff line number Diff line Loading @@ -290,6 +290,7 @@ class KeyguardStatusViewManager implements OnClickListener { private static WeatherInfo mWeatherInfo = new WeatherInfo(); private static final int QUERY_WEATHER = 0; private static final int UPDATE_WEATHER = 1; private boolean mWeatherRefreshing; private Handler mHandler = new Handler() { @Override Loading Loading @@ -345,6 +346,7 @@ class KeyguardStatusViewManager implements OnClickListener { mHandler.sendMessage(msg); } }); mWeatherRefreshing = true; queryWeather.setPriority(Thread.MIN_PRIORITY); queryWeather.start(); break; Loading @@ -359,6 +361,7 @@ class KeyguardStatusViewManager implements OnClickListener { w = parseXml(getDocument(woeid)); } catch (Exception e) { } mWeatherRefreshing = false; if (w == null) { setNoWeatherData(); } else { Loading @@ -366,6 +369,7 @@ class KeyguardStatusViewManager implements OnClickListener { mWeatherInfo = w; } } else { mWeatherRefreshing = false; if (mWeatherInfo.temp.equals(WeatherInfo.NODATA)) { setNoWeatherData(); } else { Loading @@ -389,7 +393,9 @@ class KeyguardStatusViewManager implements OnClickListener { Settings.System.WEATHER_UPDATE_INTERVAL, 60); // Default to hourly boolean manualSync = (interval == 0); if (!manualSync && (((System.currentTimeMillis() - mWeatherInfo.last_sync) / 60000) >= interval)) { if (!mWeatherRefreshing) { mHandler.sendEmptyMessage(QUERY_WEATHER); } } else if (manualSync && mWeatherInfo.last_sync == 0) { setNoWeatherData(); } else { Loading Loading @@ -437,7 +443,7 @@ class KeyguardStatusViewManager implements OnClickListener { mWeatherCity.setText(w.city); mWeatherCity.setVisibility(showLocation ? View.VISIBLE : View.GONE); } if (mWeatherCondition != null) { if (mWeatherCondition != null && !mWeatherRefreshing) { mWeatherCondition.setText(w.condition); mWeatherCondition.setVisibility(View.VISIBLE); } Loading Loading @@ -476,7 +482,7 @@ class KeyguardStatusViewManager implements OnClickListener { mWeatherCity.setText(R.string.weather_no_data); mWeatherCity.setVisibility(View.VISIBLE); } if (mWeatherCondition != null) { if (mWeatherCondition != null && !mWeatherRefreshing) { mWeatherCondition.setText(R.string.weather_tap_to_refresh); } if (mWeatherUpdateTime != null) { Loading Loading @@ -666,6 +672,7 @@ class KeyguardStatusViewManager implements OnClickListener { if (mDigitalClock != null) { mDigitalClock.updateTime(); } refreshWeather(); mUpdateMonitor.registerInfoCallback(mInfoCallback); mUpdateMonitor.registerSimStateCallback(mSimStateCallback); Loading Loading @@ -1020,6 +1027,7 @@ class KeyguardStatusViewManager implements OnClickListener { @Override public void onTimeChanged() { refreshDate(); refreshWeather(); } @Override Loading Loading @@ -1054,7 +1062,7 @@ class KeyguardStatusViewManager implements OnClickListener { } mCallback.pokeWakelock(); if (!mHandler.hasMessages(QUERY_WEATHER)) { if (!mWeatherRefreshing) { mHandler.sendEmptyMessage(QUERY_WEATHER); } } Loading Loading
policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java +12 −4 Original line number Diff line number Diff line Loading @@ -290,6 +290,7 @@ class KeyguardStatusViewManager implements OnClickListener { private static WeatherInfo mWeatherInfo = new WeatherInfo(); private static final int QUERY_WEATHER = 0; private static final int UPDATE_WEATHER = 1; private boolean mWeatherRefreshing; private Handler mHandler = new Handler() { @Override Loading Loading @@ -345,6 +346,7 @@ class KeyguardStatusViewManager implements OnClickListener { mHandler.sendMessage(msg); } }); mWeatherRefreshing = true; queryWeather.setPriority(Thread.MIN_PRIORITY); queryWeather.start(); break; Loading @@ -359,6 +361,7 @@ class KeyguardStatusViewManager implements OnClickListener { w = parseXml(getDocument(woeid)); } catch (Exception e) { } mWeatherRefreshing = false; if (w == null) { setNoWeatherData(); } else { Loading @@ -366,6 +369,7 @@ class KeyguardStatusViewManager implements OnClickListener { mWeatherInfo = w; } } else { mWeatherRefreshing = false; if (mWeatherInfo.temp.equals(WeatherInfo.NODATA)) { setNoWeatherData(); } else { Loading @@ -389,7 +393,9 @@ class KeyguardStatusViewManager implements OnClickListener { Settings.System.WEATHER_UPDATE_INTERVAL, 60); // Default to hourly boolean manualSync = (interval == 0); if (!manualSync && (((System.currentTimeMillis() - mWeatherInfo.last_sync) / 60000) >= interval)) { if (!mWeatherRefreshing) { mHandler.sendEmptyMessage(QUERY_WEATHER); } } else if (manualSync && mWeatherInfo.last_sync == 0) { setNoWeatherData(); } else { Loading Loading @@ -437,7 +443,7 @@ class KeyguardStatusViewManager implements OnClickListener { mWeatherCity.setText(w.city); mWeatherCity.setVisibility(showLocation ? View.VISIBLE : View.GONE); } if (mWeatherCondition != null) { if (mWeatherCondition != null && !mWeatherRefreshing) { mWeatherCondition.setText(w.condition); mWeatherCondition.setVisibility(View.VISIBLE); } Loading Loading @@ -476,7 +482,7 @@ class KeyguardStatusViewManager implements OnClickListener { mWeatherCity.setText(R.string.weather_no_data); mWeatherCity.setVisibility(View.VISIBLE); } if (mWeatherCondition != null) { if (mWeatherCondition != null && !mWeatherRefreshing) { mWeatherCondition.setText(R.string.weather_tap_to_refresh); } if (mWeatherUpdateTime != null) { Loading Loading @@ -666,6 +672,7 @@ class KeyguardStatusViewManager implements OnClickListener { if (mDigitalClock != null) { mDigitalClock.updateTime(); } refreshWeather(); mUpdateMonitor.registerInfoCallback(mInfoCallback); mUpdateMonitor.registerSimStateCallback(mSimStateCallback); Loading Loading @@ -1020,6 +1027,7 @@ class KeyguardStatusViewManager implements OnClickListener { @Override public void onTimeChanged() { refreshDate(); refreshWeather(); } @Override Loading Loading @@ -1054,7 +1062,7 @@ class KeyguardStatusViewManager implements OnClickListener { } mCallback.pokeWakelock(); if (!mHandler.hasMessages(QUERY_WEATHER)) { if (!mWeatherRefreshing) { mHandler.sendEmptyMessage(QUERY_WEATHER); } } Loading