billyyoyo преди 6 години
родител
ревизия
fb6b5e7a45
променени са 40 файла, в които са добавени 1307 реда и са изтрити 406 реда
  1. 4 4
      app/build.gradle
  2. BIN
      app/libs/ad_dk_sdk.aar
  3. 13 6
      app/src/main/AndroidManifest.xml
  4. 1 0
      app/src/main/assets/data.json
  5. 1 0
      app/src/main/assets/snapshot.svg
  6. 0 9
      app/src/main/java/com/sheep/gamegroup/db/DBUtils.java
  7. 4 2
      app/src/main/java/com/sheep/gamegroup/di/modules/NetModule.java
  8. 47 2
      app/src/main/java/com/sheep/gamegroup/greendao/DDProviderHelper.java
  9. 5 2
      app/src/main/java/com/sheep/gamegroup/greendao/download/DaoMaster.java
  10. 14 0
      app/src/main/java/com/sheep/gamegroup/greendao/download/DaoSession.java
  11. 258 0
      app/src/main/java/com/sheep/gamegroup/greendao/download/SheepAd.java
  12. 253 0
      app/src/main/java/com/sheep/gamegroup/greendao/download/SheepAdDao.java
  13. 11 0
      app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java
  14. 94 43
      app/src/main/java/com/sheep/gamegroup/model/entity/Article.java
  15. 19 7
      app/src/main/java/com/sheep/gamegroup/module/game/fragment/FgtGameCenter.java
  16. 14 0
      app/src/main/java/com/sheep/gamegroup/module/task/fragments/FgtVideoTaskBase.java
  17. 7 2
      app/src/main/java/com/sheep/gamegroup/module/task/fragments/FgtVideoTaskDK.java
  18. 1 11
      app/src/main/java/com/sheep/gamegroup/module/task/fragments/FgtVideoTaskZK.java
  19. 0 3
      app/src/main/java/com/sheep/gamegroup/presenter/SmallSheepContract.java
  20. 0 17
      app/src/main/java/com/sheep/gamegroup/presenter/SmallSheepPresenter.java
  21. 117 12
      app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java
  22. 8 16
      app/src/main/java/com/sheep/gamegroup/util/Jump2View.java
  23. 9 0
      app/src/main/java/com/sheep/gamegroup/util/SysAppUtil.java
  24. 11 12
      app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java
  25. 19 0
      app/src/main/java/com/sheep/gamegroup/util/js/KFZSJs.java
  26. 10 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java
  27. 55 42
      app/src/main/java/com/sheep/gamegroup/view/activity/SplashAct.java
  28. 106 0
      app/src/main/java/com/sheep/gamegroup/view/activity/helper/AdHelper.java
  29. 0 123
      app/src/main/java/com/sheep/gamegroup/view/activity/helper/SplashHelper.java
  30. 11 5
      app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment5.java
  31. 61 5
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtFindChild.java
  32. 51 74
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java
  33. 4 3
      app/src/main/java/com/sheep/jiuyan/samllsheep/Config.java
  34. 2 2
      app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java
  35. 1 0
      app/src/main/java/com/sheep/jiuyan/samllsheep/base/BaseFragment.java
  36. 9 4
      app/src/main/java/com/sheep/jiuyan/samllsheep/utils/GlideApp.java
  37. 6 0
      app/src/main/res/drawable/shape_gray_stroke_3.xml
  38. 9 0
      app/src/main/res/layout/act_bottom_bar.xml
  39. 63 0
      app/src/main/res/layout/find_item_ad.xml
  40. 9 0
      media/share_library/src/main/java/rx/functions/Action2.java

+ 4 - 4
app/build.gradle

@@ -2,7 +2,6 @@ apply plugin: 'com.android.application'
 apply plugin: 'com.jakewharton.butterknife'
 apply plugin: 'org.greenrobot.greendao'
 //apply plugin: 'com.didi.virtualapk.host'
-//apply plugin: 'realm-android'//Realm数据库
 android {
     compileSdkVersion ANDROID_COMPILE_SDK_VERSION as int
     defaultConfig {
@@ -25,7 +24,7 @@ android {
         }
     }
     greendao {
-        schemaVersion 18
+        schemaVersion 19
         targetGenDir 'src/main/java'
     }
     signingConfigs {
@@ -307,13 +306,13 @@ dependencies {
 
     //    implementation 'me.iwf.photopicker:PhotoPicker:0.9.12@aar'
     implementation(name: 'PhotoPicker-release-201810081154', ext: 'aar')
-    implementation('com.github.bumptech.glide:glide:4.1.1') {
+    implementation('com.github.bumptech.glide:glide:4.9.0') {
         exclude group: 'com.android.support', module: 'support-fragment'
 //        exclude group: 'com.github.bumptech.glide', module: 'gifdecoder'
 //        exclude group: 'com.github.bumptech.glide', module: 'disklrucache'
 //        exclude group: 'com.github.bumptech.glide', module: 'annotations'
     }
-    annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
+    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
 
     //    implementation 'com.github.yalantis:ucrop:2.2.1-native'
 
@@ -443,6 +442,7 @@ dependencies {
     implementation files('libs/ipaynow_wechatpay_v2.0.5.jar')
 
     implementation(name: 'face-sdk-release', ext: 'aar')
+    implementation 'com.airbnb.android:lottie:2.7.0'
 }
 
 static def releaseTime() {

BIN
app/libs/ad_dk_sdk.aar


+ 13 - 6
app/src/main/AndroidManifest.xml

@@ -116,9 +116,9 @@
             </intent-filter>
         </service>
 
-        <meta-data
-            android:name="com.sheep.jiuyan.samllsheep.utils.GlideApp"
-            android:value="GlideModule" />
+        <!--<meta-data-->
+            <!--android:name="com.sheep.jiuyan.samllsheep.utils.GlideAppModuleModule"-->
+            <!--android:value="AppGlideModule" />-->
         <meta-data
             android:name="design_width_in_dp"
             android:value="375" />
@@ -1019,18 +1019,25 @@
         <!-- =================点客广告SDK================== -->
         <activity
             android:name="com.tencent.tmsecure.dksdk.ad.TxRewardVideoActivity"
-            android:theme="@android:style/Theme.NoTitleBar" />
+            android:configChanges="keyboardHidden|navigation|orientation|screenSize"
+            android:screenOrientation="portrait"
+            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
         <activity
             android:name="com.tencent.tmsecure.dksdk.ad.TxDownCoinActivity"
-            android:theme="@android:style/Theme.NoTitleBar" />
+            android:configChanges="keyboardHidden|navigation|orientation|screenSize"
+            android:screenOrientation="portrait"
+            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
         <activity
             android:name="com.tencent.tmsecure.dksdk.ad.PlayGiveCoinActivity"
+            android:screenOrientation="portrait"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:theme="@style/dk_dialogstyle" />
         <activity
             android:name="com.tencent.tmsecure.dksdk.ad.WebViewActivity"
+            android:configChanges="keyboardHidden|navigation|orientation|screenSize"
+            android:screenOrientation="portrait"
             android:hardwareAccelerated="true"
-            android:theme="@android:style/Theme.NoTitleBar" />
+            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
     </application>
 
 </manifest>

Файловите разлики са ограничени, защото са твърде много
+ 1 - 0
app/src/main/assets/data.json


Файловите разлики са ограничени, защото са твърде много
+ 1 - 0
app/src/main/assets/snapshot.svg


+ 0 - 9
app/src/main/java/com/sheep/gamegroup/db/DBUtils.java

@@ -1,9 +0,0 @@
-package com.sheep.gamegroup.db;
-
-/**
- * created on:2018/8/27 on 15:26
- * created by: YSL
- * 描述:
- */
-public class DBUtils {
-}

+ 4 - 2
app/src/main/java/com/sheep/gamegroup/di/modules/NetModule.java

@@ -1,5 +1,7 @@
 package com.sheep.gamegroup.di.modules;
 
+import android.util.Log;
+
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.api.StringConverterFactory;
 import com.sheep.gamegroup.model.cookie.CookieManager;
@@ -49,8 +51,8 @@ public class NetModule {
     public Retrofit provideRetrofit(OkHttpClient okhttpClient) {
         Retrofit retrofit = new Retrofit.Builder()
                 .client(okhttpClient)
-                .baseUrl(SheepApp.getInstance().getConnectAddress().getAppUrl()+"v1/")
-//                .baseUrl("http://ss.17xmy.com/v1/")
+//                .baseUrl(SheepApp.getInstance().getConnectAddress().getAppUrl()+"v1/")
+                .baseUrl("http://ss.17xmy.com/v1/")
 //                .baseUrl("http://192.168.0.109:8080/v1/")
 //                .baseUrl("http://10.8.240.193:8080/v1/")
                 .addConverterFactory(StringConverterFactory.create())

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

@@ -18,6 +18,8 @@ import com.sheep.gamegroup.greendao.download.SearchRecord;
 import com.sheep.gamegroup.greendao.download.SearchRecordDao;
 import com.sheep.gamegroup.greendao.download.Account;
 import com.sheep.gamegroup.greendao.download.AccountDao;
+import com.sheep.gamegroup.greendao.download.SheepAd;
+import com.sheep.gamegroup.greendao.download.SheepAdDao;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.DownloadUtil;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -552,7 +554,6 @@ public class DDProviderHelper {
                 .unique();
     }
 
-
     /**
      * 添加或更新记录
      * 添加成功返回true
@@ -661,7 +662,7 @@ public class DDProviderHelper {
                 .list();
     }
 
-    public void deleteAllSearchRecords(){
+    public void deleteAllSearchRecords() {
         getDaossion().getSearchRecordDao().deleteAll();
     }
 
@@ -695,4 +696,48 @@ public class DDProviderHelper {
         }
         return false;
     }
+
+    public void saveSheepAd(SheepAd ad) {
+        getDaossion().getSheepAdDao().insert(ad);
+    }
+
+    public void clearSheepAd() {
+        getDaossion().getSheepAdDao().deleteAll();
+    }
+
+    public void deleteSheepAd(int form) {
+        getDaossion().getSheepAdDao()
+                .queryBuilder()
+                .where(SheepAdDao.Properties.Form.eq(form))
+                .buildDelete()
+                .executeDeleteWithoutDetachingEntities();
+    }
+
+    public List<SheepAd> allSheepAds() {
+        return getDaossion().getSheepAdDao().loadAll();
+    }
+
+    public List<SheepAd> listSheepAd(int type) {
+        return getDaossion()
+                .getSheepAdDao()
+                .queryBuilder()
+                .where(SheepAdDao.Properties.Form.eq(type))
+                .build()
+                .list();
+    }
+
+    public SheepAd getSheepAd(int type) {
+        List<SheepAd> ads = getDaossion()
+                .getSheepAdDao()
+                .queryBuilder()
+                .where(SheepAdDao.Properties.Form.eq(type))
+                .limit(1)
+                .build().list();
+        if (ads != null && ads.size() > 0) {
+            return ads.get(0);
+        } else {
+            return null;
+        }
+    }
+
 }

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

@@ -14,14 +14,15 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
 
 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
 /**
- * Master of DAO (schema version 18): knows all DAOs.
+ * Master of DAO (schema version 19): knows all DAOs.
  */
 public class DaoMaster extends AbstractDaoMaster {
-    public static final int SCHEMA_VERSION = 18;
+    public static final int SCHEMA_VERSION = 19;
 
     /** Creates underlying database table using DAOs. */
     public static void createAllTables(Database db, boolean ifNotExists) {
         SdkLoginUserDao.createTable(db, ifNotExists);
+        SheepAdDao.createTable(db, ifNotExists);
         AcceptTaskRecordDao.createTable(db, ifNotExists);
         AppdownloadBeanDao.createTable(db, ifNotExists);
         DownLoadInfoDao.createTable(db, ifNotExists);
@@ -34,6 +35,7 @@ public class DaoMaster extends AbstractDaoMaster {
     /** Drops underlying database table using DAOs. */
     public static void dropAllTables(Database db, boolean ifExists) {
         SdkLoginUserDao.dropTable(db, ifExists);
+        SheepAdDao.dropTable(db, ifExists);
         AcceptTaskRecordDao.dropTable(db, ifExists);
         AppdownloadBeanDao.dropTable(db, ifExists);
         DownLoadInfoDao.dropTable(db, ifExists);
@@ -60,6 +62,7 @@ public class DaoMaster extends AbstractDaoMaster {
     public DaoMaster(Database db) {
         super(db, SCHEMA_VERSION);
         registerDaoClass(SdkLoginUserDao.class);
+        registerDaoClass(SheepAdDao.class);
         registerDaoClass(AcceptTaskRecordDao.class);
         registerDaoClass(AppdownloadBeanDao.class);
         registerDaoClass(DownLoadInfoDao.class);

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

@@ -9,6 +9,7 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
 import org.greenrobot.greendao.internal.DaoConfig;
 
 import com.sheep.gamegroup.greendao.download.SdkLoginUser;
+import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.greendao.download.AcceptTaskRecord;
 import com.sheep.gamegroup.greendao.download.AppdownloadBean;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
@@ -18,6 +19,7 @@ import com.sheep.gamegroup.greendao.download.Account;
 import com.sheep.gamegroup.greendao.download.ScreenShotRecord;
 
 import com.sheep.gamegroup.greendao.download.SdkLoginUserDao;
+import com.sheep.gamegroup.greendao.download.SheepAdDao;
 import com.sheep.gamegroup.greendao.download.AcceptTaskRecordDao;
 import com.sheep.gamegroup.greendao.download.AppdownloadBeanDao;
 import com.sheep.gamegroup.greendao.download.DownLoadInfoDao;
@@ -36,6 +38,7 @@ import com.sheep.gamegroup.greendao.download.ScreenShotRecordDao;
 public class DaoSession extends AbstractDaoSession {
 
     private final DaoConfig sdkLoginUserDaoConfig;
+    private final DaoConfig sheepAdDaoConfig;
     private final DaoConfig acceptTaskRecordDaoConfig;
     private final DaoConfig appdownloadBeanDaoConfig;
     private final DaoConfig downLoadInfoDaoConfig;
@@ -45,6 +48,7 @@ public class DaoSession extends AbstractDaoSession {
     private final DaoConfig screenShotRecordDaoConfig;
 
     private final SdkLoginUserDao sdkLoginUserDao;
+    private final SheepAdDao sheepAdDao;
     private final AcceptTaskRecordDao acceptTaskRecordDao;
     private final AppdownloadBeanDao appdownloadBeanDao;
     private final DownLoadInfoDao downLoadInfoDao;
@@ -60,6 +64,9 @@ public class DaoSession extends AbstractDaoSession {
         sdkLoginUserDaoConfig = daoConfigMap.get(SdkLoginUserDao.class).clone();
         sdkLoginUserDaoConfig.initIdentityScope(type);
 
+        sheepAdDaoConfig = daoConfigMap.get(SheepAdDao.class).clone();
+        sheepAdDaoConfig.initIdentityScope(type);
+
         acceptTaskRecordDaoConfig = daoConfigMap.get(AcceptTaskRecordDao.class).clone();
         acceptTaskRecordDaoConfig.initIdentityScope(type);
 
@@ -82,6 +89,7 @@ public class DaoSession extends AbstractDaoSession {
         screenShotRecordDaoConfig.initIdentityScope(type);
 
         sdkLoginUserDao = new SdkLoginUserDao(sdkLoginUserDaoConfig, this);
+        sheepAdDao = new SheepAdDao(sheepAdDaoConfig, this);
         acceptTaskRecordDao = new AcceptTaskRecordDao(acceptTaskRecordDaoConfig, this);
         appdownloadBeanDao = new AppdownloadBeanDao(appdownloadBeanDaoConfig, this);
         downLoadInfoDao = new DownLoadInfoDao(downLoadInfoDaoConfig, this);
@@ -91,6 +99,7 @@ public class DaoSession extends AbstractDaoSession {
         screenShotRecordDao = new ScreenShotRecordDao(screenShotRecordDaoConfig, this);
 
         registerDao(SdkLoginUser.class, sdkLoginUserDao);
+        registerDao(SheepAd.class, sheepAdDao);
         registerDao(AcceptTaskRecord.class, acceptTaskRecordDao);
         registerDao(AppdownloadBean.class, appdownloadBeanDao);
         registerDao(DownLoadInfo.class, downLoadInfoDao);
@@ -102,6 +111,7 @@ public class DaoSession extends AbstractDaoSession {
     
     public void clear() {
         sdkLoginUserDaoConfig.clearIdentityScope();
+        sheepAdDaoConfig.clearIdentityScope();
         acceptTaskRecordDaoConfig.clearIdentityScope();
         appdownloadBeanDaoConfig.clearIdentityScope();
         downLoadInfoDaoConfig.clearIdentityScope();
@@ -115,6 +125,10 @@ public class DaoSession extends AbstractDaoSession {
         return sdkLoginUserDao;
     }
 
+    public SheepAdDao getSheepAdDao() {
+        return sheepAdDao;
+    }
+
     public AcceptTaskRecordDao getAcceptTaskRecordDao() {
         return acceptTaskRecordDao;
     }

+ 258 - 0
app/src/main/java/com/sheep/gamegroup/greendao/download/SheepAd.java

@@ -0,0 +1,258 @@
+package com.sheep.gamegroup.greendao.download;
+
+import org.greenrobot.greendao.annotation.Entity;
+import org.greenrobot.greendao.annotation.Generated;
+import org.greenrobot.greendao.annotation.Id;
+import org.greenrobot.greendao.annotation.Property;
+
+@Entity
+public class SheepAd {
+
+    //1:开屏广告
+    public final static int FORM_SPASH = 1;
+    //2:弹窗广告
+    public final static int FORM_POP = 2;
+    //3:首页轮播广告
+    public final static int FORM_HOME_BANNER = 3;
+    //4:首页中置banner
+    public final static int FORM_HOME_BAR = 4;
+    //5:游戏中心轮播
+    public final static int FORM_GAME_BANNER = 5;
+    //6:福利中心轮播
+    public final static int FORM_WELFARE_BANNER = 6;
+    //7:咨询推广位
+    public final static int FORM_NEWS = 7;
+    //8:游戏悬浮球广告
+    public final static int FORM_GAME_FLOAT = 8;
+
+    @Id(autoincrement = true)
+    private Long id;
+    @Property(nameInDb = "ad_id")
+    private long ad_id;
+    @Property(nameInDb = "name")
+    private String name;
+    @Property(nameInDb = "ad_img")
+    private String ad_img;
+    @Property(nameInDb = "form")
+    private int form;
+    @Property(nameInDb = "jump_form")
+    private int jump_form;
+    @Property(nameInDb = "jump_type")
+    private int jump_type;
+    @Property(nameInDb = "jump_url")
+    private String jump_url;
+    @Property(nameInDb = "link_id")
+    private long link_id;
+    @Property(nameInDb = "link_type")
+    private int link_type;
+    @Property(nameInDb = "start_time")
+    private long start_time;
+    @Property(nameInDb = "end_time")
+    private long end_time;
+    @Property(nameInDb = "platform")
+    private int platform;
+    @Property(nameInDb = "status")
+    private int status;
+    @Property(nameInDb = "user_id")
+    private long user_id;
+    @Property(nameInDb = "user_name")
+    private String user_name;
+    @Property(nameInDb = "user_type")
+    private int user_type;
+    @Property(nameInDb = "create_time")
+    private long create_time;
+    @Property(nameInDb = "update_time")
+    private long update_time;
+
+    @Generated(hash = 973022081)
+    public SheepAd(Long id, long ad_id, String name, String ad_img, int form,
+            int jump_form, int jump_type, String jump_url, long link_id,
+            int link_type, long start_time, long end_time, int platform,
+            int status, long user_id, String user_name, int user_type,
+            long create_time, long update_time) {
+        this.id = id;
+        this.ad_id = ad_id;
+        this.name = name;
+        this.ad_img = ad_img;
+        this.form = form;
+        this.jump_form = jump_form;
+        this.jump_type = jump_type;
+        this.jump_url = jump_url;
+        this.link_id = link_id;
+        this.link_type = link_type;
+        this.start_time = start_time;
+        this.end_time = end_time;
+        this.platform = platform;
+        this.status = status;
+        this.user_id = user_id;
+        this.user_name = user_name;
+        this.user_type = user_type;
+        this.create_time = create_time;
+        this.update_time = update_time;
+    }
+
+    @Generated(hash = 1653842457)
+    public SheepAd() {
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public long getAd_id() {
+        return ad_id;
+    }
+
+    public void setAd_id(long ad_id) {
+        this.ad_id = ad_id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAd_img() {
+        return ad_img;
+    }
+
+    public void setAd_img(String ad_img) {
+        this.ad_img = ad_img;
+    }
+
+    public int getForm() {
+        return form;
+    }
+
+    public void setForm(int form) {
+        this.form = form;
+    }
+
+    public int getJump_form() {
+        return jump_form;
+    }
+
+    public void setJump_form(int jump_form) {
+        this.jump_form = jump_form;
+    }
+
+    public int getJump_type() {
+        return jump_type;
+    }
+
+    public void setJump_type(int jump_type) {
+        this.jump_type = jump_type;
+    }
+
+    public String getJump_url() {
+        return jump_url;
+    }
+
+    public void setJump_url(String jump_url) {
+        this.jump_url = jump_url;
+    }
+
+    public long getLink_id() {
+        return link_id;
+    }
+
+    public void setLink_id(long link_id) {
+        this.link_id = link_id;
+    }
+
+    public int getLink_type() {
+        return link_type;
+    }
+
+    public void setLink_type(int link_type) {
+        this.link_type = link_type;
+    }
+
+    public long getStart_time() {
+        return start_time;
+    }
+
+    public void setStart_time(long start_time) {
+        this.start_time = start_time;
+    }
+
+    public long getEnd_time() {
+        return end_time;
+    }
+
+    public void setEnd_time(long end_time) {
+        this.end_time = end_time;
+    }
+
+    public int getPlatform() {
+        return platform;
+    }
+
+    public void setPlatform(int platform) {
+        this.platform = platform;
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public long getUser_id() {
+        return user_id;
+    }
+
+    public void setUser_id(long user_id) {
+        this.user_id = user_id;
+    }
+
+    public String getUser_name() {
+        return user_name;
+    }
+
+    public void setUser_name(String user_name) {
+        this.user_name = user_name;
+    }
+
+    public int getUser_type() {
+        return user_type;
+    }
+
+    public void setUser_type(int user_type) {
+        this.user_type = user_type;
+    }
+
+    public long getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(long create_time) {
+        this.create_time = create_time;
+    }
+
+    public long getUpdate_time() {
+        return update_time;
+    }
+
+    public void setUpdate_time(long update_time) {
+        this.update_time = update_time;
+    }
+
+    public boolean isImage(){
+        return true;
+    }
+
+    public long getShow_time(){
+        return 5;
+    }
+
+}

+ 253 - 0
app/src/main/java/com/sheep/gamegroup/greendao/download/SheepAdDao.java

@@ -0,0 +1,253 @@
+package com.sheep.gamegroup.greendao.download;
+
+import android.database.Cursor;
+import android.database.sqlite.SQLiteStatement;
+
+import org.greenrobot.greendao.AbstractDao;
+import org.greenrobot.greendao.Property;
+import org.greenrobot.greendao.internal.DaoConfig;
+import org.greenrobot.greendao.database.Database;
+import org.greenrobot.greendao.database.DatabaseStatement;
+
+// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
+/** 
+ * DAO for table "SHEEP_AD".
+*/
+public class SheepAdDao extends AbstractDao<SheepAd, Long> {
+
+    public static final String TABLENAME = "SHEEP_AD";
+
+    /**
+     * Properties of entity SheepAd.<br/>
+     * Can be used for QueryBuilder and for referencing column names.
+     */
+    public static class Properties {
+        public final static Property Id = new Property(0, Long.class, "id", true, "_id");
+        public final static Property Ad_id = new Property(1, long.class, "ad_id", false, "ad_id");
+        public final static Property Name = new Property(2, String.class, "name", false, "name");
+        public final static Property Ad_img = new Property(3, String.class, "ad_img", false, "ad_img");
+        public final static Property Form = new Property(4, int.class, "form", false, "form");
+        public final static Property Jump_form = new Property(5, int.class, "jump_form", false, "jump_form");
+        public final static Property Jump_type = new Property(6, int.class, "jump_type", false, "jump_type");
+        public final static Property Jump_url = new Property(7, String.class, "jump_url", false, "jump_url");
+        public final static Property Link_id = new Property(8, long.class, "link_id", false, "link_id");
+        public final static Property Link_type = new Property(9, int.class, "link_type", false, "link_type");
+        public final static Property Start_time = new Property(10, long.class, "start_time", false, "start_time");
+        public final static Property End_time = new Property(11, long.class, "end_time", false, "end_time");
+        public final static Property Platform = new Property(12, int.class, "platform", false, "platform");
+        public final static Property Status = new Property(13, int.class, "status", false, "status");
+        public final static Property User_id = new Property(14, long.class, "user_id", false, "user_id");
+        public final static Property User_name = new Property(15, String.class, "user_name", false, "user_name");
+        public final static Property User_type = new Property(16, int.class, "user_type", false, "user_type");
+        public final static Property Create_time = new Property(17, long.class, "create_time", false, "create_time");
+        public final static Property Update_time = new Property(18, long.class, "update_time", false, "update_time");
+    }
+
+
+    public SheepAdDao(DaoConfig config) {
+        super(config);
+    }
+    
+    public SheepAdDao(DaoConfig config, DaoSession daoSession) {
+        super(config, daoSession);
+    }
+
+    /** Creates the underlying database table. */
+    public static void createTable(Database db, boolean ifNotExists) {
+        String constraint = ifNotExists? "IF NOT EXISTS ": "";
+        db.execSQL("CREATE TABLE " + constraint + "\"SHEEP_AD\" (" + //
+                "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
+                "\"ad_id\" INTEGER NOT NULL ," + // 1: ad_id
+                "\"name\" TEXT," + // 2: name
+                "\"ad_img\" TEXT," + // 3: ad_img
+                "\"form\" INTEGER NOT NULL ," + // 4: form
+                "\"jump_form\" INTEGER NOT NULL ," + // 5: jump_form
+                "\"jump_type\" INTEGER NOT NULL ," + // 6: jump_type
+                "\"jump_url\" TEXT," + // 7: jump_url
+                "\"link_id\" INTEGER NOT NULL ," + // 8: link_id
+                "\"link_type\" INTEGER NOT NULL ," + // 9: link_type
+                "\"start_time\" INTEGER NOT NULL ," + // 10: start_time
+                "\"end_time\" INTEGER NOT NULL ," + // 11: end_time
+                "\"platform\" INTEGER NOT NULL ," + // 12: platform
+                "\"status\" INTEGER NOT NULL ," + // 13: status
+                "\"user_id\" INTEGER NOT NULL ," + // 14: user_id
+                "\"user_name\" TEXT," + // 15: user_name
+                "\"user_type\" INTEGER NOT NULL ," + // 16: user_type
+                "\"create_time\" INTEGER NOT NULL ," + // 17: create_time
+                "\"update_time\" INTEGER NOT NULL );"); // 18: update_time
+    }
+
+    /** Drops the underlying database table. */
+    public static void dropTable(Database db, boolean ifExists) {
+        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SHEEP_AD\"";
+        db.execSQL(sql);
+    }
+
+    @Override
+    protected final void bindValues(DatabaseStatement stmt, SheepAd entity) {
+        stmt.clearBindings();
+ 
+        Long id = entity.getId();
+        if (id != null) {
+            stmt.bindLong(1, id);
+        }
+        stmt.bindLong(2, entity.getAd_id());
+ 
+        String name = entity.getName();
+        if (name != null) {
+            stmt.bindString(3, name);
+        }
+ 
+        String ad_img = entity.getAd_img();
+        if (ad_img != null) {
+            stmt.bindString(4, ad_img);
+        }
+        stmt.bindLong(5, entity.getForm());
+        stmt.bindLong(6, entity.getJump_form());
+        stmt.bindLong(7, entity.getJump_type());
+ 
+        String jump_url = entity.getJump_url();
+        if (jump_url != null) {
+            stmt.bindString(8, jump_url);
+        }
+        stmt.bindLong(9, entity.getLink_id());
+        stmt.bindLong(10, entity.getLink_type());
+        stmt.bindLong(11, entity.getStart_time());
+        stmt.bindLong(12, entity.getEnd_time());
+        stmt.bindLong(13, entity.getPlatform());
+        stmt.bindLong(14, entity.getStatus());
+        stmt.bindLong(15, entity.getUser_id());
+ 
+        String user_name = entity.getUser_name();
+        if (user_name != null) {
+            stmt.bindString(16, user_name);
+        }
+        stmt.bindLong(17, entity.getUser_type());
+        stmt.bindLong(18, entity.getCreate_time());
+        stmt.bindLong(19, entity.getUpdate_time());
+    }
+
+    @Override
+    protected final void bindValues(SQLiteStatement stmt, SheepAd entity) {
+        stmt.clearBindings();
+ 
+        Long id = entity.getId();
+        if (id != null) {
+            stmt.bindLong(1, id);
+        }
+        stmt.bindLong(2, entity.getAd_id());
+ 
+        String name = entity.getName();
+        if (name != null) {
+            stmt.bindString(3, name);
+        }
+ 
+        String ad_img = entity.getAd_img();
+        if (ad_img != null) {
+            stmt.bindString(4, ad_img);
+        }
+        stmt.bindLong(5, entity.getForm());
+        stmt.bindLong(6, entity.getJump_form());
+        stmt.bindLong(7, entity.getJump_type());
+ 
+        String jump_url = entity.getJump_url();
+        if (jump_url != null) {
+            stmt.bindString(8, jump_url);
+        }
+        stmt.bindLong(9, entity.getLink_id());
+        stmt.bindLong(10, entity.getLink_type());
+        stmt.bindLong(11, entity.getStart_time());
+        stmt.bindLong(12, entity.getEnd_time());
+        stmt.bindLong(13, entity.getPlatform());
+        stmt.bindLong(14, entity.getStatus());
+        stmt.bindLong(15, entity.getUser_id());
+ 
+        String user_name = entity.getUser_name();
+        if (user_name != null) {
+            stmt.bindString(16, user_name);
+        }
+        stmt.bindLong(17, entity.getUser_type());
+        stmt.bindLong(18, entity.getCreate_time());
+        stmt.bindLong(19, entity.getUpdate_time());
+    }
+
+    @Override
+    public Long readKey(Cursor cursor, int offset) {
+        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
+    }    
+
+    @Override
+    public SheepAd readEntity(Cursor cursor, int offset) {
+        SheepAd entity = new SheepAd( //
+            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
+            cursor.getLong(offset + 1), // ad_id
+            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // name
+            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // ad_img
+            cursor.getInt(offset + 4), // form
+            cursor.getInt(offset + 5), // jump_form
+            cursor.getInt(offset + 6), // jump_type
+            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // jump_url
+            cursor.getLong(offset + 8), // link_id
+            cursor.getInt(offset + 9), // link_type
+            cursor.getLong(offset + 10), // start_time
+            cursor.getLong(offset + 11), // end_time
+            cursor.getInt(offset + 12), // platform
+            cursor.getInt(offset + 13), // status
+            cursor.getLong(offset + 14), // user_id
+            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // user_name
+            cursor.getInt(offset + 16), // user_type
+            cursor.getLong(offset + 17), // create_time
+            cursor.getLong(offset + 18) // update_time
+        );
+        return entity;
+    }
+     
+    @Override
+    public void readEntity(Cursor cursor, SheepAd entity, int offset) {
+        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
+        entity.setAd_id(cursor.getLong(offset + 1));
+        entity.setName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
+        entity.setAd_img(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
+        entity.setForm(cursor.getInt(offset + 4));
+        entity.setJump_form(cursor.getInt(offset + 5));
+        entity.setJump_type(cursor.getInt(offset + 6));
+        entity.setJump_url(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
+        entity.setLink_id(cursor.getLong(offset + 8));
+        entity.setLink_type(cursor.getInt(offset + 9));
+        entity.setStart_time(cursor.getLong(offset + 10));
+        entity.setEnd_time(cursor.getLong(offset + 11));
+        entity.setPlatform(cursor.getInt(offset + 12));
+        entity.setStatus(cursor.getInt(offset + 13));
+        entity.setUser_id(cursor.getLong(offset + 14));
+        entity.setUser_name(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
+        entity.setUser_type(cursor.getInt(offset + 16));
+        entity.setCreate_time(cursor.getLong(offset + 17));
+        entity.setUpdate_time(cursor.getLong(offset + 18));
+     }
+    
+    @Override
+    protected final Long updateKeyAfterInsert(SheepAd entity, long rowId) {
+        entity.setId(rowId);
+        return rowId;
+    }
+    
+    @Override
+    public Long getKey(SheepAd entity) {
+        if(entity != null) {
+            return entity.getId();
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public boolean hasKey(SheepAd entity) {
+        return entity.getId() != null;
+    }
+
+    @Override
+    protected final boolean isEntityUpdateable() {
+        return true;
+    }
+    
+}

+ 11 - 0
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -11,6 +11,8 @@ import org.afinal.simplecache.ApiKey;
 
 import java.util.Map;
 
+import javax.annotation.PostConstruct;
+
 import io.reactivex.Observable;
 import retrofit2.Call;
 import retrofit2.http.Body;
@@ -1977,4 +1979,13 @@ public interface ApiService {
     @GET("app/shop/recommends")
     Observable<BaseMessage> getShopRecommends(@Query("size") int size);
 
+    @GET("app/advertising_v2")
+    Observable<BaseMessage> getAds();
+
+    @GET("app/advertising_v2")
+    Observable<BaseMessage> getAds(@Query("form") int form);
+
+    @POST("app/advertising_v2/create/statistics")
+    Observable<BaseMessage> statAdAction(@Body JSONObject json);
+
 }

+ 94 - 43
app/src/main/java/com/sheep/gamegroup/model/entity/Article.java

@@ -3,6 +3,7 @@ package com.sheep.gamegroup.model.entity;
 import android.text.TextUtils;
 
 import com.alibaba.fastjson.annotation.JSONField;
+import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.util.ListUtil;
 
 import java.util.List;
@@ -10,12 +11,11 @@ import java.util.List;
 /**
  * Created by realicing on 2018/6/27.
  * realicing@sina.com
- *
  */
 public class Article {
     private int updated_at;
 
-    private List<ArticleTag> tages ;
+    private List<ArticleTag> tages;
 
     private int recommend_type;//咨询类型1:游戏 2:任务
 
@@ -39,7 +39,7 @@ public class Article {
 
     private int release_task_id;//发布的任务ID (咨询和任务时)
 
-    @JSONField(name ="abstract")
+    @JSONField(name = "abstract")
     private String des;//摘要
 
     private int created_at;
@@ -50,7 +50,7 @@ public class Article {
 
     private int sort;//排序
 
-    private int type;//类型 1:游戏 2:咨询 3:转跳 4:任务 5:栏目
+    private int type;//类型 1:游戏 2:咨询 3:转跳 4:任务 5:栏目, -1:广告
 
     private Applications application;
 
@@ -59,118 +59,157 @@ public class Article {
     private int display_menu;
     private int game_articles_type;
 
-    public void setUpdated_at(int updated_at){
+    private Object memo;
+
+    public void setUpdated_at(int updated_at) {
         this.updated_at = updated_at;
     }
-    public int getUpdated_at(){
+
+    public int getUpdated_at() {
         return this.updated_at;
     }
-    public void setTages(List<ArticleTag> tages){
+
+    public void setTages(List<ArticleTag> tages) {
         this.tages = tages;
     }
-    public List<ArticleTag> getTages(){
+
+    public List<ArticleTag> getTages() {
         return this.tages;
     }
-    public void setRecommend_type(int recommend_type){
+
+    public void setRecommend_type(int recommend_type) {
         this.recommend_type = recommend_type;
     }
-    public int getRecommend_type(){
+
+    public int getRecommend_type() {
         return this.recommend_type;
     }
-    public void setUrl(String url){
+
+    public void setUrl(String url) {
         this.url = url;
     }
-    public String getUrl(){
+
+    public String getUrl() {
         return this.url;
     }
-    public void setContent(String content){
+
+    public void setContent(String content) {
         this.content = content;
     }
-    public String getContent(){
+
+    public String getContent() {
         return this.content;
     }
-    public void setPictures(String pictures){
+
+    public void setPictures(String pictures) {
         this.pictures = pictures;
     }
-    public String getPictures(){
+
+    public String getPictures() {
         return this.pictures;
     }
-    public void setPlatform(int platform){
+
+    public void setPlatform(int platform) {
         this.platform = platform;
     }
-    public int getPlatform(){
+
+    public int getPlatform() {
         return this.platform;
     }
-    public void setIs_display(int is_display){
+
+    public void setIs_display(int is_display) {
         this.is_display = is_display;
     }
-    public int getIs_display(){
+
+    public int getIs_display() {
         return this.is_display;
     }
-    public void setHome_list_id(int home_list_id){
+
+    public void setHome_list_id(int home_list_id) {
         this.home_list_id = home_list_id;
     }
-    public int getHome_list_id(){
+
+    public int getHome_list_id() {
         return this.home_list_id;
     }
-    public void setTitle(String title){
+
+    public void setTitle(String title) {
         this.title = title;
     }
-    public String getTitle(){
+
+    public String getTitle() {
         return this.title;
     }
-    public void setId(int id){
+
+    public void setId(int id) {
         this.id = id;
     }
-    public int getId(){
+
+    public int getId() {
         return this.id;
     }
-    public void setIs_in_url(int is_in_url){
+
+    public void setIs_in_url(int is_in_url) {
         this.is_in_url = is_in_url;
     }
-    public int getIs_in_url(){
+
+    public int getIs_in_url() {
         return this.is_in_url;
     }
-    public void setRelease_task_id(int release_task_id){
+
+    public void setRelease_task_id(int release_task_id) {
         this.release_task_id = release_task_id;
     }
-    public int getRelease_task_id(){
+
+    public int getRelease_task_id() {
         return this.release_task_id;
     }
-    public void setDes(String des){
+
+    public void setDes(String des) {
         this.des = des;
     }
-    public String getDes(){
+
+    public String getDes() {
         return this.des;
     }
-    public void setCreated_at(int created_at){
+
+    public void setCreated_at(int created_at) {
         this.created_at = created_at;
     }
-    public int getCreated_at(){
+
+    public int getCreated_at() {
         return this.created_at;
     }
-    public void setApplication_id(int application_id){
+
+    public void setApplication_id(int application_id) {
         this.application_id = application_id;
     }
-    public int getApplication_id(){
+
+    public int getApplication_id() {
         return this.application_id;
     }
-    public void setClicks(String clicks){
+
+    public void setClicks(String clicks) {
         this.clicks = clicks;
     }
-    public String getClicks(){
+
+    public String getClicks() {
         return this.clicks;
     }
-    public void setSort(int sort){
+
+    public void setSort(int sort) {
         this.sort = sort;
     }
-    public int getSort(){
+
+    public int getSort() {
         return this.sort;
     }
-    public void setType(int type){
+
+    public void setType(int type) {
         this.type = type;
     }
-    public int getType(){
+
+    public int getType() {
         return this.type;
     }
 
@@ -195,7 +234,7 @@ public class Article {
 
     //清除空的或者没有名字的标签
     public void removeNullTag() {
-        ListUtil.removeItem(tages, new ListUtil.CallBack<ArticleTag, Boolean>(){
+        ListUtil.removeItem(tages, new ListUtil.CallBack<ArticleTag, Boolean>() {
 
             @Override
             public Boolean call(ArticleTag findTag) {
@@ -235,4 +274,16 @@ public class Article {
     public void setGame_articles_type(int game_articles_type) {
         this.game_articles_type = game_articles_type;
     }
+
+    public <T> T getMemo(Class<T> t) {
+        return (T) memo;
+    }
+
+    public Article convertFrom(SheepAd ad) {
+        type = -1;
+        title = ad.getName();
+        pictures = ad.getAd_img();
+        memo = ad;
+        return this;
+    }
 }

+ 19 - 7
app/src/main/java/com/sheep/gamegroup/module/game/fragment/FgtGameCenter.java

@@ -9,8 +9,11 @@ import android.support.v4.view.ViewPager;
 import android.view.View;
 import android.widget.ImageView;
 
+import com.bumptech.glide.Glide;
 import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.event.WebViewEvent;
+import com.sheep.gamegroup.greendao.DDProviderHelper;
+import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.model.entity.ArticleTag;
 import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.module.guide.NewbieGuideHelper;
@@ -20,6 +23,7 @@ import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.view.activity.ActMain;
+import com.sheep.gamegroup.view.activity.helper.AdHelper;
 import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
 import com.sheep.gamegroup.view.fragment.FgtFindChild;
 import com.sheep.jiuyan.samllsheep.Config;
@@ -60,7 +64,9 @@ public class FgtGameCenter extends BaseFragment {
     @BindView(R.id.fgt_gc_hb_500_yuan_iv)
     ImageView fgt_gc_hb_500_yuan_iv;
 
-    public static View getTab(int i){
+    private SheepAd floatAd;
+
+    public static View getTab(int i) {
         return gameRef.get().getTabAt(i).view;
     }
 
@@ -85,6 +91,14 @@ public class FgtGameCenter extends BaseFragment {
     public void onViewCreated() {
         initView();
         gameRef = new WeakReference<>(indicator);
+        floatAd = DDProviderHelper.getInstance().getSheepAd(SheepAd.FORM_GAME_FLOAT);
+        if (floatAd != null) {
+            ViewUtil.setVisibility(fgt_gc_hb_500_yuan_drl, true);
+            Glide.with(getContext()).load(floatAd.getAd_img()).into(fgt_gc_hb_500_yuan_iv);
+            AdHelper.stat(floatAd.getAd_id(), 1);
+        } else {
+            ViewUtil.setVisibility(fgt_gc_hb_500_yuan_drl, false);
+        }
     }
 
     private void initView() {
@@ -132,9 +146,6 @@ public class FgtGameCenter extends BaseFragment {
         });
     }
 
-    private void initData() {
-    }
-
     @Override
     public void initDataOnVisibleToUser() {
         if (gameMallFgt != null && pager.getCurrentItem() == 3) {
@@ -151,7 +162,8 @@ public class FgtGameCenter extends BaseFragment {
     public void goGet500YuanHb(View v) {
 //        Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(),
 //                new WebParams(Config.getUrlByPath(Config.PATH_SMALL_SHEEP_RED_PACKAGE)).setTitle("礼包中心"));
-        Jump2View.getInstance().goGiftCenter(getActivity());
+//        Jump2View.getInstance().goGiftCenter(getActivity());
+        AdHelper.goAdLink(getActivity(), floatAd);
     }
 
     @Subscribe
@@ -178,8 +190,8 @@ public class FgtGameCenter extends BaseFragment {
     private Handler mHandler = new Handler() {
         public void handleMessage(Message msg) {
             if (msg.what == WHAT_TRY_SWITCH_MAIN_TAB) {
-                ((ActMain)getActivity()).switchFragment(2);
-            } else if(msg.what == WHAT_TRY_SHOW_NEWBIE_GUIDE) {
+                ((ActMain) getActivity()).switchFragment(2);
+            } else if (msg.what == WHAT_TRY_SHOW_NEWBIE_GUIDE) {
                 new NewbieGuideHelper(getActivity()).show(NewbieGuideHelper.GUIDE_GAME);
             }
         }

+ 14 - 0
app/src/main/java/com/sheep/gamegroup/module/task/fragments/FgtVideoTaskBase.java

@@ -167,6 +167,20 @@ public abstract class FgtVideoTaskBase extends BaseFragment {
         });
     }
 
+    protected void handleNext(){
+        watchCount++;
+        if (watchCount >= releaseTask.getTask().getVideo_num()) {
+            commitAutoTask();
+        } else {
+            ViewUtil.showConfirmDialog(getContext(),
+                    "提示",
+                    "你需要观看" + (releaseTask.getTask().getVideo_num() - watchCount) + "个视频, 即可获得" + releaseTask.getBonusText() + "元",
+                    "放弃", "继续观看",
+                    d -> giveUpTask(),
+                    d -> loadAd()).show();
+        }
+    }
+
     @Override
     public void onViewCreated(){
         initView();

+ 7 - 2
app/src/main/java/com/sheep/gamegroup/module/task/fragments/FgtVideoTaskDK.java

@@ -17,7 +17,12 @@ public class FgtVideoTaskDK extends FgtVideoTaskBase implements DkAppDownloadLis
 
     @Override
     protected void initData() {
-        loadAd();
+        if (releaseTask.getAccepted_task_id() > 0) {
+            loadAcceptedTask();
+        } else {
+            LogUtil.logI("---------------没有接受任务---------------");
+            acceptTask();
+        }
     }
 
     @Override
@@ -42,7 +47,7 @@ public class FgtVideoTaskDK extends FgtVideoTaskBase implements DkAppDownloadLis
 
     @Override
     public void onClosed(String s, boolean b, String s1, String s2) {
-        LogUtil.logI("Video task onClosed(" + s + ", " + b + ", " + s1 + ", " + s2 + ")");
+        handleNext();
     }
 
     @Override

+ 1 - 11
app/src/main/java/com/sheep/gamegroup/module/task/fragments/FgtVideoTaskZK.java

@@ -193,17 +193,7 @@ public class FgtVideoTaskZK extends FgtVideoTaskBase {
                     public void onAutoComplete(String url, Object... objects) {
                         super.onAutoComplete(url, objects);
                         currentVideoAd.trigger(VideoAd.TYPE_VIDEO_END);
-                        watchCount++;
-                        if (watchCount >= releaseTask.getTask().getVideo_num()) {
-                            commitAutoTask();
-                        } else {
-                            ViewUtil.showConfirmDialog(getContext(),
-                                    "提示",
-                                    "你需要观看" + (releaseTask.getTask().getVideo_num() - watchCount) + "个视频, 即可获得" + releaseTask.getBonusText() + "元",
-                                    "放弃", "继续观看",
-                                    d -> giveUpTask(),
-                                    d -> loadAd()).show();
-                        }
+                        handleNext();
                     }
 
                     @Override

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

@@ -20,7 +20,6 @@ public interface SmallSheepContract {
 
         void  homeList();
 
-        void  slideshow(Object o);
         void  bulletin(Object o);
     }
 
@@ -30,8 +29,6 @@ public interface SmallSheepContract {
         void failData2View(Object o);
         void  showMore( List<MoreDataEntity> loginEty);
 
-        void failSlideshow(BaseMessage baseMessage);
-        void successSlideshow(BaseMessage baseMessage);
         void failbulletin(BaseMessage baseMessage);
         void successbulletin(BaseMessage baseMessage);
 

+ 0 - 17
app/src/main/java/com/sheep/gamegroup/presenter/SmallSheepPresenter.java

@@ -103,23 +103,6 @@ public class SmallSheepPresenter implements SmallSheepContract.Persenter {
     }
 
     @Override
-    public void slideshow(Object o) {
-        apiService.slideshow(1)
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                        view.failSlideshow(baseMessage);
-                    }
-
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        view.successSlideshow(baseMessage);
-                    }
-                });
-    }
-    @Override
     public void bulletin(Object o) {
         apiService.bulletin(1,10)
                 .subscribeOn(Schedulers.io())

+ 117 - 12
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -46,6 +46,7 @@ import com.sheep.gamegroup.event.ValueCallback;
 import com.sheep.gamegroup.greendao.DDProviderHelper;
 import com.sheep.gamegroup.greendao.download.AcceptTaskRecord;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
+import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.helper.TaskHelper;
 import com.sheep.gamegroup.model.entity.Applications;
 import com.sheep.gamegroup.model.entity.BaseMessage;
@@ -77,6 +78,7 @@ import com.sheep.gamegroup.util.viewHelper.PopupWindowUtil;
 import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.activity.ActWebX5YF;
 import com.sheep.gamegroup.view.activity.GameTaskOrderListAct;
+import com.sheep.gamegroup.view.activity.helper.AdHelper;
 import com.sheep.gamegroup.view.dialog.DialogNewbieTaskList;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.Config;
@@ -125,6 +127,7 @@ import io.reactivex.schedulers.Schedulers;
 import io.reactivex.subjects.Subject;
 import okhttp3.Call;
 import rx.functions.Action1;
+import rx.functions.Action2;
 
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.NEWBIE_TASK;
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.RECEIVE_AWARD_GAME_TASK;
@@ -2324,6 +2327,53 @@ public class CommonUtil {
                 });
     }
 
+    public void refreshAds(Action2<Boolean, List<SheepAd>> action) {
+        refreshAds(0, action);
+    }
+
+    public void refreshAds(int form, Action2<Boolean, List<SheepAd>> action) {
+        Observable<BaseMessage> observable;
+        if (form > 0) {
+            observable = SheepApp.getInstance().getNetComponent().getApiService().getAds(form);
+        } else {
+            observable = SheepApp.getInstance().getNetComponent().getApiService().getAds();
+        }
+        observable.subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        try {
+                            List<SheepAd> ads = baseMessage.getDatas(SheepAd.class);
+                            if (ads != null && ads.size() > 0) {
+                                if (form > 0) {
+                                    DDProviderHelper.getInstance().deleteSheepAd(form);
+                                } else {
+                                    DDProviderHelper.getInstance().clearSheepAd();
+                                }
+                                for (SheepAd ad : ads) {
+                                    ad.setAd_id(ad.getId());
+                                    ad.setId(null);
+                                    DDProviderHelper.getInstance().saveSheepAd(ad);
+                                }
+                            }
+                            if (action != null)
+                                action.call(true, ads);
+                        } catch (Exception e) {
+                            if (action != null)
+                                action.call(false, null);
+                        }
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+
+                        if (action != null)
+                            action.call(false, null);
+                    }
+                });
+    }
+
     /**
      * 任务审核
      */
@@ -2476,10 +2526,10 @@ public class CommonUtil {
         UMConfigUtils.IdEvent.BANNER.commit(id);
         Ext ext;
         switch (type) {// 0,类型 1跳转试玩赚钱、2单个任务详情、3信用卡办理、4 H5页面、5 微信二维码任务
-            case 1:
+            case 1: // 跳转试玩赚钱
                 Jump2View.getInstance().goTryplayView(activity, null);
                 break;
-            case 2:
+            case 2: // 单个任务详情
                 ext = EntityUtils.getExtInfo(extString);
                 if (ext == null) {
                     G.showToast(R.string.error_data);
@@ -2487,11 +2537,11 @@ public class CommonUtil {
                 }
                 Jump2View.getInstance().goTaskById(ext.getId());
                 break;
-            case 3:
+            case 3: // 信用卡办理
                 Jump2View.getInstance()
                         .goCreditCardTaskList(activity, 3);
                 break;
-            case 4:
+            case 4: // H5页面
                 ext = EntityUtils.getExtInfo(extString);
                 if (ext == null) {
                     G.showToast(R.string.error_data);
@@ -2502,7 +2552,7 @@ public class CommonUtil {
                 else//内部WebView加载H5
                     Jump2View.getInstance().goWeb(activity, ext.getUrl(), ext.getTitle());
                 break;
-            case 5:
+            case 5: // 微信二维码任务
                 ext = EntityUtils.getExtInfo(extString);
                 if (ext == null || ext.getUrl() == null) {
                     G.showToast(R.string.error_data);
@@ -2511,19 +2561,19 @@ public class CommonUtil {
                 Jump2View.getInstance().goWeb(activity, ext.getUrl(), "微信二维码辅助好友注册");
 
                 break;
-            case 6://连续任务
+            case 6: // 连续任务
                 Jump2View.getInstance().goSequentialTaskView(activity);
                 break;
-            case 9://打卡赚钱
-                Jump2View.getInstance().goSignCardAct(activity, null);
-                break;
-            case 7://玩转游戏
+            case 7: // 玩转游戏
                 Jump2View.getInstance().goMainGame(activity);
                 break;
-            case 11://游戏任务
+            case 9: // 打卡赚钱
+                Jump2View.getInstance().goSignCardAct(activity, null);
+                break;
+            case 11:    // 游戏任务
                 Jump2View.getInstance().goGameMakeMoney(activity, 0);
                 break;
-            case 12://闲玩任务
+            case 12:    // 闲玩任务
                 Jump2View.getInstance().goXianWanWeb(activity, null);
                 break;
             case 13://游戏代充
@@ -2577,6 +2627,61 @@ public class CommonUtil {
         }
     }
 
+    public void clickAd(Context activity, long id, int type, long linkId) {
+        AdHelper.stat(id, 2);
+        switch (type) {// 0,类型 1跳转试玩赚钱、2单个任务详情、3信用卡办理、4 H5页面、5 微信二维码任务
+            case 1: // 跳转试玩赚钱
+                Jump2View.getInstance().goTryplayView(activity, null);
+                break;
+            case 2: // 单个任务详情
+                Jump2View.getInstance().goTaskById((int) linkId);
+                break;
+            case 3: // 信用卡办理
+                Jump2View.getInstance()
+                        .goCreditCardTaskList(activity, 3);
+                break;
+            case 6: // 连续任务
+                Jump2View.getInstance().goSequentialTaskView(activity);
+                break;
+            case 7: // 玩转游戏
+                Jump2View.getInstance().goMainGame(activity);
+                break;
+            case 9: // 打卡赚钱
+                Jump2View.getInstance().goSignCardAct(activity, null);
+                break;
+            case 11:    // 游戏任务
+                Jump2View.getInstance().goGameMakeMoney(activity, 0);
+                break;
+            case 12:    // 闲玩任务
+                Jump2View.getInstance().goXianWanWeb(activity, null);
+                break;
+            case 13://游戏代充
+                Jump2View.getInstance().goGameRecharge(activity, null);
+                break;
+            case 14://幂动科技
+                Jump2View.getInstance().goMiDong(activity, null);
+                break;
+            case 15://小米游戏列表
+                Jump2View.getInstance().goXiaomiGameList(activity, null);
+                break;
+            case JUMP_GMAE://游戏详情
+                Jump2View.getInstance().goPlayGameDetail((int) linkId);
+                break;
+            case JUMP_FIND_RECOMMEND://发现--推荐
+            case JUMP_FIND_ACT://发现--活动
+            case JUMP_FIND_INFORMATION://webView资讯
+            case JUMP_FIND_GMAE://发现中的游戏详情
+                Jump2View.getInstance().goFindItem(activity, (int) linkId);
+                break;
+            case JUMP_WATCH_FOCUS://看点
+                Jump2View.getInstance().goWatchFocus(activity, (int) linkId);
+                break;
+            default:
+                G.showToast(R.string.coming_soon);
+                break;
+        }
+    }
+
     /**
      * tag 标签绘制
      * R.drawable.shape_blue_stroke_rectangle_no_lb

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

@@ -20,6 +20,7 @@ import com.sheep.gamegroup.event.EventTypes;
 import com.sheep.gamegroup.greendao.DDProviderHelper;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.greendao.download.SdkLoginUser;
+import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.model.entity.Advertising;
 import com.sheep.gamegroup.model.entity.Agreement;
 import com.sheep.gamegroup.model.entity.Applications;
@@ -1753,22 +1754,13 @@ public class Jump2View {
                                     }
                                 }
                                 //显示弹窗广告
-                                SheepApp.getInstance().getNetComponent().getApiService().getAdvertising(2)
-                                        .subscribeOn(Schedulers.io())
-                                        .observeOn(AndroidSchedulers.mainThread())
-                                        .subscribe(new SheepSubscriber<BaseMessage>(activity) {
-                                            @Override
-                                            public void onNext(BaseMessage baseMessage) {
-                                                Advertising advertising = baseMessage.getData(Advertising.class);
-                                                ViewUtil.showHalfScreenAd(activity, advertising, container);
-                                            }
-
-                                            @Override
-                                            public void onError(BaseMessage baseMessage) {
-                                                EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.GUIDE_NEXT));
-                                                tryShowYfShopAskDialog(activity);
-                                            }
-                                        });
+                                SheepAd ad = DDProviderHelper.getInstance().getSheepAd(SheepAd.FORM_POP);
+                                if(ad!=null){
+                                    ViewUtil.showHalfScreenAd(activity, ad, container);
+                                } else{
+                                    EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.GUIDE_NEXT));
+                                    tryShowYfShopAskDialog(activity);
+                                }
                             }
                         }));
     }

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/util/SysAppUtil.java

@@ -1152,4 +1152,13 @@ public class SysAppUtil {
                 enable ?  PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                 PackageManager.DONT_KILL_APP);
     }
+
+    public static boolean isNotSupport(Context context) {
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+            ViewUtil.showMsgDialog(context, new DialogConfig().setMsg("尊敬的羊羊用户,智能绵羊管家检测到你系统版本过低,已为你推荐了优质通道,是否立即前往?")
+                    .setBtnLeftText("知道了").setBtnRightText("前往").setBtnRightOnClickListener(view -> Jump2View.getInstance().goWeb(context, "http://shop.17xmy.com/mobile/category.php?id=144")));
+            return true;
+        }
+        return false;
+    }
 }

+ 11 - 12
app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java

@@ -75,6 +75,7 @@ import com.sheep.gamegroup.dateview.DatePickerDialog;
 import com.sheep.gamegroup.dateview.DateUtil;
 import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.event.EventTypes;
+import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.model.entity.Advertising;
 import com.sheep.gamegroup.model.entity.Applications;
 import com.sheep.gamegroup.model.entity.BaseMessage;
@@ -88,7 +89,6 @@ import com.sheep.gamegroup.model.entity.PayEntity;
 import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
-import com.sheep.gamegroup.module.guide.NewbieGuideHelper;
 import com.sheep.gamegroup.module.skin.util.SkinUtil;
 import com.sheep.gamegroup.module.yf_shop.model.ReceiveCouponsCheckResq;
 import com.sheep.gamegroup.module.yf_shop.model.ReceiveCouponsResp;
@@ -98,9 +98,8 @@ import com.sheep.gamegroup.util.string.SpannableSb;
 import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
 import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.activity.PersonalInfoAct;
-import com.sheep.gamegroup.view.activity.SplashAct;
 import com.sheep.gamegroup.view.activity.TaskDetailAct;
-import com.sheep.gamegroup.view.activity.helper.SplashHelper;
+import com.sheep.gamegroup.view.activity.helper.AdHelper;
 import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
 import com.sheep.gamegroup.view.dialog.DialogAddAccount;
 import com.sheep.gamegroup.view.dialog.DialogLoading;
@@ -1691,7 +1690,7 @@ public class ViewUtil {
 
 
     //展示弹窗广告
-    public static void showHalfScreenAd(final Activity activity, final Advertising advertising, Container<Action1<Integer>> container) {
+    public static void showHalfScreenAd(final Activity activity, final SheepAd advertising, Container<Action1<Integer>> container) {
         if (activity != null) {
             View dialog_parent = View.inflate(activity, R.layout.dialog_parent, null);
             final AlertDialog dialog = new AlertDialog.Builder(activity, R.style.MyDialogActivityTheme)
@@ -1704,7 +1703,7 @@ public class ViewUtil {
             setText(dialog_title, advertising.getName());
 
             ACache aCache = ACache.get(SheepApp.getInstance());
-            String wh = aCache.getAsString(advertising.getDisplay_src());
+            String wh = aCache.getAsString(advertising.getAd_img());
             if (!TextUtils.isEmpty(wh) && wh.contains(";")) {
                 String[] items = wh.split(";");
                 dialog_center_ll.setMinimumWidth(Integer.parseInt(items[0]));
@@ -1722,8 +1721,8 @@ public class ViewUtil {
 //            holder.setFixedSize(ad_video_view.getWidth(), ad_video_view.getWidth()*3/4);
 //            ad_video_view.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,G.WIDTH*4/7));
             if (advertising.isImage()) {
-                RequestBuilder<Drawable> builder = Glide.with(activity).load(advertising.getDisplay_src());
-                if (TextUtils.isEmpty(advertising.getDesc())) {//没有标题时 去掉下面的边距 并给图片左下理右下添加图角
+                RequestBuilder<Drawable> builder = Glide.with(activity).load(advertising.getAd_img());
+                if (TextUtils.isEmpty(advertising.getName())) {//没有标题时 去掉下面的边距 并给图片左下理右下添加图角
                     builder.apply(new RequestOptions().transform(new RoundedCornersTransformation(activity.getResources().getDimensionPixelSize(R.dimen.content_padding_36), 0, RoundedCornersTransformation.CornerType.BOTTOM)));
                     dialog_center_ll.setPadding(0, activity.getResources().getDimensionPixelSize(R.dimen.content_padding_54), 0, 0);
                     ViewGroup parent = (ViewGroup) dialog_center_ll.getParent();
@@ -1738,7 +1737,7 @@ public class ViewUtil {
                 builder.into(ad_iv);
                 ad_video_view.setVisibility(View.GONE);
             } else {
-                Uri uri = Uri.parse(advertising.getDisplay_src());
+                Uri uri = Uri.parse(advertising.getAd_img());
                 ad_iv.setVisibility(View.GONE);
                 final VideoView videoView = ad_video_view;
                 videoView.setOnInfoListener(new MediaPlayer.OnInfoListener() {
@@ -1804,7 +1803,7 @@ public class ViewUtil {
             dialog_rl.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View view) {
-                    SplashHelper.goAdLink(activity, advertising);
+                    AdHelper.goAdLink(activity, advertising);
                     AD_TOAST.onEvent("ad_id", advertising.getId());
                     dialog.dismiss();
                 }
@@ -1816,19 +1815,19 @@ public class ViewUtil {
 //                        finalTimer.clear();
 //                    }
                     ACache aCache = ACache.get(SheepApp.getInstance());
-                    aCache.put(advertising.getDisplay_src(), String.format(Locale.CHINA, "%d;%d", dialog_center_ll.getWidth(), dialog_center_ll.getHeight()));
+                    aCache.put(advertising.getAd_img(), String.format(Locale.CHINA, "%d;%d", dialog_center_ll.getWidth(), dialog_center_ll.getHeight()));
                     Jump2View.getInstance().tryShowYfShopAskDialog(activity);
                     EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.GUIDE_NEXT));
                 }
             });
-            if (TextUtils.isEmpty(advertising.getDesc())) {
+            if (TextUtils.isEmpty(advertising.getName())) {
                 ViewUtil.setVisibility(ad_msg, false);
                 //3.4.7添加 -- 不显示标题栏,不显示背景 start
                 ViewUtil.setVisibility(dialog_title, false);
                 dialog_center_ll.setBackgroundColor(Color.TRANSPARENT);
                 //3.4.7添加 -- 不显示标题栏,不显示背景 end
             } else {
-                ad_msg.setText(advertising.getDesc());
+                ad_msg.setText(advertising.getName());
             }
             try {
                 dialog.show();

+ 19 - 0
app/src/main/java/com/sheep/gamegroup/util/js/KFZSJs.java

@@ -20,6 +20,8 @@ import com.alibaba.fastjson.JSONObject;
 import com.sheep.gamegroup.absBase.AbsObserver;
 import com.sheep.gamegroup.event.WXLoginAuthEvent;
 import com.sheep.gamegroup.event.WebViewEvent;
+import com.sheep.gamegroup.greendao.DDProviderHelper;
+import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.model.api.IWeb;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DialogConfig;
@@ -57,6 +59,7 @@ import com.sheep.gamegroup.view.activity.ActInvitation;
 import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.activity.ChangeWxOrTelAct;
 import com.sheep.gamegroup.view.activity.RealNameAuthenAct;
+import com.sheep.gamegroup.view.activity.helper.AdHelper;
 import com.sheep.jiuyan.samllsheep.Config;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -217,6 +220,22 @@ public class KFZSJs {
     }
 
     @JavascriptInterface
+    public String getSheepAds(int type) {
+        return JSONObject.toJSONString(DDProviderHelper.getInstance().listSheepAd(type));
+    }
+
+    @JavascriptInterface
+    public void clickSheepAd(String json){
+        SheepAd ad = JSONObject.parseObject(json, SheepAd.class);
+        AdHelper.goAdLink(activity, ad);
+    }
+
+    @JavascriptInterface
+    public void statSheepAd(String ids){
+        AdHelper.stat(ids, 1);
+    }
+
+    @JavascriptInterface
     public String popShare(String url, String type) {
         shareLink(url, null, null, null, type);
         return "";

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

@@ -19,6 +19,7 @@ import android.widget.RelativeLayout;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.airbnb.lottie.LottieAnimationView;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.kfzs.duanduan.cardview.ScreenUtil;
@@ -179,6 +180,15 @@ public class ActMain extends BaseActYmPermissionCheck {
         tabBtn1 = new WeakReference<>(findViewById(R.id.tab_1));
         tabBtn2 = new WeakReference<>(findViewById(R.id.tab_3));
         frame_container.setHookView(main_header);
+
+//        final LottieAnimationView animView = findViewById(R.id.test_anim_view);
+//        animView.setOnClickListener(v->{
+//            if(animView.isAnimating()){
+//                animView.cancelAnimation();
+//            } else {
+//                animView.playAnimation();
+//            }
+//        });
     }
 
     @Override

+ 55 - 42
app/src/main/java/com/sheep/gamegroup/view/activity/SplashAct.java

@@ -1,5 +1,7 @@
 package com.sheep.gamegroup.view.activity;
 
+import android.Manifest;
+import android.content.pm.PackageManager;
 import android.media.MediaPlayer;
 import android.net.Uri;
 import android.os.Bundle;
@@ -8,6 +10,8 @@ import android.os.Looper;
 import android.os.Message;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
 import android.text.TextUtils;
 import android.view.View;
 import android.widget.ImageView;
@@ -16,11 +20,13 @@ import android.widget.VideoView;
 
 import com.bumptech.glide.Glide;
 import com.sheep.gamegroup.absBase.BaseActivity;
-import com.sheep.gamegroup.model.entity.Advertising;
+import com.sheep.gamegroup.greendao.DDProviderHelper;
+import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.module.skin.util.SkinUtil;
 import com.sheep.gamegroup.util.ApiJSONUtil;
+import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.LogUtil;
@@ -28,20 +34,19 @@ import com.sheep.gamegroup.util.RxjavaCountDownTimer;
 import com.sheep.gamegroup.util.SysAppUtil;
 import com.sheep.gamegroup.util.TestUtil;
 import com.sheep.gamegroup.util.ViewUtil;
-import com.sheep.gamegroup.view.activity.helper.SplashHelper;
+import com.sheep.gamegroup.view.activity.helper.AdHelper;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 
-import org.afinal.simplecache.ApiKey;
+import java.util.ArrayList;
+import java.util.List;
 
 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.AD_SPLASH;
-
 /**
  * Created by ljy on 2018/3/9.
  */
@@ -63,7 +68,7 @@ public class SplashAct extends BaseActivity {
 
     private RxjavaCountDownTimer timer;
 
-    private Advertising advertising;
+    private SheepAd ad;
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -81,20 +86,20 @@ public class SplashAct extends BaseActivity {
         if (!TextUtils.isEmpty(SpUtils.getToken(SheepApp.getInstance()))) {
             ApiJSONUtil.postUserDeviceLog();
         }
-        if (SplashHelper.requestStoragePermission(this)) {
+        if (requestStoragePermission()) {
             init();
         }
     }
 
     @Override
     public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
-        if (SplashHelper.requestStoragePermission(this)) {
+        if (requestStoragePermission()) {
             init();
         }
     }
 
     private void init() {
-        if (SplashHelper.isNotSupport(this)) return;
+        if (SysAppUtil.isNotSupport(this)) return;
         SheepApp.getInstance().getNetComponent().getApiService().checkUserFirst()
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
@@ -113,13 +118,12 @@ public class SplashAct extends BaseActivity {
 
                     private void handleResult(boolean isNewSmallSheep) {
                         DataUtil.getInstance().setIsNewSmallSheep(isNewSmallSheep);
-                        if (SysAppUtil.isNewSmallSheep() || TestUtil.isDev()) {//新版本只显示引导页面,不展示弹窗和开屏广告
+                        if (SysAppUtil.isNewSmallSheep()) {//新版本只显示引导页面,不展示弹窗和开屏广告
                             initAdvertisement(false);//只更新,不加载,下次加载上次的数据
                             sendHandlerMessages(2000);
                         } else {
-                            Advertising cacheAdvertising = DataUtil.getInstance().getCacheResult(ApiKey.advertisements(1), Advertising.class);
-                            if (cacheAdvertising != null) {
-                                advertising = cacheAdvertising;
+                            ad = DDProviderHelper.getInstance().getSheepAd(SheepAd.FORM_SPASH);
+                            if (ad != null) {
                                 loadAdvertising();
                                 initAdvertisement(false);//只更新,不加载,下次加载上次的数据
                             } else {
@@ -131,36 +135,27 @@ public class SplashAct extends BaseActivity {
     }
 
     private void initAdvertisement(boolean isLoad) {
-        SheepApp.getInstance().getNetComponent().getApiService().getAdvertising(1)
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(this) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        if (isLoad) {
-                            advertising = baseMessage.getData(Advertising.class);
-                            loadAdvertising();
-                        } else {
-
-                        }
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                        if (isLoad) {
-                            sendHandlerMessages(2000);
-                        }
-                    }
-                });
+        CommonUtil.getInstance().refreshAds((ret, list) -> {
+            if (ret) {
+                if (isLoad) {
+                    ad = DDProviderHelper.getInstance().getSheepAd(SheepAd.FORM_SPASH);
+                    loadAdvertising();
+                }
+            } else {
+                if (isLoad) {
+                    sendHandlerMessages(2000);
+                }
+            }
+        });
     }
 
     private void loadAdvertising() {
         if (this.isDestroyed()) return;
-        if (advertising.isImage()) {
-            Glide.with(this).load(advertising.getDisplay_src()).into(splash_image_view);
+        if (ad.isImage()) {
+            Glide.with(this).load(ad.getAd_img()).into(splash_image_view);
             ViewUtil.setVisibility(splash_video_view, View.GONE);
         } else {
-            Uri uri = Uri.parse(advertising.getDisplay_src());
+            Uri uri = Uri.parse(ad.getAd_img());
             if (splash_video_view != null) {
                 splash_video_view.setVisibility(View.VISIBLE);
                 splash_video_view.setOnInfoListener(new MediaPlayer.OnInfoListener() {
@@ -182,9 +177,9 @@ public class SplashAct extends BaseActivity {
         }
 
         mHandler.removeMessages(0);
-        if (advertising.getShow_time() > 0) {
+        if (ad.getShow_time() > 0) {
             ViewUtil.setVisibility(splash_skip, View.VISIBLE);
-            timer = RxjavaCountDownTimer.getInstance(advertising.getShow_time())
+            timer = RxjavaCountDownTimer.getInstance(ad.getShow_time())
                     .setOnTickListener(new RxjavaCountDownTimer.OnTickListener() {
                         @Override
                         public void onFinish() {
@@ -267,11 +262,10 @@ public class SplashAct extends BaseActivity {
                 break;
             case R.id.splash_image_view:
             case R.id.splash_video_view:
-                if (advertising != null) {
+                if (ad != null) {
                     mHandler.removeMessages(0);
                     goLink = true;
-                    SplashHelper.goAdLink(this, advertising);
-                    AD_SPLASH.onEvent("ad_id", advertising.getId());
+                    AdHelper.goAdLink(this, ad);
                 } else {
                     sendHandlerMessages(10);
                 }
@@ -301,4 +295,23 @@ public class SplashAct extends BaseActivity {
             e.printStackTrace();
         }
     }
+
+    public boolean requestStoragePermission() {
+        List<String> permissions = new ArrayList<String>();
+        boolean result = true;
+        if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
+                || ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+            permissions.add(Manifest.permission.READ_EXTERNAL_STORAGE);
+            permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
+            result = false;
+        }
+        if (permissions.size() > 0) {
+            String[] permissionArrays = new String[permissions.size()];
+            permissionArrays = permissions.toArray(permissionArrays);
+            ActivityCompat.requestPermissions(this,
+                    permissionArrays,
+                    1111);
+        }
+        return result;
+    }
 }

+ 106 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/helper/AdHelper.java

@@ -0,0 +1,106 @@
+package com.sheep.gamegroup.view.activity.helper;
+
+import android.Manifest;
+import android.app.Activity;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
+import android.text.TextUtils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.sheep.gamegroup.greendao.download.SheepAd;
+import com.sheep.gamegroup.model.entity.Advertising;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.DialogConfig;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.FileUtil;
+import com.sheep.gamegroup.util.IDConstant;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.view.activity.SplashAct;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.utils.SpUtils;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+
+import static com.sheep.jiuyan.samllsheep.utils.ClassFileHelper.DIR;
+
+public class AdHelper {
+
+    public static void goAdLink(Activity activity, SheepAd advertising) {
+        if (TextUtils.isEmpty(SpUtils.getToken(SheepApp.getInstance()))) {
+            Jump2View.getInstance().goLoginView(activity, null);
+            if (activity instanceof SplashAct) {
+                activity.finish();
+            }
+            return;
+        }
+        if (advertising.getJump_type() == 1) {
+            if (advertising.getJump_form() == 1) {
+                Jump2View.getInstance().goWeb(activity, advertising.getJump_url());
+            } else {
+                Jump2View.getInstance().goWeb(activity, advertising.getJump_url(), advertising.getName());
+            }
+            AdHelper.stat(advertising.getAd_id(), 2);
+            return;
+        } else if (advertising.getJump_type() == 2) {
+            String fileName = FileUtil.getLastSplitEnd(advertising.getJump_url(), '/');
+            String filePath = new File(DIR, fileName).getAbsolutePath();
+            Jump2View.getInstance().startDownloadService(advertising.getJump_url(), filePath);
+            AdHelper.stat(advertising.getAd_id(), 3);
+            return;
+        }
+        CommonUtil.getInstance().clickAd(activity, advertising.getId(), advertising.getLink_type(), advertising.getLink_id());
+    }
+
+    public static void stat(long adId, int type) {
+        JSONObject json = new JSONObject();
+        json.put("app_advertising_id", adId);
+        json.put("type", type);
+        SheepApp.getInstance().getNetComponent().getApiService().statAdAction(json)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+
+                    }
+                });
+    }
+
+    public static void stat(String adIds, int type) {
+        JSONObject json = new JSONObject();
+        json.put("ids", adIds);
+        json.put("type", type);
+        SheepApp.getInstance().getNetComponent().getApiService().statAdAction(json)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+
+                    }
+                });
+    }
+
+}

+ 0 - 123
app/src/main/java/com/sheep/gamegroup/view/activity/helper/SplashHelper.java

@@ -1,123 +0,0 @@
-package com.sheep.gamegroup.view.activity.helper;
-
-import android.Manifest;
-import android.app.Activity;
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.os.Build;
-import android.support.v4.app.ActivityCompat;
-import android.support.v4.content.ContextCompat;
-import android.text.TextUtils;
-
-import com.sheep.gamegroup.model.entity.Advertising;
-import com.sheep.gamegroup.model.entity.DialogConfig;
-import com.sheep.gamegroup.util.IDConstant;
-import com.sheep.gamegroup.util.Jump2View;
-import com.sheep.gamegroup.util.ViewUtil;
-import com.sheep.gamegroup.view.activity.SplashAct;
-import com.sheep.jiuyan.samllsheep.SheepApp;
-import com.sheep.jiuyan.samllsheep.utils.SpUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_FIND_ACT;
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_FIND_GMAE;
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_FIND_INFORMATION;
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_FIND_RECOMMEND;
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_GMAE;
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_WATCH_FOCUS;
-
-public class SplashHelper {
-
-    public static boolean requestStoragePermission(Activity context) {
-        List<String> permissions = new ArrayList<String>();
-        boolean result = true;
-        if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
-                || ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
-            permissions.add(Manifest.permission.READ_EXTERNAL_STORAGE);
-            permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
-            result = false;
-        }
-        if (permissions.size() > 0) {
-            String[] permissionArrays = new String[permissions.size()];
-            permissionArrays = permissions.toArray(permissionArrays);
-            ActivityCompat.requestPermissions(context,
-                    permissionArrays,
-                    1111);
-        }
-        return result;
-    }
-
-    public static boolean isNotSupport(Context context) {
-        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
-            ViewUtil.showMsgDialog(context, new DialogConfig().setMsg("尊敬的羊羊用户,智能绵羊管家检测到你系统版本过低,已为你推荐了优质通道,是否立即前往?")
-                    .setBtnLeftText("知道了").setBtnRightText("前往").setBtnRightOnClickListener(view -> Jump2View.getInstance().goWeb(context, "http://shop.17xmy.com/mobile/category.php?id=144")));
-            return true;
-        }
-        return false;
-    }
-
-    public static void goAdLink(Activity activity, Advertising advertising) {
-        if (TextUtils.isEmpty(SpUtils.getToken(SheepApp.getInstance()))) {
-            Jump2View.getInstance().goLoginView(activity, null);
-            if (activity instanceof SplashAct) {
-                activity.finish();
-            }
-            return;
-        }
-        if (advertising != null) {
-            switch (advertising.getLinkType()) {//转跳类型1:H5外部 2:H5内部 3:试玩赚钱 4:单个任务 5:信用卡 6:微信二维码 7:连续任务 8:打卡赚钱
-                case 1:
-                    Jump2View.getInstance().goWeb(activity, advertising.getLink());
-                    break;
-                case 2:
-                    Jump2View.getInstance().goWeb(activity, advertising.getLink(), advertising.getName());
-                    break;
-                case 3:
-                    Jump2View.getInstance().goTryplayView(activity, null);
-                    break;
-                case 4:
-                    Jump2View.getInstance().goTaskById(advertising.getLink_id());
-                    break;
-                case 5:
-                    Jump2View.getInstance().goCreditCardTaskDetail(activity, advertising.getLink_id());
-                    break;
-                case 6:
-                    Jump2View.getInstance().goWeb(activity, advertising.getLink(), "微信二维码辅助好友注册");
-                    break;
-                case 7:
-                    Jump2View.getInstance().goSequentialTaskView(activity);
-                    break;
-                case 8:
-                    Jump2View.getInstance().goSignCardAct(activity, null);
-                    break;
-                case 15://小米游戏列表
-                    Jump2View.getInstance().goXiaomiGameList(activity, null);
-                    break;
-                case JUMP_GMAE://游戏详情
-                    Jump2View.getInstance().goPlayGameDetail(advertising.getLink_id());
-                    break;
-                case JUMP_FIND_RECOMMEND://发现--推荐
-                case JUMP_FIND_ACT://发现--活动
-                case JUMP_FIND_INFORMATION://webView资讯
-                case JUMP_FIND_GMAE://发现中的游戏详情
-                    Jump2View.getInstance().goFindItem(activity, advertising.getLink_id());
-                    break;
-                case JUMP_WATCH_FOCUS://看点
-                    Jump2View.getInstance().goWatchFocus(activity, advertising.getLink_id());
-                    break;
-                case IDConstant.JUMP_VIP://vip
-                    Jump2View.getInstance().gotoVip(activity);
-                    break;
-                case IDConstant.JUMP_LONG_MAO://龙猫
-                    Jump2View.getInstance().gotoLongMao(activity);
-                    break;
-                case IDConstant.JUMP_YF_SHOP://商城
-                    Jump2View.getInstance().gotoYfShop(activity);
-                    break;
-            }
-        }
-    }
-
-}

+ 11 - 5
app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment5.java

@@ -11,6 +11,7 @@ import com.jcodecraeer.xrecyclerview.XRecyclerView;
 import com.sheep.gamegroup.absBase.AbsObserver;
 import com.sheep.gamegroup.absBase.ILoadMore;
 import com.sheep.gamegroup.absBase.IRefresh;
+import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
@@ -23,6 +24,7 @@ import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.base.BaseFragment;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import butterknife.BindView;
@@ -46,6 +48,10 @@ public abstract class BaseListFragment5<T> extends BaseFragment implements IRefr
 
     private int refreshOnType = REFRESH_ON_NONE;
 
+    protected List<T> list = ListUtil.emptyList();
+    protected List<T> lastCacheList = ListUtil.emptyList();
+    protected List<T> newList;
+
     @Override
     public void onViewCreated() {
         activity = getActivity();
@@ -136,9 +142,6 @@ public abstract class BaseListFragment5<T> extends BaseFragment implements IRefr
         this.noMore = noMore;
     }
 
-    protected List<T> list = ListUtil.emptyList();
-    protected List<T> lastCacheList = ListUtil.emptyList();
-
     //默认先获取缓存
     protected boolean isFirstGetACache() {
         return true;
@@ -235,8 +238,6 @@ public abstract class BaseListFragment5<T> extends BaseFragment implements IRefr
         initData();
     }
 
-    protected List<T> newList;
-
     protected void loadList(List<T> addList) {
         ListUtil.addAllItem(list, addList);
         newList = addList;
@@ -257,11 +258,16 @@ public abstract class BaseListFragment5<T> extends BaseFragment implements IRefr
         } else {
             view_list.loadMoreComplete();
         }
+        combineList();
         ViewUtil.notifyDataSetChanged(view_list);
         notifyData();
         view_list.getFootView().setVisibility(view_list.getAdapter() != null && view_list.getAdapter().getItemCount() == 0 ? View.GONE : View.VISIBLE);
     }
 
+    protected void combineList(){
+
+    }
+
     protected void updateEmptyView() {
         CommonUtil.getInstance().updateEmptyView(empty_view, list.isEmpty());
     }

+ 61 - 5
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtFindChild.java

@@ -14,7 +14,9 @@ import com.kfzs.android.view.tag.FlowLayout;
 import com.kfzs.android.view.tag.TagAdapter;
 import com.kfzs.android.view.tag.TagFlowLayout;
 import com.sheep.gamegroup.event.BigEvent;
+import com.sheep.gamegroup.greendao.DDProviderHelper;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
+import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.Applications;
 import com.sheep.gamegroup.model.entity.Article;
@@ -30,6 +32,7 @@ import com.sheep.gamegroup.util.TestUtil;
 import com.sheep.gamegroup.util.ViewHolder;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
+import com.sheep.gamegroup.view.activity.helper.AdHelper;
 import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -40,6 +43,7 @@ import org.afinal.simplecache.ApiKey;
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -58,6 +62,7 @@ public class FgtFindChild extends BaseListFragment5<Article> {
 
     private int type;
     private int subType;
+    protected List<SheepAd> ads = new ArrayList<>();
 
     @Override
     public void initView() {
@@ -246,6 +251,17 @@ public class FgtFindChild extends BaseListFragment5<Article> {
                 type = articleTag.getId();
             }
         }
+        if (type == 0) {
+            ads = DDProviderHelper.getInstance().listSheepAd(SheepAd.FORM_NEWS);
+            StringBuffer ids = new StringBuffer();
+            for (SheepAd ad : ads) {
+                if (ids.length() > 0) {
+                    ids.append(",");
+                }
+                ids.append(ad.getAd_id());
+            }
+            AdHelper.stat(ids.toString(), 1);
+        }
         EventBus.getDefault().register(this);
     }
 
@@ -297,13 +313,33 @@ public class FgtFindChild extends BaseListFragment5<Article> {
         }
     }
 
+    protected void combineList() {
+        //combine ads and list
+        if (ads == null || ads.size() == 0) return;
+        List<Article> temp = new ArrayList<>();
+        int index = 0, adi = 0;
+        for (Article art : list) {
+            if (art.getType() < 0) continue;
+            index++;
+            temp.add(art);
+            if (index > 0 && index % 3 == 0) {
+                SheepAd ad = ads.get(adi++);
+                temp.add(new Article().convertFrom(ad));
+                if (adi == ads.size()) adi = 0;
+            }
+        }
+        list.clear();
+        list.addAll(temp);
+    }
+
     private class CommonRecycler extends AdbCommonRecycler<Article> {
 
-        private Converter commonConverter, newsConverter;
+        private Converter commonConverter, newsConverter, adConverter;
 
         public CommonRecycler(List<Article> list) {
             super(SheepApp.getInstance(), list);
             commonConverter = new CommonConverter();
+            adConverter = new AdConverter();
             if (!TestUtil.isLTVersion3_4_5())
                 newsConverter = new NewsConverter();
         }
@@ -319,7 +355,9 @@ public class FgtFindChild extends BaseListFragment5<Article> {
             if (FgtFindChild.this.type == -1) {
                 return R.layout.find_item_game_news;
             } else {
-                if (type == 2 && newsConverter != null) {
+                if (type == -1) {
+                    return R.layout.find_item_ad;
+                } else if (type == 2 && newsConverter != null) {
                     return R.layout.find_item_news;
                 }
                 return R.layout.find_item;
@@ -331,7 +369,9 @@ public class FgtFindChild extends BaseListFragment5<Article> {
             if (item == null) {
                 return;
             }
-            if (item.getType() == 2 && newsConverter != null) {
+            if (item.getType() == -1) {
+                adConverter.convert(holder, item);
+            } else if (item.getType() == 2 && newsConverter != null) {
                 newsConverter.convert(holder, item);
             } else {
                 commonConverter.convert(holder, item);
@@ -353,7 +393,7 @@ public class FgtFindChild extends BaseListFragment5<Article> {
             View find_item_placement = rootConvertView.findViewById(R.id.find_item_placement);
             ViewUtil.setVisibility(find_item_placement, item.getIs_placement() == 1);
 
-            if( find_item_download!=null) {
+            if (find_item_download != null) {
                 if (item.isGame()) {
                     ViewUtil.setVisibility(find_item_download, View.VISIBLE);
                     Applications findApp = item.getApplication();
@@ -367,7 +407,7 @@ public class FgtFindChild extends BaseListFragment5<Article> {
             ViewUtil.setImage(find_item_iv, item.getPictures());
             ViewUtil.setText(find_item_des, item.getDes());
             item.removeNullTag();
-            if(find_item_tags != null) {
+            if (find_item_tags != null) {
                 if (ListUtil.isEmpty(item.getTages())) {
                     ViewUtil.setVisibility(find_item_tags, View.GONE);
                 } else {
@@ -404,4 +444,20 @@ public class FgtFindChild extends BaseListFragment5<Article> {
         }
     }
 
+    private class AdConverter implements AdbCommonRecycler.Converter {
+
+        @Override
+        public void convert(final ViewHolder holder, final Article item) {
+            View rootConvertView = holder.itemView;
+            TextView find_item_name = (TextView) rootConvertView.findViewById(R.id.find_item_name);
+            ImageView find_item_iv = (ImageView) rootConvertView.findViewById(R.id.find_item_iv);
+
+            ViewUtil.setText(find_item_name, item.getTitle());
+            ViewUtil.setImage(find_item_iv, item.getPictures());
+            item.removeNullTag();
+
+            rootConvertView.setOnClickListener(view -> AdHelper.goAdLink(getActivity(), item.getMemo(SheepAd.class)));
+        }
+    }
+
 }

+ 51 - 74
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java

@@ -54,6 +54,8 @@ import com.sheep.gamegroup.di.components.DaggerSmallSheepComponent;
 import com.sheep.gamegroup.di.modules.SmallSheepModule;
 import com.sheep.gamegroup.di.modules.TryMakeMoneyModule;
 import com.sheep.gamegroup.event.BigEvent;
+import com.sheep.gamegroup.greendao.DDProviderHelper;
+import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.BulletinEnty;
 import com.sheep.gamegroup.model.entity.CashAwarsEntity;
@@ -105,6 +107,7 @@ import com.sheep.gamegroup.util.viewHelper.PopupWindowUtil;
 import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.activity.ActMsg;
 import com.sheep.gamegroup.view.activity.NotificationsUtils;
+import com.sheep.gamegroup.view.activity.helper.AdHelper;
 import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
 import com.sheep.gamegroup.view.adapter.AdpTryMakemoney;
 import com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp;
@@ -210,12 +213,10 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
     private TryMakeMoneyAdp tryMakeMoneyAdp;
     private List<TaskAcceptedEty> allTaskAcceptedTaskList = ListUtil.emptyList();
     private List<Release_task> releaseEtyLists = new ArrayList<>();
-    private List<SlideshowEty> slideshowEtyLists = new ArrayList<>();
-    private List<String> slideshowTitleList = new ArrayList<>();
     private List<BulletinEnty> bulletinEntyLists = new ArrayList<>();
 
     private List<HomeListEntity> homeListList = new ArrayList<>();
-    private List<HomeListEntity> barListList = new ArrayList<>();
+    private List<SheepAd> barListList = new ArrayList<>();
     private AdpHomeList<HomeListEntity> adpHomeList;
     private AdpTryMakemoney mAdapter;
 
@@ -733,7 +734,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 
             @Override
             public void onRefresh(@NonNull RefreshLayout refreshLayout) {
-                refreshData();
+                refreshData(false);
             }
         });
         RefreshUtil.newInstance().publicParameterLoadMore(refresh, activity);
@@ -778,35 +779,30 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
             inviteNotice(bulletinEntyLists);
         }
         //轮播
-        List<SlideshowEty> cacheSlideshowEtyList = DataUtil.getInstance().getCacheList(ApiKey.slideshow, SlideshowEty.class);
-        if (ListUtil.isEmpty(cacheSlideshowEtyList)) {
-            ViewUtil.setVisibility(banner, false);
+        List<SheepAd> adList = DDProviderHelper.getInstance().listSheepAd(SheepAd.FORM_HOME_BANNER);
+        if (adList != null && adList.size() > 0) {
+            bindBanner(adList);
         } else {
-            for (SlideshowEty slideshowEty : cacheSlideshowEtyList) {
-                slideshowEtyLists.add(slideshowEty);
-                slideshowTitleList.add(slideshowEty.getTitle());
-            }
-            bindBanner();
+            ViewUtil.setVisibility(banner, false);
         }
+        List<SheepAd> list = DDProviderHelper.getInstance().listSheepAd(SheepAd.FORM_HOME_BAR);
+        barListList.clear();
+        barListList.addAll(list);
+        ViewUtil.notifyDataSetChanged(bar_list_rv);
         //首页list
         List<HomeListEntity> cacheHomeListEtyList = DataUtil.getInstance().getCacheList(ApiKey.home_list, HomeListEntity.class);
         addHomeList(cacheHomeListEtyList);
-        refreshData();
+        refreshData(true);
     }
 
     //添加homeList数据
     private void addHomeList(List<HomeListEntity> cacheHomeListEtyList) {
-        barListList.clear();
         homeListList.clear();
         boolean isShowQB = false;
         boolean isShowMd = false;
         for (int i = 0; i < cacheHomeListEtyList.size(); i++) {
             HomeListEntity item = cacheHomeListEtyList.get(i);
-            if ("1024".equals(item.getDesc()) || "17".equals(item.getJump())) {
-                barListList.add(item);
-            } else {
-                homeListList.add(item);
-            }
+            homeListList.add(item);
             if (item.getJump().equals("6")) {//6Q币充值
                 isShowQB = !isShowQB;
             }
@@ -817,14 +813,13 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         addNewTask();
         SheepApp.getInstance().setShowQB(isShowQB);
         ViewUtil.notifyDataSetChanged(home_list_rv);
-        ViewUtil.notifyDataSetChanged(bar_list_rv);
         ViewUtil.setVisibility(home_list_progress_bar, homeListList.size() > 8);
     }
 
     /**
      * 刷新数据
      */
-    public void refreshData() {
+    public void refreshData(boolean initFlag) {
         SysAppUtil.checkNet(new AbsObserver<Integer>() {
             @Override
             public void onNext(Integer result) {
@@ -854,7 +849,20 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         }
         refreshTaskList();//任务
         pagePresenter.bulletin(null);//公告
-        pagePresenter.slideshow(null);//轮播
+        if (!initFlag) {
+            CommonUtil.getInstance().refreshAds(SheepAd.FORM_HOME_BANNER, (ret, list) -> {
+                if (ret) {
+                    bindBanner(list);
+                }
+            });
+            CommonUtil.getInstance().refreshAds(SheepAd.FORM_HOME_BAR, (ret, list) -> {
+                if (ret) {
+                    barListList.clear();
+                    barListList.addAll(list);
+                    ViewUtil.notifyDataSetChanged(bar_list_rv);
+                }
+            });
+        }
         pagePresenter.homeList();//首页list
 
         if (ViewUtil.isVisible(home_award_container)) {
@@ -907,22 +915,17 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         bar_list_rv.setHasFixedSize(true);
         bar_list_rv.setNestedScrollingEnabled(false);
         bar_list_rv.setLayoutManager(new LinearLayoutManager(activity));
-        bar_list_rv.setAdapter(new AdbCommonRecycler<HomeListEntity>(activity, barListList) {
+        bar_list_rv.setAdapter(new AdbCommonRecycler<SheepAd>(activity, barListList) {
             @Override
             public int getViewIdByType(int type) {
                 return R.layout.item_image_full_home_list;
             }
 
             @Override
-            public void convert(ViewHolder holder, final HomeListEntity item) {
+            public void convert(ViewHolder holder, final SheepAd item) {
                 ImageView imageView = holder.getView(R.id.image);
-                GlideImageLoader.setImage(imageView, item.getIcon());
-                imageView.setOnClickListener(new View.OnClickListener() {
-                    @Override
-                    public void onClick(View view) {
-                        CommonUtil.getInstance().goWhere(activity, item, "首页");
-                    }
-                });
+                GlideImageLoader.setImage(imageView, item.getAd_img());
+                imageView.setOnClickListener(view -> AdHelper.goAdLink(getActivity(), item));
             }
         });
 
@@ -1111,37 +1114,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 
     }
 
-    /**
-     * 公告和轮播
-     *
-     * @param baseMessage
-     */
-    @Override
-    public void failSlideshow(BaseMessage baseMessage) {
-
-    }
-
-    @Override
-    public void successSlideshow(BaseMessage baseMessage) {
-        if (this.getActivity() != null && this.getActivity().isDestroyed() || this.isDetached())
-            return;
-        boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.slideshow);
-        if (isNewData) {
-            List<SlideshowEty> slideshowEtyList = baseMessage.getDataList(SlideshowEty.class);
-            if (ListUtil.isEmpty(slideshowEtyList)) {
-                ViewUtil.setVisibility(banner, false);
-            } else {
-                slideshowEtyLists.clear();
-                slideshowTitleList.clear();
-                for (SlideshowEty slideshowEty : slideshowEtyList) {
-                    slideshowEtyLists.add(slideshowEty);
-                    slideshowTitleList.add(slideshowEty.getTitle());
-                }
-                bindBanner();
-            }
-        }
-    }
-
     @Override
     public void failbulletin(BaseMessage baseMessage) {
 
@@ -1274,10 +1246,17 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         super.onStop();
     }
 
-    private void bindBanner() {
+    private void bindBanner(final List<SheepAd> list) {
         if (banner == null) {
             return;
         }
+        List<String> images = new ArrayList<>();
+        List<String> titles = new ArrayList<>();
+        for (SheepAd ad : list) {
+            images.add(ad.getAd_img());
+            titles.add(ad.getName());
+            AdHelper.stat(ad.getAd_id(), 1);
+        }
         //结束轮播
         banner.stopAutoPlay();
         banner.setVisibility(View.VISIBLE);
@@ -1286,9 +1265,9 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
             @Override
             public void displayImage(Context context, Object o, ImageView imageView) {
                 try {
-                    if (o instanceof SlideshowEty && activity != null && !activity.isDestroyed()) {
+                    if (activity != null && !activity.isDestroyed()) {
 //                        GlideImageLoader.roundedCornersImage(imageView, ((SlideshowEty) o).getUrl(), G.getRealPix(10));
-                        Glide.with(context).load(((SlideshowEty) o).getUrl()).apply(new RequestOptions().centerCrop().transform(new RoundedCorners(G.getRealPix(8)))).into(imageView);
+                        Glide.with(context).load(o.toString()).apply(new RequestOptions().centerCrop().transform(new RoundedCorners(G.getRealPix(8)))).into(imageView);
                     }
                 } catch (Exception e) {
                     e.printStackTrace();
@@ -1298,15 +1277,13 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
                 .setDelayTime(4000)
                 .setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
                 //设置图片集合
-                .setImages(slideshowEtyLists).setBannerTitles(slideshowTitleList)
-                .setOnBannerListener(new OnBannerListener() {
-                    @Override
-                    public void OnBannerClick(int i) {
-                        try {
-                            CommonUtil.getInstance().clickBanner(activity, i, slideshowEtyLists);
-                        } catch (Exception e) {
-                            G.showToast(e.getMessage());
-                        }
+                .setImages(images).setBannerTitles(titles)
+                .setOnBannerListener(i -> {
+                    try {
+                        SheepAd ad = list.get(i);
+                        AdHelper.goAdLink(activity, ad);
+                    } catch (Exception e) {
+                        G.showToast(e.getMessage());
                     }
                 });
 

+ 4 - 3
app/src/main/java/com/sheep/jiuyan/samllsheep/Config.java

@@ -118,7 +118,8 @@ public class Config {
     public static final String KEY_SMALL_STATION_URL = "small_station_url";
     //small_station地址
     public static String SMALL_STATION_URL_SHEEP = "http://smallstation.9yan.io";
-    public static String SMALL_STATION_URL_TEST = "http://10.8.230.28:8080";
+//    public static String SMALL_STATION_URL_TEST = "http://10.8.230.28:8080";
+    public static String SMALL_STATION_URL_TEST = "http://10.8.240.180:8080";
     //在数据库中表 config 中 配置 small_station_url后,可以进行设置 ,否则使用默认的值
     public static String SMALL_STATION_URL;
 
@@ -127,8 +128,8 @@ public class Config {
     }
 
     public static void initSMALL_STATION_URL() {
-        SMALL_STATION_URL = TextUtils.equals(SheepApp.getInstance().getConnectAddress().name(), "sheep") ? SMALL_STATION_URL_SHEEP : SMALL_STATION_URL_TEST;
-//        SMALL_STATION_URL = SMALL_STATION_URL_SHEEP;
+//        SMALL_STATION_URL = TextUtils.equals(SheepApp.getInstance().getConnectAddress().name(), "sheep") ? SMALL_STATION_URL_SHEEP : SMALL_STATION_URL_TEST;
+        SMALL_STATION_URL = SMALL_STATION_URL_SHEEP;
     }
 
     public static String getYFShopUrl(String sub) {

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

@@ -61,8 +61,8 @@ import com.tencent.bugly.beta.Beta;
 import com.tencent.mm.opensdk.openapi.IWXAPI;
 import com.tencent.mm.opensdk.openapi.WXAPIFactory;
 import com.tencent.smtt.sdk.QbSdk;
-import com.tmsdk.AbsTMSConfig;
-import com.tmsdk.TMSDKContext;
+import com.stmsdk.AbsTMSConfig;
+import com.stmsdk.TMSDKContext;
 import com.umeng.commonsdk.UMConfigure;
 import com.umeng.socialize.PlatformConfig;
 import com.youmi.android.offer.YmConfig;

+ 1 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/base/BaseFragment.java

@@ -99,6 +99,7 @@ public abstract class BaseFragment extends RxFragment {
             mView = inflater.inflate(getLayoutId(), null);
         } else {
             mView = new FrameLayout(getContext());
+            mView.setBackgroundColor(getResources().getColor(android.R.color.black));
         }
         return mView;
     }

+ 9 - 4
app/src/main/java/com/sheep/jiuyan/samllsheep/utils/GlideApp.java

@@ -5,23 +5,28 @@ import android.content.Context;
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.GlideBuilder;
 import com.bumptech.glide.Registry;
+import com.bumptech.glide.annotation.GlideModule;
 import com.bumptech.glide.load.DecodeFormat;
-import com.bumptech.glide.module.GlideModule;
+import com.bumptech.glide.module.AppGlideModule;
+import com.bumptech.glide.request.RequestOptions;
 
 /**
  * Created By: zhoujuncai.
  * Created Date: 2018/9/20.
  * Description: Glide图片加载配置
  */
-public class GlideApp implements GlideModule {
+@GlideModule
+public class GlideAppModule extends AppGlideModule {
 
     @Override
     public void applyOptions(Context context, GlideBuilder builder) {
-        builder.setDecodeFormat(DecodeFormat.PREFER_RGB_565);
+        super.applyOptions(context, builder);
+        // 例如:全局设置图片格式为RGB_565
+        builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565));
     }
 
     @Override
     public void registerComponents(Context context, Glide glide, Registry registry) {
-
+        super.registerComponents(context, glide, registry);
     }
 }

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

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="3dp" />
+    <stroke android:color="@color/txt_gray_929292" android:width="1dp"/>
+</shape>

+ 9 - 0
app/src/main/res/layout/act_bottom_bar.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/main_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
@@ -80,6 +81,14 @@
             android:textColor="@color/selector_color_tab_game"
             android:textSize="10sp" />
 
+        <!--<com.airbnb.lottie.LottieAnimationView-->
+            <!--android:id="@+id/test_anim_view"-->
+            <!--app:lottie_fileName="data.json"-->
+            <!--app:lottie_loop="true"-->
+            <!--app:lottie_autoPlay="true"-->
+            <!--android:layout_width="50dp"-->
+            <!--android:layout_height="50dp" />-->
+
     </RadioGroup>
 
 </RelativeLayout>

+ 63 - 0
app/src/main/res/layout/find_item_ad.xml

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/find_item_container"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginBottom="12dp"
+    android:orientation="vertical"
+    android:paddingTop="16dp">
+
+    <LinearLayout
+        android:layout_marginLeft="16dp"
+        android:layout_marginTop="4dp"
+        android:layout_marginRight="16dp"
+        android:layout_marginBottom="8dp"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center_vertical"
+        android:orientation="horizontal">
+
+        <TextView
+            android:id="@+id/find_item_name"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:layout_marginLeft="16dp"
+            android:layout_marginRight="16dp"
+            android:ellipsize="end"
+            android:lines="1"
+            android:text="abcab"
+            android:textColor="@color/black_6_3"
+            android:textSize="15sp" />
+
+        <TextView
+            android:id="@+id/find_item_placement"
+            android:text="广告"
+            android:textSize="10sp"
+            android:paddingLeft="6dp"
+            android:paddingRight="6dp"
+            android:paddingTop="2dp"
+            android:paddingBottom="2dp"
+            android:textColor="@color/txt_gray_929292"
+            android:background="@drawable/shape_gray_stroke_3"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content" />
+    </LinearLayout>
+
+    <com.makeramen.roundedimageview.RoundedImageView
+        android:id="@+id/find_item_iv"
+        android:layout_width="match_parent"
+        android:layout_height="120dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginTop="4dp"
+        android:layout_marginRight="16dp"
+        android:adjustViewBounds="true"
+        android:scaleType="centerCrop"
+        app:riv_corner_radius="5dp" />
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="8dp"
+        android:background="@color/gray_F0F0F0" />
+</LinearLayout>

+ 9 - 0
media/share_library/src/main/java/rx/functions/Action2.java

@@ -0,0 +1,9 @@
+package rx.functions;
+
+/**
+ * Created by realicing on 2018/11/19.
+ * realicing@sina.com
+ */
+public interface Action2<T1, T2> {
+    void call(T1 t1, T2 t2);
+}