This commit is contained in:
2021-03-04 21:36:39 +08:00
parent ebe720b2f7
commit 866b81ca58
3 changed files with 132 additions and 58 deletions

View File

@@ -133,64 +133,64 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
.init();
initView();
RegisterUser user = Config.getInstance(MainTabActivity.this).getUser();
Map<String, String> map = new HashMap<>();
if (user != null) {
map.put("userid", user.getUserid());
} else {
map.put("userid", 0 + "");
}
map.put("app", "Cas");
map.put("class", "MyHouseList");
//map.put("home_id", "GetHomeByPid");
map.put("sign", Md5.md5("Cas" + "MyHouseList" + Md5.secret));
getGankList(ApiConfig.BASE_URL, map, getResources().getString(R.string.requsting), 0);
// RegisterUser user = Config.getInstance(MainTabActivity.this).getUser();
// Map<String, String> map = new HashMap<>();
// if (user != null) {
// map.put("userid", user.getUserid());
// } else {
// map.put("userid", 0 + "");
// }
// map.put("app", "Cas");
// map.put("class", "MyHouseList");
// //map.put("home_id", "GetHomeByPid");
// map.put("sign", Md5.md5("Cas" + "MyHouseList" + Md5.secret));
// getGankList(ApiConfig.BASE_URL, map, getResources().getString(R.string.requsting), 0);
}
private void getGankList(String myurl, Map<String, String> map, String msg, final int requstecode) {
// progressDialog.setMessage(msg);
// progressDialog.setCancelable(false);
// progressDialog.show();
mGankLoader = new Loader();
Subscription subscription = mGankLoader.getMovie(myurl, map).subscribe(new Action1<Resultcode>() {
@Override
public void call(Resultcode resultcode) {
progressDialog.dismiss();
if (!(resultcode.status == 0)) {
setToast(resultcode.msg);
}
if (resultcode.status == 0) {
if (requstecode == 0) {
Gson gs = new Gson();
ArrayList<LinkedTreeMap> adta = (ArrayList<LinkedTreeMap>) resultcode.data;
String s = gs.toJson(adta);
//final ArrayList<MyHomequEntity> list = null;
Type type = new TypeToken<ArrayList<MyHouseEntity>>() {
}.getType();
final ArrayList<MyHouseEntity> list = new Gson().fromJson(s, type);
if(list.size()==0){
SPUtils.setSP(MainTabActivity.this, DoConfig.FANGCHAN_DATA, "0");
}else {
SPUtils.setSP(MainTabActivity.this, DoConfig.FANGCHAN_DATA, "1");
}
}
}
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
progressDialog.dismiss();
setToast(getString(R.string.getdatafailure));
throwable.printStackTrace();
}
});
addSubscription(subscription);
}
// private void getGankList(String myurl, Map<String, String> map, String msg, final int requstecode) {
//// progressDialog.setMessage(msg);
//// progressDialog.setCancelable(false);
//// progressDialog.show();
// mGankLoader = new Loader();
// Subscription subscription = mGankLoader.getMovie(myurl, map).subscribe(new Action1<Resultcode>() {
// @Override
// public void call(Resultcode resultcode) {
// progressDialog.dismiss();
//
// if (!(resultcode.status == 0)) {
// setToast(resultcode.msg);
// }
// if (resultcode.status == 0) {
// if (requstecode == 0) {
// Gson gs = new Gson();
// ArrayList<LinkedTreeMap> adta = (ArrayList<LinkedTreeMap>) resultcode.data;
// String s = gs.toJson(adta);
// //final ArrayList<MyHomequEntity> list = null;
// Type type = new TypeToken<ArrayList<MyHouseEntity>>() {
// }.getType();
// final ArrayList<MyHouseEntity> list = new Gson().fromJson(s, type);
// if(list.size()==0){
// SPUtils.setSP(MainTabActivity.this, DoConfig.FANGCHAN_DATA, "0");
// }else {
// SPUtils.setSP(MainTabActivity.this, DoConfig.FANGCHAN_DATA, "1");
// }
// }
// }
// }
//
// }, new Action1<Throwable>() {
// @Override
// public void call(Throwable throwable) {
// progressDialog.dismiss();
// setToast(getString(R.string.getdatafailure));
// throwable.printStackTrace();
// }
// });
//
// addSubscription(subscription);
// }
@SuppressLint("MissingSuperCall")