Commit dd9e6465a9fc07e22548031d8c057337ec6a0816
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/CNUserDemo
Showing
8 changed files
with
327 additions
and
6 deletions
README.md
app/build.gradle
app/libs/libcnliveuser.jar deleted
100644 → 0
No preview for this file type
app/libs/libcnliveutil.jar deleted
100644 → 0
No preview for this file type
app/src/main/java/com/cnlive/libs/LoginActivity.java
| ... | ... | @@ -7,7 +7,6 @@ import android.view.View; |
| 7 | 7 | import android.widget.Button; |
| 8 | 8 | import android.widget.EditText; |
| 9 | 9 | import android.widget.TextView; |
| 10 | -import android.widget.Toast; | |
| 11 | 10 | |
| 12 | 11 | import com.cnlive.libs.user.IUserService; |
| 13 | 12 | import com.cnlive.libs.user.UserUtil; |
| ... | ... | @@ -64,8 +63,11 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener |
| 64 | 63 | startActivity(intent); |
| 65 | 64 | break; |
| 66 | 65 | case R.id.other_textView: |
| 67 | - intent = new Intent(this, OtherActivity.class); | |
| 68 | - startActivity(intent); | |
| 66 | + if (userData==null) showToast("登录成功后才能进入用户详情页面哦"); | |
| 67 | + else { | |
| 68 | + intent = new Intent(this, OtherActivity.class); | |
| 69 | + startActivity(intent); | |
| 70 | + } | |
| 69 | 71 | break; |
| 70 | 72 | case R.id.login: |
| 71 | 73 | /** | ... | ... |
app/src/main/java/com/cnlive/libs/OtherActivity.java
| ... | ... | @@ -6,7 +6,6 @@ import android.view.View; |
| 6 | 6 | import android.widget.Button; |
| 7 | 7 | import android.widget.EditText; |
| 8 | 8 | import android.widget.TextView; |
| 9 | -import android.widget.Toast; | |
| 10 | 9 | |
| 11 | 10 | import com.cnlive.libs.user.IUserService; |
| 12 | 11 | import com.cnlive.libs.user.UserUtil; |
| ... | ... | @@ -34,7 +33,8 @@ public class OtherActivity extends BaseActivity implements View.OnClickListener |
| 34 | 33 | |
| 35 | 34 | private EditText feedbackMsg; |
| 36 | 35 | private Button feedback, uploadFace; |
| 37 | - private TextView modifyMobile, updateUserExtInfo, queryUserInfo, modifyUserInfo, modifyPwdWithMobile, bindThird, sendMessage, queryMoreUserInfo; | |
| 36 | + private TextView modifyMobile, updateUserExtInfo, queryUserInfo, modifyUserInfo, modifyPwdWithMobile, bindThird, sendMessage, queryMoreUserInfo, modifyPwdWithOldpwd | |
| 37 | + , modifyPwdWithEmail, checkVerifyCodeBeforeRegistered, checkVerifycodeBeforeQuicklogin, thirdPartyLoginWithMobile, thirdPartyRegisterMustMobile; | |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | private String uid; |
| ... | ... | @@ -93,6 +93,30 @@ public class OtherActivity extends BaseActivity implements View.OnClickListener |
| 93 | 93 | //查询多条用户信息 |
| 94 | 94 | queryMoreUserInfo = (TextView) findViewById(R.id.query_more_user_info); |
| 95 | 95 | queryMoreUserInfo.setOnClickListener(this); |
| 96 | + | |
| 97 | + //通过原密码修改密码 | |
| 98 | + modifyPwdWithOldpwd = (TextView) findViewById(R.id.modify_pwd_through_oldpwd); | |
| 99 | + modifyPwdWithOldpwd.setOnClickListener(this); | |
| 100 | + | |
| 101 | + //通过邮箱修改密码 | |
| 102 | + modifyPwdWithEmail = (TextView) findViewById(R.id.modify_pwd_through_email); | |
| 103 | + modifyPwdWithEmail.setOnClickListener(this); | |
| 104 | + | |
| 105 | + //注册前校验手机验证码 | |
| 106 | + checkVerifyCodeBeforeRegistered= (TextView) findViewById(R.id.check_verifycode_before_registered); | |
| 107 | + checkVerifyCodeBeforeRegistered.setOnClickListener(this); | |
| 108 | + | |
| 109 | + //快捷登录前校验手机验证码 | |
| 110 | + checkVerifycodeBeforeQuicklogin= (TextView) findViewById(R.id.check_verifycode_before_quicklogin); | |
| 111 | + checkVerifycodeBeforeQuicklogin.setOnClickListener(this); | |
| 112 | + | |
| 113 | + //第三方登录(可选手机号) | |
| 114 | + thirdPartyLoginWithMobile= (TextView) findViewById(R.id.third_party_login_with_mobile); | |
| 115 | + thirdPartyLoginWithMobile.setOnClickListener(this); | |
| 116 | + | |
| 117 | + //第三方注册强制绑定手机号 | |
| 118 | + thirdPartyRegisterMustMobile= (TextView) findViewById(R.id.third_party_register_must_mobile); | |
| 119 | + thirdPartyRegisterMustMobile.setOnClickListener(this); | |
| 96 | 120 | } |
| 97 | 121 | |
| 98 | 122 | @Override |
| ... | ... | @@ -540,6 +564,220 @@ public class OtherActivity extends BaseActivity implements View.OnClickListener |
| 540 | 564 | } |
| 541 | 565 | }); |
| 542 | 566 | break; |
| 567 | + case R.id.modify_pwd_through_oldpwd: | |
| 568 | + /** | |
| 569 | + * 通过原密码修改密码 | |
| 570 | + * | |
| 571 | + * @param uid 用户uid | |
| 572 | + * @param pwd 原密码 | |
| 573 | + * @param newPwd 新密码 | |
| 574 | + * @param callback 回调 | |
| 575 | + */ | |
| 576 | + UserUtil.modifyPwdWithOldPwd(uid, "pwd", "newPwd", new Callback() { | |
| 577 | + @Override | |
| 578 | + public void onState(int what, String extra, Object obj) { | |
| 579 | + showToast(extra + " : " + obj.toString()); | |
| 580 | + switch (what) { | |
| 581 | + case IUserService.SUCCESS: | |
| 582 | + //成功 | |
| 583 | + break; | |
| 584 | + case IUserService.ERROR_PARAM: | |
| 585 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_param); | |
| 586 | + break; | |
| 587 | + case IUserService.ERROR_PWD_OLDPWD_SAME: | |
| 588 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_pwd_oldpwd_same); | |
| 589 | + break; | |
| 590 | + case IUserService.ERROR_USERNAME_OR_PASSWORD: | |
| 591 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_username_or_password); | |
| 592 | + break; | |
| 593 | + case IUserService.ERROR_USER_NOT_FOUND: | |
| 594 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_user_not_found); | |
| 595 | + break; | |
| 596 | + case IUserService.ERROR_PASSWORD_CONTENT: | |
| 597 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_password_content); | |
| 598 | + break; | |
| 599 | + case IUserService.ERROR_PASSWORD_CANNOT_CONTIGUOUS: | |
| 600 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_password_cannot_be_contiguous); | |
| 601 | + break; | |
| 602 | + case IUserService.ERROR_PASSWORD_CANNOT_CONTIGUOUS_SAME: | |
| 603 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_password_cannot_be_contiguous_same); | |
| 604 | + break; | |
| 605 | + case IUserService.ERROR_OTHER: | |
| 606 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_other); | |
| 607 | + break; | |
| 608 | + } | |
| 609 | + } | |
| 610 | + }); | |
| 611 | + break; | |
| 612 | + case R.id.modify_pwd_through_email: | |
| 613 | + UserUtil.modifyPwdWithEmail("email", "newPwd", new Callback() { | |
| 614 | + @Override | |
| 615 | + public void onState(int what, String extra, Object obj) { | |
| 616 | + showToast(extra + " : " + obj.toString()); | |
| 617 | + switch (what) { | |
| 618 | + case IUserService.SUCCESS: | |
| 619 | + //成功 | |
| 620 | + break; | |
| 621 | + case IUserService.ERROR_PARAM: | |
| 622 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_param); | |
| 623 | + break; | |
| 624 | + case IUserService.ERROR_MAIL_FORMAT: | |
| 625 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_mail_format); | |
| 626 | + break; | |
| 627 | + case IUserService.ERROR_PASSWORD_CONTENT: | |
| 628 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_password_content); | |
| 629 | + break; | |
| 630 | + case IUserService.ERROR_PASSWORD_EQUAL_USERNAME: | |
| 631 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_password_equal_username); | |
| 632 | + break; | |
| 633 | + case IUserService.ERROR_PASSWORD_CANNOT_CONTIGUOUS: | |
| 634 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_password_cannot_be_contiguous); | |
| 635 | + break; | |
| 636 | + case IUserService.ERROR_PASSWORD_CANNOT_CONTIGUOUS_SAME: | |
| 637 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_password_cannot_be_contiguous_same); | |
| 638 | + break; | |
| 639 | + case IUserService.ERROR_CLIENT_PLAT: | |
| 640 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_client_plat); | |
| 641 | + break; | |
| 642 | + case IUserService.ERROR_EMAIL_UNREGISTERED: | |
| 643 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_email_unregistered); | |
| 644 | + break; | |
| 645 | + case IUserService.ERROR_OPERATE: | |
| 646 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_operate); | |
| 647 | + break; | |
| 648 | + case IUserService.ERROR_OTHER: | |
| 649 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_other); | |
| 650 | + break; | |
| 651 | + } | |
| 652 | + } | |
| 653 | + }); | |
| 654 | + break; | |
| 655 | + case R.id.check_verifycode_before_registered: | |
| 656 | + UserUtil.checkVerifyCodeBeforeRegistered("mobile", "verificationCode", new Callback() { | |
| 657 | + @Override | |
| 658 | + public void onState(int what, String extra, Object obj) { | |
| 659 | + showToast(extra + " : " + obj.toString()); | |
| 660 | + switch (what) { | |
| 661 | + case IUserService.SUCCESS: | |
| 662 | + //成功 | |
| 663 | + break; | |
| 664 | + case IUserService.ERROR_PARAM: | |
| 665 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_param); | |
| 666 | + break; | |
| 667 | + case IUserService.ERROR_MOBILE: | |
| 668 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_mobile); | |
| 669 | + break; | |
| 670 | + case IUserService.ERROR_VERIFICATION_CODE_LENGTH: | |
| 671 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_verfication_code_length); | |
| 672 | + break; | |
| 673 | + case IUserService.ERROR_CLIENT_PLAT: | |
| 674 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_client_plat); | |
| 675 | + break; | |
| 676 | + case IUserService.ERROR_VERIFICATION_CODE: | |
| 677 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_verfication_code); | |
| 678 | + break; | |
| 679 | + case IUserService.ERROR_OTHER: | |
| 680 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_other); | |
| 681 | + break; | |
| 682 | + } | |
| 683 | + } | |
| 684 | + }); | |
| 685 | + break; | |
| 686 | + case R.id.check_verifycode_before_quicklogin: | |
| 687 | + UserUtil.checkVerifyCodeBeforeQuickLogin("mobile", "verificationCode", new Callback() { | |
| 688 | + @Override | |
| 689 | + public void onState(int what, String extra, Object obj) { | |
| 690 | + showToast(extra + " : " + obj.toString()); | |
| 691 | + switch (what) { | |
| 692 | + case IUserService.SUCCESS: | |
| 693 | + //成功 | |
| 694 | + break; | |
| 695 | + case IUserService.ERROR_PARAM: | |
| 696 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_param); | |
| 697 | + break; | |
| 698 | + case IUserService.ERROR_MOBILE: | |
| 699 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_mobile); | |
| 700 | + break; | |
| 701 | + case IUserService.ERROR_VERIFICATION_CODE_LENGTH: | |
| 702 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_verfication_code_length); | |
| 703 | + break; | |
| 704 | + case IUserService.ERROR_CLIENT_PLAT: | |
| 705 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_client_plat); | |
| 706 | + break; | |
| 707 | + case IUserService.ERROR_VERIFICATION_CODE: | |
| 708 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_verfication_code); | |
| 709 | + break; | |
| 710 | + case IUserService.ERROR_OTHER: | |
| 711 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_other); | |
| 712 | + break; | |
| 713 | + } | |
| 714 | + } | |
| 715 | + }); | |
| 716 | + break; | |
| 717 | + case R.id.third_party_login_with_mobile: | |
| 718 | + UserUtil.thirdPartyLoginWithMobile(1, "thirdPartyId", "frmId", new Callback() { | |
| 719 | + @Override | |
| 720 | + public void onState(int what, String extra, Object obj) { | |
| 721 | + showToast(extra + " : " + obj.toString()); | |
| 722 | + switch (what) { | |
| 723 | + case IUserService.SUCCESS: | |
| 724 | + //成功 | |
| 725 | + break; | |
| 726 | + case IUserService.ERROR_PARAM: | |
| 727 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_param); | |
| 728 | + break; | |
| 729 | + case IUserService.ERROR_THIRD_PLAT_ID: | |
| 730 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_third_plat_id); | |
| 731 | + break; | |
| 732 | + case IUserService.ERROR_CLIENT_PLAT: | |
| 733 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_client_plat); | |
| 734 | + break; | |
| 735 | + case IUserService.ERROR_MOBILE_NOT_REGISTER: | |
| 736 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_mobile_not_register); | |
| 737 | + break; | |
| 738 | + case IUserService.ERROR_OTHER: | |
| 739 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_other); | |
| 740 | + break; | |
| 741 | + } | |
| 742 | + } | |
| 743 | + }); | |
| 744 | + break; | |
| 745 | + case R.id.third_party_register_must_mobile: | |
| 746 | + UserUtil.thirdPartyLoginMustMobile(1, "thirdPartyId", "nickName", "gender", "location", "faceUrl", "frmId", "mobile", "verificationCode", "pawd", new Callback() { | |
| 747 | + @Override | |
| 748 | + public void onState(int what, String extra, Object obj) { | |
| 749 | + showToast(extra + " : " + obj.toString()); | |
| 750 | + switch (what) { | |
| 751 | + case IUserService.SUCCESS: | |
| 752 | + //成功 | |
| 753 | + break; | |
| 754 | + case IUserService.ERROR_PARAM: | |
| 755 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_param); | |
| 756 | + break; | |
| 757 | + case IUserService.ERROR_THIRD_PLAT_ID: | |
| 758 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_third_plat_id); | |
| 759 | + break; | |
| 760 | + case IUserService.ERROR_CLIENT_PLAT: | |
| 761 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_client_plat); | |
| 762 | + break; | |
| 763 | + case IUserService.ERROR_VERIFICATION_CODE: | |
| 764 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_verfication_code); | |
| 765 | + break; | |
| 766 | + case IUserService.ERROR_MOBILE: | |
| 767 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_mobile); | |
| 768 | + break; | |
| 769 | + case IUserService.ERROR_VERIFICATION_CODE_LENGTH: | |
| 770 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_verfication_code_length); | |
| 771 | + break; | |
| 772 | + case IUserService.ERROR_REGISTERED_PLEASE_LOGIN: | |
| 773 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_registered_please_login); | |
| 774 | + break; | |
| 775 | + case IUserService.ERROR_OTHER: | |
| 776 | + Log.e(TAG_SEND_MSG_BEF_FINDBACK, IUserService.message_error_other); | |
| 777 | + break; | |
| 778 | + } | |
| 779 | + } | |
| 780 | + }); | |
| 543 | 781 | } |
| 544 | 782 | } |
| 545 | 783 | ... | ... |
app/src/main/res/layout/activity_other.xml
| ... | ... | @@ -134,6 +134,7 @@ |
| 134 | 134 | </LinearLayout> |
| 135 | 135 | |
| 136 | 136 | <LinearLayout |
| 137 | + android:id="@+id/bottom_layout1" | |
| 137 | 138 | android:layout_width="match_parent" |
| 138 | 139 | android:layout_height="wrap_content" |
| 139 | 140 | android:layout_below="@id/bottom_layout" |
| ... | ... | @@ -148,6 +149,83 @@ |
| 148 | 149 | android:text="查询多条用户信息" |
| 149 | 150 | android:textColor="#0000ff" /> |
| 150 | 151 | |
| 152 | + <TextView | |
| 153 | + android:id="@+id/modify_pwd_through_oldpwd" | |
| 154 | + android:layout_width="0dp" | |
| 155 | + android:layout_height="wrap_content" | |
| 156 | + android:layout_weight="1" | |
| 157 | + android:text="通过原密码修改密码" | |
| 158 | + android:textColor="#0000ff" /> | |
| 159 | + | |
| 160 | + </LinearLayout> | |
| 161 | + | |
| 162 | + <LinearLayout | |
| 163 | + android:id="@+id/bottom_layout2" | |
| 164 | + android:layout_width="match_parent" | |
| 165 | + android:layout_height="wrap_content" | |
| 166 | + android:layout_below="@id/bottom_layout1" | |
| 167 | + android:layout_marginTop="10dp" | |
| 168 | + android:orientation="horizontal"> | |
| 169 | + | |
| 170 | + <TextView | |
| 171 | + android:id="@+id/modify_pwd_through_email" | |
| 172 | + android:layout_width="0dp" | |
| 173 | + android:layout_height="wrap_content" | |
| 174 | + android:layout_weight="1" | |
| 175 | + android:text="通过邮箱修改密码" | |
| 176 | + android:textColor="#0000ff" /> | |
| 177 | + | |
| 178 | + <TextView | |
| 179 | + android:id="@+id/check_verifycode_before_registered" | |
| 180 | + android:layout_width="0dp" | |
| 181 | + android:layout_height="wrap_content" | |
| 182 | + android:layout_weight="1" | |
| 183 | + android:text="注册前校验手机验证码" | |
| 184 | + android:textColor="#0000ff" /> | |
| 185 | + | |
| 186 | + </LinearLayout> | |
| 187 | + | |
| 188 | + <LinearLayout | |
| 189 | + android:id="@+id/bottom_layout3" | |
| 190 | + android:layout_width="match_parent" | |
| 191 | + android:layout_height="wrap_content" | |
| 192 | + android:layout_below="@id/bottom_layout2" | |
| 193 | + android:layout_marginTop="10dp" | |
| 194 | + android:orientation="horizontal"> | |
| 195 | + | |
| 196 | + <TextView | |
| 197 | + android:id="@+id/check_verifycode_before_quicklogin" | |
| 198 | + android:layout_width="0dp" | |
| 199 | + android:layout_height="wrap_content" | |
| 200 | + android:layout_weight="1" | |
| 201 | + android:text="快捷登录前校验手机验证码" | |
| 202 | + android:textColor="#0000ff" /> | |
| 203 | + | |
| 204 | + <TextView | |
| 205 | + android:id="@+id/third_party_login_with_mobile" | |
| 206 | + android:layout_width="0dp" | |
| 207 | + android:layout_height="wrap_content" | |
| 208 | + android:layout_weight="1" | |
| 209 | + android:text="第三方登录(可选手机号)" | |
| 210 | + android:textColor="#0000ff" /> | |
| 211 | + | |
| 212 | + </LinearLayout> | |
| 213 | + | |
| 214 | + <LinearLayout | |
| 215 | + android:layout_width="match_parent" | |
| 216 | + android:layout_height="wrap_content" | |
| 217 | + android:layout_below="@id/bottom_layout3" | |
| 218 | + android:layout_marginTop="10dp" | |
| 219 | + android:orientation="horizontal"> | |
| 220 | + | |
| 221 | + <TextView | |
| 222 | + android:id="@+id/third_party_register_must_mobile" | |
| 223 | + android:layout_width="0dp" | |
| 224 | + android:layout_height="wrap_content" | |
| 225 | + android:layout_weight="1" | |
| 226 | + android:text="第三方注册强制绑定手机号" | |
| 227 | + android:textColor="#0000ff" /> | |
| 228 | + | |
| 151 | 229 | </LinearLayout> |
| 152 | 230 | |
| 153 | 231 | </RelativeLayout> | ... | ... |
doc/用户Android+SDK+说明文档.pdf
No preview for this file type