[6.4.5]
[fea] [线路缓存]
This commit is contained in:
@@ -4,6 +4,8 @@ import android.content.Context;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.JsonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.och.offline.R;
|
||||
@@ -20,6 +22,7 @@ public class BusLineModel {
|
||||
private static volatile BusLineModel sInstance;
|
||||
private Context mContext;
|
||||
private IBusLinesCallback mBusLinesCallback;
|
||||
private static final String Catche4AllLines = "Catche4AllLines";
|
||||
public static BusLineModel getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( BusLineModel.class ) {
|
||||
@@ -40,6 +43,11 @@ public class BusLineModel {
|
||||
mBusLinesCallback = callback;
|
||||
}
|
||||
public void queryBusLines(){
|
||||
String catche4AllLines = SharedPrefsMgr.getInstance().getString(Catche4AllLines);
|
||||
BindLineListResponse bindLineListResponse = GsonUtils.fromJson(catche4AllLines, BindLineListResponse.class);
|
||||
if(bindLineListResponse!=null){
|
||||
mBusLinesCallback.onBusLinesChange(bindLineListResponse);
|
||||
}
|
||||
OrderServiceManager.queryBindLineListBySn(new OchCommonServiceCallback<BindLineListResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BindLineListResponse data) {
|
||||
@@ -50,6 +58,7 @@ public class BusLineModel {
|
||||
|
||||
if (mBusLinesCallback != null){
|
||||
mBusLinesCallback.onBusLinesChange(data);
|
||||
SharedPrefsMgr.getInstance().putString(Catche4AllLines, GsonUtils.toJson(data));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,11 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
initDatas()
|
||||
}
|
||||
|
||||
@@ -119,7 +124,6 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
||||
showNoData(true)
|
||||
return
|
||||
}
|
||||
val lastCommitLineid = SharedPrefsMgr.getInstance().getInt(LASTCOMMITLINEID, -1)
|
||||
if (data.data != null && data.data.size > 0) {
|
||||
showNoData(false)
|
||||
mData.clear()
|
||||
|
||||
Reference in New Issue
Block a user