Kaynağa Gözat

Merge branch 'sheep_develop' of 10.8.230.114:xmy_android/small_sheep_android into sheep_develop

hanjing 7 yıl önce
ebeveyn
işleme
9c6b037499

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

@@ -21,26 +21,26 @@ public class DaoMaster extends AbstractDaoMaster {
 
     /** Creates underlying database table using DAOs. */
     public static void createAllTables(Database db, boolean ifNotExists) {
-        ProcessRecordDao.createTable(db, ifNotExists);
-        AppdownloadBeanDao.createTable(db, ifNotExists);
-        SdkLoginUserDao.createTable(db, ifNotExists);
-        ScreenShotRecordDao.createTable(db, ifNotExists);
         AcceptTaskRecordDao.createTable(db, ifNotExists);
         AccountDao.createTable(db, ifNotExists);
-        SearchRecordDao.createTable(db, ifNotExists);
+        AppdownloadBeanDao.createTable(db, ifNotExists);
         DownLoadInfoDao.createTable(db, ifNotExists);
+        ProcessRecordDao.createTable(db, ifNotExists);
+        ScreenShotRecordDao.createTable(db, ifNotExists);
+        SdkLoginUserDao.createTable(db, ifNotExists);
+        SearchRecordDao.createTable(db, ifNotExists);
     }
 
     /** Drops underlying database table using DAOs. */
     public static void dropAllTables(Database db, boolean ifExists) {
-        ProcessRecordDao.dropTable(db, ifExists);
-        AppdownloadBeanDao.dropTable(db, ifExists);
-        SdkLoginUserDao.dropTable(db, ifExists);
-        ScreenShotRecordDao.dropTable(db, ifExists);
         AcceptTaskRecordDao.dropTable(db, ifExists);
         AccountDao.dropTable(db, ifExists);
-        SearchRecordDao.dropTable(db, ifExists);
+        AppdownloadBeanDao.dropTable(db, ifExists);
         DownLoadInfoDao.dropTable(db, ifExists);
+        ProcessRecordDao.dropTable(db, ifExists);
+        ScreenShotRecordDao.dropTable(db, ifExists);
+        SdkLoginUserDao.dropTable(db, ifExists);
+        SearchRecordDao.dropTable(db, ifExists);
     }
 
     /**
@@ -59,14 +59,14 @@ public class DaoMaster extends AbstractDaoMaster {
 
     public DaoMaster(Database db) {
         super(db, SCHEMA_VERSION);
-        registerDaoClass(ProcessRecordDao.class);
-        registerDaoClass(AppdownloadBeanDao.class);
-        registerDaoClass(SdkLoginUserDao.class);
-        registerDaoClass(ScreenShotRecordDao.class);
         registerDaoClass(AcceptTaskRecordDao.class);
         registerDaoClass(AccountDao.class);
-        registerDaoClass(SearchRecordDao.class);
+        registerDaoClass(AppdownloadBeanDao.class);
         registerDaoClass(DownLoadInfoDao.class);
+        registerDaoClass(ProcessRecordDao.class);
+        registerDaoClass(ScreenShotRecordDao.class);
+        registerDaoClass(SdkLoginUserDao.class);
+        registerDaoClass(SearchRecordDao.class);
     }
 
     public DaoSession newSession() {

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

+ 2 - 1
app/src/main/java/com/sheep/gamegroup/module/ad_htxd/model/ArticleAd.java

@@ -5,6 +5,7 @@ import com.hoc.hoclib.adlib.NativeADDataInfo;
 import com.hoc.hoclib.adlib.PNative;
 import com.sheep.gamegroup.model.entity.Article;
 import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.TestUtil;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 
 import rx.functions.Action1;
@@ -18,7 +19,7 @@ public class ArticleAd extends Article {
 
     public static final String FEED = "1D0JLRMA102V277730B60000552042FE";
     public static final int INDEX = 4;//放在position为4的位置,即第5个
-    public static final boolean showAd = true;//是否显示广告
+    public static final boolean showAd = TestUtil.isSheep();//是否显示广告
 
     private NativeADDataInfo nativeADDataInfo;
     private PNative pNative;

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

@@ -114,7 +114,7 @@ public class SignInFgt extends AbsLoginFgt {
         }
 
         InputFilterUtil.filterPhone86(phoneNumberBox);
-        InputFilterUtil.filterPhone86(userNameBox);
+        InputFilterUtil.filterPhone86(userNameBox, false);
     }
 
     @OnClick(R.id.login_btn)

+ 40 - 19
app/src/main/java/com/sheep/gamegroup/util/StringUtils.java

@@ -30,9 +30,10 @@ import java.util.regex.Pattern;
 public class StringUtils {
     /**
      * 拷贝文字到粘贴板
+     *
      * @param text
      */
-    public static boolean  CopyText(String  text){
+    public static boolean CopyText(String text) {
         ClipboardManager clipboardManager = (ClipboardManager) SheepApp.getInstance().getSystemService(Context.CLIPBOARD_SERVICE);
         if (clipboardManager != null && !TextUtils.isEmpty(text)) {
             //创建ClipData对象
@@ -46,12 +47,13 @@ public class StringUtils {
 
     /**
      * 校验银行卡卡号
+     *
      * @param cardId
      * @return
      */
     public static boolean checkBankCard(String cardId) {
         char bit = getBankCardCheckCode(cardId.substring(0, cardId.length() - 1));
-        if(bit == 'N'){
+        if (bit == 'N') {
             return false;
         }
         return cardId.charAt(cardId.length() - 1) == bit;
@@ -59,32 +61,33 @@ public class StringUtils {
 
     /**
      * 从不含校验位的银行卡卡号采用 Luhm 校验算法获得校验位
+     *
      * @param nonCheckCodeCardId
      * @return
      */
-    public static char getBankCardCheckCode(String nonCheckCodeCardId){
-        if(nonCheckCodeCardId == null || nonCheckCodeCardId.trim().length() == 0
+    public static char getBankCardCheckCode(String nonCheckCodeCardId) {
+        if (nonCheckCodeCardId == null || nonCheckCodeCardId.trim().length() == 0
                 || !nonCheckCodeCardId.matches("\\d+")) {
             //如果传的不是数据返回N
             return 'N';
         }
         char[] chs = nonCheckCodeCardId.trim().toCharArray();
         int luhmSum = 0;
-        for(int i = chs.length - 1, j = 0; i >= 0; i--, j++) {
+        for (int i = chs.length - 1, j = 0; i >= 0; i--, j++) {
             int k = chs[i] - '0';
-            if(j % 2 == 0) {
+            if (j % 2 == 0) {
                 k *= 2;
                 k = k / 10 + k % 10;
             }
             luhmSum += k;
         }
-        return (luhmSum % 10 == 0) ? '0' : (char)((10 - luhmSum % 10) + '0');
+        return (luhmSum % 10 == 0) ? '0' : (char) ((10 - luhmSum % 10) + '0');
     }
 
 
-
     /**
      * 验证身份证
+     *
      * @param IDStr
      * @return "YES" 代表合法的身份证 ,其他值代表错误信息
      * @throws ParseException
@@ -93,7 +96,7 @@ public class StringUtils {
         String tipInfo = "YES";// 记录错误信息
         String Ai = "";
 
-        if(null == IDStr || IDStr.trim().isEmpty())
+        if (null == IDStr || IDStr.trim().isEmpty())
             return "身份证号码长度应该为15位或18位。";
 
         // 判断号码的长度 15位或18位
@@ -161,8 +164,8 @@ public class StringUtils {
      * 对应关系为: Y值: 0 1 2 3 4 5 6 7 8 9 10 校验码: 1 0 X 9 8 7 6 5 4 3 2
      */
     private static boolean isVarifyCode(String Ai, String IDStr) {
-        String[] VarifyCode = { "1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2" };
-        String[] Wi = { "7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2" };
+        String[] VarifyCode = {"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"};
+        String[] Wi = {"7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2"};
         int sum = 0;
         for (int i = 0; i < 17; i++) {
             sum = sum + Integer.parseInt(String.valueOf(Ai.charAt(i))) * Integer.parseInt(Wi[i]);
@@ -274,13 +277,13 @@ public class StringUtils {
         return m.matches();
     }
 
-    public static boolean isUserName(String name){
+    public static boolean isUserName(String name) {
         Pattern p = Pattern.compile("^[a-zA-Z0-9_.-@]{4,20}$");
         Matcher m = p.matcher(name);
         return m.matches();
     }
 
-    public static boolean isPassword(String name){
+    public static boolean isPassword(String name) {
         Pattern p = Pattern.compile("^[a-zA-Z0-9_.-@$!*%]{6,16}$");
         Matcher m = p.matcher(name);
         return m.matches();
@@ -288,10 +291,11 @@ public class StringUtils {
 
     /**
      * 格式化json
+     *
      * @param msg
      * @return
      */
-    public static String parseJson(String msg){
+    public static String parseJson(String msg) {
         String message;
         try {
             if (msg.startsWith("{")) {
@@ -329,13 +333,13 @@ public class StringUtils {
     public static final int CONTENT_TYPE_EXP = 2;
 
     public static int initContentType(String content) {
-        if(TextUtils.isEmpty(content)){
+        if (TextUtils.isEmpty(content)) {
             return CONTENT_TYPE_FONT;
         }
         boolean hasExp = EmotionLayout.hasExp(content);
-        if(hasExp){
+        if (hasExp) {
             return CONTENT_TYPE_EXP;
-        } else if(content.contains("<p>") || content.contains("<br>")){
+        } else if (content.contains("<p>") || content.contains("<br>")) {
             return CONTENT_TYPE_H5;
         } else {
             return CONTENT_TYPE_FONT;
@@ -345,7 +349,8 @@ public class StringUtils {
 
     /**
      * 获取所有满足正则表达式的字符串
-     * @param str 需要被获取的字符串
+     *
+     * @param str   需要被获取的字符串
      * @param regex 正则表达式
      * @return 所有满足正则表达式的字符串
      */
@@ -370,7 +375,7 @@ public class StringUtils {
     public static CharSequence getCopyText() {
         // 获取系统剪贴板
         ClipboardManager clipboard = (ClipboardManager) SheepApp.getInstance().getSystemService(Context.CLIPBOARD_SERVICE);
-        if(clipboard != null) {
+        if (clipboard != null) {
             // 获取剪贴板的剪贴数据集
             ClipData clipData = clipboard.getPrimaryClip();
             if (clipData != null && clipData.getItemCount() > 0) {
@@ -396,4 +401,20 @@ public class StringUtils {
     public static boolean isVideoUrl(String url) {
         return url.endsWith(".mp4");
     }
+
+    /**
+     *  
+     * 使用正则表达式过滤非数字字符串
+     *
+     * @param str  需要过滤的字符串 
+     * @return      
+     */
+    public static String filterUnNumber(String str) {
+        // 只允数字
+        String regEx = "[^0-9]";
+        Pattern p = Pattern.compile(regEx);
+        Matcher m = p.matcher(str);
+        //把非数字的字符替换为""
+        return m.replaceAll("").trim();
+    }
 }

+ 10 - 2
app/src/main/java/com/sheep/gamegroup/util/filter/InputFilterUtil.java

@@ -3,6 +3,8 @@ package com.sheep.gamegroup.util.filter;
 import android.text.InputFilter;
 import android.widget.EditText;
 
+import com.sheep.gamegroup.util.StringUtils;
+
 /**
  * Created by realicing on 2019/1/10.
  * realicing@sina.com
@@ -12,8 +14,12 @@ import android.widget.EditText;
 public class InputFilterUtil {
     //过滤掉复制内容中的86或者+86
     public static void filterPhone86(EditText editText) {
+        filterPhone86(editText, true);
+    }
+    public static void filterPhone86(EditText editText, boolean isOnlyNumber) {
         InputFilter[] filters = editText.getFilters();
-        InputFilter[] newFilters = new InputFilter[filters.length + 1];
+        int count = isOnlyNumber ? 2 : 1;
+        InputFilter[] newFilters = new InputFilter[filters.length + count];
         newFilters[0] = (charSequence, start, end, spanned, start2, end2) -> {
             if(spanned.length() == 0){
 //                if(end - start == 1) {//一个一个的输入时,必须以1开始
@@ -30,8 +36,10 @@ public class InputFilterUtil {
             }
             return null;
         };
+        if(isOnlyNumber)
+            newFilters[1] = (charSequence, start, end, spanned, start2, end2) -> StringUtils.filterUnNumber(charSequence.toString());
         for (int i = 0; i < filters.length; i++) {
-            newFilters[i + 1] = filters[i];
+            newFilters[i + count] = filters[i];
         }
         editText.setFilters(newFilters);
     }

+ 45 - 7
app/src/main/java/com/sheep/gamegroup/view/activity/ActVideoDetail.java

@@ -14,6 +14,7 @@ import android.widget.ImageView;
 import android.widget.TextView;
 
 import com.kfzs.duanduan.utils.StatusBarUtils;
+import com.sheep.gamegroup.absBase.AbsObserver;
 import com.sheep.gamegroup.absBase.BaseUMActivity;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DiscoveryVideo;
@@ -41,6 +42,7 @@ import java.util.ArrayList;
 
 import butterknife.BindView;
 import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.disposables.Disposable;
 import io.reactivex.schedulers.Schedulers;
 
 /**
@@ -59,6 +61,8 @@ public class ActVideoDetail extends BaseUMActivity {
     //播放
     @BindView(R.id.detail_player)
     StandardGSYVideoPlayer videoPlayer;
+    @BindView(R.id.gsy_video_play_iv)
+    View gsy_video_play_iv;//播放按钮
     @BindView(R.id.video_loading)
     View video_loading;
 
@@ -137,7 +141,6 @@ public class ActVideoDetail extends BaseUMActivity {
     }
 
     private boolean isPlay = false;
-    private boolean isPause = false;
     private ImageView coverImageView;
     private boolean isInit = false;
     private void initPlay() {
@@ -179,6 +182,39 @@ public class ActVideoDetail extends BaseUMActivity {
         ViewUtil.setImage(coverImageView, getVideoCoverUrl());
     }
 
+
+    private Disposable disposable;
+    private void playOrPause() {
+//        gsy_video_play_iv
+        if(isPlaying()){
+            isPlay = false;
+            ViewUtil.setVisibility(gsy_video_play_iv, true);
+            if(disposable != null && !disposable.isDisposed()){
+                disposable.dispose();
+            }
+            ViewUtil.delay(new AbsObserver<Integer>(){
+                @Override
+                public void onSubscribe(Disposable d) {
+                    disposable = d;
+                }
+
+                @Override
+                public void onNext(Integer integer) {
+                    ViewUtil.setVisibility(gsy_video_play_iv, false);
+                }
+
+                @Override
+                public void onComplete() {
+                    disposable = null;
+                }
+            }, 2);
+            videoPlayer.onVideoPause();
+        } else {
+            isPlay = true;
+            ViewUtil.setVisibility(gsy_video_play_iv, false);
+            videoPlayer.onVideoResume();
+        }
+    }
     //点赞
     public void onClickVideoLike(View view) {
         ViewUtil.setEnabled(video_like_tv, false);
@@ -351,7 +387,7 @@ public class ActVideoDetail extends BaseUMActivity {
 
     //是否正在播放视频
     private boolean isPlaying(){
-        return isPlay && !isPause;
+        return isPlay;
     }
 
 
@@ -378,14 +414,18 @@ public class ActVideoDetail extends BaseUMActivity {
         videoPlayer.onVideoResume();
         super.onResume();
         updateVideoCommentNo();
-        isPause = false;
+        isPlay = true;
     }
 
     @Override
     protected void onPause() {
         videoPlayer.onVideoPause();
+        //取消 播放按钮图片消失的事件
+        if(disposable != null && !disposable.isDisposed()){
+            disposable.dispose();
+        }
         super.onPause();
-        isPause = true;
+        isPlay = false;
     }
 
     @Override
@@ -426,9 +466,7 @@ public class ActVideoDetail extends BaseUMActivity {
             LogUtil.println("mGestureListener", "onSingleTapConfirmed");
             ViewUtil.toggleVisibility(video_top);
             ViewUtil.setVisibility(video_bottom, ViewUtil.isVisible(video_top));
-//            if(isPlaying)
-//                isPauseByUser = true;
-//            playOrPause();
+            playOrPause();
             return super.onSingleTapConfirmed(e);
         }
         @Override

+ 7 - 0
app/src/main/res/layout/gsy_video_layout_sheep.xml

@@ -19,4 +19,11 @@
         android:gravity="center"
         android:layout_centerInParent="true"/>
 
+    <ImageView
+        android:id="@+id/gsy_video_play_iv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true"
+        android:visibility="gone"
+        android:src="@drawable/ic_play_but_image"/>
 </RelativeLayout>