Bläddra i källkod

完善三方快捷注册

316044749 7 år sedan
förälder
incheckning
7d8ed7d93a

+ 27 - 11
app/src/main/java/com/ynstkz/shitu/android/activity/LoginActivity.java

@@ -1,12 +1,16 @@
 package com.ynstkz.shitu.android.activity;
 
+import android.app.Dialog;
 import android.app.ProgressDialog;
 import android.content.Intent;
+import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.text.TextUtils;
+import android.view.LayoutInflater;
 import android.view.View;
+import android.view.ViewGroup;
 import android.widget.Button;
 import android.widget.EditText;
 import android.widget.ImageView;
@@ -295,27 +299,39 @@ public class LoginActivity extends TitleBarActivity {
      * 完善用户信息
      */
     private void completeUserInfo(final String thirdId, final String thirdType, final String name, final String iconurl){
-        final MaterialDialog dialog = new MaterialDialog(this);
-        dialog.setTitle("提示");
-        dialog.setMessage("请完善用户信息");
-        dialog.setPositiveButton("确定", new View.OnClickListener() {
+        final Dialog dialog = new Dialog(this);
+        View view = LayoutInflater.from(this).inflate(R.layout.view_phone_server, null);
+        dialog.setContentView(view);
+        dialog.getWindow().setLayout((int)(PixelUtil.getScreenWidth(this) * 0.9), ViewGroup.LayoutParams.WRAP_CONTENT);
+        dialog.show();
+
+        TextView dialogTitle = view.findViewById(R.id.tv_dialog_title);
+        TextView dialogMsg = view.findViewById(R.id.tv_dialog_msg);
+        TextView dialogCancle = view.findViewById(R.id.tv_dialog_cancle);
+        TextView dialogSure = view.findViewById(R.id.tv_dialog_sure);
+
+        dialogTitle.setText("提示");
+        dialogMsg.setText("请完善个人信息");
+        dialogCancle.setText("取消");
+        dialogSure.setText("确认");
+
+        dialogCancle.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
-                intent.putExtra("thirdId", thirdId);
-                intent.putExtra("thirdType", thirdType);
-                startActivity(intent);
+                thirdRegist(thirdType, thirdId, iconurl, name);
                 dialog.dismiss();
             }
         });
-        dialog.setNegativeButton("取消", new View.OnClickListener() {
+        dialogSure.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                thirdRegist(thirdType, thirdId, iconurl, name);
+                Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
+                intent.putExtra("thirdId", thirdId);
+                intent.putExtra("thirdType", thirdType);
+                startActivity(intent);
                 dialog.dismiss();
             }
         });
-        dialog.show();
     }
 
 

+ 11 - 4
app/src/main/java/com/ynstkz/shitu/android/activity/UserInfoActivity.java

@@ -14,7 +14,6 @@ import com.ynstkz.shitu.android.R;
 import com.ynstkz.shitu.android.application.STSign;
 import com.ynstkz.shitu.android.base.TitleBarActivity;
 import com.ynstkz.shitu.android.bean.UserInfoBean;
-import com.ynstkz.shitu.android.event.LoginEvent;
 import com.ynstkz.shitu.android.event.UserInfoUpdatedEvent;
 
 import org.greenrobot.eventbus.EventBus;
@@ -56,6 +55,8 @@ public class UserInfoActivity extends TitleBarActivity {
     RelativeLayout rlLogout;
     @Bind(R.id.tv_phone_bind)
     TextView tvPhoneBind;
+    @Bind(R.id.tv_password_setting)
+    TextView tvPasswordSetting;
 
     private boolean isBindPhone;
 
@@ -93,7 +94,11 @@ public class UserInfoActivity extends TitleBarActivity {
         rlAccount.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                startActivity(new Intent(UserInfoActivity.this, AlterPasswordActivity.class));
+                if(isBindPhone){
+                    startActivity(new Intent(UserInfoActivity.this, AlterPasswordActivity.class));
+                } else {
+                    startActivity(new Intent(UserInfoActivity.this, RegisterActivity.class));
+                }
             }
         });
         //第三方账号
@@ -114,7 +119,7 @@ public class UserInfoActivity extends TitleBarActivity {
         rlPhoneNumber.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                if(isBindPhone){
+                if (isBindPhone) {
                     startActivity(new Intent(UserInfoActivity.this, AlterPhoneNumberActivity.class));
                 } else {
                     startActivity(new Intent(UserInfoActivity.this, RegisterActivity.class));
@@ -146,18 +151,20 @@ public class UserInfoActivity extends TitleBarActivity {
         });
     }
 
-    private void initUserInfo(){
+    private void initUserInfo() {
         UserInfoBean userInfoBean = STSign.getInstance().getUserInfo();
         if (userInfoBean != null && userInfoBean.getData() != null) {
             tvUsername.setText(userInfoBean.getData().getUserName());
             if (!TextUtils.isEmpty(userInfoBean.getData().getMobile())) {
                 isBindPhone = true;
                 tvPhoneNumber.setVisibility(View.VISIBLE);
+                tvPasswordSetting.setVisibility(View.GONE);
                 tvPhoneBind.setText("手机号");
                 tvPhoneNumber.setText(userInfoBean.getData().getMobile().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
             } else {
                 isBindPhone = false;
                 tvPhoneNumber.setVisibility(View.GONE);
+                tvPasswordSetting.setVisibility(View.VISIBLE);
                 tvPhoneBind.setText("绑定手机号");
             }
         }

+ 9 - 4
app/src/main/java/com/ynstkz/shitu/android/application/STSign.java

@@ -141,11 +141,16 @@ public class STSign {
         dialog.getWindow().setLayout((int)(PixelUtil.getScreenWidth(context) * 0.9), ViewGroup.LayoutParams.WRAP_CONTENT);
         dialog.show();
 
-        TextView tvPnone = view.findViewById(R.id.tv_phone_number);
-        TextView tvCancle = view.findViewById(R.id.tv_cancle);
-        TextView tvCall = view.findViewById(R.id.tv_call);
+        TextView tvPnone = view.findViewById(R.id.tv_dialog_title);
+        TextView tvMsg = view.findViewById(R.id.tv_dialog_msg);
+        TextView tvCancle = view.findViewById(R.id.tv_dialog_cancle);
+        TextView tvCall = view.findViewById(R.id.tv_dialog_sure);
+
+        tvPnone.setText("拨打电话" + "40012345678");
+        tvMsg.setText("我们将为您提供更安心的服务");
+        tvCancle.setText("我再逛逛");
+        tvCall.setText("联系客服");
 
-        tvPnone.setText("40012345678");
         tvCancle.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {

+ 7 - 0
app/src/main/java/com/ynstkz/shitu/android/fragment/UserCenterFragment.java

@@ -23,6 +23,7 @@ import com.ynstkz.shitu.android.activity.MessageListActivity;
 import com.ynstkz.shitu.android.activity.MineCollectActivity;
 import com.ynstkz.shitu.android.activity.MineCommentActivity;
 import com.ynstkz.shitu.android.activity.MineSignUpActivity;
+import com.ynstkz.shitu.android.activity.RegisterActivity;
 import com.ynstkz.shitu.android.activity.SettingActivity;
 import com.ynstkz.shitu.android.activity.StudentInfoActivity;
 import com.ynstkz.shitu.android.activity.UserInfoActivity;
@@ -34,6 +35,7 @@ import com.ynstkz.shitu.android.common.Constants;
 import com.ynstkz.shitu.android.data.RequestGroup;
 import com.ynstkz.shitu.android.data.UrlCat;
 import com.ynstkz.shitu.android.event.LoginEvent;
+import com.ynstkz.shitu.android.event.RegisterSuccessEvent;
 import com.ynstkz.shitu.android.event.UserInfoChangeEvent;
 import com.ynstkz.shitu.android.event.UserInfoUpdatedEvent;
 import com.ynstkz.shitu.android.view.ScrollViewWithGridView;
@@ -239,6 +241,11 @@ public class UserCenterFragment extends BaseFragment {
         getUserInfo();
     }
 
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    public void onMessageEvent(RegisterSuccessEvent event) {
+        getUserInfo();
+    }
+
     @Override
     public void onDestroyView() {
         super.onDestroyView();

+ 13 - 0
app/src/main/res/layout/activity_userinfo.xml

@@ -54,7 +54,20 @@
             android:textColor="@color/color_333"
             android:text="账号密码"/>
 
+        <TextView
+            android:id="@+id/tv_password_setting"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:layout_marginRight="@dimen/company_10dp"
+            android:layout_toLeftOf="@+id/iv_password_more"
+            android:textSize="@dimen/company_16sp"
+            android:textColor="#ff0000"
+            android:text="未设置"
+            android:visibility="gone"/>
+
         <ImageView
+            android:id="@+id/iv_password_more"
             android:layout_width="@dimen/company_20dp"
             android:layout_height="@dimen/company_20dp"
             android:layout_centerVertical="true"

+ 16 - 14
app/src/main/res/layout/view_phone_server.xml

@@ -5,53 +5,55 @@
     android:orientation="vertical">
 
     <TextView
-        android:id="@+id/tv_phone_number"
+        android:id="@+id/tv_dialog_title"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center"
         android:layout_marginTop="@dimen/company_20dp"
         android:textColor="@color/color_333"
-        android:textSize="@dimen/company_16sp"
-        android:text="拨打电话400123456"/>
+        android:textSize="@dimen/company_16sp"/>
 
     <TextView
+        android:id="@+id/tv_dialog_msg"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center"
         android:layout_marginTop="@dimen/company_20dp"
+        android:layout_marginBottom="@dimen/company_40dp"
         android:textSize="@dimen/company_15sp"
         android:textColor="@color/color_666"
-        android:text="我们将为您提供更安心的服务"/>
+        android:text=""/>
+
+    <include layout="@layout/view_default_line"/>
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        android:layout_marginTop="@dimen/company_40dp">
+        android:orientation="horizontal">
 
         <TextView
-            android:id="@+id/tv_cancle"
+            android:id="@+id/tv_dialog_cancle"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:background="@color/main_color"
+            android:background="@color/white"
             android:padding="@dimen/company_15dp"
             android:gravity="center"
             android:textSize="@dimen/company_16sp"
-            android:textColor="@color/white"
-            android:text="我再逛逛"/>
+            android:textColor="@color/black"
+            android:text=""/>
 
         <TextView
-            android:id="@+id/tv_call"
+            android:id="@+id/tv_dialog_sure"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:background="@color/white"
+            android:background="@color/main_color"
             android:padding="@dimen/company_15dp"
             android:gravity="center"
             android:textSize="@dimen/company_16sp"
-            android:textColor="@color/black"
-            android:text="联系客服"/>
+            android:textColor="@color/white"
+            android:text=""/>
 
     </LinearLayout>