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

+ 83 - 51
app/src/main/AndroidManifest.xml

@@ -87,19 +87,19 @@
         android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
         tools:ignore="ProtectedPermissions" />
 
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
-    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
-    <uses-permission android:name="android.permission.CAMERA"/>
-    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
-    <uses-permission android:name="android.permission.INTERNET"/>
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.RECORD_AUDIO" />
+    <uses-permission android:name="android.permission.INTERNET" />
 
-    <uses-feature android:name="android.hardware.camera"/>
-    <uses-feature android:name="android.hardware.camera.autofocus"/>
+    <uses-feature android:name="android.hardware.camera" />
+    <uses-feature android:name="android.hardware.camera.autofocus" />
 
     <permission
         android:name="android.permission.FLASHLIGHT"
         android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
-        android:protectionLevel="normal"/>
+        android:protectionLevel="normal" />
     <!-- 百度定位权限 end -->
     <application
         android:name=".SheepApp"
@@ -202,9 +202,9 @@
             android:screenOrientation="portrait"
             android:theme="@style/SplashTheme">
             <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
+            <action android:name="android.intent.action.MAIN" />
 
-                <category android:name="android.intent.category.LAUNCHER" />
+            <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
         <activity
@@ -643,50 +643,72 @@
         <meta-data
             android:name="com.baidu.lbsapi.API_KEY"
             android:value="gXD6RhE7ncVIcl1crk5SeUoVm7ceNtkL" />
-        <service android:name="com.baidu.location.f" android:enabled="true" android:process=":remote"> </service>
+        <service
+            android:name="com.baidu.location.f"
+            android:enabled="true"
+            android:process=":remote"></service>
         <!--  百度定位 sdk end -->
 
-        <activity android:name="com.sheep.gamegroup.view.activity.ActNotice"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActGuide"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActLoadH5"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActUserLabelList"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActNewAboutUs"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActInstallApkList"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActSheepApkList"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActSheepPngList"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActReservation"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActGameAgencyRecharge"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActGameAccount"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActSearchGame"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActSetting"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActGameCenter"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActDownloadWelfareList"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActGiftCenter"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.ActMyWelfare"
-            android:screenOrientation="portrait"/>
-        <activity android:name="com.sheep.gamegroup.view.activity.MessageInteractionDetailActivity"
-            android:exported="true"/>
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActNotice"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActGuide"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActLoadH5"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActUserLabelList"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActNewAboutUs"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActInstallApkList"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActSheepApkList"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActSheepPngList"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActReservation"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActGameAgencyRecharge"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActGameAccount"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActSearchGame"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActSetting"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActGameCenter"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActDownloadWelfareList"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActGiftCenter"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActMyWelfare"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.MessageInteractionDetailActivity"
+            android:exported="true" />
 
         <!--start幂动科技-->
 
-        <activity android:name="com.sheep.gamegroup.view.activity.ActMiDong"
-            android:screenOrientation="portrait"/>
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActMiDong"
+            android:screenOrientation="portrait" />
 
         <service
             android:name="com.baidu.location.f"
@@ -840,8 +862,18 @@
         <activity
             android:name="com.sheep.gamegroup.module.find.activity.ActMediaChoose"
             android:screenOrientation="portrait" />
-        <activity android:name="com.sheep.gamegroup.module.login.LoginAct" />
-        <activity android:name="com.sheep.gamegroup.module.login.ChangePasswordAct"></activity>
+        <activity
+            android:name="com.sheep.gamegroup.module.login.LoginAct"
+            android:screenOrientation="portrait">
+            <!--<intent-filter>-->
+                <!--<action android:name="android.intent.action.MAIN" />-->
+
+                <!--<category android:name="android.intent.category.LAUNCHER" />-->
+            <!--</intent-filter>-->
+        </activity>
+        <activity
+            android:name="com.sheep.gamegroup.module.login.ChangePasswordAct"
+            android:screenOrientation="portrait"></activity>
     </application>
 
 </manifest>

+ 2 - 0
app/src/main/java/com/sheep/gamegroup/absBase/BaseActivity.java

@@ -2,6 +2,7 @@ package com.sheep.gamegroup.absBase;
 
 import android.os.Bundle;
 import android.support.annotation.Nullable;
+import android.view.View;
 import android.view.inputmethod.InputMethodManager;
 
 import com.sheep.gamegroup.util.ActionUtil;
@@ -39,6 +40,7 @@ public abstract class BaseActivity extends RxAppCompatActivity {
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
         setContentView(getLayoutId());
         if (needButterKnife())
             unbinder = ButterKnife.bind(this);

+ 29 - 4
app/src/main/java/com/sheep/gamegroup/module/login/LoginAct.java

@@ -1,6 +1,7 @@
 package com.sheep.gamegroup.module.login;
 
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentTransaction;
 import android.text.TextUtils;
@@ -16,6 +17,7 @@ import com.sheep.gamegroup.module.login.fragments.SignInFgt;
 import com.sheep.gamegroup.module.login.fragments.SignUpFgt;
 import com.sheep.gamegroup.module.login.fragments.ValidCaptchaFgt;
 import com.sheep.gamegroup.greendao.download.Account;
+import com.sheep.gamegroup.module.login.fragments.WelcomeFgt;
 import com.sheep.gamegroup.util.CertificationUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.TestUtil;
@@ -42,8 +44,14 @@ public class LoginAct extends BaseUMActivity implements LoginController {
     @Override
     public void initView() {
         TitleBarUtils.getInstance().setTitleBack(this);
-        SignInFgt signInFragment = SignInFgt.newInstance(this);
-        showFragment("", signInFragment);
+        if (isFirstStartup()) {
+            WelcomeFgt welcomeFragment = WelcomeFgt.newInstance(this);
+            showFragment("welcome", welcomeFragment);
+        } else {
+            SignInFgt signInFragment = SignInFgt.newInstance(this);
+            showFragment("登录", signInFragment);
+        }
+        setFirstStartup();
     }
 
     @Override
@@ -63,11 +71,17 @@ public class LoginAct extends BaseUMActivity implements LoginController {
     }
 
     @Override
+    public void whenToLogin(int platform) {
+        SignInFgt signInFragment = SignInFgt.newInstance(this, platform);
+        showFragment("登录", signInFragment);
+    }
+
+    @Override
     public void whenLoginSuccess(int platform, LoginEntity loginResult) {
         if (TextUtils.isEmpty(SheepApp.getInstance().getGameCode())) {
 //            Snackbar.make(getWindow().getDecorView(), "登录成功", Snackbar.LENGTH_SHORT).show();
             if (TextUtils.isEmpty(loginResult.getUser().getBirthday())
-                    ||loginResult.getUser().getBirthday().startsWith("000")) {
+                    || loginResult.getUser().getBirthday().startsWith("000")) {
                 getUserInfo(platform, loginResult);
             } else {
                 Jump2View.getInstance().checkCommendApp(this, EntityUtils.getUserCode(loginResult));
@@ -150,7 +164,7 @@ public class LoginAct extends BaseUMActivity implements LoginController {
     }
 
     private void showFragment(String tag, Fragment fragment) {
-        TitleBarUtils.getInstance().setShowOrHide(this, fragment instanceof SignInFgt ? false : true).setTitle(this, tag);
+        TitleBarUtils.getInstance().setShowOrHide(this, getSupportFragmentManager().getBackStackEntryCount() > 0).setTitle(this, tag);
         FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
         transaction.replace(R.id.fragment_container, fragment, tag);
         transaction.show(fragment);
@@ -177,4 +191,15 @@ public class LoginAct extends BaseUMActivity implements LoginController {
         getLastFragment().onActivityResult(requestCode, resultCode, intent);
     }
 
+    private void setFirstStartup() {
+        SharedPreferences sp = this.getSharedPreferences("small_sheep", MODE_PRIVATE);
+        sp.edit().putBoolean("first_startup", false);
+        sp.edit().commit();
+    }
+
+    private boolean isFirstStartup() {
+        SharedPreferences sp = this.getSharedPreferences("small_sheep", MODE_PRIVATE);
+        return sp.getBoolean("first_startup", true);
+    }
+
 }

+ 2 - 0
app/src/main/java/com/sheep/gamegroup/module/login/controller/LoginController.java

@@ -10,6 +10,8 @@ public interface LoginController {
     public final static int PLATFORM_WX = 2;
     public final static int PLATFORM_QQ = 3;
 
+    void whenToLogin(int platform);
+
     void whenLoginSuccess(int platform, LoginEntity loginResult);
 
     void whenEditedInfo(LoginEntity entity);

+ 120 - 34
app/src/main/java/com/sheep/gamegroup/module/login/fragments/AbsLoginFgt.java

@@ -8,80 +8,166 @@ import android.text.TextWatcher;
 import android.view.View;
 import android.widget.EditText;
 import android.widget.ImageView;
+import android.widget.TextView;
 
+import com.alibaba.fastjson.JSONObject;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.LoginEntity;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.module.login.controller.LoginController;
+import com.sheep.gamegroup.util.ChannelContent;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.FastJsonUtils;
+import com.sheep.gamegroup.util.PreferenceUtils;
 import com.sheep.gamegroup.util.StringUtils;
+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.base.BaseFragment;
 import com.sheep.jiuyan.samllsheep.utils.G;
+import com.sheep.jiuyan.samllsheep.utils.SpUtils;
+import com.umeng.socialize.UMAuthListener;
+import com.umeng.socialize.UMShareAPI;
+import com.umeng.socialize.bean.SHARE_MEDIA;
+
+import java.util.Map;
 
 import butterknife.BindView;
 import butterknife.OnClick;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.LOGIN_QQ;
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.LOGIN_WX;
 
 /**
  * A simple {@link Fragment} subclass.
  */
-public class FindAccountFgt extends BaseFragment {
-
-    private LoginController mController;
+public class AbsLoginFgt extends BaseFragment {
 
-    @BindView(R.id.phone_number_box)
-    EditText phoneNumberBox;
-    @BindView(R.id.text_delete_btn)
-    ImageView textDeleteBtn;
+    protected LoginController mController;
 
-    public FindAccountFgt() {
+    public AbsLoginFgt() {
         // Required empty public constructor
     }
 
-    public static FindAccountFgt newInstance(LoginController controller) {
-        FindAccountFgt fragment = new FindAccountFgt();
+    public static AbsLoginFgt newInstance(LoginController controller) {
+        AbsLoginFgt fragment = new AbsLoginFgt();
         fragment.mController = controller;
         return fragment;
     }
 
     @Override
     public int getLayoutId() {
-        return R.layout.fragment_find_account;
+        return 0;
     }
 
     @Override
     public void onViewCreated() {
-        phoneNumberBox.addTextChangedListener(new TextWatcher() {
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
 
-            }
+    }
 
+    @OnClick(R.id.wx_login_btn)
+    public void doWxLogin(View v) {
+        LOGIN_WX.onEvent();
+        UMShareAPI.get(SheepApp.getInstance()).doOauthVerify(getActivity(), SHARE_MEDIA.WEIXIN, new ThirdpartAuthListener("微信") {
             @Override
-            public void onTextChanged(CharSequence s, int start, int before, int count) {
-                textDeleteBtn.setVisibility(TextUtils.isEmpty(s) ? View.GONE : View.VISIBLE);
-            }
+            public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) {
+                JSONObject j = new JSONObject();
+                j.put("code", data.get("access_token"));
+                j.put("username", data.get("openid"));
+                j.put("scope", ChannelContent.getInstance().getChannel_name());
+                PreferenceUtils.setPrefString(SheepApp.getInstance(), UMConfigUtils.LOGIN_TYPE, UMConfigUtils.Source.WECHAT);
+                SheepApp.getInstance().getNetComponent().getApiService()
+                        .LoginByWX(j)
+                        .subscribeOn(Schedulers.io())
+                        .observeOn(AndroidSchedulers.mainThread())
+                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                            @Override
+                            public void onError(BaseMessage baseMessage) {
+                                G.shortToast("微信登录失败  请检查网络是否正常");
+                                hideProgress();
+                            }
+
+                            @Override
+                            public void onNext(BaseMessage baseMessage) {
+                                hideProgress();
+                                if (baseMessage != null) {
+                                    LoginEntity loginEty = FastJsonUtils.toBean(JSONObject.toJSONString(baseMessage.getData()), LoginEntity.class);
+                                    SpUtils.saveToken(SheepApp.getInstance(), loginEty.getToken());
+                                    DataUtil.getInstance().initUserEntity(loginEty.getUser());
+                                    mController.whenLoginSuccess(LoginController.PLATFORM_WX, loginEty);
+                                    TestUtil.saveUser(loginEty);
+                                }
+                            }
+                        });
 
-            @Override
-            public void afterTextChanged(Editable s) {
+            }
+        });
+    }
 
+    @OnClick(R.id.qq_login_btn)
+    public void doQQLogin(View v) {
+        LOGIN_QQ.onEvent();
+        UMShareAPI.get(SheepApp.getInstance()).doOauthVerify(getActivity(), SHARE_MEDIA.QQ, new ThirdpartAuthListener("QQ") {
+            public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) {
+                JSONObject j = new JSONObject();
+                j.put("code", data.get("access_token"));
+                j.put("username", data.get("openid"));
+                j.put("scope", ChannelContent.getInstance().getChannel_name());
+                PreferenceUtils.setPrefString(SheepApp.getInstance(), UMConfigUtils.LOGIN_TYPE, UMConfigUtils.Source.QQ);
+                SheepApp.getInstance().getNetComponent().getApiService()
+                        .LoginByQQ(j)
+                        .subscribeOn(Schedulers.io())
+                        .observeOn(AndroidSchedulers.mainThread())
+                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+
+                            @Override
+                            public void onError(BaseMessage baseMessage) {
+                                G.shortToast("QQ登录失败  请检查网络是否正常");
+                                hideProgress();
+                            }
+
+                            @Override
+                            public void onNext(BaseMessage baseMessage) {
+                                hideProgress();
+                                if (baseMessage != null) {
+                                    LoginEntity loginEty = FastJsonUtils.toBean(JSONObject.toJSONString(baseMessage.getData()), LoginEntity.class);
+                                    SpUtils.saveToken(SheepApp.getInstance(), loginEty.getToken());
+                                    DataUtil.getInstance().initUserEntity(loginEty.getUser());
+                                    mController.whenLoginSuccess(LoginController.PLATFORM_QQ, loginEty);
+                                    TestUtil.saveUser(loginEty);
+                                }
+                            }
+                        });
             }
         });
     }
 
-    @OnClick(R.id.send_captcha_btn)
-    public void doSendCaptcha(View v) {
-        String phoneNum = phoneNumberBox.getText().toString().trim();
-        if (TextUtils.isEmpty(phoneNum)) {
-            G.shortToast("请输入手机号");
-            return;
+    protected abstract class ThirdpartAuthListener implements UMAuthListener {
+
+        private String platformName;
+
+        public ThirdpartAuthListener(String platformName) {
+            this.platformName = platformName;
         }
-        if (!StringUtils.isMobile(phoneNum)) {
-            G.shortToast("手机号有误");
-            return;
+
+        @Override
+        public void onStart(SHARE_MEDIA platform) {
+            showProgress();
+        }
+
+        @Override
+        public void onError(SHARE_MEDIA platform, int action, Throwable t) {
+            G.shortToast(platformName + "授权失败  请检查网络是否正常");
+            hideProgress();
         }
-        mController.whenGoValidCaptcha(phoneNumberBox.getText().toString());
-    }
 
-    @OnClick(R.id.text_delete_btn)
-    public void doDeleteText(View v) {
-        phoneNumberBox.setText("");
+        @Override
+        public void onCancel(SHARE_MEDIA platform, int action) {
+            hideProgress();
+        }
     }
 
 }

+ 8 - 105
app/src/main/java/com/sheep/gamegroup/module/login/fragments/SignInFgt.java

@@ -58,9 +58,9 @@ import static com.sheep.gamegroup.util.UMConfigUtils.Event.LOGIN_WX;
 /**
  * A simple {@link Fragment} subclass.
  */
-public class SignInFgt extends BaseFragment {
+public class SignInFgt extends AbsLoginFgt {
 
-    private LoginController mController;
+    private int loginType = LoginController.PLATFORM_PHONE;
 
     @BindView(R.id.for_account_pwd_container)
     View forAccountPwdContainer;
@@ -96,9 +96,14 @@ public class SignInFgt extends BaseFragment {
         // Required empty public constructor
     }
 
-    public static SignInFgt newInstance(LoginController controller) {
+    public static SignInFgt newInstance(LoginController controller){
+        return newInstance(controller, LoginController.PLATFORM_PHONE);
+    }
+
+    public static SignInFgt newInstance(LoginController controller, int type) {
         SignInFgt fragment = new SignInFgt();
         fragment.mController = controller;
+        fragment.loginType = type;
         return fragment;
     }
 
@@ -286,83 +291,6 @@ public class SignInFgt extends BaseFragment {
         mController.whenGoFindAccount();
     }
 
-    @OnClick(R.id.wx_login_btn)
-    public void doWxLogin(View v) {
-        LOGIN_WX.onEvent();
-        UMShareAPI.get(SheepApp.getInstance()).doOauthVerify(getActivity(), SHARE_MEDIA.WEIXIN, new ThirdpartAuthListener("微信") {
-            @Override
-            public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) {
-                JSONObject j = new JSONObject();
-                j.put("code", data.get("access_token"));
-                j.put("username", data.get("openid"));
-                j.put("scope", ChannelContent.getInstance().getChannel_name());
-                PreferenceUtils.setPrefString(SheepApp.getInstance(), UMConfigUtils.LOGIN_TYPE, UMConfigUtils.Source.WECHAT);
-                SheepApp.getInstance().getNetComponent().getApiService()
-                        .LoginByWX(j)
-                        .subscribeOn(Schedulers.io())
-                        .observeOn(AndroidSchedulers.mainThread())
-                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                            @Override
-                            public void onError(BaseMessage baseMessage) {
-                                G.shortToast("微信登录失败  请检查网络是否正常");
-                                hideProgress();
-                            }
-
-                            @Override
-                            public void onNext(BaseMessage baseMessage) {
-                                hideProgress();
-                                if (baseMessage != null) {
-                                    LoginEntity loginEty = FastJsonUtils.toBean(JSONObject.toJSONString(baseMessage.getData()), LoginEntity.class);
-                                    SpUtils.saveToken(SheepApp.getInstance(), loginEty.getToken());
-                                    DataUtil.getInstance().initUserEntity(loginEty.getUser());
-                                    mController.whenLoginSuccess(LoginController.PLATFORM_WX, loginEty);
-                                    TestUtil.saveUser(loginEty);
-                                }
-                            }
-                        });
-
-            }
-        });
-    }
-
-    @OnClick(R.id.qq_login_btn)
-    public void doQQLogin(View v) {
-        LOGIN_QQ.onEvent();
-        UMShareAPI.get(SheepApp.getInstance()).doOauthVerify(getActivity(), SHARE_MEDIA.QQ, new ThirdpartAuthListener("QQ") {
-            public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) {
-                JSONObject j = new JSONObject();
-                j.put("code", data.get("access_token"));
-                j.put("username", data.get("openid"));
-                j.put("scope", ChannelContent.getInstance().getChannel_name());
-                PreferenceUtils.setPrefString(SheepApp.getInstance(), UMConfigUtils.LOGIN_TYPE, UMConfigUtils.Source.QQ);
-                SheepApp.getInstance().getNetComponent().getApiService()
-                        .LoginByQQ(j)
-                        .subscribeOn(Schedulers.io())
-                        .observeOn(AndroidSchedulers.mainThread())
-                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-
-                            @Override
-                            public void onError(BaseMessage baseMessage) {
-                                G.shortToast("QQ登录失败  请检查网络是否正常");
-                                hideProgress();
-                            }
-
-                            @Override
-                            public void onNext(BaseMessage baseMessage) {
-                                hideProgress();
-                                if (baseMessage != null) {
-                                    LoginEntity loginEty = FastJsonUtils.toBean(JSONObject.toJSONString(baseMessage.getData()), LoginEntity.class);
-                                    SpUtils.saveToken(SheepApp.getInstance(), loginEty.getToken());
-                                    DataUtil.getInstance().initUserEntity(loginEty.getUser());
-                                    mController.whenLoginSuccess(LoginController.PLATFORM_QQ, loginEty);
-                                    TestUtil.saveUser(loginEty);
-                                }
-                            }
-                        });
-            }
-        });
-    }
-
     @OnClick(R.id.account_menu_btn)
     public void doSelectAccount(View v) {
         final List<Account> listData = DDProviderHelper.getInstance().getAccountList();
@@ -450,29 +378,4 @@ public class SignInFgt extends BaseFragment {
         }
     }
 
-    private abstract class ThirdpartAuthListener implements UMAuthListener {
-
-        private String platformName;
-
-        public ThirdpartAuthListener(String platformName) {
-            this.platformName = platformName;
-        }
-
-        @Override
-        public void onStart(SHARE_MEDIA platform) {
-            showProgress();
-        }
-
-        @Override
-        public void onError(SHARE_MEDIA platform, int action, Throwable t) {
-            G.shortToast(platformName + "授权失败  请检查网络是否正常");
-            hideProgress();
-        }
-
-        @Override
-        public void onCancel(SHARE_MEDIA platform, int action) {
-            hideProgress();
-        }
-    }
-
 }

+ 11 - 42
app/src/main/java/com/sheep/gamegroup/module/login/fragments/WelcomeFgt.java

@@ -21,67 +21,36 @@ import butterknife.OnClick;
 /**
  * A simple {@link Fragment} subclass.
  */
-public class FindAccountFgt extends BaseFragment {
+public class WelcomeFgt extends AbsLoginFgt {
 
-    private LoginController mController;
-
-    @BindView(R.id.phone_number_box)
-    EditText phoneNumberBox;
-    @BindView(R.id.text_delete_btn)
-    ImageView textDeleteBtn;
-
-    public FindAccountFgt() {
+    public WelcomeFgt() {
         // Required empty public constructor
     }
 
-    public static FindAccountFgt newInstance(LoginController controller) {
-        FindAccountFgt fragment = new FindAccountFgt();
+    public static WelcomeFgt newInstance(LoginController controller) {
+        WelcomeFgt fragment = new WelcomeFgt();
         fragment.mController = controller;
         return fragment;
     }
 
     @Override
     public int getLayoutId() {
-        return R.layout.fragment_find_account;
+        return R.layout.fragment_login_welcome;
     }
 
     @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.login_btn, R.id.login_type_toggle})
+    public void doToLogin(View v) {
+        mController.whenToLogin(LoginController.PLATFORM_PHONE);
     }
 
-    @OnClick(R.id.text_delete_btn)
-    public void doDeleteText(View v) {
-        phoneNumberBox.setText("");
+    @OnClick(R.id.register_btn)
+    public void doToRegister(View v) {
+        mController.whenToRegister();
     }
 
 }

+ 43 - 0
app/src/main/java/com/sheep/gamegroup/view/customview/WindowInsetsFrameLayout.java

@@ -0,0 +1,43 @@
+package com.sheep.gamegroup.view.customview;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.os.Build;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.WindowInsets;
+import android.widget.FrameLayout;
+
+public class WindowInsetsFrameLayout extends FrameLayout {
+    public WindowInsetsFrameLayout(Context context) {
+        this(context, null);
+    }
+
+    public WindowInsetsFrameLayout(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+    public WindowInsetsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        setOnHierarchyChangeListener(new OnHierarchyChangeListener() {
+            @Override
+            public void onChildViewAdded(View parent, View child) {
+                requestApplyInsets();
+            }
+
+            @Override
+            public void onChildViewRemoved(View parent, View child) {
+            }
+        });
+    }
+
+    @TargetApi(Build.VERSION_CODES.KITKAT_WATCH)
+    @Override
+    public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+        int childCount = getChildCount();
+        for (int index = 0; index < childCount; index++)
+            getChildAt(index).dispatchApplyWindowInsets(insets);
+        return insets;
+    }
+}

+ 86 - 4
app/src/main/res/layout/footer_thirdpart_login.xml

@@ -1,6 +1,88 @@
 <?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">
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+    >
 
-</android.support.constraint.ConstraintLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center"
+        android:layout_marginBottom="16dp"
+        android:layout_above="@+id/thirdpart_login_container"
+        android:orientation="horizontal">
+
+        <View
+            android:background="@color/G"
+            style="@style/login_separetor_line_style"
+            android:layout_width="20dp"/>
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:layout_marginLeft="10dp"
+            android:layout_marginRight="10dp"
+            android:layout_marginBottom="2dp"
+            android:textSize="13sp"
+            android:text="or"
+            android:textColor="@color/G" />
+
+        <View
+            style="@style/login_separetor_line_style"
+            android:background="@color/G"
+            android:layout_width="20dp"/>
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:id="@+id/thirdpart_login_container"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:orientation="horizontal"
+        android:paddingLeft="20dp"
+        android:paddingRight="20dp">
+
+        <LinearLayout
+            android:id="@+id/login_type_toggle"
+            style="@style/login_type_btn">
+
+            <ImageView
+                android:id="@+id/login_type_toggle_icon"
+                style="@style/login_type_icon"
+                android:src="@mipmap/login_account" />
+
+            <TextView
+                android:id="@+id/login_type_toggle_text"
+                style="@style/login_type_text"
+                android:text="账号登录" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:id="@+id/qq_login_btn"
+            style="@style/login_type_btn">
+
+            <ImageView
+                style="@style/login_type_icon"
+                android:src="@mipmap/login_qq" />
+
+            <TextView
+                style="@style/login_type_text"
+                android:text="QQ" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:id="@+id/wx_login_btn"
+            style="@style/login_type_btn">
+
+            <ImageView
+                style="@style/login_type_icon"
+                android:src="@mipmap/login_wx" />
+
+            <TextView
+                style="@style/login_type_text"
+                android:text="微信" />
+        </LinearLayout>
+
+
+    </LinearLayout>
+</merge>

+ 24 - 101
app/src/main/res/layout/fragment_login_welcome.xml

@@ -1,111 +1,34 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout 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">
+    android:paddingBottom="@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="已绑定小绵羊账户的用户,可以通过手机号+验证码来修改密码"
+    <ImageView
+        android:id="@+id/welcome_header"
+        android:src="@mipmap/welcome_head"
+        android:adjustViewBounds="true"
         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
+    <Button
+        android:id="@+id/register_btn"
+        style="@style/login_theme_round_button"
+        android:layout_below="@+id/welcome_header"
+        android:layout_marginTop="50dp"
+        android:layout_marginLeft="@dimen/content_padding_24"
+        android:layout_marginRight="@dimen/content_padding_24"
+        android:text="新用户注册" />
+
+    <Button
+        android:id="@+id/login_btn"
+        style="@style/login_theme_round_button"
+        android:layout_below="@+id/register_btn"
         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" />
+        android:layout_marginLeft="@dimen/content_padding_24"
+        android:layout_marginRight="@dimen/content_padding_24"
+        android:text="登录" />
 
-</LinearLayout>
+    <include layout="@layout/footer_thirdpart_login" />
+</RelativeLayout>

+ 24 - 107
app/src/main/res/layout/fragment_sign_in.xml

@@ -19,8 +19,8 @@
         android:id="@+id/for_account_pwd_container"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:visibility="gone"
-        android:layout_below="@+id/top_bar">
+        android:layout_below="@+id/top_bar"
+        android:visibility="gone">
 
         <EditText
             android:id="@+id/user_name_box"
@@ -39,18 +39,18 @@
             android:hint="输入密码(6-16位)"
             android:inputType="textPassword"
             android:maxLength="16"
-            android:paddingLeft="@dimen/content_padding_5"/>
+            android:paddingLeft="@dimen/content_padding_5" />
 
         <ImageView
             android:id="@+id/show_hide_pwd_btn"
-            android:src="@mipmap/pwd_hide"
-            android:layout_marginTop="26dp"
+            android:layout_width="30dp"
+            android:layout_height="30dp"
+            android:layout_alignParentRight="true"
             android:layout_below="@+id/user_name_box"
-            android:tint="@color/bg_line"
+            android:layout_marginTop="26dp"
             android:padding="7dp"
-            android:layout_alignParentRight="true"
-            android:layout_width="30dp"
-            android:layout_height="30dp" />
+            android:src="@mipmap/pwd_hide"
+            android:tint="@color/bg_line" />
 
         <View
             style="@style/login_separetor_line_style"
@@ -69,14 +69,15 @@
             android:hint="输入手机号"
             android:inputType="phone"
             android:maxLength="11" />
+
         <View
             style="@style/login_separetor_line_style"
             android:layout_below="@+id/phone_number_box" />
 
         <EditText
             android:id="@+id/captcha_box"
-            android:layout_below="@+id/phone_number_box"
             style="@style/login_edit_style"
+            android:layout_below="@+id/phone_number_box"
             android:hint="输入验证码"
             android:inputType="phone"
             android:maxLength="6" />
@@ -89,24 +90,24 @@
             android:id="@+id/send_captcha_btn"
             android:layout_width="wrap_content"
             android:layout_height="25dp"
-            android:background="@drawable/round_main_r25"
             android:layout_alignParentRight="true"
             android:layout_below="@+id/phone_number_box"
             android:layout_marginTop="28dp"
+            android:background="@drawable/round_main_r25"
+            android:text="获取验证码"
             android:textColor="@android:color/white"
-            android:textSize="12sp"
-            android:text="获取验证码" />
+            android:textSize="12sp" />
     </RelativeLayout>
 
     <ImageView
         android:id="@+id/account_menu_btn"
-        android:src="@mipmap/arrow_down"
-        android:tint="@color/black_6_3"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:layout_alignParentRight="true"
         android:layout_marginTop="120dp"
         android:padding="8dp"
-        android:layout_width="30dp"
-        android:layout_height="30dp" />
+        android:src="@mipmap/arrow_down"
+        android:tint="@color/black_6_3" />
 
     <TextView
         android:id="@+id/trouble_btn"
@@ -116,8 +117,8 @@
         android:layout_below="@id/top_bar"
         android:layout_marginTop="130dp"
         android:text="登录遇到问题?"
-        android:textSize="12sp"
-        android:textColor="@color/blue_34a6e7" />
+        android:textColor="@color/blue_34a6e7"
+        android:textSize="12sp" />
 
     <Button
         android:id="@+id/login_btn"
@@ -130,98 +131,14 @@
         android:id="@+id/register_btn"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_centerHorizontal="true"
         android:layout_below="@+id/login_btn"
+        android:layout_centerHorizontal="true"
         android:layout_marginTop="16dp"
         android:text="新用户注册"
-        android:textSize="12sp"
-        android:textColor="@color/blue_34a6e7" />
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:gravity="center"
-        android:layout_marginBottom="16dp"
-        android:layout_above="@+id/thirdpart_login_container"
-        android:orientation="horizontal">
+        android:textColor="@color/blue_34a6e7"
+        android:textSize="12sp" />
 
-        <View
-            android:background="@color/G"
-            style="@style/login_separetor_line_style"
-            android:layout_width="20dp"/>
-
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:gravity="center"
-            android:layout_marginLeft="10dp"
-            android:layout_marginRight="10dp"
-            android:layout_marginBottom="2dp"
-            android:textSize="13sp"
-            android:text="or"
-            android:textColor="@color/G" />
-
-        <View
-            style="@style/login_separetor_line_style"
-            android:background="@color/G"
-            android:layout_width="20dp"/>
-
-    </LinearLayout>
-
-
-
-    <LinearLayout
-        android:id="@+id/thirdpart_login_container"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingLeft="20dp"
-        android:paddingRight="20dp"
-        android:layout_alignParentBottom="true"
-        android:orientation="horizontal">
-
-        <LinearLayout
-            android:id="@+id/login_type_toggle"
-            style="@style/login_type_btn">
-
-            <ImageView
-                android:id="@+id/login_type_toggle_icon"
-                style="@style/login_type_icon"
-                android:src="@mipmap/login_account" />
-
-            <TextView
-                android:id="@+id/login_type_toggle_text"
-                android:text="账号登录"
-                style="@style/login_type_text" />
-        </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/qq_login_btn"
-            style="@style/login_type_btn">
-
-            <ImageView
-                style="@style/login_type_icon"
-                android:src="@mipmap/login_qq" />
-
-            <TextView
-                android:text="QQ"
-                style="@style/login_type_text" />
-        </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/wx_login_btn"
-            style="@style/login_type_btn">
-
-            <ImageView
-                style="@style/login_type_icon"
-                android:src="@mipmap/login_wx" />
-
-            <TextView
-                android:text="微信"
-                style="@style/login_type_text"/>
-        </LinearLayout>
-
-
-    </LinearLayout>
+    <include layout="@layout/footer_thirdpart_login" />
 
     <TextView
         android:id="@+id/test_change"

BIN
app/src/main/res/mipmap-xhdpi/welcome_head.png


BIN
app/src/main/res/mipmap-xxhdpi/welcome_head.png


+ 29 - 0
app/src/main/res/values-v19/style_theme.xml

@@ -29,4 +29,33 @@
 
         <item name="android:windowTranslucentStatus">true</item>
     </style>
+
+    <style name="AppActionTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+        <item name="android:windowContentOverlay">@null</item>
+        <item name="colorPrimary">@color/colorPrimary</item>
+        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+        <item name="colorAccent">@color/colorAccent</item>
+        <item name="colorControlHighlight">@color/black</item>
+
+        <item name="main_color">@color/theme_app_main</item>
+        <item name="main_color_dark">@color/theme_app_dark</item>
+        <item name="main_color_mid">@color/theme_app_mid</item>
+        <item name="main_color_accent">@color/theme_app_highlight</item>
+        <item name="main_color_light">@color/theme_app_highlight_more</item>
+        <item name="star_unselect">@drawable/xina</item>
+        <item name="star_select">@drawable/xinb</item>
+        <!--下面的属性全是为了兼容安卓4.0!多了好多文件啊-->
+        <item name="line_short">@drawable/sp_line_vertical</item>
+        <item name="star_style">@style/ratingbar_main</item>
+        <item name="radio_btn">@drawable/sel_circle_dot</item>
+        <item name="button_full_normal">@drawable/selector_button_full_main</item>
+        <item name="full.button">@style/full.button_main</item>
+        <item name="small.button">@style/small.button_main</item>
+        <item name="sp_dot_rota">@drawable/sp_dot_rota_main</item>
+        <item name="theme_bg_btn_corner">@drawable/theme_bg_btn_corner_main</item>
+        <item name="sp_search_edt">@drawable/sp_search_edt_main</item>
+        <item name="btn_color">@color/btn_color_main</item>
+
+        <item name="android:windowTranslucentStatus">true</item>
+    </style>
 </resources>

+ 1 - 1
app/src/main/res/values/common.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <!--APP的相关主要颜色值-->
-    <color name="colorPrimary">@color/blue_FF53BBF2</color>
+    <color name="colorPrimary">@color/white_DEDEDE</color>
     <color name="colorPrimaryDark">@color/white_DEDEDE</color>
     <color name="colorAccent">@color/white_DEDEDE</color>
     <color name="colorControlNormal">@color/black_6_3</color>