浏览代码

手机登录界面与第三方登录界面合并

zengjiebin 7 年之前
父节点
当前提交
26d3ff5a9f

+ 0 - 3
app/src/main/AndroidManifest.xml

@@ -174,9 +174,6 @@
             </intent-filter>
         </activity>
 
-        <activity android:name="com.sheep.gamegroup.view.activity.PhoneAct"
-            android:configChanges="keyboardHidden|screenSize|orientation"
-            android:screenOrientation="portrait"/>
         <activity android:name="com.sheep.gamegroup.view.activity.PersonalCenterAct"
             android:screenOrientation="portrait"/>
         <activity android:name="com.sheep.gamegroup.view.activity.WithdrawalAct"

+ 0 - 16
app/src/main/java/com/sheep/gamegroup/di/components/PhoneComponent.java

@@ -1,16 +0,0 @@
-package com.sheep.gamegroup.di.components;
-
-import com.sheep.gamegroup.di.modules.PhoneModule;
-import com.sheep.gamegroup.di.scopes.UserScope;
-import com.sheep.gamegroup.view.activity.PhoneAct;
-
-import dagger.Component;
-
-/**
- * Created by ljy on 2018/3/15.
- */
-@UserScope
-@Component(modules = PhoneModule.class, dependencies = NetComponent.class)
-public interface PhoneComponent {
-    void inject(PhoneAct phoneAct);
-}

+ 0 - 3
app/src/main/java/com/sheep/gamegroup/presenter/PhonePresenter.java

@@ -78,9 +78,6 @@ public class PhonePresenter implements PhoneContract.Presenter {
     public boolean getCaptchaa(String telphone) {
 
         try {
-            Map map = new HashMap();
-            map.put("account", telphone);
-            Log.e("hash-map", map.toString());
             com.alibaba.fastjson.JSONObject j = new com.alibaba.fastjson.JSONObject();
             j.put("account", telphone);
 

+ 0 - 13
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -71,7 +71,6 @@ import com.sheep.gamegroup.view.activity.LieMakeMoneyAct;
 import com.sheep.gamegroup.view.activity.LoginAct;
 import com.sheep.gamegroup.view.activity.PersonalCenterAct;
 import com.sheep.gamegroup.view.activity.PersonalInfoAct;
-import com.sheep.gamegroup.view.activity.PhoneAct;
 import com.sheep.gamegroup.view.activity.RealNameAuthenAct;
 import com.sheep.gamegroup.view.activity.RechargeAct;
 import com.sheep.gamegroup.view.activity.RechargeQAct;
@@ -300,18 +299,6 @@ public class Jump2View {
         });
     }
 
-
-    /**
-     * 跳到手机登录页面
-     * @param context
-     * @param o:  0:登录,1:旧手机号,2:新手机号
-     */
-    public void goPhoneLoginView(Context context, int o){
-        Intent intent = new Intent(context, PhoneAct.class);
-        intent.putExtra("show_notice",  o);
-        context.startActivity(intent);
-    }
-
     /**
      * 跳到个人中心页面
      * @param context

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/util/UMConfigUtils.java

@@ -98,7 +98,7 @@ public class UMConfigUtils {
         NEWBIE_TASK("点击新手任务图标"),//5065
         AD_SPLASH("点击开屏广告 需要传点击的广告对应的id,如:{\"ad_id\": 1}"),//5066
         AD_TOAST("点击弹窗广告 需要传点击的广告对应的id,如:{\"ad_id\": 1}"),//5067
-        LOGIN_PHONE("点击登录界面中的手机号登录"),//5068
+        LOGIN_PHONE("点击登录界面中的手机号登录  注:!!!!!手机号登录界面已经与登录界面合并了,所以不再触发该操作!!!!!"),//5068
         LOGIN_QQ("点击登录界面中的QQ登录"),//5069
         LOGIN_WX("点击登录界面中的微信登录"),//5070
         USER_INFO("个人中心 -> 个人资料"),//5071

+ 238 - 55
app/src/main/java/com/sheep/gamegroup/view/activity/LoginAct.java

@@ -1,20 +1,34 @@
 package com.sheep.gamegroup.view.activity;
 
+import android.os.Bundle;
+import android.support.v7.widget.AppCompatCheckBox;
+import android.support.v7.widget.AppCompatEditText;
 import android.text.TextUtils;
+import android.util.Log;
 import android.view.View;
-import android.widget.CheckBox;
 import android.widget.ImageView;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.alibaba.fastjson.JSONObject;
 import com.sheep.gamegroup.absBase.BaseUMActivity;
 import com.sheep.gamegroup.di.components.DaggerLoginComponent;
 import com.sheep.gamegroup.di.modules.LoginModule;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.LoginEntity;
+import com.sheep.gamegroup.model.util.EntityUtils;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.presenter.LoginContract;
 import com.sheep.gamegroup.presenter.LoginPresenter;
-import com.sheep.gamegroup.util.GlideImageLoader;
+import com.sheep.gamegroup.util.ActivityManager;
+import com.sheep.gamegroup.util.ChannelContent;
+import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.LogUtil;
+import com.sheep.gamegroup.util.PreferenceUtils;
+import com.sheep.gamegroup.util.SelfCountDownTimer;
 import com.sheep.gamegroup.util.TestUtil;
+import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
@@ -23,15 +37,18 @@ import com.umeng.socialize.UMAuthListener;
 import com.umeng.socialize.UMShareAPI;
 import com.umeng.socialize.bean.SHARE_MEDIA;
 
+import java.util.Locale;
 import java.util.Map;
 
 import javax.inject.Inject;
 
 import butterknife.BindView;
+import butterknife.ButterKnife;
 import butterknife.OnClick;
+import rx.android.schedulers.AndroidSchedulers;
 import rx.functions.Action1;
+import rx.schedulers.Schedulers;
 
-import static com.sheep.gamegroup.util.UMConfigUtils.Event.LOGIN_PHONE;
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.LOGIN_QQ;
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.LOGIN_WX;
 
@@ -43,36 +60,45 @@ public class LoginAct extends BaseUMActivity implements LoginContract.View {
 
     @Inject
     LoginPresenter mPresenter;
-
-    @BindView(R.id.login_bg_img)
-    ImageView login_bg_img;
-
-    @BindView(R.id.tel_login_tv)
-    TextView telLoginTv;
+    @BindView(R.id.login_agreement_cb)
+    AppCompatCheckBox loginAgreementCb;
+    @BindView(R.id.login_agreement_tv)
+    TextView loginAgreementTv;
+    @BindView(R.id.login_agreement_ll)
+    LinearLayout loginAgreementLl;
     @BindView(R.id.iv_wx)
     ImageView ivWx;
     @BindView(R.id.iv_qq)
     ImageView ivQq;
-
-    @BindView(R.id.tel_agreement_cb)
-    CheckBox tel_agreement_cb;
-    @BindView(R.id.tel_agreement_tv)
-    TextView tel_agreement_tv;
+    @BindView(R.id.login_other_ll)
+    LinearLayout loginOtherLl;
+    @BindView(R.id.login_et_account)
+    AppCompatEditText loginEtAccount;
+    @BindView(R.id.login_et_code)
+    AppCompatEditText loginEtCode;
+    @BindView(R.id.login_btn_code)
+    TextView loginBtnCode;
+    @BindView(R.id.login_et_scope)
+    AppCompatEditText loginEtScope;
+    @BindView(R.id.test_change)
+    TextView testChange;
+    @BindView(R.id.test_change_user)
+    TextView testChangeUser;
 
 
     @Override
     protected int getLayoutId() {
         return R.layout.login_act_layout;
     }
-
+    private LoginAct activity;
     @Override
     public void initView() {
+        activity = this;
         DaggerLoginComponent.builder()
                 .netComponent(SheepApp.get(this).getNetComponent())
                 .loginModule(new LoginModule(this))
                 .build()
                 .inject(this);
-        GlideImageLoader.setImage(login_bg_img, "http://cdngame.kuaifazs.com/login_bg_img.png");
         TestUtil.testChange(this, (TextView) findViewById(R.id.test_change));
         TestUtil.testChangeUser(this, (TextView) findViewById(R.id.test_change_user));
 
@@ -81,7 +107,24 @@ public class LoginAct extends BaseUMActivity implements LoginContract.View {
 
     @Override
     public void initListener() {
+        selfCountDownTimer = new SelfCountDownTimer(60 * 1000, 1000, SelfCountDownTimer.FULL_SECOND) {
+            @Override
+            public void onTimerRest() {
+                canGetCaptchaPhone = true;
+                loginBtnCode.setText(getString(R.string.get_captcha));
+            }
 
+            @Override
+            public void onTimerTick(long millisUntilFinished, int countTime) {
+                loginBtnCode.setText(String.format(Locale.CHINA, "%d s", countTime));
+            }
+
+            @Override
+            public void onTimerFinish() {
+                canGetCaptchaPhone = true;
+                loginBtnCode.setText(getString(R.string.get_captcha));
+            }
+        };
     }
 
     @Override
@@ -89,22 +132,6 @@ public class LoginAct extends BaseUMActivity implements LoginContract.View {
 
     }
 
-
-
-
-    private void goTelLogin() {
-        LOGIN_PHONE.onEvent();
-        String openId = SpUtils.getToken(getApplicationContext());
-        LogUtil.logI("手机号码登录--token----"+openId);
-        if (!TextUtils.isEmpty(openId)) {
-            Jump2View.getInstance().checkPhoneOrGoHomePage(this);
-            finish();
-        } else {
-            Jump2View.getInstance().goPhoneLoginView(LoginAct.this, 0);
-//            finish();
-        }
-    }
-
     private void goWeixin() {
         LOGIN_WX.onEvent();
         UMShareAPI.get(this).doOauthVerify(this, SHARE_MEDIA.WEIXIN, new UMAuthListener() {
@@ -115,17 +142,17 @@ public class LoginAct extends BaseUMActivity implements LoginContract.View {
 
             @Override
             public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) {
-                mPresenter.logByAuther(1,data.get("access_token"),data.get("openid"));
+                mPresenter.logByAuther(1, data.get("access_token"), data.get("openid"));
             }
 
             @Override
             public void onError(SHARE_MEDIA platform, int action, Throwable t) {
                 hideProgress();
-                String  str=t.getMessage();
-                if(str.indexOf("2008")>0) {
+                String str = t.getMessage();
+                if (str.indexOf("2008") > 0) {
                     G.showToast("微信授权失败,请先安装微信客户端 在登录吧!");
 
-                }else{
+                } else {
                     G.showToast("微信授权失败  请检查网络是否正常");
 
                 }
@@ -147,13 +174,13 @@ public class LoginAct extends BaseUMActivity implements LoginContract.View {
         UMShareAPI.get(this).doOauthVerify(this, SHARE_MEDIA.QQ, new UMAuthListener() {
             @Override
             public void onStart(SHARE_MEDIA platform) {
-                 showProgress();
+                showProgress();
             }
 
             @Override
             public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) {
 //                mPresenter.logByAuther(2,data.get("openid"));
-                mPresenter.logByAuther(2,data.get("access_token"),data.get("openid"));
+                mPresenter.logByAuther(2, data.get("access_token"), data.get("openid"));
 
             }
 
@@ -190,40 +217,196 @@ public class LoginAct extends BaseUMActivity implements LoginContract.View {
     }
 
 
-
-    @OnClick({R.id.tel_login_tv, R.id.iv_wx, R.id.iv_qq, R.id.tel_agreement_tv})
+    @OnClick({R.id.login_agreement_tv, R.id.iv_wx, R.id.iv_qq, R.id.login_btn_code, R.id.login_commit})
     public void onViewClicked(View view) {
         switch (view.getId()) {
-            case R.id.tel_login_tv:
-                if(checkAgreement())
-                    goTelLogin();
+            case R.id.login_agreement_tv:
+                Jump2View.getInstance().tryShowAgreement(this, new Action1<String>() {
+                    @Override
+                    public void call(String msg) {
+                        if (!TextUtils.isEmpty(msg)) {
+                            G.showToast(msg);
+                        }
+                    }
+                });
                 break;
             case R.id.iv_wx:
-                if(checkAgreement())
+                if (checkAgreement())
                     goWeixin();
                 break;
             case R.id.iv_qq:
-                if(checkAgreement())
+                if (checkAgreement())
                     loginQQ();
                 break;
-            case R.id.tel_agreement_tv:
-                Jump2View.getInstance().tryShowAgreement(this, new Action1<String>() {
-                            @Override
-                            public void call(String msg) {
-                                if(!TextUtils.isEmpty(msg)) {
-                                    G.showToast(msg);
-                                }
-                            }
-                        });
+            case R.id.login_btn_code:
+                etPhone = loginEtAccount.getText().toString().trim();
+                getCaptcha();
+                break;
+            case R.id.login_commit:
+                etPhone = loginEtAccount.getText().toString().trim();
+                etCode = loginEtCode.getText().toString().trim();
+                if (TestUtil.isTest() && TextUtils.isEmpty(etCode)) {
+                    if (TextUtils.isEmpty(etPhone))
+                        etPhone = "13626@395a75211751465f54789a7f459089bd";
+                    goMain(etPhone);
+                    if (!TextUtils.isEmpty(etPhone))
+                        TestUtil.addUser(etPhone);
+                    return;
+                }
+                loginByPhoneCaptcha();
                 break;
         }
     }
+    private void goMain(String openId) {
+        LogUtil.logI("goMain--token----"+openId);
+        SpUtils.saveToken(getApplicationContext(), openId);
+        Jump2View.getInstance().goHomePageView(this, null);
+        ActivityManager.getInstance().endActivity(LoginAct.class);
+        finish();
+    }
+
+    /**
+     * 登录
+     */
+    private void loginByPhoneCaptcha() {
+        if (!checkPhoneInput()) {
+            return;
+        }
+        if (!checkCodeInput()) {
+            return;
+        }
+        String scope = loginEtScope.getText().toString();
+        if(TextUtils.isEmpty(scope)){
+            scope = ChannelContent.getInstance().getChannel_name();
+        }
+        showProgress();
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("account", etPhone);
+        jsonObject.put("sec_code", etCode);
+        jsonObject.put("invitation_code", scope);
+        PreferenceUtils.setPrefString(SheepApp.mContext, UMConfigUtils.LOGIN_TYPE, UMConfigUtils.Source.SHEEP);
+        SheepApp.getInstance().getNetComponent().getApiService().loginByCaptcha(jsonObject)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        hideProgress();
+                        G.showToast(baseMessage);
+                    }
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        hideProgress();
+                        if (baseMessage == null) {
+                            return;
+                        }
+                        LoginEntity loginEty = null;
+                        try {
+                            loginEty = JSONObject.parseObject(JSONObject.toJSONString(baseMessage.getData()), LoginEntity.class);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                        if (loginEty != null) {
+                            SpUtils.saveToken(activity, loginEty.getToken());
+                            DataUtil.getInstance().setUserEntity(loginEty.getUser());
+                        }
+
+                        Jump2View.getInstance().goHomePageView(activity, EntityUtils.getUserCode(loginEty));
+                        TestUtil.saveUser(loginEty);
+
+                    }
+                });
+
+    }
+    private String etPhone;
+    private String etCode;
+    private boolean canGetCaptchaPhone = true;
+    private SelfCountDownTimer selfCountDownTimer;
+    /**
+     * 获取验证码
+     */
+    private void getCaptcha() {
+
+        if (!canGetCaptchaPhone) {
+            return;
+        }
+        if (!checkPhoneInput()) {
+            return;
+        }
+        selfCountDownTimer.reset(SelfCountDownTimer.FULL_SECOND);
+        canGetCaptchaPhone = true;
+        getCaptcha(etPhone, new Action1<BaseMessage>() {
+            @Override
+            public void call(BaseMessage baseMessage) {
+                if(baseMessage != null)
+                    selfCountDownTimer.start();
+            }
+        });
+    }
+
+    public void getCaptcha(String etPhone, final Action1<BaseMessage> action1) {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("account", etPhone);
+        SheepApp.getInstance().getNetComponent().getApiService().getCaptcha(jsonObject)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        action1.call(null);
+                    }
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        action1.call(baseMessage);
+                    }
+                });
+
+    }
+    private boolean checkPhoneInput() {
+        if (TextUtils.isEmpty(etPhone)) {
+            G.showToast(getString(R.string.input_your_phone));
+            return false;
+        }
+        if (etPhone.length() != 11) {
+            G.showToast(getString(R.string.toast_warning_phone_number_size));
+            return false;
+        }
+        return true;
+    }
 
+    private boolean checkCodeInput() {
+        if (TextUtils.isEmpty(etCode)) {
+            G.showToast(getString(R.string.input_your_captcha));
+            return false;
+        }
+        if (etCode.length() != 6) {
+            G.showToast(getString(R.string.toast_warning_phone_captcha_image_code_size));
+            return false;
+        }
+        return true;
+    }
     private boolean checkAgreement() {
-        if(tel_agreement_cb.isChecked()){
+        if (loginAgreementCb.isChecked()) {
             return true;
         }
         G.showToast("温馨提示:您必须同意用户协议才能继续体验小绵羊APP!");
         return false;
     }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        // TODO: add setContentView(...) invocation
+        ButterKnife.bind(this);
+    }
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        if (selfCountDownTimer != null) {
+            selfCountDownTimer.cancel();
+        }
+    }
+
 }

+ 0 - 337
app/src/main/java/com/sheep/gamegroup/view/activity/PhoneAct.java

@@ -1,337 +0,0 @@
-package com.sheep.gamegroup.view.activity;
-
-import android.app.Activity;
-import android.content.Context;
-import android.support.v7.widget.AppCompatEditText;
-import android.text.InputFilter;
-import android.text.InputType;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.alibaba.fastjson.JSONObject;
-import com.sheep.gamegroup.absBase.BaseActivity;
-import com.sheep.gamegroup.di.components.DaggerPhoneComponent;
-import com.sheep.gamegroup.di.modules.PhoneModule;
-import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.LoginEntity;
-import com.sheep.gamegroup.model.entity.UserEntity;
-import com.sheep.gamegroup.model.util.EntityUtils;
-import com.sheep.gamegroup.presenter.PhoneContract;
-import com.sheep.gamegroup.presenter.PhonePresenter;
-import com.sheep.gamegroup.util.ActivityManager;
-import com.sheep.gamegroup.util.DataUtil;
-import com.sheep.gamegroup.util.GlideImageLoader;
-import com.sheep.gamegroup.util.Jump2View;
-import com.sheep.gamegroup.util.LogUtil;
-import com.sheep.gamegroup.util.MyDbManager;
-import com.sheep.gamegroup.util.SelfCountDownTimer;
-import com.sheep.gamegroup.util.TestUtil;
-import com.sheep.jiuyan.samllsheep.R;
-import com.sheep.jiuyan.samllsheep.SheepApp;
-import com.sheep.jiuyan.samllsheep.utils.G;
-import com.sheep.jiuyan.samllsheep.utils.SpUtils;
-import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
-
-import javax.inject.Inject;
-
-import butterknife.BindView;
-import butterknife.OnClick;
-
-/**
- * Created by ljy on 2018/3/15.
- */
-
-public class PhoneAct extends BaseActivity implements PhoneContract.View {
-    Activity activity;
-    @BindView(R.id.phone_et_account)
-    AppCompatEditText phoneEtAccount;
-    @BindView(R.id.phone_et_code)
-    AppCompatEditText phoneEtCode;
-    @BindView(R.id.phone_btn_code)
-    TextView phoneBtnCode;
-    @BindView(R.id.phone_sure_tv)
-    TextView phoneSureTv;
-    @BindView(R.id.phone_iv)
-    ImageView phone_iv;
-
-    @Inject
-    PhonePresenter phonePresenter;
-    @BindView(R.id.phone_tip_tv)
-    TextView phoneTipTv;
-
-    private SelfCountDownTimer selfCountDownTimer;
-    private boolean canGetCaptchaPhone = true;
-
-    private String etPhone;
-    private String etCode;
-    private int showNotice;//0:登录,1:旧手机号,2:新手机号
-
-
-    @Override
-    protected int getLayoutId() {
-        return R.layout.bind_phone_number_act_layout;
-    }
-
-    @Override
-    public void initView() {
-        activity = this;
-        showNotice = getIntent().getIntExtra("show_notice", 0);
-        TitleBarUtils
-                .getInstance()
-                .setTitle(this, "手机号登录")
-                .setTitleFinish(this);
-        DaggerPhoneComponent.builder()
-                .netComponent(SheepApp.get(this).getNetComponent())
-                .phoneModule(new PhoneModule(this))
-                .build()
-                .inject(this);
-        if (TestUtil.isTest()) {
-            phoneEtAccount.setInputType(InputType.TYPE_CLASS_TEXT);
-            phoneEtAccount.setFilters(new InputFilter[]{new InputFilter.LengthFilter(1000)});
-        }
-        GlideImageLoader.centerImage(phone_iv, "http://cdngame.kuaifazs.com/icon_phone.png");
-    }
-
-    @Override
-    public void initListener() {
-        selfCountDownTimer = new SelfCountDownTimer(60 * 1000, 1000, SelfCountDownTimer.FULL_SECOND) {
-            @Override
-            public void onTimerRest() {
-                canGetCaptchaPhone = true;
-                phoneBtnCode.setText(getString(R.string.get_captcha));
-            }
-
-            @Override
-            public void onTimerTick(long millisUntilFinished, int counTime) {
-                String textStr = counTime + " s";
-                phoneBtnCode.setText(textStr);
-            }
-
-            @Override
-            public void onTimerFinish() {
-                canGetCaptchaPhone = true;
-                phoneBtnCode.setText(getString(R.string.get_captcha));
-            }
-        };
-    }
-
-    @Override
-    public void initData() {
-        if (showNotice == 0) {
-            phoneTipTv.setVisibility(View.GONE);
-        } else if (showNotice == 1) {
-            phoneTipTv.setVisibility(View.GONE);
-            phone_iv.setVisibility(View.GONE);
-        } else if (showNotice == 2) {
-            phoneTipTv.setVisibility(View.GONE);
-            phone_iv.setVisibility(View.GONE);
-        } else {
-            phoneTipTv.setVisibility(View.VISIBLE);
-
-        }
-
-    }
-
-    @OnClick({R.id.phone_et_account, R.id.phone_et_code, R.id.phone_btn_code, R.id.phone_sure_tv})
-    public void onViewClicked(View view) {
-        switch (view.getId()) {
-            case R.id.phone_et_account:
-                break;
-            case R.id.phone_et_code:
-                break;
-            case R.id.phone_btn_code:
-                etPhone = phoneEtAccount.getText().toString().trim();
-                getCaptcha();
-                break;
-            case R.id.phone_sure_tv:
-                etPhone = phoneEtAccount.getText().toString().trim();
-                etCode = phoneEtCode.getText().toString().trim();
-                if (TestUtil.isTest() && TextUtils.isEmpty(etCode)) {
-                    if (TextUtils.isEmpty(etPhone))
-                        etPhone = "13626@395a75211751465f54789a7f459089bd";
-                    goMain(etPhone);
-                    if (!TextUtils.isEmpty(etPhone))
-                        TestUtil.addUser(etPhone);
-                    return;
-                }
-                loginByPhoneGaptcha();
-                break;
-        }
-    }
-
-    private boolean checkPhoneInput() {
-        if (TextUtils.isEmpty(etPhone)) {
-            G.showToast(getString(R.string.input_your_phone));
-            return false;
-        }
-        if (etPhone.length() != 11) {
-            G.showToast(getString(R.string.toast_warning_phone_number_size));
-            return false;
-        }
-        return true;
-    }
-
-    private boolean checkCodeInput() {
-        if (TextUtils.isEmpty(etCode)) {
-            G.showToast(getString(R.string.input_your_captcha));
-            return false;
-        }
-        if (etCode.length() != 6) {
-            G.showToast(getString(R.string.toast_warning_phone_captcha_image_code_size));
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 获取验证码
-     */
-    private void getCaptcha() {
-
-        if (!canGetCaptchaPhone) {
-            return;
-        }
-        if (!checkPhoneInput()) {
-            return;
-        }
-        selfCountDownTimer.reset(SelfCountDownTimer.FULL_SECOND);
-        canGetCaptchaPhone = true;
-        if (phonePresenter.getCaptchaa(etPhone)) {//成功获取验证码后,开启倒计时
-            selfCountDownTimer.start();
-        }
-
-    }
-
-    /**
-     * 登录
-     */
-    private void loginByPhoneGaptcha() {
-        if (!checkPhoneInput()) {
-            return;
-        }
-        if (!checkCodeInput()) {
-            return;
-        }
-
-        showProgress();
-        phonePresenter.loginByCaptcha(etPhone, etCode);
-    }
-
-    @Override
-    public void returnGaptcha(Object o) {
-        Log.e("---Gaptcha-", o.toString());
-
-    }
-
-    /**
-     * 验证码获取失败
-     *
-     * @param o
-     */
-    @Override
-    public void gaptchaFail(BaseMessage o) {
-        hideProgress();
-        G.showToast(o.getMsg() + "");
-
-    }
-
-    @Override
-    public void returnLogindata(Object o) {
-        hideProgress();
-        if (o == null) {
-            return;
-        }
-        BaseMessage baseMessage = (BaseMessage) o;
-//        JSONObject a = JSON.parseObject(o.toString());
-        Log.e("------data", baseMessage.getData() + "");
-        LoginEntity loginEty = null;
-        try {
-            loginEty = JSONObject.parseObject(JSONObject.toJSONString(baseMessage.getData()), LoginEntity.class);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        if (loginEty != null) {
-            SpUtils.saveToken(activity, loginEty.getToken());
-            DataUtil.getInstance().setUserEntity(loginEty.getUser());
-        }
-
-        Jump2View.getInstance().goHomePageView(this, EntityUtils.getUserCode(loginEty));
-        Log.e("---login_-", o.toString());
-        TestUtil.saveUser(loginEty);
-    }
-
-    @Override
-    public void loginFail(BaseMessage o) {
-        hideProgress();
-        G.showToast(o.getMsg() + "");
-//        testData();
-    }
-
-    @Override
-    public void changeTelSuccess(BaseMessage o) {
-
-    }
-
-    @Override
-    public void changeTelFail(BaseMessage o) {
-
-    }
-
-    @Override
-    public void bindTelSuccess(BaseMessage o) {
-
-    }
-
-    @Override
-    public void bindTelFail(BaseMessage o) {
-
-    }
-
-    @Override
-    public void bindTelSmsSuccess(BaseMessage o) {
-
-    }
-
-    @Override
-    public void bindTelSmsFail(BaseMessage o) {
-
-    }
-
-
-    /**
-     * 监听软键盘
-     */
-    @Override
-    public boolean dispatchKeyEvent(KeyEvent event) {
-        if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
-            InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
-            if (inputMethodManager.isActive()) {
-                inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
-                return true;
-            }
-        }
-        return super.dispatchKeyEvent(event);
-    }
-
-
-    private void goMain(String openId) {
-        LogUtil.logI("goMain--token----"+openId);
-        SpUtils.saveToken(getApplicationContext(), openId);
-        Jump2View.getInstance().goHomePageView(this, null);
-        ActivityManager.getInstance().endActivity(LoginAct.class);
-        finish();
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        if (selfCountDownTimer != null) {
-            selfCountDownTimer.cancel();
-        }
-    }
-}

+ 1 - 3
app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java

@@ -24,8 +24,6 @@ import com.sheep.gamegroup.util.ScreenShotListenManager;
 import com.sheep.gamegroup.util.SysAppUtil;
 import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.gamegroup.view.activity.LoginAct;
-import com.sheep.gamegroup.view.activity.PhoneAct;
-import com.sheep.gamegroup.view.activity.SplashAct;
 import com.sheep.jiuyan.samllsheep.service.DownloadService;
 import com.sheep.jiuyan.samllsheep.service.FloatService;
 import com.sheep.jiuyan.samllsheep.service.FloatShotScreenService;
@@ -147,7 +145,7 @@ public class SheepApp extends BaseApplication {
         @Override
         public void onActivityCreated(final Activity activity, Bundle savedInstanceState) {
             ActivityManager.getInstance().pushActivity(activity);
-            if(/*activity instanceof SplashAct || */activity instanceof LoginAct || activity instanceof PhoneAct){
+            if(/*activity instanceof SplashAct || */activity instanceof LoginAct){
                 SysAppUtil.showVersionInfo(activity, SpUtils.getIgnoreMd5());
             } else if(activity instanceof ActMain){
                 SysAppUtil.showVersionInfo(activity, SpUtils.getIgnoreMd5(), new Action1<Integer>() {

+ 6 - 0
app/src/main/res/drawable/shape_blue_solid_rectangle_15.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="15dp" />
+    <solid android:color="#28A4EF" />
+</shape>

+ 0 - 122
app/src/main/res/layout/bind_phone_number_act_layout.xml

@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical"
-    android:background="@color/bg_gray">
-
-    <include
-        layout="@layout/title"/>
-    <ScrollView
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:scrollbars="none">
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical">
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:orientation="vertical">
-                <ImageView
-                    android:id="@+id/phone_iv"
-                    android:layout_width="145dp"
-                    android:layout_height="140dp"
-                    android:layout_gravity="center_horizontal"
-                    android:layout_marginLeft="100dp"
-                    android:layout_marginRight="100dp"
-                    android:src="@mipmap/icon"
-                    android:layout_marginTop="35dp"
-                    android:layout_marginBottom="5dp"/>
-            </LinearLayout>
-
-            <TextView
-                android:id="@+id/phone_tip_tv"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="为了避免机器刷单,请绑定手机号后领取任务奖励"
-                android:textColor="@color/black_444444"
-                android:textSize="11dp"
-                android:layout_gravity="center_horizontal"
-                android:layout_marginTop="@dimen/content_padding_small"/>
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="12dp"
-                android:layout_marginRight="12dp"
-                android:layout_marginTop="40dp"
-                android:background="@drawable/x_shap_shadow_bg_rectgangle_white"
-                android:orientation="vertical">
-                <android.support.v7.widget.AppCompatEditText
-                    android:id="@+id/phone_et_account"
-                    style="@style/edt_style"
-                    android:inputType="phone"
-                    android:layout_width="match_parent"
-                    android:layout_height="@dimen/edt_heigh_default"
-                    android:layout_centerVertical="true"
-                    android:layout_margin="@dimen/content_padding_small"
-                    android:hint="请输入手机号"
-                    android:paddingLeft="@dimen/content_padding_big"
-                    android:maxLength="11"/>
-
-                <View
-                    android:layout_width="match_parent"
-                    android:layout_height="1px"
-                    android:background="@color/white_bg_line"
-                    android:layout_marginLeft="15dp"
-                    android:layout_marginRight="15dp"
-                    />
-
-                <LinearLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_margin="@dimen/content_padding_small"
-                    android:orientation="horizontal"
-                    >
-
-                    <android.support.v7.widget.AppCompatEditText
-                        android:id="@+id/phone_et_code"
-                        style="@style/edt_style"
-                        android:layout_width="0dp"
-                        android:layout_height="@dimen/edt_heigh_default"
-                        android:layout_weight="2"
-                        android:hint="请输入验证码"
-                        android:inputType="number"
-                        android:paddingLeft="@dimen/content_padding_big"
-                        android:maxLength="6"
-                        android:textSize="@dimen/text_size_3"/>
-                    <TextView
-                        android:id="@+id/phone_btn_code"
-                        android:layout_width="0dp"
-                        android:layout_height="wrap_content"
-                        android:layout_gravity="center|center_vertical"
-                        android:layout_marginLeft="@dimen/content_padding"
-                        android:layout_weight="1"
-                        android:gravity="center"
-                        android:text="@string/get_captcha"
-                        android:textColor="@color/txt_bule"
-                        />
-
-                </LinearLayout>
-            </LinearLayout>
-
-
-
-            <TextView
-                android:id="@+id/phone_sure_tv"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="?attr/actionBarSize"
-                android:gravity="center"
-                android:layout_gravity="center_horizontal"
-                android:text="确 定"
-                style="@style/txt_big_btn_style"/>
-
-        </LinearLayout>
-    </ScrollView>
-
-
-
-</LinearLayout>

+ 151 - 76
app/src/main/res/layout/login_act_layout.xml

@@ -1,133 +1,208 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    >
+    android:layout_height="match_parent">
 
-    <RelativeLayout
+    <ImageView
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        style="@style/login_layout"
-        android:layout_marginTop="@dimen/content_padding_80">
-        <ImageView
-            android:id="@+id/login_bg_img"
+        android:adjustViewBounds="true"
+        android:scaleType="fitXY"
+        android:src="@mipmap/login_bg" />
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+        <View
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:scaleType="centerCrop"/>
+            android:layout_height="0dp"
+            android:layout_weight="60"/>
         <LinearLayout
-            android:id="@+id/tel_agreement_ll"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:layout_alignParentBottom="true"
-            android:layout_marginBottom="@dimen/content_padding_40"
-            android:gravity="center"
-            android:layout_centerHorizontal="true">
-            <android.support.v7.widget.AppCompatCheckBox
-                android:id="@+id/tel_agreement_cb"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:checked="true"
-                android:scaleX="1.4"
-                android:scaleY="1.4"
-                android:button="@drawable/drawable_selector_check"/>
-            <TextView
-                android:id="@+id/tel_agreement_tv"
-                android:layout_width="wrap_content"
+            android:layout_marginStart="48dp"
+            android:layout_marginEnd="48dp"
+            android:orientation="vertical">
+
+            <android.support.v7.widget.AppCompatEditText
+                android:id="@+id/login_et_account"
+                style="@style/style_login_et"
+                android:hint="请输入手机号"
+                android:inputType="phone"
+                android:maxLength="11"/>
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="@color/white" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginStart="5dp"
-                android:text="我已阅读并同意《小绵羊平台用户协议》"
-                android:textColor="@color/white"
-                android:textSize="12sp"/>
-        </LinearLayout>
+                android:orientation="horizontal">
+
+                <android.support.v7.widget.AppCompatEditText
+                    android:id="@+id/login_et_code"
+                    style="@style/style_login_et"
+                    android:layout_width="0dp"
+                    android:layout_weight="1"
+                    android:hint="请输入验证码"
+                    android:inputType="number"
+                    android:maxLength="6" />
+
+                <TextView
+                    android:id="@+id/login_btn_code"
+                    android:layout_width="wrap_content"
+                    android:layout_height="30dp"
+                    android:layout_gravity="center|center_vertical"
+                    android:layout_marginStart="5dp"
+                    android:paddingStart="11dp"
+                    android:paddingEnd="11dp"
+                    android:gravity="center"
+                    android:textSize="12sp"
+                    android:text="@string/get_captcha"
+                    android:textColor="@color/white"
+                    android:background="@drawable/shape_blue_solid_rectangle_15"/>
 
+            </LinearLayout>
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="@color/white" />
+            <android.support.v7.widget.AppCompatEditText
+                android:id="@+id/login_et_scope"
+                style="@style/style_login_et"
+                android:hint="请输入邀请码"
+                android:inputType="phone"
+                android:maxLength="11"/>
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="@color/white" />
+        </LinearLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="7"/>
         <TextView
-            android:id="@+id/tel_login_tv"
-            android:layout_width="wrap_content"
-            android:layout_height="38dp"
-            android:text="手机号登录"
-            android:layout_centerHorizontal="true"
-            android:layout_above="@+id/tel_agreement_ll"
-            style="@style/login_btn"
-            android:paddingStart="@dimen/content_padding_40"
-            android:paddingEnd="@dimen/content_padding_40"
+            android:id="@+id/login_commit"
+            android:layout_width="match_parent"
+            android:layout_height="36dp"
+            android:textColor="#36A5ED"
+            android:layout_marginStart="48dp"
+            android:layout_marginEnd="48dp"
+            android:textSize="18sp"
             android:gravity="center"
-            android:textColor="@color/txt_white"
-            android:background="@drawable/x_shap_shadow_stroke_rectgangle"
-            android:layout_marginBottom="8dp"
-            android:layout_marginTop="@dimen/content_padding_20"/>
-
+            android:background="@drawable/shape_white_solid_rectangle"
+            android:text="登录"/>
 
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="11"/>
         <LinearLayout
+            android:id="@+id/login_other_ll"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:layout_above="@+id/tel_login_tv"
-            android:layout_centerHorizontal="true"
-            >
+            android:layout_gravity="center_horizontal"
+            android:orientation="horizontal">
 
             <View
                 android:layout_width="10dp"
                 android:layout_height="1dp"
-                android:background="@color/txt_white"
-                android:layout_gravity="center_vertical" />
+                android:layout_gravity="center_vertical"
+                android:background="@color/txt_white" />
 
             <ImageView
-                android:layout_marginLeft="15dp"
+                android:id="@+id/iv_wx"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
+                android:layout_marginLeft="15dp"
                 android:background="@null"
-                android:src="@mipmap/x_ic_login_wx"
-                android:id="@+id/iv_wx"
-                />
+                android:src="@mipmap/x_ic_login_wx" />
 
             <View
-                android:layout_marginLeft="15dp"
-                android:layout_marginRight="15dp"
                 android:layout_width="2dp"
                 android:layout_height="2dp"
-                android:background="@color/txt_white"
-                android:layout_gravity="center_vertical" />
+                android:layout_gravity="center_vertical"
+                android:layout_marginLeft="15dp"
+                android:layout_marginRight="15dp"
+                android:background="@color/txt_white" />
 
             <ImageView
+                android:id="@+id/iv_qq"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:background="@null"
-                android:src="@mipmap/x_ic_login_qq"
-                android:id="@+id/iv_qq"
-                />
+                android:src="@mipmap/x_ic_login_qq" />
 
             <View
-                android:layout_marginLeft="15dp"
                 android:layout_width="10dp"
                 android:layout_height="1dp"
-                android:background="@color/txt_white"
-                android:layout_gravity="center_vertical" />
+                android:layout_gravity="center_vertical"
+                android:layout_marginLeft="15dp"
+                android:background="@color/txt_white" />
         </LinearLayout>
-    </RelativeLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="4"/>
+        <LinearLayout
+            android:id="@+id/login_agreement_ll"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:orientation="horizontal">
+
+            <android.support.v7.widget.AppCompatCheckBox
+                android:id="@+id/login_agreement_cb"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:button="@drawable/drawable_selector_check"
+                android:checked="true"
+                android:scaleX="1.4"
+                android:scaleY="1.4" />
+
+            <TextView
+                android:id="@+id/login_agreement_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="5dp"
+                android:text="我已阅读并同意《小绵羊平台用户协议》"
+                android:textColor="@color/white"
+                android:textSize="12sp" />
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="5"/>
+    </LinearLayout>
 
     <TextView
         android:id="@+id/test_change"
         style="@style/style_button_small_yellow"
         android:layout_width="wrap_content"
         android:layout_height="30dp"
-        android:paddingStart="@dimen/dp_10"
-        android:paddingEnd="@dimen/dp_10"
-        android:layout_margin="@dimen/dp_10"
-        android:layout_alignParentTop="true"
         android:layout_alignParentEnd="true"
+        android:layout_alignParentTop="true"
+        android:layout_margin="@dimen/dp_10"
+        android:paddingEnd="@dimen/dp_10"
+        android:paddingStart="@dimen/dp_10"
         android:text="切换服务器"
-        android:visibility="gone"/>
+        android:visibility="gone" />
+
     <TextView
         android:id="@+id/test_change_user"
         style="@style/style_button_small_yellow"
         android:layout_width="wrap_content"
         android:layout_height="30dp"
-        android:paddingStart="@dimen/dp_10"
-        android:paddingEnd="@dimen/dp_10"
-        android:layout_margin="@dimen/dp_10"
-        android:layout_below="@+id/test_change"
         android:layout_alignParentEnd="true"
+        android:layout_below="@+id/test_change"
+        android:layout_margin="@dimen/dp_10"
+        android:paddingEnd="@dimen/dp_10"
+        android:paddingStart="@dimen/dp_10"
         android:text="切换账号"
-        android:visibility="gone"/>
+        android:visibility="gone" />
 </RelativeLayout>

二进制
app/src/main/res/mipmap-xxhdpi/login_bg.webp


+ 9 - 0
app/src/main/res/values/dd_styles.xml

@@ -441,4 +441,13 @@
         <item name="tabSelectedTextColor">#791BE3</item>
         <item name="tabTextAppearance">@style/SheepTabLayoutTextAppearanceAskmoney</item>
     </style>
+    <style name="style_login_et">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">@dimen/edt_heigh_default</item>
+        <item name="android:layout_margin">@dimen/content_padding_small</item>
+        <item name="android:background">@color/transparent</item>
+        <item name="android:textColor">@color/white</item>
+        <item name="android:textColorHint">#A0D3F6</item>
+        <item name="android:textSize">15sp</item>
+    </style>
 </resources>