From 9c2d4887644df57e3aced6c3d8c9654ff731c28e Mon Sep 17 00:00:00 2001 From: hch <16607480311@163.com> Date: Thu, 2 Nov 2023 16:57:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/fragments/MyFragment.java | 109 ++-- .../fragments/home/HomeRankFragment.java | 25 +- .../activity/login/ChooseLabelActivity.java | 8 +- .../activity/setting/BindUserActivity.java | 476 ++++++++++++++++++ .../activity/user/EditProfileActivity.java | 427 ++++------------ .../shayu/onetoone/bean/BindPhoneEvent.java | 5 + OneToOne/src/main/res/color/reg_btn_code.xml | 5 + .../res/drawable/border_bind_phone_btn.xml | 6 + .../src/main/res/drawable/border_fd8c44.xml | 9 + .../src/main/res/drawable/border_fdbe40.xml | 9 + .../src/main/res/drawable/border_grey_50.xml | 9 + .../main/res/layout/activity_bind_user.xml | 363 +++++++++++++ .../main/res/layout/activity_edit_profile.xml | 5 +- .../src/main/res/mipmap-xxhdpi/icon_code.png | Bin 0 -> 1472 bytes .../res/mipmap-xxhdpi/icon_login_down.png | Bin 0 -> 386 bytes .../src/main/res/mipmap-xxhdpi/icon_phone.png | Bin 0 -> 765 bytes .../main/res/mipmap-xxhdpi/icons_password.png | Bin 0 -> 1132 bytes .../com/yunbao/common/bean/IMLoginModel.java | 12 + 18 files changed, 1087 insertions(+), 381 deletions(-) create mode 100644 OneToOne/src/main/java/com/shayu/onetoone/activity/setting/BindUserActivity.java create mode 100644 OneToOne/src/main/java/com/shayu/onetoone/bean/BindPhoneEvent.java create mode 100644 OneToOne/src/main/res/color/reg_btn_code.xml create mode 100644 OneToOne/src/main/res/drawable/border_bind_phone_btn.xml create mode 100644 OneToOne/src/main/res/drawable/border_fd8c44.xml create mode 100644 OneToOne/src/main/res/drawable/border_fdbe40.xml create mode 100644 OneToOne/src/main/res/drawable/border_grey_50.xml create mode 100644 OneToOne/src/main/res/layout/activity_bind_user.xml create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/icon_code.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/icon_login_down.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/icon_phone.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/icons_password.png diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java index 11ad0866d..5ea6d0ee4 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java @@ -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() { + @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() { @Override public void onSuccess(AuthBean data) { @@ -257,6 +272,7 @@ public class MyFragment extends BaseFragment implements OnItemClickListener mCallback = new CommonCallback() { - @Override - public void callback(UserBean bean) { - /*List list = CommonAppConfig.getInstance().getUserItemList(); - if (bean != null) { - showData(bean, list); - }*/ + private List mBannerListNew = new ArrayList<>(); - showData(bean); - } - }; - - private List 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 mBannerList = new ArrayList<>(); + public static List 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= 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= 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); diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/home/HomeRankFragment.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/home/HomeRankFragment.java index 5ed8912b4..ba02f6b05 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/home/HomeRankFragment.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/home/HomeRankFragment.java @@ -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)); diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/login/ChooseLabelActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/ChooseLabelActivity.java index 081de670f..18fa00e30 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/activity/login/ChooseLabelActivity.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/ChooseLabelActivity.java @@ -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(); diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/BindUserActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/BindUserActivity.java new file mode 100644 index 000000000..e1ffff223 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/BindUserActivity.java @@ -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 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(); + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/user/EditProfileActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/user/EditProfileActivity.java index 2aa254000..e39a339e6 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/activity/user/EditProfileActivity.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/user/EditProfileActivity.java @@ -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() { - @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() { - @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() { + @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() { + OTONetManager.getInstance(EditProfileActivity.this).setFiled("area", country.name, new com.yunbao.common.http.base.HttpCallback() { @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() { - @Override - public void onSuccess(UserBean data) { - showData(data); - } - - @Override - public void onError(String error) { - - } - }); + MainHttpUtil.getBaseInfo(new CommonCallback() { + @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() { @Override public void onSuccess(AuthBean data) { @@ -730,81 +584,6 @@ public class EditProfileActivity extends AbsActivity { }); } - - /** - * 选择城市 - */ - private void chooseCity() { - ArrayList list = CityUtil.getInstance().getCityList(); - if (list == null || list.size() == 0) { - final Dialog loading = DialogUitl.loadingDialog(mContext); - loading.show(); - CityUtil.getInstance().getCityListFromAssets(new CommonCallback>() { - @Override - public void callback(ArrayList newList) { - loading.dismiss(); - if (newList != null) { - showChooseCityDialog(newList); - } - } - }); - } else { - showChooseCityDialog(list); - } - } - - /** - * 选择城市 - */ - private void showChooseCityDialog(ArrayList 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() { - @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(); diff --git a/OneToOne/src/main/java/com/shayu/onetoone/bean/BindPhoneEvent.java b/OneToOne/src/main/java/com/shayu/onetoone/bean/BindPhoneEvent.java new file mode 100644 index 000000000..7a0ebf0e4 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/bean/BindPhoneEvent.java @@ -0,0 +1,5 @@ +package com.shayu.onetoone.bean; + +public class BindPhoneEvent { + +} diff --git a/OneToOne/src/main/res/color/reg_btn_code.xml b/OneToOne/src/main/res/color/reg_btn_code.xml new file mode 100644 index 000000000..c07366394 --- /dev/null +++ b/OneToOne/src/main/res/color/reg_btn_code.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/OneToOne/src/main/res/drawable/border_bind_phone_btn.xml b/OneToOne/src/main/res/drawable/border_bind_phone_btn.xml new file mode 100644 index 000000000..a4cef2f4a --- /dev/null +++ b/OneToOne/src/main/res/drawable/border_bind_phone_btn.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/OneToOne/src/main/res/drawable/border_fd8c44.xml b/OneToOne/src/main/res/drawable/border_fd8c44.xml new file mode 100644 index 000000000..bf14b4b1b --- /dev/null +++ b/OneToOne/src/main/res/drawable/border_fd8c44.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/OneToOne/src/main/res/drawable/border_fdbe40.xml b/OneToOne/src/main/res/drawable/border_fdbe40.xml new file mode 100644 index 000000000..3fda70d15 --- /dev/null +++ b/OneToOne/src/main/res/drawable/border_fdbe40.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/OneToOne/src/main/res/drawable/border_grey_50.xml b/OneToOne/src/main/res/drawable/border_grey_50.xml new file mode 100644 index 000000000..d7281b174 --- /dev/null +++ b/OneToOne/src/main/res/drawable/border_grey_50.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/OneToOne/src/main/res/layout/activity_bind_user.xml b/OneToOne/src/main/res/layout/activity_bind_user.xml new file mode 100644 index 000000000..bc61114e9 --- /dev/null +++ b/OneToOne/src/main/res/layout/activity_bind_user.xml @@ -0,0 +1,363 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +