hanjing лет назад: 7
Родитель
Сommit
333c35d354
22 измененных файлов с 226 добавлено и 224 удалено
  1. 49 5
      app/src/main/java/com/sheep/gamegroup/absBase/BaseActivity.java
  2. 2 2
      app/src/main/java/com/sheep/gamegroup/greendao/DDProviderHelper.java
  3. 1 1
      app/src/main/java/com/sheep/gamegroup/module/login/model/Account.java
  4. 1 3
      app/src/main/java/com/sheep/gamegroup/module/login/model/AccountDao.java
  5. 15 16
      app/src/main/java/com/sheep/gamegroup/greendao/download/DaoMaster.java
  6. 58 58
      app/src/main/java/com/sheep/gamegroup/greendao/download/DaoSession.java
  7. 3 3
      app/src/main/java/com/sheep/gamegroup/module/login/ChangePasswordAct.java
  8. 1 9
      app/src/main/java/com/sheep/gamegroup/module/login/LoginAct.java
  9. 6 6
      app/src/main/java/com/sheep/gamegroup/module/login/fragments/EditUserInfoFgt.java
  10. 2 2
      app/src/main/java/com/sheep/gamegroup/module/login/fragments/FindAccountFgt.java
  11. 2 2
      app/src/main/java/com/sheep/gamegroup/module/login/fragments/NewPasswordFgt.java
  12. 2 2
      app/src/main/java/com/sheep/gamegroup/module/login/fragments/OldPasswordFgt.java
  13. 16 15
      app/src/main/java/com/sheep/gamegroup/module/login/fragments/SignInFgt.java
  14. 5 5
      app/src/main/java/com/sheep/gamegroup/module/login/fragments/SignUpFgt.java
  15. 1 1
      app/src/main/java/com/sheep/gamegroup/module/login/fragments/ValidCaptchaFgt.java
  16. 16 8
      app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java
  17. 2 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java
  18. 4 9
      app/src/main/java/com/sheep/jiuyan/samllsheep/ui/activity/ActiveRuleActivity.java
  19. 6 10
      app/src/main/java/com/sheep/jiuyan/samllsheep/ui/activity/SignActivity.java
  20. 0 64
      app/src/main/java/com/sheep/jiuyan/samllsheep/ui/base/BaseActivity.java
  21. 20 3
      app/src/main/java/com/sheep/jiuyan/samllsheep/ui/view/EggView.java
  22. 14 0
      app/src/main/java/com/sheep/jiuyan/samllsheep/utils/G.java

+ 49 - 5
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.inputmethod.InputMethodManager;
 
 import com.sheep.gamegroup.util.ActionUtil;
 import com.sheep.gamegroup.view.dialog.DialogLoading;
@@ -9,6 +10,7 @@ import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
 
 import org.greenrobot.eventbus.EventBus;
 
+import java.lang.reflect.Field;
 import java.util.concurrent.TimeUnit;
 
 import butterknife.ButterKnife;
@@ -25,24 +27,28 @@ public abstract class BaseActivity extends RxAppCompatActivity {
 
     protected DialogLoading dialogLoading;
     public Unbinder unbinder;
-    protected boolean needRegisterEventBus(){
+
+    protected boolean needRegisterEventBus() {
         return false;
     }
-    protected boolean needButterKnife(){
+
+    protected boolean needButterKnife() {
         return true;
     }
+
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(getLayoutId());
-        if(needButterKnife())
+        if (needButterKnife())
             unbinder = ButterKnife.bind(this);
-        if(needRegisterEventBus())
+        if (needRegisterEventBus())
             EventBus.getDefault().register(this);
         initView();
         initListener();
         initData();
     }
+
     public boolean isShowing() {
         return dialogLoading != null && dialogLoading.getAlertDialog() != null && dialogLoading.getAlertDialog().isShowing();
     }
@@ -110,6 +116,7 @@ public abstract class BaseActivity extends RxAppCompatActivity {
 
     @Override
     protected void onDestroy() {
+        fixHuaweiLeak();
         try {
             super.onDestroy();
             if (needButterKnife() && this.unbinder != null) {
@@ -118,7 +125,44 @@ public abstract class BaseActivity extends RxAppCompatActivity {
         } catch (Exception e) {
             e.printStackTrace();
         }
-        if(needRegisterEventBus())
+        if (needRegisterEventBus())
             EventBus.getDefault().unregister(this);
     }
+
+
+    //解决华为手机内存泄漏问题
+    private static Field[] leakFields = new Field[2];
+    private static boolean[] hasLeakFields = {true, true};
+    private static String[] leakFieldNames = {"mLastSrvView", "mNextServedView"};
+
+    private void fixHuaweiLeak() {
+        boolean goon = false;
+        for (boolean has : hasLeakFields) {
+            goon = goon || has;
+            if (goon) break;
+        }
+        if (!goon) return;
+
+        InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
+        if (imm == null) {
+            return;
+        }
+
+        for (int i = 0; i < leakFieldNames.length; i++) {
+            try {
+                if (leakFields[i] == null) {
+                    leakFields[i] = imm.getClass().getDeclaredField(leakFieldNames[i]);
+                }
+                if (leakFields[i] == null) {
+                    hasLeakFields[i] = false;
+                }
+                if (leakFields[i] != null) {
+                    leakFields[i].setAccessible(true);
+                    leakFields[i].set(imm, null);
+                }
+            } catch (Throwable t) {
+                t.printStackTrace();
+            }
+        }
+    }
 }

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/greendao/DDProviderHelper.java

@@ -14,8 +14,8 @@ import com.sheep.gamegroup.greendao.download.SdkLoginUser;
 import com.sheep.gamegroup.greendao.download.SdkLoginUserDao;
 import com.sheep.gamegroup.greendao.download.SearchRecord;
 import com.sheep.gamegroup.greendao.download.SearchRecordDao;
-import com.sheep.gamegroup.module.login.model.Account;
-import com.sheep.gamegroup.module.login.model.AccountDao;
+import com.sheep.gamegroup.greendao.download.Account;
+import com.sheep.gamegroup.greendao.download.AccountDao;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.DownloadUtil;
 import com.sheep.jiuyan.samllsheep.SheepApp;

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/module/login/model/Account.java

@@ -1,4 +1,4 @@
-package com.sheep.gamegroup.module.login.model;
+package com.sheep.gamegroup.greendao.download;
 
 import com.sheep.gamegroup.model.entity.UserEntity;
 

+ 1 - 3
app/src/main/java/com/sheep/gamegroup/module/login/model/AccountDao.java

@@ -1,4 +1,4 @@
-package com.sheep.gamegroup.module.login.model;
+package com.sheep.gamegroup.greendao.download;
 
 import android.database.Cursor;
 import android.database.sqlite.SQLiteStatement;
@@ -9,8 +9,6 @@ import org.greenrobot.greendao.internal.DaoConfig;
 import org.greenrobot.greendao.database.Database;
 import org.greenrobot.greendao.database.DatabaseStatement;
 
-import com.sheep.gamegroup.greendao.download.DaoSession;
-
 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
 /** 
  * DAO for table "ACCOUNT".

+ 15 - 16
app/src/main/java/com/sheep/gamegroup/greendao/download/DaoMaster.java

@@ -11,7 +11,6 @@ import org.greenrobot.greendao.database.Database;
 import org.greenrobot.greendao.database.DatabaseOpenHelper;
 import org.greenrobot.greendao.identityscope.IdentityScopeType;
 
-import com.sheep.gamegroup.module.login.model.AccountDao;
 
 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
 /**
@@ -22,26 +21,26 @@ public class DaoMaster extends AbstractDaoMaster {
 
     /** Creates underlying database table using DAOs. */
     public static void createAllTables(Database db, boolean ifNotExists) {
-        AcceptTaskRecordDao.createTable(db, ifNotExists);
-        AppdownloadBeanDao.createTable(db, ifNotExists);
-        DownLoadInfoDao.createTable(db, ifNotExists);
         ProcessRecordDao.createTable(db, ifNotExists);
-        ScreenShotRecordDao.createTable(db, ifNotExists);
+        AppdownloadBeanDao.createTable(db, ifNotExists);
         SdkLoginUserDao.createTable(db, ifNotExists);
-        SearchRecordDao.createTable(db, ifNotExists);
+        ScreenShotRecordDao.createTable(db, ifNotExists);
+        AcceptTaskRecordDao.createTable(db, ifNotExists);
         AccountDao.createTable(db, ifNotExists);
+        SearchRecordDao.createTable(db, ifNotExists);
+        DownLoadInfoDao.createTable(db, ifNotExists);
     }
 
     /** Drops underlying database table using DAOs. */
     public static void dropAllTables(Database db, boolean ifExists) {
-        AcceptTaskRecordDao.dropTable(db, ifExists);
-        AppdownloadBeanDao.dropTable(db, ifExists);
-        DownLoadInfoDao.dropTable(db, ifExists);
         ProcessRecordDao.dropTable(db, ifExists);
-        ScreenShotRecordDao.dropTable(db, ifExists);
+        AppdownloadBeanDao.dropTable(db, ifExists);
         SdkLoginUserDao.dropTable(db, ifExists);
-        SearchRecordDao.dropTable(db, ifExists);
+        ScreenShotRecordDao.dropTable(db, ifExists);
+        AcceptTaskRecordDao.dropTable(db, ifExists);
         AccountDao.dropTable(db, ifExists);
+        SearchRecordDao.dropTable(db, ifExists);
+        DownLoadInfoDao.dropTable(db, ifExists);
     }
 
     /**
@@ -60,14 +59,14 @@ public class DaoMaster extends AbstractDaoMaster {
 
     public DaoMaster(Database db) {
         super(db, SCHEMA_VERSION);
-        registerDaoClass(AcceptTaskRecordDao.class);
-        registerDaoClass(AppdownloadBeanDao.class);
-        registerDaoClass(DownLoadInfoDao.class);
         registerDaoClass(ProcessRecordDao.class);
-        registerDaoClass(ScreenShotRecordDao.class);
+        registerDaoClass(AppdownloadBeanDao.class);
         registerDaoClass(SdkLoginUserDao.class);
-        registerDaoClass(SearchRecordDao.class);
+        registerDaoClass(ScreenShotRecordDao.class);
+        registerDaoClass(AcceptTaskRecordDao.class);
         registerDaoClass(AccountDao.class);
+        registerDaoClass(SearchRecordDao.class);
+        registerDaoClass(DownLoadInfoDao.class);
     }
 
     public DaoSession newSession() {

+ 58 - 58
app/src/main/java/com/sheep/gamegroup/greendao/download/DaoSession.java

@@ -8,23 +8,23 @@ import org.greenrobot.greendao.database.Database;
 import org.greenrobot.greendao.identityscope.IdentityScopeType;
 import org.greenrobot.greendao.internal.DaoConfig;
 
-import com.sheep.gamegroup.greendao.download.AcceptTaskRecord;
-import com.sheep.gamegroup.greendao.download.AppdownloadBean;
-import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.greendao.download.ProcessRecord;
-import com.sheep.gamegroup.greendao.download.ScreenShotRecord;
+import com.sheep.gamegroup.greendao.download.AppdownloadBean;
 import com.sheep.gamegroup.greendao.download.SdkLoginUser;
+import com.sheep.gamegroup.greendao.download.ScreenShotRecord;
+import com.sheep.gamegroup.greendao.download.AcceptTaskRecord;
+import com.sheep.gamegroup.greendao.download.Account;
 import com.sheep.gamegroup.greendao.download.SearchRecord;
-import com.sheep.gamegroup.module.login.model.Account;
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 
-import com.sheep.gamegroup.greendao.download.AcceptTaskRecordDao;
-import com.sheep.gamegroup.greendao.download.AppdownloadBeanDao;
-import com.sheep.gamegroup.greendao.download.DownLoadInfoDao;
 import com.sheep.gamegroup.greendao.download.ProcessRecordDao;
-import com.sheep.gamegroup.greendao.download.ScreenShotRecordDao;
+import com.sheep.gamegroup.greendao.download.AppdownloadBeanDao;
 import com.sheep.gamegroup.greendao.download.SdkLoginUserDao;
+import com.sheep.gamegroup.greendao.download.ScreenShotRecordDao;
+import com.sheep.gamegroup.greendao.download.AcceptTaskRecordDao;
+import com.sheep.gamegroup.greendao.download.AccountDao;
 import com.sheep.gamegroup.greendao.download.SearchRecordDao;
-import com.sheep.gamegroup.module.login.model.AccountDao;
+import com.sheep.gamegroup.greendao.download.DownLoadInfoDao;
 
 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
 
@@ -35,112 +35,112 @@ import com.sheep.gamegroup.module.login.model.AccountDao;
  */
 public class DaoSession extends AbstractDaoSession {
 
-    private final DaoConfig acceptTaskRecordDaoConfig;
-    private final DaoConfig appdownloadBeanDaoConfig;
-    private final DaoConfig downLoadInfoDaoConfig;
     private final DaoConfig processRecordDaoConfig;
-    private final DaoConfig screenShotRecordDaoConfig;
+    private final DaoConfig appdownloadBeanDaoConfig;
     private final DaoConfig sdkLoginUserDaoConfig;
-    private final DaoConfig searchRecordDaoConfig;
+    private final DaoConfig screenShotRecordDaoConfig;
+    private final DaoConfig acceptTaskRecordDaoConfig;
     private final DaoConfig accountDaoConfig;
+    private final DaoConfig searchRecordDaoConfig;
+    private final DaoConfig downLoadInfoDaoConfig;
 
-    private final AcceptTaskRecordDao acceptTaskRecordDao;
-    private final AppdownloadBeanDao appdownloadBeanDao;
-    private final DownLoadInfoDao downLoadInfoDao;
     private final ProcessRecordDao processRecordDao;
-    private final ScreenShotRecordDao screenShotRecordDao;
+    private final AppdownloadBeanDao appdownloadBeanDao;
     private final SdkLoginUserDao sdkLoginUserDao;
-    private final SearchRecordDao searchRecordDao;
+    private final ScreenShotRecordDao screenShotRecordDao;
+    private final AcceptTaskRecordDao acceptTaskRecordDao;
     private final AccountDao accountDao;
+    private final SearchRecordDao searchRecordDao;
+    private final DownLoadInfoDao downLoadInfoDao;
 
     public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
             daoConfigMap) {
         super(db);
 
-        acceptTaskRecordDaoConfig = daoConfigMap.get(AcceptTaskRecordDao.class).clone();
-        acceptTaskRecordDaoConfig.initIdentityScope(type);
+        processRecordDaoConfig = daoConfigMap.get(ProcessRecordDao.class).clone();
+        processRecordDaoConfig.initIdentityScope(type);
 
         appdownloadBeanDaoConfig = daoConfigMap.get(AppdownloadBeanDao.class).clone();
         appdownloadBeanDaoConfig.initIdentityScope(type);
 
-        downLoadInfoDaoConfig = daoConfigMap.get(DownLoadInfoDao.class).clone();
-        downLoadInfoDaoConfig.initIdentityScope(type);
-
-        processRecordDaoConfig = daoConfigMap.get(ProcessRecordDao.class).clone();
-        processRecordDaoConfig.initIdentityScope(type);
+        sdkLoginUserDaoConfig = daoConfigMap.get(SdkLoginUserDao.class).clone();
+        sdkLoginUserDaoConfig.initIdentityScope(type);
 
         screenShotRecordDaoConfig = daoConfigMap.get(ScreenShotRecordDao.class).clone();
         screenShotRecordDaoConfig.initIdentityScope(type);
 
-        sdkLoginUserDaoConfig = daoConfigMap.get(SdkLoginUserDao.class).clone();
-        sdkLoginUserDaoConfig.initIdentityScope(type);
+        acceptTaskRecordDaoConfig = daoConfigMap.get(AcceptTaskRecordDao.class).clone();
+        acceptTaskRecordDaoConfig.initIdentityScope(type);
+
+        accountDaoConfig = daoConfigMap.get(AccountDao.class).clone();
+        accountDaoConfig.initIdentityScope(type);
 
         searchRecordDaoConfig = daoConfigMap.get(SearchRecordDao.class).clone();
         searchRecordDaoConfig.initIdentityScope(type);
 
-        accountDaoConfig = daoConfigMap.get(AccountDao.class).clone();
-        accountDaoConfig.initIdentityScope(type);
+        downLoadInfoDaoConfig = daoConfigMap.get(DownLoadInfoDao.class).clone();
+        downLoadInfoDaoConfig.initIdentityScope(type);
 
-        acceptTaskRecordDao = new AcceptTaskRecordDao(acceptTaskRecordDaoConfig, this);
-        appdownloadBeanDao = new AppdownloadBeanDao(appdownloadBeanDaoConfig, this);
-        downLoadInfoDao = new DownLoadInfoDao(downLoadInfoDaoConfig, this);
         processRecordDao = new ProcessRecordDao(processRecordDaoConfig, this);
-        screenShotRecordDao = new ScreenShotRecordDao(screenShotRecordDaoConfig, this);
+        appdownloadBeanDao = new AppdownloadBeanDao(appdownloadBeanDaoConfig, this);
         sdkLoginUserDao = new SdkLoginUserDao(sdkLoginUserDaoConfig, this);
-        searchRecordDao = new SearchRecordDao(searchRecordDaoConfig, this);
+        screenShotRecordDao = new ScreenShotRecordDao(screenShotRecordDaoConfig, this);
+        acceptTaskRecordDao = new AcceptTaskRecordDao(acceptTaskRecordDaoConfig, this);
         accountDao = new AccountDao(accountDaoConfig, this);
+        searchRecordDao = new SearchRecordDao(searchRecordDaoConfig, this);
+        downLoadInfoDao = new DownLoadInfoDao(downLoadInfoDaoConfig, this);
 
-        registerDao(AcceptTaskRecord.class, acceptTaskRecordDao);
-        registerDao(AppdownloadBean.class, appdownloadBeanDao);
-        registerDao(DownLoadInfo.class, downLoadInfoDao);
         registerDao(ProcessRecord.class, processRecordDao);
-        registerDao(ScreenShotRecord.class, screenShotRecordDao);
+        registerDao(AppdownloadBean.class, appdownloadBeanDao);
         registerDao(SdkLoginUser.class, sdkLoginUserDao);
-        registerDao(SearchRecord.class, searchRecordDao);
+        registerDao(ScreenShotRecord.class, screenShotRecordDao);
+        registerDao(AcceptTaskRecord.class, acceptTaskRecordDao);
         registerDao(Account.class, accountDao);
+        registerDao(SearchRecord.class, searchRecordDao);
+        registerDao(DownLoadInfo.class, downLoadInfoDao);
     }
     
     public void clear() {
-        acceptTaskRecordDaoConfig.clearIdentityScope();
-        appdownloadBeanDaoConfig.clearIdentityScope();
-        downLoadInfoDaoConfig.clearIdentityScope();
         processRecordDaoConfig.clearIdentityScope();
-        screenShotRecordDaoConfig.clearIdentityScope();
+        appdownloadBeanDaoConfig.clearIdentityScope();
         sdkLoginUserDaoConfig.clearIdentityScope();
-        searchRecordDaoConfig.clearIdentityScope();
+        screenShotRecordDaoConfig.clearIdentityScope();
+        acceptTaskRecordDaoConfig.clearIdentityScope();
         accountDaoConfig.clearIdentityScope();
+        searchRecordDaoConfig.clearIdentityScope();
+        downLoadInfoDaoConfig.clearIdentityScope();
     }
 
-    public AcceptTaskRecordDao getAcceptTaskRecordDao() {
-        return acceptTaskRecordDao;
+    public ProcessRecordDao getProcessRecordDao() {
+        return processRecordDao;
     }
 
     public AppdownloadBeanDao getAppdownloadBeanDao() {
         return appdownloadBeanDao;
     }
 
-    public DownLoadInfoDao getDownLoadInfoDao() {
-        return downLoadInfoDao;
-    }
-
-    public ProcessRecordDao getProcessRecordDao() {
-        return processRecordDao;
+    public SdkLoginUserDao getSdkLoginUserDao() {
+        return sdkLoginUserDao;
     }
 
     public ScreenShotRecordDao getScreenShotRecordDao() {
         return screenShotRecordDao;
     }
 
-    public SdkLoginUserDao getSdkLoginUserDao() {
-        return sdkLoginUserDao;
+    public AcceptTaskRecordDao getAcceptTaskRecordDao() {
+        return acceptTaskRecordDao;
+    }
+
+    public AccountDao getAccountDao() {
+        return accountDao;
     }
 
     public SearchRecordDao getSearchRecordDao() {
         return searchRecordDao;
     }
 
-    public AccountDao getAccountDao() {
-        return accountDao;
+    public DownLoadInfoDao getDownLoadInfoDao() {
+        return downLoadInfoDao;
     }
 
 }

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/module/login/ChangePasswordAct.java

@@ -68,7 +68,7 @@ public class ChangePasswordAct extends BaseActivity implements ChangePasswordCon
                     @Override
                     public void onNext(BaseMessage baseMessage) {
                         hideProgress();
-                        G.showToast("密码修改成功");
+                        G.shortToast("密码修改成功");
                         finish();
                     }
 
@@ -76,9 +76,9 @@ public class ChangePasswordAct extends BaseActivity implements ChangePasswordCon
                     public void onError(BaseMessage baseMessage) {
                         hideProgress();
                         if (baseMessage != null) {
-                            G.showToast(baseMessage);
+                            G.shortToast(baseMessage);
                         } else {
-                            G.showToast("修改密码出错");
+                            G.shortToast("修改密码出错");
                         }
                     }
                 });

+ 1 - 9
app/src/main/java/com/sheep/gamegroup/module/login/LoginAct.java

@@ -15,7 +15,7 @@ import com.sheep.gamegroup.module.login.fragments.FindAccountFgt;
 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.module.login.model.Account;
+import com.sheep.gamegroup.greendao.download.Account;
 import com.sheep.gamegroup.util.CertificationUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.TestUtil;
@@ -32,8 +32,6 @@ import java.util.Map;
 
 public class LoginAct extends BaseUMActivity implements LoginController {
 
-    private Fragment currentFragment;
-
     private boolean isLogined = false;
 
     @Override
@@ -46,7 +44,6 @@ public class LoginAct extends BaseUMActivity implements LoginController {
         TitleBarUtils.getInstance().setTitleBack(this);
         SignInFgt signInFragment = SignInFgt.newInstance(this);
         showFragment("", signInFragment);
-        currentFragment = signInFragment;
     }
 
     @Override
@@ -123,7 +120,6 @@ public class LoginAct extends BaseUMActivity implements LoginController {
     private void goEditUserInfo(LoginEntity entity) {
         EditUserInfoFgt editUserInfoFgt = EditUserInfoFgt.newInstance(entity, this);
         showFragment("填写基本资料", editUserInfoFgt);
-        currentFragment = editUserInfoFgt;
     }
 
     @Override
@@ -139,21 +135,18 @@ public class LoginAct extends BaseUMActivity implements LoginController {
     public void whenToRegister() {
         SignUpFgt signUpFragment = SignUpFgt.newInstance(this);
         showFragment("注册", signUpFragment);
-        currentFragment = signUpFragment;
     }
 
     @Override
     public void whenGoFindAccount() {
         FindAccountFgt findAccountFgt = FindAccountFgt.newInstance(this);
         showFragment("登录遇到问题", findAccountFgt);
-        currentFragment = findAccountFgt;
     }
 
     @Override
     public void whenGoValidCaptcha(String phoneNum) {
         ValidCaptchaFgt validCaptchaFgt = ValidCaptchaFgt.newInstance(phoneNum, this);
         showFragment("输入验证码", validCaptchaFgt);
-        currentFragment = validCaptchaFgt;
     }
 
     private void showFragment(String tag, Fragment fragment) {
@@ -161,7 +154,6 @@ public class LoginAct extends BaseUMActivity implements LoginController {
         FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
         transaction.replace(R.id.fragment_container, fragment, tag);
         transaction.show(fragment);
-        currentFragment = fragment;
         transaction.addToBackStack(null);
         transaction.commitAllowingStateLoss();
     }

+ 6 - 6
app/src/main/java/com/sheep/gamegroup/module/login/fragments/EditUserInfoFgt.java

@@ -115,15 +115,15 @@ public class EditUserInfoFgt extends BaseFragment {
     @OnClick(R.id.submit_btn)
     public void doSubmit() {
         if (TextUtils.isEmpty(nickNameBox.getText().toString().trim())) {
-            G.showToast("请输入昵称");
+            G.shortToast("请输入昵称");
             return;
         }
         if (nickNameBox.getText().toString().trim().length() > 30) {
-            G.showToast("昵称长度不能超过30");
+            G.shortToast("昵称长度不能超过30");
             return;
         }
         if (TextUtils.isEmpty(birthdayBox.getText().toString().trim())) {
-            G.showToast("请选择生日");
+            G.shortToast("请选择生日");
             return;
         }
         if (newAvatar != null) {
@@ -143,7 +143,7 @@ public class EditUserInfoFgt extends BaseFragment {
 
                 @Override
                 public void Failure(String err) {
-                    G.showToast("头像上传失败");
+                    G.shortToast("头像上传失败");
                 }
             });
         } else {
@@ -174,9 +174,9 @@ public class EditUserInfoFgt extends BaseFragment {
                     @Override
                     public void onError(BaseMessage baseMessage) {
                         if (baseMessage != null && !TextUtils.isEmpty(baseMessage.getMsg())) {
-                            G.showToast(baseMessage.getMsg());
+                            G.shortToast(baseMessage.getMsg());
                         } else {
-                            G.showToast("提交失败");
+                            G.shortToast("提交失败");
                         }
                     }
                 });

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/module/login/fragments/FindAccountFgt.java

@@ -69,11 +69,11 @@ public class FindAccountFgt extends BaseFragment {
     public void doSendCaptcha(View v) {
         String phoneNum = phoneNumberBox.getText().toString().trim();
         if (TextUtils.isEmpty(phoneNum)) {
-            G.showToast("请输入手机号");
+            G.shortToast("请输入手机号");
             return;
         }
         if (!StringUtils.isMobile(phoneNum)) {
-            G.showToast("手机号有误");
+            G.shortToast("手机号有误");
             return;
         }
         mController.whenGoValidCaptcha(phoneNumberBox.getText().toString());

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/module/login/fragments/NewPasswordFgt.java

@@ -70,11 +70,11 @@ public class NewPasswordFgt extends BaseFragment {
     public void doDone(View v){
         String password = newpwdBox.getText().toString().trim();
         if (TextUtils.isEmpty(password)) {
-            G.showToast("新密码不能为空");
+            G.shortToast("新密码不能为空");
             return;
         }
         if (!StringUtils.isPassword(password)) {
-            G.showToast("用户名只能包含英文、数字、_.-@$!*%符号");
+            G.shortToast("用户名只能包含英文、数字、_.-@$!*%符号");
             return;
         }
         mController.whenComplete(password);

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/module/login/fragments/OldPasswordFgt.java

@@ -71,11 +71,11 @@ public class OldPasswordFgt extends BaseFragment {
     public void doNext(View v) {
         String password = oldpwdBox.getText().toString().trim();
         if (TextUtils.isEmpty(password)) {
-            G.showToast("旧密码不能为空");
+            G.shortToast("旧密码不能为空");
             return;
         }
         if (!StringUtils.isPassword(password)) {
-            G.showToast("用户名只能包含英文、数字、_.-@$!*%符号");
+            G.shortToast("用户名只能包含英文、数字、_.-@$!*%符号");
             return;
         }
         mController.whenNext(password);

+ 16 - 15
app/src/main/java/com/sheep/gamegroup/module/login/fragments/SignInFgt.java

@@ -17,6 +17,7 @@ import android.widget.EditText;
 import android.widget.ImageView;
 import android.widget.PopupWindow;
 import android.widget.TextView;
+import android.widget.Toast;
 
 import com.alibaba.fastjson.JSONObject;
 import com.sheep.gamegroup.greendao.DDProviderHelper;
@@ -24,7 +25,7 @@ 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.module.login.model.Account;
+import com.sheep.gamegroup.greendao.download.Account;
 import com.sheep.gamegroup.util.ChannelContent;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.FastJsonUtils;
@@ -129,19 +130,19 @@ public class SignInFgt extends BaseFragment {
         String username = userNameBox.getText().toString().trim();
         String password = passwordBox.getText().toString().trim();
         if (TextUtils.isEmpty(username)) {
-            G.showToast("请输入用户名");
+            G.shortToast("请输入用户名");
             return false;
         }
         if (TextUtils.isEmpty(password)) {
-            G.showToast("密码不能为空");
+            G.shortToast("密码不能为空");
             return false;
         }
         if (!StringUtils.isUserName(username)) {
-            G.showToast("用户名只能包含英文、数字、._-@符号");
+            G.shortToast("用户名只能包含英文、数字、._-@符号");
             return false;
         }
         if (!StringUtils.isPassword(password)) {
-            G.showToast("用户名只能包含英文、数字、_.-@$!*%符号");
+            G.shortToast("用户名只能包含英文、数字、_.-@$!*%符号");
             return false;
         }
         return true;
@@ -161,7 +162,7 @@ public class SignInFgt extends BaseFragment {
                     @Override
                     public void onError(BaseMessage baseMessage) {
                         hideProgress();
-                        G.showToast(baseMessage);
+                        G.shortToast(baseMessage);
                     }
 
                     @Override
@@ -188,11 +189,11 @@ public class SignInFgt extends BaseFragment {
     private boolean validatePhoneCaptcha() {
         String etCode = captchaBox.getText().toString().trim();
         if (TextUtils.isEmpty(etCode)) {
-            G.showToast(getString(R.string.input_your_captcha));
+            G.shortToast(getString(R.string.input_your_captcha));
             return false;
         }
         if (etCode.length() != 6) {
-            G.showToast(getString(R.string.toast_warning_phone_captcha_image_code_size));
+            G.shortToast(getString(R.string.toast_warning_phone_captcha_image_code_size));
             return false;
         }
         return true;
@@ -212,7 +213,7 @@ public class SignInFgt extends BaseFragment {
                     @Override
                     public void onError(BaseMessage baseMessage) {
                         hideProgress();
-                        G.showToast(baseMessage);
+                        G.shortToast(baseMessage);
                     }
 
                     @Override
@@ -240,11 +241,11 @@ public class SignInFgt extends BaseFragment {
     public void doSendCaptcha(View v) {
         String phoneNum = phoneNumberBox.getText().toString().trim();
         if (TextUtils.isEmpty(phoneNum)) {
-            G.showToast("请输入手机号");
+            G.shortToast("请输入手机号");
             return;
         }
         if (!StringUtils.isMobile(phoneNum)) {
-            G.showToast("手机号有误");
+            G.shortToast("手机号有误");
             return;
         }
         JSONObject jsonObject = new JSONObject();
@@ -303,7 +304,7 @@ public class SignInFgt extends BaseFragment {
                         .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                             @Override
                             public void onError(BaseMessage baseMessage) {
-                                G.showToast("微信登录失败  请检查网络是否正常");
+                                G.shortToast("微信登录失败  请检查网络是否正常");
                                 hideProgress();
                             }
 
@@ -342,7 +343,7 @@ public class SignInFgt extends BaseFragment {
 
                             @Override
                             public void onError(BaseMessage baseMessage) {
-                                G.showToast("QQ登录失败  请检查网络是否正常");
+                                G.shortToast("QQ登录失败  请检查网络是否正常");
                                 hideProgress();
                             }
 
@@ -365,7 +366,7 @@ public class SignInFgt extends BaseFragment {
     @OnClick(R.id.account_menu_btn)
     public void doSelectAccount(View v) {
         final List<Account> listData = DDProviderHelper.getInstance().getAccountList();
-        View flagView = mView.findViewById(R.id.login_btn);
+        View flagView = findViewById(R.id.login_btn);
         RecyclerView listView = new RecyclerView(getContext());
         listView.setBackgroundResource(R.drawable.screenshot_panel);
         listView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
@@ -464,7 +465,7 @@ public class SignInFgt extends BaseFragment {
 
         @Override
         public void onError(SHARE_MEDIA platform, int action, Throwable t) {
-            G.showToast(platformName + "授权失败  请检查网络是否正常");
+            G.shortToast(platformName + "授权失败  请检查网络是否正常");
             hideProgress();
         }
 

+ 5 - 5
app/src/main/java/com/sheep/gamegroup/module/login/fragments/SignUpFgt.java

@@ -90,7 +90,7 @@ public class SignUpFgt extends BaseFragment {
                     @Override
                     public void onError(BaseMessage baseMessage) {
                         hideProgress();
-                        G.showToast(baseMessage);
+                        G.shortToast(baseMessage);
                     }
 
                     @Override
@@ -118,19 +118,19 @@ public class SignUpFgt extends BaseFragment {
         String username = userNameBox.getText().toString().trim();
         String password = passwordBox.getText().toString().trim();
         if (TextUtils.isEmpty(username)) {
-            G.showToast("请输入用户名");
+            G.shortToast("请输入用户名");
             return false;
         }
         if (TextUtils.isEmpty(password)) {
-            G.showToast("密码不能为空");
+            G.shortToast("密码不能为空");
             return false;
         }
         if (!StringUtils.isUserName(username)) {
-            G.showToast("用户名只能包含英文、数字、._-@符号");
+            G.shortToast("用户名只能包含英文、数字、._-@符号");
             return false;
         }
         if (!StringUtils.isPassword(password)) {
-            G.showToast("用户名只能包含英文、数字、_.-@$!*%符号,长度6-16");
+            G.shortToast("用户名只能包含英文、数字、_.-@$!*%符号,长度6-16");
             return false;
         }
         return true;

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/module/login/fragments/ValidCaptchaFgt.java

@@ -97,7 +97,7 @@ public class ValidCaptchaFgt extends BaseFragment {
                     @Override
                     public void onError(BaseMessage baseMessage) {
                         hideProgress();
-                        G.showToast(baseMessage);
+                        G.shortToast(baseMessage);
                     }
 
                     @Override

+ 16 - 8
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -495,8 +495,8 @@ public class CommonUtil {
                 break;
             case JUMP_H5_INNER://内部WebView加载H5
                 if (checkLongMao(activity, jump)) {
-                    if(jump instanceof IJumpWeb){
-                        Jump2View.getInstance().goWeb(context, (IJumpWeb)jump);
+                    if (jump instanceof IJumpWeb) {
+                        Jump2View.getInstance().goWeb(context, (IJumpWeb) jump);
                     } else {
                         Jump2View.getInstance().goWeb(context, jump.getUrl(), jump.getTitle());
                     }
@@ -993,6 +993,7 @@ public class CommonUtil {
         Thread payThread = new Thread(payRunnable);
         payThread.start();
     }
+
     /**
      * 支付宝支付
      *
@@ -1017,8 +1018,8 @@ public class CommonUtil {
                 emitter.onNext(resultStatus);
             }
         }).subscribeOn(Schedulers.io())
-        .observeOn(AndroidSchedulers.mainThread())
-        .subscribe(observer);
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(observer);
     }
 
     /**
@@ -1781,18 +1782,19 @@ public class CommonUtil {
 
     //设置无数据距离上面的距离
     public void setEmptyViewMargin(View empty_view, int topMargin, int bottomMargin) {
-        if(empty_view != null) {
+        if (empty_view != null) {
             ViewGroup.LayoutParams layoutParams = empty_view.getLayoutParams();
-            if(layoutParams instanceof RelativeLayout.LayoutParams) {
+            if (layoutParams instanceof RelativeLayout.LayoutParams) {
                 ((RelativeLayout.LayoutParams) layoutParams).topMargin = topMargin;
                 ((RelativeLayout.LayoutParams) layoutParams).bottomMargin = bottomMargin;
-            } else if(layoutParams instanceof LinearLayout.LayoutParams) {
+            } else if (layoutParams instanceof LinearLayout.LayoutParams) {
                 ((LinearLayout.LayoutParams) layoutParams).topMargin = topMargin;
                 ((LinearLayout.LayoutParams) layoutParams).bottomMargin = bottomMargin;
             }
             empty_view.setLayoutParams(layoutParams);
         }
     }
+
     //设置无数据显示
     public void updateEmptyView(View empty_view, boolean showEmpty) {
         updateEmptyView(empty_view, showEmpty, false);
@@ -1859,6 +1861,12 @@ public class CommonUtil {
         return false;
     }
 
+    public void onDestroy() {
+        if (SheepApp.getInstance().isInitMidong()) {
+            AdManager.getInstance(SheepApp.getInstance()).onAppExit();
+        }
+    }
+
     /**
      * 小米游戏账号领取
      */
@@ -1958,7 +1966,7 @@ public class CommonUtil {
             DownLoadInfo task = (DownLoadInfo) event.getData();
             String url = task.getMDownloadUrl();
             TextView tvProgress = view.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + url);
-            if(tvProgress != null) {
+            if (tvProgress != null) {
                 switch (event.getEventTypes()) {
                     case DOWNLOAD_RUNNING:
                         try {

+ 2 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java

@@ -468,7 +468,9 @@ public class ActMain extends BaseActYmPermissionCheck  {
     protected void onDestroy() {
         super.onDestroy();
         EventBus.getDefault().unregister(this);
+        CommonUtil.getInstance().onDestroy();
         if (container != null && container.getT() != null)
             container.setT(null);
+
     }
 }

+ 4 - 9
app/src/main/java/com/sheep/jiuyan/samllsheep/ui/activity/ActiveRuleActivity.java

@@ -2,8 +2,8 @@ package com.sheep.jiuyan.samllsheep.ui.activity;
 
 import android.widget.TextView;
 
+import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.jiuyan.samllsheep.R;
-import com.sheep.jiuyan.samllsheep.ui.base.BaseActivity;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 
 import butterknife.BindView;
@@ -20,23 +20,18 @@ public class ActiveRuleActivity extends BaseActivity {
     TextView activeRuleText;
 
     @Override
-    protected int onLayout() {
+    protected int getLayoutId() {
         return R.layout.activity_active_rule;
     }
 
     @Override
-    protected void onObject() {
-
-    }
-
-    @Override
-    protected void onView() {
+    public void initView() {
         TitleBarUtils.getInstance().setTitle(this, "活动规则")
                 .setTitleFinish(this);
     }
 
     @Override
-    protected void onData() {
+    public void initData() {
 
     }
 }

+ 6 - 10
app/src/main/java/com/sheep/jiuyan/samllsheep/ui/activity/SignActivity.java

@@ -32,7 +32,7 @@ import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
 import com.sheep.gamegroup.view.customview.ErasableTextView;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
-import com.sheep.jiuyan.samllsheep.ui.base.BaseActivity;
+import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.jiuyan.samllsheep.ui.view.EggView;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.umeng.socialize.UMShareAPI;
@@ -92,18 +92,14 @@ public class SignActivity extends BaseActivity implements UMShareListener {
     private boolean hasMissSign = false;
 
     @Override
-    protected int onLayout() {
+    protected int getLayoutId() {
         return R.layout.activity_sign;
     }
 
-    @Override
-    protected void onObject() {
-
-    }
-
     private float per;//图片每像素在屏幕上的距离
+
     @Override
-    protected void onView() {
+    public void initView() {
         ViewUtil.setText(sign_card_num, ViewUtil.BLOCK);
         ViewUtil.setImage(sheep_sign_machine, ViewUtil.getNetImgByName("sheep_sign_machine"));
         ViewUtil.setImage(sheep_sign_rectangle, ViewUtil.getNetImgByName("sheep_sign_rectangle"));
@@ -170,7 +166,7 @@ public class SignActivity extends BaseActivity implements UMShareListener {
     }
 
     @Override
-    protected void onData() {
+    public void initData() {
         initSigns();
         initUserSignScratchAmount();
         initUserSignLastScratch();
@@ -531,6 +527,6 @@ public class SignActivity extends BaseActivity implements UMShareListener {
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
-        UMShareAPI.get(this).onActivityResult(requestCode, resultCode, data);
+        UMShareAPI.get(SheepApp.getInstance()).onActivityResult(requestCode, resultCode, data);
     }
 }

+ 0 - 64
app/src/main/java/com/sheep/jiuyan/samllsheep/ui/base/BaseActivity.java

@@ -1,64 +0,0 @@
-package com.sheep.jiuyan.samllsheep.ui.base;
-
-import android.annotation.SuppressLint;
-import android.os.Bundle;
-import android.support.annotation.LayoutRes;
-import android.support.annotation.Nullable;
-
-import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
-
-import butterknife.ButterKnife;
-import butterknife.Unbinder;
-
-/**
- * Created by: zhoujuncai.
- * Created date: 2018/10/30.
- * Description: Activity父类
- */
-@SuppressLint("Registered")
-public abstract class BaseActivity extends RxAppCompatActivity {
-
-    private Unbinder unbinder;
-
-    @Override
-    protected void onCreate(@Nullable Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(onLayout());
-        unbinder = ButterKnife.bind(this);
-        onObject();
-        onView();
-        onData();
-    }
-
-    /**
-     * 初始化布局
-     *
-     * @return 返回布局资源id
-     */
-    protected abstract @LayoutRes
-    int onLayout();
-
-    /**
-     * 初始化对象
-     */
-    protected abstract void onObject();
-
-    /**
-     * 初始化视图
-     */
-    protected abstract void onView();
-
-    /**
-     * 初始化数据
-     */
-    protected abstract void onData();
-
-    @Override
-    protected void onDestroy() {
-        if (unbinder != null) {
-            unbinder.unbind();
-            unbinder = null;
-        }
-        super.onDestroy();
-    }
-}

+ 20 - 3
app/src/main/java/com/sheep/jiuyan/samllsheep/ui/view/EggView.java

@@ -86,13 +86,13 @@ public class EggView extends View {
             }
         }
         super.onDraw(canvas);
-        if(!isStop)
+        if (!isStop)
             invalidate();
     }
 
     public void setStop(boolean stop) {
         isStop = stop;
-        if(!isStop)
+        if (!isStop)
             invalidate();
     }
 
@@ -106,8 +106,14 @@ public class EggView extends View {
             eggs[i] = egg;
         }
     }
+
     //退出时销毁
-    public void onDestroy(){
+    public void onDestroy() {
+        for (int i = 0; i < eggs.length; i++) {
+            if (eggs[i] != null) {
+                eggs[i].destroy();
+            }
+        }
         for (Bitmap item : bitmaps) {
             try {
                 item.recycle();
@@ -216,5 +222,16 @@ public class EggView extends View {
             Random r = new Random();
             return r.nextInt(max) % (max - min + 1) + min;
         }
+
+        public void destroy() {
+            if (xValue != null) {
+                xValue.removeAllUpdateListeners();
+                xValue.cancel();
+            }
+            if (yValue != null) {
+                yValue.removeAllUpdateListeners();
+                yValue.cancel();
+            }
+        }
     }
 }

+ 14 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/utils/G.java

@@ -79,6 +79,20 @@ public class G {
         mToast.show();
     }
 
+    public static void shortToast(BaseMessage msg){
+        if(TextUtils.isEmpty(msg.getMsg())){
+            G.shortToast(SheepApp.getInstance().getString(R.string.unknown_error));
+        } else {
+            G.shortToast(msg.getMsg() + (BuildConfig.DEBUG ? "[" + msg.getCode() + "]" : ""));
+        }
+    }
+
+    public static void shortToast(String msg){
+        Toast t = Toast.makeText(SheepApp.getInstance(), msg, Toast.LENGTH_SHORT);
+        t.setGravity(Gravity.CENTER, 0, getRealPix(200));//居中靠下
+        t.show();
+    }
+
     public static void showToast(String msg) {
         showToast(msg, Toast.LENGTH_SHORT);
     }