修复bug

This commit is contained in:
hch 2023-11-02 16:57:17 +08:00
parent ad7ab6bcf2
commit 9c2d488764
18 changed files with 1087 additions and 381 deletions

View File

@ -48,7 +48,9 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.GoogleBean;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.SlideModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
@ -56,6 +58,7 @@ import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.APKManager;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.StringUtil;
@ -242,10 +245,22 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
MainHttpUtil.cancel(MainHttpConsts.GET_BASE_INFO);
}
public void loadData() {
MainHttpUtil.getGoogle(mCallback1);
MainHttpUtil.getBaseInfo(mCallback);
OTONetManager.getInstance(mContext).getBaseInfos(true, new com.yunbao.common.http.base.HttpCallback<com.shayu.onetoone.bean.UserBean>() {
@Override
public void onSuccess(com.shayu.onetoone.bean.UserBean data) {
showData(data.getUser());
}
@Override
public void onError(String error) {
}
});
OTONetManager.getInstance(mContext).getAuthInfo(new com.yunbao.common.http.base.HttpCallback<AuthBean>() {
@Override
public void onSuccess(AuthBean data) {
@ -257,6 +272,7 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
}
});
MainHttpUtil.getBalance(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@ -354,63 +370,58 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
}
};
private CommonCallback<UserBean> mCallback = new CommonCallback<UserBean>() {
@Override
public void callback(UserBean bean) {
/*List<UserItemBean> list = CommonAppConfig.getInstance().getUserItemList();
if (bean != null) {
showData(bean, list);
}*/
private List<SlideModel> mBannerListNew = new ArrayList<>();
showData(bean);
}
};
private List<SlideBean> mBannerListNew = new ArrayList<>();
IMLoginModel userInfo;
@SuppressLint("SetTextI18n")
private void showData(UserBean u) {
private void showData(IMLoginModel u) {
userInfo = u;
mBannerList.clear();
mBannerListNew.clear();
if (u == null) {
if (userInfo == null) {
return;
}
if (!StringUtil.isEmpty(u.getSlide())) {
mBannerListNew.addAll(JSON.parseArray(u.getSlide(), SlideBean.class));
for (SlideBean bean : mBannerListNew) {
if (bean.getSlide_status().equals("1")) {
if (userInfo.getSlide() != null) {
mBannerListNew.addAll(userInfo.getSlide());
for (SlideModel bean : mBannerListNew) {
if (bean.getSlideStatus() == 1) {
mBannerList.add(bean);
}
}
}
if (u.getSex() == 1) {
if (userInfo.getSex() == 1) {
sex.setImageResource(R.mipmap.ic_message_tab_man);
} else {
sex.setImageResource(R.mipmap.ic_message_tab_woman);
}
showBanner();
ImgLoader.displayAvatar(mContext, u.getAvatar(), mAvatar);
mName.setText(u.getUserNiceName());
if (!"0".endsWith(u.getNoble_id())) {
user_noble_text.setText(mContext.getResources().getString(R.string.now_noble) + u.getNoble_name());
user_noble_time.setText(mContext.getResources().getString(R.string.now_noble_time) + u.getNoble_end_time());
if (!userInfo.getAvatar().contains("http")) {
ImgLoader.displayAvatar(mContext, CommonAppConfig.HOST + userInfo.getAvatar(), mAvatar);
} else {
user_noble_text.setText(u.getNoble_name());
ImgLoader.displayAvatar(mContext, userInfo.getAvatar(), mAvatar);
}
mName.setText(userInfo.getUserNicename());
if (!"0".endsWith(String.valueOf(userInfo.getNobleId()))) {
user_noble_text.setText(mContext.getResources().getString(R.string.now_noble) + userInfo.getNobleName());
user_noble_time.setText(mContext.getResources().getString(R.string.now_noble_time) + userInfo.getNobleEndTime());
} else {
user_noble_text.setText(userInfo.getNobleName());
user_noble_time.setText(mContext.getResources().getString(R.string.open_noble_text));
}
String singnature = u.getSignature();
String singnature = userInfo.getSignature();
if (TextUtils.equals(singnature, "這個人很懶,什麼也沒留下") || TextUtils.equals(singnature, "这家伙很懒,什么都没留下") || TextUtils.isEmpty(singnature)) {
singnature = WordUtil.isNewZh() ? "這個人很懶,什麼也沒留下" : "The guy was lazy and didn't write anything.";
}
signature.setText(getResources().getString(R.string.user_sign) + ":" + singnature);
CommonAppConfig appConfig = CommonAppConfig.getInstance();
LevelBean anchorLevelBean = appConfig.getAnchorLevel(u.getLevelAnchor());
LevelBean anchorLevelBean = appConfig.getAnchorLevel(Integer.parseInt(userInfo.getLevelAnchor()));
if (u.getDress().getAvatar_frame() != null) {
if (u.getDress().getAvatar_frame().contains("svga")) {
if (userInfo.getDress().getAvatarFrame() != null) {
if (userInfo.getDress().getAvatarFrame().contains("svga")) {
try {
new SVGAParser(mContext).parse(new URL(u.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() {
new SVGAParser(mContext).parse(new URL(userInfo.getDress().getAvatarFrame()), new SVGAParser.ParseCompletion() {
@Override
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
@ -426,13 +437,13 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
e.printStackTrace();
}
} else {
ImgLoader.display(mContext, u.getDress().getAvatar_frame(), gift_svga);
ImgLoader.display(mContext, userInfo.getDress().getAvatarFrame(), gift_svga);
}
}
if (u.getDress().getMedal() != null) {
Log.e("tag", u.getDress().getMedal());
ImgLoader.display(mContext, u.getDress().getMedal(), user_noble_ico);
if (userInfo.getDress().getMedal() != null) {
Log.e("tag", userInfo.getDress().getMedal());
ImgLoader.display(mContext, userInfo.getDress().getMedal(), user_noble_ico);
} else {
user_noble_ico.setImageResource(R.mipmap.icon_vip_gold);
}
@ -469,12 +480,12 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
}
}*/
//修改靓号图标 个人中心
if (u.getGoodnum() != null && !u.getGoodnum().equals("")) {
if (userInfo.getGoodnum() != null && !userInfo.getGoodnum().equals("")) {
good_nub_ico.setVisibility(View.VISIBLE);
mID.setText("ID:" + u.getGoodnum());
mID.setText("ID:" + userInfo.getGoodnum());
} else {
good_nub_ico.setVisibility(View.GONE);
mID.setText(u.getLiangNameTip());
//good_nub_ico.setVisibility(View.GONE);
//mID.setText(userInfo.getLiangNameTip());
}
if (beanKefu != null) {
@ -483,8 +494,8 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
ImgLoader.display(mContext, beanStetting.getThumb(), img_setting);
tv_setting.setText(beanStetting.getName());
}
Constants.myUid = u.getGoodnum();
Constants.myAvatar = u.getAvatar();
Constants.myUid = userInfo.getGoodnum();
Constants.myAvatar = userInfo.getAvatar();
// if (u.getUserInfoComplete() == 1) {
// findViewById(R.id.complete_information_radius).setVisibility(View.INVISIBLE);
// findViewById(R.id.complete_information).setVisibility(View.INVISIBLE);
@ -666,7 +677,7 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
}
public static List<SlideBean> mBannerList = new ArrayList<>();
public static List<SlideModel> mBannerList = new ArrayList<>();
private void showBanner() {
if (mBannerList == null || mBannerList.size() <= 0 || banner_me == null) {
@ -680,10 +691,10 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
public void onBannerClick(List datas, int p) {
if (mBannerList != null) {
if (p >= 0 && p < mBannerList.size()) {
SlideBean bean = mBannerList.get(p);
if (!bean.getSlide_url().equals("")) {
SlideModel bean = mBannerList.get(p);
if (!bean.getSlideUrl().equals("")) {
Constants.isTitle = true;
String url = bean.getSlide_url() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
String url = bean.getSlideUrl() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
//WebViewActivity.forward(mContext, url, false, false);
RouteManager.forwardWebViewActivity("", url);
}
@ -697,10 +708,10 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
public void onBannerClick(List datas, int p) {
if (mBannerList != null) {
if (p >= 0 && p < mBannerList.size()) {
SlideBean bean = mBannerList.get(p);
if (!bean.getSlide_url().equals("")) {
SlideModel bean = mBannerList.get(p);
if (!bean.getSlideUrl().equals("")) {
Constants.isTitle = true;
String url = bean.getSlide_url() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
String url = bean.getSlideUrl() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
RouteManager.forwardWebViewActivity("", url);
/*if(bean.getSlide_id().equals("95")){
RouteUtil.forwardCustomerService(url);

View File

@ -15,15 +15,12 @@ import com.opensource.svgaplayer.SVGAImageView;
import com.shayu.onetoone.R;
import com.shayu.onetoone.activity.fragments.BaseFragment;
import com.shayu.onetoone.adapter.HomeRankListAdapter;
import com.shayu.onetoone.bean.FollowBean;
import com.shayu.onetoone.bean.HomeRankBean;
import com.shayu.onetoone.listener.OnAppbarListener;
import com.shayu.onetoone.manager.OTONetManager;
import com.shayu.onetoone.utils.UserManager;
import com.yanzhenjie.recyclerview.SwipeRecyclerView;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.ToastUtil;
import java.util.ArrayList;
@ -197,7 +194,9 @@ public class HomeRankFragment extends BaseFragment {
getItem(position, mName1, mName2, mName3).setText(user.getUserNicename());
getItem(position, mVotes1, mVotes2, mVotes3).setText(user.getMoney());
if (user.isFollow()) {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.INVISIBLE);
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.GONE);
} else if (CommonAppConfig.getInstance().getUserBean().getId().equals(user.getId())) {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.GONE);
} else {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.VISIBLE);
}
@ -209,12 +208,30 @@ public class HomeRankFragment extends BaseFragment {
switch (position) {
case 0:
svga1.setImageResource(R.mipmap.ic_home_rank_top_1);
mBtnFollow1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
follow(user, mBtnFollow1);
}
});
break;
case 1:
svga2.setImageResource(R.mipmap.ic_home_rank_top_2);
mBtnFollow2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
follow(user, mBtnFollow2);
}
});
break;
case 2:
svga3.setImageResource(R.mipmap.ic_home_rank_top_3);
mBtnFollow3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
follow(user, mBtnFollow3);
}
});
break;
}
ImgLoader.display(mContext, user.getAvatar(), getItem(position, mAvatar1, mAvatar2, mAvatar3));

View File

@ -168,14 +168,17 @@ public class ChooseLabelActivity extends AbsOTOActivity {
*/
private void setLabel() {
StringBuffer labels = new StringBuffer();
StringBuffer labelNames = new StringBuffer();
for (int i = 0; i < myLabelList.size(); i++) {
if (i == 0) {
labels.append(myLabelList.get(i).getId());
labelNames.append(myLabelList.get(i).getCn_title());
} else {
labels.append("," + myLabelList.get(i).getId());
labelNames.append("," + myLabelList.get(i).getCn_title());
}
}
if (TextUtils.isEmpty(labels)){
if (TextUtils.isEmpty(labels)) {
ToastUtil.show("請設置標籤");
return;
}
@ -185,6 +188,9 @@ public class ChooseLabelActivity extends AbsOTOActivity {
Toast.makeText(mContext, data.getMsg(), Toast.LENGTH_SHORT).show();
if (data.getCode() == 0) {
if (isUserHome) {
Intent intent = new Intent();
intent.putExtra("label", labelNames.toString());
setResult(RESULT_OK, intent);
finish();
} else {
RouteManager.forwardMainActivity();

View File

@ -0,0 +1,476 @@
package com.shayu.onetoone.activity.setting;
import android.app.Dialog;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.webkit.JavascriptInterface;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.DeviceUtils;
import com.fm.openinstall.OpenInstall;
import com.fm.openinstall.listener.AppInstallAdapter;
import com.fm.openinstall.model.AppData;
import com.sahooz.library.Country;
import com.sahooz.library.CountryPicker;
import com.sahooz.library.OnPick;
import com.shayu.onetoone.R;
import com.shayu.onetoone.bean.BindPhoneEvent;
import com.shayu.onetoone.utils.MainHttpConsts;
import com.shayu.onetoone.utils.MainHttpUtil;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.HtmlConfig;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.ToastUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
/**
* 綁定手機號
*/
public class BindUserActivity extends AbsActivity {
private LinearLayout lt_first_bind;
private EditText mEditPhone;
private EditText mEditCode;
private EditText mEditPwd1;
private EditText mEditPwd2;
private TextView mBtnCode;
private View mBtnRegister;
private Handler mHandler;
private static final int TOTAL = 60;
private int mCount = TOTAL;
private String mGetCode;
private String mGetCodeAgain;
private Dialog mDialog;
private boolean mFirstLogin;//是否是第一次登录
private boolean mShowInvite;
private String mPromoCode = "";//推广码
private String mUuidDevice = "";//手机唯一标识符
private int mPhoneMinLength = 5;//输入手机号的最小位数
private TextView mTvCountryCode;
private int mCountryCode = 852;//国家代码
private ImageView mIvCountryCode;
private LinearLayout lt_now_bind, lt_give, lt_password, lt_password2;
private TextView tv_now_phone, tv_title;
private Button btn_goto_updata;
private String isBind = "0", mobile = "";
private WebView webview;
private WebSettings webSettings;
private ArrayList<Country> allCountries = new ArrayList<>();
@Override
protected int getLayoutId() {
return R.layout.activity_bind_user;
}
@Override
protected void main() {
Bus.getOn(this);
// setTitle(mContext.getString(R.string.reg_register));
getPromoCode();
webview = (WebView) findViewById(R.id.webview);
lt_first_bind = (LinearLayout) findViewById(R.id.lt_first_bind);
lt_password = findViewById(R.id.lt_password);
lt_password2 = findViewById(R.id.lt_password2);
mEditPhone = (EditText) findViewById(R.id.edit_phone);
mTvCountryCode = findViewById(R.id.tvCountryCode);
mIvCountryCode = findViewById(R.id.ivCountryCode);
mEditCode = (EditText) findViewById(R.id.edit_code);
mEditPwd1 = (EditText) findViewById(R.id.edit_pwd_1);
mEditPwd2 = (EditText) findViewById(R.id.edit_pwd_2);
mBtnCode = (TextView) findViewById(R.id.btn_code);
mBtnRegister = findViewById(R.id.btn_register);
lt_now_bind = findViewById(R.id.lt_now_bind);
lt_give = findViewById(R.id.lt_give);
tv_now_phone = findViewById(R.id.tv_now_phone);
btn_goto_updata = findViewById(R.id.btn_goto_updata);
tv_title = findViewById(R.id.tv_title);
mGetCode = mContext.getString(R.string.reg_get_code);
mGetCodeAgain = mContext.getString(R.string.reg_get_code_again);
mTvCountryCodeClick();
mEditPhone.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (!TextUtils.isEmpty(s) && s.length() >= mPhoneMinLength) {
mBtnCode.setEnabled(true);
} else {
mBtnCode.setEnabled(false);
}
changeEnable();
}
@Override
public void afterTextChanged(Editable s) {
}
});
TextWatcher textWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
changeEnable();
}
@Override
public void afterTextChanged(Editable s) {
}
};
mEditCode.addTextChangedListener(textWatcher);
mEditPwd1.addTextChangedListener(textWatcher);
mEditPwd2.addTextChangedListener(textWatcher);
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
mCount--;
if (mCount > 0) {
mBtnCode.setText(mGetCodeAgain + "(" + mCount + "s)");
if (mHandler != null) {
mHandler.sendEmptyMessageDelayed(0, 1000);
}
} else {
mBtnCode.setText(mGetCode);
mCount = TOTAL;
if (mBtnCode != null) {
mBtnCode.setEnabled(true);
}
}
}
};
mDialog = DialogUitl.loadingDialog(mContext, getString(R.string.reg_register_ing));
//EventBus.getDefault().register(this);
isBind = getIntent().getStringExtra("isBind");
mobile = getIntent().getStringExtra("mobile");
if ("1".equals(isBind)) {
lt_now_bind.setVisibility(View.VISIBLE);
lt_first_bind.setVisibility(View.GONE);
tv_now_phone.setText(mobile);
} else {
lt_now_bind.setVisibility(View.GONE);
lt_first_bind.setVisibility(View.VISIBLE);
}
webSettings = webview.getSettings();
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
// 禁用缓存
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
// 开启js支持
webSettings.setJavaScriptEnabled(true);
webview.addJavascriptInterface(new JsBridge(), "jsBridge");
// 也可以加载本地html(webView.loadUrl("file:///android_asset/xxx.html"))
webview.loadUrl(CommonAppConfig.HOST + "/h5/live/TCaptcha.html");
allCountries.clear();
allCountries.addAll(Country.getAll(mContext, null));
String ct = IMLoginManager.get(mContext).getString("sys_user_area");
ct = TextUtils.equals("中国", ct) ? "中国香港" : ct;
for (int i = 0; i < allCountries.size(); i++) {
if (allCountries.get(i).chs.equals(ct)) {
String countryName = allCountries.get(i).name;
countryName = countryName.length() > 4 ? countryName.substring(0, 4) : countryName;
mTvCountryCode.setText("+" + allCountries.get(i).code + " " + countryName);
mCountryCode = allCountries.get(i).code;
return;
}
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEditProfileEvent(BindPhoneEvent event) {
}
private void mTvCountryCodeClick() {
mIvCountryCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showCountryCode();
}
});
mTvCountryCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showCountryCode();
}
});
}
private void changeEnable() {
String phone = mEditPhone.getText().toString();
String code = mEditCode.getText().toString();
String pwd1 = mEditPwd1.getText().toString();
String pwd2 = mEditPwd2.getText().toString();
// mBtnRegister.setEnabled(!TextUtils.isEmpty(phone) && !TextUtils.isEmpty(code) && !TextUtils.isEmpty(pwd1) && !TextUtils.isEmpty(pwd2));
}
private void showCountryCode() {
CountryPicker.newInstance(null, new OnPick() {
@Override
public void onPick(Country country) {
String countryName = country.name;
countryName = countryName.length() > 4 ? countryName.substring(0, 4) + "..." : countryName;
mTvCountryCode.setText(" +" + country.code + " " + countryName);
mCountryCode = country.code;
}
}).show(getSupportFragmentManager(), "country");
}
public void registerClick(View v) {
int i = v.getId();
if (i == R.id.btn_code) {
//获取验证码
// getMessageCode();
//获取邀请码
// getPromoCode();
webview.setVisibility(View.VISIBLE);
//获取设备唯一标识符
getUuidDevice();
} else if (i == R.id.btn_register) {
register();
} else if (i == R.id.btn_tip2) {
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY1, false);
} else if (i == R.id.btn_tip3) {
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY2, false);
} else if (i == R.id.btn_goto_updata) {
lt_now_bind.setVisibility(View.GONE);
lt_first_bind.setVisibility(View.VISIBLE);
lt_give.setVisibility(View.GONE);
lt_password.setVisibility(View.GONE);
lt_password2.setVisibility(View.GONE);
tv_title.setText(getResources().getString(R.string.bind_phone_updata_title));
}
}
private void getUuidDevice() {
String uuid = DeviceUtils.getUniqueDeviceId();
if (uuid != null) {
mUuidDevice = uuid;
}
}
public class JsBridge {
@JavascriptInterface
public void getData(final String Randstr, final String Ticket) {
((BindUserActivity) mContext).runOnUiThread(new Runnable() {
@Override
public void run() {
Log.i("tvss", Randstr);
webview.setVisibility(View.GONE);
//获取验证码
getMessageCode(Randstr, Ticket);
}
});
}
}
/**
* 获取短信验证码
*/
private void getMessageCode(String Randstr, String Ticket) {
String phoneNum = mEditPhone.getText().toString().trim();
if (TextUtils.isEmpty(phoneNum)) {
mEditPhone.setError(mContext.getString(R.string.reg_input_phone));
mEditPhone.requestFocus();
return;
}
//屏蔽原因国外手机号无法校验合法性
// if (!ValidatePhoneUtil.validateMobileNumber(phoneNum))
// {
// mEditPhone.setError(mContext.getString(R.string.login_phone_error));
// mEditPhone.requestFocus();
// return;
// }
mEditCode.requestFocus();
MainHttpUtil.getRegisterCode(Randstr, Ticket, phoneNum, mCountryCode, mGetCodeCallback);
}
private HttpCallback mGetCodeCallback = new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
mBtnCode.setEnabled(false);
if (mHandler != null) {
mHandler.sendEmptyMessage(0);
}
if (!TextUtils.isEmpty(msg) && msg.contains("123456")) {
ToastUtil.show(msg);
}
} else {
ToastUtil.show(msg);
}
}
};
/**
* 注册并登陆
*/
private void register() {
final String phoneNum = mEditPhone.getText().toString().trim();
if (TextUtils.isEmpty(phoneNum)) {
mEditPhone.setError(mContext.getString(R.string.reg_input_phone));
mEditPhone.requestFocus();
return;
}
//屏蔽原因国外手机号无法校验合法性
// if (!ValidatePhoneUtil.validateMobileNumber(phoneNum)) {
// mEditPhone.setError(mContext.getString(R.string.login_phone_error));
// mEditPhone.requestFocus();
// return;
// }
String code = mEditCode.getText().toString().trim();
if (TextUtils.isEmpty(code)) {
mEditCode.setError(mContext.getString(R.string.reg_input_code));
mEditCode.requestFocus();
return;
}
if ("0".equals(isBind)) {
final String pwd = mEditPwd1.getText().toString().trim();
if (TextUtils.isEmpty(pwd)) {
mEditPwd1.setError(mContext.getString(R.string.reg_input_pwd_1));
mEditPwd1.requestFocus();
return;
}
String pwd2 = mEditPwd2.getText().toString().trim();
if (TextUtils.isEmpty(pwd2)) {
mEditPwd2.setError(mContext.getString(R.string.reg_input_pwd_2));
mEditPwd2.requestFocus();
return;
}
if (!pwd.equals(pwd2)) {
mEditPwd2.setError(mContext.getString(R.string.reg_pwd_error));
mEditPwd2.requestFocus();
return;
}
// if (mDialog != null) {
// mDialog.show();
// }
MainHttpUtil.bindPhone(phoneNum, mCountryCode, getIntent().getStringExtra("uid"), getIntent().getStringExtra("token"), pwd, pwd2, code, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
ToastUtil.show(msg);
if (code == 0) {
Intent intent = getIntent();
intent.putExtra("phoneNum", phoneNum);
setResult(RESULT_OK, intent);
finish();
}
if (mDialog != null) {
mDialog.dismiss();
}
}
@Override
public void onError() {
if (mDialog != null) {
mDialog.dismiss();
}
}
});
} else if ("1".equals(isBind)) {
MainHttpUtil.updateBindMobile(phoneNum, mCountryCode, getIntent().getStringExtra("uid"), getIntent().getStringExtra("token"), code, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
ToastUtil.show(msg);
if (code == 0) {
Intent intent = getIntent();
intent.putExtra("phoneNum", phoneNum);
setResult(RESULT_OK, intent);
finish();
}
if (mDialog != null) {
mDialog.dismiss();
}
}
@Override
public void onError() {
if (mDialog != null) {
mDialog.dismiss();
}
}
});
}
}
//从网页获取推广码
private void getPromoCode() {
OpenInstall.getInstall(new AppInstallAdapter() {
@Override
public void onInstall(AppData appData) {
//获取渠道数据
String channelCode = appData.getChannel();
//获取自定义数据
if (appData.getData() != null && !appData.getData().equals("")) {
JSONObject data = JSON.parseObject(appData.getData());
mPromoCode = data.getString("admin_id") + "";
Log.d("OpenInstall", "appData.getData()1111= " + mPromoCode);
}
}
});
}
@Override
protected void onDestroy() {
EventBus.getDefault().unregister(this);
MainHttpUtil.cancel(MainHttpConsts.GET_REGISTER_CODE);
MainHttpUtil.cancel(MainHttpConsts.REGISTER);
MainHttpUtil.cancel(MainHttpConsts.LOGIN);
MainHttpUtil.cancel(MainHttpConsts.GET_BASE_INFO);
if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null);
mHandler = null;
}
super.onDestroy();
}
}

View File

@ -9,6 +9,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
@ -18,13 +19,13 @@ import com.sahooz.library.Country;
import com.sahooz.library.CountryPicker;
import com.sahooz.library.OnPick;
import com.shayu.onetoone.R;
import com.shayu.onetoone.activity.login.ChooseLabelActivity;
import com.shayu.onetoone.activity.setting.BindUserActivity;
import com.shayu.onetoone.bean.AuthBean;
import com.shayu.onetoone.bean.AvatarBean;
import com.shayu.onetoone.bean.UserBean;
import com.shayu.onetoone.manager.OTONetManager;
import com.shayu.onetoone.manager.RouteManager;
import com.shayu.onetoone.utils.MainHttpUtil;
import com.shayu.onetoone.utils.UserManager;
import com.shayu.onetoone.view.UserAvatarPopup;
import com.tencent.imsdk.v2.V2TIMCallback;
import com.tencent.imsdk.v2.V2TIMManager;
@ -34,6 +35,8 @@ import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.event.UpdateFieldEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
@ -49,23 +52,18 @@ import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.CompleteInformationPopup;
import com.yunbao.common.views.UpdateSexPopup;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import cn.qqtheme.framework.entity.City;
import cn.qqtheme.framework.entity.County;
import cn.qqtheme.framework.entity.Province;
import cn.qqtheme.framework.picker.AddressPicker;
import io.rong.imkit.userinfo.db.model.User;
/**
* 我的 编辑资料
@ -81,9 +79,9 @@ public class EditProfileActivity extends AbsActivity {
private TextView mCity;
private TextView tv_bind_phone;
private TextView auth_status;
private TextView tag;
private ProcessImageUtil cameraUtil;
private UserBean mUserBean;
private String mProvinceVal;
private String mCityVal;
private String mZoneVal;
@ -97,6 +95,10 @@ public class EditProfileActivity extends AbsActivity {
AuthBean authBean;
IMLoginModel userInfo;
com.shayu.onetoone.bean.UserBean.UserInfo info;
@Override
protected int getLayoutId() {
return R.layout.activity_edit_profile;
@ -113,45 +115,27 @@ public class EditProfileActivity extends AbsActivity {
mSex = (TextView) findViewById(R.id.sex);
mCity = (TextView) findViewById(R.id.city);
tv_bind_phone = (TextView) findViewById(R.id.tv_bind_phone);
tag = findViewById(R.id.u_tag);
mUserBean = UserManager.getUserBean();
OTONetManager.getInstance(mContext)
.getBaseInfos(false, new com.yunbao.common.http.base.HttpCallback<UserBean>() {
@Override
public void onSuccess(UserBean data) {
mUserBean = data;
showData(mUserBean);
}
@Override
public void onError(String error) {
}
});
like = findViewById(R.id.like);
findViewById(R.id.btn_person).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RouteManager.forwardAuthActivity();
}
});
/*if (mUserBean != null) {
showData(mUserBean);
} else {
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
@Override
public void callback(UserBean u) {
mUserBean = u;
showData(u);
}
});
}*/
initCamera();
com.shayu.onetoone.bean.UserBean bean = UserManager.getUserBean();
if (bean != null) {
tag.setText(bean.getInfo().getCn_label());
}
}
OTONetManager.getInstance(mContext).getBaseInfos(true, new com.yunbao.common.http.base.HttpCallback<com.shayu.onetoone.bean.UserBean>() {
@Override
public void onSuccess(com.shayu.onetoone.bean.UserBean data) {
showData(data.getUser(), data.getInfo());
}
@Override
public void onError(String error) {
}
});
initCamera();
}
private void initCamera() {
cameraUtil = new ProcessImageUtil(this, getPackageName() + ".fileprovider");
@ -216,42 +200,6 @@ public class EditProfileActivity extends AbsActivity {
});
}
@Override
public void onBackPressed() {
if (userModel.getUser().getUserInfoComplete() == 1) {
finish();
} else {
new XPopup.Builder(mContext).asCustom(new CompleteInformationPopup(mContext, true, new CompleteInformationPopup.CompleteInformationCallBack() {
@Override
public void onCancel() {
}
@Override
public void onSure() {
finish();
}
})).show();
}
}
private void getTaskType() {
MainHttpUtil.getUserFrontTaskType(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (info != null) {
if (info.length > 0) {
if (info[0].equals("0")) {
isInto = false;
} else {
isInto = true;
}
}
}
}
});
}
public void editProfileClick(View v) {
if (!canClick()) {
return;
@ -312,22 +260,19 @@ public class EditProfileActivity extends AbsActivity {
CountryPicker.newInstance(null, new OnPick() {
@Override
public void onPick(final Country country) {
mCity.setText(country.name);
OTONetManager.getInstance(EditProfileActivity.this).setFiled("location", country.name, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
OTONetManager.getInstance(EditProfileActivity.this).setFiled("area", country.name, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
if (data.getCode() == 0) {
ToastUtil.show(data.getMsg());
UserBean u = UserManager.getUserBean();
if (u != null) {
u.getUser().setLocation(country.name);
if (userInfo != null) {
userInfo.setLocation(country.name);
}
if (userModel != null) {
userModel.getUser().setLocation(country.name);
showData(userModel);
if (userInfo != null) {
userInfo.setArea(country.name);
}
mCity.setText(country.name);
//showData(userInfo);
EventBus.getDefault().post(new UpdateFieldEvent());
}
}
@ -340,29 +285,49 @@ public class EditProfileActivity extends AbsActivity {
}
}).show(getSupportFragmentManager(), "country");
} else if (i == R.id.rt_bind_phone) {
/*startActivity(new Intent(mContext, BindUserActivity.class)
.putExtra("uid", CommonAppConfig.getInstance().getUid())
.putExtra("token", CommonAppConfig.getInstance().getToken())
.putExtra("isBind", isBind)
.putExtra("mobile", mobile));*/
Intent intent = new Intent(mContext, BindUserActivity.class).putExtra("uid", CommonAppConfig.getInstance().getUid()).putExtra("token", CommonAppConfig.getInstance().getToken()).putExtra("isBind", isBind).putExtra("mobile", mobile);
cameraUtil.startActivityForResult(intent, new ActivityResultCallback() {
@Override
public void onSuccess(Intent intent) {
if (intent != null) {
String phoneNum = String.valueOf(intent.getStringExtra("phoneNum"));
userInfo.setMobile(phoneNum);
tv_bind_phone.setText(phoneNum);
}
}
});
} else if (i == R.id.auth) {
RouteManager.forwardAuthActivity();
}
}
private void editLabel() {
RouteManager.forwardChooseLabelActivity(true);
Intent intent = new Intent(mContext, ChooseLabelActivity.class);
intent.putExtra("isUserHome", true);
cameraUtil.startActivityForResult(intent, new ActivityResultCallback() {
@Override
public void onSuccess(Intent intent) {
if (intent != null) {
String label = intent.getStringExtra("label");
info.setCn_label(label);
like.setText(label);
EventBus.getDefault().post(new UpdateFieldEvent());
}
}
});
}
private void editName() {
Intent intent = new Intent(mContext, EditNameActivity.class);
intent.putExtra(Constants.NICK_NAME, mUserBean.getUser().getUserNicename());
intent.putExtra(Constants.NICK_NAME, mUserBean.getUserNiceName());
cameraUtil.startActivityForResult(intent, new ActivityResultCallback() {
@Override
public void onSuccess(Intent intent) {
if (intent != null) {
String nickName = intent.getStringExtra(Constants.NICK_NAME);
mUserBean.getUser().setSignature(nickName);
mUserBean.setSignature(nickName);
mName.setText(nickName);
EventBus.getDefault().post(new UpdateFieldEvent());
}
@ -434,17 +399,17 @@ public class EditProfileActivity extends AbsActivity {
}
private void forwardSign() {
if (mUserBean == null) {
if (userInfo == null) {
return;
}
Intent intent = new Intent(mContext, EditSignActivity.class);
intent.putExtra(Constants.SIGN, mUserBean.getUser().getSignature());
intent.putExtra(Constants.SIGN, mUserBean.getSignature());
cameraUtil.startActivityForResult(intent, new ActivityResultCallback() {
@Override
public void onSuccess(Intent intent) {
if (intent != null) {
String sign = intent.getStringExtra(Constants.SIGN);
mUserBean.getUser().setSignature(sign);
mUserBean.setSignature(sign);
mSign.setText(sign);
EventBus.getDefault().post(new UpdateFieldEvent());
}
@ -459,11 +424,11 @@ public class EditProfileActivity extends AbsActivity {
private void editBirthday() {
if (mUserBean == null) {
if (userInfo == null) {
return;
}
String[] times = mUserBean.getUser().getBirthday().split("-");
String[] times = mUserBean.getBirthday().split("-");
year = Integer.parseInt(times[0]);
month = Integer.parseInt(times[1]) - 1;
day = Integer.parseInt(times[2]);
@ -471,6 +436,12 @@ public class EditProfileActivity extends AbsActivity {
//时间选择器
Calendar selectedDate = Calendar.getInstance();
selectedDate.set(year, month, day);
Calendar startCalendar = Calendar.getInstance();
Calendar endCalendar = Calendar.getInstance();
startCalendar.set(1990, 1, 1);
endCalendar.setTime(new Date());
TimePickerView pvTime = new TimePickerBuilder(EditProfileActivity.this, new OnTimeSelectListener() {
@SuppressLint("SetTextI18n")
@Override
@ -490,14 +461,14 @@ public class EditProfileActivity extends AbsActivity {
@Override
public void onSuccess(HttpCallbackModel data) {
if (data.getCode() == 0) {
mUserBean.getUser().setBirthday(strbir);
userInfo.setBirthday(strbir);
mBirthday.setText(strbir);
if (userModel != null) {
userModel.getUser().setBirthday(strbir);
if (userInfo != null) {
userInfo.setBirthday(strbir);
}
showData(userModel);
//showData(userInfo);
EventBus.getDefault().post(new UpdateFieldEvent());
}
}
@ -509,74 +480,43 @@ public class EditProfileActivity extends AbsActivity {
});
}
}).setCancelText(WordUtil.getNewString(R.string.birthday)).setSubmitColor(getResources().getColor(R.color.blue01)).setSubmitText(WordUtil.getNewString(R.string.complete)).setContentTextSize(20).setDate(selectedDate).build();
}).setRangDate(startCalendar, endCalendar).isAlphaGradient(true).setCancelText(WordUtil.getNewString(R.string.birthday)).setSubmitColor(getResources().getColor(R.color.blue01)).setSubmitText(WordUtil.getNewString(R.string.complete)).setContentTextSize(20).setDate(selectedDate).build();
pvTime.show();
}
private void forwardSex() {
if (mUserBean == null) {
return;
}
// Intent intent = new Intent(mContext, EditSexActivity.class);
// intent.putExtra(Constants.SEX, mUserBean.getSex());
// mImageUtil.startActivityForResult(intent, new ActivityResultCallback() {
// @Override
// public void onSuccess(Intent intent) {
// if (intent != null) {
// int sex = intent.getIntExtra(Constants.SEX, 0);
// if (sex == 1) {
// mSex.setText(R.string.sex_male);
// mUserBean.setSex(sex);
// } else if (sex == 2) {
// mSex.setText(R.string.sex_female);
// mUserBean.setSex(sex);
// }
// EventBus.getDefault().post(new UpdateFieldEvent());
// }
// }
//
// });
}
@Override
protected void onDestroy() {
Bus.getOff(this);
if (cameraUtil != null) {
cameraUtil.release();
}
//MainHttpUtil.cancel(MainHttpConsts.UPDATE_AVATAR);
//MainHttpUtil.cancel(MainHttpConsts.UPDATE_FIELDS);
super.onDestroy();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEditProfileEvent(/*EditProfileEvent event*/) {
OTONetManager.getInstance(mContext)
.getBaseInfos(false, new com.yunbao.common.http.base.HttpCallback<UserBean>() {
@Override
public void onSuccess(UserBean data) {
showData(data);
}
@Override
public void onError(String error) {
}
});
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
@Override
public void callback(UserBean u) {
showData(u);
}
});
}
private UserBean userModel;
userInfo = u;
info = inf;
private void showData(UserBean u) {
userModel = u;
int index = 0;
String birthday = u.getUser().getBirthday();
String location = u.getUser().getLocation();
String bindPhone = u.getUser().getMobile();
String birthday = userInfo.getBirthday();
String location = userInfo.getLocation();
String bindPhone = userInfo.getMobile();
String sex = "";
if (u.getUser().getSex() == 1) {
if (userInfo.getSex() == 1) {
sex = mContext.getString(R.string.sex_male);
} else if (u.getUser().getSex() == 2) {
} else if (userInfo.getSex() == 2) {
sex = mContext.getString(R.string.sex_female);
}
if (!TextUtils.isEmpty(bindPhone)) {
@ -591,117 +531,31 @@ public class EditProfileActivity extends AbsActivity {
if (!TextUtils.isEmpty(sex)) {
index = index + 1;
}
/*if (index == 0) {
completeInformation.setBackgroundResource(R.mipmap.bg_complete_information_progress);
completeInformation1.setBackgroundResource(R.mipmap.bg_complete_information_progress);
completeInformation2.setBackgroundResource(R.mipmap.bg_complete_information_progress);
completeInformation3.setBackgroundResource(R.mipmap.bg_complete_information_progress);
information.setVisibility(View.VISIBLE);
information1.setVisibility(View.VISIBLE);
information2.setVisibility(View.VISIBLE);
information3.setVisibility(View.VISIBLE);
viewProgress1.setBackgroundColor(Color.parseColor("#DEE4F1"));
viewProgress2.setBackgroundColor(Color.parseColor("#DEE4F1"));
viewProgress3.setBackgroundColor(Color.parseColor("#DEE4F1"));
submit.setText(R.string.to_complete);
submit.setTextColor(Color.parseColor("#ffffff"));
} else if (index == 1) {
completeInformation.setBackgroundResource(R.mipmap.bg_complete_information_progress2);
completeInformation1.setBackgroundResource(R.mipmap.bg_complete_information_progress);
completeInformation2.setBackgroundResource(R.mipmap.bg_complete_information_progress);
completeInformation3.setBackgroundResource(R.mipmap.bg_complete_information_progress);
information.setVisibility(View.INVISIBLE);
information1.setVisibility(View.VISIBLE);
information2.setVisibility(View.VISIBLE);
information3.setVisibility(View.VISIBLE);
viewProgress1.setBackgroundColor(Color.parseColor("#DEE4F1"));
viewProgress2.setBackgroundColor(Color.parseColor("#DEE4F1"));
viewProgress3.setBackgroundColor(Color.parseColor("#DEE4F1"));
submit.setText(R.string.to_complete);
submit.setTextColor(Color.parseColor("#ffffff"));
} else if (index == 2) {
information.setVisibility(View.INVISIBLE);
information1.setVisibility(View.INVISIBLE);
information2.setVisibility(View.VISIBLE);
information3.setVisibility(View.VISIBLE);
completeInformation1.setBackgroundResource(R.mipmap.bg_complete_information_progress2);
completeInformation.setBackgroundResource(R.mipmap.bg_complete_information_progress2);
completeInformation2.setBackgroundResource(R.mipmap.bg_complete_information_progress);
completeInformation3.setBackgroundResource(R.mipmap.bg_complete_information_progress);
viewProgress1.setBackgroundColor(Color.parseColor("#FFE5D0"));
viewProgress2.setBackgroundColor(Color.parseColor("#DEE4F1"));
viewProgress3.setBackgroundColor(Color.parseColor("#DEE4F1"));
submit.setText(R.string.to_complete);
submit.setTextColor(Color.parseColor("#ffffff"));
} else if (index == 3) {
information.setVisibility(View.INVISIBLE);
information1.setVisibility(View.INVISIBLE);
information2.setVisibility(View.INVISIBLE);
information3.setVisibility(View.VISIBLE);
completeInformation.setBackgroundResource(R.mipmap.bg_complete_information_progress2);
completeInformation1.setBackgroundResource(R.mipmap.bg_complete_information_progress2);
completeInformation2.setBackgroundResource(R.mipmap.bg_complete_information_progress2);
completeInformation3.setBackgroundResource(R.mipmap.bg_complete_information_progress);
viewProgress1.setBackgroundColor(Color.parseColor("#FFE5D0"));
viewProgress2.setBackgroundColor(Color.parseColor("#FFE5D0"));
viewProgress3.setBackgroundColor(Color.parseColor("#DEE4F1"));
submit.setText(R.string.to_complete);
submit.setTextColor(Color.parseColor("#ffffff"));
} else if (index == 4) {
information.setVisibility(View.INVISIBLE);
information1.setVisibility(View.INVISIBLE);
information2.setVisibility(View.INVISIBLE);
information3.setVisibility(View.INVISIBLE);
completeInformation.setBackgroundResource(R.mipmap.bg_complete_information_progress2);
completeInformation1.setBackgroundResource(R.mipmap.bg_complete_information_progress2);
completeInformation2.setBackgroundResource(R.mipmap.bg_complete_information_progress2);
completeInformation3.setBackgroundResource(R.mipmap.bg_complete_information_progress2);
viewProgress1.setBackgroundColor(Color.parseColor("#FFE5D0"));
viewProgress2.setBackgroundColor(Color.parseColor("#FFE5D0"));
viewProgress3.setBackgroundColor(Color.parseColor("#FFE5D0"));
submit.setText(R.string.to_receive);
submit.setTextColor(Color.parseColor("#935902"));
submit.setEnabled(true);
}*/
ImgLoader.displayAvatar(mContext, u.getUser().getAvatar(), mAvatar);
mName.setText(u.getUser().getUserNicename());
mSign.setText(u.getUser().getSignature());
mBirthday.setText(u.getUser().getBirthday());
if (u.getUser().getSex() == 0) {
if (!userInfo.getAvatar().contains("http")) {
ImgLoader.displayAvatar(mContext, CommonAppConfig.HOST + userInfo.getAvatar(), mAvatar);
} else {
ImgLoader.displayAvatar(mContext, userInfo.getAvatar(), mAvatar);
}
mName.setText(userInfo.getUserNicename());
mSign.setText(userInfo.getSignature());
mBirthday.setText(userInfo.getBirthday());
if (userInfo.getSex() == 0) {
mSex.setText("");
} else if (u.getUser().getSex() == 1) {
} else if (userInfo.getSex() == 1) {
mSex.setText(R.string.sex_male);
} else if (u.getUser().getSex() == 2) {
} else if (userInfo.getSex() == 2) {
mSex.setText(R.string.sex_female);
}
mCity.setText(u.getUser().getCity());
if (u.getUser().getLoginType().equals("phone")) {
mobile = u.getUser().getMobile();
like.setText(info.getCn_label());
mCity.setText(info.getArea());
if (1 == userInfo.getIsBind()) {
mobile = userInfo.getMobile();
tv_bind_phone.setText(mobile);
isBind = "1";
} else {
tv_bind_phone.setHint(getResources().getString(R.string.bind_phone_text));
isBind = "0";
}
/*if (u.getUserInfoComplete() == 1) {
submit.setText(R.string.live_task_item_complete_true);
submit.setBackgroundResource(R.mipmap.bg_submit_cancel);
submit.setTextColor(Color.parseColor("#FFFFFF"));
submit.setEnabled(false);
} else {
if (index < 4) {
submit.setText(R.string.to_complete);
submit.setBackgroundResource(R.mipmap.bg_submit);
submit.setTextColor(Color.parseColor("#FFFFFF"));
submit.setEnabled(false);
} else {
submit.setText(R.string.to_receive);
submit.setBackgroundResource(R.mipmap.bg_submit);
submit.setTextColor(Color.parseColor("#935902"));
}
}*/
OTONetManager.getInstance(EditProfileActivity.this).getAuthInfo(new com.yunbao.common.http.base.HttpCallback<AuthBean>() {
@Override
public void onSuccess(AuthBean data) {
@ -730,81 +584,6 @@ public class EditProfileActivity extends AbsActivity {
});
}
/**
* 选择城市
*/
private void chooseCity() {
ArrayList<Province> list = CityUtil.getInstance().getCityList();
if (list == null || list.size() == 0) {
final Dialog loading = DialogUitl.loadingDialog(mContext);
loading.show();
CityUtil.getInstance().getCityListFromAssets(new CommonCallback<ArrayList<Province>>() {
@Override
public void callback(ArrayList<Province> newList) {
loading.dismiss();
if (newList != null) {
showChooseCityDialog(newList);
}
}
});
} else {
showChooseCityDialog(list);
}
}
/**
* 选择城市
*/
private void showChooseCityDialog(ArrayList<Province> list) {
String province = mProvinceVal;
String city = mCityVal;
String district = mZoneVal;
if (TextUtils.isEmpty(province)) {
province = CommonAppConfig.getInstance().getProvince();
}
if (TextUtils.isEmpty(city)) {
city = CommonAppConfig.getInstance().getCity();
}
if (TextUtils.isEmpty(district)) {
district = CommonAppConfig.getInstance().getDistrict();
}
DialogUitl.showCityChooseDialog(this, list, province, city, district, new AddressPicker.OnAddressPickListener() {
@Override
public void onAddressPicked(Province province, final City city, County county) {
String provinceName = province.getAreaName();
String cityName = city.getAreaName();
String zoneName = county.getAreaName();
mProvinceVal = provinceName;
mCityVal = cityName;
mZoneVal = zoneName;
final String location = StringUtil.contact(mProvinceVal, mCityVal, mZoneVal);
if (mCity != null) {
mCity.setText(location);
}
OTONetManager.getInstance(EditProfileActivity.this).setFiled("location", location, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
ToastUtil.show(data.getMsg());
if (data.getCode() == 0) {
UserBean u = UserManager.getUserBean();
if (u != null) {
u.getUser().setLocation(location);
}
EventBus.getDefault().post(new UpdateFieldEvent());
}
}
@Override
public void onError(String error) {
}
});
}
});
}
@Override
protected void onResume() {
super.onResume();

View File

@ -0,0 +1,5 @@
package com.shayu.onetoone.bean;
public class BindPhoneEvent {
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/global" android:state_enabled="true"/>
<item android:color="@color/gray3" android:state_enabled="false"/>
</selector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/border_fd8c44" android:state_pressed="true" />
<item android:drawable="@drawable/border_fdbe40" android:state_focused="true" />
<item android:drawable="@drawable/border_fdbe40"/>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="30dp" />
<solid android:color="#fd8c44 " />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="30dp" />
<solid android:color="#fdbe40 " />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="50dp" />
<solid android:color="#FAFAFA" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,363 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="65dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="23dp"
android:layout_marginRight="20dp"
android:background="@color/white">
<ImageView
android:id="@+id/btn_back"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:onClick="backClick"
android:padding="9dp"
android:src="@mipmap/icon_back"
app:tint="@color/textColor" />
</RelativeLayout>
<LinearLayout
android:id="@+id/lt_first_bind"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="41dp"
android:layout_marginTop="30dp"
android:layout_marginBottom="25dp"
android:text="@string/bind_phone_title"
android:textColor="#ffff8d41"
android:textSize="24sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="1dp"
android:layout_marginRight="30dp"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:background="@drawable/border_grey_50"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="0dp">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="22dp"
android:src="@mipmap/icon_phone" />
<TextView
android:id="@+id/tvCountryCode"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical|right"
android:minWidth="45dp"
android:text="+852"
android:textColor="@color/black1"
android:textSize="14sp" />
<ImageView
android:id="@+id/ivCountryCode"
android:layout_width="12dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:adjustViewBounds="true"
android:src="@mipmap/icon_login_down"
android:tint="@color/gray1" />
<EditText
android:id="@+id/edit_phone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:background="@null"
android:hint="@string/reg_input_phone"
android:inputType="number"
android:maxLength="11"
android:textColor="@color/textColor"
android:textColorHint="@color/gray3"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_marginBottom="15dp"
android:background="@drawable/border_grey_50"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="22dp"
android:src="@mipmap/icon_code" />
<EditText
android:id="@+id/edit_code"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_weight="1"
android:background="@null"
android:hint="@string/reg_input_code"
android:inputType="number"
android:textColor="@color/textColor"
android:textColorHint="@color/gray3"
android:textSize="14sp" />
<TextView
android:id="@+id/btn_code"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="20dp"
android:enabled="false"
android:gravity="center_vertical"
android:onClick="registerClick"
android:text="@string/reg_get_code"
android:textColor="@color/reg_btn_code"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/lt_password"
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_marginBottom="15dp"
android:background="@drawable/border_grey_50"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="22dp"
android:src="@mipmap/icons_password" />
<EditText
android:id="@+id/edit_pwd_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:background="@null"
android:hint="@string/reg_input_pwd_1"
android:inputType="textPassword"
android:textColor="@color/textColor"
android:textColorHint="@color/gray3"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/lt_password2"
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_marginBottom="15dp"
android:background="@drawable/border_grey_50"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="22dp"
android:src="@mipmap/icons_password" />
<EditText
android:id="@+id/edit_pwd_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:background="@null"
android:hint="@string/reg_input_pwd_2"
android:inputType="textPassword"
android:textColor="@color/textColor"
android:textColorHint="@color/gray3"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/btn_register"
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="30dp"
android:layout_marginRight="30dp"
android:background="@drawable/border_bind_phone_btn"
android:gravity="center"
android:onClick="registerClick"
android:text="@string/bind_phone_updata"
android:textColor="@color/white"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/lt_give"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="18dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="24dp"
android:gravity="center"
android:text="@string/bind_phone_give"
android:textColor="@color/green_81c160"
android:textSize="13sp" />
<View
android:layout_width="24dp"
android:layout_height="24dp"
android:background="@mipmap/gold_coin" />
<TextView
android:layout_width="wrap_content"
android:layout_height="24dp"
android:gravity="center"
android:text="@string/bind_phone_give_nuber"
android:textColor="@color/green_81c160"
android:textSize="13sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/bind_phone_text1"
android:textColor="@color/gray_aaaaaa"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:gravity="center"
android:text="@string/bind_phone_text2"
android:textColor="@color/gray_aaaaaa"
android:textSize="13sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/lt_now_bind"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginBottom="25dp"
android:gravity="center"
android:text="@string/bind_phone_now"
android:textColor="#ffff8d41"
android:textSize="24sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="1dp"
android:layout_marginRight="30dp"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:background="@drawable/border_grey_50"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_now_phone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:minWidth="45dp"
android:text=""
android:textColor="@color/black_161616"
android:textSize="17sp" />
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/btn_goto_updata"
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="30dp"
android:layout_marginRight="30dp"
android:background="@drawable/border_bind_phone_btn"
android:gravity="center"
android:onClick="registerClick"
android:text="@string/bind_phone_updata_title"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<WebView
android:id="@+id/webview"
android:layout_width="600dp"
android:layout_height="600dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:visibility="gone" />
</RelativeLayout>

View File

@ -23,8 +23,8 @@
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_width="43dp"
android:layout_height="43dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="25dp"
@ -398,7 +398,6 @@
android:textSize="14sp" />
<TextView
android:id="@+id/u_tag"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -123,6 +123,10 @@ public class IMLoginModel extends BaseModel {
//
@SerializedName("location")
private String location = "";
//
@SerializedName("area")
private String area = "";
//
@SerializedName("medal_level")
private String medalLevel = "";
@ -282,6 +286,14 @@ public class IMLoginModel extends BaseModel {
this.userInfoComplete = userInfoComplete;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public int getIsAttention() {
return isAttention;
}