diff --git a/app/app.iml b/app/app.iml index 6c6ed3f..7f0efb4 100644 --- a/app/app.iml +++ b/app/app.iml @@ -65,14 +65,6 @@ - - - - - - - - @@ -81,6 +73,14 @@ + + + + + + + + diff --git a/app/src/main/java/com/xiecc/seeWeather/modules/main/ui/MainActivity.java b/app/src/main/java/com/xiecc/seeWeather/modules/main/ui/MainActivity.java index ba9b1ac..bba2811 100644 --- a/app/src/main/java/com/xiecc/seeWeather/modules/main/ui/MainActivity.java +++ b/app/src/main/java/com/xiecc/seeWeather/modules/main/ui/MainActivity.java @@ -48,7 +48,6 @@ import com.xiecc.seeWeather.base.BaseActivity; import com.xiecc.seeWeather.base.C; import com.xiecc.seeWeather.common.PLog; import com.xiecc.seeWeather.common.utils.CheckVersion; -import com.xiecc.seeWeather.common.utils.RxUtils; import com.xiecc.seeWeather.common.utils.Util; import com.xiecc.seeWeather.component.ImageLoader; import com.xiecc.seeWeather.component.RetrofitSingleton; @@ -324,7 +323,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig @Override public void onError(Throwable e) { - + PLog.e(e.toString()); } @Override @@ -382,10 +381,9 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig */ private Observable fetchDataByCache() { return Observable.defer(() -> { - Weather weather = (Weather) aCache.getAsObject(C.WEATHER_CACHE); - return Observable.just(weather); - } - ).compose(RxUtils.rxSchedulerHelper()); + Weather weather = (Weather) aCache.getAsObject(C.WEATHER_CACHE); + return Observable.just(weather); + }); } /** @@ -394,7 +392,12 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig private Observable fetchDataByNetWork() { String cityName = Util.replaceCity(mSetting.getCityName()); return RetrofitSingleton.getInstance() - .fetchWeather(cityName); + .fetchWeather(cityName) + .onErrorReturn(throwable -> { + PLog.e(throwable.getMessage()); + throwable.printStackTrace(); + return null; + }); } private void showFabDialog() {