Explorar o código

发现游戏详情中图片列表修改

zengjiebin %!s(int64=7) %!d(string=hai) anos
pai
achega
1d8ca4b038

+ 49 - 0
app/src/main/java/com/sheep/gamegroup/heler/ImageListHelper.java

@@ -0,0 +1,49 @@
+package com.sheep.gamegroup.heler;
+
+import android.app.Activity;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.ImageView;
+
+import com.bumptech.glide.Glide;
+import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
+import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.jiuyan.samllsheep.R;
+
+import java.util.ArrayList; /**
+ * Created by realicing on 2018/7/5.
+ * realicing@sina.com
+ */
+public class ImageListHelper {
+    private RecyclerViewAdapter mRecyclerViewAdapter;
+    public void initList(final Activity activity, final RecyclerView recyclerView, final ArrayList<String> pictureList) {
+        recyclerView.setVisibility(View.VISIBLE);
+        recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext(), LinearLayoutManager.HORIZONTAL, false));
+        recyclerView.setNestedScrollingEnabled(false);
+
+        mRecyclerViewAdapter = new RecyclerViewAdapter<String>(recyclerView.getContext(), R.layout.item_image, pictureList) {
+            @Override
+            public void convert(ViewHolder viewHolder, String url, final int position) {
+                View view = viewHolder.getView(R.id.img_detail);
+                if (view instanceof ImageView) {
+                    Glide.with(recyclerView.getContext()).load(url).into((ImageView) view);
+                    view.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            Jump2View.getInstance().showImgList(activity, position, pictureList);
+                        }
+                    });
+                }
+
+            }
+        };
+        recyclerView.setAdapter(mRecyclerViewAdapter);
+    }
+
+    public void notifyDataSetChanged() {
+        if(mRecyclerViewAdapter != null)
+            mRecyclerViewAdapter.notifyDataSetChanged();
+    }
+}

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/model/entity/FindApp.java

@@ -1,7 +1,7 @@
 package com.sheep.gamegroup.model.entity;
 
 import com.sheep.gamegroup.model.api.IDownload;
-import com.sheep.gamegroup.util.FindAppHelper;
+import com.sheep.gamegroup.heler.FindAppHelper;
 
 /**
  * Created by realicing on 2018/6/28.

+ 0 - 134
app/src/main/java/com/sheep/gamegroup/util/DownloadHelper.java

@@ -1,134 +0,0 @@
-package com.sheep.gamegroup.util;
-
-import android.app.Activity;
-import android.text.TextUtils;
-import android.view.View;
-import android.widget.TextView;
-
-import com.arialyy.aria.core.Aria;
-import com.arialyy.aria.core.download.DownloadTarget;
-import com.arialyy.aria.core.inf.IEntity;
-import com.kfzs.duanduan.datashare.provider.download.DownLoadInfo;
-import com.kfzs.duanduan.event.BigEvent;
-import com.kfzs.duanduan.event.EventTypes;
-import com.kfzs.duanduan.services.DownloadTaskService;
-import com.kfzs.duanduan.utils.ApkUtils;
-import com.sheep.gamegroup.model.api.IDownload;
-import com.sheep.gamegroup.view.activity.TaskDetailAct;
-import com.sheep.jiuyan.samllsheep.R;
-import com.sheep.jiuyan.samllsheep.utils.G;
-import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
-
-import org.greenrobot.eventbus.EventBus;
-
-import rx.functions.Action1;
-
-/**
- * Created by realicing on 2018/7/3.
- * realicing@sina.com
- * 下载游戏辅助类
- */
-public class DownloadHelper {
-    private int downLoadType;
-    /**
-     * 更新游戏下载与响应点击
-     * @param activity
-     * @param iTask
-     * @param down_tv
-     */
-    public void updateDownloadTaskView(final Activity activity, final IDownload iTask, final TextView down_tv) {
-        updateDownloadTaskView(activity, iTask, down_tv, null);
-    }
-    public void updateDownloadTaskView(final Activity activity, final IDownload iTask, final TextView down_tv, final Action1<Integer> callBack) {
-        if(mDownloadTaskService == null){
-            mDownloadTaskService = new DownloadTaskService(activity);
-        }
-        TaskDetailAct.setBtnStr(iTask, mDownloadTaskService, new Action1<Object>() {
-            @Override
-            public void call(Object o) {
-                if(o instanceof Integer){
-                    downLoadType = (int) o;
-                    if(callBack != null)
-                        callBack.call(downLoadType);
-                } else if( o instanceof String){
-                    down_tv.setText((String) o);
-                } else if( o instanceof Boolean){
-                    down_tv.setEnabled((Boolean) o);
-                }
-            }
-        });
-        down_tv.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                if(callBack != null)
-                    callBack.call(-1);
-                downloadApp(activity, iTask);
-            }
-        });
-    }
-
-    private DownloadTaskService mDownloadTaskService;
-    private DownloadTarget downloadTarget;
-    //下载应用
-    private void downloadApp(Activity activity, IDownload task) {
-        switch (downLoadType){
-            case DownloadTaskService.STATUS_INIT://可以下载
-                if(TextUtils.isEmpty(task.getDownload_link()) || !task.getDownload_link().contains("http")){
-                    G.showToast(R.string.error_download_link);
-                    return;
-                }
-                this.downloadTarget = Aria.download(activity).load(task.getDownload_link());
-                final DownLoadInfo downLoadInfo = mDownloadTaskService.getDownloadTaskByUrl(task);
-                if(this.downloadTarget != null) {
-                    if (this.downloadTarget.getTaskState() == IEntity.STATE_RUNNING) {
-                        this.downloadTarget.stop();
-                    } else if (this.downloadTarget.getTaskState() == IEntity.STATE_FAIL) {
-                        this.downloadTarget.cancel(true);
-                        this.downloadTarget.removeRecord();
-                    } else {
-                        mDownloadTaskService.start(downLoadInfo);
-                    }
-                    new Thread(new Runnable() {
-                        @Override
-                        public void run() {
-                            if(mDownloadTaskService.addDownloadTask(downLoadInfo)){//添加数据到数据库,可以在下载管理中看到
-                                //发送红点信息
-                                EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.TIPS_DOWN_ICON));
-                            }
-                        }
-                    }).start();
-                }
-                break;
-            case DownloadTaskService.STATUS_FINISH://已经下载完成,可以安装
-                String path = PackageUtil.isExistsFile(task.getPackage_names());
-                if(TextUtils.isEmpty(path)){//数据库保存有下载完成的状态,但是应用已经被删除,需要修复其下载状态
-                    if(TextUtils.isEmpty(task.getDownload_link()) || !task.getDownload_link().contains("http")){
-                        G.showToast(R.string.error_download_link);
-                        return;
-                    }
-                    this.downloadTarget = Aria.download(activity).load(task.getDownload_link());
-                    if(this.downloadTarget != null) {
-                        this.downloadTarget.cancel(true);
-                        this.downloadTarget.removeRecord();
-                        mDownloadTaskService.start(mDownloadTaskService.getDownloadTaskByUrl(task));
-                        mDownloadTaskService.setDownloadTaskStatus(task.getDownload_link(), DownloadTaskService.STATUS_INIT);
-                        downLoadType = DownloadTaskService.STATUS_INIT;
-                    }
-                } else {
-                    ApkUtils.installApk(activity, PackageUtil.isExistsFile(task.getPackage_names()));
-                }
-                break;
-            case DownloadTaskService.STATUS_INSTALLED://已经安装,可以试玩
-                PackageUtil.startApp(activity, task.getPackage_names());
-                break;
-        }
-    }
-
-    /**
-     * 更新下载状态
-     * @param status
-     */
-    public void updateState(int status) {
-        downLoadType = status;
-    }
-}

+ 0 - 111
app/src/main/java/com/sheep/gamegroup/util/FindAppHelper.java

@@ -1,111 +0,0 @@
-package com.sheep.gamegroup.util;
-
-import android.app.Activity;
-import android.view.Gravity;
-import android.view.View;
-import android.widget.TextView;
-
-import com.alibaba.fastjson.JSON;
-import com.kfzs.duanduan.services.DownloadTaskService;
-import com.sheep.gamegroup.model.api.IDownload;
-import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.DialogConfig;
-import com.sheep.gamegroup.model.entity.FindApp;
-import com.sheep.gamegroup.model.util.SheepSubscriber;
-import com.sheep.jiuyan.samllsheep.SheepApp;
-import com.sheep.jiuyan.samllsheep.utils.G;
-
-import java.util.Locale;
-
-import rx.android.schedulers.AndroidSchedulers;
-import rx.functions.Action1;
-import rx.schedulers.Schedulers;
-
-import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_APP;
-
-/**
- * Created by realicing on 2018/6/29.
- * realicing@sina.com
- */
-public class FindAppHelper{
-    private DownloadHelper downloadHelper = new DownloadHelper();
-
-    public void updateState(int status) {
-        downloadHelper.updateState(status);
-    }
-    public void updateDownloadTaskView(final Activity activity, final IDownload iTask, final TextView down_tv) {
-        downloadHelper.updateDownloadTaskView(activity, iTask, down_tv, new Action1<Integer>() {
-            @Override
-            public void call(Integer integer) {
-                if(DownloadTaskService.STATUS_INIT != integer){//-1 点击下载按钮的回调;其它状态直接回调不需要点击按钮
-                    if(iTask instanceof FindApp) {
-                        FindApp findApp = (FindApp) iTask;
-                        recordAppDownloads(activity, findApp, down_tv);
-                        FIND_APP.onEvent("application_id", findApp.getId(), "action", down_tv.getText());
-                    }
-                }
-            }
-        });
-    }
-
-    /**
-     * 更新预约下载状态与响应点击
-     * @param activity
-     * @param findApp
-     * @param reservation_tv
-     */
-    public void updateReservationView(final Activity activity, final FindApp findApp, final TextView reservation_tv) {
-        if(findApp.isCanRecord()) {
-            reservation_tv.setEnabled(true);
-            reservation_tv.setText("预约下载");
-            reservation_tv.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View view) {
-                    FIND_APP.onEvent("application_id", findApp.getId(), "action", "预约下载");
-                    reservation_tv.setEnabled(false);
-                    recordAppDownloads(activity, findApp, reservation_tv);
-                }
-            });
-        } else {
-            reservation_tv.setEnabled(false);
-            reservation_tv.setText("已经预约");
-        }
-    }
-
-
-    /**
-     * 点击预约下载与立即下载时,需要调用这个接口记录到服务器
-     * @param findApp
-     */
-    private void recordAppDownloads(final Activity activity, final FindApp findApp, final TextView textView) {
-        SheepApp.getInstance().getNetComponent().getApiService().recordAppDownloads(findApp.getId())
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        LogUtil.println("baseMessage onNext "+ JSON.toJSONString(baseMessage));
-                        findApp.setRecord(2);//设置为不可记录
-                        if(findApp.isCanDonload()){
-                            //提交下载成功
-                            textView.setEnabled(true);
-                        } else {//提交预约成功
-                            textView.setEnabled(false);
-                            textView.setText("已经预约");
-                            ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("预约成功")
-                                    .setMsg(String.format(Locale.CHINA, "请在%s准时到小绵羊下载哦", TimeUtil.TimeStamp2Date(findApp.getDownload_at(), "yyyy年MM月dd日HH时mm分")))
-                                    .setMsgGravity(Gravity.START).setBtnLeftText("我知道了"));
-                        }
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                        LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
-                        if(!findApp.isCanDonload()){
-                            G.showToast("预约失败");
-                        }
-                        textView.setEnabled(true);
-                    }
-                });
-    }
-}

+ 0 - 352
app/src/main/java/com/sheep/gamegroup/util/TaskHelper.java

@@ -1,352 +0,0 @@
-package com.sheep.gamegroup.util;
-
-import android.app.Activity;
-import android.text.TextUtils;
-import android.view.Gravity;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.alibaba.fastjson.JSON;
-import com.kfzs.duanduan.utils.NumberFormatUtils;
-import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.OrienteeringDetail;
-import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
-import com.sheep.gamegroup.model.entity.TaskEty;
-import com.sheep.gamegroup.model.entity.TaskReleaseEty;
-import com.sheep.gamegroup.model.util.SheepSubscriber;
-import com.sheep.jiuyan.samllsheep.R;
-import com.sheep.jiuyan.samllsheep.SheepApp;
-import com.sheep.jiuyan.samllsheep.utils.G;
-
-import java.util.Locale;
-
-import rx.android.schedulers.AndroidSchedulers;
-import rx.functions.Action1;
-import rx.schedulers.Schedulers;
-
-import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_TASK;
-
-/**
- * Created by realicing on 2018/7/3.
- * realicing@sina.com
- */
-public class TaskHelper {
-    private Action1<Integer> action1;
-    public TaskHelper(Action1<Integer> action1){
-        this.action1 = action1;
-    }
-
-    private TaskAcceptedEty taskAcceptedEty;
-    private int release_task_id;
-    private Activity activity;
-    public void initAcceptedTask(Activity activity, final int release_task_id) {
-        this.activity = activity;
-        this.release_task_id = release_task_id;
-        SheepApp.getInstance().getNetComponent().getApiService().getAcceptedTaskDetail(release_task_id)
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        LogUtil.println("baseMessage onNext "+ JSON.toJSONString(baseMessage));
-                        taskAcceptedEty = baseMessage.getData(TaskAcceptedEty.class);
-                        initTask(release_task_id);
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                        LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
-                        initTask(release_task_id);
-                    }
-                });
-    }
-    private TaskReleaseEty taskReleaseEty;
-    private void initTask(int release_task_id) {
-        SheepApp.getInstance().getNetComponent().getApiService().taskDesc(release_task_id)
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        LogUtil.println("baseMessage onNext "+JSON.toJSONString(baseMessage));
-                        taskReleaseEty = baseMessage.getData(TaskReleaseEty.class);
-                        if(action1 != null)
-                            action1.call(1);//刷新界面
-
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                        LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
-                    }
-                });
-    }
-    private OrienteeringDetail orienteeringDetail;
-    private void initGameTask(final View itemView, String third_task_id) {
-        SheepApp.getInstance().getNetComponent().getApiService().getMyGame(third_task_id)
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        LogUtil.println("baseMessage onNext "+JSON.toJSONString(baseMessage));
-                        orienteeringDetail = baseMessage.getData(OrienteeringDetail.class);
-                        loadTask(itemView);
-
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                        LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
-                    }
-                });
-    }
-
-    public boolean hasTask() {
-        return taskReleaseEty != null && taskReleaseEty.getTask() != null;
-    }
-
-    private RxjavaCountDownTimer timer;
-    public void loadTask(final View itemView) {
-        itemView.setVisibility(View.VISIBLE);
-        if(taskReleaseEty == null){
-            return;
-        }
-        final TaskEty taskEty = taskReleaseEty.getTask();
-        if(taskEty == null){
-            return;
-        }
-        ImageView find_information_game_icon = (ImageView)itemView.findViewById(R.id.find_information_game_icon);
-        TextView find_information_game_name = (TextView)itemView.findViewById(R.id.find_information_game_name);
-        TextView find_information_game_surplus = (TextView)itemView.findViewById(R.id.find_information_game_surplus);
-        TextView find_information_game_time = (TextView)itemView.findViewById(R.id.find_information_game_time);
-        TextView find_information_game_yuan = (TextView)itemView.findViewById(R.id.find_information_game_yuan);
-        TextView find_information_game_task0 = (TextView)itemView.findViewById(R.id.find_information_game_task0);
-        TextView find_information_game_task = (TextView)itemView.findViewById(R.id.find_information_game_task);
-        final TextView find_information_game_task_end_time = (TextView)itemView.findViewById(R.id.find_information_game_task_end_time);
-        if(orienteeringDetail != null){//已经完成的游戏任务
-            find_information_game_task.setVisibility(View.VISIBLE);
-            find_information_game_task0.setVisibility(View.VISIBLE);
-            find_information_game_yuan.setVisibility(View.INVISIBLE);
-            find_information_game_surplus.setText(String.format(Locale.CHINA, "可定向消费:%.1f元", orienteeringDetail.getBalance()));
-            find_information_game_surplus.setTextColor(activity.getResources().getColor(R.color.red_fd2d54));
-            find_information_game_task.setText("去充值");
-            find_information_game_task.setEnabled(true);
-            downloadHelper.updateDownloadTaskView(activity, taskEty, find_information_game_task0);
-            find_information_game_task.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View view) {
-                    ViewUtil.showGamePayAccount(activity, orienteeringDetail.getGame_id());
-                }
-            });
-            itemView.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View view) {
-                    reloadDataType = 1;//回来后将刷新界面数据 taskAcceptedEty
-                    Jump2View.getInstance().goGameTaskDetailView(activity,  release_task_id, orienteeringDetail.getGame_id(),1);
-                    UMConfigUtils.IdEvent.TASK.commit(release_task_id);
-                }
-            });
-            return;
-        }
-        GlideImageLoader.centerImage(find_information_game_icon, taskEty.getIcon());
-        ViewUtil.setText(find_information_game_name, taskReleaseEty.getName());
-        ViewUtil.setText(find_information_game_surplus, String.format(Locale.CHINA, "剩余%s份", taskReleaseEty.getLast_num()));
-        ViewUtil.setText(find_information_game_time, String.format(Locale.CHINA, "截止日期:%s", taskReleaseEty.getDeadline().equals("永久") ? taskReleaseEty.getDeadline() : TimeUtil.TimeStamp2Date(NumberFormatUtils.parseLong(taskReleaseEty.getDeadline()), "yyyy/MM/dd HH:mm")));
-        ViewUtil.setText(find_information_game_yuan, String.format(Locale.CHINA, "+%s元", taskReleaseEty.getBonus()));
-        find_information_game_task0.setVisibility(View.GONE);
-        find_information_game_yuan.setVisibility(View.VISIBLE);
-        switch (taskEty.getTask_type()) {// 1时间试玩任务 2 信用卡任务 3应用下载 4h5业务 1001畅思 1000连续任务, 1002 1003游戏任务
-            case 2://信用卡任务
-                find_information_game_task.setVisibility(View.GONE);
-                find_information_game_task_end_time.setVisibility(View.GONE);
-                find_information_game_yuan.setGravity(Gravity.END);
-                String[] remarks = new String[0];
-                if(!TextUtils.isEmpty(taskEty.getRemarks())) {
-                    remarks = taskEty.getRemarks().split(";");
-                }
-                find_information_game_time.setText(remarks.length > 0 ? remarks[0] : "");
-                find_information_game_surplus.setText(remarks.length > 1 ? remarks[1] : "");
-                itemView.setOnClickListener(new View.OnClickListener() {
-                    @Override
-                    public void onClick(View view) {
-                        Jump2View.getInstance().goCreditCardTaskDetail(activity, taskReleaseEty.getId());
-                    }
-                });
-                break;
-            case 1001:
-                break;
-            case 1://时间试玩任务
-            case 3://应用下载
-            case 4://h5业务
-            case 1000://连续任务
-            case 1002://游戏任务
-            case 1003://游戏任务
-            default:
-                find_information_game_yuan.setGravity(Gravity.CENTER);
-                if(taskAcceptedEty != null){
-                    switch (taskAcceptedEty.getStatus()) {
-                        case 1://"已接受任务";
-                        case 2:// "正在进行中";
-                            if(taskReleaseEty.getDeadline().equals("永久")){
-                                find_information_game_task_end_time.setVisibility(View.GONE);
-                            } else {
-                                find_information_game_task_end_time.setVisibility(View.VISIBLE);
-                                find_information_game_task_end_time.setText(TimeUtil.getHours(taskAcceptedEty.getEnd_time() * 1000));
-                                timer = RxjavaCountDownTimer.getInstance(taskAcceptedEty.getEnd_time())
-                                        .setOnTickListener(new RxjavaCountDownTimer.OnTickListener() {
-                                            @Override
-                                            public void onFinish() {
-                                                find_information_game_task_end_time.setVisibility(View.GONE);
-                                                refreshTask();
-                                            }
-
-                                            @Override
-                                            public void onTicker(long time) {
-                                                find_information_game_task_end_time.setText(TimeUtil.getHours(time * 1000));
-                                            }
-                                        }).start();
-                            }
-                            find_information_game_task.setText("取消任务");
-                            find_information_game_task.setEnabled(true);
-                            find_information_game_task.setOnClickListener(new View.OnClickListener() {
-                                @Override
-                                public void onClick(View view) {
-                                    FIND_TASK.onEvent("release_task_id", release_task_id, "action", "取消任务");
-                                    SheepApp.getInstance().getNetComponent().getApiService().giveUpTask(taskAcceptedEty.getId())
-                                            .subscribeOn(Schedulers.io())
-                                            .observeOn(AndroidSchedulers.mainThread())
-                                            .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                                                @Override
-                                                public void onNext(BaseMessage baseMessage) {
-                                                    LogUtil.println("baseMessage onNext "+JSON.toJSONString(baseMessage));
-                                                    refreshTask();
-                                                }
-
-                                                @Override
-                                                public void onError(BaseMessage baseMessage) {
-                                                    LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
-                                                    G.showToast(baseMessage);
-                                                }
-                                            });
-                                    //暂停下载
-                                    CommonUtil.getInstance().stopDownloadTask(activity, taskEty.getDownload_link());
-                                }
-                            });
-                            break;
-                        case 6://审核失败
-                            find_information_game_task_end_time.setVisibility(View.GONE);
-                            find_information_game_task.setVisibility(View.VISIBLE);
-                            find_information_game_task.setText("审核失败");
-                            find_information_game_task.setEnabled(false);
-                            break;
-                        //不可操作
-                        case 7:// "提交审核";
-                            find_information_game_task_end_time.setVisibility(View.GONE);
-                            find_information_game_task.setVisibility(View.VISIBLE);
-                            find_information_game_task.setText("正在审核");
-                            find_information_game_task.setEnabled(false);
-                            break;
-                        case 3://完成任务
-                            find_information_game_task_end_time.setVisibility(View.GONE);
-                            find_information_game_task.setVisibility(View.VISIBLE);
-                            find_information_game_task.setText("已经完成");
-                            find_information_game_task.setEnabled(false);
-                            if(taskEty.isGameTask()){
-                                initGameTask(itemView, taskEty.getThird_task_id());
-                            }
-                            break;
-                        case 8://任务已经下线
-                            find_information_game_task_end_time.setVisibility(View.GONE);
-                            find_information_game_task.setVisibility(View.VISIBLE);
-                            find_information_game_task.setText("已经下线");
-                            find_information_game_task.setEnabled(false);
-                            break;
-                        case 9:// "至少完成一个任务了";
-                        default:
-                            find_information_game_task_end_time.setVisibility(View.GONE);
-                            find_information_game_task.setVisibility(View.GONE);
-                            break;
-                    }
-                } else if(taskReleaseEty.isOffline()){//任务已经下线
-                    find_information_game_task_end_time.setVisibility(View.GONE);
-                    find_information_game_task.setVisibility(View.VISIBLE);
-                    find_information_game_task.setText("已经下线");
-                    find_information_game_task.setEnabled(false);
-                } else if("0".equals(taskReleaseEty.getLast_num())){
-                    find_information_game_task_end_time.setVisibility(View.GONE);
-                    find_information_game_task.setVisibility(View.VISIBLE);
-                    find_information_game_task.setText("任务已抢光");
-                    find_information_game_task.setEnabled(false);
-                } else {
-                    find_information_game_task_end_time.setVisibility(View.GONE);
-                    find_information_game_task.setVisibility(View.VISIBLE);
-                    find_information_game_task.setText("领取任务");
-                    find_information_game_task.setEnabled(true);
-                    find_information_game_task.setOnClickListener(new View.OnClickListener() {
-                        @Override
-                        public void onClick(View view) {
-                            taskEty.setRunTask(0);
-                            taskEty.setRelease_task_id(taskReleaseEty.getId());
-                            taskEty.setName(taskReleaseEty.getName());
-                            taskEty.setAcceptedTaskId(taskReleaseEty.getAccepted_task_id());
-                            Jump2View.getInstance().goDialogActivityView(activity, taskEty);
-                            FIND_TASK.onEvent("release_task_id", release_task_id, "action", "领取任务");
-                        }
-                    });
-                }
-                itemView.setOnClickListener(new View.OnClickListener() {
-                    @Override
-                    public void onClick(View view) {
-                        reloadDataType = 1;//回来后将刷新界面数据 taskAcceptedEty
-                        Jump2View.getInstance().goTaskDetailView(activity, release_task_id);
-                    }
-                });
-                break;
-        }
-    }
-
-    //刷新界面
-    public void refreshTask() {
-        clear();
-        taskAcceptedEty = null;
-        taskReleaseEty = null;
-        initAcceptedTask(activity, release_task_id);
-    }
-    private int reloadDataType;//0 不刷新数据 1刷新 taskAcceptedEty
-    public void onResume() {
-        switch (reloadDataType){
-            case 1:
-                refreshTask();
-                break;
-        }
-    }
-    /**
-     * 清理计时器
-     */
-    public void clear() {
-        if(timer != null)
-            timer.clear();
-        timer = null;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-    private DownloadHelper downloadHelper = new DownloadHelper();
-
-    public void updateState(int status) {
-        downloadHelper.updateState(status);
-    }
-
-}

+ 18 - 40
app/src/main/java/com/sheep/gamegroup/view/activity/ActFindGame.java

@@ -6,6 +6,8 @@ import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.design.widget.AppBarLayout;
 import android.support.v7.widget.AppCompatRatingBar;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
 import android.support.v7.widget.Toolbar;
 import android.text.TextUtils;
 import android.view.View;
@@ -23,10 +25,17 @@ import com.alibaba.fastjson.JSONObject;
 import com.arialyy.annotations.Download;
 import com.arialyy.aria.core.Aria;
 import com.arialyy.aria.core.download.DownloadTask;
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
+import com.bumptech.glide.request.RequestOptions;
+import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
+import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
+import com.kfzs.duanduan.fragment.FgtGameDetail;
 import com.kfzs.duanduan.services.DownloadTaskService;
 import com.kfzs.duanduan.utils.StatusBarUtils;
 import com.kfzs.duanduan.utils.dlg.HelperUtils;
 import com.sheep.gamegroup.absBase.BaseActivity;
+import com.sheep.gamegroup.heler.ImageListHelper;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.FindApp;
 import com.sheep.gamegroup.model.entity.FindAppScore;
@@ -56,6 +65,7 @@ import org.afinal.simplecache.ACache;
 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;
@@ -173,9 +183,6 @@ public class ActFindGame extends BaseActivity {
             }
         });
         txt_baseactivity_title.setVisibility(View.INVISIBLE);//不显示标题栏
-        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) homepage_item_banner_layout.getLayoutParams();
-        layoutParams.height = G.WIDTH / 2;
-        homepage_item_banner_layout.setLayoutParams(layoutParams);
         bindBanner();
         resetData();
         resetAppScoreNum();
@@ -293,43 +300,13 @@ public class ActFindGame extends BaseActivity {
     View status_height_view;
 
     //游戏banner图片
-    @BindView(R.id.viewpager_banner)
-    SheepViewPager viewpager_banner;
-    @BindView(R.id.group_banner)
-    RadioGroup group_banner;
-    private List<String> pictureList = ListUtil.emptyList();
-    private ImageGlarryDrawable<String> mImageGlarryStr;
-
-    private Conversion2<String, String, String> conversion2 = new Conversion2<String, String, String>() {
-        @Override
-        public String convert1(String title, int position) {
-            return BuildConfig.DEBUG ? "这里图片的比例为2:1" : null;
-        }
-
-        @Override
-        public String convert2(String url, int position) {
-            return url;
-        }
-    };
-    @BindView(R.id.homepage_item_banner_layout)
-    RelativeLayout homepage_item_banner_layout;
+    @BindView(R.id.find_game_list)
+    RecyclerView find_game_list;
+    private ArrayList<String> pictureList = ListUtil.emptyList();
+    private ImageListHelper imageListHelper = new ImageListHelper();
 
     private void bindBanner() {
-        homepage_item_banner_layout.setVisibility(View.VISIBLE);
-        if (mImageGlarryStr != null) {
-            mImageGlarryStr.init(pictureList, ImageView.ScaleType.CENTER_CROP, conversion2);
-            return;
-        }
-        mImageGlarryStr = new ImageGlarryDrawable<>(this, viewpager_banner, group_banner);
-        mImageGlarryStr.setSetBackGround(false);
-        final int radius = getResources().getDimensionPixelSize(R.dimen.dp_10);
-        mImageGlarryStr.setImageViewLoader(new ImageGlarryDrawable.ImageViewLoader() {
-            @Override
-            public void loadImageView(ImageView imageView, String url) {
-                ViewUtil.setImage(imageView, url, radius);
-            }
-        });
-        mImageGlarryStr.init(pictureList, ImageView.ScaleType.CENTER_CROP, conversion2);
+        imageListHelper.initList(this, find_game_list, pictureList);
     }
 
     //游戏简介与下载
@@ -364,9 +341,10 @@ public class ActFindGame extends BaseActivity {
         if (!TextUtils.isEmpty(pictures) && pictures.contains(";")) {
             pictureList.clear();
             ListUtil.addAll(pictureList, pictures.split(";"));
-            bindBanner();
+            find_game_list.setVisibility(View.VISIBLE);
+            imageListHelper.notifyDataSetChanged();
         } else {
-            homepage_item_banner_layout.setVisibility(View.GONE);
+            find_game_list.setVisibility(View.GONE);
         }
         //应用评分情况
         find_game_xin2.setRating(findApp.getScore() / 2);

+ 1 - 8
app/src/main/java/com/sheep/gamegroup/view/activity/ActFindInformation.java

@@ -13,7 +13,6 @@ import android.widget.ImageView;
 import android.widget.TextView;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.arialyy.annotations.Download;
 import com.arialyy.aria.core.Aria;
 import com.arialyy.aria.core.download.DownloadTask;
@@ -23,17 +22,13 @@ import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.FindApp;
 import com.sheep.gamegroup.model.entity.FindItem;
-import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
-import com.sheep.gamegroup.model.entity.TaskEty;
-import com.sheep.gamegroup.model.entity.TaskReleaseEty;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.LogUtil;
-import com.sheep.gamegroup.util.StringUtils;
 import com.sheep.gamegroup.util.SysAppUtil;
-import com.sheep.gamegroup.util.TaskHelper;
+import com.sheep.gamegroup.heler.TaskHelper;
 import com.sheep.gamegroup.util.TimeUtil;
 import com.sheep.gamegroup.util.ViewHolder;
 import com.sheep.gamegroup.util.ViewUtil;
@@ -42,10 +37,8 @@ import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
-import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 
-import org.afinal.simplecache.ACache;
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 

+ 4 - 20
app/src/main/res/layout/act_find_game.xml

@@ -38,28 +38,12 @@
                 android:layout_height="wrap_content"
                 android:orientation="vertical">
 
-                <RelativeLayout
-                    android:id="@+id/homepage_item_banner_layout"
+                <android.support.v7.widget.RecyclerView
+                    android:id="@+id/find_game_list"
                     android:layout_width="match_parent"
                     android:layout_height="200dp"
-                    android:layout_margin="@dimen/dp_10">
-
-
-                    <com.sheep.gamegroup.view.customview.SheepViewPager
-                        android:id="@+id/viewpager_banner"
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent" />
-
-                    <RadioGroup
-                        android:id="@+id/group_banner"
-                        android:layout_width="match_parent"
-                        android:layout_height="14dp"
-                        android:layout_alignParentBottom="true"
-                        android:layout_marginEnd="@dimen/content_padding_small"
-                        android:gravity="center"
-                        android:orientation="horizontal"
-                        android:paddingTop="4dp" />
-                </RelativeLayout>
+                    android:layout_marginTop="@dimen/dp_10"
+                    android:layout_marginBottom="@dimen/dp_10"/>
 
                 <LinearLayout
                     android:layout_width="match_parent"