d
This commit is contained in:
@@ -6,20 +6,39 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.internal.LinkedTreeMap;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.selectpicker.OptionsPopupWindow;
|
||||
import com.sl.house_property.cart.CartFragment;
|
||||
import com.sl.house_property.databinding.ActivityMainTabBinding;
|
||||
import com.sl.house_property.discovery.DiscoveryFragment;
|
||||
import com.sl.house_property.discovery.LikeFragment;
|
||||
import com.sl.house_property.user.MyPropertyActivity;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import entity.MyHomequEntity;
|
||||
import entity.RegisterUser;
|
||||
import entity.SimpleEntity;
|
||||
import http.ApiConfig;
|
||||
import my_loader.Loader;
|
||||
import my_loader.Resultcode;
|
||||
import rx.Subscription;
|
||||
import rx.functions.Action1;
|
||||
import tools.Config;
|
||||
import utils.Md5;
|
||||
import utils.SPUtils;
|
||||
|
||||
public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
implements View.OnClickListener,
|
||||
@@ -49,7 +68,7 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
|
||||
private int myeditcode = 1000;
|
||||
|
||||
|
||||
private Loader mGankLoader;
|
||||
private int nowradioId;
|
||||
|
||||
// @Override
|
||||
@@ -113,6 +132,64 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
// | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) //软键盘自动弹出
|
||||
.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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user