Bläddra i källkod

添加手动上传

liujiangyao 8 år sedan
förälder
incheckning
ce17077c7d

+ 39 - 0
app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java

@@ -2,16 +2,20 @@ package com.kfzs.duanduan.fragment;
 
 import android.app.Activity;
 import android.content.Context;
+import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
+import android.support.v4.view.ViewPager;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.AdapterView;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
+import android.widget.RadioGroup;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
@@ -32,6 +36,7 @@ import com.sheep.gamegroup.model.entity.MoreDataEntity;
 import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.presenter.SmallSheepContract;
 import com.sheep.gamegroup.presenter.SmallSheepPresenter;
+import com.sheep.gamegroup.util.ImageGlarryDrawable;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.MyDbManager;
 import com.sheep.jiuyan.samllsheep.R;
@@ -69,6 +74,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
         initView();
         initListener();
         initData();
+        setBanner();//viewpager
     }
 
     @BindView(R.id.icon_img_iv)
@@ -93,6 +99,10 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
     LinearLayout invitationLayout;
     @BindView(R.id.lying_layout)
     LinearLayout lyingLayout;
+    @BindView(R.id.viewpager_banner)
+    ViewPager viewpager_banner;
+    @BindView(R.id.group_banner)
+    RadioGroup group_banner;
 
     @Inject
     SmallSheepPresenter pagePresenter;
@@ -357,4 +367,33 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
         super.onStart();
         Log.e("onAttach-----","");
     }
+    /**
+     * banner
+     */
+    private ImageGlarryDrawable mImageGlarry;
+    private void setBanner(){
+        ArrayList<Drawable> imgURL = new ArrayList<>();
+        imgURL.add(getResources().getDrawable(R.mipmap.couple_red_packets));
+        imgURL.add(getResources().getDrawable(R.mipmap.couple_red_packets));
+        if (mImageGlarry != null) {
+            mImageGlarry.init(imgURL.toArray(new Drawable[]{}), ImageView.ScaleType.CENTER_CROP);
+            return;
+        }
+        mImageGlarry = new ImageGlarryDrawable((Activity) mContext, viewpager_banner, group_banner);
+        mImageGlarry.init(imgURL.toArray(new Drawable[]{}), ImageView.ScaleType.CENTER_CROP);
+        mImageGlarry.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+
+                switch (position) {
+                    case 0:
+
+                        break;
+                    case 1:
+
+                        break;
+                }
+            }
+        });
+    }
 }

+ 16 - 0
app/src/main/java/com/sheep/gamegroup/di/components/TaskDetailComponent.java

@@ -0,0 +1,16 @@
+package com.sheep.gamegroup.di.components;
+
+import com.sheep.gamegroup.di.modules.TaskDetailModule;
+import com.sheep.gamegroup.di.scopes.UserScope;
+import com.sheep.gamegroup.view.activity.TaskDetailAct;
+
+import dagger.Component;
+
+/**
+ * Created by ljy on 2018/4/2.
+ */
+@UserScope
+@Component(modules = TaskDetailModule.class, dependencies = NetComponent.class)
+public interface TaskDetailComponent {
+    void inject(TaskDetailAct taskDetailAct);
+}

+ 22 - 0
app/src/main/java/com/sheep/gamegroup/di/modules/TaskDetailModule.java

@@ -0,0 +1,22 @@
+package com.sheep.gamegroup.di.modules;
+
+import com.sheep.gamegroup.presenter.TaskDetailContract;
+
+import dagger.Module;
+import dagger.Provides;
+
+/**
+ * Created by ljy on 2018/4/2.
+ */
+@Module
+public class TaskDetailModule {
+    private TaskDetailContract.View view;
+
+    public TaskDetailModule(TaskDetailContract.View view) {
+        this.view = view;
+    }
+    @Provides
+    public TaskDetailContract.View provideView(){
+        return view;
+    }
+}

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

@@ -210,6 +210,14 @@ public interface ApiService {
      */
     @POST(V1 + "/app/user/sms_for_bind_mobile")
     Observable<BaseMessage> smsBindMobile(@Body JSONObject jsonObject);
+    /**
+     * 修改任务进度
+     */
+//    @GET(V1 + "/app/accepted_task/status")
+//    Observable<BaseMessage> taskStatus(@Query("id") int id,@Query("screenshots") String screenshots,
+//        @Query("remark") String remark,@Query("package_name") String package_name,@Query("status") String status);
+    @GET(V1 + "/app/accepted_task/status")
+    Observable<BaseMessage> taskStatus(@Body JSONObject jsonObject);
 
 
 }

+ 57 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UploadResult.java

@@ -0,0 +1,57 @@
+package com.sheep.gamegroup.model.entity;
+
+
+/**
+ * Created by ljy on 2018/4/2.
+ */
+
+public class UploadResult {
+    private int status;
+    private String error;
+    private String error_message;
+    private Data data;
+
+    public int getStatus() {
+        return status;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public String getError() {
+        return error;
+    }
+
+    public void setError(String error) {
+        this.error = error;
+    }
+
+    public String getError_message() {
+        return error_message;
+    }
+
+    public void setError_message(String error_message) {
+        this.error_message = error_message;
+    }
+
+    public Data getData() {
+        return data;
+    }
+
+    public void setData(Data data) {
+        this.data = data;
+    }
+
+    public class Data {
+        private String url;
+
+        public String getUrl() {
+            return url;
+        }
+
+        public void setUrl(String url) {
+            this.url = url;
+        }
+    }
+}

+ 19 - 0
app/src/main/java/com/sheep/gamegroup/presenter/TaskDetailContract.java

@@ -0,0 +1,19 @@
+package com.sheep.gamegroup.presenter;
+
+import com.alibaba.fastjson.JSONObject;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+
+/**
+ * Created by ljy on 2018/4/2.
+ */
+
+public interface TaskDetailContract {
+    interface Presenter{
+        void taskStatus(JSONObject jsonObject);
+    }
+
+    interface View{
+        void taskStatusSuccess(BaseMessage baseMessage);
+        void taskStatusFaile(BaseMessage baseMessage);
+    }
+}

+ 47 - 0
app/src/main/java/com/sheep/gamegroup/presenter/TaskDetailPresenter.java

@@ -0,0 +1,47 @@
+package com.sheep.gamegroup.presenter;
+
+import com.alibaba.fastjson.JSONObject;
+import com.sheep.gamegroup.model.api.ApiService;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+import javax.inject.Inject;
+
+import rx.Scheduler;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+
+/**
+ * Created by ljy on 2018/4/2.
+ */
+
+public class TaskDetailPresenter implements TaskDetailContract.Presenter {
+    private ApiService apiService;
+    private TaskDetailContract.View view;
+
+    @Inject
+    public TaskDetailPresenter(ApiService apiService, TaskDetailContract.View view) {
+        this.apiService = apiService;
+        this.view = view;
+    }
+
+    @Override
+    public void taskStatus(JSONObject jsonObject) {
+        apiService.taskStatus(jsonObject)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        view.taskStatusFaile(baseMessage);
+                    }
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        view.taskStatusSuccess(baseMessage);
+                    }
+                });
+    }
+}

+ 226 - 0
app/src/main/java/com/sheep/gamegroup/util/ImageGlarryDrawable.java

@@ -0,0 +1,226 @@
+package com.sheep.gamegroup.util;
+
+import android.app.Activity;
+import android.graphics.drawable.Drawable;
+import android.os.Handler;
+import android.os.Message;
+import android.support.v4.view.PagerAdapter;
+import android.support.v4.view.ViewPager;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.request.RequestOptions;
+import com.kfzs.duanduan.view.ImageGlarry;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by ljy on 2018/4/2.
+ */
+
+public class ImageGlarryDrawable {
+    private Activity mActivity;
+    private ViewPager mViewPager;
+    private RadioGroup mRadioGroup;
+    private List<Drawable> mList = new ArrayList<>();
+    private int mIntDelayTime = 4000;
+    private List<ImageView> mListImages = new ArrayList<>();
+    private View mLastSelect;
+    private boolean mIsMoved = false;
+
+    public ImageGlarryDrawable(Activity activity, ViewPager viewPager, RadioGroup radioGroup) {
+        mActivity = activity;
+        mViewPager = viewPager;
+        mRadioGroup = radioGroup;
+    }
+
+
+    public void setmIntDelayTime(int mIntDelayTime) {
+        this.mIntDelayTime = mIntDelayTime;
+    }
+
+    public ImageGlarryDrawable init(Drawable[] pics) {
+        return init(pics, ImageView.ScaleType.CENTER_INSIDE);
+    }
+
+    /**
+     * 初始化组件
+     *
+     * @param pics 图片Url完整地址。
+     */
+    public ImageGlarryDrawable init(Drawable[] pics, ImageView.ScaleType scaleType) {
+        int pos = 0;
+        mList.clear();
+        mListImages.clear();
+        mLastSelect = null;
+        mRadioGroup.removeAllViews();
+        //防止loading图案被放得很大很大
+        for (Drawable pic : pics) {
+            mList.add(pic);
+            ImageView imageView = new ImageView(mActivity);
+            imageView.setOnClickListener(new ImageGlarryDrawable.cls_main(pos));
+            imageView.setScaleType(scaleType);
+            Glide.with(mActivity).load(pic).apply(new RequestOptions().dontAnimate()).into(imageView);
+            mListImages.add(imageView);
+
+
+            RadioButton radioButton = (RadioButton) View.inflate(mActivity, R.layout.rbt_dot, null);
+            mRadioGroup.addView(radioButton);
+            LinearLayout.LayoutParams layoutParams = new LinearLayout
+                    .LayoutParams(G.getRealPix(5
+            ), G.getRealPix(5));
+            layoutParams.setMargins(G.getRealPix(2), 0, G.getRealPix(2), 0);
+            radioButton.setLayoutParams(layoutParams);
+//            radioButton.setButtonDrawable(null);
+//            radioButton.setBackgroundResource(R.drawable.sel_circle_dot);
+
+            if (pos == 0) {
+                selectPosition(0);
+            }
+            pos = pos + 1;
+        }
+
+        if (mList.size() > 1) {//有两张或以上图片,开始轮播
+            if (!mIsMoved) {
+                mIsMoved = true;
+                handler.sendEmptyMessageDelayed(0, mIntDelayTime);
+            }
+            //handler.sendEmptyMessageDelayed(1, mIntDelayTime);
+        } else if (mList.size() == 1) {//如果只有一个或没有,就隐藏Group
+            mRadioGroup.setVisibility(View.GONE);
+        } else {//说明是空的。
+            mViewPager.setBackgroundColor(mActivity.getResources().getColor(R.color.white));
+            return this;
+        }
+
+        mViewPager.setAdapter(pagerAdapter);
+        mViewPager.setCurrentItem(0);
+        mViewPager.addOnPageChangeListener(onPageChangeListener);
+        return this;
+    }
+
+    /**
+     * 设置当前选中项
+     *
+     * @param position
+     */
+    private void selectPosition(int position) {
+        mLastSelect = mRadioGroup.getChildAt(position);
+        mRadioGroup.check(mLastSelect.getId());
+        LinearLayout.LayoutParams layoutParams = new LinearLayout
+                .LayoutParams(G.getRealPix(10
+        ), G.getRealPix(5));
+        layoutParams.setMargins(G.getRealPix(2), 0, G.getRealPix(2), 0);
+        mRadioGroup.getChildAt(position).setLayoutParams(layoutParams);
+    }
+
+    private Handler handler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            super.handleMessage(msg);
+            if (mActivity.isFinishing() || mList.size() < 2) {
+                return;
+            }
+            if (mViewPager.getCurrentItem() >= mList.size() - 1) {
+                mViewPager.setCurrentItem(0, true);
+            } else {
+                mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1, true);
+            }
+            sendEmptyMessageDelayed(0, mIntDelayTime);
+        }
+    };
+
+    /**
+     * 选取
+     */
+    private ViewPager.OnPageChangeListener onPageChangeListener = new ViewPager.OnPageChangeListener() {
+        @Override
+        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+
+        }
+
+        /**
+         * 改变dot的宽度等操作
+         * @param position
+         */
+        @Override
+        public void onPageSelected(int position) {
+            if (mLastSelect != null) {
+                LinearLayout.LayoutParams layoutParams = new LinearLayout
+                        .LayoutParams(G.getRealPix(5
+                ), G.getRealPix(5));
+                layoutParams.setMargins(G.getRealPix(2), 0, G.getRealPix(2), 0);
+                mLastSelect.setLayoutParams(layoutParams);
+            }
+            selectPosition(position);
+        }
+
+        @Override
+        public void onPageScrollStateChanged(int state) {
+
+        }
+    };
+
+
+    /**
+     * ViewPager
+     */
+    private PagerAdapter pagerAdapter = new PagerAdapter() {
+        @Override
+        public int getCount() {
+            return mList.size();
+        }
+
+        @Override
+        public boolean isViewFromObject(View view, Object object) {
+            return view.equals(object);
+        }
+
+        @Override
+        public void destroyItem(ViewGroup container, int position, Object object) {
+            container.removeView(mListImages.get(position));
+        }
+
+        @Override
+        public Object instantiateItem(ViewGroup container, int position) {
+            container.addView(mListImages.get(position));
+            return mListImages.get(position);
+        }
+    };
+
+
+    private AdapterView.OnItemClickListener onItemClickListener;
+
+    /**
+     * 设置点击回调,回调仅回传View和position
+     *
+     * @param onItemClickListener
+     */
+    public void setOnItemClickListener(AdapterView.OnItemClickListener onItemClickListener) {
+        this.onItemClickListener = onItemClickListener;
+    }
+
+    private class cls_main implements View.OnClickListener {
+        private int position = 0;
+
+        public cls_main(int pos) {
+            position = pos;
+        }
+
+        @Override
+        public void onClick(View v) {
+            if (onItemClickListener != null) {
+                onItemClickListener.onItemClick(null, v, position, 0);
+            }
+        }
+    }
+}

+ 339 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailAct.java

@@ -0,0 +1,339 @@
+package com.sheep.gamegroup.view.activity;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.provider.MediaStore;
+import android.support.annotation.RequiresApi;
+import android.text.TextUtils;
+import android.view.View;
+import android.webkit.WebChromeClient;
+import android.webkit.WebResourceRequest;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.kfzs.appstore.utils.string.HexUtils;
+import com.kfzs.duanduan.react.upfile.UpFileListener;
+import com.kfzs.duanduan.react.upfile.UpFileUtils;
+import com.sheep.gamegroup.absBase.BaseActivity;
+import com.sheep.gamegroup.di.components.DaggerTaskDetailComponent;
+import com.sheep.gamegroup.di.modules.TaskDetailModule;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.TaskEty;
+import com.sheep.gamegroup.model.entity.UploadResult;
+import com.sheep.gamegroup.presenter.TaskDetailContract;
+import com.sheep.gamegroup.presenter.TaskDetailPresenter;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.view.dialog.DialogShowLoading;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.page.WebActivity;
+import com.sheep.jiuyan.samllsheep.utils.G;
+import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
+
+import java.io.File;
+
+import javax.inject.Inject;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+import go.kfzssafe.Kfzssafe;
+import me.iwf.photopicker.PhotoPicker;
+
+/**
+ * 任务详情页面
+ * Created by ljy on 2018/4/2.
+ */
+
+public class TaskDetailAct extends BaseActivity implements TaskDetailContract.View, UpFileListener {
+
+    @BindView(R.id.icon_iv)
+    ImageView iconIv;
+    @BindView(R.id.name_tv)
+    TextView nameTv;
+    @BindView(R.id.date_tv)
+    TextView dateTv;
+    @BindView(R.id.price_tv)
+    TextView priceTv;
+    @BindView(R.id.detail_task_tv)
+    TextView detailTaskTv;
+    @BindView(R.id.web_text)
+    WebView webText;
+    @BindView(R.id.ll_infos)
+    LinearLayout llInfos;
+    @BindView(R.id.btn_task_item)
+    TextView btnTaskItem;
+    @BindView(R.id.btn_up_imag)
+    TextView btnUpImag;
+    @BindView(R.id.bottom_btn_layout)
+    LinearLayout bottom_btn_layout;
+    private Activity activity;
+    @Inject
+    TaskDetailPresenter presenter;
+
+    private TaskEty taskEty;
+    private DialogShowLoading dialogShowLoading;
+
+    /**
+     * 上传进度
+     */
+    private boolean isUpload = true;
+    public void showChooseDialog() {
+        showChooseDialog(true, true);
+    }
+
+    public void showChooseDialog(boolean isCrop, boolean isUpload) {
+        this.isUpload = isUpload;
+        PhotoPicker.builder()
+                .setPhotoCount(1)
+                .setShowCamera(true)
+                .setShowGif(false)
+                .setPreviewEnabled(false)
+                .start(this, PhotoPicker.REQUEST_CODE);
+    }
+
+    @Override
+    protected int getLayoutId() {
+        return R.layout.task_detail_layout;
+    }
+
+    @Override
+    public void initView() {
+        activity = this;
+        taskEty = (TaskEty) getIntent().getSerializableExtra("task_enty");
+        DaggerTaskDetailComponent.builder()
+                .netComponent(SheepApp.get(activity).getNetComponent())
+                .taskDetailModule(new TaskDetailModule(this))
+                .build()
+                .inject(this);
+        TitleBarUtils.getInstance()
+                .setTitle(activity, "任务详情")
+                .setTitleFinish(activity);
+    }
+
+    @Override
+    public void initListener() {
+
+    }
+
+    @Override
+    public void initData() {
+        if(taskEty == null){
+            G.showToast("网络异常,请稍候再试");
+//            finish();
+            return;
+        }
+        webText.setWebChromeClient(new WebChromeClient(){
+
+        });
+        webText.getSettings().setJavaScriptEnabled(true);
+        webText.setWebViewClient(new WebViewClient(){
+            @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
+            @Override
+            public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
+                view.loadUrl(request.getUrl().toString());
+                return true;
+            }
+        });
+        webText.loadUrl(taskEty.getDownload_link());
+
+        if (taskEty.getRunTask() == 1){
+            detailTaskTv.setVisibility(View.VISIBLE);
+            bottom_btn_layout.setVisibility(View.VISIBLE);
+        }else {
+            detailTaskTv.setVisibility(View.INVISIBLE);
+            bottom_btn_layout.setVisibility(View.GONE);
+
+        }
+        if (PackageUtil.isAppInstalled(SheepApp.mContext, taskEty.getPackage_names())) {
+            btnTaskItem.setText("开始游戏");
+        } else {
+            btnTaskItem.setText("下载游戏");
+        }
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        // TODO: add setContentView(...) invocation
+        ButterKnife.bind(this);
+    }
+
+    @OnClick({R.id.detail_task_tv, R.id.web_text, R.id.ll_infos, R.id.btn_task_item, R.id.btn_up_imag})
+    public void onViewClicked(View view) {
+        switch (view.getId()) {
+            case R.id.detail_task_tv://查看任务截图
+                Intent intent = new Intent(activity, WebActivity.class);
+                intent.putExtra(WebActivity.INTENT_URL, taskEty.getScreenshots());
+                intent.putExtra(WebActivity.INTENT_TITLE, "任务提交示意");
+                startActivity(intent);
+                break;
+            case R.id.web_text:
+                break;
+            case R.id.ll_infos:
+                break;
+            case R.id.btn_task_item:
+                if (PackageUtil.isAppInstalled(SheepApp.mContext, taskEty.getPackage_names())) {
+                    PackageUtil.startApp(SheepApp.mContext, taskEty.getPackage_names());
+                } else {
+                    Jump2View.getInstance().goDialogActivityView(activity, taskEty);
+                }
+                break;
+            case R.id.btn_up_imag:
+                uploadImag();
+                break;
+        }
+    }
+
+    /**
+     * 任务进度
+     */
+    private void taskSchedule(){
+        llInfos.removeAllViews();
+        if (taskEty != null) {
+            int thisRun = taskEty.getRunTask();
+            if (thisRun == 1) {//接受了任务
+                llInfos.addView(getStep("领取任务", "已完成", 0));
+                if (PackageUtil.isAppInstalled(SheepApp.mContext, taskEty.getPackage_names())) {
+                    llInfos.addView(getStep("下载游戏", "已完成", 0));
+                    llInfos.addView(getStep("完成任务", "进行中", 1));
+                } else {
+                    llInfos.addView(getStep("下载游戏", "待完成", 2));
+                }
+            } else {
+                llInfos.addView(getStep("领取任务", "待完成", 2));
+            }
+        } else {
+            llInfos.addView(getStep("领取任务", "待完成", 2));
+        }
+    }
+
+
+    private View getStep(String step, String state, int color) {
+        View view = View.inflate(this, R.layout.task_step_info, null);
+        ImageView img = (ImageView) view.findViewById(R.id.img_tab);
+        TextView tvStep = (TextView) view.findViewById(R.id.tv_step);
+        TextView tvStatus = (TextView) view.findViewById(R.id.tv_status);
+        if (color == 0) {
+            img.setImageResource(R.drawable.garden_green);
+            tvStep.setTextColor(getResources().getColor(R.color.green));
+            tvStatus.setTextColor(getResources().getColor(R.color.green));
+        } else if (color == 1) {
+            img.setImageResource(R.drawable.garden_yellow);
+            tvStep.setTextColor(getResources().getColor(R.color.yellow_text_light));
+            tvStatus.setTextColor(getResources().getColor(R.color.yellow_text_light));
+        } else {
+            img.setImageResource(R.drawable.garden_gray);
+            tvStep.setTextColor(getResources().getColor(R.color.black_text_gray));
+            tvStatus.setTextColor(getResources().getColor(R.color.black_text_gray));
+        }
+
+        tvStep.setText(step);
+        tvStatus.setText(state);
+        return view;
+    }
+
+    /**
+     * update file
+     */
+    private void uploadImag() {
+        Intent intent = new Intent(Intent.ACTION_PICK,
+                android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
+        startActivityForResult(intent, 1);
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+
+        //获取图片路径
+        if (requestCode == 1 && resultCode == Activity.RESULT_OK && data != null) {
+            Uri selectedImage = data.getData();
+            String[] filePathColumns = {MediaStore.Images.Media.DATA};
+            Cursor c = getContentResolver().query(selectedImage, filePathColumns, null, null, null);
+            c.moveToFirst();
+            int columnIndex = c.getColumnIndex(filePathColumns[0]);
+            String imagePath = c.getString(columnIndex);
+            if (isUpload) {
+                dialogShowLoading = DialogShowLoading.showDialog(activity);
+                UpFileUtils.upImage(new File(imagePath), TaskDetailAct.this);
+           }
+            c.close();
+        }
+    }
+
+    @Override
+    public void taskStatusSuccess(BaseMessage baseMessage) {
+        dialogShowLoading.getTextView().setText("完成");
+//                            onGetNetImageUrl(data);
+        dialogShowLoading.getAlertDialog().dismiss();
+
+    }
+
+    @Override
+    public void taskStatusFaile(BaseMessage baseMessage) {
+        updateError("失败");
+
+    }
+
+    @Override
+    public void Success(String msg) {
+        String json;
+        if (TextUtils.isEmpty(msg)) {
+            updateError("失败");
+            return;
+        }
+        if (msg.startsWith("{")) {
+            json = msg;
+        } else {
+            try {
+                byte[] bytes = HexUtils.hexStr2Bytes(msg);
+                byte[] byteDecode = Kfzssafe.XByteDecode(bytes);
+                json = new String(byteDecode);
+            } catch (Exception e) {
+                e.printStackTrace();
+                updateError("失败");
+                return;
+            }
+        }
+        UploadResult uploadResult = JSON.parseObject(json, UploadResult.class);
+        if (uploadResult != null) {
+            final String data = uploadResult.getData().getUrl();
+            dialogShowLoading.getTextView().setText("更新中");
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("id", taskEty.getRelease_task_id());
+            jsonObject.put("screenshots",taskEty.getScreenshots()+"");
+            jsonObject.put("remark",taskEty.getRemarks()+"");
+            jsonObject.put("package_name",taskEty.getPackage_names()+"");
+            jsonObject.put("status",7+"");
+            presenter.taskStatus(jsonObject);
+        }
+    }
+    private void updateError(String msg) {
+        dialogShowLoading.getTextView().setText(msg);
+//        onNotGetImage(msg);
+        dialogShowLoading.getAlertDialog().dismiss();
+    }
+
+    @Override
+    public void Progress(String progress) {
+        dialogShowLoading.getTextView().setText(progress);
+        dialogShowLoading.getTextView().append("%");
+
+    }
+
+    @Override
+    public void Failure(String err) {
+        G.showToast(err);
+    }
+}

+ 13 - 0
app/src/main/java/com/sheep/gamegroup/view/adapter/TryMakeMoneyAdp.java

@@ -132,6 +132,12 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                 ((TextView)viewHolder.itemView.findViewById(R.id.item_anem_tv)).setText(etyList.get(i).getName()+"");
                 ((TextView)viewHolder.itemView.findViewById(R.id.item_num_tv)).setText("剩余"+ etyList.get(i).getLast_num()+"份");
                 ((TextView)viewHolder.itemView.findViewById(R.id.item_money)).setText("+"+ etyList.get(i).getBonus() +"元");
+                ((TextView)viewHolder.itemView.findViewById(R.id.detail_task_tv)).setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        G.showToast("任务详情");
+                    }
+                });
                 Glide.with(context)
                         .load(etyList.get(i).getTask().getIcon()+"")
                         .apply(new RequestOptions().placeholder(R.mipmap.x_ic_def_head))
@@ -169,6 +175,7 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
         TextView item_num_tv = holder.getView(R.id.item_num_tv);
         TextView item_money = holder.getView(R.id.item_money);
         TextView cancel_task_tv = holder.getView(R.id.cancel_task_tv);
+        TextView detail_task_tv = holder.getView(R.id.detail_task_tv);
         Glide.with(context)
                 .load(acceptedEty.getRelease_task().getTask().getIcon()+"")
                 .apply(new RequestOptions().placeholder(R.mipmap.x_ic_def_head).dontAnimate())
@@ -182,6 +189,12 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                 presenter.giveUpTask(acceptedEty.getId());
             }
         });
+        detail_task_tv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                G.showToast("任务详情");
+            }
+        });
         holder.itemView.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {

+ 21 - 1
app/src/main/res/layout/homepage_act_layout.xml

@@ -117,7 +117,27 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:padding="@dimen/content_padding_10"
-                android:src="@mipmap/couple_red_packets"  />
+                android:src="@mipmap/couple_red_packets"
+                android:visibility="gone"/>
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+                <android.support.v4.view.ViewPager
+                    android:id="@+id/viewpager_banner"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:minHeight="@dimen/app_group_height_120" />
+
+                <RadioGroup
+                    android:id="@+id/group_banner"
+                    android:layout_width="match_parent"
+                    android:layout_height="14dp"
+                    android:layout_alignParentBottom="true"
+                    android:gravity="center"
+                    android:orientation="horizontal"
+                    android:paddingTop="4dp"></RadioGroup>
+            </RelativeLayout>
 
             <LinearLayout
                 android:layout_width="match_parent"

+ 172 - 0
app/src/main/res/layout/task_detail_layout.xml

@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/bg_gray"
+    android:orientation="vertical">
+
+    <include
+        layout="@layout/title"/>
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+        <ScrollView
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:scrollbars="none">
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:orientation="vertical">
+                <RelativeLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:background="@drawable/x_shap_shadow_bg_rectgangle_white"
+                    android:padding="@dimen/content_padding_10"
+                    android:layout_margin="@dimen/content_padding_10">
+                    <RelativeLayout
+                        android:id="@+id/item_layout"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content">
+                        <ImageView
+                            android:id="@+id/icon_iv"
+                            android:layout_width="@dimen/view_size_60"
+                            android:layout_height="@dimen/view_size_60"
+                            android:src="@mipmap/ic_launcher"
+                            android:layout_centerVertical="true"/>
+
+                        <RelativeLayout
+                            android:id="@+id/name_date_layout"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_toRightOf="@+id/icon_iv"
+                            android:layout_marginLeft="@dimen/content_padding"
+                            android:layout_centerVertical="true">
+                            <TextView
+                                android:id="@+id/name_tv"
+                                style="@style/nomal_txt_style"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:text="完成试玩任务无敌大航海"/>
+
+                            <TextView
+                                android:id="@+id/date_tv"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:text="2018/02/14 14:41"
+                                android:layout_below="@+id/name_tv"
+                                android:textSize="@dimen/text_size_3"
+                                android:textColor="@color/txt_black_818181"
+                                android:layout_marginTop="@dimen/content_padding_10"/>
+                        </RelativeLayout>
+
+                        <TextView
+                            android:id="@+id/price_tv"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text="+1.5元"
+                            android:textColor="@color/txt_red"
+                            android:textSize="@dimen/text_size_15"
+                            android:layout_centerVertical="true"
+                            android:layout_toRightOf="@+id/name_date_layout"
+                            android:layout_marginLeft="@dimen/content_padding_10"
+                            android:layout_alignParentRight="true"
+                            android:gravity="right"/>
+                    </RelativeLayout>
+                    <TextView
+                        android:id="@+id/detail_task_tv"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="任务截图"
+                        android:minWidth="@dimen/view_size_73"
+                        android:textColor="@color/white"
+                        android:textSize="@dimen/text_size_12"
+                        android:gravity="center"
+                        android:padding="@dimen/content_padding_3"
+                        android:layout_alignParentRight="true"
+                        android:layout_below="@+id/item_layout"
+                        android:background="@drawable/sp_bg_gradient_rectangle_yellow"
+                        android:layout_alignParentBottom="true"/>
+                </RelativeLayout>
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="@drawable/x_shap_shadow_bg_rectgangle_white"
+                    android:padding="@dimen/content_padding_20"
+                    android:layout_margin="@dimen/content_padding_10"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:text="任务说明"
+                        style="@style/nomal_txt_style"
+                        android:layout_marginBottom="@dimen/content_padding_small"/>
+
+                    <WebView
+                        android:id="@+id/web_text"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content">
+
+                    </WebView>
+                </LinearLayout>
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="@drawable/x_shap_shadow_bg_rectgangle_white"
+                    android:padding="@dimen/content_padding_20"
+                    android:layout_margin="@dimen/content_padding_10"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:text="任务进度"
+                        style="@style/nomal_txt_style"
+                        android:layout_marginBottom="@dimen/content_padding_small"/>
+
+                    <LinearLayout
+                        android:id="@+id/ll_infos"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:orientation="vertical">
+
+                    </LinearLayout>
+                </LinearLayout>
+            </LinearLayout>
+        </ScrollView>
+
+
+        <LinearLayout
+            android:id="@+id/bottom_btn_layout"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:minHeight="@dimen/layout_heigh_default"
+            android:background="@color/background_light_gray"
+            android:orientation="horizontal"
+            android:layout_alignParentBottom="true">
+
+            <TextView
+                android:id="@+id/btn_task_item"
+                style="@style/style_button"
+                android:layout_width="0dp"
+                android:layout_height="35dp"
+                android:layout_weight="1"
+                android:text="下载游戏"/>
+
+            <TextView
+                android:id="@+id/btn_up_imag"
+                style="@style/style_button"
+                android:layout_width="0dp"
+                android:layout_height="35dp"
+                android:layout_weight="1"
+                android:text="上传截图"/>
+        </LinearLayout>
+    </RelativeLayout>
+
+
+
+</LinearLayout>

+ 15 - 2
app/src/main/res/layout/try_makemoney_item.xml

@@ -71,11 +71,24 @@
             android:id="@+id/item_money"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text=""
+            android:text="14"
             android:textSize="18dp"
             android:textColor="@color/txt_red"
-            android:layout_centerVertical="true"
             android:layout_alignParentRight="true"/>
+        <TextView
+            android:id="@+id/detail_task_tv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="任务详情"
+            android:minWidth="@dimen/view_size_73"
+            android:textColor="@color/white"
+            android:textSize="@dimen/text_size_12"
+            android:gravity="center"
+            android:padding="@dimen/content_padding_3"
+            android:layout_alignParentRight="true"
+            android:layout_below="@+id/item_money"
+            android:layout_marginTop="@dimen/content_padding_small"
+            android:background="@drawable/sp_bg_gradient_rectangle_yellow"/>
     </RelativeLayout>
     <TextView
         android:id="@+id/line_tv"

+ 14 - 1
app/src/main/res/layout/try_makemoney_item_recommend.xml

@@ -60,8 +60,21 @@
             android:text=""
             android:textSize="18dp"
             android:textColor="@color/txt_red"
-            android:layout_centerVertical="true"
             android:layout_alignParentRight="true"/>
+        <TextView
+            android:id="@+id/detail_task_tv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="任务详情"
+            android:minWidth="@dimen/view_size_73"
+            android:textColor="@color/white"
+            android:textSize="@dimen/text_size_12"
+            android:gravity="center"
+            android:padding="@dimen/content_padding_3"
+            android:layout_alignParentRight="true"
+            android:layout_below="@+id/item_money"
+            android:layout_marginTop="@dimen/content_padding_small"
+            android:background="@drawable/sp_bg_gradient_rectangle_yellow"/>
     </RelativeLayout>
     <TextView
         android:id="@+id/line_tv"

+ 1 - 0
app/src/main/res/values/common.xml

@@ -109,6 +109,7 @@
     <dimen name="view_size_40">40dp</dimen>
     <dimen name="view_size_45">45dp</dimen>
     <dimen name="view_size_60">60dp</dimen>
+    <dimen name="view_size_73">73dp</dimen>
     <dimen name="view_size_80">80dp</dimen>
     <dimen name="view_size_160">160dp</dimen>
 

+ 1 - 1
kfzslibrary/build.gradle

@@ -1,6 +1,6 @@
 apply plugin: 'com.android.library'
 //使用aop插件
-//apply plugin: 'com.aop.plugin'
+apply plugin: 'com.aop.plugin'
 
 android {
     compileSdkVersion androidConfigs.compileSdkVersion