hanjing %!s(int64=7) %!d(string=hai) anos
pai
achega
5c6e34a37d

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

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

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

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

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

@@ -1464,4 +1464,17 @@ public interface ApiService {
     @GET(ApiKey.getUserFootPrintDateCount)
     Observable<BaseMessage> getUserFootPrintDateCount(@Query("start_date") String start_date, @Query("end_date") String end_date);
 //---------------------------end 小绵羊3.4.5 足迹-------------------------------------
+//---------------------------start 小绵羊3.4.5 分享-----------------------------------
+    /**
+     * 获取每日分享列表
+     */
+    @GET("app/share/shares")
+    Observable<BaseMessage> getShareList();
+    /**
+     * 每日分享结果
+     */
+    @POST("app/share/share/")
+    Observable<BaseMessage> sendShareResult(@Query("id") int id);
+//---------------------------end 小绵羊3.4.5 分享-----------------------------------
+
 }

+ 82 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/EveryDayShare.java

@@ -6,4 +6,86 @@ package com.sheep.gamegroup.model.entity;
  * 小绵羊3.4.5新增--每日分享
  */
 public class EveryDayShare {
+
+    private int id = 0;
+    private String title;
+    private String content;
+    private float money;
+    private int share_count;
+    private int status;
+    private String platform;
+    private long create_at;
+    private long updated_at;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public float getMoney() {
+        return money;
+    }
+
+    public void setMoney(float money) {
+        this.money = money;
+    }
+
+    public int getShare_count() {
+        return share_count;
+    }
+
+    public void setShare_count(int share_count) {
+        this.share_count = share_count;
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public String getPlatform() {
+        return platform;
+    }
+
+    public void setPlatform(String platform) {
+        this.platform = platform;
+    }
+
+    public long getCreate_at() {
+        return create_at;
+    }
+
+    public void setCreate_at(long create_at) {
+        this.create_at = create_at;
+    }
+
+    public long getUpdated_at() {
+        return updated_at;
+    }
+
+    public void setUpdated_at(long updated_at) {
+        this.updated_at = updated_at;
+    }
 }

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

@@ -28,6 +28,7 @@ public class ViewHolder extends android.support.v7.widget.RecyclerView.ViewHolde
     private View mConvertView;
     private Context mContext;
     private int mLayoutId;
+    private Object mExtra;
 
     public ViewHolder(Context context, View itemView, ViewGroup parent, int position) {
         super(itemView);
@@ -238,4 +239,12 @@ public class ViewHolder extends android.support.v7.widget.RecyclerView.ViewHolde
     public int getLayoutId() {
         return this.mLayoutId;
     }
+
+    public Object getmExtra() {
+        return mExtra;
+    }
+
+    public void setmExtra(Object mExtra) {
+        this.mExtra = mExtra;
+    }
 }

+ 50 - 32
app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java

@@ -244,6 +244,7 @@ public class ViewUtil {
             mWebView.loadUrl("javascript:" + js);
         }
     }
+
     //加载js
     public static void loadJs(WebView mWebView, String js) {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
@@ -260,7 +261,7 @@ public class ViewUtil {
 
     //刷新RecyclerView的adapter
     public static void notifyDataSetChanged(RecyclerView recyclerView) {
-        if(recyclerView != null && recyclerView.getAdapter() != null)
+        if (recyclerView != null && recyclerView.getAdapter() != null)
             recyclerView.getAdapter().notifyDataSetChanged();
     }
 
@@ -300,6 +301,7 @@ public class ViewUtil {
     public void showRobDutyDialog(final Activity mActivity, RobTask robTask) {
         showRobDutyDialog(mActivity, robTask, R.layout.dialog_game_or_task_or_gift, null);
     }
+
     /**
      * 抢任务弹框
      *
@@ -310,7 +312,7 @@ public class ViewUtil {
         final AlertDialog mAlertDialog = new AlertDialog.Builder(mActivity, R.style.MyDialogActivityTheme)
                 .setView(view)
                 .create();
-        if(action1 != null)
+        if (action1 != null)
             action1.call(view);
         View dialog_btn_left = view.findViewById(R.id.dialog_btn_left);
         View dialog_btn_right = view.findViewById(R.id.dialog_btn_right);
@@ -660,6 +662,10 @@ public class ViewUtil {
      * @param link
      */
     public static void shareLink(final Activity activity, final String link) {
+        shareLink(activity, null, link, null, null, null);
+    }
+
+    public static void shareLink(final Activity activity, String viewTitle, final String link, final String title, final String content, final ShareCallback callback) {
         View dialog_parent = View.inflate(activity, R.layout.dialog_parent, null);
         final AlertDialog dialog = new AlertDialog.Builder(activity, R.style.MyDialogActivityTheme)
                 .setView(dialog_parent)
@@ -668,7 +674,7 @@ public class ViewUtil {
         View dialog_close = dialog_parent.findViewById(R.id.dialog_close);
         LinearLayout dialog_center_ll = dialog_parent.findViewById(R.id.dialog_center_ll);
         View view = LayoutInflater.from(activity).inflate(R.layout.x_recommend_dialog, dialog_center_ll, true);
-        dialog_title.setText("推荐给好友");
+        dialog_title.setText(TextUtils.isEmpty(viewTitle) ? "推荐给好友" : viewTitle);
 
         View wx = view.findViewById(R.id.but_share_wx);
         View qq = view.findViewById(R.id.but_share_qq);
@@ -682,7 +688,7 @@ public class ViewUtil {
         wx.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                shareAction(activity, link, SHARE_MEDIA.WEIXIN);
+                shareAction(activity, title, content, link, SHARE_MEDIA.WEIXIN, callback);
                 dialog.dismiss();
             }
         });
@@ -691,7 +697,7 @@ public class ViewUtil {
         qq.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                shareAction(activity, link, SHARE_MEDIA.QQ);
+                shareAction(activity, title, content, link, SHARE_MEDIA.QQ, callback);
                 dialog.dismiss();
             }
         });
@@ -700,7 +706,7 @@ public class ViewUtil {
         pyq.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                shareAction(activity, link, SHARE_MEDIA.WEIXIN_CIRCLE);
+                shareAction(activity, title, content, link, SHARE_MEDIA.WEIXIN_CIRCLE, callback);
                 dialog.dismiss();
             }
         });
@@ -709,7 +715,7 @@ public class ViewUtil {
         zone.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                shareAction(activity, link, SHARE_MEDIA.QZONE);
+                shareAction(activity, title, content, link, SHARE_MEDIA.QZONE, callback);
                 dialog.dismiss();
             }
         });
@@ -767,16 +773,16 @@ public class ViewUtil {
      * @param url      分享链接
      * @param media    分享平台
      */
-    private static void shareAction(Activity activity, String url, SHARE_MEDIA media) {
+    private static void shareAction(Activity activity, String title, String content, String url, SHARE_MEDIA media, final ShareCallback callback) {
         /* 缩略图 */
         UMImage image = new UMImage(activity, R.drawable.icon);
         /* URL */
         UMWeb web = new UMWeb(url);
         /* 标题 */
-        web.setTitle("赚钱就来小绵羊");
+        web.setTitle(!TextUtils.isEmpty(title) ? "赚钱就来小绵羊" : title);
         web.setThumb(image);
-        web.setDescription("更懂你的赚钱工具,超多福利,超多赏金,拿到你手软!");
-        switch (media){
+        web.setDescription(!TextUtils.isEmpty(content) ? "更懂你的赚钱工具,超多福利,超多赏金,拿到你手软!" : content);
+        switch (media) {
             case WEIXIN_CIRCLE:
                 web.setTitle(web.getTitle() + "\n" + web.getDescription());
                 break;
@@ -793,6 +799,9 @@ public class ViewUtil {
             @Override
             public void onResult(SHARE_MEDIA share_media) {
                 G.showToast("分享成功!");
+                if (callback != null) {
+                    callback.callback();
+                }
             }
 
             @Override
@@ -808,6 +817,10 @@ public class ViewUtil {
         action.share();
     }
 
+    public static interface ShareCallback {
+        void callback();
+    }
+
     /**
      * 领取福利成功的对话框
      *
@@ -978,6 +991,7 @@ public class ViewUtil {
             textView.setMovementMethod(LinkMovementMethod.getInstance());
         }
     }
+
     public static void setH5ImgText(TextView textView, String content, int maxWidth, Html.TagHandler tagHandler) {
         if (textView != null) {
             if (TextUtils.isEmpty(content)) {
@@ -1470,8 +1484,8 @@ public class ViewUtil {
 
 
     public static void centerImage(ImageView imageView, String pictures) {
-        if (imageView != null){
-            if(TextUtils.isEmpty(pictures)) {
+        if (imageView != null) {
+            if (TextUtils.isEmpty(pictures)) {
                 imageView.setImageResource(R.mipmap.icon);
             } else {
                 if (pictures.contains(";")) {
@@ -1483,8 +1497,8 @@ public class ViewUtil {
     }
 
     public static void setAvatar(ImageView imageView, String pictures) {
-        if (imageView != null){
-            if(TextUtils.isEmpty(pictures)) {
+        if (imageView != null) {
+            if (TextUtils.isEmpty(pictures)) {
                 imageView.setImageResource(R.mipmap.icon);
             } else {
                 if (pictures.contains(";")) {
@@ -1496,8 +1510,8 @@ public class ViewUtil {
     }
 
     public static void setBlur(ImageView imageView, String pictures) {
-        if (imageView != null){
-            if(TextUtils.isEmpty(pictures)) {
+        if (imageView != null) {
+            if (TextUtils.isEmpty(pictures)) {
                 imageView.setImageResource(R.mipmap.icon);
             } else {
                 if (pictures.contains(";")) {
@@ -1509,8 +1523,8 @@ public class ViewUtil {
     }
 
     public static void setImage(ImageView imageView, String pictures) {
-        if (imageView != null){
-            if(TextUtils.isEmpty(pictures)) {
+        if (imageView != null) {
+            if (TextUtils.isEmpty(pictures)) {
                 imageView.setImageResource(R.mipmap.icon);
             } else {
                 if (pictures.contains(";")) {
@@ -1522,8 +1536,8 @@ public class ViewUtil {
     }
 
     public static void setImageLoading(ImageView imageView, String pictures) {
-        if (imageView != null){
-            if(TextUtils.isEmpty(pictures)) {
+        if (imageView != null) {
+            if (TextUtils.isEmpty(pictures)) {
                 imageView.setImageResource(R.mipmap.icon);
             } else {
                 if (pictures.contains(";")) {
@@ -1535,8 +1549,8 @@ public class ViewUtil {
     }
 
     public static void setImage(ImageView imageView, String pictures, int radius) {
-        if (imageView != null){
-            if(TextUtils.isEmpty(pictures)) {
+        if (imageView != null) {
+            if (TextUtils.isEmpty(pictures)) {
                 imageView.setImageResource(R.mipmap.icon);
             } else {
                 if (pictures.contains(";")) {
@@ -1548,8 +1562,8 @@ public class ViewUtil {
     }
 
     public static void setGameImage(ImageView imageView, String pictures) {
-        if (imageView != null){
-            if(TextUtils.isEmpty(pictures)) {
+        if (imageView != null) {
+            if (TextUtils.isEmpty(pictures)) {
                 imageView.setImageResource(R.mipmap.icon);
             } else {
                 if (pictures.contains(";")) {
@@ -1561,8 +1575,8 @@ public class ViewUtil {
     }
 
     public static void setGameImage(ImageView imageView, String pictures, int radius) {
-        if (imageView != null){
-            if(TextUtils.isEmpty(pictures)) {
+        if (imageView != null) {
+            if (TextUtils.isEmpty(pictures)) {
                 imageView.setImageResource(R.mipmap.icon);
             } else {
                 if (pictures.contains(";")) {
@@ -1605,6 +1619,7 @@ public class ViewUtil {
                 break;
         }
     }
+
     public static void setText(TextView textView, IContentTypeContainer<Integer, String> contentTypeContainer, int maxWidth, Html.TagHandler tagHandler) {
         switch (contentTypeContainer.getContentType()) {
             case StringUtils.CONTENT_TYPE_FONT:
@@ -1634,9 +1649,10 @@ public class ViewUtil {
 
     /**
      * 设置视频播放和播放按钮与占位图
+     *
      * @param videoView
      * @param placeHolderlView 占位图片
-     * @param control 控制播放的按钮
+     * @param control          控制播放的按钮
      * @param url
      */
     public static void setVideoAndFull(final VideoView videoView, final ImageView placeHolderlView, final ImageView control, final String url) {
@@ -1704,6 +1720,7 @@ public class ViewUtil {
             view.setEnabled(enabled);
         }
     }
+
     public static void setVisibility(View view, boolean isVisible) {
         if (view != null) {
             view.setVisibility(isVisible ? View.VISIBLE : View.GONE);
@@ -1812,9 +1829,10 @@ public class ViewUtil {
 
     /**
      * 显示分享弹出框
+     *
      * @param activity
      * @param shareLinkConfig
-     * @param action1 回调的view为nul时,代表流程结束;不为空时,代表初始化dialog的view,可以做自定义
+     * @param action1         回调的view为nul时,代表流程结束;不为空时,代表初始化dialog的view,可以做自定义
      */
     public static void showShareDialog(final Activity activity, final ShareLinkConfig shareLinkConfig, final Action1<View> action1) {
         View dialogView = View.inflate(activity, R.layout.ask_to_share, null);
@@ -1823,7 +1841,7 @@ public class ViewUtil {
                 .create();
 //        TextView ask_share_title = dialogView.findViewById(R.id.ask_share_title);
         RecyclerView ask_share_list = dialogView.findViewById(R.id.ask_share_list);
-        if(action1 != null)
+        if (action1 != null)
             action1.call(dialogView);
 //        ask_share_list.setHasFixedSize(true);
 //        ask_share_list.setNestedScrollingEnabled(false);
@@ -1885,7 +1903,7 @@ public class ViewUtil {
         dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
             @Override
             public void onDismiss(DialogInterface dialogInterface) {
-                if(action1 != null)
+                if (action1 != null)
                     action1.call(null);
             }
         });
@@ -1900,7 +1918,7 @@ public class ViewUtil {
             }
         } catch (Exception e) {
             e.printStackTrace();
-            if(action1 != null)
+            if (action1 != null)
                 action1.call(null);
         }
     }

+ 5 - 0
app/src/main/java/com/sheep/gamegroup/view/adapter/AdbCommonRecycler.java

@@ -5,6 +5,7 @@ import android.support.annotation.NonNull;
 import android.support.v7.widget.RecyclerView;
 import android.view.ViewGroup;
 
+import com.sheep.gamegroup.model.entity.Article;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.ViewHolder;
 
@@ -78,4 +79,8 @@ public abstract class AdbCommonRecycler<T> extends RecyclerView.Adapter<ViewHold
     public int getItemCount() {
         return listData.size();
     }
+
+    public interface Converter{
+        void convert(ViewHolder holder, Article item);
+    }
 }

+ 76 - 4
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpEveryDayShare.java

@@ -1,29 +1,101 @@
 package com.sheep.gamegroup.view.adapter;
 
+import android.app.Activity;
+import android.content.Context;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.alibaba.fastjson.JSONObject;
+import com.sheep.gamegroup.model.entity.Article;
+import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.EveryDayShare;
+import com.sheep.gamegroup.model.entity.UserEntity;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.ViewHolder;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.util.share.ShareLinkConfig;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 
 import java.util.List;
 
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+import rx.functions.Action1;
+
 /**
  * Created by realicing on 2018/11/23.
  * realicing@sina.com
  * 小绵羊3.4.5新增--每日分享
  */
-public class AdpEveryDayShare extends AdbCommonRecycler<EveryDayShare>{
-    public AdpEveryDayShare(List<EveryDayShare> list) {
-        super(SheepApp.getInstance(), list);
+public class AdpEveryDayShare extends AdbCommonRecycler<EveryDayShare> {
+    public AdpEveryDayShare(Context context, List<EveryDayShare> list) {
+        super(context, list);
+        list.add(0, new EveryDayShare());
+    }
+
+    @Override
+    public int getItemViewType(int position) {
+        return position == 0 ? 0 : 1;
     }
 
     @Override
     public int getViewIdByType(int type) {
+        if (type == 0) {
+            return R.layout.item_text_tips;
+        }
         return R.layout.item_every_day_share;
     }
 
     @Override
-    public void convert(ViewHolder holder, EveryDayShare everyDayShare) {
+    public void convert(ViewHolder holder, final EveryDayShare item) {
+        if (item.getId() == 0) {
+
+        } else {
+            TextView share_item_title = holder.itemView.findViewById(R.id.share_item_title);
+            ImageView share_item_iv = holder.itemView.findViewById(R.id.share_item_iv);
+            ViewUtil.setText(share_item_title, item.getTitle());
+//        ViewUtil.setImage(share_item_iv, item.getPictures());
+            holder.itemView.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View view) {
+                    CommonUtil.getInstance().callActionWithUserInfo(new Action1<UserEntity>() {
+                        @Override
+                        public void call(UserEntity userEntity) {
+                            if (userEntity != null) {
+                                ViewUtil.shareLink((Activity) context,
+                                        "分享",
+                                        userEntity.getShareLink(ShareLinkConfig.OTHER),
+                                        item.getTitle(),
+                                        item.getContent(),
+                                        new ViewUtil.ShareCallback() {
+                                            @Override
+                                            public void callback() {
+                                                SheepApp.getInstance().getNetComponent().getApiService()
+                                                        .sendShareResult(item.getId())
+                                                        .subscribeOn(Schedulers.io())
+                                                        .observeOn(Schedulers.io())
+                                                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                                                            @Override
+                                                            public void onNext(BaseMessage baseMessage) {
+                                                            }
 
+                                                            @Override
+                                                            public void onError(BaseMessage baseMessage) {
+                                                                LogUtil.logE(baseMessage.getCode() + " : " + baseMessage.getErrorMsg());
+                                                            }
+                                                        });
+                                            }
+                                        });
+                            }
+                        }
+                    });
+                }
+            });
+        }
     }
 }

+ 24 - 3
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtEveryDayShare.java

@@ -5,7 +5,13 @@ import android.support.v7.widget.RecyclerView;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.EveryDayShare;
+import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.view.adapter.AdpEveryDayShare;
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
+
+import org.afinal.simplecache.ApiKey;
+
+import java.util.List;
 
 import io.reactivex.Observable;
 
@@ -15,23 +21,38 @@ import io.reactivex.Observable;
  * 小绵羊3.4.5新增--每日分享
  */
 public class FgtEveryDayShare extends BaseListFragment2<EveryDayShare>{
+
+    @Override
+    public void initView() {
+        TitleBarUtils.getInstance().setTitle(title, "每日分享")
+                .setTitleFinish(title, activity);
+        view_list.setLoadingMoreEnabled(false);
+    }
+
     @Override
     protected RecyclerView.Adapter getAdapter() {
-        return new AdpEveryDayShare(list);
+        return new AdpEveryDayShare(getActivity(), list);
     }
 
     @Override
     protected String getKey(int page, int per_page) {
-        return null;
+        return ApiKey.getShareList;
     }
 
     @Override
     protected Observable<BaseMessage> getApi(ApiService apiService) {
-        return null;
+        return apiService.getShareList();
     }
 
     @Override
     protected Class<EveryDayShare> getTClass() {
         return EveryDayShare.class;
     }
+
+    @Override
+    public void loadList(List<EveryDayShare> addList) {
+        addList.add(0, new EveryDayShare());
+        super.loadList(addList);
+    }
+
 }

+ 112 - 77
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtFindChild.java

@@ -37,6 +37,7 @@ import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 
@@ -52,83 +53,7 @@ import static android.content.Intent.ACTION_PACKAGE_REMOVED;
 public class FgtFindChild extends BaseListFragment2<Article> {
     @Override
     protected RecyclerView.Adapter getAdapter() {
-        return new AdbCommonRecycler<Article>(SheepApp.getInstance(), list) {
-
-            @Override
-            public int getItemViewType(int position) {
-                return position;
-            }
-
-            @Override
-            public int getViewIdByType(int type) {//type来源于 getItemViewType 返回的值
-                return R.layout.find_item;
-            }
-
-            @Override
-            public void convert(final ViewHolder holder, final Article item) {
-                if (item == null) {
-                    return;
-                }
-                View rootConvertView = holder.itemView;
-                View padding = rootConvertView.findViewById(R.id.padding);
-                if (padding == null) {
-                    return;
-                }
-                padding.setVisibility(holder.getAdapterPosition() == 1 ? View.GONE : View.VISIBLE);
-                TextView find_item_name = (TextView) rootConvertView.findViewById(R.id.find_item_name);
-                TextView find_item_time = (TextView) rootConvertView.findViewById(R.id.find_item_time);
-                ImageView find_item_iv = (ImageView) rootConvertView.findViewById(R.id.find_item_iv);
-                TextView find_item_des = (TextView) rootConvertView.findViewById(R.id.find_item_des);
-//                TextView find_item_pf_label = (TextView)rootConvertView.findViewById(R.id.find_item_pf_label);
-                TextView find_item_download = (TextView) rootConvertView.findViewById(R.id.find_item_download);
-                TagFlowLayout find_item_tags = (TagFlowLayout) rootConvertView.findViewById(R.id.find_item_tags);
-
-                if (item.isGame()) {
-                    find_item_download.setVisibility(View.VISIBLE);
-                    Applications findApp = item.getApplication();
-//                    find_item_pf_label.setVisibility(View.VISIBLE);
-//                    find_item_pf_label.setText(Html.fromHtml(String.format(Locale.CHINA, "评分:<font color='%s'>%.1f</font>分", "#29d6fd", findApp.getScore())));
-                    updateView(activity, findApp, find_item_download);
-                } else {
-                    find_item_download.setVisibility(View.GONE);
-//                    find_item_pf_label.setVisibility(View.GONE);
-                }
-                ViewUtil.setText(find_item_name, item.getTitle());
-                ViewUtil.setTextTime(find_item_time, item.getCreated_at(), "yyyy-MM-dd");
-                ViewUtil.setImage(find_item_iv, item.getPictures());
-                ViewUtil.setText(find_item_des, item.getDes());
-                item.removeNullTag();
-                if (ListUtil.isEmpty(item.getTages())) {
-                    find_item_tags.setVisibility(View.GONE);
-                } else {
-                    find_item_tags.setVisibility(View.VISIBLE);
-                    TagAdapter adapter = new TagAdapter<ArticleTag>(item.getTages()) {
-                        @Override
-                        public View getView(FlowLayout parent, int position, ArticleTag item) {
-                            TextView tv = (TextView) LayoutInflater.from(activity).inflate(R.layout.find_item_tag, parent, false);
-                            ViewUtil.setText(tv, item.getName());
-                            return tv;
-                        }
-                    };
-                    find_item_tags.setAdapter(adapter);
-                }
-//                if(BuildConfig.DEBUG){
-//                    rootConvertView.setOnLongClickListener(new View.OnLongClickListener() {
-//                        @Override
-//                        public boolean onLongClick(View view) {
-//                            G.showToast(""+holder.getAdapterPosition());
-//                            return true;
-//                        }
-//                    });
-//                }
-                rootConvertView.setOnClickListener(new View.OnClickListener() {
-                    @Override
-                    public void onClick(View view) {
-                        onClickItem(item);
-                    }
-                });
-            }
-        };
+        return new CommonRecycler(list);
     }
 
     @Override
@@ -343,4 +268,114 @@ public class FgtFindChild extends BaseListFragment2<Article> {
             }
         }
     }
+
+    private class CommonRecycler extends AdbCommonRecycler<Article> {
+
+        private Converter commonConverter, newsConverter;
+
+        public CommonRecycler(List<Article> list) {
+            super(SheepApp.getInstance(), list);
+            commonConverter = new CommonConverter();
+            newsConverter = new NewsConverter();
+        }
+
+        @Override
+        public int getItemViewType(int position) {
+            Article article = list.get(position);
+            return article.getType();
+        }
+
+        @Override
+        public int getViewIdByType(int type) {//type来源于 getItemViewType 返回的值
+            if (type == 2) {
+                return R.layout.find_item_news;
+            }
+            return R.layout.find_item;
+        }
+
+        @Override
+        public void convert(final ViewHolder holder, final Article item) {
+            if (item == null) {
+                return;
+            }
+            if (item.getType() == 2) {
+                newsConverter.convert(holder, item);
+            } else {
+                commonConverter.convert(holder, item);
+            }
+        }
+    }
+
+    private class CommonConverter implements AdbCommonRecycler.Converter {
+
+        @Override
+        public void convert(final ViewHolder holder, final Article item) {
+            View rootConvertView = holder.itemView;
+            View padding = rootConvertView.findViewById(R.id.padding);
+            if (padding == null) {
+                return;
+            }
+            padding.setVisibility(holder.getAdapterPosition() == 1 ? View.GONE : View.VISIBLE);
+            TextView find_item_name = (TextView) rootConvertView.findViewById(R.id.find_item_name);
+            TextView find_item_time = (TextView) rootConvertView.findViewById(R.id.find_item_time);
+            ImageView find_item_iv = (ImageView) rootConvertView.findViewById(R.id.find_item_iv);
+            TextView find_item_des = (TextView) rootConvertView.findViewById(R.id.find_item_des);
+            TextView find_item_download = (TextView) rootConvertView.findViewById(R.id.find_item_download);
+            TagFlowLayout find_item_tags = (TagFlowLayout) rootConvertView.findViewById(R.id.find_item_tags);
+
+            if (item.isGame()) {
+                find_item_download.setVisibility(View.VISIBLE);
+                Applications findApp = item.getApplication();
+                updateView(activity, findApp, find_item_download);
+            } else {
+                find_item_download.setVisibility(View.GONE);
+            }
+            ViewUtil.setText(find_item_name, item.getTitle());
+            ViewUtil.setTextTime(find_item_time, item.getCreated_at(), "yyyy-MM-dd");
+            ViewUtil.setImage(find_item_iv, item.getPictures());
+            ViewUtil.setText(find_item_des, item.getDes());
+            item.removeNullTag();
+            if (ListUtil.isEmpty(item.getTages())) {
+                find_item_tags.setVisibility(View.GONE);
+            } else {
+                find_item_tags.setVisibility(View.VISIBLE);
+                TagAdapter adapter = new TagAdapter<ArticleTag>(item.getTages()) {
+                    @Override
+                    public View getView(FlowLayout parent, int position, ArticleTag item) {
+                        TextView tv = (TextView) LayoutInflater.from(activity).inflate(R.layout.find_item_tag, parent, false);
+                        ViewUtil.setText(tv, item.getName());
+                        return tv;
+                    }
+                };
+                find_item_tags.setAdapter(adapter);
+            }
+            rootConvertView.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View view) {
+                    onClickItem(item);
+                }
+            });
+        }
+    }
+
+    private class NewsConverter implements AdbCommonRecycler.Converter {
+
+        @Override
+        public void convert(ViewHolder holder, final Article item) {
+            View rootConvertView = holder.itemView;
+            TextView find_item_name = rootConvertView.findViewById(R.id.find_item_name);
+            TextView find_item_time = rootConvertView.findViewById(R.id.find_item_time);
+            ImageView find_item_iv = rootConvertView.findViewById(R.id.find_item_iv);
+            ViewUtil.setText(find_item_name, item.getTitle());
+            ViewUtil.setTextTime(find_item_time, item.getCreated_at(), "yyyy-MM-dd");
+            ViewUtil.setImage(find_item_iv, item.getPictures());
+            rootConvertView.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View view) {
+                    onClickItem(item);
+                }
+            });
+        }
+    }
+
 }

+ 3 - 0
app/src/main/java/org/afinal/simplecache/ApiKey.java

@@ -59,6 +59,9 @@ public class ApiKey {
     //足迹
     public static final String getUserFootPrintList = "app/user/footprint/list";
     public static final String getUserFootPrintDateCount = "app/user/footprint/date_count";
+    //每日分享
+    public static final String getShareList = "app/share/shares";
+    public static final String sendShareResult = "app/share/share";
     public static final String pageKeyUrl(String baseUrl, int page, int per_page){
         return String.format(Locale.CHINA, "%s?page=%d&per_page=%d", baseUrl, page, per_page);
     }

+ 5 - 0
app/src/main/res/drawable/shape_rect_gray_solid.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <solid android:color="@color/gray_F0F0F0"/>
+</shape>

+ 55 - 0
app/src/main/res/layout/find_item_news.xml

@@ -0,0 +1,55 @@
+<?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:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <RelativeLayout
+        android:id="@+id/find_item_container"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="@dimen/content_padding_10">
+
+        <TextView
+            android:id="@+id/find_item_name"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_toLeftOf="@+id/find_item_iv"
+            android:ellipsize="end"
+            android:maxLines="3"
+            android:minLines="2"
+            android:text="abcab"
+            android:textColor="@color/black_6_3"
+            android:textSize="15sp" />
+
+        <TextView
+            android:id="@+id/find_item_time"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@+id/find_item_name"
+            android:layout_marginTop="5dp"
+            android:layout_toLeftOf="@+id/find_item_iv"
+            android:text="@string/app_name"
+            android:textColor="#9B9B9B"
+            android:textSize="11sp" />
+
+        <ImageView
+            android:id="@+id/find_item_iv"
+            android:layout_width="106dp"
+            android:layout_height="60dp"
+            android:layout_alignParentRight="true"
+            android:layout_marginLeft="@dimen/content_padding_10"
+            android:adjustViewBounds="true"
+            android:scaleType="centerCrop"
+            android:src="@mipmap/icon" />
+
+    </RelativeLayout>
+
+    <View
+        android:background="@color/gray"
+        android:layout_marginLeft="@dimen/content_padding_10"
+        android:layout_marginRight="@dimen/content_padding_10"
+        android:layout_below="@+id/find_item_container"
+        android:layout_width="match_parent"
+        android:layout_height="1dp"/>
+</RelativeLayout>

+ 32 - 4
app/src/main/res/layout/item_every_day_share.xml

@@ -1,6 +1,34 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout
-    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
-    android:layout_height="match_parent">
+<RelativeLayout 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_marginTop="@dimen/dp_10"
+    android:layout_marginLeft="@dimen/dp_10"
+    android:layout_marginRight="@dimen/dp_10"
+    android:background="@drawable/shape_rect_gray_solid"
+    android:padding="@dimen/dp_10">
 
-</android.support.constraint.ConstraintLayout>
+    <TextView
+        android:id="@+id/share_item_title"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_toRightOf="@+id/share_item_iv"
+        android:ellipsize="end"
+        android:maxLines="3"
+        android:minLines="2"
+        android:text="abcab"
+        android:textColor="@color/black_6_3"
+        android:textSize="15sp" />
+
+    <ImageView
+        android:id="@+id/share_item_iv"
+        android:layout_width="75dp"
+        android:layout_height="75dp"
+        android:layout_marginRight="@dimen/content_padding_8"
+        android:adjustViewBounds="true"
+        android:scaleType="centerCrop"
+        android:src="@mipmap/icon" />
+
+</RelativeLayout>

+ 10 - 0
app/src/main/res/layout/item_text_tips.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/item_iv"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:padding="@dimen/content_padding_13"
+    android:text="点击文案分享到朋友圈等社交圈,可更好的邀新享受永久提成,分享领1毛钱红包"
+    android:textSize="15sp"
+    android:textColor="#9B9B9B"
+    android:background="@color/gray_F0F0F0"/>