Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5852c191 authored by Daniel Bateman's avatar Daniel Bateman Committed by Gerrit Code Review
Browse files

Lockscreen: Move weather request into thread

Change-Id: I938d2d734f7e584af42f5b71c68771305ba7006a
parent 166f6b96
Loading
Loading
Loading
Loading
+15 −17
Original line number Diff line number Diff line
@@ -340,9 +340,19 @@ class KeyguardStatusViewManager implements OnClickListener {
                                e.printStackTrace();
                            }
                        }
                        if (DEBUG) {
                            Log.d(TAG, "Location code is " + woeid);
                        }
                        WeatherInfo w = null;
                        if (woeid != null) {
                            try {
                                w = parseXml(getDocument(woeid));
                            } catch (Exception e) {
                            }
                        }
                        Message msg = Message.obtain();
                        msg.what = UPDATE_WEATHER;
                        msg.obj = woeid;
                        msg.obj = w;
                        mHandler.sendMessage(msg);
                    }
                });
@@ -351,23 +361,11 @@ class KeyguardStatusViewManager implements OnClickListener {
                queryWeather.start();
                break;
            case UPDATE_WEATHER:
                String woeid = (String) msg.obj;
                if (woeid != null) {
                    if (DEBUG) {
                        Log.d(TAG, "Location code is " + woeid);
                    }
                    WeatherInfo w = null;
                    try {
                        w = parseXml(getDocument(woeid));
                    } catch (Exception e) {
                    }
                WeatherInfo w = (WeatherInfo) msg.obj;
                if (w != null) {
                    mWeatherRefreshing = false;
                    if (w == null) {
                        setNoWeatherData();
                    } else {
                    setWeatherData(w);
                    mWeatherInfo = w;
                    }
                } else {
                    mWeatherRefreshing = false;
                    if (mWeatherInfo.temp.equals(WeatherInfo.NODATA)) {