hanjing лет назад: 7
Родитель
Сommit
aea980866c

+ 87 - 0
app/src/main/java/com/sheep/gamegroup/module/login/fragments/AbsLoginFgt.java

@@ -0,0 +1,87 @@
+package com.sheep.gamegroup.module.login.fragments;
+
+
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.ImageView;
+
+import com.sheep.gamegroup.module.login.controller.LoginController;
+import com.sheep.gamegroup.util.StringUtils;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.base.BaseFragment;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import butterknife.BindView;
+import butterknife.OnClick;
+
+/**
+ * A simple {@link Fragment} subclass.
+ */
+public class FindAccountFgt extends BaseFragment {
+
+    private LoginController mController;
+
+    @BindView(R.id.phone_number_box)
+    EditText phoneNumberBox;
+    @BindView(R.id.text_delete_btn)
+    ImageView textDeleteBtn;
+
+    public FindAccountFgt() {
+        // Required empty public constructor
+    }
+
+    public static FindAccountFgt newInstance(LoginController controller) {
+        FindAccountFgt fragment = new FindAccountFgt();
+        fragment.mController = controller;
+        return fragment;
+    }
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.fragment_find_account;
+    }
+
+    @Override
+    public void onViewCreated() {
+        phoneNumberBox.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) {
+                textDeleteBtn.setVisibility(TextUtils.isEmpty(s) ? View.GONE : View.VISIBLE);
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+
+            }
+        });
+    }
+
+    @OnClick(R.id.send_captcha_btn)
+    public void doSendCaptcha(View v) {
+        String phoneNum = phoneNumberBox.getText().toString().trim();
+        if (TextUtils.isEmpty(phoneNum)) {
+            G.shortToast("请输入手机号");
+            return;
+        }
+        if (!StringUtils.isMobile(phoneNum)) {
+            G.shortToast("手机号有误");
+            return;
+        }
+        mController.whenGoValidCaptcha(phoneNumberBox.getText().toString());
+    }
+
+    @OnClick(R.id.text_delete_btn)
+    public void doDeleteText(View v) {
+        phoneNumberBox.setText("");
+    }
+
+}

+ 87 - 0
app/src/main/java/com/sheep/gamegroup/module/login/fragments/WelcomeFgt.java

@@ -0,0 +1,87 @@
+package com.sheep.gamegroup.module.login.fragments;
+
+
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.ImageView;
+
+import com.sheep.gamegroup.module.login.controller.LoginController;
+import com.sheep.gamegroup.util.StringUtils;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.base.BaseFragment;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import butterknife.BindView;
+import butterknife.OnClick;
+
+/**
+ * A simple {@link Fragment} subclass.
+ */
+public class FindAccountFgt extends BaseFragment {
+
+    private LoginController mController;
+
+    @BindView(R.id.phone_number_box)
+    EditText phoneNumberBox;
+    @BindView(R.id.text_delete_btn)
+    ImageView textDeleteBtn;
+
+    public FindAccountFgt() {
+        // Required empty public constructor
+    }
+
+    public static FindAccountFgt newInstance(LoginController controller) {
+        FindAccountFgt fragment = new FindAccountFgt();
+        fragment.mController = controller;
+        return fragment;
+    }
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.fragment_find_account;
+    }
+
+    @Override
+    public void onViewCreated() {
+        phoneNumberBox.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) {
+                textDeleteBtn.setVisibility(TextUtils.isEmpty(s) ? View.GONE : View.VISIBLE);
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+
+            }
+        });
+    }
+
+    @OnClick(R.id.send_captcha_btn)
+    public void doSendCaptcha(View v) {
+        String phoneNum = phoneNumberBox.getText().toString().trim();
+        if (TextUtils.isEmpty(phoneNum)) {
+            G.shortToast("请输入手机号");
+            return;
+        }
+        if (!StringUtils.isMobile(phoneNum)) {
+            G.shortToast("手机号有误");
+            return;
+        }
+        mController.whenGoValidCaptcha(phoneNumberBox.getText().toString());
+    }
+
+    @OnClick(R.id.text_delete_btn)
+    public void doDeleteText(View v) {
+        phoneNumberBox.setText("");
+    }
+
+}

+ 68 - 56
app/src/main/java/com/sheep/jiuyan/samllsheep/ui/activity/SignActivity.java

@@ -80,7 +80,7 @@ public class SignActivity extends BaseActivity implements UMShareListener {
     ImageView sheep_sign_rectangle;
     @BindView(R.id.sheep_sign_egg_rl)
     View sheep_sign_egg_rl;//中奖的球与文本的容器
-//    @BindView(R.id.sheep_sign_egg)
+    //    @BindView(R.id.sheep_sign_egg)
 //    ImageView sheep_sign_egg;//中奖的球
     @BindView(R.id.sheep_sign_egg_msg)
     TextView sheep_sign_egg_msg;//中奖的球的文本
@@ -122,14 +122,14 @@ public class SignActivity extends BaseActivity implements UMShareListener {
         sign_etv.setOnTouchUpCountChangeListener(new Action1<Integer>() {
             @Override
             public void call(Integer count) {
-                if(count >= 4){
+                if (count >= 4) {
                     sign_etv.setFinish(true);
-                    if(canSignGuaJiang())
+                    if (canSignGuaJiang())
                         onSignGuaJiangquClicked();
                 }
             }
         });
-        if(TestUtil.isDev())
+        if (TestUtil.isDev())
             sign_gua_jiang_qu.setVisibility(View.VISIBLE);
     }
 
@@ -150,7 +150,7 @@ public class SignActivity extends BaseActivity implements UMShareListener {
 
             @Override
             public void onAnimationEnd(Animation animation) {
-                if(animationAction1 != null)
+                if (animationAction1 != null)
                     animationAction1.call(animation);
                 ViewUtil.setVisibility(sheep_sign_egg_rl, false);
             }
@@ -175,45 +175,46 @@ public class SignActivity extends BaseActivity implements UMShareListener {
 
     private void initUserSignScratchAmount() {
         SheepApp.getInstance().getNetComponent().getApiService().getUserSignScratch_amount()
-                        .subscribeOn(Schedulers.io())
-                        .observeOn(AndroidSchedulers.mainThread())
-                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                            @Override
-                            public void onNext(BaseMessage baseMessage) {
-                                Float result = baseMessage.getData(Float.class);
-                                if(result == null){
-                                    result = 0.01f;
-                                }
-                                sign_etv.setText(String.format(Locale.CHINA, "绵羊币:%s", NumberFormatUtils.retainMost2(result)));
-                            }
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        Float result = baseMessage.getData(Float.class);
+                        if (result == null) {
+                            result = 0.01f;
+                        }
+                        sign_etv.setText(String.format(Locale.CHINA, "绵羊币:%s", NumberFormatUtils.retainMost2(result)));
+                    }
 
-                            @Override
-                            public void onError(BaseMessage baseMessage) {
-                            }
-                        });
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                    }
+                });
     }
 
     //是否完成最后一次刮奖数据的获取
     private boolean isFinishInitLastScratch = false;
     //最后一次刮奖数据
     private RechargeLogEntity rechargeLogEntity;
+
     private void initUserSignLastScratch() {
         SheepApp.getInstance().getNetComponent().getApiService().getUserSignLastScratch()
-                        .subscribeOn(Schedulers.io())
-                        .observeOn(AndroidSchedulers.mainThread())
-                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                            @Override
-                            public void onNext(BaseMessage baseMessage) {
-                                rechargeLogEntity = baseMessage.getData(RechargeLogEntity.class);
-                                isFinishInitLastScratch = true;
-                                updateSignGuaJiang();
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        rechargeLogEntity = baseMessage.getData(RechargeLogEntity.class);
+                        isFinishInitLastScratch = true;
+                        updateSignGuaJiang();
 
-                            }
+                    }
 
-                            @Override
-                            public void onError(BaseMessage baseMessage) {
-                            }
-                        });
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                    }
+                });
     }
 
     private void initSignCardData() {
@@ -272,7 +273,7 @@ public class SignActivity extends BaseActivity implements UMShareListener {
                             //设置今日签到状态
                             boolean isSignToday = lastUserSign != null && lastUserSign.isToday();
                             ViewUtil.setText(sign_now_but, isSignToday ? "已签到" : "签到");
-                            if(canSignInSupplement())//今日已经签到,并且有漏签、且今日没有进行补签,就设置复活补签
+                            if (canSignInSupplement())//今日已经签到,并且有漏签、且今日没有进行补签,就设置复活补签
                                 ViewUtil.setText(sign_now_but, "复活补签");
                             updateSignGuaJiang();
                         } else {
@@ -291,12 +292,13 @@ public class SignActivity extends BaseActivity implements UMShareListener {
 
     //更新刮奖显示状态
     private void updateSignGuaJiang() {
-        if(TestUtil.isDev())
+        if (TestUtil.isDev())
             return;
         //一个周期完成且这个周期内没有刮奖时,可以进行刮奖
         ViewUtil.setVisibility(sign_gua_jiang_qu, canSignGuaJiang());
     }
-    private boolean canSignGuaJiang(){
+
+    private boolean canSignGuaJiang() {
         return isFinishInitLastScratch && ListUtil.size(userSignList) == SIGN_PERIOD && (rechargeLogEntity == null || TimeUtil.isTimeXDay(rechargeLogEntity.getCreate_time(), -SIGN_PERIOD));
     }
 
@@ -332,7 +334,7 @@ public class SignActivity extends BaseActivity implements UMShareListener {
                     @Override
                     public void onNext(BaseMessage baseMessage) {
                         SheepSignResult sheepSignResult = baseMessage.getData(SheepSignResult.class);
-                        if(sheepSignResult != null) {
+                        if (sheepSignResult != null) {
                             tryShowSignResultAndTask("补签成功", sheepSignResult.getAmount());
                             hasMissSign = false;
                         }
@@ -359,7 +361,7 @@ public class SignActivity extends BaseActivity implements UMShareListener {
                     @Override
                     public void onNext(BaseMessage baseMessage) {
                         final SheepSignResult sheepSignResult = baseMessage.getData(SheepSignResult.class);
-                        if(sheepSignResult != null) {
+                        if (sheepSignResult != null) {
                             if (sheepSignResult.isSign()) {
                                 tryShowSignResultAndTask("签到成功", sheepSignResult.getAmount());
                             } else {
@@ -429,13 +431,13 @@ public class SignActivity extends BaseActivity implements UMShareListener {
         ViewUtil.setEnabled(sign_now_but, false);
         if (canSignInSupplement()) {
             //该操作前提是lastUserSign是今天的数据,且没有进行过补签
-            if(lastUserSign.signShared()){//可以进行补签且进行过分享操作,可以直接补签
+            if (lastUserSign.signShared()) {//可以进行补签且进行过分享操作,可以直接补签
                 signInSupplement();
             } else {
                 new ShareLinkConfig().setAction1(new Action1<View>() {
                     @Override
                     public void call(View view) {
-                        if(view == null){
+                        if (view == null) {
                             ViewUtil.setEnabled(sign_now_but, true);
                         } else {
                             ViewUtil.setText((TextView) view.findViewById(R.id.ask_share_title), "邀请获得复活机会");
@@ -447,8 +449,9 @@ public class SignActivity extends BaseActivity implements UMShareListener {
             signNow();
         }
     }
+
     //判断 是否可以补签
-    private boolean canSignInSupplement(){
+    private boolean canSignInSupplement() {
         return hasMissSign && lastUserSign != null && lastUserSign.isToday() && !lastUserSign.signSupplemented();//有漏签并且今日已经签到、今日没有进行过补签,才能进行最近的补签
     }
 
@@ -468,7 +471,7 @@ public class SignActivity extends BaseActivity implements UMShareListener {
                     @Override
                     public void onNext(BaseMessage baseMessage) {
                         SheepSignResult sheepSignResult = baseMessage.getData(SheepSignResult.class);
-                        if(sheepSignResult != null) {
+                        if (sheepSignResult != null) {
                             tryShowSignResultAndTask("刮奖成功", sheepSignResult.getAmount());
                         }
                         sign_gua_jiang_qu.setVisibility(View.GONE);
@@ -481,6 +484,7 @@ public class SignActivity extends BaseActivity implements UMShareListener {
                     }
                 });
     }
+
     @OnClick(R.id.go_to_yaoqing)
     public void onGoToYaoqingClicked() {
         Jump2View.getInstance().goAskGetMoney(this, null);
@@ -495,21 +499,21 @@ public class SignActivity extends BaseActivity implements UMShareListener {
     public void onResult(SHARE_MEDIA share_media) {
 //        LogUtil.println("SignActivity", "share", "onResult", share_media.getName());
         SheepApp.getInstance().getNetComponent().getApiService().postUserSignShare()
-                        .subscribeOn(Schedulers.io())
-                        .observeOn(AndroidSchedulers.mainThread())
-                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                            @Override
-                            public void onNext(BaseMessage baseMessage) {
-                                if (canSignInSupplement())
-                                    signInSupplement();
-                            }
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        if (canSignInSupplement())
+                            signInSupplement();
+                    }
 
-                            @Override
-                            public void onError(BaseMessage baseMessage) {
-                                if (canSignInSupplement())
-                                    G.showToast(baseMessage);
-                            }
-                        });
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        if (canSignInSupplement())
+                            G.showToast(baseMessage);
+                    }
+                });
     }
 
     @Override
@@ -529,4 +533,12 @@ public class SignActivity extends BaseActivity implements UMShareListener {
         super.onActivityResult(requestCode, resultCode, data);
         UMShareAPI.get(SheepApp.getInstance()).onActivityResult(requestCode, resultCode, data);
     }
+
+    @Override
+    public void onDestroy() {
+        if (eggsView != null) {
+            eggsView.onDestroy();
+        }
+        super.onDestroy();
+    }
 }

+ 6 - 0
app/src/main/res/layout/footer_thirdpart_login.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout
+    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+</android.support.constraint.ConstraintLayout>

+ 111 - 0
app/src/main/res/layout/fragment_login_welcome.xml

@@ -0,0 +1,111 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:paddingTop="@dimen/content_padding_24"
+    android:paddingLeft="@dimen/content_padding_13"
+    android:paddingBottom="@dimen/content_padding_24"
+    android:paddingRight="@dimen/content_padding_24">
+
+    <LinearLayout
+        android:gravity="center_vertical"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <View
+            android:layout_marginRight="4dp"
+            android:layout_width="4dp"
+            android:layout_height="14dp"
+            android:background="@color/btn_color_main_stroke"/>
+        <TextView
+            android:text="方法一:"
+            android:textSize="14sp"
+            android:textColor="@color/black_6_3"
+            android:textStyle="bold"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+    </LinearLayout>
+
+    <TextView
+        android:layout_marginTop="12dp"
+        android:textSize="12sp"
+        android:layout_marginLeft="8dp"
+        android:text="已绑定小绵羊账户的用户,可以通过手机号+验证码来修改密码"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" />
+
+    <RelativeLayout
+        android:layout_marginTop="8dp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginRight="8dp"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <EditText
+            android:layout_marginTop="8dp"
+            android:id="@+id/phone_number_box"
+            android:hint="请输入手机号"
+            android:inputType="phone"
+            style="@style/login_edit_style" />
+
+        <ImageView
+            android:id="@+id/text_delete_btn"
+            android:src="@mipmap/text_delete"
+            android:visibility="gone"
+            android:layout_toLeftOf="@+id/send_captcha_btn"
+            android:layout_marginTop="24dp"
+            android:layout_marginRight="12dp"
+            android:layout_width="16dp"
+            android:layout_height="16dp" />
+
+        <View
+            style="@style/login_separetor_line_style"
+            android:layout_below="@+id/phone_number_box" />
+        <Button
+            android:id="@+id/send_captcha_btn"
+            android:text="获取验证码"
+            android:textSize="12sp"
+            android:textStyle="normal"
+            android:layout_marginTop="22dp"
+            android:layout_alignParentRight="true"
+            style="@style/login_theme_round_button"
+            android:layout_width="wrap_content"
+            android:layout_height="20dp"/>
+
+    </RelativeLayout>
+
+    <LinearLayout
+        android:layout_marginTop="16dp"
+        android:gravity="center_vertical"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <View
+            android:layout_marginRight="4dp"
+            android:layout_width="4dp"
+            android:layout_height="14dp"
+            android:background="@color/btn_color_main_stroke"/>
+        <TextView
+            android:text="方法二:"
+            android:textSize="14sp"
+            android:textColor="@color/black_6_3"
+            android:textStyle="bold"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+    </LinearLayout>
+    <TextView
+        android:text="通过联系客服申述,召回无绑定手机号的小绵羊账号及密码"
+        android:layout_marginTop="12dp"
+        android:textSize="12sp"
+        android:layout_marginLeft="8dp"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" />
+
+    <TextView
+        android:textColor="@color/btn_color_main_stroke"
+        android:layout_marginTop="24dp"
+        android:textSize="12sp"
+        android:layout_marginLeft="8dp"
+        android:text="客服QQ: 2441310002"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" />
+
+</LinearLayout>