d
This commit is contained in:
@@ -3,6 +3,7 @@ package com.sl.house_property;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
@@ -10,8 +11,11 @@ import android.widget.Toast;
|
||||
import com.cutil.RegexUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.internal.LinkedTreeMap;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sl.house_property.databinding.ActivityLoginBinding;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -23,6 +27,7 @@ import http.ApiConfig;
|
||||
import rx.Subscription;
|
||||
import rx.functions.Action1;
|
||||
import utils.Md5;
|
||||
import utils.SPUtils;
|
||||
|
||||
public class LoginActivity extends BaseActivity<ActivityLoginBinding> implements View.OnClickListener {
|
||||
|
||||
@@ -131,11 +136,22 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding> implements
|
||||
RegisterUser user = gs.fromJson(s, RegisterUser.class);//把JSON字符串转为对象
|
||||
Config.getInstance(LoginActivity.this).putUser(user);
|
||||
Config.getInstance(LoginActivity.this).put("username", mDataBinding.phone.getText().toString().trim());
|
||||
if (!Config.getInstance(LoginActivity.this).getBoolean("MainTabActivity", false)) {
|
||||
Intent intent = new Intent(LoginActivity.this, MainTabActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (user != null) {
|
||||
map.put("userid", user.getUserid());
|
||||
} else {
|
||||
map.put("userid", 0 + "");
|
||||
}
|
||||
finish();
|
||||
map.put("app", "Cas");
|
||||
map.put("class", "MyHouseList");
|
||||
//map.put("home_id", "GetHomeByPid");
|
||||
map.put("sign", Md5.md5("Cas" + "MyHouseList" + Md5.secret));
|
||||
getpammar(ApiConfig.BASE_URL, map, getResources().getString(R.string.requsting), 0);
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -155,4 +171,58 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding> implements
|
||||
addSubscription(subscription);
|
||||
}
|
||||
|
||||
|
||||
private void getpammar(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(LoginActivity.this, DoConfig.FANGCHAN_DATA, "0");
|
||||
Log.e("fuzhi","0");
|
||||
}else {
|
||||
SPUtils.setSP(LoginActivity.this, DoConfig.FANGCHAN_DATA, "1");
|
||||
Log.e("fuzhi","1");
|
||||
|
||||
}
|
||||
if (!Config.getInstance(LoginActivity.this).getBoolean("MainTabActivity", false)) {
|
||||
Intent intent = new Intent(LoginActivity.this, MainTabActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
setToast(getString(R.string.getdatafailure));
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
addSubscription(subscription);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -156,6 +156,8 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
map.put("sign", Md5.md5("Advert" + "Advertr_an_AdvertHomeList" + Md5.secret));
|
||||
getGankList(ApiConfig.BASE_URL, map, getResources().getString(R.string.requsting), 0, false);
|
||||
user = user1;
|
||||
page=1;
|
||||
getlist(page);
|
||||
}
|
||||
;
|
||||
}
|
||||
@@ -370,6 +372,8 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
}
|
||||
|
||||
Intent intent = new Intent(getContext(), HistoryRecordActivity.class);
|
||||
final RegisterUser user =
|
||||
Config.getInstance(getActivity()).getUser();
|
||||
intent.putExtra("userId", user.getUserid());
|
||||
intent.putExtra("userName", user.getNickname());
|
||||
intent.putExtra("title", "物业服务");
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user