<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.github.barteksc.pdfviewer.PDFView;
import com.github.barteksc.pdfviewer.listener.OnLoadCompleteListener;
import com.github.barteksc.pdfviewer.listener.OnPageChangeListener;
import com.github.barteksc.pdfviewer.listener.OnPageErrorListener;
import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle;
import com.github.barteksc.pdfviewer.util.FitPolicy;
import com.shockwave.pdfium.PdfDocument;
import com.zhang.baselib.BaseApplication;
import com.zhang.okinglawenforcementphone.R;

import java.util.List;

/**
 * 案例库
 */
public class PuttedForwardFragment extends Fragment implements OnPageChangeListener, OnLoadCompleteListener, OnPageErrorListener {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    Integer pageNumber = 0;
    private PDFView mPdfView;
    private View mInflate;

    public PuttedForwardFragment() {
        // Required empty public constructor
    }

    public static PuttedForwardFragment newInstance(String param1, String param2) {
        PuttedForwardFragment fragment = new PuttedForwardFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (mInflate ==null){
            mInflate = inflater.inflate(R.layout.fragment_putted_forward, container, false);

        }
        initView(mInflate);
        return mInflate;
    }


    public void initView(View rootView) {
       final RecyclerView rc = rootView.findViewById(R.id.rc);
        mPdfView = rootView.findViewById(R.id.pdfView);

        mPdfView.fromAsset("case1.pdf")
                .defaultPage(pageNumber)
                .onPageChange(this)
                .enableAnnotationRendering(true)
                .onLoad(this)
                .scrollHandle(new DefaultScrollHandle(BaseApplication.getApplictaion()))
                .spacing(10) // in dp
                .onPageError(this)
                .pageFitPolicy(FitPolicy.BOTH)
                .load();



    }

    @Override
    public void onPageChanged(int page, int pageCount) {
        pageNumber = page;
//        setTitle(String.format("%s %s / %s", pdfFileName, page + 1, pageCount));
    }


    @Override
    public void loadComplete(int nbPages) {
//        PdfDocument.Meta meta = mPdfView.getDocumentMeta();

        printBookmarksTree(mPdfView.getTableOfContents(), "-");
    }

    @Override
    public void onPageError(int page, Throwable t) {

    }

    public void printBookmarksTree(List<PdfDocument.Bookmark> tree, String sep) {
        for (PdfDocument.Bookmark b : tree) {


            if (b.hasChildren()) {
                printBookmarksTree(b.getChildren(), sep + "-");
            }
        }
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;

/**
 * Created by Administrator on 2018/5/18/018.
 */
@Entity
public class GreenSearchHistory {
    @Id(autoincrement = true)
    private Long id;
    private String userId;
    private String searchText;
    private Long time;
    @Generated(hash = 298392090)
    public GreenSearchHistory(Long id, String userId, String searchText,
            Long time) {
        this.id = id;
        this.userId = userId;
        this.searchText = searchText;
        this.time = time;
    }
    @Generated(hash = 918844437)
    public GreenSearchHistory() {
    }
    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getUserId() {
        return this.userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
    public String getSearchText() {
        return this.searchText;
    }
    public void setSearchText(String searchText) {
        this.searchText = searchText;
    }
    public Long getTime() {
        return this.time;
    }
    public void setTime(Long time) {
        this.time = time;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.presenter;

import com.zhang.okinglawenforcementphone.beans.GreenMissionLog;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.mvp.contract.GetHttpMissionLogContract;
import com.zhang.okinglawenforcementphone.mvp.model.GetHttpMissionLogModel;

import java.io.File;

/**
 * Created by Administrator on 2018/4/23/023.
 */

public class GetHttpMissionLogPresenter implements GetHttpMissionLogContract.Presenter {
    private GetHttpMissionLogContract.View mView;
    private GetHttpMissionLogContract.Model mModel;

    public GetHttpMissionLogPresenter(GetHttpMissionLogContract.View view) {
        mView = view;
        mModel = new GetHttpMissionLogModel(this);
    }

    @Override
    public void getHttpMissionLog(GreenMissionTask mission) {
        mModel.getHttpMissionLog(mission);
    }

    @Override
    public void loadHttpMissionLogSucc(GreenMissionLog greenMissionLog) {
        mView.loadHttpMissionLogSucc(greenMissionLog);

    }


    @Override
    public void loadEmpty(GreenMissionLog greenMissionLog) {
        mView.loadEmpty(greenMissionLog);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

import com.google.gson.annotations.SerializedName;

import java.util.List;

/**
 * Created by Administrator on 2018/1/18.
 */

public class ReceptionStaffBean {

    private List<ALLUSERBean> ALLUSER;
    private List<CBRBean> CBR;
    private List<SZJCBean> SZJC;
    @SerializedName("null")
    private List<NullBean> _$Null65; // FIXME check this code
    private List<SubCBRBean> subCBR;
    private List<SubSZJCBean> subSZJC;

    public List<ALLUSERBean> getALLUSER() {
        return ALLUSER;
    }

    public void setALLUSER(List<ALLUSERBean> ALLUSER) {
        this.ALLUSER = ALLUSER;
    }

    public List<CBRBean> getCBR() {
        return CBR;
    }

    public void setCBR(List<CBRBean> CBR) {
        this.CBR = CBR;
    }

    public List<SZJCBean> getSZJC() {
        return SZJC;
    }

    public void setSZJC(List<SZJCBean> SZJC) {
        this.SZJC = SZJC;
    }

    public List<NullBean> get_$Null65() {
        return _$Null65;
    }

    public void set_$Null65(List<NullBean> _$Null65) {
        this._$Null65 = _$Null65;
    }

    public List<SubCBRBean> getSubCBR() {
        return subCBR;
    }

    public void setSubCBR(List<SubCBRBean> subCBR) {
        this.subCBR = subCBR;
    }

    public List<SubSZJCBean> getSubSZJC() {
        return subSZJC;
    }

    public void setSubSZJC(List<SubSZJCBean> subSZJC) {
        this.subSZJC = subSZJC;
    }

    public static class ALLUSERBean {
        /**
         * DEPTID : 001001
         * DEPTNAME : 广东省水利厅水利水政监察局
         * REMARK : CBR
         * USERID : d97863e57c7b4f8ba30262d932b36645
         * USERNAME : 周  磊
         * ZFZH : O116030
         */

        private String DEPTID;
        private String DEPTNAME;
        private String REMARK;
        private String USERID;
        private String USERNAME;
        private String ZFZH;

        public String getDEPTID() {
            return DEPTID;
        }

        public void setDEPTID(String DEPTID) {
            this.DEPTID = DEPTID;
        }

        public String getDEPTNAME() {
            return DEPTNAME;
        }

        public void setDEPTNAME(String DEPTNAME) {
            this.DEPTNAME = DEPTNAME;
        }

        public String getREMARK() {
            return REMARK;
        }

        public void setREMARK(String REMARK) {
            this.REMARK = REMARK;
        }

        public String getUSERID() {
            return USERID;
        }

        public void setUSERID(String USERID) {
            this.USERID = USERID;
        }

        public String getUSERNAME() {
            return USERNAME;
        }

        public void setUSERNAME(String USERNAME) {
            this.USERNAME = USERNAME;
        }

        public String getZFZH() {
            return ZFZH;
        }

        public void setZFZH(String ZFZH) {
            this.ZFZH = ZFZH;
        }
    }

    public static class CBRBean {
        /**
         * DEPTID : 001001
         * DEPTNAME : 广东省水利厅水利水政监察局
         * REMARK : CBR
         * USERID : d97863e57c7b4f8ba30262d932b36645
         * USERNAME : 周  磊
         * ZFZH : O116030
         */

        private String DEPTID;
        private String DEPTNAME;
        private String REMARK;
        private String USERID;
        private String USERNAME;
        private String ZFZH;

        public String getDEPTID() {
            return DEPTID;
        }

        public void setDEPTID(String DEPTID) {
            this.DEPTID = DEPTID;
        }

        public String getDEPTNAME() {
            return DEPTNAME;
        }

        public void setDEPTNAME(String DEPTNAME) {
            this.DEPTNAME = DEPTNAME;
        }

        public String getREMARK() {
            return REMARK;
        }

        public void setREMARK(String REMARK) {
            this.REMARK = REMARK;
        }

        public String getUSERID() {
            return USERID;
        }

        public void setUSERID(String USERID) {
            this.USERID = USERID;
        }

        public String getUSERNAME() {
            return USERNAME;
        }

        public void setUSERNAME(String USERNAME) {
            this.USERNAME = USERNAME;
        }

        public String getZFZH() {
            return ZFZH;
        }

        public void setZFZH(String ZFZH) {
            this.ZFZH = ZFZH;
        }
    }

    public static class SZJCBean {
        /**
         * DEPTID : 001001
         * DEPTNAME : 广东省水利厅水利水政监察局
         * REMARK : SZJC
         * USERID : 4b7d309839db41e18a3439623c4fdf1d
         * USERNAME : 张立强
         * ZFZH : O078035
         */

        private String DEPTID;
        private String DEPTNAME;
        private String REMARK;
        private String USERID;
        private String USERNAME;
        private String ZFZH;

        public String getDEPTID() {
            return DEPTID;
        }

        public void setDEPTID(String DEPTID) {
            this.DEPTID = DEPTID;
        }

        public String getDEPTNAME() {
            return DEPTNAME;
        }

        public void setDEPTNAME(String DEPTNAME) {
            this.DEPTNAME = DEPTNAME;
        }

        public String getREMARK() {
            return REMARK;
        }

        public void setREMARK(String REMARK) {
            this.REMARK = REMARK;
        }

        public String getUSERID() {
            return USERID;
        }

        public void setUSERID(String USERID) {
            this.USERID = USERID;
        }

        public String getUSERNAME() {
            return USERNAME;
        }

        public void setUSERNAME(String USERNAME) {
            this.USERNAME = USERNAME;
        }

        public String getZFZH() {
            return ZFZH;
        }

        public void setZFZH(String ZFZH) {
            this.ZFZH = ZFZH;
        }
    }

    public static class NullBean {
        /**
         * DEPTID : 001001
         * DEPTNAME : 广东省水利厅水利水政监察局
         * USERID : f0624a37baef40798a216654d3900ae6
         * USERNAME : 王春海
         * ZFZH : O110454
         */

        private String DEPTID;
        private String DEPTNAME;
        private String USERID;
        private String USERNAME;
        private String ZFZH;

        public String getDEPTID() {
            return DEPTID;
        }

        public void setDEPTID(String DEPTID) {
            this.DEPTID = DEPTID;
        }

        public String getDEPTNAME() {
            return DEPTNAME;
        }

        public void setDEPTNAME(String DEPTNAME) {
            this.DEPTNAME = DEPTNAME;
        }

        public String getUSERID() {
            return USERID;
        }

        public void setUSERID(String USERID) {
            this.USERID = USERID;
        }

        public String getUSERNAME() {
            return USERNAME;
        }

        public void setUSERNAME(String USERNAME) {
            this.USERNAME = USERNAME;
        }

        public String getZFZH() {
            return ZFZH;
        }

        public void setZFZH(String ZFZH) {
            this.ZFZH = ZFZH;
        }
    }

    public static class SubCBRBean {
        /**
         * DEPTID : 001001029001
         * DEPTNAME : 研发中心测试大队
         * REMARK : CBR
         * USERID : 8aac8d5f5<KEY>
         * USERNAME : DEV队长
         * ZFZH : dev12345
         */

        private String DEPTID;
        private String DEPTNAME;
        private String REMARK;
        private String USERID;
        private String USERNAME;
        private String ZFZH;

        public String getDEPTID() {
            return DEPTID;
        }

        public void setDEPTID(String DEPTID) {
            this.DEPTID = DEPTID;
        }

        public String getDEPTNAME() {
            return DEPTNAME;
        }

        public void setDEPTNAME(String DEPTNAME) {
            this.DEPTNAME = DEPTNAME;
        }

        public String getREMARK() {
            return REMARK;
        }

        public void setREMARK(String REMARK) {
            this.REMARK = REMARK;
        }

        public String getUSERID() {
            return USERID;
        }

        public void setUSERID(String USERID) {
            this.USERID = USERID;
        }

        public String getUSERNAME() {
            return USERNAME;
        }

        public void setUSERNAME(String USERNAME) {
            this.USERNAME = USERNAME;
        }

        public String getZFZH() {
            return ZFZH;
        }

        public void setZFZH(String ZFZH) {
            this.ZFZH = ZFZH;
        }
    }

    public static class SubSZJCBean {
        /**
         * DEPTID : 001001029001
         * DEPTNAME : 研发中心测试大队
         * REMARK : SZJC
         * USERID : 8aac8d5f586ac00<KEY>bb7050d
         * USERNAME : DEV队长
         * ZFZH : dev12345
         */

        private String DEPTID;
        private String DEPTNAME;
        private String REMARK;
        private String USERID;
        private String USERNAME;
        private String ZFZH;

        public String getDEPTID() {
            return DEPTID;
        }

        public void setDEPTID(String DEPTID) {
            this.DEPTID = DEPTID;
        }

        public String getDEPTNAME() {
            return DEPTNAME;
        }

        public void setDEPTNAME(String DEPTNAME) {
            this.DEPTNAME = DEPTNAME;
        }

        public String getREMARK() {
            return REMARK;
        }

        public void setREMARK(String REMARK) {
            this.REMARK = REMARK;
        }

        public String getUSERID() {
            return USERID;
        }

        public void setUSERID(String USERID) {
            this.USERID = USERID;
        }

        public String getUSERNAME() {
            return USERNAME;
        }

        public void setUSERNAME(String USERNAME) {
            this.USERNAME = USERNAME;
        }

        public String getZFZH() {
            return ZFZH;
        }

        public void setZFZH(String ZFZH) {
            this.ZFZH = ZFZH;
        }
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.github.mikephil.charting.animation.EasingFunction;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.data.PieEntry;
import com.github.mikephil.charting.formatter.PercentFormatter;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.sundeepk.compactcalendarview.CompactCalendarView;
import com.zhang.baselib.BaseApplication;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.StatisRcyAdapter;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTaskDao;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;
import com.zhang.okinglawenforcementphone.utils.DialogUtil;
import com.zhang.okinglawenforcementphone.views.DividerItemDecoration;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * 统计查询
 */
public class StatisticalActivity extends BaseActivity {

    @BindView(R.id.tv_title)
    TextView mTvTitle;
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.calendar_title)
    TextView calendarTitle;
    @BindView(R.id.materialcalendarview2)
    CompactCalendarView materialcalendarview;
    @BindView(R.id.chart)
    PieChart mChart;
    private Unbinder mBind;
    private SimpleDateFormat mDateFormat = new SimpleDateFormat("yyyy年MM月");
    private SimpleDateFormat mDateFormatForDay = new SimpleDateFormat("yyyy年MM月dd日");
    private String mSelectMonth;
    private List<GreenMissionTask> mGreenMissionTasks;
    private ArrayList<GreenMissionTask>mCompleteMissionTask = new ArrayList<>();
    private ArrayList<GreenMissionTask>mUnfinishedMissionTask = new ArrayList<>();
    private String mSelectDate;
    private DialogUtil mDialogUtil;
    private StatisRcyAdapter mStatisRcyAdapter;
    private View mStatisView;
    private Intent intent;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_statistical);
        mBind = ButterKnife.bind(this);
        initData();
        setListener();
    }

    private void setListener() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        materialcalendarview.setListener(new CompactCalendarView.CompactCalendarViewListener() {
            @Override
            public void onDayClick(Date dateClicked) {
                mSelectDate = mDateFormatForDay.format(dateClicked);
                mChart.setCenterText(mSelectDate);
                getMissionTaskPie(-1);
            }

            @Override
            public void onMonthScroll(Date firstDayOfNewMonth) {
                mSelectMonth = mDateFormat.format(firstDayOfNewMonth);
                calendarTitle.setText(mSelectMonth);
                mChart.setCenterText(mSelectMonth);
                getMissionTaskPie(0);
            }
        });
        mChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
            @Override
            public void onValueSelected(Entry e, Highlight h) {
                List<GreenMissionTask> greenMissionTasks = (List<GreenMissionTask>) e.getData();
                if (mDialogUtil ==null){
                    mDialogUtil = new DialogUtil();
                    mStatisView = View.inflate(BaseApplication.getApplictaion(), R.layout.statistical_dialog, null);
                    RecyclerView rcyStatis = mStatisView.findViewById(R.id.rcy_statis);
                    rcyStatis.setLayoutManager(new LinearLayoutManager(BaseApplication.getApplictaion(), LinearLayoutManager.VERTICAL, false));
                    rcyStatis.addItemDecoration(new DividerItemDecoration(BaseApplication.getApplictaion(), 0, 10, getResources().getColor(R.color.activity_bg)));
                    mStatisRcyAdapter = new StatisRcyAdapter(R.layout.statistical_dialog_item,greenMissionTasks);
                    mStatisRcyAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
                    rcyStatis.setAdapter(mStatisRcyAdapter);
                    mStatisRcyAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
                        @Override
                        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                            List<GreenMissionTask> data = adapter.getData();
                            GreenMissionTask greenMissionTask = data.get(position);
                            switch (greenMissionTask.getStatus()){
                                case "0":

                                case "1":

                                case "2":
                                    intent = new Intent(StatisticalActivity.this, ArrangeTeamMembersActivity.class);
                                    intent.putExtra("id", greenMissionTask.getId());
                                    intent.putExtra("position", position);
                                    startActivity(intent);
                                    break;
                                case "3":

                                case "4":
                                case "100":
                                    intent = new Intent(StatisticalActivity.this, MissionActivity.class);
                                    intent.putExtra("id", greenMissionTask.getId());
                                    intent.putExtra("position", position);
                                    startActivity(intent);
                                    break;
                                case "5":
                                    intent = new Intent(StatisticalActivity.this, MissionRecorActivity.class);
                                    intent.putExtra("id", greenMissionTask.getId());
                                    intent.putExtra("taskId", greenMissionTask.getTaskid());
                                    startActivity(intent);
                                    break;
                                case "9":
                                    intent = new Intent(StatisticalActivity.this, MissionActivity.class);
                                    intent.putExtra("id", greenMissionTask.getId());
                                    intent.putExtra("position", position);
                                    startActivity(intent);
                                    break;
                                default:
                                    break;

                            }
                        }
                    });
                }else {
                    mStatisRcyAdapter.setNewData(greenMissionTasks);
                }
                mDialogUtil.showBottomDialog(StatisticalActivity.this,mStatisView,400f);
            }


            @Override
            public void onNothingSelected() {

            }
        });

    }

    private void initData() {
        materialcalendarview.setFirstDayOfWeek(Calendar.SUNDAY);
        materialcalendarview.setLocale(TimeZone.getDefault(), Locale.getDefault());
        materialcalendarview.setUseThreeLetterAbbreviation(true);
        Date date = new Date();
        materialcalendarview.setCurrentDate(date);
        mSelectMonth = mDateFormat.format(date);
        calendarTitle.setText(mSelectMonth);


        mChart.setUsePercentValues(true);
        mChart.getDescription().setEnabled(false);
        mChart.setCenterTextSize(16f);
        mChart.setCenterText(mSelectMonth);

        mChart.setDrawHoleEnabled(true);
        mChart.setHoleColor(Color.WHITE);
        moveOffScreen();

        mChart.setTransparentCircleColor(Color.WHITE);
        mChart.setTransparentCircleAlpha(110);

        mChart.setHoleRadius(58f);
        mChart.setTransparentCircleRadius(61f);

        mChart.setDrawCenterText(true);

        mChart.setRotationEnabled(false);
        mChart.setHighlightPerTapEnabled(true);

        mChart.setMaxAngle(180f); // HALF CHART
        mChart.setRotationAngle(180f);
        mChart.setCenterTextOffset(0, -20);
        mGreenMissionTasks = GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao().queryBuilder()
                .where(GreenMissionTaskDao.Properties.Userid.eq(OkingContract.CURRENTUSER.getUserid())).list();
        getMissionTaskPie(0);



        mChart.animateY(1400, EaseInOutQuad);

        Legend l = mChart.getLegend();
        l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
        l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
        l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
        l.setDrawInside(false);
        l.setXEntrySpace(7f);
        l.setYEntrySpace(0f);
        l.setYOffset(0f);

        // entry label styling
        mChart.setEntryLabelColor(Color.WHITE);
        mChart.setEntryLabelTextSize(12f);

    }

    private void getMissionTaskPie(int type) {
        mCompleteMissionTask.clear();
        mUnfinishedMissionTask.clear();

        for (GreenMissionTask greenMissionTask : mGreenMissionTasks) {
            Log.i("GG",greenMissionTask.getEnd_time()+"");
            Long end_time = greenMissionTask.getEnd_time();
            if (type==0){

               String yearMonth = mDateFormat.format(end_time);
                if (mSelectMonth.equals(yearMonth)) {
                    if (greenMissionTask.getStatus().equals("5") || greenMissionTask.getStatus().equals("100")) {
                        mCompleteMissionTask.add(greenMissionTask);
                    } else {
                        mUnfinishedMissionTask.add(greenMissionTask);
                    }

                }

            }else {
                String yearDay = mDateFormatForDay.format(end_time);
                if (mSelectDate.equals(yearDay)) {
                    if (greenMissionTask.getStatus().equals("5") || greenMissionTask.getStatus().equals("100")) {
                        mCompleteMissionTask.add(greenMissionTask);
                    } else {
                        mUnfinishedMissionTask.add(greenMissionTask);
                    }

                }
            }
        }
        setData(mCompleteMissionTask, mUnfinishedMissionTask);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mDateFormat = null;
        mBind.unbind();
    }

    private void setData(ArrayList<GreenMissionTask> completeMissionTask, ArrayList<GreenMissionTask> unfinishedMissionTask) {

        ArrayList<PieEntry> values = new ArrayList<PieEntry>();

        PieEntry completePieEntry = new PieEntry(completeMissionTask.size(), "完成" + completeMissionTask.size());
        completePieEntry.setData(completeMissionTask);
        values.add(completePieEntry);
        PieEntry unfinishedPieEntry = new PieEntry(unfinishedMissionTask.size(), "未完成" + unfinishedMissionTask.size());
        unfinishedPieEntry.setData(unfinishedMissionTask);
        values.add(unfinishedPieEntry);

        PieDataSet dataSet = new PieDataSet(values, "");
        dataSet.setSliceSpace(3f);
        dataSet.setSelectionShift(5f);

        dataSet.setColors(ColorTemplate.MATERIAL_COLORS);
        //dataSet.setSelectionShift(0f);

        PieData data = new PieData(dataSet);
        data.setValueFormatter(new PercentFormatter());
        data.setValueTextSize(11f);
        data.setValueTextColor(Color.WHITE);
        mChart.setData(data);

        mChart.invalidate();
    }


    public static final EasingFunction EaseInOutQuad = new EasingFunction() {
        public float getInterpolation(float input) {
            input *= 2f;

            if (input < 1f) {
                return 0.5f * input * input;
            }

            return -0.5f * ((--input) * (input - 2f) - 1f);
        }
    };

    private void moveOffScreen() {

        Display display = getWindowManager().getDefaultDisplay();
        int height = display.getHeight();  // deprecated

        int offset = (int) (height * 0.30); /* percent to move */

        RelativeLayout.LayoutParams rlParams =
                (RelativeLayout.LayoutParams) mChart.getLayoutParams();
        rlParams.setMargins(0, 0, 0, -offset);
        mChart.setLayoutParams(rlParams);
    }

}
<file_sep>package com.zhang.baselib.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by Administrator on 2018/4/18.
 */

public class NetUtil {
    /**
     * 判断网络是否连接
     * 需添加权限
     *
     * @code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     */
    public static boolean isConnected(Context context) {
        NetworkInfo info = getActiveNetworkInfo(context);
        return info != null && info.isConnected();
    }

    /**
     * 获取活动网络信息
     *
     * @param context 上下文
     * @return NetworkInfo
     */
    private static NetworkInfo getActiveNetworkInfo(Context context) {
        ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        return cm.getActiveNetworkInfo();
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.content.Intent;
import android.net.Uri;
import android.support.v4.app.Fragment;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.GlideApp;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenEvidenceMedia;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.PlayVideoOnlineActivity;

import java.util.ArrayList;


/**
 * Created by zhao on 2016/10/9.
 */

public class CaseSimpleAdapter extends BaseAdapter {

    private ArrayList<GreenEvidenceMedia> greenMedias;
    private OnClickListener onClickListener;
    private Fragment f;
    private boolean canAdd;
    private String typeName;

    public CaseSimpleAdapter(ArrayList<GreenEvidenceMedia> greenMedias, Fragment f, boolean canAdd, String typeName) {
        this.greenMedias = greenMedias;
        this.f = f;
        this.canAdd = canAdd;
        this.typeName = typeName;
    }


    public void setOnClickListener(OnClickListener onClickListener) {
        this.onClickListener = onClickListener;
    }

    @Override
    public int getCount() {
        return greenMedias.size()+1;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup viewGroup) {
        ViewHolder viewHolder;
        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView =  View.inflate(BaseApplication.getApplictaion(), R.layout.pic_item,null);
            viewHolder.iv_pic = convertView.findViewById(R.id.sdv);
            viewHolder.tv = (TextView) convertView.findViewById(R.id.tv);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        if (position == 0) {
            viewHolder.tv.setVisibility(View.GONE);
            GlideApp.with(f)
                    .load(R.drawable.video)
                    .into(viewHolder.iv_pic);

            if (canAdd) {
                viewHolder.iv_pic .setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (onClickListener != null) {
                            onClickListener.onAddVideo();
                        }
                    }
                });
            }


        } else {
            viewHolder.tv.setVisibility(View.VISIBLE);
            final Uri uri = Uri.parse(greenMedias.get(position - 1).getPath());

            GlideApp.with(f)
                    .load(uri)
                    .into(viewHolder.iv_pic);

            viewHolder.iv_pic .setOnLongClickListener(new View.OnLongClickListener() {
                @Override
                public boolean onLongClick(View v) {
                    if (onClickListener != null && canAdd) {
                        onClickListener.onLongItemClick(CaseSimpleAdapter.this, greenMedias, position - 1);
                    }
//                    bitmapCache.remove(uri);
                    return false;
                }
            });
            viewHolder.iv_pic .setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(f.getActivity(), PlayVideoOnlineActivity.class);
                    intent.putExtra("path",uri.getPath());
                    f.startActivity(intent);
                }
            });
            String path = uri.getPath();

            String s = path.substring(path.lastIndexOf("/") + 1, path.length());
            viewHolder.tv.setText(s.split("_")[0]+typeName);
        }

        return convertView;

    }

    public interface OnClickListener {
        void onAddVideo();

        void onLongItemClick(CaseSimpleAdapter adapter, ArrayList<GreenEvidenceMedia> data, int position);
    }

    class ViewHolder{
        ImageView iv_pic;
        TextView tv;
    }
}
<file_sep>apply plugin: 'com.android.library'
android {
    compileSdkVersion 27



    defaultConfig {
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = [moduleName: project.getName()]
            }
        }
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}


dependencies {
    implementation 'com.android.support:appcompat-v7:27.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'io.reactivex.rxjava2:rxjava:2.1.1'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'org.greenrobot:greendao:3.2.2'
    compile 'com.github.bumptech.glide:glide:4.7.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
    //加密
    compile 'net.zetetic:android-database-sqlcipher:3.5.6'
    compile files('libs/commons-lang3-3.0-beta.jar')
    compile 'com.apkfuns.logutils:library:1.0.6'
    compile 'org.greenrobot:eventbus:3.1.1'
    compile 'com.jaeger.statusbarutil:library:1.5.1'

}<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.app.Activity;
import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import android.support.design.widget.TextInputEditText;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;

import com.baidu.ocr.sdk.model.IDCardResult;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.ui.views.RxDialogLoading;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.baselib.utils.AppUtil;
import com.zhang.baselib.utils.FileUtil;
import com.zhang.baselib.utils.TextUtil;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.WrittenItemBean;
import com.zhang.okinglawenforcementphone.beans.WrittenRecordLevel0;

import java.io.File;
import java.util.Calendar;
import java.util.List;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Administrator on 2018/5/11/011.
 */

public class ExpandableStopIllegalAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity, BaseViewHolder> {
    public static final int TYPE_LEVEL_0 = 0;
    public static final int TYPE_LEVEL_1 = 1;
    public static final int TYPE_LEVEL_2 = 2;
    public static final int TYPE_LEVEL_3 = 3;
    private RadioButton mRb_natural_person;
    private TextInputEditText mTet_parties_concerned_natural;
    private TextInputEditText mTet_sex_natural;
    private TextInputEditText mTet_card_natural;
    private TextInputEditText mTet_phone_natural;
    private TextInputEditText mTet_address_natural;
    private TextInputEditText mTet_parties_concerned_other;
    private TextInputEditText mTet_position_other;
    private TextInputEditText mTet_phone_other;
    private TextInputEditText mTet_representative_other;
    private TextInputEditText mTet_credit_code_oher;
    private TextInputEditText mTet_address_other;
    private TextView mBt_idcard;
    private EditText mEt_illegal_facts;
    private EditText mEt_legal_provisions1;
    private EditText mEt_legal_provisions2;
    private TextInputEditText mTet_contact;
    private TextInputEditText mTet_phone;
    private TextInputEditText mTet_addr;
    private Button mBt_prin;
    private RxDialogLoading mRxDialogLoading;
    private Activity mActivity;
    private String mNaturalInfo;
    private int mMYear;
    private int mMMonth;
    private int mMDay;
    private TextView mTv_time;

    public ExpandableStopIllegalAdapter(Activity activity, List<MultiItemEntity> data) {
        super(data);
        this.mActivity = activity;
        addItemType(TYPE_LEVEL_0, R.layout.activity_mission_recor_level0);
        addItemType(TYPE_LEVEL_1, R.layout.stop_thellegal_activities_info1);
        addItemType(TYPE_LEVEL_2, R.layout.stop_thellegal_activities_info2);
        addItemType(TYPE_LEVEL_3, R.layout.stop_thellegal_activities_info3);

        Calendar c = Calendar.getInstance();//
        // 获取当前年份
        mMYear = c.get(Calendar.YEAR);
        // 获取当前月份
        mMMonth = c.get(Calendar.MONTH) + 1;
        // 获取当日期
        mMDay = c.get(Calendar.DAY_OF_MONTH);


    }

    @Override
    protected void convert(final BaseViewHolder helper, MultiItemEntity item) {
        switch (helper.getItemViewType()) {
            case TYPE_LEVEL_0:
                final WrittenRecordLevel0 lv0 = (WrittenRecordLevel0) item;
                helper.setText(R.id.title, lv0.subTitle);
                helper.itemView.setOnClickListener(new View.OnClickListener() {


                    @Override
                    public void onClick(View v) {
                        int adapterPosition = helper.getAdapterPosition();
                        List<WrittenItemBean> subItems = lv0.getSubItems();
                        int subItemType = subItems.get(0).getItemType();

                        if (lv0.isExpanded()) {
                            collapse(adapterPosition);


                        } else {
                            expand(adapterPosition);
                        }


                    }

                });
                break;
            case TYPE_LEVEL_1:
                if (mRb_natural_person == null) {

                    mRb_natural_person = helper.getView(R.id.rb_natural_person);
                    mRb_natural_person.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                        @Override
                        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                            if (mRb_natural_person.isChecked()) {
                                mTet_parties_concerned_natural.setEnabled(true);
                                mTet_parties_concerned_other.setEnabled(false);
                                mTet_parties_concerned_other.setText("");
                                mTet_sex_natural.setEnabled(true);
                                mTet_card_natural.setEnabled(true);
                                mTet_phone_natural.setEnabled(true);
                                mTet_phone_other.setEnabled(false);
                                mTet_phone_other.setText("");
                                mTet_address_natural.setEnabled(true);
                                mTet_address_other.setEnabled(false);
                                mTet_address_other.setText("");
                                mTet_position_other.setEnabled(false);
                                mTet_position_other.setText("");
                                mTet_representative_other.setEnabled(false);
                                mTet_representative_other.setText("");
                                mTet_credit_code_oher.setEnabled(false);
                                mTet_credit_code_oher.setText("");
                                mBt_idcard.setEnabled(true);
                            } else {
                                mTet_parties_concerned_natural.setEnabled(false);
                                mTet_parties_concerned_other.setEnabled(true);
                                mTet_sex_natural.setEnabled(false);
                                mTet_card_natural.setEnabled(false);
                                mTet_phone_natural.setEnabled(false);
                                mTet_phone_other.setEnabled(true);
                                mTet_address_natural.setEnabled(false);
                                mTet_address_other.setEnabled(true);
                                mTet_position_other.setEnabled(true);
                                mTet_representative_other.setEnabled(true);
                                mTet_credit_code_oher.setEnabled(true);
                                mBt_idcard.setEnabled(false);
                            }

                        }
                    });
                }

                if (mTet_parties_concerned_natural == null) {

                    mTet_parties_concerned_natural = helper.getView(R.id.tet_parties_concerned_natural);
                }

                if (mTet_sex_natural == null) {

                    mTet_sex_natural = helper.getView(R.id.tet_sex_natural);
                }

                if (mTet_card_natural == null) {

                    mTet_card_natural = helper.getView(R.id.tet_card_natural);
                }

                if (mTet_phone_natural == null) {

                    mTet_phone_natural = helper.getView(R.id.tet_phone_natural);
                }

                if (mTet_address_natural == null) {

                    mTet_address_natural = helper.getView(R.id.tet_address_natural);
                    TextUtil.setEditTextInhibitInputSpace(mTet_address_natural);
                    TextUtil.setEditTextInhibitInputSpeChat(mTet_address_natural);
                }

                if (mTet_parties_concerned_other == null) {

                    mTet_parties_concerned_other = helper.getView(R.id.tet_parties_concerned_other);
                }

                if (mTet_position_other == null) {

                    mTet_position_other = helper.getView(R.id.tet_position_other);
                }

                if (mTet_phone_other == null) {

                    mTet_phone_other = helper.getView(R.id.tet_phone_other);
                }

                if (mTet_representative_other == null) {

                    mTet_representative_other = helper.getView(R.id.tet_representative_other);
                    TextUtil.setEditTextInhibitInputSpace(mTet_representative_other);
                    TextUtil.setEditTextInhibitInputSpeChat(mTet_representative_other);
                }

                if (mTet_credit_code_oher == null) {

                    mTet_credit_code_oher = helper.getView(R.id.tet_credit_code_oher);
                }

                if (mTet_address_other == null) {

                    mTet_address_other = helper.getView(R.id.tet_address_other);
                    TextUtil.setEditTextInhibitInputSpace(mTet_address_other);
                    TextUtil.setEditTextInhibitInputSpeChat(mTet_address_other);
                }

                if (mBt_idcard == null) {

                    mBt_idcard = helper.getView(R.id.bt_idcard);
                    helper.addOnClickListener(R.id.bt_idcard);
                }
                break;
            case TYPE_LEVEL_2:
                if (mEt_illegal_facts == null) {

                    mEt_illegal_facts = helper.getView(R.id.et_illegal_facts);
                }

                if (mEt_legal_provisions1 == null) {

                    mEt_legal_provisions1 = helper.getView(R.id.et_legal_provisions);
                }

                if (mEt_legal_provisions2 == null) {

                    mEt_legal_provisions2 = helper.getView(R.id.et_legal_provisions2);
                }
                break;
            case TYPE_LEVEL_3:
                if (mTet_contact == null) {

                    mTet_contact = helper.getView(R.id.tet_contact);
                    TextUtil.setEditTextInhibitInputSpace(mTet_contact);
                    TextUtil.setEditTextInhibitInputSpeChat(mTet_contact);
                }

                if (mTet_phone == null) {

                    mTet_phone = helper.getView(R.id.tet_phone);
                }

                if (mTet_addr == null) {

                    mTet_addr = helper.getView(R.id.tet_addr);
                    TextUtil.setEditTextInhibitInputSpace(mTet_addr);
                    TextUtil.setEditTextInhibitInputSpeChat(mTet_addr);
                }

                if (mBt_prin == null) {

                    mBt_prin = helper.getView(R.id.bt_prin);
                    helper.addOnClickListener(R.id.bt_prin);
                }
                if (mTv_time == null) {

                    mTv_time = helper.getView(R.id.tv_time);
                    mTv_time.setText(mMYear + "年" + mMMonth + "月" + mMDay + "日");
                }
                break;
            default:
                break;
        }
    }

    public void setOCRData(IDCardResult result) {
        mTet_sex_natural.setText(result.getGender().toString());
        mTet_parties_concerned_natural.setText(result.getName().toString());
        mTet_card_natural.setText(result.getIdNumber().toString());
        mTet_address_natural.setText(result.getAddress().toString());
    }

    public void print() {
        boolean installApp = AppUtil.isInstallApp(BaseApplication.getApplictaion(), "com.dynamixsoftware.printershare");

        if (installApp) {
            if (mRb_natural_person.isChecked()) {    //当事人为自然人

                final String partiesConcernedNatural = mTet_parties_concerned_natural.getText().toString().trim();
                final String sexNatural = mTet_sex_natural.getText().toString().trim();
                final String tetCardNatural = mTet_card_natural.getText().toString().trim();
                final String tetPhoneNatural = mTet_phone_natural.getText().toString().trim();
                final String tetAddressNatural = mTet_address_natural.getText().toString().trim();
                if (TextUtils.isEmpty(partiesConcernedNatural) && TextUtils.isEmpty(sexNatural)
                        && TextUtils.isEmpty(tetCardNatural) && TextUtils.isEmpty(tetPhoneNatural)
                        && TextUtils.isEmpty(tetAddressNatural)) {
                    RxToast.warning(BaseApplication.getApplictaion(), "填入信息不能有空", Toast.LENGTH_SHORT).show();
                    return;
                }
                mNaturalInfo = "<p>当事人:<u>&nbsp;" + partiesConcernedNatural + "&nbsp;</u>&nbsp;&nbsp;&nbsp;&nbsp;性别: <u>&nbsp;" + sexNatural + "&nbsp;</u>&nbsp;&nbsp;&nbsp;&nbsp;身份证号:\n" +
                        "    <u>&nbsp;" + tetCardNatural + "&nbsp;</u>&nbsp;&nbsp;&nbsp;&nbsp;电话:\n" +
                        "    <u>&nbsp;" + tetPhoneNatural + "&nbsp;</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;住址:\n" +
                        "    <u>&nbsp;" + tetAddressNatural + "&nbsp;</u>\n" +
                        "</p>";
                //---------------------------------------------------


            } else {
                String partiesConcernedOther = mTet_parties_concerned_other.getText().toString().trim();
                String positionOther = mTet_position_other.getText().toString().trim();
                String phoneOther = mTet_phone_other.getText().toString().trim();
                String representativeOther = mTet_representative_other.getText().toString().trim();
                String creditCodeOher = mTet_credit_code_oher.getText().toString().trim();
                String addressOther = mTet_address_other.getText().toString().trim();

                if (TextUtils.isEmpty(partiesConcernedOther) && TextUtils.isEmpty(positionOther)
                        && TextUtils.isEmpty(phoneOther) && TextUtils.isEmpty(representativeOther)
                        && TextUtils.isEmpty(creditCodeOher) && TextUtils.isEmpty(addressOther)) {
                    RxToast.warning(BaseApplication.getApplictaion(), "填入信息不能有空", Toast.LENGTH_SHORT).show();
                    return;
                }
                mNaturalInfo = "<p>当事人:<u>&nbsp;" + partiesConcernedOther + "&nbsp;</u>&nbsp;&nbsp;&nbsp;&nbsp;职务: <u>&nbsp;" + positionOther + "&nbsp;</u>&nbsp;&nbsp;&nbsp;&nbsp;电话:\n" +
                        "    <u>&nbsp;" + phoneOther + "&nbsp;</u>&nbsp;&nbsp;&nbsp;&nbsp;法定代表人:\n" +
                        "    <u>&nbsp;" + representativeOther + "&nbsp;</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;统一社会信用代码:\n" +
                        "    <u>&nbsp;" + creditCodeOher + "&nbsp;</u>\n" + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;住所:<u>&nbsp;" + addressOther + "&nbsp;</u>" +
                        "</p>";

            }

            if (mEt_illegal_facts == null || TextUtils.isEmpty(mEt_illegal_facts.getText().toString().trim())) {
                RxToast.warning("违法事实不能为空");
                return;
            }

            if (mEt_legal_provisions1 == null || TextUtils.isEmpty(mEt_legal_provisions1.getText().toString().trim())) {
                RxToast.warning("法律条款不能为空");
                return;
            }

            if (mEt_legal_provisions2 == null || TextUtils.isEmpty(mEt_legal_provisions2.getText().toString().trim())) {
                RxToast.warning("法律条款不能为空");
                return;
            }

            if (mTet_contact == null || TextUtils.isEmpty(mTet_contact.getText().toString().trim())) {
                RxToast.warning("联系人不能为空");
                return;
            }

            if (mTet_phone == null || TextUtils.isEmpty(mTet_phone.getText().toString().trim())) {
                RxToast.warning("联系电话不能为空");
                return;
            }

            if (mTet_addr == null || TextUtils.isEmpty(mTet_addr.getText().toString().trim())) {
                RxToast.warning("联系地址不能为空");
                return;
            }
            final String illegalFacts = mEt_illegal_facts.getText().toString().trim();
            final String legalProvisions1 = mEt_legal_provisions1.getText().toString().trim();
            final String legalProvisions2 = mEt_legal_provisions2.getText().toString().trim();
            final String contact = mTet_contact.getText().toString().trim();
            final String phone = mTet_phone.getText().toString().trim();
            final String addr = mTet_addr.getText().toString().trim();
            //写文件html
            Schedulers.io().createWorker().schedule(new Runnable() {
                @Override
                public void run() {
                    writeHtml(illegalFacts, legalProvisions1, legalProvisions2, contact, phone, addr);

                }
            });
            ComponentName comp = new ComponentName("com.dynamixsoftware.printershare", "com.dynamixsoftware.printershare.ActivityWeb");
            Intent intent = new Intent();
            intent.setComponent(comp);
            intent.setAction("android.intent.action.VIEW");
            intent.setType("text/html");
            intent.setData(Uri.parse("file:///" + Environment.getExternalStorageDirectory().getPath() + "/oking/print/temp1.html"));
            mActivity.startActivity(intent);

        } else {
            if (mRxDialogLoading == null) {

                mRxDialogLoading = new RxDialogLoading(mActivity, false, new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialogInterface) {
                        dialogInterface.cancel();
                    }
                });
                mRxDialogLoading.setLoadingText("正在解压插件...");
            }
            mRxDialogLoading.show();
            Schedulers.io().createWorker().schedule(new Runnable() {
                @Override
                public void run() {
                    final File assetFileToCacheDir = FileUtil.getAssetFileToCacheDir("PrinterShare.apk");
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            mRxDialogLoading.cancel();
                            AppUtil.installAPK(BaseApplication.getApplictaion(), assetFileToCacheDir.getPath());
                        }
                    });
                }
            });

        }

    }

    private void writeHtml(String illegalFacts, String legalProvisions1, String legalProvisions2, String contact, String phone, String addr) {
        File destDir = new File(Environment.getExternalStorageDirectory().getPath() + "/oking/print/temp1.html");
        StringBuffer sb = new StringBuffer();
        sb.append("<!DOCTYPE HTML>\n");
        sb.append("<html>\n");
        sb.append("<head>\n");
        sb.append("    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n");
        sb.append("    <style>\n");
        sb.append("    </style>\n");
        sb.append("</head>\n");
        sb.append("<body>\n");
        sb.append("<h1 align=\"center\">水行政责令停止违法行为通知书</h1>\n");
        sb.append("<p align=\"right\">x水当罚字[&nbsp;]第&nbsp;&nbsp;号</p>\n");
        sb.append(mNaturalInfo);
        sb.append("<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;据初步调查,你(单位)&nbsp; <u>&nbsp;" + illegalFacts + "&nbsp;</u>&nbsp;涉嫌违反了 &nbsp;<u>&nbsp;" + legalProvisions1 + "&nbsp;</u>&nbsp;\n");
        sb.append("    的规定,现根据:<u>&nbsp;" + legalProvisions2 + "&nbsp;</u>的规定,责令你(单位)立即停止违法行为,听后处理。</p>\n");
        sb.append("<p align=\"right\">" + mMYear + "年" + mMMonth + "月" + mMDay + "日&nbsp;&nbsp;</p>\n");
        sb.append("<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;联系人:<u>&nbsp;" + contact + "&nbsp;</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;联系电话:&nbsp;<u>&nbsp;" + phone + "&nbsp;</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;联系地址:&nbsp;<u>&nbsp;" + addr + "&nbsp;</u></p>\n");
        sb.append("</body>\n");
        sb.append("</html>");
        FileUtil.writeFileFromString(destDir, sb.toString(), false);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;

import android.os.Bundle;
import android.support.design.widget.TextInputEditText;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class ApprovalTaskInfoFragment extends Fragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.tv_taskname)
    TextInputEditText mTvTaskname;
    @BindView(R.id.tv_source)
    TextInputEditText mTvSource;
    @BindView(R.id.publisher_tv)
    TextInputEditText mPublisherTv;
    @BindView(R.id.tv_approver)
    TextInputEditText mTvApprover;
    @BindView(R.id.tv_recipient)
    TextInputEditText mTvRecipient;
    @BindView(R.id.tv_emergency)
    TextInputEditText mTvEmergency;
    @BindView(R.id.tv_begintime)
    TextInputEditText mTvBegintime;
    @BindView(R.id.tv_endtime)
    TextInputEditText mTvEndtime;
    @BindView(R.id.list_item_missionDetail)
    TextInputEditText mListItemMissionDetail;
    @BindView(R.id.tv_description)
    TextInputEditText mTvDescription;
    Unbinder unbinder;

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    private View mInflate;
    private GreenMissionTask mGreenMissionTask;
    private DateFormat mDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");

    public ApprovalTaskInfoFragment() {
        // Required empty public constructor
    }

    public static ApprovalTaskInfoFragment newInstance(String param1, String param2) {
        ApprovalTaskInfoFragment fragment = new ApprovalTaskInfoFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_approval_task_info, container, false);

        }
        unbinder = ButterKnife.bind(this, mInflate);
        initData();
        return mInflate;
    }

    private void initData() {
        mTvTaskname.setText(mGreenMissionTask.getTask_name());
        if ("0".equals(mGreenMissionTask.getRwly())) {
            mTvSource.setText("上级交办");
        } else if ("1".equals(mGreenMissionTask.getRwly())) {
            mTvSource.setText("部门移送");
        } else if ("2".equals(mGreenMissionTask.getRwly())) {
            mTvSource.setText("系统报警");
        } else if ("3".equals(mGreenMissionTask.getRwly())) {
            mTvSource.setText("日常巡查");
        } else if ("4".equals(mGreenMissionTask.getRwly())) {
            mTvSource.setText("媒体披露");
        } else if ("5".equals(mGreenMissionTask.getRwly())) {
            mTvSource.setText("群众举报");
        }
        mPublisherTv.setText(mGreenMissionTask.getPublisher_name());
        mTvApprover.setText(mGreenMissionTask.getApproved_person_name());
        mTvRecipient.setText(mGreenMissionTask.getFbr());
        if ("0".equals(mGreenMissionTask.getJjcd())) {
            mTvEmergency.setText("特急");
        } else if ("紧急".equals(mGreenMissionTask.getJjcd())) {
            mTvEmergency.setText("紧急");
        } else if ("一般".equals(mGreenMissionTask.getJjcd())) {
            mTvEmergency.setText("一般");
        } else {
            mTvEmergency.setText("紧急");
        }
        mTvBegintime.setText(mDateFormat.format(mGreenMissionTask.getBegin_time()));
        mTvEndtime.setText(mDateFormat.format(mGreenMissionTask.getEnd_time()));
        mListItemMissionDetail.setText(mGreenMissionTask.getTask_area());
        mTvDescription.setText(mGreenMissionTask.getTask_content());
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    public void setMissionTask(GreenMissionTask missionTask) {
        mGreenMissionTask = missionTask;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.RectF;
import android.location.Location;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.RadioButton;

import com.amap.api.maps.AMap;
import com.amap.api.maps.CameraUpdate;
import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.MapView;
import com.amap.api.maps.Projection;
import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.CameraPosition;
import com.amap.api.maps.model.Circle;
import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.MyLocationStyle;
import com.amap.api.maps.model.Polygon;
import com.amap.api.maps.model.PolygonOptions;
import com.google.gson.reflect.TypeToken;
import com.yinghe.whiteboardlib.bean.StrokeRecord;
import com.yinghe.whiteboardlib.view.SketchView;
import com.zhang.baselib.ui.views.RxDialogSureCancel;
import com.zhang.baselib.utils.DataUtil;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.LatLngListOV;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;
import com.zhang.okinglawenforcementphone.views.MapDraw;

import org.greenrobot.eventbus.EventBus;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class MapByPointActivity extends BaseActivity implements AMap.OnMyLocationChangeListener, CompoundButton.OnCheckedChangeListener {

    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.map)
    MapView mMap;
    @BindView(R.id.rb_circular)
    RadioButton mRbCircular;
    @BindView(R.id.rb_polygon)
    RadioButton mRbPolygon;
    @BindView(R.id.rb_move_map)
    RadioButton mRbMoveMap;
    @BindView(R.id.md)
    MapDraw mMd;
    private Unbinder mBind;
    private AMap mAMap;
    private UiSettings mUiSettings;
    private LatLng mLng;

    private int mDrawType;

    private StrokeRecord mStrokeRecord;
    private RxDialogSureCancel mRxDialogSureCancel;
    private String mMcoordinateJson;
    private int mDrawLaLoType;
    private LatLng mCenterPoint;
    private float mZoom;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map_by_point);
        mBind = ButterKnife.bind(this);
        mMap.onCreate(savedInstanceState);// 此方法必须重写
        initData();
        setListener();

    }

    private void setListener() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        mRbCircular.setOnCheckedChangeListener(this);
        mRbPolygon.setOnCheckedChangeListener(this);
        mRbMoveMap.setOnCheckedChangeListener(this);
    }

    private void initData() {
        Intent intent = getIntent();
        mMcoordinateJson = intent.getStringExtra("mcoordinateJson");
        mDrawLaLoType = intent.getIntExtra("drawLaLoType", 4);
        float left = intent.getFloatExtra("left", 0);
        float right = intent.getFloatExtra("right", 0);
        float top = intent.getFloatExtra("top", 0);
        float bottom = intent.getFloatExtra("bottom", 0);
        mZoom = intent.getFloatExtra("zoom", 0);
        mCenterPoint = (LatLng) intent.getParcelableExtra("centerPoint");
        initMap();

        mStrokeRecord = new StrokeRecord();
        mStrokeRecord.setType(mDrawLaLoType);
        Paint strokePaint = new Paint();
        strokePaint.setAntiAlias(true);
        strokePaint.setDither(true);
        strokePaint.setColor(Color.RED);
        strokePaint.setStyle(Paint.Style.STROKE);
        strokePaint.setStrokeJoin(Paint.Join.ROUND);
        strokePaint.setStrokeCap(Paint.Cap.ROUND);
        strokePaint.setStrokeWidth(3);
        if (left != 0) {
            RectF rect = new RectF(left, top, right, bottom);
            mStrokeRecord.rect = rect;
        }

        mStrokeRecord.paint = strokePaint;
        mMd.setOnDrawChangedListener(new MapDraw.OnDrawChangedListener() {
            @Override
            public void onDrawChanged(final LatLngListOV latLngListOV) {
                if (mRxDialogSureCancel == null) {
                    mRxDialogSureCancel = new RxDialogSureCancel(MapByPointActivity.this, false, new DialogInterface.OnCancelListener() {
                        @Override
                        public void onCancel(DialogInterface dialogInterface) {
                            dialogInterface.cancel();
                        }
                    });

                    mRxDialogSureCancel.setContent("确认巡查范围已标记无误？");
                    mRxDialogSureCancel.getTvCancel().setText("重来");
                    mRxDialogSureCancel.getTvSure().setText("完成");

                }
                mRxDialogSureCancel.getTvCancel().setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        mRxDialogSureCancel.cancel();
                    }
                });
                mRxDialogSureCancel.getTvSure().setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        mRxDialogSureCancel.cancel();

                        EventBus.getDefault().post(latLngListOV);
                        finish();
                    }
                });
                mRxDialogSureCancel.show();
            }
        });
        mMd.setAmap(mAMap);
        mMd.setStrokeRecord(mStrokeRecord);
    }

    private void initMap() {
        if (mAMap == null) {
            mAMap = mMap.getMap();
            mUiSettings = mAMap.getUiSettings();
        }
        mAMap.setMaxZoomLevel(20);
        mAMap.setMapType(AMap.MAP_TYPE_NORMAL);// MAP_TYPE_SATELLITE卫星地图模式
        mUiSettings.setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
        mAMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位，false表示隐藏定位层并不可触发定位，默认是false
        setupLocationStyle();
        mAMap.setOnMyLocationChangeListener(this);

        Log.i("Oking",">>>"+mMcoordinateJson);
    }

    private void setupLocationStyle() {
        // 自定义系统定位蓝点
        MyLocationStyle myLocationStyle = new MyLocationStyle();
        // 自定义定位蓝点图标
        myLocationStyle.myLocationIcon(BitmapDescriptorFactory.
                fromResource(R.mipmap.gps_point));
        // 自定义精度范围的圆形边框颜色
        myLocationStyle.strokeColor(Color.argb(180, 3, 145, 255));
        //自定义精度范围的圆形边框宽度
        myLocationStyle.strokeWidth(5);
        // 设置圆形的填充颜色
        myLocationStyle.radiusFillColor(Color.argb(10, 0, 0, 180));
        // 将自定义的 myLocationStyle 对象添加到地图上
        myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_SHOW);
        mAMap.setMyLocationStyle(myLocationStyle);

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mMap.onDestroy();
        mBind.unbind();
    }

    /**
     * 方法必须重写
     */
    @Override
    protected void onResume() {
        super.onResume();
        mMap.onResume();
    }

    /**
     * 方法必须重写
     */
    @Override
    protected void onPause() {
        super.onPause();
        mMap.onPause();
    }

    /**
     * 方法必须重写
     */
    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        mMap.onSaveInstanceState(outState);
    }


    @Override
    public void onMyLocationChange(Location location) {
        if (location != null) {
            mLng = new LatLng(location.getLatitude(), location.getLongitude());
            Log.e("amap", "onMyLocationChange 定位成功， lat: " + location.getLatitude() + " lon: " + location.getLongitude());
            Bundle bundle = location.getExtras();
            if (bundle != null) {
                int errorCode = bundle.getInt(MyLocationStyle.ERROR_CODE);
                String errorInfo = bundle.getString(MyLocationStyle.ERROR_INFO);
                // 定位类型，可能为GPS WIFI等，具体可以参考官网的定位SDK介绍
                int locationType = bundle.getInt(MyLocationStyle.LOCATION_TYPE);
                /*
                errorCode
                errorInfo
                locationType
                */

                if (mCenterPoint == null) {
                    changeCamera(
                            CameraUpdateFactory.newCameraPosition(new CameraPosition(
                                    mLng, 18, 30, 30)));
                } else {
                    changeCamera(
                            CameraUpdateFactory.newCameraPosition(new CameraPosition(
                                    mCenterPoint, mZoom, 30, 30)));
                }

                Log.e("amap", "定位信息， code: " + errorCode + " errorInfo: " + errorInfo + " locationType: " + locationType);
            } else {
                Log.e("amap", "定位信息， bundle is null ");

            }

        } else {
            Log.e("amap", "定位失败");
        }

    }

    private void changeCamera(CameraUpdate cameraUpdate) {
        mAMap.moveCamera(cameraUpdate);
    }

    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean b) {

        switch (compoundButton.getId()) {

            case R.id.rb_circular:
                if (b) {
                    mUiSettings.setScrollGesturesEnabled(false);
                    mMd.setVisibility(View.VISIBLE);
                    mDrawType = 4;
                    mStrokeRecord.setType(mDrawType);
                    mMd.setStrokeRecord(mStrokeRecord);
                }
                break;
            case R.id.rb_polygon:
                if (b) {
                    mUiSettings.setScrollGesturesEnabled(false);
                    mMd.setVisibility(View.VISIBLE);
                    mDrawType = 5;
                    mStrokeRecord.setType(mDrawType);
                    mMd.setStrokeRecord(mStrokeRecord);

                }
                break;
            case R.id.rb_move_map:
                if (b) {
                    mUiSettings.setScrollGesturesEnabled(true);
                    mMd.setVisibility(View.GONE);
                }
                break;
            default:
                break;
        }
    }


}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.baselib.BaseApplication;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.MenuItemOV;
import com.zhang.okinglawenforcementphone.beans.MenuOV;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;
import com.zhy.view.flowlayout.TagFlowLayout;

import java.util.List;

/**
 * Created by Administrator on 2018/4/18.
 */

public class IndexRecyAdapter extends BaseQuickAdapter<MenuOV, BaseViewHolder> {

    private OnTagClickListener mOnTagClickListener;

    public IndexRecyAdapter(int layoutResId, @Nullable List<MenuOV> data, OnTagClickListener onTagClickListener) {
        super(layoutResId, data);
        this.mOnTagClickListener = onTagClickListener;
    }

    @Override
    protected void convert(BaseViewHolder helper, final MenuOV item) {
        helper.setText(R.id.tv_title, item.getTage());
        TagFlowLayout flowlayout = helper.getView(R.id.flowlayout);
        final List<MenuItemOV> menuItemOVS = item.getMenuItemOVS();
        flowlayout.setAdapter(new TagAdapter<MenuItemOV>(menuItemOVS) {
            @Override
            public View getView(FlowLayout parent, int position, MenuItemOV dataBean) {
                View inflate = View.inflate(BaseApplication.getApplictaion(), R.layout.hot_tagflow_item, null);
                TextView tv_tag = inflate.findViewById(R.id.tv_tag);
                ImageView icon = inflate.findViewById(R.id.iv_icon);
                tv_tag.setText(dataBean.getTitle());
                icon.setImageResource(dataBean.getIcon());
                return inflate;
            }
        });

        flowlayout.setOnTagClickListener(new TagFlowLayout.OnTagClickListener() {
            @Override
            public boolean onTagClick(View view, int position, FlowLayout parent) {
                mOnTagClickListener.onTagClickListener(menuItemOVS.get(position));
                return false;
            }
        });
    }


    public interface OnTagClickListener {
        void onTagClickListener(MenuItemOV bean);

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

/**
 * Created by Administrator on 2017/10/31.
 */

public class SectionDomain {
    private String chapterItem;
    private String itemTitle;

    public String getChapterItem() {
        return chapterItem;
    }

    public void setChapterItem(String chapterItem) {
        this.chapterItem = chapterItem;
    }

    public String getItemTitle() {
        return itemTitle;
    }

    public void setItemTitle(String itemTitle) {
        this.itemTitle = itemTitle;
    }

    @Override
    public String toString() {
        return "SectionDomain{" +
                "chapterItem='" + chapterItem + '\'' +
                ", itemTitle='" + itemTitle + '\'' +
                '}';
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.presenter;

import com.zhang.okinglawenforcementphone.beans.JPushMessageBean;
import com.zhang.okinglawenforcementphone.mvp.contract.JPushMessageContract;
import com.zhang.okinglawenforcementphone.mvp.model.JPushMessageModel;

/**
 * Created by Administrator on 2018/8/27/027.
 */

public class JPushMessagePresenter implements JPushMessageContract.Presenter {
    private JPushMessageContract.Model mModel;
    private JPushMessageContract.View mView;

    public JPushMessagePresenter(JPushMessageContract.View view) {
        mView = view;
        mModel = new JPushMessageModel(this);
    }

    @Override
    public void pushMessage(JPushMessageBean jPushMessageBean) {
        mModel.pushMessage(jPushMessageBean);
    }

    @Override
    public void pushMessageSucc(String result) {
        mView.pushMessageSucc(result);
    }

    @Override
    public void pushMessageFail(Throwable ex) {
        mView.pushMessageFail(ex);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.content.Intent;
import android.os.Bundle;
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;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.ArrangeMissionRcyAdapter;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLog;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLogDao;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTaskDao;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.beans.UpdateGreenMissionTaskOV;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;
import com.zhang.okinglawenforcementphone.views.DividerItemDecoration;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.greenrobot.greendao.query.QueryBuilder;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public class TaskMissionProjectActivity extends BaseActivity {
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.ry_arrange)
    RecyclerView ryArrange;
    @BindView(R.id.tv)
    TextView tv;
    @BindView(R.id.tv_title)
    TextView mTvTitle;
    private Unbinder mBind;
    private List<GreenMissionTask> mGreenMissionTasks;
    private String argActivity;
    private ArrangeMissionRcyAdapter mAarrangeMissionRcyAdapter;
    private Intent mIntent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_task_mission_project);
        mBind = ButterKnife.bind(this);
        initView();
        initData();
        setListener();

    }

    private void setListener() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        mAarrangeMissionRcyAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

            private GreenMissionTask mGreenMissionTask;

            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                switch (argActivity) {
                    case "ArrangeMissionActivity":
                        mIntent = new Intent(TaskMissionProjectActivity.this, ArrangeTeamMembersActivity.class);
                        mIntent.putExtra("id", mAarrangeMissionRcyAdapter.getData().get(position).getId());
                        mIntent.putExtra("position", position);
                        startActivity(mIntent);
                        break;
                    case "TaskExecutionActivity":
                    case "ReportTaskActivity":
                        mIntent = new Intent(TaskMissionProjectActivity.this, MissionActivity.class);
                        mIntent.putExtra("id", mAarrangeMissionRcyAdapter.getData().get(position).getId());
                        mIntent.putExtra("position", position);
                        startActivity(mIntent);
                        break;

                    case "TrajectoryListActivity":
                        mGreenMissionTask = mAarrangeMissionRcyAdapter.getData().get(position);
                        GreenMissionLog unique = GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao()
                                .queryBuilder().where(GreenMissionLogDao.Properties.Task_id.eq(mGreenMissionTask.getTaskid())).unique();
                        if (unique == null || unique.getLocJson() == null|| unique.getLocJson().equals("[]")|| TextUtils.isEmpty(unique.getLocJson())) {
                            RxToast.error("抱歉后台哥们不给力，木有轨迹返回给我~~~~");
                        } else {
                            mIntent = new Intent(TaskMissionProjectActivity.this, TrajectoryActivity.class);
                            mIntent.putExtra("id", mAarrangeMissionRcyAdapter.getData().get(position).getTaskid());
                            mIntent.putExtra("taskName", mGreenMissionTask.getTask_name());
                            mIntent.putExtra("publishname", mGreenMissionTask.getPublisher_name());
                            mIntent.putExtra("executeBeginTime", mGreenMissionTask.getExecute_start_time());
                            mIntent.putExtra("executeEndTime", mGreenMissionTask.getExecute_end_time());
                            mIntent.putExtra("area", mGreenMissionTask.getTask_area());
                            mIntent.putExtra("locJson", unique.getLocJson());
                            startActivity(mIntent);
                        }

                        break;
                    case "CompleteListActivity":
                        mGreenMissionTask = mAarrangeMissionRcyAdapter.getData().get(position);
                        Intent intent = new Intent(TaskMissionProjectActivity.this, MissionRecorActivity.class);
                        intent.putExtra("id", mGreenMissionTask.getId());
                        intent.putExtra("taskId", mGreenMissionTask.getTaskid());
                        startActivity(intent);

                        break;
                    default:
                        break;
                }
            }
        });

    }

    private void initData() {
        Intent intent = getIntent();
        argActivity = intent.getStringExtra("activity");
        EventBus.getDefault().register(this);

        switch (argActivity) {
            case "ArrangeMissionActivity":
                mTvTitle.setText("待安排队员列表");
                Schedulers.io().createWorker().schedule(new Runnable() {
                    @Override
                    public void run() {
                        mGreenMissionTasks = GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao()
                                .queryBuilder().where(GreenMissionTaskDao.Properties.Userid.eq(OkingContract.CURRENTUSER.getUserid()), GreenMissionTaskDao.Properties.Status.eq(2))
                                .list();
                        if (mGreenMissionTasks.size() > 0) {
                            AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                                @Override
                                public void run() {
                                    ryArrange.setVisibility(View.VISIBLE);
                                    tv.setVisibility(View.GONE);
                                    mAarrangeMissionRcyAdapter.setNewData(mGreenMissionTasks);

                                }
                            });
                        } else {
                            AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                                @Override
                                public void run() {
                                    ryArrange.setVisibility(View.GONE);
                                    tv.setVisibility(View.VISIBLE);
                                }
                            });

                        }
                    }
                });
                break;
            case "TaskExecutionActivity":
                mTvTitle.setText("待执行任务列表");
                mGreenMissionTasks = GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao()
                        .queryBuilder().where(GreenMissionTaskDao.Properties.Userid.eq(OkingContract.CURRENTUSER.getUserid()))
                        .whereOr(GreenMissionTaskDao.Properties.Status.eq(3), GreenMissionTaskDao.Properties.Status.eq(4))
                        .list();
                if (mGreenMissionTasks.size() > 0) {
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            ryArrange.setVisibility(View.VISIBLE);
                            tv.setVisibility(View.GONE);
                            mAarrangeMissionRcyAdapter.setNewData(mGreenMissionTasks);

                        }
                    });
                } else {
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            ryArrange.setVisibility(View.GONE);
                            tv.setVisibility(View.VISIBLE);
                        }
                    });

                }
                break;

            case "ReportTaskActivity":
                mTvTitle.setText("待上报任务列表");
                mGreenMissionTasks = GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao()
                        .queryBuilder().where(GreenMissionTaskDao.Properties.Userid.eq(OkingContract.CURRENTUSER.getUserid()), GreenMissionTaskDao.Properties.Status.eq(100))
                        .list();
                if (mGreenMissionTasks.size() > 0) {
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            ryArrange.setVisibility(View.VISIBLE);
                            tv.setVisibility(View.GONE);
                            mAarrangeMissionRcyAdapter.setNewData(mGreenMissionTasks);

                        }
                    });
                } else {
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            ryArrange.setVisibility(View.GONE);
                            tv.setVisibility(View.VISIBLE);
                        }
                    });

                }
                break;

            case "TrajectoryListActivity":
                mTvTitle.setText("任务轨迹列表");
                QueryBuilder<GreenMissionTask> greenMissionTaskQueryBuilder = GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao()
                        .queryBuilder();
                greenMissionTaskQueryBuilder.where(GreenMissionTaskDao.Properties.Userid.eq(OkingContract.CURRENTUSER.getUserid()));
                greenMissionTaskQueryBuilder.whereOr(GreenMissionTaskDao.Properties.Status.eq(100), GreenMissionTaskDao.Properties.Status.eq(5));
                mGreenMissionTasks = greenMissionTaskQueryBuilder.list();
                if (mGreenMissionTasks.size() > 0) {
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            ryArrange.setVisibility(View.VISIBLE);
                            tv.setVisibility(View.GONE);
                            mAarrangeMissionRcyAdapter.setNewData(mGreenMissionTasks);

                        }
                    });
                } else {
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            ryArrange.setVisibility(View.GONE);
                            tv.setVisibility(View.VISIBLE);
                        }
                    });

                }
                break;
            case "CompleteListActivity":
                mTvTitle.setText("任务完成列表");
                mGreenMissionTasks = GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao()
                        .queryBuilder().where(GreenMissionTaskDao.Properties.Userid.eq(OkingContract.CURRENTUSER.getUserid()), GreenMissionTaskDao.Properties.Status.eq(5)).list();
                if (mGreenMissionTasks.size() > 0) {
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            ryArrange.setVisibility(View.VISIBLE);
                            tv.setVisibility(View.GONE);
                            mAarrangeMissionRcyAdapter.setNewData(mGreenMissionTasks);

                        }
                    });
                } else {
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            ryArrange.setVisibility(View.GONE);
                            tv.setVisibility(View.VISIBLE);
                        }
                    });

                }
                break;
            default:
                break;
        }

    }

    private void initView() {
        ryArrange.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
        ryArrange.addItemDecoration(new DividerItemDecoration(BaseApplication.getApplictaion(), 0, 8, BaseApplication.getApplictaion().getResources().getColor(R.color.activity_bg)));
        mAarrangeMissionRcyAdapter = new ArrangeMissionRcyAdapter(R.layout.arrangemission_task_item, null);
        mAarrangeMissionRcyAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
        ryArrange.setAdapter(mAarrangeMissionRcyAdapter);
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void handleEvent1(UpdateGreenMissionTaskOV event) {

        mAarrangeMissionRcyAdapter.setData(event.getPosition(), event.getMissionTask());

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBind.unbind();
        EventBus.getDefault().unregister(this);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.model;

import android.os.Environment;
import android.util.Log;

import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.beans.GreenMedia;
import com.zhang.okinglawenforcementphone.beans.GreenMediaDao;
import com.zhang.okinglawenforcementphone.beans.GreenMember;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLog;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLogDao;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.contract.GetHttpMissionLogContract;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.File;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;

/**
 * Created by Administrator on 2018/4/23/023.
 */

public class GetHttpMissionLogModel implements GetHttpMissionLogContract.Model {
    private GetHttpMissionLogContract.Presenter mPresenter;
    private GreenMissionLog mUnique;

    public GetHttpMissionLogModel(GetHttpMissionLogContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void getHttpMissionLog(final GreenMissionTask mission) {
        BaseHttpFactory.getInstence()
                .createService(GDWaterService.class, Api.BASE_URL)
                .getHttpMissionLog("-1", mission.getTaskid())
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .observeOn(Schedulers.io())
                .concatMap(new Function<ResponseBody, Observable<ResponseBody>>() {


                    @Override
                    public Observable<ResponseBody> apply(ResponseBody responseBody) throws Exception {
                        String result = responseBody.string();
                        Log.i("Oking5", "获取任务到任务" + result);
                        JSONObject object = new JSONObject(result);
                        int count = object.optInt("total");
                        if (count > 0) {
                            JSONObject rows = object.getJSONArray("rows").getJSONObject(0);
                            String mId = rows.optString("id");
                            mUnique = GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao().queryBuilder()
                                    .where(GreenMissionLogDao.Properties.Server_id.eq(mId)).unique();
                            if (mUnique == null) {
                                mUnique = new GreenMissionLog();
                                mUnique.setAddr(rows.optString("addr"));
                                mUnique.setArea(rows.optString("area"));
                                mUnique.setDeal(rows.optString("deal"));
                                mUnique.setDzyj(rows.optString("dzyj"));
                                mUnique.setEquipment(rows.optString("equipment"));
                                mUnique.setServer_id(mId);
                                mUnique.setId_card(rows.optString("id_card"));
                                mUnique.setItem(rows.optInt("item"));
                                mUnique.setName(rows.optString("name"));
                                mUnique.setOther_part(rows.optString("other_part"));
                                mUnique.setOther_person(rows.optInt("other_person"));
                                mUnique.setPatrol(rows.optString("patrol"));
                                mUnique.setPlan(rows.optInt("plan"));
                                mUnique.setPost(rows.optString("post"));
                                mUnique.setResult(rows.optString("result"));
                                mUnique.setRoute(rows.optString("route"));
                                mUnique.setStatus(rows.optInt("status"));
                                mUnique.setTask_id(rows.optString("task_id"));
                                mUnique.setTime(rows.optString("time"));
                                mUnique.setType(rows.optInt("type"));
                                mUnique.setWeather(rows.optString("weather"));
                                GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao().insert(mUnique);
                            } else {
                                mUnique.setAddr(rows.optString("addr"));
                                mUnique.setArea(rows.optString("area"));
                                mUnique.setDeal(rows.optString("deal"));
                                mUnique.setDzyj(rows.optString("dzyj"));
                                mUnique.setEquipment(rows.optString("equipment"));
                                mUnique.setServer_id(mId);
                                mUnique.setId_card(rows.optString("id_card"));
                                mUnique.setItem(rows.optInt("item"));
                                mUnique.setName(rows.optString("name"));
                                mUnique.setOther_part(rows.optString("other_part"));
                                mUnique.setOther_person(rows.optInt("other_person"));
                                mUnique.setPatrol(rows.optString("patrol"));
                                mUnique.setPlan(rows.optInt("plan"));
                                mUnique.setPost(rows.optString("post"));
                                mUnique.setResult(rows.optString("result"));
                                mUnique.setRoute(rows.optString("route"));
                                mUnique.setStatus(rows.optInt("status"));
                                mUnique.setTask_id(rows.optString("task_id"));
                                mUnique.setTime(rows.optString("time"));
                                mUnique.setType(rows.optInt("type"));
                                mUnique.setWeather(rows.optString("weather"));
                                GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao().update(mUnique);
                            }

                            //获取日志图片路径
                            return BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL).getMissionRecordPicPath(mId, 0);

                        } else {
                            return Observable.error(new Throwable("NOTASKLOG"));
                        }
                    }
                }).concatMap(new Function<ResponseBody, Observable<ResponseBody>>() {
            @Override
            public Observable<ResponseBody> apply(ResponseBody responseBody) throws Exception {
                if (mUnique.getGreenMedia().size() < 1) {
                    String result = responseBody.string();
                    Log.i("Oking", "获取任务到任务图片路径：" + result);
                    JSONArray paths = new JSONArray(result);
                    for (int i = 0; i < paths.length(); i++) {
                        String path = paths.getJSONObject(i).optString("path");
                        GreenMedia unique = GreenDAOManager.getInstence().getDaoSession().getGreenMediaDao()
                                .queryBuilder().where(GreenMediaDao.Properties.Path.eq(Api.BASE_URL + path)).unique();
                        if (unique == null) {
                            GreenMedia greenMedia = new GreenMedia();
                            greenMedia.setType(1);
                            greenMedia.setPath(Api.BASE_URL + path);
                            greenMedia.setGreenMissionLogId(mUnique.getId());
                            GreenDAOManager.getInstence().getDaoSession().getGreenMediaDao().insert(greenMedia);
                        }

                    }
                }


                //获取签名图片
                return BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL).getMissionRecordPicPath(mUnique.getServer_id(), 1);
            }
        }).concatMap(new Function<ResponseBody, Observable<ResponseBody>>() {
            @Override
            public Observable<ResponseBody> apply(ResponseBody responseBody) throws Exception {

                String result = responseBody.string();
                Log.i("Oking", "获取到签名路径：" + result);
                JSONArray paths = new JSONArray(result);
                for (int i = 0; i < paths.length(); i++) {


                    String userid = paths.getJSONObject(i).optString("userid");
                    for (int j = 0; j < mission.getMembers().size(); j++) {
                        GreenMember member = mission.getMembers().get(j);
                        if (member!=null&&userid.equals(member.getUserid())&& member.getSignPic() == null) {
                            String path = paths.getJSONObject(i).optString("path");
                            GreenMedia greenMedia = new GreenMedia();
                            greenMedia.setType(4);
                            greenMedia.setPath(path);
                            greenMedia.setUserid(member.getUserid());
                            GreenDAOManager.getInstence().getDaoSession().getGreenMediaDao().insert(greenMedia);
                        }
                    }
                }
                //获取巡查视频
                return BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL).getMissionRecordPicPath(mUnique.getServer_id(), 2);
            }
        }).observeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        Log.i("Oking", "获取任务日志成功");
                        mPresenter.loadHttpMissionLogSucc(mUnique);

                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        GreenMissionLog unique = GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao().queryBuilder()
                                .where(GreenMissionLogDao.Properties.Task_id.eq(mission.getTaskid())).unique();
                        if (unique == null) {
                            mUnique = new GreenMissionLog();
                            mUnique.setTask_id(mission.getTaskid());
                            mUnique.setName(OkingContract.CURRENTUSER.getUserid());
                            mUnique.setStatus(0);
                            GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao().insert(mUnique);
                            mPresenter.loadEmpty(mUnique);
                        } else {
                            mPresenter.loadEmpty(unique);
                        }
                    }
                });

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

/**
 * Created by Administrator on 2018/4/13.
 */

public class SaveOrRemoveDataEvent {
    public int type;

    public SaveOrRemoveDataEvent(int type) {
        this.type = type;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;


/**
 * Created by Administrator on 2018/4/8.
 */

public class UpdateGreenMissionTaskOV {
    private int type;
    private int position;
    private GreenMissionTask missionTask;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public GreenMissionTask getMissionTask() {
        return missionTask;
    }

    public void setMissionTask(GreenMissionTask missionTask) {
        this.missionTask = missionTask;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.http;

/**
 * Created by Administrator on 2018/4/18.
 */

public class Api {
    public static final String BASE_URL = "http://10.44.21.26:8087";
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

/**
 * Created by Administrator on 2018/5/28/028.
 */

public class BinnerItem {
    private String title;
    private int picPath;
    private String toContent;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getPicPath() {
        return picPath;
    }

    public void setPicPath(int picPath) {
        this.picPath = picPath;
    }

    public String getToContent() {
        return toContent;
    }

    public void setToContent(String toContent) {
        this.toContent = toContent;
    }

    @Override
    public String toString() {
        return "BinnerItem{" +
                "title='" + title + '\'' +
                ", picPath='" + picPath + '\'' +
                ", toContent='" + toContent + '\'' +
                '}';
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;

import java.util.List;

/**
 * Created by Administrator on 2018/5/17.
 */

public class StatisRcyAdapter extends BaseQuickAdapter<GreenMissionTask, BaseViewHolder> {
    public StatisRcyAdapter(int layoutResId, @Nullable List<GreenMissionTask> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GreenMissionTask item) {
        helper.setText(R.id.tv_taskname,"任务名称："+item.getTask_name());
        helper.setText(R.id.tv_taskid,"任务编号："+item.getTaskid());
        helper.setText(R.id.tv_fbr,"发布人："+item.getPublisher_name());

        switch (item.getStatus()) {
            case "0":

            case "1":

            case "2":
                helper.setText(R.id.tv_state,"未安排人员");
                break;
            case "3":
                helper.setText(R.id.tv_state,"已安排，待执行");
                break;
            case "4":
                helper.setText(R.id.tv_state,"巡查中");
                break;
            case "100":
                helper.setText(R.id.tv_state,"巡查结束");
                break;
            case "5":
                helper.setText(R.id.tv_state,"已上报");
                break;
            case "9":
                helper.setText(R.id.tv_state,"退回修改");
                break;
            default:
                break;

        }

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.PixelFormat;
import android.hardware.Camera;
import android.media.MediaRecorder;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.PowerManager;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.ImageView;
import android.widget.Toast;
import android.widget.VideoView;

import com.hyphenate.easeui.ui.EaseBaseActivity;
import com.hyphenate.easeui.utils.EaseCommonUtils;
import com.hyphenate.util.EMLog;
import com.zhang.baselib.utils.Util;
import com.zhang.okinglawenforcementphone.R;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.List;

public class VideoRecordActivity extends EaseBaseActivity implements
        View.OnClickListener, SurfaceHolder.Callback, MediaRecorder.OnErrorListener,
        MediaRecorder.OnInfoListener {

    private static final String TAG = "VideoRecordActivity";
    private final static String CLASS_LABEL = "VideoRecordActivity";
    private PowerManager.WakeLock mWakeLock;
    private ImageView btnStart;
    private ImageView btnStop;
    private MediaRecorder mediaRecorder;
    private VideoView mVideoView;// to display video
    String localPath = "";// path to save recorded video
    private Camera mCamera;
    private int previewWidth = 640;
    private int previewHeight = 480;
    private Chronometer chronometer;
    private int frontCamera = 0; // 0 is back camera，1 is front camera
    private Button btn_switch;

    private SurfaceHolder mSurfaceHolder;
    int defaultVideoFrameRate = -1;
    SimpleDateFormat mSdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
    private String mFileName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);// no title
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);// full screen
        // translucency mode，used in surface view
        getWindow().setFormat(PixelFormat.TRANSLUCENT);
        setContentView(R.layout.em_recorder_activity);
        PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
        mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
                CLASS_LABEL);
        mWakeLock.acquire();
        initViews();
    }

    private void initViews() {
        btn_switch = (Button) findViewById(R.id.switch_btn);
        btn_switch.setOnClickListener(this);
//        btn_switch.setVisibility(View.VISIBLE);
        mVideoView = (VideoView) findViewById(R.id.mVideoView);
        btnStart = (ImageView) findViewById(R.id.recorder_start);
        btnStop = (ImageView) findViewById(R.id.recorder_stop);
        btnStart.setOnClickListener(this);
        btnStop.setOnClickListener(this);
        mSurfaceHolder = mVideoView.getHolder();
        mSurfaceHolder.addCallback(this);
        mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        chronometer = (Chronometer) findViewById(R.id.chronometer);
    }

    public void back(View view) {
        releaseRecorder();
        releaseCamera();
        finish();
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (mWakeLock == null) {
            // keep screen on
            PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
            mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
                    CLASS_LABEL);
            mWakeLock.acquire();
        }
    }

    @SuppressLint("NewApi")
    private boolean initCamera() {
        try {
            if (frontCamera == 0) {
                mCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);

            } else {
                mCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
            }
            Camera.Parameters camParams = mCamera.getParameters();
            mCamera.lock();
            mSurfaceHolder = mVideoView.getHolder();
            mCamera.cancelAutoFocus();          //自动对焦
            mSurfaceHolder.addCallback(this);
            mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
            mCamera.setDisplayOrientation(90);


        } catch (RuntimeException ex) {
            EMLog.e("video", "init Camera fail " + ex.getMessage());
            return false;
        }
        return true;
    }

    private void handleSurfaceChanged() {
        if (mCamera == null) {
            finish();
            return;
        }
        boolean hasSupportRate = false;
        List<Integer> supportedPreviewFrameRates = mCamera.getParameters()
                .getSupportedPreviewFrameRates();
        if (supportedPreviewFrameRates != null
                && supportedPreviewFrameRates.size() > 0) {
            Collections.sort(supportedPreviewFrameRates);
            for (int i = 0; i < supportedPreviewFrameRates.size(); i++) {
                int supportRate = supportedPreviewFrameRates.get(i);

                if (supportRate == 15) {
                    hasSupportRate = true;
                }

            }
            if (hasSupportRate) {
                defaultVideoFrameRate = 15;
            } else {
                defaultVideoFrameRate = supportedPreviewFrameRates.get(0);
            }

        }

        // get all resolutions which camera provide
        List<Camera.Size> resolutionList = Util.getResolutionList(mCamera);
        if (resolutionList != null && resolutionList.size() > 0) {
            Collections.sort(resolutionList, new Util.ResolutionComparator());
            Camera.Size previewSize = null;
            boolean hasSize = false;

            // use 60*480 if camera support
            for (int i = 0; i < resolutionList.size(); i++) {
                Camera.Size size = resolutionList.get(i);
                if (size != null && size.width == 640 && size.height == 480) {
                    previewSize = size;
                    previewWidth = previewSize.width;
                    previewHeight = previewSize.height;
                    hasSize = true;
                    break;
                }
            }
            // use medium resolution if camera don't support the above resolution
            if (!hasSize) {
                int mediumResolution = resolutionList.size() / 2;
                if (mediumResolution >= resolutionList.size())
                    mediumResolution = resolutionList.size() - 1;
                previewSize = resolutionList.get(mediumResolution);
                previewWidth = previewSize.width;
                previewHeight = previewSize.height;

            }
        }
    }

    @Override
    protected void onPause() {
        super.onPause();

        if (mWakeLock != null) {
            mWakeLock.release();
            mWakeLock = null;
        }

        releaseRecorder();
        releaseCamera();

        finish();
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.switch_btn:
                switchCamera();
                break;
            case R.id.recorder_start:
                if (!startRecording())
                    return;
                Toast.makeText(this, R.string.The_video_to_start, Toast.LENGTH_SHORT).show();
                btn_switch.setVisibility(View.INVISIBLE);
                btnStart.setVisibility(View.INVISIBLE);
                btnStart.setEnabled(false);
                btnStop.setVisibility(View.VISIBLE);
                chronometer.setBase(SystemClock.elapsedRealtime());
                chronometer.start();

                break;
            case R.id.recorder_stop:
                btnStop.setEnabled(false);
                stopRecording();
                btn_switch.setVisibility(View.VISIBLE);
                chronometer.stop();
                btnStart.setVisibility(View.VISIBLE);
                btnStop.setVisibility(View.INVISIBLE);
                sendVideo(null);
                break;

            default:
                break;
        }
    }

    @Override
    public void surfaceChanged(SurfaceHolder holder, int format, int width,
                               int height) {
        mSurfaceHolder = holder;
    }

    @Override
    public void surfaceCreated(SurfaceHolder holder) {
        if (mCamera == null) {
            if (!initCamera()) {
                showFailDialog();
                return;
            }

        }
        try {
            mCamera.setPreviewDisplay(mSurfaceHolder);
            mCamera.startPreview();
            handleSurfaceChanged();
        } catch (Exception e1) {
            EMLog.e("video", "start preview fail " + e1.getMessage());
            showFailDialog();
        }
    }

    @Override
    public void surfaceDestroyed(SurfaceHolder arg0) {
        EMLog.v("video", "surfaceDestroyed");
    }

    public boolean startRecording() {
        if (mediaRecorder == null) {
            if (!initRecorder())
                return false;
        }

        mediaRecorder.setOnInfoListener(this);
        mediaRecorder.setOnErrorListener(this);
        mediaRecorder.start();
        return true;
    }

    @SuppressLint("NewApi")
    private boolean initRecorder() {
        if (!EaseCommonUtils.isSdcardExist()) {
            showNoSDCardDialog();
            return false;
        }

        if (mCamera == null) {
            if (!initCamera()) {
                showFailDialog();
                return false;
            }
        }
        mVideoView.setVisibility(View.VISIBLE);
        mCamera.stopPreview();
        mediaRecorder = new MediaRecorder();
        mCamera.unlock();
        mediaRecorder.setCamera(mCamera);
        mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
        mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
//        mediaRecorder.setOrientationHint(90);
        if (frontCamera == 1) {
            mediaRecorder.setOrientationHint(270);
        } else {
            mediaRecorder.setOrientationHint(90);
        }

        mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
        mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
        mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
        // set resolution, should be set after the format and encoder was set
        mediaRecorder.setVideoSize(previewWidth, previewHeight);
        mediaRecorder.setVideoEncodingBitRate(900*1024);
        // set frame rate, should be set after the format and encoder was set
        if (defaultVideoFrameRate != -1) {
            mediaRecorder.setVideoFrameRate(defaultVideoFrameRate);
        }

        // set the path for video file
        mFileName = mSdf.format(System.currentTimeMillis());
        localPath = "/storage/emulated/0/oking/mission_video/"
                + mFileName + ".mp4";
        File file = new File("/storage/emulated/0/oking/mission_video/");
        if (!file.exists()) {
            file.mkdir();
        }
        mediaRecorder.setOutputFile(localPath);
        mediaRecorder.setMaxDuration(300000);
        mediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
        try {
            mediaRecorder.prepare();
        } catch (IllegalStateException e) {
            e.printStackTrace();
            return false;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
        return true;

    }

    public void stopRecording() {
        if (mediaRecorder != null) {
            mediaRecorder.setOnErrorListener(null);
            mediaRecorder.setOnInfoListener(null);

            try {
                mediaRecorder.stop();

            } catch (Exception e) {
                EMLog.e("video", "stopRecording error:" + e.getMessage());
            }
        }
        releaseRecorder();

        if (mCamera != null) {
            mCamera.stopPreview();
            releaseCamera();
        }
    }

    private void releaseRecorder() {
        if (mediaRecorder != null) {
            mediaRecorder.release();
            mediaRecorder = null;
        }
    }

    protected void releaseCamera() {
        try {
            if (mCamera != null) {
                mCamera.stopPreview();
                mCamera.release();
                mCamera = null;
            }
        } catch (Exception e) {
        }
    }

    @SuppressLint("NewApi")
    public void switchCamera() {

        if (mCamera == null) {
            return;
        }
        if (Camera.getNumberOfCameras() >= 2) {
            btn_switch.setEnabled(false);
            if (mCamera != null) {
                mCamera.stopPreview();
                mCamera.release();
                mCamera = null;
            }

            switch (frontCamera) {
                case 0:
                    mCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
                    frontCamera = 1;
                    break;
                case 1:
                    mCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
                    frontCamera = 0;
                    break;
            }
            try {
                mCamera.lock();
//                mCamera.setDisplayOrientation(90);
                mCamera.setPreviewDisplay(mVideoView.getHolder());
                mCamera.startPreview();
            } catch (IOException e) {
                mCamera.release();
                mCamera = null;
            }
            btn_switch.setEnabled(true);

        }

    }


    public void sendVideo(View view) {
        if (TextUtils.isEmpty(localPath)) {
            return;
        }

        File file = new File(localPath);
        Intent intent = getIntent();
        intent.setData(Uri.fromFile(file));
        setResult(RESULT_OK, intent);
        finish();

    }

    @Override
    public void onInfo(MediaRecorder mr, int what, int extra) {
        EMLog.v("video", "onInfo");
        if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED) {
            EMLog.v("video", "max duration reached");
            stopRecording();
            btn_switch.setVisibility(View.VISIBLE);
            chronometer.stop();
            btnStart.setVisibility(View.GONE);
            btnStop.setVisibility(View.VISIBLE);
            chronometer.stop();
            if (localPath == null) {
                return;
            }
            new AlertDialog.Builder(this)
                    .setCancelable(false)
                    .setMessage("单个视频时长已达最长")
                    .setPositiveButton(R.string.ok,
                            new DialogInterface.OnClickListener() {

                                @Override
                                public void onClick(DialogInterface arg0,
                                                    int arg1) {
                                    arg0.dismiss();
                                    sendVideo(null);

                                }
                            }).setNegativeButton(R.string.cancel, null)
                    .setCancelable(false).show();
        }

    }

    @Override
    public void onError(MediaRecorder mr, int what, int extra) {
        EMLog.e("video", "recording onError:");
        stopRecording();
        Toast.makeText(this,
                "Recording error has occurred. Stopping the recording",
                Toast.LENGTH_SHORT).show();

    }

    public void saveBitmapFile(Bitmap bitmap) {
        File file = new File(Environment.getExternalStorageDirectory(), "a.jpg");
        try {
            BufferedOutputStream bos = new BufferedOutputStream(
                    new FileOutputStream(file));
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos);
            bos.flush();
            bos.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        releaseCamera();

        if (mWakeLock != null) {
            mWakeLock.release();
            mWakeLock = null;
        }

    }

    @Override
    public void onBackPressed() {
        back(null);
    }

    private void showFailDialog() {
        new AlertDialog.Builder(this)
                .setTitle(R.string.prompt)
                .setMessage(R.string.Open_the_equipment_failure)
                .setPositiveButton(R.string.ok,
                        new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialog,
                                                int which) {
                                finish();

                            }
                        }).setCancelable(false).show();

    }

    private void showNoSDCardDialog() {
        new AlertDialog.Builder(this)
                .setTitle(R.string.prompt)
                .setMessage("No sd card!")
                .setPositiveButton(R.string.ok,
                        new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialog,
                                                int which) {
                                finish();

                            }
                        }).setCancelable(false).show();
    }

}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

import com.chad.library.adapter.base.entity.MultiItemEntity;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;

/**
 * Created by Administrator on 2018/4/11.
 */
@Entity
public class GreenEquipment implements MultiItemEntity {
    @Id(autoincrement = true)
    private Long id;
    private String type2;
    private String mc1;      //装备类型
    private String type;      //装备类型code
    private String mc2;    //装备名称
    private String value;
    private String ly;
    private String remarks;
    private String deptId;
    private int itemType = 0;

    @Generated(hash = 996505078)
    public GreenEquipment(Long id, String type2, String mc1, String type,
            String mc2, String value, String ly, String remarks, String deptId,
            int itemType) {
        this.id = id;
        this.type2 = type2;
        this.mc1 = mc1;
        this.type = type;
        this.mc2 = mc2;
        this.value = value;
        this.ly = ly;
        this.remarks = remarks;
        this.deptId = deptId;
        this.itemType = itemType;
    }

    @Generated(hash = 119980583)
    public GreenEquipment() {
    }
    
    @Override
    public int getItemType() {
        return itemType;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getType2() {
        return this.type2;
    }

    public void setType2(String type2) {
        this.type2 = type2;
    }

    public String getMc1() {
        return this.mc1;
    }

    public void setMc1(String mc1) {
        this.mc1 = mc1;
    }

    public String getType() {
        return this.type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getMc2() {
        return this.mc2;
    }

    public void setMc2(String mc2) {
        this.mc2 = mc2;
    }

    public String getValue() {
        return this.value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getLy() {
        return this.ly;
    }

    public void setLy(String ly) {
        this.ly = ly;
    }

    public String getRemarks() {
        return this.remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getDeptId() {
        return this.deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public void setItemType(int itemType) {
        this.itemType = itemType;
    }

    @Override
    public String toString() {
        return "GreenEquipment{" +
                "id=" + id +
                ", type2='" + type2 + '\'' +
                ", mc1='" + mc1 + '\'' +
                ", type='" + type + '\'' +
                ", mc2='" + mc2 + '\'' +
                ", value='" + value + '\'' +
                ", ly='" + ly + '\'' +
                ", remarks='" + remarks + '\'' +
                ", deptId='" + deptId + '\'' +
                ", itemType=" + itemType +
                '}';
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;
import com.zhang.okinglawenforcementphone.mvp.ui.fragments.LawEnforcementSpecificationFragment;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class FromAllLawEnforcementSpecificationActivity extends BaseActivity {

    @BindView(R.id.tv_title)
    TextView mTvTitle;
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    private Unbinder mBind;
    private LawEnforcementSpecificationFragment mLawEnforcementSpecificationFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_from_all_law_enforcement_specification);
        mBind = ButterKnife.bind(this);
        initData();
        setListener();
    }

    private void setListener() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
                Fragment enforcementInspectionNormsFragment = getSupportFragmentManager().findFragmentByTag("EnforcementInspectionNormsFragment");
                Fragment enforcementLanguageSpecificationFragment = getSupportFragmentManager().findFragmentByTag("EnforcementLanguageSpecificationFragment");
                Fragment administrativeEnforcementFragment = getSupportFragmentManager().findFragmentByTag("AdministrativeEnforcementFragment");
                if (enforcementInspectionNormsFragment!=null&&!enforcementInspectionNormsFragment.isHidden()){
                    fragmentTransaction.hide(enforcementInspectionNormsFragment);
                    fragmentTransaction.show(mLawEnforcementSpecificationFragment).commit();
                }else if (enforcementLanguageSpecificationFragment!=null&&!enforcementLanguageSpecificationFragment.isHidden()){
                    fragmentTransaction.hide(enforcementLanguageSpecificationFragment);
                    fragmentTransaction.show(mLawEnforcementSpecificationFragment).commit();
                }else if (administrativeEnforcementFragment!=null&&!administrativeEnforcementFragment.isHidden()){
                    fragmentTransaction.hide(administrativeEnforcementFragment);
                    fragmentTransaction.show(mLawEnforcementSpecificationFragment).commit();
                }else {

                    finish();
                }
            }
        });
    }

    private void initData() {
        mLawEnforcementSpecificationFragment = LawEnforcementSpecificationFragment.newInstance(null, null);
        getSupportFragmentManager().beginTransaction().replace(R.id.rl_administrative_content, mLawEnforcementSpecificationFragment, "LawEnforcementSpecificationFragment").commit();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBind.unbind();
    }

    public void setTitleText(String title) {
        mTvTitle.setText(title);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;


import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.PowerManager;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.hyphenate.EMError;
import com.hyphenate.easeui.model.EaseVoiceRecorder;
import com.hyphenate.easeui.utils.EaseCommonUtils;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.ui.views.RxDialogSure;
import com.zhang.baselib.ui.views.RxDialogSureCancel;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.MediaManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.CaseSimpleAdapter;
import com.zhang.okinglawenforcementphone.adapter.SoundSimpleAdapter;
import com.zhang.okinglawenforcementphone.adapter.SourceArrayRecyAdapter;
import com.zhang.okinglawenforcementphone.adapter.SpinnerArrayAdapter;
import com.zhang.okinglawenforcementphone.beans.GreenCase;
import com.zhang.okinglawenforcementphone.beans.GreenEvidence;
import com.zhang.okinglawenforcementphone.beans.GreenEvidenceDao;
import com.zhang.okinglawenforcementphone.beans.GreenEvidenceMedia;
import com.zhang.okinglawenforcementphone.beans.GreenEvidenceSTZJOV;
import com.zhang.okinglawenforcementphone.beans.GreenMedia;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.beans.SaveOrRemoveDataEvent;
import com.zhang.okinglawenforcementphone.beans.SourceArrayOV;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.EvidenceManagerActivity;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.VideoRecordActivity;
import com.zhang.okinglawenforcementphone.utils.DialogUtil;
import com.zhang.okinglawenforcementphone.views.DividerItemDecoration;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;


import static android.app.Activity.RESULT_OK;

/**
 * A simple {@link Fragment} subclass.
 */
public class CaseAudioVideoEvidenceFragment extends Fragment {
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_TYPE = "type";
    private static final String ARG_EVIDENCE = "evidence";
    //    private static final int PHOTO_FROM_CAMERA = 100;
//    private static final int PHOTO_FROM_GALLERY = 101;
    private static final int VIDEO_FROM_CAMERA = 102;
    private static final int VIDEO_FROM_GALLERY = 103;

    private GreenEvidence myEvidence;
    private GreenCase mycase;
    private TextView evidence_name_tv, evidence_content_tv, evidence_remark_tv;
    private TextView evidence_getLocation_tv, evidence_man_textView, evidence_dept_tv, evidence_pagerCount_tv;
    private TextView type_spinner, evidence_source_spinner;
    private Button save_button, close_button;
    private GridView video_gridView, sound_gridView;

    private SoundSimpleAdapter soundAdapter;
    private CaseSimpleAdapter videoAdapter;

    private ArrayList<GreenEvidenceMedia> soundList = new ArrayList<>();
    private ArrayList<GreenEvidenceMedia> videoList = new ArrayList<>();
    private int mType;
    private long mEvidenceId;
    //    private Uri photouri, videouri;


    private RxDialogSureCancel mRxDialogSureCancel;
    private View mInflate;
    private TextView mTv_stop;
    private TextView mTv_cancel;
    private AlertDialog mAlertDialog;
    private EvidenceManagerActivity mEvidenceManagerActivity;
    private ArrayList<SourceArrayOV> mPlandataOVS;
    private ArrayList<SourceArrayOV> mTypedataOVS;
    private DialogUtil mDialogUtil;
    private View mButtonDailog;
    private TextView mTv_title;
    private SourceArrayRecyAdapter mSourceArrayRecyAdapter;

    public CaseAudioVideoEvidenceFragment() {
        // Required empty public constructor
    }

    public static CaseAudioVideoEvidenceFragment newInstance(int type) {
        CaseAudioVideoEvidenceFragment fragment = new CaseAudioVideoEvidenceFragment();
        Bundle args = new Bundle();
        args.putInt(ARG_TYPE, type);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mType = getArguments().getInt(ARG_TYPE);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_case_forensics, container, false);

        }

        initView(mInflate);
        return mInflate;

    }


    @Override
    public void onDestroyView() {
//        getActivity().unregisterReceiver(mReceiver);
        if (MediaManager.mPlayer != null) {

            MediaManager.mPlayer.reset();
            MediaManager.mPlayer = null;
        }
        super.onDestroyView();
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mEvidenceManagerActivity = (EvidenceManagerActivity) context;
        mEvidenceManagerActivity.setVisibleAdd(false);
    }

    public void initView(View rootView) {


        evidence_name_tv = (TextView) rootView.findViewById(R.id.evidence_name_tv);
        evidence_source_spinner = (TextView) rootView.findViewById(R.id.evidence_source_spinner);
        video_gridView = (GridView) rootView.findViewById(R.id.video_gridView);
        sound_gridView = (GridView) rootView.findViewById(R.id.sound_gridView);

        String[] plandataset = getResources().getStringArray(R.array.spinner_evidence_source);
        mPlandataOVS = new ArrayList<>();
        for (String s : plandataset) {
            SourceArrayOV sourceArrayOV = new SourceArrayOV();
            sourceArrayOV.setType(0);
            sourceArrayOV.setSource(s);
            mPlandataOVS.add(sourceArrayOV);
        }
        if (mDialogUtil == null) {

            mDialogUtil = new DialogUtil();

            mButtonDailog = View.inflate(BaseApplication.getApplictaion(), R.layout.maptask_dialog, null);
            mTv_title = mButtonDailog.findViewById(R.id.tv_title);
            RecyclerView recyList = mButtonDailog.findViewById(R.id.recy_task);
            recyList.setLayoutManager(new LinearLayoutManager(BaseApplication.getApplictaion(), LinearLayoutManager.VERTICAL, false));
            recyList.addItemDecoration(new DividerItemDecoration(BaseApplication.getApplictaion(), 0, 3, Color.TRANSPARENT));
            mSourceArrayRecyAdapter = new SourceArrayRecyAdapter(R.layout.source_item, null);
            mSourceArrayRecyAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
            recyList.setAdapter(mSourceArrayRecyAdapter);
            mSourceArrayRecyAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
                @Override
                public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                    List<SourceArrayOV> data = adapter.getData();
                    SourceArrayOV sourceArrayOV = data.get(position);
                    switch (sourceArrayOV.getType()) {
                        case 0:
                            switch (sourceArrayOV.getSource()) {
                                case "当事人提供":
                                    myEvidence.setZJLY("DSRTG");
                                    myEvidence.setZJLYMC(sourceArrayOV.getSource());
                                    break;
                                case "当事人口述":
                                    myEvidence.setZJLY("DSRKS");
                                    myEvidence.setZJLYMC(sourceArrayOV.getSource());
                                    break;
                                case "调查搜集":
                                    myEvidence.setZJLY("DCSJ");
                                    myEvidence.setZJLYMC(sourceArrayOV.getSource());
                                    break;
                                case "执法人员制作":
                                    myEvidence.setZJLY("ZFRYZZ");
                                    myEvidence.setZJLYMC(sourceArrayOV.getSource());
                                    break;
                                case "执法人员拍摄":
                                    myEvidence.setZJLY("ZFRYPS");
                                    myEvidence.setZJLYMC(sourceArrayOV.getSource());
                                    break;
                                case "局审批科室":
                                    myEvidence.setZJLY("JSPKS");
                                    myEvidence.setZJLYMC(sourceArrayOV.getSource());
                                    break;
                                default:
                                    break;
                            }
                            evidence_source_spinner.setText(sourceArrayOV.getSource());
                            break;
                        case 1:
                            switch (position) {
                                case 0:
                                    video_gridView.setVisibility(View.VISIBLE);
                                    ((LinearLayout) sound_gridView.getParent()).setVisibility(View.INVISIBLE);
                                    break;
                                case 1:
                                    video_gridView.setVisibility(View.INVISIBLE);
                                    ((LinearLayout) sound_gridView.getParent()).setVisibility(View.VISIBLE);
                                    break;
                                default:
                                    break;
                            }
                            type_spinner.setText(sourceArrayOV.getSource());
                            break;
                        default:
                            break;
                    }

                    mDialogUtil.cancelDialog();
                }
            });
        }


        type_spinner = (TextView) rootView.findViewById(R.id.type_spinner);
        String[] typedataset = getResources().getStringArray(R.array.spinner_data_type);
        mTypedataOVS = new ArrayList<>();
        for (String s : typedataset) {
            SourceArrayOV sourceArrayOV = new SourceArrayOV();
            sourceArrayOV.setType(1);
            sourceArrayOV.setSource(s);
            mTypedataOVS.add(sourceArrayOV);
        }

        evidence_content_tv = (TextView) rootView.findViewById(R.id.evidence_content_tv);
        evidence_remark_tv = (TextView) rootView.findViewById(R.id.evidence_remark_tv);
        evidence_getLocation_tv = (TextView) rootView.findViewById(R.id.evidence_getLocation_tv);
        evidence_man_textView = (TextView) rootView.findViewById(R.id.evidence_man_textView);
        evidence_dept_tv = (TextView) rootView.findViewById(R.id.evidence_dept_tv);
        evidence_pagerCount_tv = (TextView) rootView.findViewById(R.id.evidence_pagerCount_tv);
        save_button = (Button) rootView.findViewById(R.id.save_button);
        if (myEvidence != null) {
            mEvidenceId = myEvidence.getId();
            evidence_name_tv.setText(myEvidence.getZJMC());
            evidence_content_tv.setText(myEvidence.getZJNR());
            evidence_remark_tv.setText(myEvidence.getBZ());
            evidence_getLocation_tv.setText(myEvidence.getCJDD());
            evidence_man_textView.setText(myEvidence.getJZR());
            evidence_dept_tv.setText(myEvidence.getDW());
            evidence_pagerCount_tv.setText(myEvidence.getYS());


            myEvidence.resetGreenMedia();
            List<GreenEvidenceMedia> greenMedia = myEvidence.getGreenMedia();
            if (greenMedia != null && greenMedia.size() > 0) {
                videoList.clear();
                soundList.clear();
                for (GreenEvidenceMedia media : greenMedia) {
                    if (media.getType() == 2) {

                        videoList.add(media);
                    }
                }

                for (GreenEvidenceMedia media : greenMedia) {
                    if (media.getType() == 3) {

                        soundList.add(media);
                    }
                }
            }


            if (videoList != null && videoList.size() > 0) {
                type_spinner.setText("视频");
                video_gridView.setVisibility(View.VISIBLE);
                ((LinearLayout) sound_gridView.getParent()).setVisibility(View.INVISIBLE);
            } else if (soundList != null && soundList.size() > 0) {
                type_spinner.setText("语音");
                video_gridView.setVisibility(View.INVISIBLE);
                ((LinearLayout) sound_gridView.getParent()).setVisibility(View.VISIBLE);
            } else {
                type_spinner.setText("视频");
                video_gridView.setVisibility(View.INVISIBLE);
                ((LinearLayout) sound_gridView.getParent()).setVisibility(View.INVISIBLE);
            }


        } else {

            myEvidence = new GreenEvidence();
            myEvidence.setGreenCaseId(mycase.getId());
            myEvidence.setZJID(UUID.randomUUID().toString());
            myEvidence.setAJID(mycase.getAJID());
            myEvidence.setZJLX("STZL");
            mEvidenceId = GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceDao().insert(myEvidence);


        }

        if (mType == 0) {
            save_button.setVisibility(View.GONE);

        } else {
            save_button.setVisibility(View.VISIBLE);
        }

        evidence_source_spinner.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mSourceArrayRecyAdapter.setNewData(mPlandataOVS);
                mDialogUtil.showBottomDialog(mEvidenceManagerActivity, mButtonDailog, 300f);
            }
        });

        type_spinner.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mSourceArrayRecyAdapter.setNewData(mTypedataOVS);
                mDialogUtil.showBottomDialog(mEvidenceManagerActivity, mButtonDailog, 300f);
            }
        });
        save_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (localSaveEvidence()) {

                    final RxDialogSure rxDialogSure = new RxDialogSure(getActivity());
                    rxDialogSure.setTitle("提示");
                    rxDialogSure.setContent("保存成功！");
                    rxDialogSure.getTvSure().setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            rxDialogSure.cancel();
                            mEvidenceManagerActivity.setVisibleAdd(true);
                            GreenEvidenceSTZJOV greenEvidenceOV = new GreenEvidenceSTZJOV();
                            greenEvidenceOV.setType(mType);
                            greenEvidenceOV.setGreenEvidence(myEvidence);
                            EventBus.getDefault().post(greenEvidenceOV);
                            getFragmentManager().beginTransaction().remove(CaseAudioVideoEvidenceFragment.this).commit();

                        }
                    });
                    rxDialogSure.show();


                }
            }
        });
        close_button = (Button) rootView.findViewById(R.id.close_button);
        close_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mEvidenceManagerActivity.setVisibleAdd(true);
                getFragmentManager().beginTransaction().remove(CaseAudioVideoEvidenceFragment.this).commit();

            }
        });


        initVoiceRecorder();

        setSoundGridView();
        setVideoGridView();


    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void handleEvent1(SaveOrRemoveDataEvent event) {

        if (event.type == 0) {             //保存数据

        } else {                            //不保存数据
            GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceDao().deleteByKey(mEvidenceId);
        }
    }


    private PowerManager.WakeLock wakeLock;
    private EaseVoiceRecorder voiceRecorder;
    private Drawable[] micImages;
    private ImageView mMic_image;
    private Handler micImageHandler = new Handler() {
        @Override
        public void handleMessage(android.os.Message msg) {
            // change image
            mMic_image.setImageDrawable(micImages[msg.what]);
        }
    };

    /**
     * 初始化录音
     */
    private void initVoiceRecorder() {
        wakeLock = ((PowerManager) BaseApplication.getApplictaion().getSystemService(Context.POWER_SERVICE)).newWakeLock(
                PowerManager.SCREEN_DIM_WAKE_LOCK, "oking");

        micImages = new Drawable[]{BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_01),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_02),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_03),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_04),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_05),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_06),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_07),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_08),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_09),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_10),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_11),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_12),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_13),
                BaseApplication.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_14),};

        voiceRecorder = new EaseVoiceRecorder(micImageHandler);

    }

    private void setSoundGridView() {


        soundAdapter = new SoundSimpleAdapter(soundList, !myEvidence.getIsUpload());
        soundAdapter.setOnClickListener(new SoundSimpleAdapter.OnClickListener() {

            private AlertDialog.Builder mBuilder;

            @Override
            public void onLongItemClick(final SoundSimpleAdapter adapter, final ArrayList<GreenEvidenceMedia> data, final int position) {
                if (mRxDialogSureCancel == null) {

                    mRxDialogSureCancel = new RxDialogSureCancel(getActivity());

                }
                mRxDialogSureCancel.setTitle("提示");
                mRxDialogSureCancel.setContent("是否删除声音文件？");
                mRxDialogSureCancel.getTvSure().setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        String path = data.get(position).getPath();
                        File file = new File(path);
                        if (file.exists()) {
                            file.delete();
                            //ACTION_MEDIA_SCANNER_SCAN_FILE

                            Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_FINISHED);
                            intent.setData(Uri.fromFile(file));
                            CaseAudioVideoEvidenceFragment.this.getContext().sendBroadcast(intent);
                        }
                        data.remove(position);
                        adapter.notifyDataSetChanged();


                        mRxDialogSureCancel.cancel();
                    }
                });
                mRxDialogSureCancel.getTvCancel().setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        mRxDialogSureCancel.cancel();
                    }
                });
                mRxDialogSureCancel.show();
            }

            @Override
            public void onAddSoundClick() {
                if (mBuilder == null) {
                    mBuilder = new AlertDialog.Builder(getActivity());
                    View recordingView = View.inflate(getActivity(), R.layout.voice_recorder_dialog, null);
                    mMic_image = recordingView.findViewById(R.id.mic_image);
                    mTv_stop = recordingView.findViewById(R.id.tv_stop);
                    mTv_cancel = recordingView.findViewById(R.id.tv_cancel);
                    mBuilder.setView(recordingView);
                    mAlertDialog = mBuilder.create();
                    mAlertDialog.setCanceledOnTouchOutside(false);
                    mAlertDialog.show();
                    WindowManager.LayoutParams params =
                            mAlertDialog.getWindow().getAttributes();
                    params.width = 580;
                    params.height = 530;
                    mAlertDialog.getWindow().setAttributes(params);
                }

                startRecording();
                mTv_stop.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        try {
                            int length = stopRecoding();
                            if (length > 0) {

                                GreenEvidenceMedia greenMedia = new GreenEvidenceMedia();
                                greenMedia.setGreenEvidenceId(myEvidence.getGreenCaseId());
                                greenMedia.setPath(Environment.getExternalStorageDirectory() + "/oking/mission_voice/" + getVoiceFileName());
                                greenMedia.setType(3);
                                GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceMediaDao().insert(greenMedia);
                                soundList.add(greenMedia);
                                soundAdapter.notifyDataSetChanged();
                            } else if (length == EMError.FILE_INVALID) {
                                RxToast.error(BaseApplication.getApplictaion(), "录音失败", Toast.LENGTH_SHORT).show();
                            } else {
                                RxToast.warning(BaseApplication.getApplictaion(), "录音时间太短", Toast.LENGTH_SHORT).show();
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                            RxToast.error(BaseApplication.getApplictaion(), "录音失败", Toast.LENGTH_SHORT).show();
                        }


                        mAlertDialog.cancel();

                    }
                });

                mTv_cancel.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        stopRecoding();
                        mAlertDialog.cancel();
                    }
                });

            }
        });

        sound_gridView.setAdapter(soundAdapter);

    }

    public String getVoiceFileName() {
        return voiceRecorder.getVoiceFileName();
    }

    private int stopRecoding() {
        if (wakeLock.isHeld()) {

            wakeLock.release();
        }
        return voiceRecorder.stopRecoding();
    }


    private void startRecording() {
        if (!EaseCommonUtils.isSdcardExist()) {
            RxToast.error(BaseApplication.getApplictaion(), "请插上sd卡", Toast.LENGTH_SHORT).show();
            return;
        }
        try {
            wakeLock.acquire();
            voiceRecorder.setRecordTag(true);
            voiceRecorder.startRecording(BaseApplication.getApplictaion());
        } catch (Exception e) {
            e.printStackTrace();
            if (wakeLock.isHeld()) {

                wakeLock.release();
            }
            if (voiceRecorder != null) {

                voiceRecorder.discardRecording();
            }
            RxToast.error(BaseApplication.getApplictaion(), "录音失败,请重试!", Toast.LENGTH_SHORT).show();
            return;
        }
    }


    private void setVideoGridView() {

        videoAdapter = new CaseSimpleAdapter(videoList, this, mType != 0, "视听资料");
        videoAdapter.setOnClickListener(new CaseSimpleAdapter.OnClickListener() {
            @Override
            public void onAddVideo() {


                Intent intent = new Intent();
                intent.setClass(getActivity(), VideoRecordActivity.class);
                CaseAudioVideoEvidenceFragment.this.startActivityForResult(intent, VIDEO_FROM_CAMERA);
            }

            @Override
            public void onLongItemClick(final CaseSimpleAdapter adapter, final ArrayList<GreenEvidenceMedia> data, final int position) {

                if (mRxDialogSureCancel == null) {

                    mRxDialogSureCancel = new RxDialogSureCancel(getActivity());

                }
                mRxDialogSureCancel.setTitle("提示");
                mRxDialogSureCancel.setContent("是否删除原视频？");
                mRxDialogSureCancel.getTvCancel().setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {

                        mRxDialogSureCancel.cancel();
                    }
                });

                mRxDialogSureCancel.getTvSure().setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        String path = data.get(position).getPath();
                        File file = new File(path);
                        if (file.exists()) {
                            file.delete();

                        }
                        data.remove(position);
                        adapter.notifyDataSetChanged();
                        mRxDialogSureCancel.cancel();
                    }
                });

                mRxDialogSureCancel.show();
            }
        });

        video_gridView.setAdapter(videoAdapter);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {

        if (resultCode == RESULT_OK) {
            switch (requestCode) {
                case VIDEO_FROM_CAMERA:

                    Uri videouri = data.getData();
                    GreenEvidenceMedia greenMedia = new GreenEvidenceMedia();
                    greenMedia.setType(2);
                    greenMedia.setPath(videouri.toString());
                    greenMedia.setGreenEvidenceId(myEvidence.getId());
                    GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceMediaDao().insert(greenMedia);
                    videoList.add(greenMedia);
                    videoAdapter.notifyDataSetChanged();

                    //通知系统扫描文件
                    Intent intent2 = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
                    intent2.setData(videouri);
                    CaseAudioVideoEvidenceFragment.this.getContext().sendBroadcast(intent2);
                    break;
                case VIDEO_FROM_GALLERY:
                    Uri videoUri = data.getData();
                    GreenEvidenceMedia greenMedia2 = new GreenEvidenceMedia();
                    greenMedia2.setType(2);
                    greenMedia2.setPath(videoUri.toString());
                    greenMedia2.setGreenEvidenceId(myEvidence.getId());
                    GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceMediaDao().insert(greenMedia2);
                    videoList.add(greenMedia2);
                    videoAdapter.notifyDataSetChanged();
                    break;
                default:
                    break;
            }

//            localSaveEvidence();

        }
        super.onActivityResult(requestCode, resultCode, data);
    }

    private boolean localSaveEvidence() {
        if (type_spinner.getText().toString().trim().equals("*请选择")) {
            RxToast.warning("证据类型不能为空！");
            return false;
        }
        if (evidence_source_spinner.getText().toString().trim().equals("*请选择")) {
            RxToast.warning("证据来源不能为空！");
            return false;
        }

        if ("".equals(evidence_name_tv.getText().toString())) {
            Toast.makeText(getContext(), "证据名称不能为空！", Toast.LENGTH_SHORT).show();
            return false;
        }
//        if (evidence_source_spinner.getText().toString().equals("")) {
//            Toast.makeText(getContext(), "证据来源不能为空！", Toast.LENGTH_SHORT).show();
//            return false;
//        }
        if ("".equals(evidence_content_tv.getText().toString())) {
            Toast.makeText(getContext(), "证据内容不能为空！", Toast.LENGTH_SHORT).show();
            return false;
        }
        if ("".equals(evidence_getLocation_tv.getText().toString())) {
            Toast.makeText(getContext(), "采集地点不能为空！", Toast.LENGTH_SHORT).show();
            return false;
        }

        if (soundList.size() > 0 || videoList.size() > 0) {

        } else {
            Toast.makeText(getContext(), "请录入语音或视频！", Toast.LENGTH_SHORT).show();
            return false;
        }


        myEvidence.setZJMC(evidence_name_tv.getText().toString());
        myEvidence.setZJNR(evidence_content_tv.getText().toString());
        myEvidence.setBZ(evidence_remark_tv.getText().toString());
        myEvidence.setCJDD(evidence_getLocation_tv.getText().toString());
        myEvidence.setJZR(evidence_man_textView.getText().toString());
        myEvidence.setDW(evidence_dept_tv.getText().toString());
        myEvidence.setYS(evidence_pagerCount_tv.getText().toString());
        myEvidence.setCJSJ(System.currentTimeMillis());
        myEvidence.setCJR(OkingContract.CURRENTUSER.getUserName());

        if (videoList.size() > 0 && soundList.size() > 0) {
            myEvidence.setOtype("YYSP");            //语音、视频
        } else if (videoList.size() > 0 && soundList.size() < 1) {
            myEvidence.setOtype("SP");          //视频
        } else if (videoList.size() < 1 && soundList.size() > 0) {
            myEvidence.setOtype("YY");          //语音
        }

        if (mType == 0 || mType == 2 && myEvidence != null) {
            mycase.getGreenEvidence().add(myEvidence);
        }

        GreenEvidence unique = GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceDao().queryBuilder().where(GreenEvidenceDao.Properties.Id.eq(mEvidenceId)).unique();
        if (unique == null) {
            myEvidence.setGreenCaseId(mycase.getId());
            GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceDao().insert(myEvidence);
        } else {
            GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceDao().update(myEvidence);
        }

        return true;
    }


    public void setGreenCase(GreenCase greenCase, GreenEvidence greenEvidence) {
        this.mycase = greenCase;
        this.myEvidence = greenEvidence;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.utils;

import com.zhang.okinglawenforcementphone.beans.RecipientBean;

import net.sourceforge.pinyin4j.PinyinHelper;

import java.util.Comparator;


/**
 * Created by Administrator on 2018/1/8.
 */

public class CBRPinyinComparator implements Comparator<RecipientBean> {
    @Override
    public int compare(RecipientBean t0, RecipientBean t1) {

       String us0 =  t0.getUSERNAME();
       String us1 =  t1.getUSERNAME();
        if (us0.startsWith("曾")){
            us0 = us0.replace("曾","增");
        }

        if (us1.startsWith("曾")){
            us1=us1.replace("曾","增");
        }
        return concatPinyinStringArray(PinyinHelper.toHanyuPinyinStringArray(us0.charAt(0)))
                .compareTo(concatPinyinStringArray(PinyinHelper
                        .toHanyuPinyinStringArray(us1.charAt(0))));
    }

    private String concatPinyinStringArray(String[] pinyinArray) {
        StringBuffer pinyinSbf = new StringBuffer();
        if ((pinyinArray != null) && (pinyinArray.length > 0)) {
            for (int i = 0; i < pinyinArray.length; i++) {
                pinyinSbf.append(pinyinArray[i]);
            }
        }
        return pinyinSbf.toString();
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.contract;

/**
 * Created by Administrator on 2018/6/8/008.
 */

public interface LoadTaskPicContract {
    interface Model {
        void loadTaskPic(String logId);
    }

    interface View {
        void loadTaskPicSucc(String result);

        void loadTaskPicFail(Throwable e);
    }

    interface Presenter {
        void loadTaskPic(String logId);

        void loadTaskPicSucc(String result);

        void loadTaskPicFail(Throwable e);
    }
}


<file_sep>package com.zhang.okinglawenforcementphone.mvp.model;

import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.contract.UpdateMissionStateContract;

import io.reactivex.functions.Consumer;
import okhttp3.ResponseBody;

/**
 * Created by Administrator on 2018/4/20.
 */

public class UpdateMissionStateModel implements UpdateMissionStateContract.Model {
    private UpdateMissionStateContract.Presenter mPresenter;

    public UpdateMissionStateModel(UpdateMissionStateContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void updateMissionState(String id, String executeStartTime, String executeEndTime, int status) {
        BaseHttpFactory.getInstence()
                .createService(GDWaterService.class, Api.BASE_URL)
                .updateMissionState(id, executeStartTime, executeEndTime, status)
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        String result = responseBody.string();
                        mPresenter.updateMissionStateSucc(result);
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        mPresenter.updateMissionStateFail(throwable);
                    }
                });
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

/**
 * Created by Administrator on 2017/10/27.
 */

public class LawBean {
    private long rowId;
    private String levelEffectiveness;
    private String publishingDepartment;
    private String releaseTime;
    private String implementationTime;
    private String mmid;
    private String title;
    private String rulesContent;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getLevelEffectiveness() {
        return levelEffectiveness;
    }

    public void setLevelEffectiveness(String levelEffectiveness) {
        this.levelEffectiveness = levelEffectiveness;
    }

    public String getPublishingDepartment() {
        return publishingDepartment;
    }

    public void setPublishingDepartment(String publishingDepartment) {
        this.publishingDepartment = publishingDepartment;
    }

    public String getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(String releaseTime) {
        this.releaseTime = releaseTime;
    }

    public String getImplementationTime() {
        return implementationTime;
    }

    public void setImplementationTime(String implementationTime) {
        this.implementationTime = implementationTime;
    }

    public String getMmid() {
        return mmid;
    }

    public void setMmid(String mmid) {
        this.mmid = mmid;
    }

    public String getRulesContent() {
        return rulesContent;
    }

    public void setRulesContent(String rulesContent) {
        this.rulesContent = rulesContent;
    }

    public long getRowId() {
        return rowId;
    }

    public void setRowId(long rowId) {
        this.rowId = rowId;
    }

    @Override
    public String toString() {
        return "LawBean{" +
                "rowId=" + rowId +
                ", levelEffectiveness='" + levelEffectiveness + '\'' +
                ", publishingDepartment='" + publishingDepartment + '\'' +
                ", releaseTime='" + releaseTime + '\'' +
                ", implementationTime='" + implementationTime + '\'' +
                ", mmid='" + mmid + '\'' +
                ", title='" + title + '\'' +
                ", rulesContent='" + rulesContent + '\'' +
                '}';
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.contract;

import com.google.gson.Gson;
import com.zhang.okinglawenforcementphone.beans.RecordLogOV;

/**
 * Created by Administrator on 2018/4/26/026.
 */

public interface UploadJobLogContract {
    interface Model {
        void uploadJobLog(RecordLogOV recordLogOV, Gson gson);
    }

    interface View {
        void uploadJobLogSucc(String result);

        void uploadJobLogFail(Throwable ex);
    }

    interface Presenter {
        void uploadJobLog(RecordLogOV recordLogOV, Gson gson);

        void uploadJobLogSucc(String result);

        void uploadJobLogFail(Throwable ex);
    }
}
<file_sep>package com.zhang.baselib.utils;

import android.graphics.Bitmap;
import android.graphics.Matrix;

/**
 * Created by Administrator on 2018/5/22/022.
 */

public class PicUtil {
    /**
     * 将图片按照某个角度进行旋转
     *
     * @param bm
     *            需要旋转的图片
     * @param degree
     *            旋转角度
     * @return 旋转后的图片
     */
    public static Bitmap rotateBitmapByDegree(Bitmap bm, int degree) {
        Bitmap returnBm = null;

        // 根据旋转角度，生成旋转矩阵
        Matrix matrix = new Matrix();
        matrix.postRotate(degree);
        try {
            // 将原始图片按照旋转矩阵进行旋转，并得到新的图片
            returnBm = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(),
                    bm.getHeight(), matrix, true);
        } catch (OutOfMemoryError e) {
        }
        if (returnBm == null) {
            returnBm = bm;
        }
        if (bm != returnBm) {
            bm.recycle();
        }
        return returnBm;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.presenter;

import com.zhang.okinglawenforcementphone.mvp.contract.UploadCaseInAdvanceContract;
import com.zhang.okinglawenforcementphone.mvp.model.UploadCaseInAdvanceModel;

import java.util.Map;

/**
 * Created by Administrator on 2018/5/4/004.
 */

public class UploadCaseInAdvancePresenter implements UploadCaseInAdvanceContract.Presenter {
    private UploadCaseInAdvanceContract.Model mModel;
    private UploadCaseInAdvanceContract.View mView;

    public UploadCaseInAdvancePresenter(UploadCaseInAdvanceContract.View view) {
        mView = view;
        mModel = new UploadCaseInAdvanceModel(this);
    }

    @Override
    public void uploadCaseInAdvance(Map<String, Object> params) {
        mModel.uploadCaseInAdvance(params);
    }

    @Override
    public void uploadCaseInAdvanceSucc(String result) {
        mView.uploadCaseInAdvanceSucc(result);
    }

    @Override
    public void uploadCaseInAdvanceFail(Throwable ex) {
        mView.uploadCaseInAdvanceFail(ex);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.presenter;

import com.zhang.okinglawenforcementphone.beans.GreenMissionLog;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadSignaturePicContract;
import com.zhang.okinglawenforcementphone.mvp.model.UploadSignaturePicModel;

import java.util.Map;

import okhttp3.RequestBody;

/**
 * Created by Administrator on 2018/4/26/026.
 */

public class UploadSignaturePicPresenter implements UploadSignaturePicContract.Presenter {
    private UploadSignaturePicContract.Model mModel;
    private UploadSignaturePicContract.View mView;

    public UploadSignaturePicPresenter(UploadSignaturePicContract.View view) {
        mView = view;
        mModel = new UploadSignaturePicModel(this);
    }

    @Override
    public void uploadSignaturePic(GreenMissionLog mGreenMissionLog, GreenMissionTask missionTask, Map<String, RequestBody> photoParams) {
        mModel.uploadSignaturePic(mGreenMissionLog,missionTask,photoParams);
    }

    @Override
    public void uploadSignaturePicSucc(String result) {
        mView.uploadSignaturePicSucc(result);
    }

    @Override
    public void uploadIsCount(int pos) {
        mView.uploadIsCount(pos);
    }

    @Override
    public void uploadRetry(Throwable ex) {
        mView.uploadRetry(ex);
    }

    @Override
    public void uploadSignatureFail(Throwable ex) {
        mView.uploadSignatureFail(ex);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Transient;

import java.sql.Date;

/**
 * Created by Administrator on 2018/3/27.
 */
@Entity
public class GreenMedia {
    @Id(autoincrement = true)
    private Long id;
    private Long greenMissionLogId;
    private Long time;
    private String path;
    private String userid;
    private String taskid;
    @Transient
    private GreenLocation souceLocation;
    private Integer type;               //1表示日志图片  2表示视频  3表示语音   4签名图片
    private Long greenGreenLocationId;
    @ToOne(joinProperty = "greenGreenLocationId")
    private GreenLocation location;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 1532472546)
    private transient GreenMediaDao myDao;
    @Generated(hash = 24618416)
    public GreenMedia(Long id, Long greenMissionLogId, Long time, String path,
            String userid, String taskid, Integer type, Long greenGreenLocationId) {
        this.id = id;
        this.greenMissionLogId = greenMissionLogId;
        this.time = time;
        this.path = path;
        this.userid = userid;
        this.taskid = taskid;
        this.type = type;
        this.greenGreenLocationId = greenGreenLocationId;
    }
    @Generated(hash = 1581839435)
    public GreenMedia() {
    }
    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getGreenMissionLogId() {
        return this.greenMissionLogId;
    }
    public void setGreenMissionLogId(Long greenMissionLogId) {
        this.greenMissionLogId = greenMissionLogId;
    }
    public Long getTime() {
        return this.time;
    }
    public void setTime(Long time) {
        this.time = time;
    }
    public String getPath() {
        return this.path;
    }
    public void setPath(String path) {
        this.path = path;
    }
    public String getUserid() {
        return this.userid;
    }
    public void setUserid(String userid) {
        this.userid = userid;
    }
    public String getTaskid() {
        return this.taskid;
    }
    public void setTaskid(String taskid) {
        this.taskid = taskid;
    }
    public Integer getType() {
        return this.type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public Long getGreenGreenLocationId() {
        return this.greenGreenLocationId;
    }
    public void setGreenGreenLocationId(Long greenGreenLocationId) {
        this.greenGreenLocationId = greenGreenLocationId;
    }

    public GreenLocation getSouceLocation() {
        return souceLocation;
    }

    public void setSouceLocation(GreenLocation souceLocation) {
        this.souceLocation = souceLocation;
    }

    @Generated(hash = 1068795426)
    private transient Long location__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 2016527076)
    public GreenLocation getLocation() {
        Long __key = this.greenGreenLocationId;
        if (location__resolvedKey == null || !location__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            GreenLocationDao targetDao = daoSession.getGreenLocationDao();
            GreenLocation locationNew = targetDao.load(__key);
            synchronized (this) {
                location = locationNew;
                location__resolvedKey = __key;
            }
        }
        return location;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 592716253)
    public void setLocation(GreenLocation location) {
        synchronized (this) {
            this.location = location;
            greenGreenLocationId = location == null ? null : location.getId();
            location__resolvedKey = greenGreenLocationId;
        }
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    @Override
    public String toString() {
        return "GreenMedia{" +
                "id=" + id +
                ", greenMissionLogId=" + greenMissionLogId +
                ", time=" + time +
                ", path='" + path + '\'' +
                ", userid='" + userid + '\'' +
                ", taskid='" + taskid + '\'' +
                ", souceLocation=" + souceLocation +
                ", type=" + type +
                ", greenGreenLocationId=" + greenGreenLocationId +
                ", location=" + location +
                ", daoSession=" + daoSession +
                ", myDao=" + myDao +
                ", location__resolvedKey=" + location__resolvedKey +
                '}';
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1652320658)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getGreenMediaDao() : null;
    }
}



<file_sep>buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'

    }
}
apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.zhang.okinglawenforcementphone"
        minSdkVersion 18
        targetSdkVersion 27
        versionCode 1
        versionName "1.0.1"
        multiDexEnabled true
        ndk {
            abiFilters "armeabi"
        }
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']

        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:support-v4:27.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'com.youth.banner:banner:1.4.10'
    implementation 'com.hyman:flowlayout-lib:1.1.2'
    implementation project(':CircularProgressButtonLibrary')
    implementation project(':baselib')
    implementation files('libs/pinyin4j-2.5.0.jar')
    implementation 'com.jzxiang.pickerview:TimePickerDialog:1.0.1'
    implementation project(':easeui')
    implementation 'top.zibin:Luban:1.1.3'
    implementation project(':whiteboardlib')
    implementation files('libs/ocr-sdk.jar')
    implementation project(':ocr_ui')
    implementation project(':android-pdf-viewer')
    implementation 'com.github.sundeepk:compact-calendar-view:2.0.3-beta'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
    implementation files('libs/mail.jar')
    implementation files('libs/activation.jar')
    implementation files('libs/additionnal.jar')
    implementation 'cn.ittiger:TigerVideoPlayer:1.7'
    implementation files('libs/AMap3DMap_5.2.0_AMapNavi_5.1.0_AMapSearch_5.1.0_AMapLocation_3.4.0_20170602.jar')
    implementation files('libs/jcore-android-1.2.3.jar')
    implementation files('libs/jpush-android-3.1.5.jar')
}

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.1.0'
            }
        }
    }
}




<file_sep>package com.zhang.okinglawenforcementphone;

import android.content.Context;

import com.zhang.baselib.ui.views.RxDialogSureCancel;
import com.zhang.baselib.utils.ActivityUtil;
import com.zhang.okinglawenforcementphone.beans.DaoMaster;
import com.zhang.okinglawenforcementphone.beans.DaoSession;
import com.zhang.okinglawenforcementphone.db.MyGreenDaoDbHelper;

import org.greenrobot.greendao.database.Database;


/**
 * Created by Administrator on 2018/4/18.
 */

public class GreenDAOManager {
    public static final boolean ENCRYPTED = true;
    private static GreenDAOManager mGreenDAOMannager;
    private DaoSession daoSession;
    private MyGreenDaoDbHelper mDevOpenHelper;
    private GreenDAOManager() {
    }

    public static GreenDAOManager getInstence() {
        if (mGreenDAOMannager == null) {
            synchronized (GreenDAOManager.class) {
                if (mGreenDAOMannager == null) {
                    mGreenDAOMannager = new GreenDAOManager();
                }
            }
        }
        return mGreenDAOMannager;
    }

   public void initGreenDao(Context context){
       MyGreenDaoDbHelper helper = new MyGreenDaoDbHelper(context, ENCRYPTED ? "gdWater-db-encrypted" : "gdWater-db");
       Database db = ENCRYPTED ? helper.getEncryptedWritableDb("super-secret") : helper.getWritableDb();
       daoSession = new DaoMaster(db).newSession();
       mDevOpenHelper = new MyGreenDaoDbHelper(context, "gdWater-db");
    }

    public DaoSession getDaoSession(){
       return daoSession;
    }

    //升级表
    public void updateTable(){

       mDevOpenHelper.onUpgrade(mDevOpenHelper.getWritableDatabase(), 1, 1);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.model;

import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.contract.LoadCanSelectMemberContract;

import io.reactivex.functions.Consumer;
import okhttp3.ResponseBody;

/**
 * Created by Administrator on 2018/4/20.
 */

public class LoadCanSelectMemberModel implements LoadCanSelectMemberContract.Model {
    private LoadCanSelectMemberContract.Presenter mPresenter;

    public LoadCanSelectMemberModel(LoadCanSelectMemberContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void loadCanSelectMember() {
        BaseHttpFactory.getInstence()
                .createService(GDWaterService.class, Api.BASE_URL)
                .loadCanSelectMember("SZJC,CBR")
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        mPresenter.loadCanSelectMemberSucc(responseBody.string());

                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        mPresenter.loadCanSelectMemberFail(throwable);
                    }
                });

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

import com.amap.api.maps.model.LatLng;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/12/15.
 */

public class MapTaskInfo {
    private String taskName;
    private String taskState;
    private String taskTime;
    private String taskPeleasePeople;
    private String taskApprover;
    private String taskDescription;
    private String taskAre;
    private LatLng taskLatLng;
    private LatLng moveCenterLatLng;
    private LatLng startLatLng;
    private LatLng endLatLng;
    private ArrayList<LatLng>mPicLatLngs;
    private ArrayList<LatLng>mRecordScreenLatLngs;

    public LatLng getTaskLatLng() {
        return taskLatLng;
    }

    public void setTaskLatLng(LatLng taskLatLng) {
        this.taskLatLng = taskLatLng;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getTaskState() {
        return taskState;
    }

    public void setTaskState(String taskState) {
        this.taskState = taskState;
    }

    public String getTaskTime() {
        return taskTime;
    }

    public void setTaskTime(String taskTime) {
        this.taskTime = taskTime;
    }

    public String getTaskPeleasePeople() {
        return taskPeleasePeople;
    }

    public void setTaskPeleasePeople(String taskPeleasePeople) {
        this.taskPeleasePeople = taskPeleasePeople;
    }

    public String getTaskApprover() {
        return taskApprover;
    }

    public void setTaskApprover(String taskApprover) {
        this.taskApprover = taskApprover;
    }

    public String getTaskDescription() {
        return taskDescription;
    }

    public void setTaskDescription(String taskDescription) {
        this.taskDescription = taskDescription;
    }

    public String getTaskAre() {
        return taskAre;
    }

    public void setTaskAre(String taskAre) {
        this.taskAre = taskAre;
    }

    public LatLng getMoveCenterLatLng() {
        return moveCenterLatLng;
    }

    public void setMoveCenterLatLng(LatLng moveCenterLatLng) {
        this.moveCenterLatLng = moveCenterLatLng;
    }

    public LatLng getStartLatLng() {
        return startLatLng;
    }

    public void setStartLatLng(LatLng startLatLng) {
        this.startLatLng = startLatLng;
    }

    public LatLng getEndLatLng() {
        return endLatLng;
    }

    public void setEndLatLng(LatLng endLatLng) {
        this.endLatLng = endLatLng;
    }

    public ArrayList<LatLng> getPicLatLngs() {
        return mPicLatLngs;
    }

    public void setPicLatLngs(ArrayList<LatLng> picLatLngs) {
        mPicLatLngs = picLatLngs;
    }

    public ArrayList<LatLng> getRecordScreenLatLngs() {
        return mRecordScreenLatLngs;
    }

    public void setRecordScreenLatLngs(ArrayList<LatLng> recordScreenLatLngs) {
        mRecordScreenLatLngs = recordScreenLatLngs;
    }

    @Override
    public String toString() {
        return "MapTaskInfo{" +
                "taskName='" + taskName + '\'' +
                ", taskState='" + taskState + '\'' +
                ", taskTime='" + taskTime + '\'' +
                ", taskPeleasePeople='" + taskPeleasePeople + '\'' +
                ", taskApprover='" + taskApprover + '\'' +
                ", taskDescription='" + taskDescription + '\'' +
                ", taskAre='" + taskAre + '\'' +
                ", taskLatLng=" + taskLatLng +
                ", moveCenterLatLng=" + moveCenterLatLng +
                ", startLatLng=" + startLatLng +
                ", endLatLng=" + endLatLng +
                ", mPicLatLngs=" + mPicLatLngs +
                ", mRecordScreenLatLngs=" + mRecordScreenLatLngs +
                '}';
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.contract;

import com.google.gson.Gson;

import java.text.SimpleDateFormat;

/**
 * Created by Administrator on 2018/4/20.
 */

public interface UploadLocationToServerContract {
    interface Model {
        void upploadLocationToServer(Long loginTime, SimpleDateFormat sdf, String imei, Gson gson);
    }

    interface View {
        void uploadSucc(String result);

        void uploadFail(Throwable ex);
    }

    interface Presenter {
        void upploadLocationToServer(Long loginTime, SimpleDateFormat sdf, String imei, Gson gson);

        void uploadSucc(String result);

        void uploadFail(Throwable ex);
    }
}
<file_sep>package com.zhang.baselib.utils;

import android.content.Context;
import android.location.LocationManager;

/**
 * Created by Administrator on 2018/4/18.
 */

public class LocationUtil {

    /**
     * 判断Gps是否可用
     *
     * @return {@code true}: 是<br>{@code false}: 否
     */
    public static boolean isGpsEnabled(Context context) {
        LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
        return lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.SeachBean;

import java.util.List;

/**
 * Created by Administrator on 2018/5/18/018.
 */

public class SerchRecyAdapter extends BaseMultiItemQuickAdapter<SeachBean, BaseViewHolder> {

    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    public SerchRecyAdapter(List<SeachBean> data) {
        super(data);
        addItemType(0, R.layout.arrangemission_task_item);
        addItemType(1, R.layout.search_menu_item);
    }

    @Override
    protected void convert(BaseViewHolder helper, SeachBean item) {
        int itemViewType = helper.getItemViewType();
        switch (itemViewType) {
            case 0:
                helper.setText(R.id.tv_taskname,"任务名称："+item.getTaskName());
                helper.setText(R.id.tv_taskid,"任务编号："+item.getTaskId());
                helper.setText(R.id.tv_fbr,"发布人："+item.getPublisherName());



                if ("0".equals(item.getState())) {
                    helper.setText(R.id.tv_state,"任务状态：未发布");
                } else if ("1".equals(item.getState())) {
                    helper.setText(R.id.tv_state,"任务状态：已发布待审核");
                } else if ("2".equals(item.getState())) {
                    helper.setText(R.id.tv_state,"任务状态：审核通过");
                } else if ("3".equals(item.getState())) {
                    helper.setText(R.id.tv_state,"任务状态：已分配队员待执行");
                } else if ("4".equals(item.getState())) {
                    helper.setText(R.id.tv_state,"任务状态：任务开始");
                } else if ("5".equals(item.getState())) {
                    helper.setText(R.id.tv_state,"任务状态：任务完成");
                }else if ("100".equals(item.getState())){
                    helper.setText(R.id.tv_state,"任务状态：巡查结束，待上传");
                }


                break;
            case 1:
                helper.setText(R.id.tv_menuname,"名称："+item.getMenuItme());
                break;
            default:
                    break;

        }
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.PowerManager;
import android.os.StrictMode;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.google.gson.Gson;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.DefaultContants;
import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.baselib.ui.views.RxDialogLoading;
import com.zhang.baselib.ui.views.RxDialogSureCancel;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.baselib.utils.ActivityUtil;
import com.zhang.baselib.utils.FileUtil;
import com.zhang.baselib.utils.NetUtil;
import com.zhang.baselib.utils.Util;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.OkingJPushManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.NavViewRecyAdapter;
import com.zhang.okinglawenforcementphone.beans.GreenMedia;
import com.zhang.okinglawenforcementphone.beans.GreenMember;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLog;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLogDao;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTaskDao;
import com.zhang.okinglawenforcementphone.beans.JPushMessageBean;
import com.zhang.okinglawenforcementphone.beans.NavBean;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.beans.Point;
import com.zhang.okinglawenforcementphone.beans.RecordLogOV;
import com.zhang.okinglawenforcementphone.beans.UpdateGreenMissionTaskOV;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.contract.GetHttpMissionLogContract;
import com.zhang.okinglawenforcementphone.mvp.contract.JPushMessageContract;
import com.zhang.okinglawenforcementphone.mvp.contract.UpdateMissionStateContract;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadJobLogContract;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadJobLogForPicContract;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadSignaturePicContract;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadVideoContract;
import com.zhang.okinglawenforcementphone.mvp.presenter.GetHttpMissionLogPresenter;
import com.zhang.okinglawenforcementphone.mvp.presenter.UpdateMissionStatePresenter;
import com.zhang.okinglawenforcementphone.mvp.presenter.UploadJobLogForPicPresenter;
import com.zhang.okinglawenforcementphone.mvp.presenter.UploadJobLogPresenter;
import com.zhang.okinglawenforcementphone.mvp.presenter.UploadSignaturePicPresenter;
import com.zhang.okinglawenforcementphone.mvp.presenter.UploadVideoPresenter;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;
import com.zhang.okinglawenforcementphone.mvp.ui.fragments.TaskInfoFragment;
import com.zhang.okinglawenforcementphone.mvp.ui.fragments.TaskPatrolFragment;
import com.zhang.okinglawenforcementphone.mvp.ui.fragments.TaskPicFragment;
import com.zhang.okinglawenforcementphone.mvp.ui.fragments.TaskProcessingResultFragment;
import com.zhang.okinglawenforcementphone.mvp.ui.fragments.TaskVideoFragment;
import com.zhang.okinglawenforcementphone.views.DividerItemDecoration;

import org.greenrobot.eventbus.EventBus;
import org.json.JSONException;
import org.json.JSONObject;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import java.util.concurrent.TimeUnit;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import io.reactivex.Flowable;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.ObservableSource;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;

public class MissionRecorActivity extends BaseActivity {
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.tv_title)
    TextView mTvTitle;
    @BindView(R.id.tv_savetag)
    TextView mTvSavetag;
    @BindView(R.id.nav_view)
    RecyclerView mNavView;
    @BindView(R.id.fab)
    ImageView mFab;
    @BindView(R.id.drawer_layout)
    DrawerLayout mDrawerLayout;
    @BindView(R.id.report_mission_button)
    Button mReportMissionButton;
    @BindView(R.id.complete_mission_button)
    Button mCompleteMissionButton;
    private int atPosition = 0;
    private GreenMissionTask mission;
    private GreenMissionLog mGreenMissionLog;
    private RxDialogLoading mRxDialogLoading;
    private PowerManager.WakeLock mWakeLock;
    private Handler mHandler = new Handler();
    private int picComPostion = 0;
    private int veodComPosion = 0;
    private int logSignPosion = 0;
    private List<GreenMedia> mPhotoMedias = new ArrayList<>();
    private List<GreenMedia> mVideoMedias = new ArrayList<>();
    private boolean uploadLogPic = false, uploadSignPic = false, uploadLogVideo = false;
    private UploadJobLogPresenter mUploadJobLogPresenter;
    private UploadJobLogForPicPresenter mUploadJobLogForPicPresenter;
    private UploadSignaturePicPresenter mUploadSignaturePicPresenter;
    private UploadVideoPresenter mUploadVideoPresenter;
    private Map<String, RequestBody> photoParams;
    private SimpleDateFormat sdfVideo = new SimpleDateFormat("yyyyMMdd_HHmmss");
    private int mDatePoor;
    private long mBeforTime;
    private String mLocJson;
    private Gson mGson = new Gson();
    private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
    private BroadcastReceiver mNetWokReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            boolean connected = NetUtil.isConnected(BaseApplication.getApplictaion());
            if (connected) {
                RxToast.error(BaseApplication.getApplictaion(), "连接", Toast.LENGTH_SHORT).show();

            } else {
                if (mRxDialogLoading != null) {
                    RxToast.error(BaseApplication.getApplictaion(), "网络断开了~~请检查网络再进行提交数据", Toast.LENGTH_SHORT).show();
                    mRxDialogLoading.cancel();
                }

            }
        }
    };
    private Unbinder mBind;
    private String mTaskId;
    private GetHttpMissionLogPresenter mGetHttpMissionLogPresenter;
    private RxDialogSureCancel mRxDialogSureCancel;
    private NavViewRecyAdapter mNavViewRecyAdapter;
    private TaskInfoFragment mTaskInfoFragment;
    private TaskPatrolFragment mTaskPatrolFragment;
    private TaskProcessingResultFragment mTaskProcessingResultFragment;
    private TaskPicFragment mTaskPicFragment;
    private TaskVideoFragment mTaskVideoFragment;
    private Subscription mSubscription;
    private SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat("HH:mm:ss");
    private boolean mCanSaveComplete = false;
    private boolean mSummarySwisopen;
    private boolean mLeaderSummarySwisopen;
    private Handler mainHandler;
    private int mPosition;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mission_recor);
        mBind = ButterKnife.bind(this);
        StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
        StrictMode.setVmPolicy(builder.build());
        builder.detectFileUriExposure();
        initView();
        initData();
        setListerner();
    }

    private void setListerner() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mission.getStatus().equals("5")) {
                    finish();
                } else {
                    saveTheRecord();
                    finish();
                }

            }
        });

        mNavViewRecyAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, final int position) {

                Observable.create(new ObservableOnSubscribe<Integer>() {
                    @Override
                    public void subscribe(ObservableEmitter<Integer> e) throws Exception {
                        saveTheRecord();
                        e.onNext(200);
                    }
                }).subscribe(new Consumer<Integer>() {
                    @Override
                    public void accept(Integer integer) throws Exception {
                        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
                        atPosition = position;

                        switch (position) {
                            case 0:                     //基本信息
                                mTvTitle.setText("基本信息");
                                if (mTaskPatrolFragment != null) {
                                    fragmentTransaction.hide(mTaskPatrolFragment);
                                }
                                if (mTaskProcessingResultFragment != null) {

                                    fragmentTransaction.hide(mTaskProcessingResultFragment);
                                }
                                if (mTaskPicFragment != null) {

                                    fragmentTransaction.hide(mTaskPicFragment);
                                }
                                if (mTaskVideoFragment != null) {

                                    fragmentTransaction.hide(mTaskVideoFragment);
                                }
                                if (mTaskInfoFragment != null) {
                                    fragmentTransaction.show(mTaskInfoFragment);
                                } else {
                                    mTaskInfoFragment = TaskInfoFragment.newInstance(null, null);
                                    mTaskInfoFragment.setMission(mission);
                                    mTaskInfoFragment.setGreenMissionLog(mGreenMissionLog);
                                    fragmentTransaction.add(R.id.rl_mision, mTaskInfoFragment, "TaskInfoFragment");
                                }
                                fragmentTransaction.commitAllowingStateLoss();

                                break;
                            case 1:                     //巡查情况
                                mTvTitle.setText("巡查情况");
                                if (mTaskInfoFragment != null) {

                                    fragmentTransaction.hide(mTaskInfoFragment);
                                }
                                if (mTaskProcessingResultFragment != null) {

                                    fragmentTransaction.hide(mTaskProcessingResultFragment);
                                }
                                if (mTaskPicFragment != null) {

                                    fragmentTransaction.hide(mTaskPicFragment);
                                }
                                if (mTaskVideoFragment != null) {

                                    fragmentTransaction.hide(mTaskVideoFragment);
                                }
                                if (mTaskPatrolFragment != null) {
                                    fragmentTransaction.show(mTaskPatrolFragment);
                                } else {
                                    mTaskPatrolFragment = TaskPatrolFragment.newInstance(null, null);
                                    mTaskPatrolFragment.setMission(mission);
                                    mTaskPatrolFragment.setGreenMissionLog(mGreenMissionLog);
                                    fragmentTransaction.add(R.id.rl_mision, mTaskPatrolFragment, "TaskPatrolFragment");

                                }
                                fragmentTransaction.commitAllowingStateLoss();

                                break;
                            case 2:                     //处理结果
                                switchResults(fragmentTransaction);

                                break;
                            case 3:                     //拍照
                                mTvTitle.setText("拍照");
                                if (mTaskInfoFragment != null) {

                                    fragmentTransaction.hide(mTaskInfoFragment);
                                }
                                if (mTaskPatrolFragment != null) {

                                    fragmentTransaction.hide(mTaskPatrolFragment);
                                }
                                if (mTaskProcessingResultFragment != null) {

                                    fragmentTransaction.hide(mTaskProcessingResultFragment);
                                }
                                if (mTaskVideoFragment != null) {

                                    fragmentTransaction.hide(mTaskVideoFragment);
                                }
                                if (mTaskPicFragment != null) {
                                    fragmentTransaction.show(mTaskPicFragment);
                                } else {
                                    mTaskPicFragment = TaskPicFragment.newInstance(null, null);
                                    mTaskPicFragment.setMission(mission);
                                    mTaskPicFragment.setGreenMissionLog(mGreenMissionLog);
                                    fragmentTransaction.add(R.id.rl_mision, mTaskPicFragment, "TaskPicFragment");

                                }
                                fragmentTransaction.commitAllowingStateLoss();
                                break;
                            case 4:                     //录视频
                                mTvTitle.setText("录视频");
                                if (mTaskInfoFragment != null) {

                                    fragmentTransaction.hide(mTaskInfoFragment);
                                }
                                if (mTaskPatrolFragment != null) {

                                    fragmentTransaction.hide(mTaskPatrolFragment);
                                }
                                if (mTaskProcessingResultFragment != null) {

                                    fragmentTransaction.hide(mTaskProcessingResultFragment);
                                }
                                if (mTaskPicFragment != null) {

                                    fragmentTransaction.hide(mTaskPicFragment);
                                }
                                if (mTaskVideoFragment != null) {
                                    fragmentTransaction.show(mTaskVideoFragment);
                                } else {
                                    mTaskVideoFragment = TaskVideoFragment.newInstance(null, null);
                                    mTaskVideoFragment.setMission(mission);
                                    mTaskVideoFragment.setGreenMissionLog(mGreenMissionLog);
                                    fragmentTransaction.add(R.id.rl_mision, mTaskVideoFragment, "TaskVideoFragment");

                                }
                                fragmentTransaction.commitAllowingStateLoss();
                                break;
                            default:
                                break;
                        }

                        mDrawerLayout.closeDrawers();
                    }
                });

            }
        });
    }

    private void switchResults(FragmentTransaction fragmentTransaction) {
        mTvTitle.setText("处理结果");
        if (mTaskInfoFragment != null) {

            fragmentTransaction.hide(mTaskInfoFragment);
        }
        if (mTaskPatrolFragment != null) {

            fragmentTransaction.hide(mTaskPatrolFragment);
        }
        if (mTaskPicFragment != null) {

            fragmentTransaction.hide(mTaskPicFragment);
        }
        if (mTaskVideoFragment != null) {

            fragmentTransaction.hide(mTaskVideoFragment);
        }
        if (mTaskProcessingResultFragment != null) {
            mTaskProcessingResultFragment.setMission(mission);
            fragmentTransaction.show(mTaskProcessingResultFragment);
        } else {
            mTaskProcessingResultFragment = TaskProcessingResultFragment.newInstance(null, null);
            mTaskProcessingResultFragment.setMission(mission);
            mTaskProcessingResultFragment.setGreenMissionLog(mGreenMissionLog);
            fragmentTransaction.add(R.id.rl_mision, mTaskProcessingResultFragment, "TaskProcessingResultFragment");

        }
        fragmentTransaction.commitAllowingStateLoss();
    }


    private void initData() {
        BaseApplication.getApplictaion().registerReceiver(mNetWokReceiver, new IntentFilter("oking.network"));
        //定时保存
        if (mission != null) {
            Flowable.interval(5, 10, TimeUnit.SECONDS)
                    .onBackpressureDrop()
                    .subscribe(new Subscriber<Long>() {
                        @Override
                        public void onSubscribe(Subscription s) {
                            mSubscription = s;
                            s.request(Long.MAX_VALUE);
                        }

                        @Override
                        public void onNext(Long aLong) {
                            //判断当前显示的是哪个页面
                            if (mission.getStatus().equals("5") || mission.getStatus().equals("100")) {

                            } else {
                                switch (atPosition) {
                                    case 0:
                                        Log.i("Oking5", "保存基本信息");
                                        saveTaskInfo();
                                        break;
                                    case 1:
                                        Log.i("Oking5", "保存巡查情况");
                                        savePatrol();
                                        break;
                                    case 2:
                                        Log.i("Oking5", "保存处理结果");
                                        saveResults();
                                        break;
                                    case 3:
                                        Log.i("Oking5", "保存拍照");     //不用再去调用保存操作，每次拍照都保存了
                                        break;
                                    case 4:
                                        Log.i("Oking5", "保存视频");
                                        break;
                                    default:
                                        break;
                                }
                                AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                                    @Override
                                    public void run() {
                                        mTvSavetag.setText("上次保存时间：" + mSimpleDateFormat.format(System.currentTimeMillis()));
                                    }
                                });
                            }


                        }

                        @Override
                        public void onError(Throwable t) {

                        }

                        @Override
                        public void onComplete() {

                        }
                    });
        }

    }

    private void saveResults() {
        mTaskProcessingResultFragment.saveResults();
    }

    private void savePatrol() {
        mTaskPatrolFragment.savePatrol();
    }

    private void saveTaskInfo() {
        mTaskInfoFragment.saveTaskInfo();

    }

    private void initView() {

        ArrayList<NavBean> navBeans = new ArrayList<>();
        NavBean navBean1 = new NavBean();
        navBean1.setIcon(R.mipmap.icon_taskinfo);
        navBean1.setTitle("基本信息");
        navBeans.add(navBean1);
        NavBean navBean2 = new NavBean();
        navBean2.setIcon(R.mipmap.icon_taskpatrl);
        navBean2.setTitle("巡查情况");
        navBeans.add(navBean2);
        NavBean navBean3 = new NavBean();
        navBean3.setIcon(R.mipmap.icon_result);
        navBean3.setTitle("处理结果");
        navBeans.add(navBean3);
        NavBean navBean4 = new NavBean();
        navBean4.setIcon(R.mipmap.icon_tagpic);
        navBean4.setTitle("拍照");
        navBeans.add(navBean4);
        NavBean navBean5 = new NavBean();
        navBean5.setIcon(R.mipmap.icon_tagvideo);
        navBean5.setTitle("录视频");
        navBeans.add(navBean5);
        mNavViewRecyAdapter = new NavViewRecyAdapter(R.layout.navview_item, navBeans);
        mNavViewRecyAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
        mNavView.setLayoutManager(new LinearLayoutManager(BaseApplication.getApplictaion(), LinearLayoutManager.VERTICAL, false));
        mNavView.addItemDecoration(new DividerItemDecoration(BaseApplication.getApplictaion(), 0, 1, Color.DKGRAY));
        mNavView.setAdapter(mNavViewRecyAdapter);

        PowerManager pm = (PowerManager) BaseApplication.getApplictaion().getSystemService(Context.POWER_SERVICE);
        mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
                "MissionRecordFragment");
        mWakeLock.acquire();

        Intent intent = getIntent();
        mTaskId = intent.getStringExtra("taskId");
        mPosition = intent.getIntExtra("position", -1);


        if (mTaskId != null) {
            //网络获取Log(尝试用http获取服务器的Log，获取不了再单机生成新Log)
            getNetData(mTaskId);
        }


        mDrawerLayout.openDrawer(Gravity.LEFT);
    }

    private void getNetData(String taskId) {
        if (mRxDialogLoading == null) {
            mRxDialogLoading = new RxDialogLoading(this, true, new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    dialogInterface.cancel();
                }
            });
        }
        mRxDialogLoading.setLoadingText("初始化数据中，请稍等...");
        mRxDialogLoading.show();

        mission = GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao().queryBuilder().where(GreenMissionTaskDao.Properties.Taskid.eq(taskId)).unique();
        if (mGetHttpMissionLogPresenter == null) {
            mGetHttpMissionLogPresenter = new GetHttpMissionLogPresenter(new GetHttpMissionLogContract.View() {
                @Override
                public void loadHttpMissionLogSucc(GreenMissionLog greenMissionLog) {
                    mRxDialogLoading.cancel();
                    mGreenMissionLog = greenMissionLog;
                    initFragment();

                }

                @Override
                public void loadEmpty(GreenMissionLog greenMissionLog) {
                    mRxDialogLoading.cancel();
                    mGreenMissionLog = greenMissionLog;
                    initFragment();

                }
            });
        }
        if (mission != null) {

            mGetHttpMissionLogPresenter.getHttpMissionLog(mission);
        } else {
            mRxDialogLoading.cancel();
            finish();
        }


    }

    private void initFragment() {
        if (mCompleteMissionButton != null && mReportMissionButton != null) {
            if (mission.getStatus().equals("100")) {//任务已完成，不能再完成

                mCompleteMissionButton.setVisibility(View.GONE);

            } else if (mission.getStatus().equals("5")) {
                //任务已上报，不能再上报
                mReportMissionButton.setVisibility(View.GONE);
                mCompleteMissionButton.setVisibility(View.GONE);


            } else if (mission.getStatus().equals("9")) {//任务被退回修改


                mReportMissionButton.setVisibility(View.GONE);
                mCompleteMissionButton.setVisibility(View.GONE);

            }
        }

        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        mTaskInfoFragment = TaskInfoFragment.newInstance(null, null);
        mTaskInfoFragment.setMission(mission);
        mTaskInfoFragment.setGreenMissionLog(mGreenMissionLog);
        fragmentTransaction.replace(R.id.rl_mision, mTaskInfoFragment, "TaskInfoFragment").commitAllowingStateLoss();
    }


    @Override
    public void onPause() {
        super.onPause();
        if (mWakeLock != null) {
            mWakeLock.release();
            mWakeLock = null;
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        if (mWakeLock == null) {
            // keep screen on
            PowerManager pm = (PowerManager) BaseApplication.getApplictaion().getSystemService(Context.POWER_SERVICE);
            mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
                    "MissionRecordFragment");
            mWakeLock.acquire();
        }
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        BaseApplication.getApplictaion().unregisterReceiver(mNetWokReceiver);
        if (mSubscription != null) {
            mSubscription.cancel();
            mSubscription = null;
        }

        if (mWakeLock != null) {
            mWakeLock.release();
            mWakeLock = null;
        }
        mBind.unbind();
    }


    public void invisiabelCompleteMissionButton() {
        if (mRxDialogSureCancel == null) {

            mRxDialogSureCancel = new RxDialogSureCancel(MissionRecorActivity.this);//提示弹窗
        }
        mRxDialogSureCancel.setContent("完成巡查后将停止记录巡查定位，是否继续？");
        mRxDialogSureCancel.getTvSure().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                RxToast.warning(BaseApplication.getApplictaion(), "请去签名!!", Toast.LENGTH_SHORT, true).show();

                mission.setExecute_end_time(System.currentTimeMillis());
                mission.setStatus("100");
                //把巡查轨迹插入本地数据库
                Schedulers.io().createWorker().schedule(new Runnable() {
                    @Override
                    public void run() {
                        String locationTrajectory = getLocationTrajectory();
                        Log.i("Oking1", ">>>>>>>>>>>>>" + locationTrajectory);

                        mGreenMissionLog.setLocJson(locationTrajectory);
                        GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao().update(mGreenMissionLog);
                        GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao().update(mission);

                    }
                });

                if (DefaultContants.ISHTTPLOGIN) {
                    //改变任务状态
                    UpdateMissionStatePresenter updateMissionStatePresenter = new UpdateMissionStatePresenter(new UpdateMissionStateContract.View() {
                        @Override
                        public void updateMissionStateSucc(String result) {
                            Log.i("Oking", "巡查完毕" + result);
                            saveTheRecord();
                            mRxDialogSureCancel.cancel();
                        }

                        @Override
                        public void updateMissionStateFail(Throwable ex) {
                            Log.i("Oking", "巡查异常" + ex.getMessage());
                            saveTheRecord();
                            mRxDialogSureCancel.cancel();
                        }
                    });
                    updateMissionStatePresenter.updateMissionState(mission.getTaskid(), "",
                            OkingContract.SDF.format(mission.getExecute_end_time()), 4);

                }

                FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
                switchResults(fragmentTransaction);
                mCompleteMissionButton.setVisibility(View.GONE);
            }
        });
        mRxDialogSureCancel.getTvCancel().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mRxDialogSureCancel.cancel();
            }
        });
        mRxDialogSureCancel.show();
    }


    private String getLocationTrajectory() {
        Log.i("Oking1", ">>>>>>>>>>>>>遍历轨迹");
        Long beginTime = mission.getExecute_start_time();
        if (beginTime == null) {
            beginTime = System.currentTimeMillis() - 1000 * 60 * 20;
        }
        Long endTime = mission.getExecute_end_time();
        if (endTime == null) {
            endTime = System.currentTimeMillis();
            mission.setExecute_end_time(endTime);
        }
        mBeforTime = beginTime - 24 * 60 * 60 * 1000;
        final String file1 = sdf.format(beginTime);

        final ArrayList<Point> locationPath = new ArrayList<>();

        mDatePoor = Util.getDatePoor(beginTime, endTime);
        if (mDatePoor < 1) {        //表示在同一天
//                    Log.i("Oking","是同一天");
            List<String> locationPos = FileUtil.readFile2List(Environment.getExternalStorageDirectory() + "/oking/location/" + file1 + ".txt", "UTF-8");
            if (locationPos != null) {
                for (String s : locationPos) {
                    String[] items = s.split(",");
                    if (items.length != 3) {
                        continue;
                    }

                    String mLatitude = items[0];
                    String mLongitude = items[1];
                    String mDatetime = items[2];

                    if (Long.parseLong(mDatetime) > beginTime && Long.parseLong(mDatetime) < endTime) {
                        Point location = new Point();
                        location.setLatitude(Double.valueOf(mLatitude));
                        location.setLongitude(Double.valueOf(mLongitude));
                        location.setDatetime(Long.valueOf(mDatetime));
                        locationPath.add(location);
                    }
                }
            }


        } else {

            for (int i = 0; i <= mDatePoor; i++) {
                File file = new File(Environment.getExternalStorageDirectory() + "/oking/location/" + getAfterData(mBeforTime) + ".txt");

                if (file.exists()) {
//                            Log.i("Oking","不是同一天"+file.getName());
                    List<String> locationPos = FileUtil.readFile2List(file, "UTF-8");
                    for (String s : locationPos) {
                        String[] items = s.split(",");
                        if (items.length != 3) {
                            continue;
                        }

                        String Latitude = items[0];
                        String Longitude = items[1];
                        String datetime = items[2];

                        if (Long.parseLong(datetime) > beginTime && Long.parseLong(datetime) < endTime) {

                            Point location = new Point();
                            location.setLatitude(Double.valueOf(Latitude));
                            location.setLongitude(Double.valueOf(Longitude));
                            location.setDatetime(Long.valueOf(datetime));
                            locationPath.add(location);
                        }
                    }

                }

            }
        }

        //筛选一下，不然点集太多
        if (locationPath.size() > 100) {
            ArrayList<Point> newLocationPath = new ArrayList<>();
            for (int i = 0; i < locationPath.size(); i = i + 2) {

                newLocationPath.add(locationPath.get(i));
            }

            mLocJson = mGson.toJson(newLocationPath);

        } else {

            mLocJson = mGson.toJson(locationPath);
        }

        return mLocJson;
    }

    @OnClick({R.id.report_mission_button, R.id.complete_mission_button, R.id.fab})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.fab:
                if (mDrawerLayout.isDrawerOpen(Gravity.LEFT)) {
                    mDrawerLayout.closeDrawers();
                } else {

                    mDrawerLayout.openDrawer(Gravity.LEFT);
                }
                break;
            case R.id.report_mission_button:                //上报任务
                reportingTasks();
                break;
            case R.id.complete_mission_button:              //完成巡查
                invisiabelCompleteMissionButton();
                break;
            default:
                break;
        }
    }

    private void reportingTasks() {
        if (mRxDialogSureCancel == null) {

            mRxDialogSureCancel = new RxDialogSureCancel(MissionRecorActivity.this);//提示弹窗
        }
        mRxDialogSureCancel.setContent("上报任务后不能修改日志，是否继续？");
        mRxDialogSureCancel.getTvSure().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mSubscription.cancel();
                saveTheRecord();
                GreenMissionLog unique = GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao().queryBuilder().where(GreenMissionLogDao.Properties.Task_id.eq(mTaskId)).unique();
                if (!mission.getStatus().equals("100") &&
                        !mission.getStatus().equals("9")) {
                    RxToast.warning(BaseApplication.getApplictaion(), "任务未完成，不能上报", Toast.LENGTH_SHORT, true).show();

                    return;
                }

                if (mission.getMembers().size() > 0) {
                    for (GreenMember greenMember : mission.getMembers()) {
                        String signPic = greenMember.getSignPic();
                        if (signPic != null) {
                            File file = new File(signPic);
                            if (signPic != null && file.exists()) {
                                mCanSaveComplete = true;

                            } else {
                                mCanSaveComplete = false;
                                RxToast.warning(BaseApplication.getApplictaion(), "存在成员未签名，不能上报任务！", Toast.LENGTH_SHORT, true).show();
                                return;
                            }
                        } else {
                            mCanSaveComplete = false;
                            RxToast.warning(BaseApplication.getApplictaion(), "存在成员未签名，不能上报任务！", Toast.LENGTH_SHORT, true).show();
                            return;
                        }


                    }
                }


                if (mCanSaveComplete) {
                    mSummarySwisopen = unique.getSummarySwisopen();
                    mLeaderSummarySwisopen = unique.getLeaderSummarySwisopen();
                    String patrol = unique.getPatrol();
                    String dzyj = unique.getDzyj();
                    if (!mSummarySwisopen && TextUtils.isEmpty(patrol)) {
                        RxToast.warning(BaseApplication.getApplictaion(), "巡查情况未填写，不能上报任务！", Toast.LENGTH_SHORT, true).show();

                        return;
                    }

                    if (!mLeaderSummarySwisopen && TextUtils.isEmpty(dzyj)) {
                        RxToast.warning(BaseApplication.getApplictaion(), "处理结果未填写，不能上报任务！", Toast.LENGTH_SHORT, true).show();
                        return;
                    }

                    if (mRxDialogLoading == null) {

                        mRxDialogLoading = new RxDialogLoading(MissionRecorActivity.this, false, new DialogInterface.OnCancelListener() {
                            @Override
                            public void onCancel(DialogInterface dialogInterface) {
                                dialogInterface.cancel();
                            }
                        });
                    }
                    unique.resetGreenMedia();
                    List<GreenMedia> greenMedias = unique.getGreenMedia();
                    for (GreenMedia media : greenMedias) {
                        if (media.getType() == 1) {            //1表示日志图片
                            mPhotoMedias.add(media);
                        } else if (media.getType() == 2) {      //2表示视频
                            mVideoMedias.add(media);
                        } else if (media.getType() == 3) {
                            //3表示语音
                        } else {
                            //签名图片
                        }

                    }

                    mRxDialogSureCancel.cancel();
                    mRxDialogLoading.setLoadingText("上传数据中...图片：" + picComPostion + "/" + mPhotoMedias.size() + "视频：" + veodComPosion + "/" + mVideoMedias.size());
                    mRxDialogLoading.show();

                    picComPostion = 0;
                    veodComPosion = 0;
                    logSignPosion = 0;

                    //上传数据
                    httpSaveRecord(unique);

                } else {
                    RxToast.warning(BaseApplication.getApplictaion(), "存在成员未签名，不能上报任务！", Toast.LENGTH_SHORT, true).show();
                    return;
                }

            }
        });
        mRxDialogSureCancel.getTvCancel().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mRxDialogSureCancel.cancel();
            }
        });
        mRxDialogSureCancel.show();


    }

    private void httpSaveRecord(GreenMissionLog unique) {
        RecordLogOV recordLogOV = new RecordLogOV();
        recordLogOV.setArea(mission.getRwqyms());
        recordLogOV.setEquipment(unique.getEquipment());
        recordLogOV.setGreenMissionLog(mGreenMissionLog);
        recordLogOV.setGreenMissionTask(mission);
        recordLogOV.setLeaderSummary(unique.getDzyj());

        if (mSummarySwisopen || mLeaderSummarySwisopen) {
            recordLogOV.setSwisopen(true);
        } else {
            recordLogOV.setSwisopen(false);
        }
        recordLogOV.setParts(unique.getOther_part());
        recordLogOV.setSeleMattersPos(unique.getItem());
        recordLogOV.setSelePlanPos(unique.getPlan());
        recordLogOV.setSummary(unique.getPatrol());

        recordLogOV.setTime(OkingContract.SDF.format(System.currentTimeMillis()));
        if (mUploadJobLogPresenter == null) {
            mUploadJobLogPresenter = new UploadJobLogPresenter(new UploadJobLogContract.View() {
                @Override
                public void uploadJobLogSucc(String result) {
                    Log.i("Oking", result);
                    try {
                        JSONObject jsonObject = new JSONObject(result);
                        int code = jsonObject.getInt("code");
                        if (code == 0) {
                            String serverId = jsonObject.getString("id");
                            mGreenMissionLog.setServer_id(serverId);
                            GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao().update(mGreenMissionLog);
                        }

                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                    if (mPhotoMedias.size() > 0) {
                        //上传巡查日志的图片
                        uploadPic();
                    } else {
                        uploadLogPic = true;
                    }


                    //上传签名图片
                    uploadSignedPic();

                    //上传巡查视频
                    if (mVideoMedias.size() > 0) {
                        uploadVideo();
                    } else {
                        uploadLogVideo = true;
                    }

                }

                @Override
                public void uploadJobLogFail(Throwable ex) {
                    Log.i("Oking", "异常：" + ex.toString());
                    if (mRxDialogLoading != null) {
                        mRxDialogLoading.cancel();
                    }
                    RxToast.error(BaseApplication.getApplictaion(), "当前4G网络不稳定，上传失败，请稍后重试！20", Toast.LENGTH_SHORT, true).show();

                }
            });
        }
        mUploadJobLogPresenter.uploadJobLog(recordLogOV, mGson);

    }

    private void uploadVideo() {
        photoParams = new HashMap<>();
        if (mUploadVideoPresenter == null) {
            mUploadVideoPresenter = new UploadVideoPresenter(new UploadVideoContract.View() {
                @Override
                public void loadVideoSucc(String result) {
                    try {
                        JSONObject object = new JSONObject(result);
                        int code = object.getInt("code");
                        if (code == 200) {
                            veodComPosion++;
                            mRxDialogLoading.getTextView().setText("上传数据中...图片：" + picComPostion + "/" + mPhotoMedias.size() + "视频：" + veodComPosion + "/" + mVideoMedias.size());

                            if (veodComPosion == mVideoMedias.size()) {
                                uploadLogVideo = true;
                                checkChangeState();
                            }
                        } else {
                            if (mRxDialogLoading != null) {
                                mRxDialogLoading.cancel();
                            }
                            RxToast.error(BaseApplication.getApplictaion(), "当前4G网络不稳定，上传失败，请稍后重试！1", Toast.LENGTH_SHORT, true).show();
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                        if (mRxDialogLoading != null) {
                            mRxDialogLoading.cancel();
                        }
                        RxToast.error(BaseApplication.getApplictaion(), "当前4G网络不稳定，上传失败，请稍后重试！2", Toast.LENGTH_SHORT, true).show();

                    }

                }

                @Override
                public void uploadRetry(Throwable ex) {
                    veodComPosion = 0;
                    RxToast.warning("网络有点开小差~~正在努力重试！！");
                }

                @Override
                public void loadVideoFail(Throwable ex) {

                }

                @Override
                public void uploadIsCount(int pos) {
                    veodComPosion = pos;
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {

                            mRxDialogLoading.getTextView().setText("上传数据中...图片：" + picComPostion + "/" + mPhotoMedias.size() + "视频：" + veodComPosion + "/" + mVideoMedias.size());

                            if (veodComPosion == mVideoMedias.size()) {
                                uploadLogVideo = true;
                                checkChangeState();
                            }
                        }
                    });

                }
            });

        }
        mUploadVideoPresenter.uploadVideo(mGreenMissionLog, mVideoMedias, photoParams, sdfVideo, mGson);

    }

    private void uploadSignedPic() {
        photoParams = new HashMap<>();
        if (mUploadSignaturePicPresenter == null) {
            mUploadSignaturePicPresenter = new UploadSignaturePicPresenter(new UploadSignaturePicContract.View() {
                @Override
                public void uploadSignaturePicSucc(String result) {
                    Log.i("Oking1", "签名上传成功回掉》》》》》》》》》》》》》》》》" + result);
                    try {
                        JSONObject object = new JSONObject(result);
                        int code = object.getInt("code");
                        if (code == 200) {
                            logSignPosion++;
                            if (logSignPosion == mission.getMembers().size()) {
                                uploadSignPic = true;
                                checkChangeState();
                            }
                        } else {
                            if (mRxDialogLoading != null) {
                                mRxDialogLoading.cancel();
                            }
                            RxToast.error(BaseApplication.getApplictaion(), "当前4G网络不稳定，上传失败，请稍后重试！14", Toast.LENGTH_SHORT, true).show();
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                        if (mRxDialogLoading != null) {
                            mRxDialogLoading.cancel();
                        }
                        RxToast.error(BaseApplication.getApplictaion(), "当前4G网络不稳定，上传失败，请稍后重试！15", Toast.LENGTH_SHORT, true).show();
                    }

                }

                @Override
                public void uploadIsCount(int pos) {
                    logSignPosion = pos;
                    if (logSignPosion == mission.getMembers().size()) {
                        uploadSignPic = true;
                        checkChangeState();
                    }

                }

                @Override
                public void uploadRetry(Throwable ex) {
                    logSignPosion = 0;
                    RxToast.warning("网络有点开小差~~正在努力重试！！");
                }

                @Override
                public void uploadSignatureFail(Throwable ex) {
                    if (mRxDialogLoading != null) {
                        mRxDialogLoading.cancel();
                    }
                    RxToast.error(BaseApplication.getApplictaion(), "当前4G网络不稳定，上传失败，请稍后重试！16", Toast.LENGTH_SHORT, true).show();

                }
            });

        }
        mUploadSignaturePicPresenter.uploadSignaturePic(mGreenMissionLog, mission, photoParams);

    }

    private void uploadPic() {
        photoParams = new HashMap<>();
        if (mUploadJobLogForPicPresenter == null) {
            mUploadJobLogForPicPresenter = new UploadJobLogForPicPresenter(new UploadJobLogForPicContract.View() {
                @Override
                public void uploadSucc(String result) {
                    try {
                        JSONObject object = new JSONObject(result);
                        int code = object.getInt("code");
                        if (code == 200) {
                            picComPostion++;
                            mRxDialogLoading.getTextView().setText("上传数据中...图片：" + picComPostion + "/" + mPhotoMedias.size() + "视频：" + veodComPosion + "/" + mVideoMedias.size());
                            if (picComPostion == mPhotoMedias.size()) {
                                uploadLogPic = true;
                                checkChangeState();
                            }
                        } else {
                            if (mRxDialogLoading != null) {
                                mRxDialogLoading.cancel();
                            }
                            RxToast.error(BaseApplication.getApplictaion(), "当前4G网络不稳定，上传失败，请稍后重试！1", Toast.LENGTH_SHORT, true).show();
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                        if (mRxDialogLoading != null) {
                            mRxDialogLoading.cancel();
                        }
                        RxToast.error(BaseApplication.getApplictaion(), "当前4G网络不稳定，上传失败，请稍后重试！2", Toast.LENGTH_SHORT, true).show();

                    }

                }

                @Override
                public void uploadRetry(Throwable ex) {
                    picComPostion = 0;
                    RxToast.warning("网络有点开小差~~正在努力重试！！");
                }

                @Override
                public void uploadFail(Throwable ex) {
                    if (mRxDialogLoading != null) {
                        mRxDialogLoading.cancel();
                    }
                    Log.i("Oking", "上传失败，请稍后重试！3" + ex.toString());
                    RxToast.error(BaseApplication.getApplictaion(), "当前4G网络不稳定，上传失败，请稍后重试！3", Toast.LENGTH_SHORT, true).show();

                }

                @Override
                public void uploadIsCount(int pos) {
                    picComPostion = pos;
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            mRxDialogLoading.getTextView().setText("上传数据中...图片：" + picComPostion + "/" + mPhotoMedias.size() + "视频：" + veodComPosion + "/" + mVideoMedias.size());

                            if (picComPostion == mPhotoMedias.size()) {
                                uploadLogPic = true;
                                checkChangeState();
                            }
                        }
                    });
                }

                @Override
                public void uploadPositionFail(Throwable ex) {
                    Log.i("Oking", "位置数据解析异常" + ex.toString());
                    RxToast.error(BaseApplication.getApplictaion(), "位置数据解析异常", Toast.LENGTH_SHORT, true).show();

                }
            });
        }
        mUploadJobLogForPicPresenter.uploadJobLogForPic(mGson, photoParams, mGreenMissionLog, mPhotoMedias);

    }

    private void checkChangeState() {
        Log.i("Oking", uploadLogPic + "----uploadLogPic");
        Log.i("Oking", uploadSignPic + "----uploadSignPic");
        Log.i("Oking", uploadLogVideo + "----uploadLogVideo");
        if (uploadLogPic && uploadSignPic && uploadLogVideo) {
            httpCompleteMission();
        }

    }

    private void httpCompleteMission() {
        BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .updateMissionRecordState(mGreenMissionLog.getServer_id(), 1)
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .observeOn(Schedulers.io())
                .concatMap(new Function<ResponseBody, ObservableSource<ResponseBody>>() {
                    @Override
                    public Observable<ResponseBody> apply(ResponseBody responseBody) throws Exception {
                        return BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                                .updateMissionState(mission.getTaskid(), "", "", 5);
                    }
                })
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        if (mRxDialogLoading != null) {
                            mRxDialogLoading.cancel();
                        }

                        String string = responseBody.string();
                        mission.setStatus("5");
                        mission.setExamine_status(0);
                        GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao().update(mission);
                        UpdateGreenMissionTaskOV greenMissionOV = new UpdateGreenMissionTaskOV();
                        greenMissionOV.setMissionTask(mission);
                        greenMissionOV.setPosition(mPosition);
                        EventBus.getDefault().post(greenMissionOV);


                        //发送一个远程通知
                        JPushMessageBean jPushMessageBean = new JPushMessageBean();
                        JPushMessageBean.AudienceBean audienceBean = new JPushMessageBean.AudienceBean();
                        ArrayList<String> alias = new ArrayList<>();
                        alias.add(mission.getApproved_person());
                        audienceBean.setAlias(alias);
                        jPushMessageBean.setAudience(audienceBean);
                        JPushMessageBean.NotificationBean notificationBean = new JPushMessageBean.NotificationBean();
                        notificationBean.setAlert("新消息：" + mission.getTask_name());
                        JPushMessageBean.NotificationBean.AndroidBean androidBean = new JPushMessageBean.NotificationBean.AndroidBean();
                        JPushMessageBean.NotificationBean.AndroidBean.ExtrasBean extrasBean = new JPushMessageBean.NotificationBean.AndroidBean.ExtrasBean();
                        extrasBean.setOpenType("2");
                        extrasBean.setTaskid(mission.getTaskid());
                        androidBean.setExtras(extrasBean);
                        notificationBean.setAndroid(androidBean);
                        ArrayList<String> platforms = new ArrayList<>();
                        platforms.add("android");
                        jPushMessageBean.setPlatform(platforms);
                        jPushMessageBean.setNotification(notificationBean);
                        OkingJPushManager.getInstence().pushMessage(jPushMessageBean, new JPushMessageContract.View() {
                            @Override
                            public void pushMessageSucc(String result) {


                            }

                            @Override
                            public void pushMessageFail(Throwable ex) {
                                RxToast.error(ex.getMessage());
                            }
                        });

                        if (mainHandler == null) {

                            mainHandler = new Handler();
                        }
                        mainHandler.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                Stack<Activity> activityStack = ActivityUtil.getActivityStack();
                                for (Activity activity : activityStack) {
                                    if (activity.getClass().getSimpleName().equals("MissionActivity")) {
                                        activity.finish();
                                    }

                                }
                                finish();

                            }
                        }, 100);

                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        Log.i("Oking", ">>>>>>>>>>异常");
                        if (mRxDialogLoading != null) {
                            mRxDialogLoading.cancel();
                        }
                    }
                });

    }


    public void saveTheRecord() {
        if (mission.getStatus().equals("5")) {

        } else {
            switch (atPosition) {
                case 0:
                    saveTaskInfo();
                    break;
                case 1:
                    savePatrol();
                    break;
                case 2:
                    saveResults();
                    break;
                case 3:
                    break;
                case 4:
                    break;
                default:
                    break;
            }

        }

    }

    private String getAfterData(long time) {
        //如果需要向后计算日期 -改为+
        Date newDate = new Date(time + 24 * 60 * 60 * 1000);
        mBeforTime = newDate.getTime();
        String dateOk = sdf.format(newDate);
        return dateOk;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.TaskLogPicRecyAdapter;
import com.zhang.okinglawenforcementphone.beans.GreenLocation;
import com.zhang.okinglawenforcementphone.beans.GreenMedia;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLog;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.mvp.contract.LoadBasicLogContract;
import com.zhang.okinglawenforcementphone.mvp.contract.LoadTaskPicContract;
import com.zhang.okinglawenforcementphone.mvp.presenter.LoadBasicLogPresenter;
import com.zhang.okinglawenforcementphone.mvp.presenter.LoadTaskPicPresenter;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.ImageViewActivity;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.PlayVideoOnlineActivity;

import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class ApprovalPicVideoFragment extends Fragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.pic_gridView)
    RecyclerView mPicGridView;
    Unbinder unbinder;
    @BindView(R.id.swipeRefreshLayout)
    SwipeRefreshLayout mSwipeRefreshLayout;

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    private View mInflate;
    private TaskLogPicRecyAdapter mTaskLogPicRecyAdapter;
    private GreenMissionTask mGreenMissionTask;
    private GreenMissionLog mGreenMissionLog;
    private LoadBasicLogPresenter mLoadBasicLogPresenter;
    private LoadTaskPicPresenter mLoadTaskPicPresenter;
    private boolean mIsLoadMeadiaSucc = false;

    public ApprovalPicVideoFragment() {
        // Required empty public constructor
    }

    public static ApprovalPicVideoFragment newInstance(String param1, String param2) {
        ApprovalPicVideoFragment fragment = new ApprovalPicVideoFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_approval_pic_video, container, false);

        }

        unbinder = ButterKnife.bind(this, mInflate);
        initData();
        setListerner();
        return mInflate;
    }

    private void setListerner() {
        mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                loadLogData();
            }
        });
        mTaskLogPicRecyAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                List<GreenMedia> mediaList = adapter.getData();
                GreenMedia greenMedia = mediaList.get(position);
                if (greenMedia.getType() == 2) {
                    Intent intent = new Intent(getActivity(), PlayVideoOnlineActivity.class);
                    /**
                     * 有毒，请截取掉.MP4后缀！！！请截取掉.MP4后缀！！！（后台框架限制）
                     */

                    intent.putExtra("path", StringUtils.substring(greenMedia.getPath(), 0, greenMedia.getPath().length() - 4));
                    startActivity(intent);


                } else if (greenMedia.getType() == 1) {
                    Intent intent = new Intent(getActivity(), ImageViewActivity.class);
                    intent.putExtra("time", OkingContract.SDF.format(greenMedia.getTime()));
                    intent.putExtra("picLocation", greenMedia.getSouceLocation().getLatitude() + "," + greenMedia.getSouceLocation().getLongitude());
                    intent.setData(Uri.parse(greenMedia.getPath()));
                    startActivity(intent);
                } else {

                    Intent intent = new Intent(getActivity(), ImageViewActivity.class);
                    intent.setData(Uri.parse(greenMedia.getPath()));
                    startActivity(intent);

                }
            }
        });

    }

    private void initData() {
        mPicGridView.setLayoutManager(new GridLayoutManager(BaseApplication.getApplictaion(), 5));
        mTaskLogPicRecyAdapter = new TaskLogPicRecyAdapter(getActivity(), R.layout.pic_item, null);
        mPicGridView.setAdapter(mTaskLogPicRecyAdapter);

        loadLogData();

    }

    private void loadLogData() {
        if (mGreenMissionLog == null) {  //先去获取日志
            if (mLoadBasicLogPresenter == null) {
                mLoadBasicLogPresenter = new LoadBasicLogPresenter(new LoadBasicLogContract.View() {
                    @Override
                    public void getBasicLogSucc(String result) {
                        //{"msg":"查询成功!","datas":[{"OTHER_PART":"交通,城管","EQUIPMENT":"交通工具：001003,001001,001001  ","PLAN":"0","TYPE":"0"}],"status":"1"}

                        try {
                            JSONObject jsonObject = new JSONObject(result);
                            String status = jsonObject.getString("status");
                            if (status.equals("1")) {
                                JSONArray datas = jsonObject.getJSONArray("datas");
                                mGreenMissionLog = new GreenMissionLog();
                                for (int i = 0; i < datas.length(); i++) {
                                    JSONObject object = datas.getJSONObject(i);
                                    mGreenMissionLog.setEquipment(object.getString("EQUIPMENT"));
                                    mGreenMissionLog.setServer_id(object.getString("LOG_ID"));
                                    mGreenMissionLog.setTask_id(mGreenMissionTask.getTaskid());
                                    mGreenMissionLog.setOther_part(object.getString("OTHER_PART"));
                                    mGreenMissionLog.setPlan(Integer.parseInt(object.getString("PLAN")));
                                    mGreenMissionLog.setPatrol(object.getString("PATROL"));
                                    mGreenMissionLog.setDzyj(object.getString("DZYJ"));
                                }
                                GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao()
                                        .insert(mGreenMissionLog);
                                loadLogMedia();
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
//
                    }

                    @Override
                    public void getBasicLogFail(Throwable ex) {
                        RxToast.error("获取日志失败");

                    }
                });

            }
            mLoadBasicLogPresenter.getBasicLog(mGreenMissionTask.getTaskid());
        } else {
            loadLogMedia();
        }

    }

    private void loadLogMedia() {
        if (!mIsLoadMeadiaSucc&&mGreenMissionLog.getServer_id()!=null) {
            if (mLoadTaskPicPresenter == null) {
                mLoadTaskPicPresenter = new LoadTaskPicPresenter(new LoadTaskPicContract.View() {
                    @Override
                    public void loadTaskPicSucc(String result) {
                        mSwipeRefreshLayout.setRefreshing(false);
                        mIsLoadMeadiaSucc = true;
                        List<GreenMedia> mediaList = new ArrayList<>();
                        try {
                            JSONArray jsonArray = new JSONArray(result);


                            for (int i = 0; i < jsonArray.length(); i++) {
                                GreenMedia greenMedia = new GreenMedia();
                                JSONObject jsonObject = jsonArray.getJSONObject(i);
//                            String id = jsonObject.optString("ID");
//                            String logId = jsonObject.optString("LOG_ID");
                                String path = jsonObject.optString("PATH");
                                String userId = jsonObject.optString("USER_ID");
                                String ext = jsonObject.optString("EXT");
                                String type = jsonObject.getString("TYPE");
                                String smallimg = jsonObject.getString("SMALLIMG");
                                //文件类型  0-巡查日志照片  1-队员签名图片 2-视频 3-视频缩略图

                                switch (type) {
                                    case "0":
                                        greenMedia.setType(1);//1表示日志图片  2表示视频  3表示语音   4签名图片
                                        greenMedia.setPath(Api.BASE_URL + "/upload" + path);
                                        greenMedia.setGreenMissionLogId(mGreenMissionLog.getId());
                                        if (ext != null) {
                                            JSONObject extObj = new JSONObject(ext);
                                            String datetime = extObj.optString("datetime");

                                            if (datetime != null) {
                                                try {
                                                    greenMedia.setTime(OkingContract.SDF.parse(datetime).getTime());
                                                } catch (ParseException e) {
                                                    e.printStackTrace();
                                                }
                                            }
                                            GreenLocation greenLocation = new GreenLocation();
                                            greenLocation.setLatitude(extObj.optString("latitude"));
                                            greenLocation.setLongitude(extObj.optString("longitude"));
                                            greenMedia.setSouceLocation(greenLocation);
                                        }

                                        mediaList.add(greenMedia);
                                        break;
                                    case "1":
                                        greenMedia.setType(4);
                                        greenMedia.setPath(Api.BASE_URL + "/upload" + path);
                                        greenMedia.setUserid(userId);
                                        greenMedia.setGreenMissionLogId(mGreenMissionLog.getId());
                                        mediaList.add(greenMedia);
                                        break;
                                    case "2":
                                        greenMedia.setType(2);
                                        greenMedia.setPath(Api.BASE_URL + "/upload" + smallimg);
                                        greenMedia.setGreenMissionLogId(mGreenMissionLog.getId());
                                        mediaList.add(greenMedia);
                                        break;
                                    default:
                                        break;

                                }
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                            Log.i("Oking2", e.getMessage());
                        }
                        mTaskLogPicRecyAdapter.setNewData(mediaList);
                    }

                    @Override
                    public void loadTaskPicFail(Throwable e) {
                        Log.i("Oking1", "失败" + e.toString());
                        mSwipeRefreshLayout.setRefreshing(false);
                        mIsLoadMeadiaSucc = false;
                    }
                });
            }

            mLoadTaskPicPresenter.loadTaskPic(mGreenMissionLog.getServer_id());
        } else {
            mSwipeRefreshLayout.setRefreshing(false);
        }


    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    public void setMissionTask(GreenMissionTask greenMissionTask) {
        mGreenMissionTask = greenMissionTask;
    }

    public void setMissionLog(GreenMissionLog greenMissionLog) {
        mGreenMissionLog = greenMissionLog;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

/**
 * Created by Administrator on 2018/2/3.
 */

public class MarkerOptionInfo {
    private int optionType;
    private String sourcePath;

    public int getOptionType() {
        return optionType;
    }

    public void setOptionType(int optionType) {
        this.optionType = optionType;
    }

    public String getSourcePath() {
        return sourcePath;
    }

    public void setSourcePath(String sourcePath) {
        this.sourcePath = sourcePath;
    }

    @Override
    public String toString() {
        return "MarkerOptionInfo{" +
                "optionType=" + optionType +
                ", sourcePath='" + sourcePath + '\'' +
                '}';
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.contract;

/**
 * Created by Administrator on 2018/6/9/009.
 */

public interface LoadAcceptNumberContract {
    interface Model {
        void loadAcceptNumber();

    }

    interface View {
        void loadAcceptNumberSucc(String result);

        void loadAcceptNumberFail(Throwable ex);
    }

    interface Presenter {
        void loadAcceptNumber();

        void loadAcceptNumberSucc(String result);

        void loadAcceptNumberFail(Throwable ex);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone;

import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Environment;
import android.os.IBinder;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Log;

import com.amap.api.navi.AMapNavi;
import com.google.gson.Gson;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.DefaultContants;
import com.zhang.baselib.utils.FileUtil;
import com.zhang.baselib.utils.NetUtil;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadLocationToServerContract;
import com.zhang.okinglawenforcementphone.mvp.presenter.UploadLocationToServerPresenter;

import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.concurrent.TimeUnit;

import io.reactivex.Flowable;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Administrator on 2018/4/20.
 */

public class OkingLocationManager {
    private static OkingLocationManager mOkingLocationMannager;
    private Subscription mSubscription;
    private SimpleDateFormat locationFileSdf = new SimpleDateFormat("yyyyMMdd");
    private UploadLocationToServerPresenter mUploadLocationToServerPresenter;

    private OkingLocationManager() {
    }

    public static final OkingLocationManager getInstence() {
        if (mOkingLocationMannager == null) {
            synchronized (OkingLocationManager.class) {
                if (mOkingLocationMannager == null) {
                    mOkingLocationMannager = new OkingLocationManager();
                }
            }
        }

        return mOkingLocationMannager;
    }

    public void init() {
        //设置高德地图apikey
        AMapNavi.setApiKey(BaseApplication.getApplictaion(), "26c7c12d8952b9db18af6439616b25aa");
    }

    @SuppressLint("WrongConstant")
    public void startLocation(final UploadLocationToServerContract.View mView, final String imei, final Gson gson) {
        Intent intent = new Intent();
        intent.setComponent(new ComponentName("com.zhang.okinglawenforcementphone", "com.zhang.okinglawenforcementphone.service.IRemoteLocationService"));
        BaseApplication.getApplictaion().bindService(intent, new ServiceConnection() {
            @Override
            public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
                final AmapLocationAidlInterface amapLocationAidlInterface = AmapLocationAidlInterface.Stub.asInterface(iBinder);
                if (amapLocationAidlInterface != null) {
                    Flowable.interval(1, 4, TimeUnit.SECONDS)
                            .onBackpressureDrop()
                            .subscribe(new Subscriber<Long>() {
                                @Override
                                public void onSubscribe(Subscription s) {
                                    mSubscription = s;
                                    s.request(Long.MAX_VALUE);
                                }

                                @Override
                                public void onNext(Long aLong) {
                                    try {
                                        String[] location = amapLocationAidlInterface.getLocation();
                                        OkingContract.LOCATIONRESULT = location;
                                        OkingContract.MARQUEEVIEWINFO.clear();
                                        OkingContract.MARQUEEVIEWINFO.add("当前定位类型：" + OkingContract.LOCATIONRESULT[0]);
                                        OkingContract.MARQUEEVIEWINFO.add("经纬度：" + OkingContract.LOCATIONRESULT[1] + "," + OkingContract.LOCATIONRESULT[2]);
                                        OkingContract.MARQUEEVIEWINFO.add("定位时间：" + OkingContract.LOCATIONRESULT[3]);
                                    } catch (RemoteException e) {
                                        e.printStackTrace();
                                    }


                                    try {
                                        if (aLong % 5 == 0) {
                                            amapLocationAidlInterface.refreshNotification();
                                            if (NetUtil.isConnected(BaseApplication.getApplictaion())
                                                    && OkingContract.CURRENTUSER != null
                                                    && !"".equals(OkingContract.CURRENTUSER.getUserid()) &&
                                                    DefaultContants.ISHTTPLOGIN && !TextUtils.isEmpty(OkingContract.LOCATIONRESULT[1])) {

                                                if (mUploadLocationToServerPresenter == null) {
                                                    mUploadLocationToServerPresenter = new UploadLocationToServerPresenter(mView);

                                                }

                                                mUploadLocationToServerPresenter.upploadLocationToServer(Long.parseLong(OkingContract.CURRENTUSER.getLogintime()), OkingContract.SDF, imei, gson);

                                            }

                                            //把定位经纬度保存text


                                            if (!TextUtils.isEmpty(OkingContract.LOCATIONRESULT[3]) && !OkingContract.LOCATIONRESULT[0].equals("返回上次定位")) {

                                                Schedulers.io().createWorker().schedule(new Runnable() {
                                                    @Override
                                                    public void run() {
                                                        writeToLogFile();
                                                    }
                                                });
                                            }

                                        }
                                    } catch (RemoteException e) {
                                        e.printStackTrace();
                                    }

                                }

                                @Override
                                public void onError(Throwable t) {
                                    Log.i("Oking", "定位异常" + t.getMessage());
                                }

                                @Override
                                public void onComplete() {

                                }
                            });
                }
            }

            @Override
            public void onServiceDisconnected(ComponentName componentName) {
                if (mSubscription != null) {
                    mSubscription.cancel();
                }


            }
        }, 1);

    }

    public void cancelLocation() {
        if (mSubscription!=null){

            mSubscription.cancel();
            mSubscription=null;
        }
    }

    private void writeToLogFile() {
        String filePath = Environment.getExternalStorageDirectory() + "/oking/location/" + locationFileSdf.format(System.currentTimeMillis()) + ".txt";


        String cont = null;

        try {
            long time = OkingContract.SDF.parse(OkingContract.LOCATIONRESULT[3]).getTime();
            cont = OkingContract.LOCATIONRESULT[1] + "," + OkingContract.LOCATIONRESULT[2] + "," + time + "\n";
        } catch (ParseException e) {
            e.printStackTrace();
        }
        boolean flag = FileUtil.writeFileFromString(filePath, cont, true);
        if (flag) {
//            System.out.println("文件写入成功");
        } else {
//            System.out.println("文件写入失败");
        }

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.views;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

/**
 * Created by zhao on 2016/10/18.
 */

public class SignatureView extends View {

    private Paint paint = new Paint();
    private Path path = new Path();

    private boolean canPaint = true;

    public SignatureView(Context context) {
        super(context);
        initView(context);
    }

    public SignatureView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    private void initView(Context context) {
        paint.setAntiAlias(true);
        paint.setColor(Color.BLACK);
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeJoin(Paint.Join.ROUND);
        paint.setStrokeWidth(25f);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        if(canPaint) {
            canvas.drawPath(path, paint);
        }
        super.onDraw(canvas);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        float eventX = event.getX();
        float eventY = event.getY();

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                path.moveTo(eventX, eventY);
                return true;
            case MotionEvent.ACTION_MOVE:
            case MotionEvent.ACTION_UP:
                path.lineTo(eventX, eventY);
                break;
            default:
                return false;
        }

        invalidate();
        return true;
    }

    public void clear(){
        this.setDrawingCacheEnabled(false);
        path.reset();
        invalidate();
    }

    public Bitmap save(){
        if(!path.isEmpty()) {
            this.setDrawingCacheEnabled(true);
            this.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
            this.setDrawingCacheBackgroundColor(Color.WHITE);
            this.buildDrawingCache();
            return this.getDrawingCache();
        }else{
            return null;
        }
    }

    public boolean isCanPaint() {
        return canPaint;
    }

    public void setCanPaint(boolean canPaint) {
        this.canPaint = canPaint;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;

import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;
import com.zhang.okinglawenforcementphone.mvp.ui.fragments.HandlingMenuFragment;
import com.zhang.okinglawenforcementphone.mvp.ui.fragments.LawEnforcementMenuFragment;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class CaseManagerActivity extends BaseActivity {
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.tv_title)
    TextView mTvTitle;
    private Unbinder mBind;
    private HandlingMenuFragment mHandlingMenuFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_case_manager);
        mBind = ButterKnife.bind(this);
        initData();
        setListenner();
    }

    private void setListenner() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                back();
            }
        });
    }

    private void back() {
        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        Fragment caseRegistrationFragment = getSupportFragmentManager().findFragmentByTag("CaseRegistrationFragment");
        Fragment openCasesFragment = getSupportFragmentManager().findFragmentByTag("OpenCasesFragment");
        Fragment caseProcessingListFragment = getSupportFragmentManager().findFragmentByTag("CaseProcessingListFragment");
        Fragment caseComplaintFragment = getSupportFragmentManager().findFragmentByTag("CaseComplaintFragment");
        Fragment caseInAdvanceFragment = getSupportFragmentManager().findFragmentByTag("CaseInAdvanceFragment");

        if (caseRegistrationFragment != null && !caseRegistrationFragment.isHidden()) {
            mTvTitle.setText("办案");
            fragmentTransaction.hide(caseRegistrationFragment);
            fragmentTransaction.show(mHandlingMenuFragment).commit();
        }else if (openCasesFragment != null && !openCasesFragment.isHidden()) {
            mTvTitle.setText("办案");
            fragmentTransaction.hide(openCasesFragment);
            fragmentTransaction.show(mHandlingMenuFragment).commit();
        }else if (caseProcessingListFragment != null && !caseProcessingListFragment.isHidden()) {
            mTvTitle.setText("办案");
            fragmentTransaction.hide(caseProcessingListFragment);
            fragmentTransaction.show(mHandlingMenuFragment).commit();
        }else if (caseComplaintFragment != null && !caseComplaintFragment.isHidden()) {
            mTvTitle.setText("办案");
            fragmentTransaction.hide(caseComplaintFragment);
            fragmentTransaction.show(mHandlingMenuFragment).commit();
        }else if (caseInAdvanceFragment != null && !caseInAdvanceFragment.isHidden()) {
            mTvTitle.setText("办案");
            fragmentTransaction.hide(caseInAdvanceFragment);
            fragmentTransaction.show(mHandlingMenuFragment).commit();
        }else {
            finish();
        }
    }

    private void initData() {
        mHandlingMenuFragment = HandlingMenuFragment.newInstance(null, null);
        getSupportFragmentManager().beginTransaction().replace(R.id.rl_case_content, mHandlingMenuFragment, "HandlingMenuFragment").commit();

//        initPage();

//        CaseManagerListFragment caseManagerListFragment = CaseManagerListFragment.newInstance(null, null);
//        getSupportFragmentManager().beginTransaction().replace(R.id.taskmanager_content, caseManagerListFragment).commit();
    }

//    private void initPage() {
//        ArrayList<String> listTitles = new ArrayList<>();
//        ArrayList<Fragment> fragments = new ArrayList<>();
//
//        listTitles.add("案件登记");
//        CaseRegistrationFragment caseRegistrationFragment = CaseRegistrationFragment.newInstance(null, null);
//        fragments.add(caseRegistrationFragment);
//        mTabLayout.addTab(mTabLayout.newTab().setText("案件登记"));
//
//        listTitles.add("案件受理");
//        OpenCasesFragment openCasesFragment = OpenCasesFragment.newInstance(null, null);
//        fragments.add(openCasesFragment);
//        mTabLayout.addTab(mTabLayout.newTab().setText("案件受理"));
//
//        listTitles.add("案件处理");
//        CaseProcessingListFragment caseManagerListFragment = CaseProcessingListFragment.newInstance(null, null);
//        fragments.add(caseManagerListFragment);
//        mTabLayout.addTab(mTabLayout.newTab().setText("案件处理"));
//
//        listTitles.add("案件转办");
//        CaseComplaintFragment caseComplaintFragment = CaseComplaintFragment.newInstance(null, null);
//        fragments.add(caseComplaintFragment);
//        mTabLayout.addTab(mTabLayout.newTab().setText("案件转办"));
//
//
//        listTitles.add("预立案");
//        CaseInAdvanceFragment caseInAdvanceFragment = CaseInAdvanceFragment.newInstance(null, null);
//        fragments.add(caseInAdvanceFragment);
//        mTabLayout.addTab(mTabLayout.newTab().setText("预立案"));
//
//
//        TitleAdapter titleTabAdapter = new TitleAdapter(getSupportFragmentManager(), fragments, listTitles);
//        mViewPager.setAdapter(titleTabAdapter);
//        mTabLayout.setupWithViewPager(mViewPager);
//    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBind.unbind();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            back();
            return true;//return true;拦截事件传递,从而屏蔽back键。
        }

        return super.onKeyDown(keyCode, event);
    }

    public void setTitleText(String title) {
        mTvTitle.setText(title);
    }

}
<file_sep>path.variable.kotlin_bundled=G\:\\Android Studio\\plugins\\Kotlin\\kotlinc
jdk.home.1.8=G\:/Android Studio/jre
jdk.home.android_api_27_platform=G\:/androidSDK
javac2.instrumentation.includeJavaRuntime=false<file_sep>"# OkingLawEnforcementPhone" 
"# OkingLawEnforcementPhone" 
"# OkingLawEnforcementPhone" 
"# OkingLawEnforcementPhone" 
<file_sep>package com.zhang.okinglawenforcementphone.beans;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Generated;

/**
 * Created by Administrator on 2018/5/28.
 */
@Entity
public class GreenEvidenceMedia {
    @Id(autoincrement = true)
    private Long id;
    private Long greenEvidenceId;
    private Long time;
    private String path;
    private String userid;
    private String taskid;
    private Integer type;               //1表示证据图片  2表示视频  3表示语音
    @Generated(hash = 1044598213)
    public GreenEvidenceMedia(Long id, Long greenEvidenceId, Long time, String path,
            String userid, String taskid, Integer type) {
        this.id = id;
        this.greenEvidenceId = greenEvidenceId;
        this.time = time;
        this.path = path;
        this.userid = userid;
        this.taskid = taskid;
        this.type = type;
    }
    @Generated(hash = 612896463)
    public GreenEvidenceMedia() {
    }
    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getGreenEvidenceId() {
        return this.greenEvidenceId;
    }
    public void setGreenEvidenceId(Long greenEvidenceId) {
        this.greenEvidenceId = greenEvidenceId;
    }
    public Long getTime() {
        return this.time;
    }
    public void setTime(Long time) {
        this.time = time;
    }
    public String getPath() {
        return this.path;
    }
    public void setPath(String path) {
        this.path = path;
    }
    public String getUserid() {
        return this.userid;
    }
    public void setUserid(String userid) {
        this.userid = userid;
    }
    public String getTaskid() {
        return this.taskid;
    }
    public void setTaskid(String taskid) {
        this.taskid = taskid;
    }
    public Integer getType() {
        return this.type;
    }
    public void setType(Integer type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return "GreenEvidenceMedia{" +
                "id=" + id +
                ", greenEvidenceId=" + greenEvidenceId +
                ", time=" + time +
                ", path='" + path + '\'' +
                ", userid='" + userid + '\'' +
                ", taskid='" + taskid + '\'' +
                ", type=" + type +
                '}';
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.model;

import android.net.Uri;
import android.util.Log;

import com.google.gson.Gson;
import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.okinglawenforcementphone.beans.GreenLocation;
import com.zhang.okinglawenforcementphone.beans.GreenMedia;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLog;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.beans.Point;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadJobLogForPicContract;

import org.json.JSONObject;

import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.functions.Predicate;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;

/**
 * Created by Administrator on 2018/4/26/026.
 */

public class UploadJobLogForPicModel implements UploadJobLogForPicContract.Model {
    private UploadJobLogForPicContract.Presenter mPresenter;
    private String mLogResult;
    private int pos = 0;
    private String mLastPathSegment;

    public UploadJobLogForPicModel(UploadJobLogForPicContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void uploadJobLogForPic(final Gson gson, final Map<String, RequestBody> photoParams, final GreenMissionLog mLog, final List<GreenMedia> media) {
        BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .getMissionRecordPicPath(mLog.getServer_id(), 0)
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .observeOn(Schedulers.io())
                .concatMap(new Function<ResponseBody, Observable<GreenMedia>>() {

                    @Override
                    public Observable<GreenMedia> apply(ResponseBody responseBody) throws Exception {
                        mLogResult = responseBody.string();

                        Log.i("Oking", "已存在日志图片集合:" + mLogResult);
                        pos = 0;
                        return Observable.fromIterable(media);
                    }
                })
                .concatMap(new Function<GreenMedia, ObservableSource<ResponseBody>>() {
                    @Override
                    public Observable<ResponseBody> apply(GreenMedia media) throws Exception {
                        mLastPathSegment = Uri.parse(media.getPath()).getLastPathSegment();
                        if (mLogResult.contains(mLastPathSegment)) {
                            //已经存在服务器
                            Log.i("Oking", "日志图片已存在服务器" + mLastPathSegment);
                            pos++;
                            mPresenter.uploadIsCount(pos);
                        } else {

                            //上传图片
                            photoParams.clear();
                            File file = new File(Uri.parse(media.getPath()).getPath());

                            photoParams.put("logId", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), mLog.getServer_id()));
                            photoParams.put("type", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), "0"));
                            photoParams.put("smallImg", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), ""));
                            String ext;
                            GreenLocation mediaLocation = media.getLocation();
                            if (mediaLocation != null) {
                                Point location = new Point();
                                location.setLongitude(Double.parseDouble(mediaLocation.getLongitude()));
                                location.setLatitude(Double.parseDouble(mediaLocation.getLatitude()));
                                location.setDatetime(media.getTime());
                                ext = gson.toJson(location);
                            } else {
                                Map<String, String> map = new HashMap<>();
                                map.put("datetime", OkingContract.SDF.format(media.getTime()));
                                ext = gson.toJson(map);
                            }
                            Log.i("Oking5",ext);
                            photoParams.put("ext", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), ext));

                            photoParams.put("files" + "\"; filename=\"" + file.getName(), RequestBody.create(MediaType.parse("image/png"), file));
                            return BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                                    .uploadFiles(photoParams);
                        }
                        return Observable.empty();
                    }
                })
                .observeOn(AndroidSchedulers.mainThread())
                .retry(5, new Predicate<Throwable>() {
                    @Override
                    public boolean test(Throwable throwable) throws Exception {
                        //最多让被观察者重新发射数据5次，但是这里返回值可以进行处理
                        //返回假就是不让重新发射数据了，调用观察者的onError就终止了。
                        //返回真就是让被观察者重新发射请求

                        mPresenter.uploadRetry(throwable);
                        Log.i("Oking", "日志图片上传异常，重试");

                        return true;
                    }
                })
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        String result = responseBody.string();
                        JSONObject jsonObject = new JSONObject(result);
                        String path = jsonObject.getString("path");
                        mLogResult = mLogResult + "," + path;
                        Log.i("Oking", "日志图片上传成功" + result);
                        mPresenter.uploadSucc(result);
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        mPresenter.uploadFail(throwable);
                        Log.i("Oking", "日志图片上传失败" + throwable.toString());
                    }
                });

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.app.PendingIntent;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.support.design.widget.TextInputEditText;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.google.gson.Gson;
import com.jzxiang.pickerview.TimePickerDialog;
import com.jzxiang.pickerview.data.Type;
import com.jzxiang.pickerview.listener.OnDateSetListener;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.baselib.ui.views.RxDialogLoading;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.baselib.utils.TextUtil;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.OkingNotificationManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.EmergencyMemberAdapter;
import com.zhang.okinglawenforcementphone.adapter.SourceArrayRecyAdapter;
import com.zhang.okinglawenforcementphone.beans.ApproverBean;
import com.zhang.okinglawenforcementphone.beans.EmergencyMemberGson;
import com.zhang.okinglawenforcementphone.beans.EmergencyTaskOV;
import com.zhang.okinglawenforcementphone.beans.GreenMember;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.beans.LatLngListOV;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.beans.SourceArrayOV;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;
import com.zhang.okinglawenforcementphone.utils.ApproverPinyinComparator;
import com.zhang.okinglawenforcementphone.utils.DialogUtil;
import com.zhang.okinglawenforcementphone.utils.EmergencyPinyinComparator;
import com.zhang.okinglawenforcementphone.views.DividerItemDecoration;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;

public class TemporaryEmergencyTaskActivity extends BaseActivity implements OnDateSetListener {

    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.et_taskname)
    TextInputEditText mEtTaskname;
    @BindView(R.id.publisher_tv)
    TextInputEditText mPublisherTv;
    @BindView(R.id.sp_tasktype)
    TextView mSpTasktype;
    @BindView(R.id.sp_approver)
    TextView mSpApprover;
    @BindView(R.id.sp_source)
    TextView mSpSource;
    @BindView(R.id.sp_tasknature)
    TextView mSpTasknature;
    @BindView(R.id.list_item_missionMember)
    TextInputEditText mListItemMissionMember;
    @BindView(R.id.bt_select_begintime)
    Button mBtSelectBegintime;
    @BindView(R.id.bt_select_endtime)
    Button mBtSelectEndtime;
    @BindView(R.id.list_item_missionDetail)
    TextInputEditText mListItemMissionDetail;
    @BindView(R.id.et_description)
    TextInputEditText mEtDescription;
    @BindView(R.id.bt_ok)
    Button mBtOk;
    @BindView(R.id.bt_select_members)
    Button mBtSelectMembers;
    @BindView(R.id.ib_map)
    ImageButton mIbMap;

    private TimePickerDialog mBeginDialogAll;
    private TimePickerDialog mEndDialogAll;
    private SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    private long mBeginMillseconds = 0;
    private long mEndMillseconds = 0;

    private String mApproverId;    //选中的审批人ID
    private String mApprover;    //选中的审批人
    private String mSource;     //选中的线索来源
    private String mTasknature;   //选中的任务性质
    private List<ApproverBean.SZJCBean> mSzjc;
    private String mMembersid;
    private RxDialogLoading mSubRxDialogLoading;
    private Handler mainHandler;
    private String[] mTasktypeArray;
    private String mTasktype;
    private RxDialogLoading mRxDialogLoading;
    private Gson gson = new Gson();
    private String mMcoordinateJson;
    private ArrayList<GreenMember> mEmergencyMembers;
    private EmergencyMemberAdapter mEmergencyMemberAdapter;
    private View mButtomContentView;
    private ListView mLv_members;
    private DialogUtil mButtomDialogUtil;
    private Button mBtOkselect;
    private List<GreenMember> mCheckName;
    private Intent mIntent;
    private Unbinder mBind;
    private LatLngListOV mLatLngListOV;
    private DialogUtil mDialogUtil;
    private View mButtonDailog;
    private TextView mTv_title;
    private ArrayList<SourceArrayOV> mSourceArrayOVS;
    private SourceArrayRecyAdapter mSourceArrayRecyAdapter;
    private ArrayList<SourceArrayOV> mTasknatureArrayOVS;
    private List<SourceArrayOV> mTasktypeArrayOVS;
    private List<SourceArrayOV> mApproversOVS;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_temporary_emergency_task);
        mBind = ButterKnife.bind(this);
        initView();
        initData();
        setListener();
    }

    private void setListener() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    private void initView() {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBind.unbind();
        EventBus.getDefault().unregister(this);
    }

    private void initData() {
        EventBus.getDefault().register(this);
        mPublisherTv.setText(OkingContract.CURRENTUSER.getUserName());

        BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .loadEmergencyName(OkingContract.CURRENTUSER.getDept_id())
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        String result = responseBody.string();
                        try {
                            JSONObject jsonObject = new JSONObject(result);
                            int code = jsonObject.getInt("code");
                            if (code == 400) {
                                JSONArray msg = jsonObject.getJSONArray("msg");
                                JSONObject jsonObject1 = msg.getJSONObject(0);
                                String rwmc = jsonObject1.getString("rwmc");
                                mEtTaskname.setText(rwmc);
                                TextUtil.setEditTextInhibitInputSpace(mEtTaskname);
                                TextUtil.setEditTextInhibitInputSpeChat(mEtTaskname);
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }

                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {

                    }
                });

        initButtomDialog();
        String[] sourceArray = getResources().getStringArray(R.array.spinner_source);
        mSourceArrayOVS = new ArrayList<>();
        for (String s : sourceArray) {
            SourceArrayOV sourceArrayOV = new SourceArrayOV();
            sourceArrayOV.setType(0);
            sourceArrayOV.setSource(s);
            mSourceArrayOVS.add(sourceArrayOV);
        }

        String[] tasknatureArray = getResources().getStringArray(R.array.spinner_tasknature);
        mTasknatureArrayOVS = new ArrayList<>();
        for (String s : tasknatureArray) {
            SourceArrayOV sourceArrayOV = new SourceArrayOV();
            sourceArrayOV.setType(1);
            sourceArrayOV.setSource(s);
            mTasknatureArrayOVS.add(sourceArrayOV);
        }

        String[] tasktypeArray =  getResources().getStringArray(R.array.spinner_tasktype);
        mTasktypeArrayOVS = new ArrayList<>();
        for (String s : tasktypeArray) {
            SourceArrayOV sourceArrayOV = new SourceArrayOV();
            sourceArrayOV.setType(2);
            sourceArrayOV.setSource(s);
            mTasktypeArrayOVS.add(sourceArrayOV);
        }

        if (mRxDialogLoading == null) {
            initWaitingDialog();
        }

        mRxDialogLoading.show();
        BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .loadPersonnel("SZJC")
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        String result = responseBody.string();
                        mRxDialogLoading.cancel();

                        ApproverBean approverBean = gson.fromJson(result, ApproverBean.class);
                        mSzjc = approverBean.getSZJC();
                        Collections.sort(mSzjc, new ApproverPinyinComparator());
                        mApproversOVS = new ArrayList<>();
                        for (int i = 0; i < mSzjc.size(); i++) {
                            SourceArrayOV sourceArrayOV = new SourceArrayOV();
                            sourceArrayOV.setType(3);
                            sourceArrayOV.setSource(mSzjc.get(i).getUSERNAME());
                            mApproversOVS.add(sourceArrayOV);
                        }


                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        Log.i("Oking", "失败：" + throwable.getMessage());
                        RxToast.error(BaseApplication.getApplictaion(), "数据获取失败", Toast.LENGTH_SHORT).show();
                        mRxDialogLoading.cancel();
                    }
                });

    }

    private void initButtomDialog() {

        if (mDialogUtil == null) {
            mDialogUtil = new DialogUtil();
            mButtonDailog = View.inflate(BaseApplication.getApplictaion(), R.layout.maptask_dialog, null);
            mTv_title = mButtonDailog.findViewById(R.id.tv_title);
            RecyclerView recyList = mButtonDailog.findViewById(R.id.recy_task);
            recyList.setLayoutManager(new LinearLayoutManager(BaseApplication.getApplictaion(), LinearLayoutManager.VERTICAL, false));
            recyList.addItemDecoration(new DividerItemDecoration(BaseApplication.getApplictaion(), 0, 1, Color.argb(255,223,223,223)));
            mSourceArrayRecyAdapter = new SourceArrayRecyAdapter(R.layout.source_item, null);
            mSourceArrayRecyAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
            recyList.setAdapter(mSourceArrayRecyAdapter);
            mSourceArrayRecyAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
                @Override
                public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                    List<SourceArrayOV> sourceArrayOVS = adapter.getData();
                    SourceArrayOV sourceArrayOV = sourceArrayOVS.get(position);
                    switch (sourceArrayOV.getType()) {
                        case 0:

                            if ("上级交办".equals(sourceArrayOV.getSource())) {
                                mSource = "0";
                            } else if ("部门移送".equals(sourceArrayOV.getSource())) {
                                mSource = "1";
                            } else if ("系统报警".equals(sourceArrayOV.getSource())) {
                                mSource = "2";
                            } else if ("日常巡查".equals(sourceArrayOV.getSource())) {
                                mSource = "3";
                            } else if ("媒体披露".equals(sourceArrayOV.getSource())) {
                                mSource = "4";
                            } else if ("群众举报".equals(sourceArrayOV.getSource())) {
                                mSource = "5";
                            }

                            mSpSource.setText(sourceArrayOV.getSource());

                            break;
                        case 1:

                            if ("日常执法".equals(sourceArrayOV.getSource())) {
                                mTasknature = "0";
                            } else if ("联合执法".equals(sourceArrayOV.getSource())) {
                                mTasknature = "1";
                            } else if ("专项执法".equals(sourceArrayOV.getSource())) {
                                mTasknature = "2";
                            }
                            mSpTasknature.setText(sourceArrayOV.getSource());
                            break;
                        case 2:

                            if ("河道管理".equals(sourceArrayOV.getSource())) {
                                mTasktype = "0";
                            } else if ("河道采砂".equals(sourceArrayOV.getSource())) {
                                mTasktype = "1";
                            } else if ("水资源管理".equals(sourceArrayOV.getSource())) {
                                mTasktype = "2";
                            } else if ("水土保持管理".equals(sourceArrayOV.getSource())) {
                                mTasktype = "3";
                            } else if ("水利工程管理".equals(sourceArrayOV.getSource())) {
                                mTasktype = "4";
                            }
                            mSpTasktype.setText(sourceArrayOV.getSource());
                            break;
                        case 3:
                            mApproverId = mSzjc.get(position).getUSERID();
                            mApprover = sourceArrayOV.getSource();
                            mSpApprover.setText(sourceArrayOV.getSource());
                            break;
                        default:
                            break;
                    }

                    mDialogUtil.cancelDialog();
                }
            });

        }

    }

    private void initWaitingDialog() {
        mRxDialogLoading = new RxDialogLoading(this, false, new DialogInterface.OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialogInterface) {
                dialogInterface.cancel();
            }
        });
        mRxDialogLoading.setLoadingText("获取数据中,请稍等...");

    }

    @OnClick({R.id.sp_tasktype, R.id.sp_approver, R.id.sp_source, R.id.sp_tasknature,R.id.bt_select_begintime, R.id.bt_select_endtime, R.id.bt_ok, R.id.bt_select_members, R.id.ib_map})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.sp_tasktype:
                mTv_title.setText("任务类型");
                mSourceArrayRecyAdapter.setNewData(mTasktypeArrayOVS);
                mDialogUtil.showBottomDialog(TemporaryEmergencyTaskActivity.this, mButtonDailog, 300f);
                break;
            case R.id.sp_approver:
                mTv_title.setText("审批领导");
                mSourceArrayRecyAdapter.setNewData(mApproversOVS);
                mDialogUtil.showBottomDialog(TemporaryEmergencyTaskActivity.this, mButtonDailog, 300f);
                break;
            case R.id.sp_source:
                mTv_title.setText("线索来源");
                mSourceArrayRecyAdapter.setNewData(mSourceArrayOVS);
                mDialogUtil.showBottomDialog(TemporaryEmergencyTaskActivity.this, mButtonDailog, 300f);
                break;
            case R.id.sp_tasknature:
                mTv_title.setText("任务性质");
                mSourceArrayRecyAdapter.setNewData(mTasknatureArrayOVS);
                mDialogUtil.showBottomDialog(TemporaryEmergencyTaskActivity.this, mButtonDailog, 300f);
                break;
            case R.id.bt_select_begintime:          //选择开始时间
                if (mBeginDialogAll == null) {
                    initBeginWheelYearMonthDayDialog();
                }
                mBtSelectEndtime.setText("选择");
                mBeginDialogAll.show(getSupportFragmentManager(), "beginTime");
                break;
            case R.id.bt_select_endtime:            //选择结束时间
                initEndWheelYearMonthDayDialog();
                mEndDialogAll.show(getSupportFragmentManager(), "endTime");
                break;
            case R.id.bt_ok:                //提交
                submitDataToServer();
                break;
            case R.id.bt_select_members:        //选择成员
                if (mRxDialogLoading == null) {

                    initWaitingDialog();
                }
                mRxDialogLoading.show();
                httpGetCanSelectMember();
                break;
            case R.id.ib_map:
                if (mIntent == null) {
                    mIntent = new Intent(TemporaryEmergencyTaskActivity.this, MapByPointActivity.class);
                }
                if (mLatLngListOV != null) {
                    mIntent.putExtra("centerPoint", mLatLngListOV.getCenterLatLng());
                    mIntent.putExtra("drawLaLoType", mLatLngListOV.getType());
                    mIntent.putExtra("left", mLatLngListOV.getLeft());
                    mIntent.putExtra("right", mLatLngListOV.getRight());
                    mIntent.putExtra("top", mLatLngListOV.getTop());
                    mIntent.putExtra("bottom", mLatLngListOV.getBottom());
                    mIntent.putExtra("zoom", mLatLngListOV.getZoom());
                }
                startActivity(mIntent);
                break;
            default:
                break;
        }
    }

    private void initEndWheelYearMonthDayDialog() {
        long tenYears = 5L * 365 * 1000 * 60 * 60 * 24L;

        if (mBeginMillseconds == 0) {
            mBeginMillseconds = System.currentTimeMillis();
        }
        mEndDialogAll = new TimePickerDialog.Builder()
                .setCallBack(this)
                .setCancelStringId("取消")
                .setSureStringId("确认")
                .setTitleStringId("请选择结束时间")
                .setYearText("年")
                .setMonthText("月")
                .setDayText("日")
                .setHourText("点")
                .setMinuteText("分")
                .setCyclic(false)
                .setMinMillseconds(mBeginMillseconds)
                .setMaxMillseconds(System.currentTimeMillis() + tenYears)
                .setCurrentMillseconds(System.currentTimeMillis())
                .setThemeColor(getResources().getColor(R.color.timepicker_dialog_bg))
                .setType(Type.ALL)
                .setWheelItemTextNormalColor(getResources().getColor(R.color.timetimepicker_default_text_color))
                .setWheelItemTextSelectorColor(getResources().getColor(R.color.timepicker_toolbar_bg))
                .setWheelItemTextSize(18)
                .build();

    }

    private void initBeginWheelYearMonthDayDialog() {
        long tenYears = 5L * 365 * 1000 * 60 * 60 * 24L;
        mBeginDialogAll = new TimePickerDialog.Builder()
                .setCallBack(this)
                .setCancelStringId("取消")
                .setSureStringId("确认")
                .setTitleStringId("请选择开始时间")
                .setYearText("年")
                .setMonthText("月")
                .setDayText("日")
                .setHourText("点")
                .setMinuteText("分")
                .setCyclic(false)
                .setMinMillseconds(System.currentTimeMillis())
                .setMaxMillseconds(System.currentTimeMillis() + tenYears)
                .setCurrentMillseconds(System.currentTimeMillis())
                .setThemeColor(getResources().getColor(R.color.timepicker_dialog_bg))
                .setType(Type.ALL)
                .setWheelItemTextNormalColor(getResources().getColor(R.color.timetimepicker_default_text_color))
                .setWheelItemTextSelectorColor(getResources().getColor(R.color.timepicker_toolbar_bg))
                .setWheelItemTextSize(18)
                .build();

    }

    private void httpGetCanSelectMember() {
        if (mButtomContentView == null) {
            mButtomContentView = LayoutInflater.from(TemporaryEmergencyTaskActivity.this).inflate(R.layout.dialog_content_circle, null);

            mLv_members = mButtomContentView.findViewById(R.id.lv_members);
            mBtOkselect = mButtomContentView.findViewById(R.id.bt_okselect);
            mBtOkselect.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    mCheckName = mEmergencyMemberAdapter.getCheckName();
                    String members = OkingContract.CURRENTUSER.getUserName();
                    mMembersid = "";
                    for (GreenMember m : mCheckName) {
                        members = members + "," + m.getUsername();
                        mMembersid = mMembersid + "," + m.getUserid();
                    }
                    mListItemMissionMember.setText(members);
                    mButtomDialogUtil.cancelDialog();
                }
            });
        }

        BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .loadPersonnel("SZJC,CBR")
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        String result = responseBody.string();
                        mRxDialogLoading.cancel();

                        if (mEmergencyMembers == null) {

                            mEmergencyMembers = new ArrayList<GreenMember>();
                        }
                        mEmergencyMembers.clear();


                        EmergencyMemberGson emergencyMemberGson = gson.fromJson(result, EmergencyMemberGson.class);
                        List<EmergencyMemberGson.CBRBean> cbrs = emergencyMemberGson.getCBR();
                        for (EmergencyMemberGson.CBRBean cbrBean : cbrs) {


                            if (cbrBean.getUSERNAME().equals(OkingContract.CURRENTUSER.getUserName())) {
                                continue;
                            }
                            GreenMember member = new GreenMember();
                            member.setUsername(cbrBean.getUSERNAME());
                            member.setDepatid(cbrBean.getDEPTID());
                            member.setDepatname(cbrBean.getDEPTNAME());
                            member.setRemark(cbrBean.getREMARK());
                            member.setUserid(cbrBean.getUSERID());
                            member.setZfzh(cbrBean.getZFZH());
                            mEmergencyMembers.add(member);
                        }
                        List<EmergencyMemberGson.SZJCBean> szjcs = emergencyMemberGson.getSZJC();


                        for (EmergencyMemberGson.SZJCBean szjcBean : szjcs) {


                            if (szjcBean.getUSERNAME().equals(OkingContract.CURRENTUSER.getUserName())) {
                                continue;
                            }
                            GreenMember member = new GreenMember();
                            member.setUsername(szjcBean.getUSERNAME());
                            member.setDepatid(szjcBean.getDEPTID());
                            member.setDepatname(szjcBean.getDEPTNAME());
                            member.setRemark(szjcBean.getREMARK());
                            member.setUserid(szjcBean.getUSERID());
                            member.setZfzh(szjcBean.getZFZH());
                            mEmergencyMembers.add(member);
                        }


                        Collections.sort(mEmergencyMembers, new EmergencyPinyinComparator());
                        if (mButtomDialogUtil == null) {

                            mButtomDialogUtil = new DialogUtil();
                        }
                        mButtomDialogUtil.showBottomDialog(TemporaryEmergencyTaskActivity.this, mButtomContentView, 400f);
                        mEmergencyMemberAdapter = new EmergencyMemberAdapter(TemporaryEmergencyTaskActivity.this, mEmergencyMembers);
                        mLv_members.setAdapter(mEmergencyMemberAdapter);

                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        mRxDialogLoading.cancel();
                        if (mEmergencyMemberAdapter != null) {

                            mEmergencyMemberAdapter.notifyDataSetChanged();
                        }
                    }
                });

    }

    private void submitDataToServer() {
        if (mSubRxDialogLoading == null) {

            mSubRxDialogLoading = new RxDialogLoading(this, false, new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    dialogInterface.cancel();
                }
            });
            mSubRxDialogLoading.setLoadingText("提交数据中,请稍等...");
        }


        final String taskName = mEtTaskname.getText().toString().trim();
        String members = mListItemMissionMember.getText().toString().trim();
        final String missionDetail = mListItemMissionDetail.getText().toString().trim();
        final String description = mEtDescription.getText().toString().trim();
        final String beginTime = mBtSelectBegintime.getText().toString();
        final String endTime = mBtSelectEndtime.getText().toString();
        if (mSpTasktype.getText().toString().trim().equals("*请选择")) {
            RxToast.warning("请选择任务类型");
            return;
        }
        if (mSpApprover.getText().toString().trim().equals("*请选择")) {
            RxToast.warning("请选择审批领导");
            return;
        }
        if (mSpSource.getText().toString().trim().equals("*请选择")) {
            RxToast.warning("请选择线索来源");
            return;
        }
        if (mSpTasknature.getText().toString().trim().equals("*请选择")) {
            RxToast.warning("请选择任务性质");
            return;
        }

        if (!TextUtils.isEmpty(taskName) && !TextUtils.isEmpty(members)
                && !TextUtils.isEmpty(missionDetail) && !TextUtils.isEmpty(description)
                && !"选择".equals(beginTime) && !"选择".equals(endTime)) {
            mBtOk.setEnabled(false);
            mSubRxDialogLoading.show();

            HashMap<String, Object> stringObjectHashMap = new HashMap<>();
            stringObjectHashMap.put("rwmc", taskName);
            stringObjectHashMap.put("fid", "0");
            stringObjectHashMap.put("rwms", description);
            stringObjectHashMap.put("fbrid", OkingContract.CURRENTUSER.getUserid());
            stringObjectHashMap.put("sjq", beginTime);
            stringObjectHashMap.put("sjz", endTime);
            stringObjectHashMap.put("jsrid", OkingContract.CURRENTUSER.getUserid());
            stringObjectHashMap.put("rwlx", mTasknature);
            stringObjectHashMap.put("sprid", mApproverId);
            stringObjectHashMap.put("zt", "3");
            stringObjectHashMap.put("jjcd", "1");
            stringObjectHashMap.put("deptid", OkingContract.CURRENTUSER.getDept_id());
            stringObjectHashMap.put("rwqyms", missionDetail);
            stringObjectHashMap.put("rwly", mSource);
            stringObjectHashMap.put("jsr", OkingContract.CURRENTUSER.getUserName());
            stringObjectHashMap.put("jsdw", OkingContract.CURRENTUSER.getDeptname());
            stringObjectHashMap.put("fbr", OkingContract.CURRENTUSER.getUserName());
            stringObjectHashMap.put("fbdw", OkingContract.CURRENTUSER.getDeptname());
            stringObjectHashMap.put("spr", mApprover);
            stringObjectHashMap.put("rwcd", "1");
            stringObjectHashMap.put("typeoftask", mTasktype);
            stringObjectHashMap.put("yxry", mMembersid.substring(1, mMembersid.length()));
            BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                    .addEmergencyRelease(stringObjectHashMap)
                    .compose(RxSchedulersHelper.<ResponseBody>io_main())
                    .subscribe(new Consumer<ResponseBody>() {
                        @Override
                        public void accept(ResponseBody responseBody) throws Exception {
                            String result = responseBody.string();
                            mSubRxDialogLoading.cancel();
                            try {
                                JSONObject jsonObject = new JSONObject(result);
                                int code = jsonObject.getInt("code");
                                if (code == 400) {
                                    final String taskid = jsonObject.getString("taskid");
                                    Schedulers.io().createWorker().schedule(new Runnable() {
                                        @Override
                                        public void run() {
                                            GreenMissionTask greenMissionTask = new GreenMissionTask();
                                            //返回个id
                                            greenMissionTask.setTaskid(taskid);
                                            greenMissionTask.setStatus("3");
                                            greenMissionTask.setTask_name(taskName);
                                            greenMissionTask.setJjcd("1");
                                            greenMissionTask.setTask_content(description);
                                            greenMissionTask.setRwqyms(missionDetail);
                                            greenMissionTask.setBegin_time(mBeginMillseconds);
                                            greenMissionTask.setEnd_time(mEndMillseconds);
                                            greenMissionTask.setUserid(OkingContract.CURRENTUSER.getUserid());
                                            greenMissionTask.setTypeoftask(mTasktype);
                                            greenMissionTask.setRwly(mSource);
                                            greenMissionTask.setExamine_status(-1);
                                            greenMissionTask.setTypename(mSpTasknature.getText().toString());
                                            greenMissionTask.setApproved_person_name(mApprover);
                                            greenMissionTask.setApproved_person(mApproverId);
                                            greenMissionTask.setPublisher_name(OkingContract.CURRENTUSER.getUserName());
                                            greenMissionTask.setFbdw(OkingContract.CURRENTUSER.getDeptname());
                                            greenMissionTask.setTask_area(missionDetail);
                                            if (mLatLngListOV != null) {
                                                greenMissionTask.setDrawLaLoType(mLatLngListOV.getType());

                                                greenMissionTask.setMcoordinateJson(gson.toJson(mLatLngListOV.getLatLngs()));
                                            }
                                            long insert = GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao().insert(greenMissionTask);

                                            GreenMember greenMember = new GreenMember();
                                            greenMember.setGreenMemberId(insert);
                                            greenMember.setUsername(OkingContract.CURRENTUSER.getUserName());
                                            greenMember.setUserid(OkingContract.CURRENTUSER.getUserid());
                                            greenMember.setPost("负责人");
                                            greenMember.setAccount(OkingContract.CURRENTUSER.getAcount());
                                            GreenDAOManager.getInstence().getDaoSession().getGreenMemberDao().insert(greenMember);

                                            for (GreenMember checkName : mCheckName) {
                                                checkName.setPost("组员");
                                                checkName.setGreenMemberId(insert);
                                            GreenDAOManager.getInstence().getDaoSession().getGreenMemberDao().insert(checkName);
                                            }
                                            Intent intent = new Intent(BaseApplication.getApplictaion(), MissionActivity.class);
                                            intent.putExtra("id", insert);
                                            PendingIntent pendingIntent = PendingIntent.getActivity(BaseApplication.getApplictaion(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
                                            OkingNotificationManager.getInstence().showTaskNotification(greenMissionTask, pendingIntent);
                                            EmergencyTaskOV emergencyTaskOV = new EmergencyTaskOV();
                                            emergencyTaskOV.setType(0);
                                            emergencyTaskOV.setGreenMissionTask(greenMissionTask);
                                            EventBus.getDefault().post(emergencyTaskOV);

                                        }
                                    });
                                    if (mainHandler == null) {

                                        mainHandler = new Handler();
                                    }
                                    mainHandler.postDelayed(new Runnable() {
                                        @Override
                                        public void run() {
                                            finish();

                                        }
                                    }, 100);
                                    RxToast.success(BaseApplication.getApplictaion(), "紧急任务发布成功", Toast.LENGTH_LONG).show();

                                } else {
                                    RxToast.error(BaseApplication.getApplictaion(), "服务器系统内部出错了", Toast.LENGTH_LONG).show();

                                }
                            } catch (JSONException e) {
                                e.printStackTrace();
                                RxToast.error(BaseApplication.getApplictaion(), "服务器系统内部出错了", Toast.LENGTH_LONG).show();

                            }
                            mBtOk.setEnabled(true);

                        }
                    }, new Consumer<Throwable>() {
                        @Override
                        public void accept(Throwable throwable) throws Exception {
                            mBtOk.setEnabled(true);
                            mSubRxDialogLoading.cancel();
                            RxToast.error(BaseApplication.getApplictaion(), "紧急任务发布失败" + throwable.getMessage(), Toast.LENGTH_SHORT).show();

                        }
                    });

        } else {
            RxToast.warning(BaseApplication.getApplictaion(), "提交内容不能有空", Toast.LENGTH_LONG).show();
        }

    }

    @Override
    public void onDateSet(TimePickerDialog timePickerView, long millseconds) {
        String tag = timePickerView.getTag();
        if ("beginTime".equals(tag)) {
            mBeginMillseconds = millseconds;
            mBtSelectBegintime.setText(getDateToString(millseconds));
        } else {
            mEndMillseconds = millseconds;
            mBtSelectEndtime.setText(getDateToString(millseconds));
        }

    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void handleEvent(LatLngListOV latLngListOV) {
        this.mLatLngListOV = latLngListOV;
        mMcoordinateJson = gson.toJson(latLngListOV.getLatLngs());
        Log.i("Oking", latLngListOV.getLatLngs().size() + "" + latLngListOV.getLatLngs().toString());
    }

    private String getDateToString(long millseconds) {
        Date d = new Date(millseconds);
        return sf.format(d);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.zhang.baselib.BaseApplication;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class BinnerContentActivity extends BaseActivity {

    @BindView(R.id.tv_title)
    TextView mTvTitle;
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.rl_web)
    RelativeLayout mRlWeb;
    private Unbinder mBind;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_binner_content);
        mBind = ButterKnife.bind(this);
        initData();
        setListener();
    }

    private void setListener() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    private void initData() {
        Intent intent = getIntent();
        final String title = intent.getStringExtra("title");
        String toContent = intent.getStringExtra("toContent");
        mTvTitle.setText(title);

        WebView webView = new WebView(BaseApplication.getApplictaion());
        webView.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
        WebSettings settings = webView.getSettings();
        settings.setSupportZoom(true);
        settings.setUseWideViewPort(false);
        settings.setMediaPlaybackRequiresUserGesture(true);
        settings.setUseWideViewPort(true);
        settings.setDefaultFontSize(16);
        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
        settings.setLoadWithOverviewMode(true);
        settings.setJavaScriptEnabled(true);
        webView.loadUrl(toContent);
        webView.setWebViewClient(new WebViewClient());
        mRlWeb.addView(webView);

    }



    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mRlWeb.removeAllViews();
        mBind.unbind();
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.support.annotation.Nullable;
import android.text.Html;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenCase;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;


/**
 * Created by zhao on 2016/9/12.
 */
public class CaseListAdapter extends BaseQuickAdapter<GreenCase, BaseViewHolder> {

    private DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");

    public CaseListAdapter(int layoutResId, @Nullable List<GreenCase> data) {
        super(layoutResId, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, GreenCase item) {

        helper.setText(R.id.tv_caseid, Html.fromHtml("<font color=\"#98CF60\">案件编号：</font>"+item.getAJID()));
        helper.setText(R.id.tv_casename, Html.fromHtml("<font color=\"#98CF60\">案件名称：</font>"+item.getAJMC()));
        helper.setText(R.id.tv_casetime, Html.fromHtml("<font color=\"#98CF60\">受理时间：</font>"+dateFormat.format(item.getSLRQ())));


        switch (item.getSLXX_ZT()) {
            case "SL":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>受理"));
                break;
            case "CBBDCQZ":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>承办并调查取证"));
                break;
            case "ZB":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>转办"));
                break;
            case "LA":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>立案"));
                break;
            case "AJSC":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>案件审查"));
                break;
            case "BYCF":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>不予处罚"));
                break;
            case "WSZL":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>完善资料"));
                break;
            case "YS":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>移送"));
                break;
            case "CFGZHTZ":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>处罚告知或听证"));
                break;
            case "TZ":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>听证"));
                break;
            case "FH":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>复核"));
                break;
            case "CFJD":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>处罚决定"));
                break;
            case "ZX":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>执行"));
                break;
            case "JABGD":
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>结案并归档"));
                break;
            default:
                helper.setText(R.id.tv_casestate, Html.fromHtml("<font color=\"#98CF60\">状态：</font>未知"));
                break;
        }


    }


}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.SourceArrayOV;

import java.util.List;

/**
 * Created by Administrator on 2018/5/25/025.
 */

public class SourceArrayRecyAdapter extends BaseQuickAdapter<SourceArrayOV, BaseViewHolder> {
    public SourceArrayRecyAdapter(int layoutResId, @Nullable List<SourceArrayOV> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SourceArrayOV item) {
        helper.setText(R.id.tv_sub, item.getSource());
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.ProblemBean;

import java.util.List;


/**
 * Created by Administrator on 2017/11/14.
 */

public class AskAdapter extends BaseQuickAdapter<ProblemBean, BaseViewHolder> {

    public AskAdapter(int layoutResId, @Nullable List<ProblemBean> data) {
        super(layoutResId, data);
        //        micImages = new Drawable[] { MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_01),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_02),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_03),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_04),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_05),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_06),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_07),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_08),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_09),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_10),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_11),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_12),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_13),
//                MyApp.getApplictaion().getResources().getDrawable(com.hyphenate.easeui.R.drawable.ease_record_animate_14), };
//
//        voiceRecorder = new EaseVoiceRecorder(micImageHandler);

    }
    //    private PowerManager.WakeLock wakeLock;
//    private EaseVoiceRecorder voiceRecorder;
//    private Drawable[] micImages;
//    private ImageView mMic_image;
//    private Handler micImageHandler = new Handler() {
//        @Override
//        public void handleMessage(android.os.Message msg) {
//            // change image
//            mMic_image.setImageDrawable(micImages[msg.what]);
//        }
//    };





    @Override
    protected void convert(BaseViewHolder helper, ProblemBean item) {
        helper.setText(R.id.tv_ask_content,"问：" + item.getAsk());
        helper.setText(R.id.et_answer_content,"");
    }


//    @Override
//    public View getView( int position, View contentView, ViewGroup viewGroup) {
//        ViewHolder viewHolder;
//        if (contentView == null) {
//            viewHolder = new ViewHolder();
//            contentView = View.inflate(BaseApplication.getApplictaion(), R.layout.survey_ask_item, null);
//            viewHolder.tv_ask_content = contentView.findViewById(R.id.tv_ask_content);
//            viewHolder.et_answer_content = contentView.findViewById(R.id.et_answer_content);
//            contentView.setTag(viewHolder);
//        }
//
//        viewHolder = (ViewHolder) contentView.getTag();
//        viewHolder.et_answer_content.setText("");
////        ImageView iv_record = contentView.findViewById(R.id.iv_record);
//        final ProblemBean problemBean = problemContent.get(position);
//        viewHolder.tv_ask_content.setText("问：" + problemBean.getAsk());
////        iv_record.setOnClickListener(new View.OnClickListener() {
////            @Override
////            public void onClick(View view) {
////                AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
////                View inflate = View.inflate(mActivity, R.layout.voice_recorder_dialog, null);
////                mMic_image = inflate.findViewById(R.id.mic_image);
////                builder.setView(inflate);
////                builder.setCancelable(false);
////                builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
////                    @Override
////                    public void onClick(DialogInterface dialogInterface, int i) {
////                        stopRecoding();
////                        dialogInterface.dismiss();
////                    }
////                });
////                builder.setPositiveButton("停止", new DialogInterface.OnClickListener() {
////                    @Override
////                    public void onClick(DialogInterface dialogInterface, int i) {
////
////                        try {
////                            int length = stopRecoding();
////                            if (length > 0) {
////                                System.out.println(getVoiceFilePath() + "<<<<<<<<<<<<<<<");
////
////                            } else if (length == EMError.FILE_INVALID) {
////                                RxToast.error(MyApp.getApplictaion(), "录音失败", Toast.LENGTH_SHORT).show();
////                            } else {
////                                RxToast.warning(MyApp.getApplictaion(), "录音时间太短", Toast.LENGTH_SHORT).show();
////                            }
////                        } catch (Exception e) {
////                            e.printStackTrace();
////                            RxToast.error(MyApp.getApplictaion(), "录音失败", Toast.LENGTH_SHORT).show();
////                        }
////
////
////                        dialogInterface.dismiss();
////                    }
////                });
////
////                AlertDialog alertDialog = builder.create();
////                alertDialog.show();
////                WindowManager.LayoutParams params =
////                        alertDialog.getWindow().getAttributes();
////                params.width = 450;
////                params.height = 400;
////                alertDialog.getWindow().setAttributes(params);
////                startRecording();
////            }
////        });
//
//        return contentView;
//    }


//    private int stopRecoding() {
////        if (wakeLock.isHeld()){
////
////            wakeLock.release();
////        }
//        return voiceRecorder.stopRecoding();
//    }


//    private void startRecording() {
//        if (!EaseCommonUtils.isSdcardExist()) {
//            RxToast.error(BaseApplication.getApplictaion(), "请插上sd卡", Toast.LENGTH_SHORT).show();
//            return;
//        }
//        try {
////            wakeLock.acquire();
//            voiceRecorder.startRecording(BaseApplication.getApplictaion());
//        } catch (Exception e) {
//            e.printStackTrace();
////            if (wakeLock.isHeld()){
////
////                wakeLock.release();
////            }
//            if (voiceRecorder != null) {
//
//                voiceRecorder.discardRecording();
//            }
//            RxToast.error(BaseApplication.getApplictaion(), "录音失败,请重试!", Toast.LENGTH_SHORT).show();
//            return;
//        }
//    }


//    public String getVoiceFilePath() {
//        return voiceRecorder.getVoiceFilePath();
//    }

}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;


import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zhang.baselib.ui.views.RxDialogLoading;
import com.zhang.baselib.ui.views.RxDialogSure;
import com.zhang.baselib.ui.views.RxDialogSureCancel;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.DocumentaryEvidenceListRecyAdapter;
import com.zhang.okinglawenforcementphone.beans.GreenCase;
import com.zhang.okinglawenforcementphone.beans.GreenEvidence;
import com.zhang.okinglawenforcementphone.beans.GreenEvidenceMedia;
import com.zhang.okinglawenforcementphone.beans.GreenEvidenceSZOV;
import com.zhang.okinglawenforcementphone.beans.GreenMedia;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadEvidenceContract;
import com.zhang.okinglawenforcementphone.mvp.presenter.UploadEvidencePresenter;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 书证列表
 * A simple {@link Fragment} subclass.
 */
public class DocumentaryEvidenceListFragment extends Fragment {

    private GreenCase mycase;

    private RecyclerView ryMain;
    private ArrayList<GreenEvidence> evidences = new ArrayList<>();


    private SimpleDateFormat mSimpleDateFormat;
    private DocumentaryEvidenceListRecyAdapter mDocumentaryEvidenceListRecyAdapter;
    private RxDialogLoading mRxDialogLoading;
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";

    private String mParam2;
    private RxDialogSureCancel mRxDialogSureCancel;
    private View mInflate;
    private List<GreenEvidenceMedia> mPicGreenMedias = new ArrayList<>();
    private UploadEvidencePresenter mUploadEvidencePresenter;
    private DocumentaryEvidenceFragment mDocumentaryEvidenceFragment;

    public DocumentaryEvidenceListFragment() {
        // Required empty public constructor
    }

    public static DocumentaryEvidenceListFragment newInstance(String param2) {
        DocumentaryEvidenceListFragment fragment = new DocumentaryEvidenceListFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");

        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_documentary_evidence_list, container, false);
        }
        EventBus.getDefault().register(this);
        initView(mInflate);
        return mInflate;
    }


    @Subscribe(threadMode = ThreadMode.MAIN)
    public void handleEvent1(GreenEvidenceSZOV event) {
        Log.i("Oking", event.toString());
        if (event.getType() == 2) {            //添加征据
            evidences.add(event.getGreenEvidence());
            mDocumentaryEvidenceListRecyAdapter.setNewData(evidences);
        } else {
            loadEvidence();
        }

    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        EventBus.getDefault().unregister(this);
    }

    public void initView(View rootView) {
        ryMain = rootView.findViewById(R.id.ry_main);
        ryMain.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
        if (mDocumentaryEvidenceListRecyAdapter == null) {
            mDocumentaryEvidenceListRecyAdapter = new DocumentaryEvidenceListRecyAdapter(R.layout.list_item_documentaryevidence, null);
            ryMain.setAdapter(mDocumentaryEvidenceListRecyAdapter);

        }
        loadEvidence();
        mDocumentaryEvidenceListRecyAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
            @Override
            public void onItemChildClick(final BaseQuickAdapter adapter, View view, final int position) {
                final List<GreenEvidence> datas = adapter.getData();
                final GreenEvidence greenEvidence = datas.get(position);
                switch (view.getId()) {
                    case R.id.upload_button:            //上传
                        Log.i("Oking", "点击的：position:" + position + "ID:" + greenEvidence.getId() + "###" + greenEvidence.toString());
                        if (mRxDialogLoading == null) {

                            mRxDialogLoading = new RxDialogLoading(getActivity(), false, new DialogInterface.OnCancelListener() {
                                @Override
                                public void onCancel(DialogInterface dialogInterface) {
                                    dialogInterface.cancel();
                                }
                            });
                            mRxDialogLoading.setLoadingText("上传数据中...");
                        }
                        mRxDialogLoading.show();

                        saveEvidence(position, greenEvidence);

                        break;
                    case R.id.delete_button:            //删除
                        if (mRxDialogSureCancel == null) {

                            mRxDialogSureCancel = new RxDialogSureCancel(getActivity());
                            mRxDialogSureCancel.setTitle("提示");
                            mRxDialogSureCancel.setContent("是否删除证据？");
                        }
                        mRxDialogSureCancel.getTvSure().setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceDao().delete(greenEvidence);
                                mDocumentaryEvidenceListRecyAdapter.remove(position);
                                mRxDialogSureCancel.cancel();
                            }
                        });
                        mRxDialogSureCancel.getTvCancel().setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                mRxDialogSureCancel.cancel();
                            }
                        });
                        mRxDialogSureCancel.show();
                        break;
                    case R.id.edit_button:              //查看编辑
                        if (((Button) view).getText().equals("查看")) {
                            FragmentTransaction ft = getFragmentManager().beginTransaction();

                            mDocumentaryEvidenceFragment = DocumentaryEvidenceFragment.newInstance(0);
                            mDocumentaryEvidenceFragment.setGreenCase(mycase, evidences.get(position));
                            ft.add(R.id.rl_sub_content, mDocumentaryEvidenceFragment, "documentaryEvidenceFragment").commit();

                        } else {
                            FragmentTransaction ft = getFragmentManager().beginTransaction();
                            mDocumentaryEvidenceFragment = DocumentaryEvidenceFragment.newInstance(1);
                            mDocumentaryEvidenceFragment.setGreenCase(mycase, evidences.get(position));
                            ft.add(R.id.rl_sub_content, mDocumentaryEvidenceFragment, "documentaryEvidenceFragment").commit();


                        }

                        break;
                    default:
                        break;
                }
            }
        });


    }


    /**
     * 上传数据
     *
     * @param position
     * @param evidence
     */
    private void saveEvidence(final int position, final GreenEvidence evidence) {

        Map<String, Object> fields = new HashMap<>();
        if (evidence.getZJID() != null) {

            fields.put("zjid", evidence.getZJID());
        }

        if (evidence.getAJID() != null) {
            fields.put("ajid", evidence.getAJID());
        }
        if (evidence.getZJLX() != null) {
            fields.put("zjlx", evidence.getZJLX());
        }
        if (evidence.getZJMC() != null) {
            fields.put("zjmc", evidence.getZJMC());
        }
        if (evidence.getZJLY() != null) {
            fields.put("zjly", evidence.getZJLY());
        }
        if (evidence.getZJNR() != null) {
            fields.put("zjnr", evidence.getZJNR());
        }
        if (evidence.getSL() != null) {
            fields.put("sl", evidence.getSL());
        }


        if (((Long) evidence.getCJSJ()) != null) {
            fields.put("cjsj", mSimpleDateFormat.format(evidence.getCJSJ()));
        }
        if (evidence.getCJR() != null) {
            fields.put("cjr", evidence.getCJR());
        }
        if (evidence.getCJDD() != null) {
            fields.put("cjdd", evidence.getCJDD());
        }
        if (evidence.getJZR() != null) {
            fields.put("jzr", evidence.getJZR());
        }
        if (evidence.getDW() != null) {
            fields.put("dw", evidence.getDW());
        }
        if (evidence.getBZ() != null) {
            fields.put("bz", evidence.getBZ());
        }
        if (OkingContract.CURRENTUSER != null) {
            fields.put("scr", OkingContract.CURRENTUSER.getUserName());
        }
        fields.put("scsj", mSimpleDateFormat.format(System.currentTimeMillis()));

        if (evidence.getZT() != null) {
            fields.put("zt", evidence.getZT());
        }
        if (evidence.getWSID() != null) {
            fields.put("wsid", evidence.getWSID());
        }
        if (evidence.getLXMC() != null) {
            fields.put("lxmc", evidence.getLXMC());
        }
        if (evidence.getZJLYMC() != null) {
            fields.put("zjlymc", evidence.getZJLYMC());
        }
        if (evidence.getYS() != null) {
            fields.put("ys", evidence.getYS());
        }


        List<GreenEvidenceMedia> greenMedias = evidence.getGreenMedia();

        for (GreenEvidenceMedia greenMedia : greenMedias) {
            if (greenMedia.getType() == 1) {
                mPicGreenMedias.add(greenMedia);
            }

        }


        if (mUploadEvidencePresenter == null) {
            mUploadEvidencePresenter = new UploadEvidencePresenter(new UploadEvidenceContract.View() {
                @Override
                public void uploadEvidenceSucc(String result) {
                    mRxDialogLoading.cancel();
                    checkChangeState(position, evidence);
                }

                @Override
                public void uploadEvidenceFail(Throwable ex) {
                    mRxDialogLoading.cancel();
                }
            });
        }
        mUploadEvidencePresenter.uploadEvidence(fields, evidence, mPicGreenMedias);


    }


    public void loadEvidence() {
        evidences.clear();
        if (mycase != null) {
            mycase.resetGreenEvidence();
            for (int i = 0; i < mycase.getGreenEvidence().size(); i++) {
                if ("SZ".equals(mycase.getGreenEvidence().get(i).getZJLX())) {
                    evidences.add(mycase.getGreenEvidence().get(i));
                }
            }
            mDocumentaryEvidenceListRecyAdapter.setNewData(evidences);
        }
    }


    private void checkChangeState(final int position, final GreenEvidence evidence) {

        evidence.setIsUpload(true);
        GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceDao().update(evidence);


        GreenDAOManager.getInstence().getDaoSession().getGreenCaseDao().update(mycase);
        mRxDialogLoading.cancel();

        getActivity().finish();

    }

    public void setGreenCase(GreenCase greenCase) {
        this.mycase = greenCase;
    }
}
<file_sep>package com.zhang.baselib.http.interceptor;

import android.util.Log;

import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.utils.NetUtil;

import java.io.IOException;

import okhttp3.CacheControl;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;


/**
 * Created by Administrator on 2018/3/6.
 * 缓存拦截器
 */

public class CacheControlInterceptor implements Interceptor {
    //短缓存1分钟
    public static final int CACHE_AGE_SHORT = 60;
    //长缓存有效期为1天
    public static final int CACHE_STALE_LONG = 60 * 60 * 24;
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request();
        if (!NetUtil.isConnected(BaseApplication.getApplictaion())) {
            //没网时只使用缓存
            //自定义请求头，可以在响应头对请求头的header进行拦截，配置不同的缓存策略
            request = request.newBuilder()
                    .header("head-request", request.toString())
                    .cacheControl(CacheControl.FORCE_CACHE)
                    .build();
        }
        Response response = chain.proceed(request);
        if (!NetUtil.isConnected(BaseApplication.getApplictaion())) {
            //有网的时候读接口上的@Headers里的配置，你可以在这里进行统一的设置
            Log.e("Interceptor", "response: " + response.toString());
            //添加头信息，配置Cache-Control
            //removeHeader("Pragma") 使缓存生效
            return response.newBuilder()
                    .header("Cache-Control", "public, max-age=" + CACHE_AGE_SHORT)
                    .removeHeader("Pragma")
                    .build();
        } else {
            Log.e("Interceptor", "net not connect");
            return response.newBuilder()
                    .header("Cache-Control", "public,only-if-cached, max-stale=" + CACHE_STALE_LONG)
                    .removeHeader("Pragma")
                    .build();
        }
    }

}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Switch;

import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLog;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class TaskPatrolFragment extends Fragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.sw_summary)
    Switch mSwSummary;
    @BindView(R.id.summary_editText)
    EditText mSummaryEditText;
    Unbinder unbinder;

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    private View mInflate;
    private GreenMissionLog mGreenMissionLog;
    private GreenMissionTask mGreenMissionTask;
    private boolean mSummarySwisopen = false;
    public TaskPatrolFragment() {
        // Required empty public constructor
    }

    public static TaskPatrolFragment newInstance(String param1, String param2) {
        TaskPatrolFragment fragment = new TaskPatrolFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_task_patrol, container, false);

        }
        unbinder = ButterKnife.bind(this, mInflate);
        initData();
        setListerner();
        return mInflate;
    }

    private void setListerner() {
        mSwSummary.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
                mSummarySwisopen = isChecked;
                if (isChecked) {
                    mSummaryEditText.setEnabled(false);
                    mSummaryEditText.setText("");
                } else {
                    mSummaryEditText.setEnabled(true);
                }
            }
        });
        if (mGreenMissionTask.getStatus().equals("5")) {
            mSwSummary.setEnabled(false);
            mSummaryEditText.setFocusable(false);
        } else if (mGreenMissionTask.getStatus().equals("9")) {
            mSwSummary.setEnabled(true);
        }
    }

    private void initData() {
        mSummaryEditText.setText(mGreenMissionLog.getPatrol());
    }

    public void setMission(GreenMissionTask mission) {
        mGreenMissionTask = mission;
    }

    public void setGreenMissionLog(GreenMissionLog greenMissionLog) {
        mGreenMissionLog = greenMissionLog;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    public void savePatrol() {
        mGreenMissionLog.setSummarySwisopen(mSummarySwisopen);
        mGreenMissionLog.setPatrol(mSummaryEditText.getText().toString().trim());
        GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao().update(mGreenMissionLog);
    }
}
<file_sep>package com.zhang.baselib;

import android.app.Application;



/**
 * Created by Administrator on 2018/3/14.
 */

public class BaseApplication extends Application{
    private static  BaseApplication  baseApplication;
    @Override
    public void onCreate() {
        super.onCreate();
        baseApplication = this;

    }

    public static Application getApplictaion() {
        return baseApplication;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.presenter;

import com.zhang.okinglawenforcementphone.mvp.contract.TaskBackContract;
import com.zhang.okinglawenforcementphone.mvp.model.TaskBackModel;

import java.util.Map;

import retrofit2.http.FieldMap;

/**
 * Created by Administrator on 2018/6/7/007.
 */

public class TaskBackPresenter implements TaskBackContract.Presenter {
    private TaskBackContract.Model mModel;
    private TaskBackContract.View mView;

    public TaskBackPresenter(TaskBackContract.View view) {
        mView = view;
        mModel = new TaskBackModel(this);
    }

    @Override
    public void taskBack(Map<String, Object> params) {
        mModel.taskBack(params);
    }

    @Override
    public void taskBackSucc(String result) {
        mView.taskBackSucc(result);
    }

    @Override
    public void taskBackFail(Throwable ex) {
        mView.taskBackFail(ex);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.design.widget.TextInputEditText;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;

import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.DefaultContants;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTaskDao;
import com.zhang.okinglawenforcementphone.beans.NewsTaskOV;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.beans.UpdateGreenMissionTaskOV;
import com.zhang.okinglawenforcementphone.mvp.contract.UpdateMissionStateContract;
import com.zhang.okinglawenforcementphone.mvp.presenter.UpdateMissionStatePresenter;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONException;
import org.json.JSONObject;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class MissionActivity extends BaseActivity {


    private DateFormat mDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    @BindView(R.id.toolbar)
    Toolbar mToolbar;

    @BindView(R.id.list_item_missionTitle)
    TextInputEditText tv_taskname;

    @BindView(R.id.list_item_missionDate)
    TextInputEditText tv_entime;

    @BindView(R.id.list_item_missionState)
    TextInputEditText tv_state;

    @BindView(R.id.publisher_tv)
    TextInputEditText tv_sued_people;

    @BindView(R.id.approved_person_tv)
    TextInputEditText tv_approver_people;

    @BindView(R.id.begin_time_tv)
    TextInputEditText tv_statime;

    @BindView(R.id.mission_type_tv)
    TextInputEditText tv_type;

    @BindView(R.id.list_item_missionMember)
    TextInputEditText tv_members;

    @BindView(R.id.list_item_missionDetail)
    TextInputEditText tv_patrol_area;


    @BindView(R.id.list_item_missionRecord)
    Button list_item_missionRecord;

    private GreenMissionTask mGreenMissionTask;
    private Unbinder mBind;
    private int mPosition;
    private UpdateMissionStatePresenter mUpdateMissionStatePresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mission);
        mBind = ButterKnife.bind(this);
        EventBus.getDefault().register(this);
        initView();
        initData();
    }

    private void initView() {

        Intent intent = getIntent();
        mPosition = intent.getIntExtra("position", -1);

        long id = intent.getLongExtra("id", -1L);
        if (id != -1L) {
            mGreenMissionTask = GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao().queryBuilder().where(GreenMissionTaskDao.Properties.Id.eq(id)).unique();
        }

        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        String groupName = mGreenMissionTask.getTask_name();
        String endTime = mDateFormat.format(mGreenMissionTask.getEnd_time());
        tv_taskname.setText(groupName);
        tv_entime.setText(endTime);
        switch (mGreenMissionTask.getStatus()) {
            case "0":

            case "1":

            case "2":
                list_item_missionRecord.setText("NONE");
                list_item_missionRecord.setEnabled(false);
                tv_state.setText("未安排人员");
                tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain8));

                break;
            case "3":
                list_item_missionRecord.setEnabled(true);
                list_item_missionRecord.setText("开始任务");
                tv_state.setText("已安排，待执行");
                tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain7));

                break;
            case "4":
                list_item_missionRecord.setEnabled(true);
                list_item_missionRecord.setText("任务日志");
                tv_state.setText("巡查中");
                tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain5));

                break;
            case "100":
                list_item_missionRecord.setEnabled(true);
                list_item_missionRecord.setText("任务日志");
                tv_state.setText("巡查结束");
                tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.law_enforcement_bt_enable));

                break;
            case "5":
                list_item_missionRecord.setEnabled(true);
                list_item_missionRecord.setText("任务日志");
                tv_state.setText("已上报");
                tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.task_other_tx));

                break;
            case "9":
                list_item_missionRecord.setEnabled(true);
                list_item_missionRecord.setText("任务日志");
                tv_state.setText("退回修改");
                tv_state.setTextColor(Color.GRAY);

                break;
            default:
                break;

        }


        tv_sued_people.setText(mGreenMissionTask.getPublisher_name());
        tv_approver_people.setText(mGreenMissionTask.getApproved_person_name());
        tv_statime.setText(mDateFormat.format(mGreenMissionTask.getBegin_time()));
        tv_type.setText(mGreenMissionTask.getTypename());

        String memberStr = "";
        //清除dao缓存
        mGreenMissionTask.resetMembers();
        if (mGreenMissionTask.getMembers() != null) {
            for (int j = 0; j < mGreenMissionTask.getMembers().size(); j++) {
                memberStr += mGreenMissionTask.getMembers().get(j).getUsername() + ",";
            }
        }
        if (!"".equals(memberStr)) {
            memberStr = memberStr.substring(0, memberStr.length() - 1);
        }

        tv_members.setText(memberStr);

        if (mGreenMissionTask.getRwqyms() != null) {
            tv_patrol_area.setText(mGreenMissionTask.getRwqyms());
        }

    }
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void handleEvent1(UpdateGreenMissionTaskOV event) {

        switch (event.getMissionTask().getStatus()) {
            case "0":

            case "1":

            case "2":

                list_item_missionRecord.setText("NONE");
                list_item_missionRecord.setEnabled(false);
                tv_state.setText("未安排人员");
                tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain8));

                break;
            case "3":
                list_item_missionRecord.setEnabled(true);
                list_item_missionRecord.setText("开始任务");
                tv_state.setText("已安排，待执行");
                tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain7));

                break;
            case "4":
                list_item_missionRecord.setEnabled(true);
                list_item_missionRecord.setText("任务日志");
                tv_state.setText("巡查中");
                tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain5));

                break;
            case "100":
                list_item_missionRecord.setEnabled(true);
                list_item_missionRecord.setText("任务日志");
                tv_state.setText("巡查结束");
                tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.law_enforcement_bt_enable));

                break;
            case "5":
                list_item_missionRecord.setEnabled(true);
                list_item_missionRecord.setText("任务日志");
                tv_state.setText("已上报");
                tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.task_other_tx));

                break;
            case "9":
                list_item_missionRecord.setEnabled(true);
                list_item_missionRecord.setText("任务日志");
                tv_state.setText("退回修改");
                tv_state.setTextColor(Color.GRAY);

                break;
            default:
                break;
        }

    }

    private void initData() {


    }

    @OnClick(R.id.list_item_missionRecord)
    public void onClick(View view) {
        if ("开始任务".equals(list_item_missionRecord.getText().toString())) {


            if (mGreenMissionTask.getBegin_time() > System.currentTimeMillis()) {
                RxToast.warning("未到达任务开始时间，不能开始任务！");
                return;
            }

            Calendar c = Calendar.getInstance();
            c.setTime(new Date(mGreenMissionTask.getEnd_time()));
            if (c.getTime().getTime() < System.currentTimeMillis()) {
                RxToast.warning("超出任务的预计结束时间，不能开始任务！");
                return;
            }

            if (DefaultContants.ISHTTPLOGIN) {
                if (mUpdateMissionStatePresenter ==null){
                    mUpdateMissionStatePresenter = new UpdateMissionStatePresenter(new UpdateMissionStateContract.View() {
                        @Override
                        public void updateMissionStateSucc(String result) {
                            try {
                                JSONObject object = new JSONObject(result);
                                int code = object.getInt("code");
                                if (code == 0) {
                                    mGreenMissionTask.setExecute_start_time(System.currentTimeMillis());
                                    mGreenMissionTask.setStatus("4");
                                    GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao().update(mGreenMissionTask);
                                    list_item_missionRecord.setText("任务日志");
                                    tv_state.setText("巡查中");
                                    tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain5));
                                    if (mPosition != -1) {
                                        UpdateGreenMissionTaskOV updateGreenMissionTaskOV = new UpdateGreenMissionTaskOV();
                                        updateGreenMissionTaskOV.setType(200);
                                        updateGreenMissionTaskOV.setPosition(mPosition);
                                        updateGreenMissionTaskOV.setMissionTask(mGreenMissionTask);
                                        EventBus.getDefault().post(updateGreenMissionTaskOV);
                                    }

                                } else {
                                    RxToast.error(object.getString("msg"));
                                }
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }

                        }

                        @Override
                        public void updateMissionStateFail(Throwable ex) {
                            mGreenMissionTask.setExecute_start_time(System.currentTimeMillis());
                            mGreenMissionTask.setStatus("4");
                            GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao().update(mGreenMissionTask);
                            list_item_missionRecord.setText("任务日志");
                            tv_state.setText("巡查中");
                            tv_state.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain5));

                        }
                    });

                }
                mUpdateMissionStatePresenter.updateMissionState(mGreenMissionTask.getTaskid(), OkingContract.SDF.format(System.currentTimeMillis())
                        , "", 4);

                EventBus.getDefault().post(new NewsTaskOV(0,null,mGreenMissionTask));
            } else {

                mGreenMissionTask.setExecute_start_time(System.currentTimeMillis());
                mGreenMissionTask.setStatus("4");
                GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao().update(mGreenMissionTask);

            }

        } else if ("任务日志".equals(list_item_missionRecord.getText().toString())) {
            Intent intent = new Intent(MissionActivity.this, MissionRecorActivity.class);
            intent.putExtra("position", mPosition);
            intent.putExtra("taskId", mGreenMissionTask.getTaskid());
            startActivity(intent);

        }


    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBind.unbind();
        EventBus.getDefault().unregister(this);
    }


}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.app.Activity;
import android.net.Uri;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.baselib.GlideApp;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenMedia;

import java.util.List;


/**
 * Created by zhao on 2016/10/9.
 */

public class PicSimpleAdapter extends BaseQuickAdapter<GreenMedia, BaseViewHolder> {

    private Activity activity;
    private boolean canAdd;
    private String typeName;

    public PicSimpleAdapter(int layoutResId, List<GreenMedia> data, Activity recorActivity, boolean canAdd, String typeName) {
        super(layoutResId, data);
        this.activity = recorActivity;
        this.canAdd = canAdd;
        this.typeName = typeName;
    }

    @Override
    protected void convert(BaseViewHolder helper, final GreenMedia item) {
        ImageView sdv = helper.getView(R.id.sdv);
        String path = item.getPath();
        final Uri uri = Uri.parse(path);
        GlideApp.with(activity)
                .load(uri)
                .placeholder(R.mipmap.ic_launcher_logo)
                .error(R.drawable.loadfail)
                .into(sdv);
        helper.addOnClickListener(R.id.sdv);

        if (canAdd) {
            helper.addOnLongClickListener(R.id.sdv);
        }
        String picName = uri.getPath();

        String s = picName.substring(picName.lastIndexOf("/") + 1, picName.length());
        helper.setText(R.id.tv, s.split("_")[0] + typeName);

    }


}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

import com.amap.api.maps.model.LatLng;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/4/18.
 */

public class OkingContract {
    public static SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public static GreenUser CURRENTUSER = null;
    public static String[] LOCATIONRESULT = new String[8];
    public static final String UPDATE_GPS_STATE_UI = "oking.updategpsstate";
    public static List<String> MARQUEEVIEWINFO = new ArrayList<>();

    static {
        MARQUEEVIEWINFO.add("");
        MARQUEEVIEWINFO.add("");
        MARQUEEVIEWINFO.add("");

    }


    public static final int PICTYPE = 1;            //图片
    public static final int RECORDSCREENTYPE = 2;   //视频
    public static final int STARTADNEDD = 0;     //起点终点

    public static final LatLng PAD_1 = new LatLng(22.545173, 113.360352);
    public static final LatLng PAD_2 = new LatLng(22.5225, 113.384385);
    public static final LatLng PAD_3 = new LatLng(22.481822, 113.403293);
    public static final LatLng PAD_4 = new LatLng(22.45648, 113.411084);
    public static final LatLng PAD_5 = new LatLng(23.146249, 113.333418);
    public static final LatLng PAD_6 = new LatLng(23.145603, 113.334106);
    public static final LatLng PAD_7 = new LatLng(23.145509, 113.333462);
    public static final LatLng PAD_8 = new LatLng(23.146984, 113.332738);
    public static final LatLng PAD_9 = new LatLng(23.146436, 113.334202);


    public static final LatLng MOVECENTER = new LatLng(23.216240864201108, 112.80308326186321);
    public static final LatLng STARTLATLNG = new LatLng(23.234459161444516, 112.8114729970563);
    public static final LatLng ENDLATLNG = new LatLng(23.216927695817933, 112.80293250504201);
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.os.Build;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.baselib.utils.DeviceUtil;
import com.zhang.baselib.utils.NetUtil;
import com.zhang.baselib.utils.RegUtil;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.SendEmailManager;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;
import com.zhy.view.flowlayout.TagFlowLayout;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * 意见反馈
 */
public class FeedbackActivity extends BaseActivity {

    @BindView(R.id.tv_title)
    TextView mTvTitle;
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.type_flow_layout)
    TagFlowLayout mTypeFlowLayout;
    @BindView(R.id.et_contet)
    EditText mEtContet;
    @BindView(R.id.et_phone)
    EditText mEtPhone;
    @BindView(R.id.bt_submit)
    TextView mBtSubmit;
    private Unbinder mBind;
    private ArrayList<String> mPartList;
    private String mAdviceType = "无";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_feedback);
        mBind = ButterKnife.bind(this);
        initData();
        setListener();

    }

    private void setListener() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }

    private void initData() {
        mPartList = new ArrayList<>();
        mPartList.add("bug");
        mPartList.add("产品建议");
        mPartList.add("吐槽");
        mPartList.add("其他");
        TagAdapter<String> tagAdapter = new TagAdapter<String>(mPartList) {
            @Override
            public View getView(FlowLayout parent, int position, String parts) {
                View inflate = View.inflate(BaseApplication.getApplictaion(), R.layout.feedback_tag_item, null);
                TextView tv_tag = inflate.findViewById(R.id.tv_tag);
                tv_tag.setText(parts);
                return inflate;
            }
        };
        mTypeFlowLayout.setAdapter(tagAdapter);

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBind.unbind();

    }

    @OnClick(R.id.bt_submit)
    public void onViewClicked(View view) {
        String advice = mEtContet.getText().toString().trim();
        String addr = mEtPhone.getText().toString().trim();

        if (!TextUtils.isEmpty(advice) && NetUtil.isConnected(BaseApplication.getApplictaion())) {
            if (!TextUtils.isEmpty(addr)) {
                if (RegUtil.isEmail(addr) || RegUtil.isMobileSimple(addr)) {

                } else {
                    RxToast.warning("请输入正确的联系方式");
                    return;
                }

            }

            mBtSubmit.setEnabled(false);
            Set<Integer> selectedList = mTypeFlowLayout.getSelectedList();
            Iterator<Integer> it = selectedList.iterator();
            while (it.hasNext()) {
                Integer next = it.next();
                mAdviceType = mPartList.get(next);
            }
            final String content = "用户名：" + OkingContract.CURRENTUSER.getUserName() + "\n"
                    + "设备厂商：" + Build.MANUFACTURER + "\n"
                    + "设备型号：" + Build.MODEL + "\n"
                    + "系统版本：" + Build.VERSION.RELEASE + "\n"
                    + "程序版本：" + DeviceUtil.getAppVersionName(BaseApplication.getApplictaion()) + "\n"
                    + "意见类型：" + mAdviceType + "\n"
                    + "意见内容：" + advice + "\n"
                    + "联系方式：" + addr;
            Schedulers.io().createWorker().schedule(new Runnable() {
                @Override
                public void run() {
                    boolean succ = SendEmailManager.send("<EMAIL>", "水政执法意见反馈", content);
                    if (succ) {
                        AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                            @Override
                            public void run() {
                                RxToast.success("您的反馈我们已经收到~~");
                                mBtSubmit.setEnabled(true);
                            }
                        });
                    }
                }
            });

        }

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.app.PendingIntent;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcel;
import android.support.design.widget.TextInputEditText;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.google.gson.Gson;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.ui.views.RxDialogLoading;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.OkingJPushManager;
import com.zhang.okinglawenforcementphone.OkingNotificationManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTaskDao;
import com.zhang.okinglawenforcementphone.beans.InspectTaskBean;
import com.zhang.okinglawenforcementphone.beans.JPushMessageBean;
import com.zhang.okinglawenforcementphone.beans.NewsTaskOV;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.beans.UpdateGreenMissionTaskOV;
import com.zhang.okinglawenforcementphone.mvp.contract.JPushMessageContract;
import com.zhang.okinglawenforcementphone.mvp.contract.TaskBackContract;
import com.zhang.okinglawenforcementphone.mvp.contract.TaskReviewContract;
import com.zhang.okinglawenforcementphone.mvp.presenter.TaskBackPresenter;
import com.zhang.okinglawenforcementphone.mvp.presenter.TaskReviewPresenter;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;

import org.greenrobot.eventbus.EventBus;
import org.json.JSONException;
import org.json.JSONObject;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * 审核
 */
public class AuditActivity extends BaseActivity {
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.list_item_missionTitle)
    TextInputEditText mListItemMissionTitle;
    @BindView(R.id.list_item_missionState)
    TextInputEditText mListItemMissionState;
    @BindView(R.id.publisher_tv)
    TextInputEditText mPublisherTv;
    @BindView(R.id.approved_person_tv)
    TextInputEditText mApprovedPersonTv;
    @BindView(R.id.begin_time_tv)
    TextInputEditText mBeginTimeTv;
    @BindView(R.id.list_endDate)
    TextInputEditText mEtEndTime;
    @BindView(R.id.mission_type_tv)
    TextInputEditText mMissionTypeTv;
    @BindView(R.id.list_item_missionDetail)
    TextInputEditText tvPatrolAarea;
    @BindView(R.id.ed_approval_opinions)
    TextInputEditText mEdApprovalOpinions;
    @BindView(R.id.bt_ok)
    Button mBtOk;
    @BindView(R.id.bt_modify)
    Button mBtModify;
    private Unbinder mBind;
    private DateFormat mDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    private TaskReviewPresenter mTaskReviewPresenter;
    private GreenMissionTask mUnique;
    private RxDialogLoading mRxDialogLoading;
    private int mPosition;
    private TaskBackPresenter mTaskBackPresenter;
    private Handler mainHandler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_audit);
        mBind = ButterKnife.bind(this);
        initData();
        setListener();
    }

    private void setListener() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    private void initData() {
        Intent intent = getIntent();
        mPosition = intent.getIntExtra("position", -1);
        long id = intent.getLongExtra("id", -1L);
        if (id != -1L) {
            mUnique = GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao()
                    .queryBuilder()
                    .where(GreenMissionTaskDao.Properties.Id.eq(id)).unique();
            mListItemMissionTitle.setText(mUnique.getTask_name());

            switch (mUnique.getStatus()) {
                case "0":

                case "1":
                    mListItemMissionState.setText("待审核");
                    mListItemMissionState.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain8));
                    break;
                case "2":
                    mListItemMissionState.setText("未安排人员");
                    mListItemMissionState.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain8));
                    break;
                case "3":
                    mListItemMissionState.setText("已安排，待执行");
                    mListItemMissionState.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain7));
                    break;
                case "4":
                    mListItemMissionState.setText("巡查中");
                    mListItemMissionState.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain5));
                    break;
                case "100":
                    mListItemMissionState.setText("巡查结束");
                    mListItemMissionState.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain6));
                    break;
                case "5":
                    mListItemMissionState.setText("已上报");
                    mListItemMissionState.setTextColor(BaseApplication.getApplictaion().getResources().getColor(R.color.colorMain4));
                    break;
                case "9":
                    mListItemMissionState.setText("退回修改");
                    mListItemMissionState.setTextColor(Color.GRAY);
                    break;
                default:
                    break;

            }
            mPublisherTv.setText(mUnique.getPublisher_name());
            mApprovedPersonTv.setText(mUnique.getApproved_person_name());
            mBeginTimeTv.setText(mDateFormat.format(mUnique.getBegin_time()));
            mEtEndTime.setText(mDateFormat.format(mUnique.getEnd_time()));
            mMissionTypeTv.setText(mUnique.getTypename());
            tvPatrolAarea.setText(mUnique.getRwqyms());
            if (mUnique.getStatus().equals("7")) {
                mEdApprovalOpinions.setText(mUnique.getSpyj());
                mEdApprovalOpinions.setEnabled(false);
                mBtOk.setText("重新发布");
                mBtModify.setVisibility(View.GONE);
            } else {
                if (mUnique.getApproved_person().equals(OkingContract.CURRENTUSER.getUserid())) {
                    //审批人是自己

                } else {
                    mBtOk.setEnabled(false);
                    mEdApprovalOpinions.setEnabled(false);
                    mBtOk.setText("等候" + mUnique.getApproved_person_name() + "审批");
                    mBtModify.setVisibility(View.GONE);
                }
            }

        }

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBind.unbind();
    }

    @OnClick({R.id.bt_ok, R.id.bt_modify})
    public void onViewClicked(View view) {
        final String approvalOpinions = mEdApprovalOpinions.getText().toString().trim();
        switch (view.getId()) {

            case R.id.bt_ok:
                if (mBtOk.getText().toString().trim().equals("重新发布")) {
                    Intent intent = new Intent(AuditActivity.this, PatrolsToReleaseActivity.class);
                    InspectTaskBean fromParcel = InspectTaskBean.CREATOR.createFromParcel(Parcel.obtain());
                    fromParcel.setAPPROVED_PERSON(mUnique.getApproved_person());
                    fromParcel.setBEGIN_TIME(mUnique.getBegin_time());
                    fromParcel.setCREATE_TIME(mUnique.getCreate_time());
                    fromParcel.setDELIVERY_TIME(mUnique.getDelivery_time());
                    fromParcel.setDEPT_ID(OkingContract.CURRENTUSER.getDept_id());
                    fromParcel.setEND_TIME(mUnique.getEnd_time());
                    fromParcel.setFBDW(mUnique.getFbdw());
                    fromParcel.setFBR(mUnique.getFbr());
                    fromParcel.setFBRID(OkingContract.CURRENTUSER.getUserid());
                    String taskid = mUnique.getTaskid();

                    fromParcel.setID(taskid);
                    if ("0".equals(mUnique.getJjcd())) {

                        fromParcel.setJJCD("特急");
                    } else if ("1".equals(mUnique.getJjcd())) {
                        fromParcel.setJJCD("紧急");
                    } else if ("2".equals(mUnique.getJjcd())) {
                        fromParcel.setJJCD("一般");
                    }

                    fromParcel.setJSDW(mUnique.getJsdw());
                    fromParcel.setJSR(mUnique.getJsr());
                    fromParcel.setPUBLISHER(mUnique.getPublisher());
                    fromParcel.setRECEIVER(mUnique.getReceiver());

                    if ("0".equals(mUnique.getTypeoftask())) {

                        fromParcel.setRWLX("日常执法");
                    } else if ("1".equals(mUnique.getTask_type())) {
                        fromParcel.setRWLX("联合执法");
                    } else if ("2".equals(mUnique.getTask_type())) {
                        fromParcel.setRWLX("专项执法");
                    } else if ("3".equals(mUnique.getTask_type())) {
                        fromParcel.setRWLX("目标核查");
                    }

                    if ("0".equals(mUnique.getRwly())) {

                        fromParcel.setRWLY("上级交办");
                    } else if ("1".equals(mUnique.getRwly())) {
                        fromParcel.setRWLY("部门移送");
                    } else if ("2".equals(mUnique.getRwly())) {
                        fromParcel.setRWLY("系统报警");
                    } else if ("3".equals(mUnique.getRwly())) {
                        fromParcel.setRWLY("日常巡查");
                    } else if ("4".equals(mUnique.getRwly())) {
                        fromParcel.setRWLY("媒体披露");
                    } else if ("5".equals(mUnique.getRwly())) {
                        fromParcel.setRWLY("群众举报");
                    }

                    fromParcel.setRWMC(mUnique.getTask_name());
                    fromParcel.setRWMS(mUnique.getTask_content());
                    fromParcel.setRWQYMS(mUnique.getRwqyms());
                    fromParcel.setSPR(mUnique.getApproved_person_name());
                    fromParcel.setSPRID(mUnique.getApproved_person());
                    if ("0".equals(mUnique.getStatus())) {
                        fromParcel.setSTATUS("未发布");
                    } else if ("1".equals(mUnique.getStatus())) {
                        fromParcel.setSTATUS("已发布待审核");
                    } else if ("2".equals(mUnique.getStatus())) {
                        fromParcel.setSTATUS("审核通过");
                    } else if ("3".equals(mUnique.getStatus())) {
                        fromParcel.setSTATUS("接收并已分配队员");
                    } else if ("4".equals(mUnique.getStatus())) {
                        fromParcel.setSTATUS("任务开始");
                    } else if ("5".equals(mUnique.getStatus())) {
                        fromParcel.setSTATUS("任务完成");
                    } else if ("7".equals(mUnique.getStatus())) {
                        fromParcel.setSTATUS("退回修改");
                    }


                    if ("0".equals(mUnique.getTypeoftask())) {
                        fromParcel.setTYPEOFTASK("河道管理");
                    } else if ("1".equals(mUnique.getTypeoftask())) {
                        fromParcel.setTYPEOFTASK("河道采砂");
                    } else if ("2".equals(mUnique.getTypeoftask())) {
                        fromParcel.setTYPEOFTASK("水资源管理");
                    } else if ("3".equals(mUnique.getTypeoftask())) {
                        fromParcel.setTYPEOFTASK("水土保持管理");
                    } else if ("4".equals(mUnique.getTypeoftask())) {
                        fromParcel.setTYPEOFTASK("水利工程管理");
                    }

                    fromParcel.setTASK_NAME(mUnique.getTask_name());

                    intent.putExtra("inspectTaskBean", fromParcel);
                    intent.putExtra("position", mPosition);
                    intent.putExtra("id", mUnique.getId());
                    startActivity(intent);
                    finish();
                } else {
                    if (!TextUtils.isEmpty(approvalOpinions)) {
                        if (mTaskReviewPresenter == null) {
                            mTaskReviewPresenter = new TaskReviewPresenter(new TaskReviewContract.View() {
                                @Override
                                public void taskReviewSucc(final String result) {
                                    Log.i("Oking", "成功:" + result);
                                    mRxDialogLoading.cancel();
                                    try {
                                        JSONObject jsonObject = new JSONObject(result);
                                        String status = jsonObject.getString("status");
                                        String msg = jsonObject.getString("msg");

                                        if (status.equals("1")) {

                                            //发送一个远程通知
                                            JPushMessageBean jPushMessageBean = new JPushMessageBean();
                                            JPushMessageBean.AudienceBean audienceBean = new JPushMessageBean.AudienceBean();
                                            ArrayList<String> alias = new ArrayList<>();
                                            alias.add(mUnique.getReceiver());
                                            mUnique.setStatus("2");
                                            audienceBean.setAlias(alias);
                                            jPushMessageBean.setAudience(audienceBean);
                                            JPushMessageBean.NotificationBean notificationBean = new JPushMessageBean.NotificationBean();
                                            notificationBean.setAlert("新消息："+mUnique.getTask_name());
                                            JPushMessageBean.NotificationBean.AndroidBean androidBean = new JPushMessageBean.NotificationBean.AndroidBean();
                                            JPushMessageBean.NotificationBean.AndroidBean.ExtrasBean extrasBean = new JPushMessageBean.NotificationBean.AndroidBean.ExtrasBean();
                                            extrasBean.setOpenType("1");
                                            extrasBean.setTaskid(mUnique.getTaskid());
                                            androidBean.setExtras(extrasBean);
                                            notificationBean.setAndroid(androidBean);
                                            ArrayList<String> platforms = new ArrayList<>();
                                            platforms.add("android");
                                            jPushMessageBean.setPlatform(platforms);
                                            jPushMessageBean.setNotification(notificationBean);
                                            OkingJPushManager.getInstence().pushMessage(jPushMessageBean, new JPushMessageContract.View() {
                                                @Override
                                                public void pushMessageSucc(String result) {


                                                }

                                                @Override
                                                public void pushMessageFail(Throwable ex) {
                                                    RxToast.error(ex.getMessage());
                                                }
                                            });



                                            UpdateGreenMissionTaskOV updateGreenMissionTaskOV = new UpdateGreenMissionTaskOV();
                                            updateGreenMissionTaskOV.setType(100);
                                            updateGreenMissionTaskOV.setMissionTask(mUnique);
                                            updateGreenMissionTaskOV.setPosition(mPosition);
                                            EventBus.getDefault().post(updateGreenMissionTaskOV);
                                            GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao().delete(mUnique);
                                            if (mainHandler == null) {

                                                mainHandler = new Handler();
                                            }
                                            mainHandler.postDelayed(new Runnable() {
                                                @Override
                                                public void run() {
                                                    finish();

                                                }
                                            }, 100);
                                            RxToast.success(msg);
                                        } else {
                                            RxToast.error(msg);
                                        }
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }


                                }

                                @Override
                                public void taskReviewFail(Throwable ex) {
                                    Log.i("Oking", "失败:" + ex.toString());
                                    mRxDialogLoading.cancel();
                                }
                            });
                        }
                        Map<String, Object> params = new HashMap<>();
                        params.put("lx", "updatesp");
//                    params.put("coordinateJson", "");
                        params.put("rwmc", mUnique.getTask_name());
                        params.put("fbr", mUnique.getPublisher_name());
                        params.put("fbdw", mUnique.getFbdw());
                        params.put("jsr", mUnique.getJsr());
                        params.put("jsdw", mUnique.getJsdw());
                        params.put("rwms", mUnique.getTask_content());
                        params.put("rwqyms", mUnique.getTask_area());
                        params.put("sjq", mBeginTimeTv.getText().toString().trim());
                        params.put("sjz", mEtEndTime.getText().toString().trim());
                        params.put("rwlx", mUnique.getTask_type());
                        params.put("jjcd", mUnique.getJjcd());
                        params.put("zt", "2");
                        params.put("rwly", mUnique.getRwly());
                        params.put("fbrid", mUnique.getPublisher());
                        params.put("jsrid", mUnique.getReceiver());
                        params.put("sprid", mUnique.getApproved_person());
                        params.put("spr", mUnique.getApproved_person_name());
                        params.put("deptid", OkingContract.CURRENTUSER.getDept_id());
                        params.put("id", mUnique.getTaskid());
                        params.put("spyj", approvalOpinions);
                        params.put("typeoftask", mUnique.getTypeoftask());
                        if (mRxDialogLoading == null) {
                            mRxDialogLoading = new RxDialogLoading(AuditActivity.this, false, new DialogInterface.OnCancelListener() {
                                @Override
                                public void onCancel(DialogInterface dialog) {
                                    dialog.cancel();
                                }
                            });
                            mRxDialogLoading.setLoadingText("正在提交数据请稍候...");
                        }

                        mRxDialogLoading.show();
                        mTaskReviewPresenter.taskReview(params);
                    } else {
                        RxToast.warning("请填入审批意见");
                    }
                }


                break;
            case R.id.bt_modify:

                if (!TextUtils.isEmpty(approvalOpinions)) {
                    if (mTaskBackPresenter == null) {
                        mTaskBackPresenter = new TaskBackPresenter(new TaskBackContract.View() {
                            @Override
                            public void taskBackSucc(String result) {
                                mRxDialogLoading.cancel();
                                try {
                                    JSONObject jsonObject = new JSONObject(result);
                                    String status = jsonObject.getString("status");
                                    String msg = jsonObject.getString("msg");

                                    if (status.equals("1")) {

                                        GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao().delete(mUnique);

                                        //发送一个远程通知
                                        JPushMessageBean jPushMessageBean = new JPushMessageBean();
                                        JPushMessageBean.AudienceBean audienceBean = new JPushMessageBean.AudienceBean();
                                        ArrayList<String> alias = new ArrayList<>();
                                        alias.add(mUnique.getPublisher());
                                        mUnique.setStatus("7");
                                        audienceBean.setAlias(alias);
                                        jPushMessageBean.setAudience(audienceBean);
                                        JPushMessageBean.NotificationBean notificationBean = new JPushMessageBean.NotificationBean();
                                        notificationBean.setAlert(mUnique.getTask_name());
                                        JPushMessageBean.NotificationBean.AndroidBean androidBean = new JPushMessageBean.NotificationBean.AndroidBean();
                                        JPushMessageBean.NotificationBean.AndroidBean.ExtrasBean extrasBean = new JPushMessageBean.NotificationBean.AndroidBean.ExtrasBean();
                                        extrasBean.setData(new Gson().toJson(mUnique));
                                        androidBean.setExtras(extrasBean);
                                        notificationBean.setAndroid(androidBean);
                                        ArrayList<String> platforms = new ArrayList<>();
                                        platforms.add("android");
                                        jPushMessageBean.setPlatform(platforms);
                                        jPushMessageBean.setNotification(notificationBean);
                                        OkingJPushManager.getInstence().pushMessage(jPushMessageBean, new JPushMessageContract.View() {
                                            @Override
                                            public void pushMessageSucc(String result) {


                                            }

                                            @Override
                                            public void pushMessageFail(Throwable ex) {
                                                RxToast.error(ex.getMessage());
                                            }
                                        });
                                        if (mainHandler == null) {

                                            mainHandler = new Handler();
                                        }
                                        mainHandler.postDelayed(new Runnable() {
                                            @Override
                                            public void run() {
                                                finish();

                                            }
                                        }, 100);
                                        RxToast.success("退回成功");
                                        if (mPosition != -1) {
                                            UpdateGreenMissionTaskOV updateGreenMissionTaskOV = new UpdateGreenMissionTaskOV();
                                            updateGreenMissionTaskOV.setType(100);
                                            updateGreenMissionTaskOV.setPosition(mPosition);
                                            EventBus.getDefault().post(updateGreenMissionTaskOV);
                                        }
                                        finish();

                                    } else {
                                        RxToast.error("退回失败！");
                                    }
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }

                            }

                            @Override
                            public void taskBackFail(Throwable ex) {
                                mRxDialogLoading.cancel();
                            }
                        });
                    }
                    Map<String, Object> params = new HashMap<>();
                    params.put("lx", "updatesp");
//                    params.put("coordinateJson", "");
                    params.put("rwmc", mUnique.getTask_name());
                    params.put("fbr", mUnique.getPublisher_name());
                    params.put("fbdw", mUnique.getFbdw());
                    params.put("jsr", mUnique.getJsr());
                    params.put("jsdw", mUnique.getJsdw());
                    params.put("rwms", mUnique.getTask_content());
                    params.put("rwqyms", mUnique.getTask_area());
                    params.put("sjq", mBeginTimeTv.getText().toString().trim());
                    params.put("sjz", mEtEndTime.getText().toString().trim());
                    params.put("rwlx", mUnique.getTask_type());
                    params.put("jjcd", mUnique.getJjcd());
                    params.put("zt", "7");
                    params.put("rwly", mUnique.getRwly());
                    params.put("fbrid", mUnique.getPublisher());
                    params.put("jsrid", mUnique.getReceiver());
                    params.put("sprid", mUnique.getApproved_person());
                    params.put("spr", mUnique.getApproved_person_name());
                    params.put("deptid", OkingContract.CURRENTUSER.getDept_id());
                    params.put("id", mUnique.getTaskid());
                    params.put("spyj", approvalOpinions);
                    params.put("typeoftask", mUnique.getTypeoftask());

                    if (mRxDialogLoading == null) {
                        mRxDialogLoading = new RxDialogLoading(AuditActivity.this, false, new DialogInterface.OnCancelListener() {
                            @Override
                            public void onCancel(DialogInterface dialog) {
                                dialog.cancel();
                            }
                        });
                        mRxDialogLoading.setLoadingText("正在提交数据请稍候...");
                    }

                    mRxDialogLoading.show();
                    mTaskBackPresenter.taskBack(params);


                } else {
                    RxToast.warning("请填入审批意见");
                }


                break;
            default:
                break;
        }
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.ui.views.RxDialogSureCancel;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.AllMenuRecyAdapter;
import com.zhang.okinglawenforcementphone.beans.AllMenuItemBean;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;
import com.zhang.okinglawenforcementphone.views.DividerItemDecoration;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class AllActivity extends BaseActivity {

    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.rcy_all)
    RecyclerView rcyAll;
    private Unbinder mBind;
    private AllMenuItemBean mAllMenuItemBean;
    private List<String> mMenusSub;
    private RxDialogSureCancel mRxDialogSureCancel;
    private Intent intent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_all);
        mBind = ButterKnife.bind(this);
        initData();
        setListener();
    }

    private void setListener() {
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    private void initData() {
        rcyAll.setLayoutManager(new LinearLayoutManager(BaseApplication.getApplictaion(), LinearLayoutManager.VERTICAL, false));
        rcyAll.addItemDecoration(new DividerItemDecoration(BaseApplication.getApplictaion(), 0, 20, getResources().getColor(R.color.activity_bg)));

        getMenu();
        AllMenuRecyAdapter allMenuRecyAdapter = new AllMenuRecyAdapter(R.layout.all_menu_item, getMenu(), new AllMenuRecyAdapter.OnItemClickListener() {
            @Override
            public void setOnItemClickListener(BaseQuickAdapter adapter, View view, int groupPosition, int chilPosition) {
                switch (groupPosition) {
                    case 0:                                     //任务管理
                        switch (chilPosition) {
                            case 0:
                                if (mRxDialogSureCancel == null) {

                                    mRxDialogSureCancel = new RxDialogSureCancel(AllActivity.this);
                                }
                                mRxDialogSureCancel.setContent("请选择发布任务类型");
                                mRxDialogSureCancel.getTvSure().setText("一般任务");
                                mRxDialogSureCancel.getTvCancel().setText("紧急任务");
                                mRxDialogSureCancel.getTvCancel().setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view) {
                                        mRxDialogSureCancel.cancel();
                                        Intent intent = new Intent(AllActivity.this, TemporaryEmergencyTaskActivity.class);
                                        startActivity(intent);
                                    }
                                });

                                mRxDialogSureCancel.getTvSure().setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view) {
                                        mRxDialogSureCancel.cancel();
                                        Intent intent = new Intent(AllActivity.this, PatrolsToReleaseActivity.class);
                                        startActivity(intent);
                                    }
                                });
                                mRxDialogSureCancel.show();
                                break;
                            case 1:
                                intent = new Intent(AllActivity.this, TaskMissionProjectActivity.class);
                                intent.putExtra("activity", "ArrangeMissionActivity");
                                startActivity(intent);
                                break;
                            case 2:
                                intent = new Intent(AllActivity.this, TaskMissionProjectActivity.class);
                                intent.putExtra("activity", "TaskExecutionActivity");
                                startActivity(intent);
                                break;
                            case 3:
                                intent = new Intent(AllActivity.this, TaskMissionProjectActivity.class);
                                intent.putExtra("activity", "ReportTaskActivity");
                                startActivity(intent);
                                break;
                            case 4:
                                intent = new Intent(AllActivity.this, TaskMissionProjectActivity.class);
                                intent.putExtra("activity", "CompleteListActivity");
                                startActivity(intent);
                                break;
                            default:
                                break;
                        }
                        break;
                    case 1:                                     //执法管理
                        switch (chilPosition) {
                            case 0:
                                intent = new Intent(AllActivity.this, WrittenRecordActivity.class);
                                startActivity(intent);
                                break;
                            case 1:
                                intent = new Intent(AllActivity.this, FromAllLawEnforcementActivity.class);
                                startActivity(intent);
                                break;
                            case 2:
                                intent = new Intent(AllActivity.this, FromAllPenaltyTheSpotActivity.class);
                                startActivity(intent);
                                break;
                            case 3:
                                intent = new Intent(AllActivity.this, SceneInquestActivity.class);
                                startActivity(intent);
                                break;
                            default:
                                break;
                        }
                        break;
                    case 2:                                     //执法指导
                        switch (chilPosition) {
                            case 0:
                                intent = new Intent(AllActivity.this, FromAllLawsAndRegulationsActivity.class);
                                startActivity(intent);
                                break;
                            case 1:
                                intent = new Intent(AllActivity.this, FromAllLawEnforcementSpecificationActivity.class);
                                startActivity(intent);
                                break;
                            case 2:
                                intent = new Intent(AllActivity.this, PuttedForwardConActivity.class);
                                startActivity(intent);
                                break;
                            default:
                                break;
                        }
                        break;
                    case 3:                                     //统计查询
                        switch (chilPosition) {
                            case 0:
                                intent = new Intent(AllActivity.this, StatisticalActivity.class);
                                startActivity(intent);

                                break;
                            case 1:
                                intent = new Intent(AllActivity.this, MapQueryActivity.class);
                                startActivity(intent);
                                break;
                            case 2:
                                intent = new Intent(AllActivity.this, MapTaskActivity.class);
                                startActivity(intent);
                                break;
                            case 3:
                                intent = new Intent(AllActivity.this, RegionalHistoryEnforcementActivity.class);
                                startActivity(intent);
                                break;
                            case 4:
                                intent = new Intent(AllActivity.this, TaskMissionProjectActivity.class);
                                intent.putExtra("activity", "TrajectoryListActivity");
                                startActivity(intent);
                                break;
                            default:
                                break;
                        }
                        break;
                    case 4:                                     //案件管理
                        switch (chilPosition) {
                            case 0:
                                intent = new Intent(AllActivity.this, FromAllCaseRegistrationActivity.class);
                                startActivity(intent);
                                break;
                            case 1:
                                intent = new Intent(AllActivity.this, FromAllOpenCasesActivity.class);
                                startActivity(intent);
                                break;
                            case 2:
                                intent = new Intent(AllActivity.this, FromAllCaseProcessingListActivity.class);
                                startActivity(intent);
                                break;
                            case 3:
                                intent = new Intent(AllActivity.this, FromAllCaseComplaintActivity.class);
                                startActivity(intent);
                                break;
                            case 4:
                                intent = new Intent(AllActivity.this, FromAllCaseInAdvanceActivity.class);
                                startActivity(intent);
                                break;
                            default:
                                break;
                        }
                        break;
                    default:
                        break;


                }
            }
        });
        allMenuRecyAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
        rcyAll.setAdapter(allMenuRecyAdapter);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBind.unbind();

    }

    public List<AllMenuItemBean> getMenu() {
        List<AllMenuItemBean> allMenuItemBeans = new ArrayList<>();
        mAllMenuItemBean = new AllMenuItemBean();
        mAllMenuItemBean.setTitle("任务管理");
        mMenusSub = new ArrayList<>();
        mMenusSub.add("巡查任务发布");
        mMenusSub.add("巡查任接收安排");
        mMenusSub.add("任务执行");
        mMenusSub.add("任务上报");
        mMenusSub.add("日志(已完成)");
        mAllMenuItemBean.setSubList(mMenusSub);
        allMenuItemBeans.add(mAllMenuItemBean);

        mAllMenuItemBean = new AllMenuItemBean();
        mAllMenuItemBean.setTitle("执法管理");
        mMenusSub = new ArrayList<>();
        mMenusSub.add("调查笔录");
        mMenusSub.add("责令停止违法行为通知");
        mMenusSub.add("水行政当场除非决定书");
        mMenusSub.add("现场勘验");
        mAllMenuItemBean.setSubList(mMenusSub);
        allMenuItemBeans.add(mAllMenuItemBean);

        mAllMenuItemBean = new AllMenuItemBean();
        mAllMenuItemBean.setTitle("执法指导");
        mMenusSub = new ArrayList<>();
        mMenusSub.add("法律法规库");
        mMenusSub.add("执法规范");
        mMenusSub.add("案例库");
        mAllMenuItemBean.setSubList(mMenusSub);
        allMenuItemBeans.add(mAllMenuItemBean);

        mAllMenuItemBean = new AllMenuItemBean();
        mAllMenuItemBean.setTitle("统计查询");
        mMenusSub = new ArrayList<>();
        mMenusSub.add("日志统计");
        mMenusSub.add("地图查询");
        mMenusSub.add("地图任务展示");
        mMenusSub.add("区域执法记录查询");
        mMenusSub.add("轨迹管理");
        mAllMenuItemBean.setSubList(mMenusSub);
        allMenuItemBeans.add(mAllMenuItemBean);

        mAllMenuItemBean = new AllMenuItemBean();
        mAllMenuItemBean.setTitle("案件管理");
        mMenusSub = new ArrayList<>();
        mMenusSub.add("案件登记");
        mMenusSub.add("案件受理");
        mMenusSub.add("案件处理");
        mMenusSub.add("案件转办");
        mMenusSub.add("预立案");
        mAllMenuItemBean.setSubList(mMenusSub);
        allMenuItemBeans.add(mAllMenuItemBean);
        return allMenuItemBeans;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.model;

import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.utils.DeviceUtil;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.contract.AppVersionContract;

import org.json.JSONArray;
import org.json.JSONObject;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;

/**
 * Created by Administrator on 2018/4/18.
 */

public class AppVersionModel implements AppVersionContract.Model {
    private AppVersionContract.Presenter mPresenter;

    public AppVersionModel(AppVersionContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void reqAppVersion() {
        GDWaterService service = BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL);

        service.reqAppVersion("app_version")
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        JSONArray jsonArray = new JSONArray(responseBody.string());
                        for (int i = 0; i < jsonArray.length(); i++) {
                            JSONObject jsonObject = jsonArray.getJSONObject(i);
                            String value = jsonObject.getString("VALUE");
                            String bz = jsonObject.getString("BZ");
                            if (!value.equals(DeviceUtil.getAppVersionName(BaseApplication.getApplictaion()))) {

                                mPresenter.reqSucc(bz);


                            }

                        }
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        mPresenter.reqFail(throwable);
                    }
                });

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.views;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.hardware.Camera;
import android.os.Handler;
import android.view.SurfaceHolder;
import android.widget.Toast;

import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.baselib.utils.PicUtil;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.ShootActivity;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ScheduledThreadPoolExecutor;


@SuppressWarnings("deprecation")
public class MyCamera implements Camera.PictureCallback, Camera.ShutterCallback {
    private Camera mCamera;
    private ScheduledThreadPoolExecutor mTimerShootingExecutor;
    private ArrayList<String> paths = new ArrayList<String>();
    private ShootActivity mShootActivity;
    private Handler mHandler = new Handler();

    public MyCamera(ShootActivity shootActivity) {
        this.mShootActivity = shootActivity;
    }

    public void openCamera() {
        if (null == mCamera) {
            mCamera = Camera.open();
            mCamera.setDisplayOrientation(90);
        }
    }

    public void releaseCamera() {
        if (null != mCamera) {
            if (isTimerShootingStart()) {
                stopTimerShooting();
            }

            mCamera.release();
            mCamera = null;
        }
    }

    public void takePicture() {
        mCamera.takePicture(this, null, this);
    }


    public synchronized void stopTimerShooting() {
        if (null != mTimerShootingExecutor) {
            mTimerShootingExecutor.shutdown();
            mTimerShootingExecutor = null;
        }
    }

    public synchronized boolean isTimerShootingStart() {
        if (null != mTimerShootingExecutor) {
            return true;
        } else {
            return false;
        }
    }

    public void onSurfaceCreated(SurfaceHolder holder) {
        try {
            //surface创建成功能够拿到回调的holder
            //holder中包含有成功创建的Surface
            //从而交给摄像机预览使用
            mCamera.setPreviewDisplay(holder);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
        //surface的尺寸发生变化
        //配置预览参数，如分辨率等
        //这里使用的分辨率简单选取了支持的预览分辨率的第一项
        //网上可以查找对应的优选算法
        Camera.Parameters parameters = mCamera.getParameters();
        List<Camera.Size> sizes = parameters.getSupportedPreviewSizes();
        Camera.Size selected = sizes.get(0);
        parameters.setPreviewSize(selected.width, selected.height);
        parameters.setPictureSize(selected.width, selected.height);

        //给摄像机设置参数，开始预览
        mCamera.setParameters(parameters);
        mCamera.startPreview();
    }

    public void onSurfaceDestroyed(SurfaceHolder holder) {

    }

    @Override
    public void onPictureTaken(byte[] data, Camera camera) {
            Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
            bmp = PicUtil.rotateBitmapByDegree(bmp, 90);
            String filename = UUID.randomUUID().toString();
            String filePathname = "/storage/emulated/0/oking/mission_pic/" + filename+".jpg";
            save(bmp, filePathname, filename);


    }


    private void save(Bitmap bitmap, String filePath, String fileName) {
        File file = new File(filePath);
        if (!file.getParentFile().exists()) {
            file.getParentFile().mkdirs(); // 创建文件夹
        }
        try {
            BufferedOutputStream bos = new BufferedOutputStream(
                    new FileOutputStream(file));
            bitmap.compress(Bitmap.CompressFormat.JPEG, 80, bos); // 向缓冲区之中压缩图片
            bos.flush();
            bos.close();

            paths.add(filePath);

            RxToast.success(BaseApplication.getApplictaion(), "拍照成功", Toast.LENGTH_SHORT).show();
            mHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    mShootActivity.notyEnablestate(true);
                }
            }, 300);

            //重新启动预览
            mCamera.startPreview();

        } catch (Exception e) {

        }
    }

    @Override
    public void onShutter() {
    }

    public ArrayList<String> completePhotos() {

        return paths;
    }

}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.TextView;


import com.zhang.baselib.BaseApplication;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.ChapterDomain;
import com.zhang.okinglawenforcementphone.beans.LawsRegulation;

import java.util.ArrayList;


/**
 * Created by Administrator on 2017/10/30.
 */

public class RegulationsExListViewAdapter extends BaseExpandableListAdapter {
    private ArrayList<LawsRegulation>  lawChapter;

    public RegulationsExListViewAdapter(ArrayList<LawsRegulation>  lawChapter) {
        this.lawChapter = lawChapter;
    }

    public void setDataList(ArrayList dataList) {

    }

    @Override
    public int getGroupCount() {
        return lawChapter.size();
    }

    @Override
    public int getChildrenCount(int i) {
        return lawChapter.get(i).getChapterDirectory().get(i).getSection().size();
    }

    @Override
    public Object getGroup(int i) {
        return null;
    }

    @Override
    public Object getChild(int i, int i1) {
        return null;
    }

    @Override
    public long getGroupId(int i) {
        return 0;
    }

    @Override
    public long getChildId(int i, int i1) {
        return 0;
    }

    @Override
    public boolean hasStableIds() {
        return false;
    }

    @Override
    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
        GroupHold groupHold;
        if (convertView==null){
            groupHold = new GroupHold();
            convertView = View.inflate(BaseApplication.getApplictaion(), R.layout.gegulation_group_item,null);
            groupHold.title = convertView.findViewById(R.id.tv_title);
            groupHold.ivGoToChildLv = convertView.findViewById(R.id.iv_goToChildLV);
            convertView.setTag(groupHold);
        }

        groupHold = (GroupHold) convertView.getTag();
        ChapterDomain chapterDomain = lawChapter.get(groupPosition).getChapterDirectory().get(groupPosition);
        groupHold.title.setText(chapterDomain.getChapterDirectory());
        //取消默认的groupIndicator后根据方法中传入的isExpand判断组是否展开并动态自定义指示器
        if (isExpanded) {   //如果组展开
            groupHold.ivGoToChildLv.setImageResource(R.mipmap.arrow_down);
        } else {
            groupHold.ivGoToChildLv.setImageResource(R.mipmap.arrow_right);
        }
        return convertView;
    }

    @Override
    public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView,
                             ViewGroup parent) {
        ChildHold childHold;
        if (convertView==null){
            childHold = new ChildHold();
            convertView = View.inflate(BaseApplication.getApplictaion(),R.layout.gegylation_child_item,null);
            childHold.itemTitle = convertView.findViewById(R.id.tv_title);
            convertView.setTag(childHold);
        }
        childHold = (ChildHold) convertView.getTag();
        String itemTitle = lawChapter.get(groupPosition).getChapterDirectory().get(groupPosition).getSection().get(childPosition).getItemTitle();
        childHold.itemTitle.setText(itemTitle);
        return convertView;
    }

    @Override
    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return true;
    }

    class GroupHold {
        TextView title;
        ImageView ivGoToChildLv;
    }

    class ChildHold {
        TextView itemTitle;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.views;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.GridView;

/**
 * Created by Administrator on 2018/4/24/024.
 */

public class MyRecycelerView extends RecyclerView{


    public MyRecycelerView(android.content.Context context, android.util.AttributeSet attrs){
        super(context, attrs);
    }
    public MyRecycelerView(android.content.Context context){
        super(context);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        //请求所有父控件及祖宗控件不要拦截事件
        getParent().requestDisallowInterceptTouchEvent(true);
        return super.dispatchTouchEvent(ev);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.presenter;

import com.zhang.okinglawenforcementphone.mvp.contract.AddMemberContract;
import com.zhang.okinglawenforcementphone.mvp.model.AddMemberModel;

/**
 * Created by Administrator on 2018/4/20.
 */

public class AddMemberPresenter implements AddMemberContract.Presenter {
    private AddMemberContract.Model mModel;
    private AddMemberContract.View mView;

    public AddMemberPresenter(AddMemberContract.View view) {
        mView = view;
        mModel = new AddMemberModel(this);
    }

    @Override
    public void addMember(String userid, String mtaskId, String userids) {
        mModel.addMember(userid, mtaskId, userids);
    }

    @Override
    public void addMemberSucc(String result) {
        mView.addMemberSucc(result);
    }

    @Override
    public void addMemberFail(Throwable ex) {
        mView.addMemberFail(ex);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.widget.CompoundButton;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenEquipment;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;


/**
 * Created by Administrator on 2018/4/10.
 */

public class EquipmentRecyAdapter extends BaseMultiItemQuickAdapter<GreenEquipment, BaseViewHolder> {
    private List<GreenEquipment> checkItems = new ArrayList<GreenEquipment>();
    private Map<Integer, Boolean> map = new HashMap<>();// 存放已被选中的CheckBox

    public EquipmentRecyAdapter(List<GreenEquipment> data) {
        super(data);
        addItemType(0, R.layout.equipment_item_head);
        addItemType(1, R.layout.equipment_item_layout);
    }


    @Override
    protected void convert(final BaseViewHolder helper, GreenEquipment item) {
        if (item.getItemType() == 1) {
            helper.setText(R.id.type_textView, item.getMc1());
            helper.setText(R.id.value_textView, item.getValue());

            switch (item.getLy()) {
                case "0":
                    helper.setText(R.id.tv_attribute, "自有");
                    break;
                case "1":
                    helper.setText(R.id.tv_attribute, "租借");
                    break;

                default:
                    break;
            }

            helper.setText(R.id.remarks_textView, item.getRemarks());
            helper.setText(R.id.tv_mc, item.getMc2());
            helper.setOnCheckedChangeListener(R.id.cb, new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                    if (b) {
                        map.put(helper.getLayoutPosition(), true);


                    } else {
                        map.remove(helper.getLayoutPosition());


                    }
                }
            });

            if (map != null && map.containsKey(helper.getLayoutPosition())) {
                helper.setChecked(R.id.cb, true);
            } else {
                helper.setChecked(R.id.cb, false);
            }

        }


    }


    public List<GreenEquipment> getCheckItem() {
        List<GreenEquipment> equipmentArrayList = getData();
        checkItems.clear();
        Iterator<Integer> iter = map.keySet().iterator();

        while (iter.hasNext()) {

            int key = iter.next();

            checkItems.add(equipmentArrayList.get(key));


        }
        return checkItems;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.model;

import android.net.Uri;
import android.util.Log;

import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.okinglawenforcementphone.beans.GreenMember;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLog;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadSignaturePicContract;

import org.json.JSONObject;

import java.io.File;
import java.util.Map;

import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.functions.Predicate;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;

/**
 * Created by Administrator on 2018/4/26/026.
 */

public class UploadSignaturePicModel implements UploadSignaturePicContract.Model {
    private UploadSignaturePicContract.Presenter mPresenter;
    private String memberResult;
    private int uploadSignaturePicCount=0;
    private String mLastPathSegment;

    public UploadSignaturePicModel(UploadSignaturePicContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void uploadSignaturePic(final GreenMissionLog mGreenMissionLog, final GreenMissionTask missionTask, final Map<String, RequestBody> photoParams) {
        BaseHttpFactory
                .getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .getMissionRecordPicPath(mGreenMissionLog.getServer_id(), 1)
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .observeOn(Schedulers.io())
                .concatMap(new Function<ResponseBody, ObservableSource<GreenMember>>() {

                    @Override
                    public Observable<GreenMember> apply(ResponseBody responseBody) throws Exception {
                        memberResult = responseBody.string();
                        uploadSignaturePicCount=0;
                        Log.i("Oking1",memberResult+">>>>服务器返回member>>");
                        Log.i("Oking1","需要签名人员:"+missionTask.getMembers().size()+missionTask.getMembers().toString());
                        return Observable.fromIterable(missionTask.getMembers());
                    }
                })
                .concatMap(new Function<GreenMember, ObservableSource<ResponseBody>>() {
                    @Override
                    public ObservableSource<ResponseBody> apply(GreenMember greenMember) throws Exception {
                        mLastPathSegment = Uri.parse(greenMember.getSignPic()).getLastPathSegment();
                        Log.i("Oking1","遍历签名"+ mLastPathSegment);
                        if (memberResult.contains(mLastPathSegment)) {
                            //存在服务器
                            Log.i("Oking1",mLastPathSegment+"签名在服务器存在》》》》》》》》》"+memberResult);
                            uploadSignaturePicCount++;
                            mPresenter.uploadIsCount(uploadSignaturePicCount);
                        } else {
                            if (greenMember.getSignPic() != null) {
                                photoParams.clear();
                                File file = new File(greenMember.getSignPic());
                                photoParams.put("logId", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), mGreenMissionLog.getServer_id()));
                                photoParams.put("type", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), "1"));
                                photoParams.put("smallImg", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), ""));
                                photoParams.put("user_id", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), greenMember.getUserid()!=null?greenMember.getUserid():"880088"));
                                String fileName = file.getName();
                                photoParams.put("files" + "\"; filename=\"" + fileName, RequestBody.create(MediaType.parse("image/png"), file));

                                return BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                                        .uploadFiles(photoParams);
                            }
                        }
                        return Observable.empty();
                    }
                }).observeOn(AndroidSchedulers.mainThread())
                .retry(5, new Predicate<Throwable>() {
                    @Override
                    public boolean test(Throwable throwable) throws Exception {
                        //最多让被观察者重新发射数据5次，但是这里返回值可以进行处理
                        //返回假就是不让重新发射数据了，调用观察者的onError就终止了。
                        //返回真就是让被观察者重新发射请求
                        Log.i("Oking1","签名图片上传异常，重试");

                        mPresenter.uploadRetry(throwable);
                        return true;
                    }
                })
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        uploadSignaturePicCount++;
                        String result = responseBody.string();
                        JSONObject jsonObject = new JSONObject(result);
                        String path = jsonObject.getString("path");
                        memberResult = memberResult+","+path;
                        mPresenter.uploadSignaturePicSucc(result);

                        Log.i("Oking1","签名上传成功"+result);
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        Log.i("Oking1","签名上传失败"+throwable.toString());
                        mPresenter.uploadSignatureFail(throwable);
                    }
                });

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.CaseListAdapter;
import com.zhang.okinglawenforcementphone.beans.GreenCase;
import com.zhang.okinglawenforcementphone.beans.GreenCaseDao;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.CaseDealActivity;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.CaseManagerActivity;
import com.zhang.okinglawenforcementphone.views.DividerItemDecoration;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import io.reactivex.functions.Consumer;
import okhttp3.ResponseBody;

/**
 * 案件处理列表
 */
public class CaseProcessingListFragment extends Fragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.case_ry)
    RecyclerView mCaseRy;
    @BindView(R.id.layoutSwipeRefresh)
    SwipeRefreshLayout mLayoutSwipeRefresh;
    Unbinder unbinder;
    @BindView(R.id.tv)
    TextView mTv;
    private CaseManagerActivity mActivity;

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    private View mInflate;
    private CaseListAdapter mCaseListAdapter;
    private List<GreenCase> mCaseList = new ArrayList<>();


    public CaseProcessingListFragment() {
        // Required empty public constructor
    }

    public static CaseProcessingListFragment newInstance(String param1, String param2) {
        CaseProcessingListFragment fragment = new CaseProcessingListFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (mInflate == null) {

            mInflate = inflater.inflate(R.layout.fragment_caseprocessing_list, container, false);
        }
        unbinder = ButterKnife.bind(this, mInflate);
        initData();
        setListener();
        return mInflate;
    }

    private void setListener() {
        mLayoutSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                getHttpCaseList();
            }
        });
        mCaseListAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                List<GreenCase> data = adapter.getData();
                Intent intent = new Intent(getActivity(), CaseDealActivity.class);
                intent.putExtra("AJID",data.get(position).getAJID());
                startActivity(intent);
            }
        });
    }

    private void initData() {
        mLayoutSwipeRefresh.setRefreshing(true);
        mLayoutSwipeRefresh.setColorSchemeColors(getResources().getColor(R.color.refresh_color));
        getHttpCaseList();
        mCaseRy.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
        mCaseRy.addItemDecoration(new DividerItemDecoration(BaseApplication.getApplictaion(), 0, 10, BaseApplication.getApplictaion().getResources().getColor(R.color.activity_bg)));

        mCaseListAdapter = new CaseListAdapter(R.layout.list_item_case, null);
        mCaseRy.setAdapter(mCaseListAdapter);
    }

    private void getHttpCaseList() {
        BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .loadCaseList(OkingContract.CURRENTUSER.getUserid())
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody requestBody) throws Exception {
                        String result = requestBody.string();
                        JSONArray jsonArray = new JSONArray(result);
                        mLayoutSwipeRefresh.setRefreshing(false);
                        if (jsonArray.length() > 0) {
                            mCaseList.clear();
                            for (int i = 0; i < jsonArray.length(); i++) {
                                JSONObject jsonObject = jsonArray.getJSONObject(i);
                                String ajid = jsonObject.getString("AJID");
                                GreenCase unique = GreenDAOManager.getInstence().getDaoSession().getGreenCaseDao().queryBuilder().where(GreenCaseDao.Properties.AJID.eq(ajid)).unique();

                                if (unique == null) {
                                    unique = new GreenCase();
                                    unique.setAJID(ajid);
                                    unique.setAFDD(jsonObject.getString("AFDD"));
                                    unique.setAFSJ(jsonObject.optLong("AFSJ"));

                                    unique.setAJLX(jsonObject.getString("AJLX"));
                                    unique.setAJLXID(jsonObject.getString("AJLXID"));
                                    unique.setAJLY(jsonObject.getString("AJLY"));
                                    unique.setAJMC(jsonObject.getString("AJMC"));
                                    unique.setAQJY(jsonObject.getString("AQJY"));
                                    unique.setAY(jsonObject.getString("AY"));
                                    unique.setCBR1(jsonObject.getString("CBR1"));
                                    unique.setCBR2(jsonObject.getString("CBR2"));
                                    unique.setCBRDW1(jsonObject.getString("CBRDW1"));
                                    unique.setCBRDW2(jsonObject.getString("CBRDW2"));
                                    unique.setCBRID1(jsonObject.getString("CBRID1"));
                                    unique.setCBRID2(jsonObject.getString("CBRID2"));
                                    unique.setCFNR(jsonObject.getString("CFNR"));
                                    unique.setCFYJ(jsonObject.getString("CFYJ"));
                                    unique.setDSRQK(jsonObject.getString("DSRQK"));
                                    unique.setFLYJ(jsonObject.getString("FLYJ"));
                                    unique.setJGD(jsonObject.getString("JGD"));
                                    unique.setSLR(jsonObject.getString("SLR"));
                                    unique.setSLRQ(jsonObject.optLong("SLRQ"));
                                    unique.setSLXX_ZT(jsonObject.getString("SLXX_ZT"));
                                    unique.setSQWTR(jsonObject.getString("SQWTR"));
                                    unique.setSSD(jsonObject.getString("SSD"));
                                    unique.setWHJGFSD(jsonObject.getString("WHJGFSD"));
                                    unique.setXWZSD(jsonObject.getString("XWZSD"));
                                    unique.setZFBM(jsonObject.getString("ZFBM"));
                                    unique.setZFZH1(jsonObject.getString("ZFZH1"));
                                    unique.setZFZH2(jsonObject.getString("ZFZH2"));
                                    unique.setZT(jsonObject.getString("ZT"));
                                    GreenDAOManager.getInstence().getDaoSession().getGreenCaseDao().insert(unique);
                                    mCaseList.add(unique);
                                } else {
                                    unique.setAJID(ajid);
                                    unique.setAFDD(jsonObject.getString("AFDD"));
                                    unique.setAFSJ(jsonObject.optLong("AFSJ"));
                                    unique.setAJLX(jsonObject.getString("AJLX"));
                                    unique.setAJLXID(jsonObject.getString("AJLXID"));
                                    unique.setAJLY(jsonObject.getString("AJLY"));
                                    unique.setAJMC(jsonObject.getString("AJMC"));
                                    unique.setAQJY(jsonObject.getString("AQJY"));
                                    unique.setAY(jsonObject.getString("AY"));
                                    unique.setCBR1(jsonObject.getString("CBR1"));
                                    unique.setCBR2(jsonObject.getString("CBR2"));
                                    unique.setCBRDW1(jsonObject.getString("CBRDW1"));
                                    unique.setCBRDW2(jsonObject.getString("CBRDW2"));
                                    unique.setCBRID1(jsonObject.getString("CBRID1"));
                                    unique.setCBRID2(jsonObject.getString("CBRID2"));
                                    unique.setCFNR(jsonObject.getString("CFNR"));
                                    unique.setCFYJ(jsonObject.getString("CFYJ"));
                                    unique.setDSRQK(jsonObject.getString("DSRQK"));
                                    unique.setFLYJ(jsonObject.getString("FLYJ"));
                                    unique.setJGD(jsonObject.getString("JGD"));
                                    unique.setSLR(jsonObject.getString("SLR"));
                                    unique.setSLRQ(jsonObject.optLong("SLRQ"));
                                    unique.setSLXX_ZT(jsonObject.getString("SLXX_ZT"));
                                    unique.setSQWTR(jsonObject.getString("SQWTR"));
                                    unique.setSSD(jsonObject.getString("SSD"));
                                    unique.setWHJGFSD(jsonObject.getString("WHJGFSD"));
                                    unique.setXWZSD(jsonObject.getString("XWZSD"));
                                    unique.setZFBM(jsonObject.getString("ZFBM"));
                                    unique.setZFZH1(jsonObject.getString("ZFZH1"));
                                    unique.setZFZH2(jsonObject.getString("ZFZH2"));
                                    unique.setZT(jsonObject.getString("ZT"));
                                    GreenDAOManager.getInstence().getDaoSession().getGreenCaseDao().update(unique);
                                    mCaseList.add(unique);
                                }

                            }

                            mCaseListAdapter.setNewData(mCaseList);
                        } else {
                            mLayoutSwipeRefresh.setVisibility(View.GONE);
                            mTv.setVisibility(View.VISIBLE);
                        }

                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        mLayoutSwipeRefresh.setRefreshing(false);
                        List<GreenCase> greenCases = GreenDAOManager.getInstence().getDaoSession().getGreenCaseDao().queryBuilder().where(GreenCaseDao.Properties.CBRID1.eq(OkingContract.CURRENTUSER.getUserid())).list();
                        mCaseListAdapter.setNewData(greenCases);

                    }
                });

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        if (context != null) {
            mActivity = (CaseManagerActivity) getActivity();
        }
    }
}
<file_sep>package com.zhang.baselib.utils;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Environment;
import android.os.SystemClock;
import android.util.Log;

import com.zhang.okinglawenforcementphone.SendEmailManager;
import com.zhang.okinglawenforcementphone.beans.OkingContract;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import io.reactivex.schedulers.Schedulers;

/**
 * Created by Administrator on 2018/5/23/023.
 */

public class CrashUtil implements Thread.UncaughtExceptionHandler {

    private volatile static CrashUtil mInstance;

    private Thread.UncaughtExceptionHandler mHandler;
    private boolean                  mInitialized;
    private String                   crashDir;
    private String                   versionName;
    private int                      versionCode;

    private Context context;
    private CrashUtil(Context context) {
        this.context = context;
    }

    /**
     * 获取单例
     * <p>在Application中初始化{@code RxCrashUtils.getInstance().init(this);}</p>
     *
     * @return 单例
     */
    public static CrashUtil getInstance(Context context) {
        if (mInstance == null) {
            synchronized (CrashUtil.class) {
                if (mInstance == null) {
                    mInstance = new CrashUtil(context);
                }
            }
        }
        return mInstance;
    }

    /**
     * 初始化
     *
     * @return {@code true}: 成功<br>{@code false}: 失败
     */
    public boolean init() {
        if (mInitialized) return true;
        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
            crashDir = context.getExternalCacheDir().getPath() + File.separator + "crash" + File.separator;
        } else {
            crashDir = context.getCacheDir().getPath() + File.separator + "crash" + File.separator;
        }
        try {
            PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
            versionName = pi.versionName;
            versionCode = pi.versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
            return false;
        }
        mHandler = Thread.getDefaultUncaughtExceptionHandler();
        Thread.setDefaultUncaughtExceptionHandler(this);
        return mInitialized = true;
    }

    @Override
    public void uncaughtException(Thread thread, final Throwable throwable) {
        String now =  OkingContract.SDF.format(System.currentTimeMillis());
        final String fullPath = crashDir + now + ".txt";
        if (!FileUtil.createOrExistsFile(fullPath)) return;
        Schedulers.io().createWorker().schedule(new Runnable() {
            @Override
            public void run() {
                PrintWriter pw = null;
                try {
                    pw = new PrintWriter(new FileWriter(fullPath, false));
                    pw.write(getCrashHead());
                    throwable.printStackTrace(pw);
                    Throwable cause = throwable.getCause();
                    while (cause != null) {
                        cause.printStackTrace(pw);
                        cause = cause.getCause();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                    FileUtil.closeIO(pw);
                }

            }
        });
        if (mHandler != null) {
            mHandler.uncaughtException(thread, throwable);
        }
    }

    /**
     * 获取崩溃头
     *
     * @return 崩溃头
     */
    private String getCrashHead() {
        return "\n************* Crash Log Head ****************" +
                "\n设备厂商       : " + Build.MANUFACTURER +// 设备厂商
                "\n设备型号       : " + Build.MODEL +// 设备型号
                "\n系统版本       : " + Build.VERSION.RELEASE +// 系统版本
                "\nSDK版本        : " + Build.VERSION.SDK_INT +// SDK版本
                "\n程序版本名称    : " + versionName +
                "\n程序版本号      : " + versionCode +
                "\n************* Crash Log Head ****************\n\n";
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.zhang.okinglawenforcementphone.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class RegulationsDetailFragment extends Fragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.tv_detail)
    TextView tvDetail;
    @BindView(R.id.tv_itemdetail)
    TextView tvItemdetail;
    Unbinder unbinder;

    // TODO: Rename and change types of parameters
    private String articlesContent;
    private String rulesContent;
    private View mInflate;


    public RegulationsDetailFragment() {
        // Required empty public constructor
    }

    public static RegulationsDetailFragment newInstance(String articlesContent, String rulesContent) {
        RegulationsDetailFragment fragment = new RegulationsDetailFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, articlesContent);
        args.putString(ARG_PARAM2, rulesContent);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            articlesContent = getArguments().getString(ARG_PARAM1);
            rulesContent = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_regulations_detail, container, false);

        }
        unbinder = ButterKnife.bind(this, mInflate);
        initData();
        setListener();
        return mInflate;
    }

    private void initData() {
        tvDetail.setText(rulesContent);
        tvItemdetail.setText(articlesContent);
    }

    private void setListener() {

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    public void setRulesContent(String articlesContent, String rulesContent) {
        this.articlesContent = articlesContent;
        this.rulesContent = rulesContent;
        if (tvItemdetail!=null){
            tvDetail.setText(rulesContent);
            tvItemdetail.setText(articlesContent);
        }
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.WrittenItemBean;
import com.zhang.okinglawenforcementphone.beans.WrittenRecordLevel0;

import java.util.List;


/**
 * Created by Administrator on 2018/5/7/007.
 */

public class ExpandableItemCaseRegistAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity, BaseViewHolder> {
    public static final int TYPE_LEVEL_0 = 0;
    public static final int TYPE_LEVEL_1 = 1;
    public static final int TYPE_LEVEL_2 = 2;
    public static final int TYPE_LEVEL_3 = 3;

    public ExpandableItemCaseRegistAdapter(List<MultiItemEntity> data) {
        super(data);
        addItemType(TYPE_LEVEL_0, R.layout.activity_mission_recor_level0);
        addItemType(TYPE_LEVEL_1, R.layout.case_regist_info1);
        addItemType(TYPE_LEVEL_2, R.layout.case_regist_info2);
        addItemType(TYPE_LEVEL_3, R.layout.case_regist_info3);
    }

    @Override
    protected void convert(final BaseViewHolder helper, MultiItemEntity item) {
        switch (helper.getItemViewType()) {
            case TYPE_LEVEL_0:
                final WrittenRecordLevel0 lv0 = (WrittenRecordLevel0) item;
                helper.setText(R.id.title, lv0.subTitle);
                helper.itemView.setOnClickListener(new View.OnClickListener() {


                    @Override
                    public void onClick(View v) {
                        int adapterPosition = helper.getAdapterPosition();
                        List<WrittenItemBean> subItems = lv0.getSubItems();
                        int subItemType = subItems.get(0).getItemType();

                        if (lv0.isExpanded()) {
                            collapse(adapterPosition);


                        } else {
                            expand(adapterPosition);
                        }


                    }

                });

                break;
            case TYPE_LEVEL_1:
                break;
            case TYPE_LEVEL_2:
                break;
            case TYPE_LEVEL_3:
                break;
            default:
                break;
        }
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenCase;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.CaseDealActivity;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.EvidenceManagerActivity;

import java.text.SimpleDateFormat;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class CaseDealFragment extends Fragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.ajid_tv)
    TextView mAjidTv;
    @BindView(R.id.ajlx_tv)
    TextView mAjlxTv;
    @BindView(R.id.ajly_tv)
    TextView mAjlyTv;
    @BindView(R.id.ajmc_tv)
    TextView mAjmcTv;
    @BindView(R.id.slsj_tv)
    TextView mSlsjTv;
    @BindView(R.id.dsr_tv)
    TextView mDsrTv;
    @BindView(R.id.afdd_tv)
    TextView mAfddTv;
    @BindView(R.id.aqjy_tv)
    TextView mAqjyTv;
    @BindView(R.id.ajzt_tv)
    TextView mAjztTv;
    @BindView(R.id.change_btn)
    Button mChangeBtn;
    Unbinder unbinder;
    private GreenCase mUnique;
    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    private View mInflate;
    private SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    private CaseDealActivity mCaseDealActivity;

    public CaseDealFragment() {
        // Required empty public constructor
    }

    public static CaseDealFragment newInstance(String param1, String param2) {
        CaseDealFragment fragment = new CaseDealFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_case_deal, container, false);

        }
        unbinder = ButterKnife.bind(this, mInflate);
        initData();
        return mInflate;
    }

    private void initData() {
        if (mUnique != null) {
            mAjlxTv.setText(mUnique.getAJLX());
            mAjlyTv.setText(mUnique.getAJLY());
            mAjmcTv.setText(mUnique.getAJMC());

            mSlsjTv.setText(mSimpleDateFormat.format(mUnique.getSLRQ()));
            mDsrTv.setText(mUnique.getDSRQK());
            mAfddTv.setText(mUnique.getAFDD());
            mAqjyTv.setText(mUnique.getAQJY());
            mAjidTv.setText(mUnique.getAJID());
            switch (mUnique.getSLXX_ZT()) {
                case "SL":
                    mAjztTv.setText("受理");
                    break;
                case "CBBDCQZ":
                    mAjztTv.setText("承办并调查取证");
                    break;
                case "ZB":
                    mAjztTv.setText("转办");
                    break;
                case "LA":
                    mAjztTv.setText("立案");
                    break;
                case "AJSC":
                    mAjztTv.setText("案件审查");
                    break;
                case "BYCF":
                    mAjztTv.setText("不予处罚");
                    break;
                case "WSZL":
                    mAjztTv.setText("完善资料");
                    break;
                case "YS":
                    mAjztTv.setText("移送");
                    break;
                case "CFGZHTZ":
                    mAjztTv.setText("处罚告知或听证");
                    break;
                case "TZ":
                    mAjztTv.setText("听证");
                    break;
                case "FH":
                    mAjztTv.setText("复核");
                    break;
                case "CFJD":
                    mAjztTv.setText("处罚决定");
                    break;
                case "ZX":
                    mAjztTv.setText("执行");
                    break;
                case "JABGD":
                    mAjztTv.setText("结案并归档");
                    break;
                default:
                    mAjztTv.setText("");
                    break;
            }

        }

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick({R.id.change_btn, R.id.evidence_btn})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.change_btn:
                getActivity().finish();
                break;
            case R.id.evidence_btn:
                String ajid = mCaseDealActivity.getAJID();
                Intent intent = new Intent(mCaseDealActivity, EvidenceManagerActivity.class);
                intent.putExtra("AJID",ajid);
                startActivity(intent);
//                mCaseDealActivity.setToolbarText("证据管理");


//                FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
//                fragmentTransaction.hide(CaseDealFragment.this);
//                if (mCaseEvidenceFragment == null) {
//                    mCaseEvidenceFragment = CaseEvidenceFragment.newInstance(null);
//                    fragmentTransaction.add(R.id.sub_fragment_root, mCaseEvidenceFragment, "caseEvidenceFragment").commit();
//                }else {
//                    fragmentTransaction.show(mCaseEvidenceFragment).commit();
//
//                }
                break;
            default:
                break;
        }

    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mCaseDealActivity = (CaseDealActivity) context;
    }

    public void setGreenCase(GreenCase greenCase) {
        this.mUnique = greenCase;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zhang.baselib.BaseApplication;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.UserRecyAdaper;
import com.zhang.okinglawenforcementphone.beans.UserItemOV;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.CaseManagerActivity;
import com.zhang.okinglawenforcementphone.views.DividerItemDecoration;
import com.zhang.okinglawenforcementphone.views.GridDivider;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class HandlingMenuFragment extends Fragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.recy_law_menu)
    RecyclerView mRecyLawMenu;
    Unbinder unbinder;

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    private View mInflate;
    private Fragment mHandlingMenuFragment;

    private UserItemOV mUserItemOV;
    private UserRecyAdaper mHandingMenuRecyAdaper;
    private CaseManagerActivity mCaseManagerActivity;
    private CaseRegistrationFragment mCaseRegistrationFragment;
    private OpenCasesFragment mOpenCasesFragment;
    private CaseProcessingListFragment mCaseProcessingListFragment;
    private CaseComplaintFragment mCaseComplaintFragment;
    private CaseInAdvanceFragment mCaseInAdvanceFragment;

    public HandlingMenuFragment() {
        // Required empty public constructor
    }

    public static HandlingMenuFragment newInstance(String param1, String param2) {
        HandlingMenuFragment fragment = new HandlingMenuFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_handling_menu, container, false);

        }

        unbinder = ButterKnife.bind(this, mInflate);
        initData();
        setListenner();
        return mInflate;
    }

    private void setListenner() {
        mHandingMenuRecyAdaper.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
                if (!mHandlingMenuFragment.isHidden()) {

                    fragmentTransaction.hide(mHandlingMenuFragment);
                }
                switch (position) {
                    case 0:
                        mCaseManagerActivity.setTitleText("案件登记");
                        if (mOpenCasesFragment != null) {
                            fragmentTransaction.hide(mOpenCasesFragment);
                        }

                        if (mCaseProcessingListFragment != null) {
                            fragmentTransaction.hide(mCaseProcessingListFragment);
                        }

                        if (mCaseComplaintFragment != null) {
                            fragmentTransaction.hide(mCaseComplaintFragment);
                        }

                        if (mCaseInAdvanceFragment != null) {
                            fragmentTransaction.hide(mCaseInAdvanceFragment);
                        }
                        if (mCaseRegistrationFragment == null) {

                            mCaseRegistrationFragment = CaseRegistrationFragment.newInstance(null, null);
                            fragmentTransaction.add(R.id.rl_case_content, mCaseRegistrationFragment, "CaseRegistrationFragment").commit();
                        } else {
                            if (mCaseRegistrationFragment.isAdded()) {
                                fragmentTransaction.show(mCaseRegistrationFragment).commit();
                            }
                        }


                        break;
                    case 1:
                        mCaseManagerActivity.setTitleText("案件受理");
                        if (mCaseRegistrationFragment != null) {
                            fragmentTransaction.hide(mCaseRegistrationFragment);
                        }

                        if (mCaseProcessingListFragment != null) {
                            fragmentTransaction.hide(mCaseProcessingListFragment);
                        }

                        if (mCaseComplaintFragment != null) {
                            fragmentTransaction.hide(mCaseComplaintFragment);
                        }
                        if (mCaseInAdvanceFragment != null) {
                            fragmentTransaction.hide(mCaseInAdvanceFragment);
                        }
                        if (mOpenCasesFragment == null) {

                            mOpenCasesFragment = OpenCasesFragment.newInstance(null, null);
                            fragmentTransaction.add(R.id.rl_case_content, mOpenCasesFragment, "OpenCasesFragment").commit();
                        } else {
                            if (mOpenCasesFragment.isAdded()) {
                                fragmentTransaction.show(mOpenCasesFragment).commit();
                            }
                        }
                        break;
                    case 2:
                        mCaseManagerActivity.setTitleText("案件处理");
                        if (mCaseRegistrationFragment != null) {
                            fragmentTransaction.hide(mCaseRegistrationFragment);
                        }

                        if (mOpenCasesFragment != null) {
                            fragmentTransaction.hide(mOpenCasesFragment);
                        }

                        if (mCaseComplaintFragment != null) {
                            fragmentTransaction.hide(mCaseComplaintFragment);
                        }
                        if (mCaseInAdvanceFragment != null) {
                            fragmentTransaction.hide(mCaseInAdvanceFragment);
                        }

                        if (mCaseProcessingListFragment == null) {

                            mCaseProcessingListFragment = CaseProcessingListFragment.newInstance(null, null);
                            fragmentTransaction.add(R.id.rl_case_content, mCaseProcessingListFragment, "CaseProcessingListFragment").commit();
                        } else {
                            if (mCaseProcessingListFragment.isAdded()) {
                                fragmentTransaction.show(mCaseProcessingListFragment).commit();
                            }
                        }
                        break;
                    case 3:
                        mCaseManagerActivity.setTitleText("案件转办");
                        if (mCaseRegistrationFragment != null) {
                            fragmentTransaction.hide(mCaseRegistrationFragment);
                        }

                        if (mOpenCasesFragment != null) {
                            fragmentTransaction.hide(mOpenCasesFragment);
                        }

                        if (mCaseProcessingListFragment != null) {
                            fragmentTransaction.hide(mCaseProcessingListFragment);
                        }

                        if (mCaseInAdvanceFragment != null) {
                            fragmentTransaction.hide(mCaseInAdvanceFragment);
                        }

                        if (mCaseComplaintFragment == null) {
                            mCaseComplaintFragment = CaseComplaintFragment.newInstance(null, null);
                            fragmentTransaction.add(R.id.rl_case_content, mCaseComplaintFragment, "CaseComplaintFragment").commit();

                        } else {
                            if (mCaseComplaintFragment.isAdded()) {
                                fragmentTransaction.show(mCaseComplaintFragment).commit();
                            }
                        }
                        break;
                    case 4:
                        mCaseManagerActivity.setTitleText("预立案");
                        if (mCaseRegistrationFragment != null) {
                            fragmentTransaction.hide(mCaseRegistrationFragment);
                        }

                        if (mOpenCasesFragment != null) {
                            fragmentTransaction.hide(mOpenCasesFragment);
                        }
                        if (mCaseComplaintFragment != null) {
                            fragmentTransaction.hide(mCaseComplaintFragment);
                        }
                        if (mCaseProcessingListFragment != null) {
                            fragmentTransaction.hide(mCaseProcessingListFragment);
                        }

                        if (mCaseInAdvanceFragment == null) {
                            mCaseInAdvanceFragment = CaseInAdvanceFragment.newInstance(null, null);
                            fragmentTransaction.add(R.id.rl_case_content, mCaseInAdvanceFragment, "CaseInAdvanceFragment").commit();

                        } else {
                            if (mCaseInAdvanceFragment.isAdded()) {
                                fragmentTransaction.show(mCaseInAdvanceFragment).commit();
                            }
                        }
                        break;
                    default:
                        break;
                }
            }
        });

    }

    private void initData() {
        mHandlingMenuFragment = getFragmentManager().findFragmentByTag("HandlingMenuFragment");
        mRecyLawMenu.setLayoutManager(new GridLayoutManager(BaseApplication.getApplictaion(),3));
        mRecyLawMenu.addItemDecoration(new GridDivider(BaseApplication.getApplictaion(),  10, getResources().getColor(R.color.line)));

        List<UserItemOV> userItemOVS = new ArrayList<>();
        mUserItemOV = new UserItemOV();
        mUserItemOV.setTitle("案件登记");
        mUserItemOV.setIcon(R.mipmap.ajdj);
        userItemOVS.add(mUserItemOV);
        mUserItemOV = new UserItemOV();
        mUserItemOV.setTitle("案件受理");
        mUserItemOV.setIcon(R.mipmap.ajsl);
        userItemOVS.add(mUserItemOV);
        mUserItemOV = new UserItemOV();
        mUserItemOV.setTitle("案件处理");
        mUserItemOV.setIcon(R.mipmap.ajcl);
        userItemOVS.add(mUserItemOV);
        mUserItemOV = new UserItemOV();
        mUserItemOV.setTitle("案件转办");
        mUserItemOV.setIcon(R.mipmap.ajzb);
        userItemOVS.add(mUserItemOV);
        mUserItemOV = new UserItemOV();
        mUserItemOV.setTitle("预立案");
        mUserItemOV.setIcon(R.mipmap.yla);
        userItemOVS.add(mUserItemOV);

        mHandingMenuRecyAdaper = new UserRecyAdaper(R.layout.handling_menu_item, userItemOVS);
        mHandingMenuRecyAdaper.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
        mRecyLawMenu.setAdapter(mHandingMenuRecyAdaper);
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mCaseManagerActivity = (CaseManagerActivity) context;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.utils;

import android.app.Dialog;
import android.content.Context;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.zhang.baselib.utils.DensityUtil;
import com.zhang.okinglawenforcementphone.R;

/**
 * Created by Administrator on 2018/4/19.
 */

public class DialogUtil {

    private Dialog bottomDialog;
    private ViewGroup.MarginLayoutParams mParams;

    public void showBottomDialog(Context context, View contentView,float height) {
        if (bottomDialog==null){

            bottomDialog = new Dialog(context, R.style.BottomDialog);
            bottomDialog.setContentView(contentView);
            mParams = (ViewGroup.MarginLayoutParams) contentView.getLayoutParams();
            mParams.width = context.getResources().getDisplayMetrics().widthPixels - DensityUtil.dp2px(context, 16f);
            mParams.bottomMargin = DensityUtil.dp2px(context, 8f);
            contentView.setLayoutParams(mParams);
            bottomDialog.setCanceledOnTouchOutside(true);
            bottomDialog.getWindow().setGravity(Gravity.BOTTOM);
            bottomDialog.getWindow().setWindowAnimations(R.style.BottomDialog_Animation);
        }
        mParams.height = DensityUtil.dp2px(context,height);

        bottomDialog.show();
    }
    public void cancelDialog(){
        bottomDialog.dismiss();
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.zhang.baselib.BaseApplication;
import com.zhang.okinglawenforcementphone.R;


/**
 * Created by Administrator on 2017/10/20.
 */

public class SpinnerArrayAdapter extends ArrayAdapter<String> {
    private String [] mStringArray;
    public SpinnerArrayAdapter(String[] stringArray) {
        super(BaseApplication.getApplictaion(), R.layout.sp_item_auto, stringArray);
        mStringArray=stringArray;
    }

    @Override
    public View getDropDownView(int position, View convertView, ViewGroup parent) {
        //修改Spinner展开后的字体颜色
        if (convertView == null) {
            LayoutInflater inflater = LayoutInflater.from(BaseApplication.getApplictaion());
            convertView = inflater.inflate(R.layout.spinner_item, parent,false);
        }

        //此处text1是Spinner默认的用来显示文字的TextView
        TextView tv = (TextView) convertView.findViewById(R.id.tv);
        tv.setText(mStringArray[position]);
//        tv.setTextSize(5f);
//        tv.setTextColor(Color.argb(255,161,168,174));

        return convertView;

    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // 修改Spinner选择后结果的字体颜色
        if (convertView == null) {
            LayoutInflater inflater = LayoutInflater.from(BaseApplication.getApplictaion());
            convertView = inflater.inflate(R.layout.sp_item_auto, parent, false);
//            AutoUtils.autoSize(convertView);
        }

        //此处text1是Spinner默认的用来显示文字的TextView
        TextView tv = (TextView) convertView.findViewById(R.id.tv);
        tv.setText(mStringArray[position]);
//        tv.setTextSize(AutoUtils.getPercentWidthSize(21));
//        tv.setTextColor(Color.argb(255,161,168,174));
        return convertView;
    }

}<file_sep>package com.zhang.okinglawenforcementphone.mvp.model;

import android.text.format.DateFormat;

import com.google.gson.Gson;
import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.beans.Point;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadLocationToServerContract;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import io.reactivex.functions.Consumer;
import okhttp3.ResponseBody;

/**
 * Created by Administrator on 2018/4/20.
 */

public class UploadLocationToServerModel implements UploadLocationToServerContract.Model {
    private UploadLocationToServerContract.Presenter mPresenter;
    private Point mLocation;
    public UploadLocationToServerModel(UploadLocationToServerContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void upploadLocationToServer(Long loginTime, SimpleDateFormat sdf, String imei, Gson gson) {
        if (mLocation==null){

            mLocation = new Point();
        }
        mLocation.setLatitude(Double.parseDouble(OkingContract.LOCATIONRESULT[1]));
        mLocation.setLongitude(Double.parseDouble(OkingContract.LOCATIONRESULT[2]));
        try {
            mLocation.setDatetime(sdf.parse(OkingContract.LOCATIONRESULT[3]).getTime());
        } catch (ParseException e) {
            e.printStackTrace();
        }


        BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .uploadLocation(loginTime,
                        OkingContract.CURRENTUSER.getUserid(),
                        imei,gson.toJson(mLocation), DateFormat.format("yyyy-MM-dd HH:mm:ss", System.currentTimeMillis()).toString())
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        String result = responseBody.string();
                        mPresenter.uploadSucc(result);
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        mPresenter.uploadFail(throwable);
                    }
                });

    }
}
<file_sep>package com.zhang.baselib.utils;

import android.content.Context;
import android.hardware.Camera;
import android.os.Build;

import java.util.Comparator;
import java.util.List;

/**
 * Created by Administrator on 2018/4/25/025.
 */

public class Util {
    public static List<Camera.Size> getResolutionList(Camera camera) {
        Camera.Parameters parameters = camera.getParameters();
        return parameters.getSupportedPreviewSizes();
    }

    public static boolean hasGingerbread() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;
    }

    public static boolean hasHoneycomb() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
    }

    public static boolean hasHoneycombMR1() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1;
    }

    public static boolean hasJellyBean() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
    }

    public static boolean hasKitKat() {
        return Build.VERSION.SDK_INT >= 19;
    }

    public static boolean hasFroyo() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO;

    }

    public static class ResolutionComparator implements Comparator<Camera.Size> {

        @Override
        public int compare(Camera.Size lhs, Camera.Size rhs) {
            if (lhs.height != rhs.height) {
                return lhs.height - rhs.height;
            } else {
                return lhs.width - rhs.width;
            }
        }

    }

    /**
     * 获取状态栏高度
     * @param context
     * @return
     */

    public static int getStatusBarHeight(Context context) {
        int result = 0;
        int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            result = context.getResources().getDimensionPixelSize(resourceId);
        }
        return result;
    }

    public static int getDatePoor(long time1, long time2) {
        long nd = 1000 * 24 * 60 * 60;
        // long ns = 1000;
        // 获得两个时间的毫秒时间差异
        long diff = time2 - time1;
        // 计算差多少天
        int day = (int) (diff / nd);
        return day;

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.model;

import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.contract.AddMemberContract;

import io.reactivex.functions.Consumer;
import okhttp3.ResponseBody;

/**
 * Created by Administrator on 2018/4/20.
 */

public class AddMemberModel implements AddMemberContract.Model {
    private AddMemberContract.Presenter mPresenter;

    public AddMemberModel(AddMemberContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void addMember(String userid, String mtaskId, String userids) {

        BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .addMember(userid,mtaskId,userids)
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        mPresenter.addMemberSucc(responseBody.string());
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        mPresenter.addMemberFail(throwable);
                    }
                });
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.contract;

import java.util.Map;

/**
 * Created by Administrator on 2018/4/28/028.
 */

public interface UploadRecordContract {
    interface Model {
       void uploadRecord(Map<String, Object> params);
    }

    interface View {
        void uploadRecordSucc(String result);
        void uploadRecordFail(Throwable ex);
    }

    interface Presenter {
        void uploadRecord(Map<String, Object> params);
        void uploadRecordSucc(String result);
        void uploadRecordFail(Throwable ex);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;


import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.baselib.ui.views.RxDialogLoading;
import com.zhang.baselib.ui.views.RxDialogSure;
import com.zhang.baselib.ui.views.RxDialogSureCancel;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.baselib.utils.NetUtil;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.CaseAudioVideoEvidenceListRecyAdapter;
import com.zhang.okinglawenforcementphone.beans.GreenCase;
import com.zhang.okinglawenforcementphone.beans.GreenEvidence;
import com.zhang.okinglawenforcementphone.beans.GreenEvidenceMedia;
import com.zhang.okinglawenforcementphone.beans.GreenEvidenceSTZJOV;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;

/**
 * A simple {@link Fragment} subclass.
 */
public class CaseAudioVideoEvidenceListFragment extends Fragment {
    private static final String ARG_PARAM2 = "param2";
    private String mParam2;
    private GreenCase mycase;

    private RecyclerView ryMain;
    private ArrayList<GreenEvidence> evidences = new ArrayList<>();

    private boolean uploadSound, uploadVideo;
    private int  uploadSoundCount, uploadVideoCount;

    private SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    private CaseAudioVideoEvidenceListRecyAdapter mCaseAudioVideoEvidenceListRecyAdapter;
    private RxDialogSureCancel mRxDialogSureCancel;
    private RxDialogLoading mRxDialogLoading;
    private ArrayList<GreenEvidenceMedia> mPicGreenMediaList = new ArrayList<>();
    private ArrayList<GreenEvidenceMedia> mVoiceGreenMediaList = new ArrayList<>();
    private ArrayList<GreenEvidenceMedia> mVideoGreenMediaList = new ArrayList<>();
    private View mInflate;

    public CaseAudioVideoEvidenceListFragment() {
        // Required empty public constructor
    }

    public static CaseAudioVideoEvidenceListFragment newInstance( String param2) {
        CaseAudioVideoEvidenceListFragment fragment = new CaseAudioVideoEvidenceListFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (mInflate ==null){
            mInflate = inflater.inflate(R.layout.fragment_case_audio_video_evidence_list, container, false);

        }
        EventBus.getDefault().register(this);
        initView(mInflate);
        return mInflate;
    }


    @Override
    public void onDestroyView() {
        EventBus.getDefault().unregister(this);
        super.onDestroyView();
    }

    public void initView(View rootView) {
        ryMain = rootView.findViewById(R.id.ry_main);
        ryMain.setLayoutManager(new LinearLayoutManager(BaseApplication.getApplictaion(), LinearLayoutManager.VERTICAL, false));
        mCaseAudioVideoEvidenceListRecyAdapter = new CaseAudioVideoEvidenceListRecyAdapter(R.layout.list_item_audiovideoevidence, null);
        ryMain.setAdapter(mCaseAudioVideoEvidenceListRecyAdapter);
        loadEvidence();
        mCaseAudioVideoEvidenceListRecyAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
            @Override
            public void onItemChildClick(final BaseQuickAdapter adapter, View view, final int position) {
                switch (view.getId()) {
                    case R.id.upload_button:            //上传
                        if (NetUtil.isConnected(BaseApplication.getApplictaion())) {
                            GreenEvidence greenEvidence = evidences.get(position);
                            List<GreenEvidenceMedia> greenMedias = greenEvidence.getGreenMedia();
                            for (GreenEvidenceMedia greenMedia : greenMedias) {
                                if (greenMedia.getType()==1){
                                    mPicGreenMediaList.clear();
                                    mPicGreenMediaList.add(greenMedia);
                                }else if (greenMedia.getType()==2){
                                    mVideoGreenMediaList.clear();
                                    mVideoGreenMediaList.add(greenMedia);
                                }else if (greenMedia.getType()==3){
                                    mVoiceGreenMediaList.clear();
                                    mVoiceGreenMediaList.add(greenMedia);
                                }
                            }

                            saveEvidence(evidences.get(position));
                        } else {
                            RxToast.warning(BaseApplication.getApplictaion(), "网络无连接", Toast.LENGTH_SHORT).show();
                        }
                        break;
                    case R.id.delete_button:            //删除
                        if (mRxDialogSureCancel == null) {

                            mRxDialogSureCancel = new RxDialogSureCancel(getActivity());
                            mRxDialogSureCancel.setTitle("提示");
                            mRxDialogSureCancel.setContent("是否删除证据");
                        }
                        mRxDialogSureCancel.getTvSure().setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {

                                GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceDao().delete(evidences.get(position));
                                evidences.remove(position);
                                mCaseAudioVideoEvidenceListRecyAdapter.setNewData(evidences);
                                mRxDialogSureCancel.cancel();

                            }
                        });
                        mRxDialogSureCancel.getTvCancel().setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                mRxDialogSureCancel.cancel();
                            }
                        });
                        mRxDialogSureCancel.show();

                        break;
                    case R.id.edit_button:            //查看编辑
                        if (((Button) view).getText().equals("查看")) {
                            FragmentTransaction ft = getFragmentManager().beginTransaction();

                            CaseAudioVideoEvidenceFragment caseAudioVideoEvidenceFragment = CaseAudioVideoEvidenceFragment.newInstance(0);
                            caseAudioVideoEvidenceFragment.setGreenCase(mycase, evidences.get(position));
                            ft.add(R.id.rl_sub_content, caseAudioVideoEvidenceFragment).commit();
                        } else {
                            FragmentTransaction ft = getFragmentManager().beginTransaction();
                            CaseAudioVideoEvidenceFragment caseAudioVideoEvidenceFragment = CaseAudioVideoEvidenceFragment.newInstance(1);
                            caseAudioVideoEvidenceFragment.setGreenCase(mycase, evidences.get(position));
                            ft.add(R.id.rl_sub_content, caseAudioVideoEvidenceFragment).commit();
                        }

                        break;
                    default:
                        break;
                }
            }
        });

    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void handleEvent1(GreenEvidenceSTZJOV event) {
        if (event.getType() == 2) {            //添加征据
            evidences.add(event.getGreenEvidence());
            mCaseAudioVideoEvidenceListRecyAdapter.setNewData(evidences);
        } else {
            loadEvidence();
        }

    }

    /**
     * 上传数据
     * @param evidence
     */
    private void saveEvidence(final GreenEvidence evidence) {

        if (mRxDialogLoading == null) {

            mRxDialogLoading = new RxDialogLoading(getActivity(), false, new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    mRxDialogLoading.cancel();
                }
            });
        }
        mRxDialogLoading.setLoadingText("上传数据中...");
        mRxDialogLoading.show();



        Map<String, Object> fields = new HashMap<>();
        if (evidence.getZJID() != null) {

            fields.put("zjid", evidence.getZJID());
        }

        if (evidence.getAJID() != null) {
            fields.put("ajid", evidence.getAJID());
        }
        if (evidence.getZJLX() != null) {
            fields.put("zjlx", evidence.getZJLX());
        }
        if (evidence.getZJMC() != null) {
            fields.put("zjmc", evidence.getZJMC());
        }
        if (evidence.getZJLY() != null) {
            fields.put("zjly", evidence.getZJLY());
        }
        if (evidence.getZJNR() != null) {
            fields.put("zjnr", evidence.getZJNR());
        }
        if (evidence.getSL() != null) {
            fields.put("sl", evidence.getSL());
        }


        if (((Long) evidence.getCJSJ()) != null) {
            fields.put("cjsj", mSimpleDateFormat.format(evidence.getCJSJ()));
        }
        if (evidence.getCJR() != null) {
            fields.put("cjr", evidence.getCJR());
        }
        if (evidence.getCJDD() != null) {
            fields.put("cjdd", evidence.getCJDD());
        }
        if (evidence.getJZR() != null) {
            fields.put("jzr", evidence.getJZR());
        }
        if (evidence.getDW() != null) {
            fields.put("dw", evidence.getDW());
        }
        if (evidence.getBZ() != null) {
            fields.put("bz", evidence.getBZ());
        }
        if (OkingContract.CURRENTUSER != null) {
            fields.put("scr", OkingContract.CURRENTUSER.getUserName());
        }
        fields.put("scsj", mSimpleDateFormat.format(System.currentTimeMillis()));

        if (evidence.getZT() != null) {
            fields.put("zt", evidence.getZT());
        }
        if (evidence.getWSID() != null) {
            fields.put("wsid", evidence.getWSID());
        }
        if (evidence.getLXMC() != null) {
            fields.put("lxmc", evidence.getLXMC());
        }
        if (evidence.getZJLYMC() != null) {
            fields.put("zjlymc", evidence.getZJLYMC());
        }
        if (evidence.getYS() != null) {
            fields.put("ys", evidence.getYS());
        }



        BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .uploadEvidence(fields)
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        String result = responseBody.string();
                        if ("success".equals(result)) {
                            uploadEvidenceFile(evidence);
                        } else {
                            RxToast.error(BaseApplication.getApplictaion(), "上传证据失败", Toast.LENGTH_SHORT).show();
                        }
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {

                    }
                });

    }

    private void uploadEvidenceFile(final GreenEvidence evidence) {

        uploadSound = true;
        uploadVideo = true;
        uploadVideoCount = 0;
        uploadSoundCount = 0;

        Observable.create(new ObservableOnSubscribe<Integer>() {
            @Override
            public void subscribe(ObservableEmitter<Integer> e) throws Exception {

                for (int i = 0; i < mVideoGreenMediaList.size(); i++) {

                    uploadVideo = false;

                    String videoPath = mVideoGreenMediaList.get(i).getPath();
                    uploadFile(videoPath, "mp4", evidence);
                }

                for (int i = 0; i < mVoiceGreenMediaList.size(); i++) {

                    uploadSound = false;
                    String voicePath = mVoiceGreenMediaList.get(i).getPath();
                    uploadFile(voicePath, "m4a", evidence);
                }
                e.onNext(1);
            }
        }).subscribe(new Observer<Integer>() {
            @Override
            public void onSubscribe(Disposable d) {

            }

            @Override
            public void onNext(Integer value) {
                if (value == 1) {
                    checkChangeState(evidence);
                }
            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onComplete() {

            }
        });


    }

    private void uploadFile(String path, final String type, final GreenEvidence evidence) {


        Map<String, RequestBody> fileParams = new HashMap<>();
        fileParams.put("zjid", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), evidence.getZJID()));
        fileParams.put("type", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), type));
        fileParams.put("ajid", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), evidence.getAJID()));
        fileParams.put("userid", RequestBody.create(MediaType.parse("text/plain;charset=UTF-8"), OkingContract.CURRENTUSER.getUserid()));
        File file = new File(Uri.parse(path).getPath());
        fileParams.put("files" + "\"; filename=\"" + file.getName(), RequestBody.create(MediaType.parse("video/mp4"), file));

        BaseHttpFactory.getInstence().createService(GDWaterService.class,Api.BASE_URL)
                .uploadEvidenceFiles(fileParams)
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        String result = responseBody.string();
                        if ("success".equals(result)) {
                            switch (type) {
                                case "mp4":
                                    uploadVideoCount++;
                                    if (uploadVideoCount == mVideoGreenMediaList.size()) {
                                        uploadVideo = true;
                                        checkChangeState(evidence);
                                    }
                                    break;
                                case "m4a":
                                    uploadSoundCount++;
                                    if (uploadSoundCount == mVoiceGreenMediaList.size()) {
                                        uploadSound = true;
                                        checkChangeState(evidence);
                                    }
                                    break;
                                default:
                                    break;
                            }
                        } else {
                            mRxDialogLoading.cancel();
                            RxToast.error(BaseApplication.getApplictaion(), "上传证据附件失败！", Toast.LENGTH_SHORT).show();
                        }

                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        mRxDialogLoading.cancel();
                        RxToast.error(BaseApplication.getApplictaion(), "上传附件失败！2"+throwable.getMessage(), Toast.LENGTH_SHORT).show();

                    }
                });


    }

    public void notifyDataSetChanged() {
        if (mCaseAudioVideoEvidenceListRecyAdapter != null) {
            mCaseAudioVideoEvidenceListRecyAdapter.notifyDataSetChanged();
        }
    }

    private void loadEvidence() {
        evidences.clear();
        if (mycase != null) {
            for (int i = 0; i < mycase.getGreenEvidence().size(); i++) {
                if ("YYSP".equals(mycase.getGreenEvidence().get(i).getOtype()) || "SP".equals(mycase.getGreenEvidence().get(i).getOtype())
                        || "YY".equals(mycase.getGreenEvidence().get(i).getOtype())) {
                    evidences.add(mycase.getGreenEvidence().get(i));
                }
            }
            mCaseAudioVideoEvidenceListRecyAdapter.setNewData(evidences);
        }
    }

    private void checkChangeState(GreenEvidence evidence) {
        if (uploadSound && uploadVideo ) {
            mRxDialogLoading.cancel();
            evidence.setIsUpload(true);
            GreenDAOManager.getInstence().getDaoSession().getGreenEvidenceDao().update(evidence);
            mCaseAudioVideoEvidenceListRecyAdapter.notifyDataSetChanged();
            GreenDAOManager.getInstence().getDaoSession().getGreenCaseDao().update(mycase);
            final RxDialogSure rxDialogSure = new RxDialogSure(getActivity());
            rxDialogSure.setTitle("提示");
            rxDialogSure.setContent("上传成功！");
            rxDialogSure.show();
            rxDialogSure.getTvSure().setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    rxDialogSure.cancel();
                }
            });

        }
    }


    public void setGreenCase(GreenCase greenCase){
        this.mycase = greenCase;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;

import android.content.DialogInterface;
import android.os.Bundle;
import android.support.design.widget.TextInputEditText;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.baselib.ui.views.RxDialogLoading;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLog;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLogDao;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.mvp.contract.LoadBasicLogContract;
import com.zhang.okinglawenforcementphone.mvp.presenter.LoadBasicLogPresenter;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class ApprovalTheLogFragment extends Fragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.type_nature)
    TextInputEditText mTypeNature;
    @BindView(R.id.tv_tasktype)
    TextInputEditText mTvTasktype;
    @BindView(R.id.plan_spinner)
    TextInputEditText mPlanSpinner;
    @BindView(R.id.item_spinner)
    TextInputEditText mItemSpinner;
    @BindView(R.id.equipment_textView)
    TextInputEditText mEquipmentTextView;
    @BindView(R.id.tv_patrol)
    TextInputEditText mTvPatrol;
    @BindView(R.id.tv_result)
    TextInputEditText mTvResult;
    @BindView(R.id.tv_law_enforcement)
    TextInputEditText mTvLawEnforcement;
    Unbinder unbinder;

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    private View mInflate;
    private GreenMissionLog mGreenMissionLog;
    private RxDialogLoading mRxDialogLoading;
    private LoadBasicLogPresenter mLoadBasicLogPresenter;
    private GreenMissionTask mGreenMissionTask;

    public ApprovalTheLogFragment() {
        // Required empty public constructor
    }

    public static ApprovalTheLogFragment newInstance(String param1, String param2) {
        ApprovalTheLogFragment fragment = new ApprovalTheLogFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_approval_the_log, container, false);

        }
        unbinder = ButterKnife.bind(this, mInflate);
        initData();
        return mInflate;
    }

    private void initData() {
        if (mGreenMissionLog == null) {
            if (mRxDialogLoading == null) {
                mRxDialogLoading = new RxDialogLoading(getActivity(), false, new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialog) {
                        dialog.cancel();
                    }
                });
            }

            mRxDialogLoading.setLoadingText("正在获取数据中请稍候...");
            mRxDialogLoading.show();
            //{"msg":"查询成功!","datas":[{"OTHER_PART":"交通,城管","EQUIPMENT":"交通工具：001003,001001,001001  ","PLAN":"0","TYPE":"0"}],"status":"1"}
//
            if (mLoadBasicLogPresenter == null) {
                mLoadBasicLogPresenter = new LoadBasicLogPresenter(new LoadBasicLogContract.View() {
                    @Override
                    public void getBasicLogSucc(String result) {
                        mRxDialogLoading.cancel();
                        //{"msg":"查询成功!","datas":[{"OTHER_PART":"交通,城管","EQUIPMENT":"交通工具：001003,001001,001001  ","PLAN":"0","TYPE":"0"}],"status":"1"}
                        try {
                            JSONObject jsonObject = new JSONObject(result);
                            String status = jsonObject.getString("status");
                            if (status.equals("1")) {
                                JSONArray datas = jsonObject.getJSONArray("datas");
                                mGreenMissionLog = new GreenMissionLog();
                                if (datas.length()>0){
                                    JSONObject object = datas.getJSONObject(0);
                                    mGreenMissionLog.setEquipment(object.getString("EQUIPMENT"));
                                    mGreenMissionLog.setServer_id(object.getString("LOG_ID"));
                                    mGreenMissionLog.setTask_id(mGreenMissionTask.getTaskid());
                                    mGreenMissionLog.setOther_part(object.getString("OTHER_PART"));
                                    mGreenMissionLog.setPlan(Integer.parseInt(object.getString("PLAN")));
                                    mGreenMissionLog.setPatrol(object.getString("PATROL"));
                                    mGreenMissionLog.setDzyj(object.getString("DZYJ"));
                                    Log.i("Oking5",">>>>>>>>>>>"+mGreenMissionLog.toString());
                             GreenDAOManager.getInstence().getDaoSession().getGreenMissionLogDao().insert(mGreenMissionLog);
                                    setTaskLogData();
                                }


                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
//
                    }

                    @Override
                    public void getBasicLogFail(Throwable ex) {
                        mRxDialogLoading.cancel();
                        Log.i("Oking5","获取日志失败"+ex.toString());
                        RxToast.error("获取日志失败");

                    }
                });

            }
            mLoadBasicLogPresenter.getBasicLog(mGreenMissionTask.getTaskid());
        } else {
            setTaskLogData();
        }

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    public void setMissionLog(GreenMissionLog greenMissionLog) {
        mGreenMissionLog = greenMissionLog;
    }

    private void setTaskLogData() {
        mTypeNature.setText(mGreenMissionTask.getTypename());

        if ("0".equals(mGreenMissionTask.getTypeoftask())) {
            mTvTasktype.setText("河道管理");
        } else if ("1".equals(mGreenMissionTask.getTypeoftask())) {
            mTvTasktype.setText("河道采砂");
        } else if ("2".equals(mGreenMissionTask.getTypeoftask())) {
            mTvTasktype.setText("水资源管理");
        } else if ("3".equals(mGreenMissionTask.getTypeoftask())) {
            mTvTasktype.setText("水土保持管理");
        } else if ("4".equals(mGreenMissionTask.getTypeoftask())) {
            mTvTasktype.setText("水利工程管理");
        }

        if (0 == mGreenMissionLog.getPlan()) {
            mPlanSpinner.setText("月计划");
        } else if (1 == mGreenMissionLog.getPlan()) {
            mPlanSpinner.setText("季度计划");
        } else if (2 == mGreenMissionLog.getPlan()) {
            mPlanSpinner.setText("年计划");
        }

        if (0 == mGreenMissionLog.getItem()) {
            mItemSpinner.setText("河道管理执法巡查");
        } else if (1 == mGreenMissionLog.getItem()) {
            mItemSpinner.setText("河道采砂管理执法巡查");
        } else if (2 == mGreenMissionLog.getItem()) {
            mItemSpinner.setText("水资源管理执法巡查");
        } else if (3 == mGreenMissionLog.getItem()) {
            mItemSpinner.setText("水土保持管理执法巡查");
        } else if (4 == mGreenMissionLog.getItem()) {
            mItemSpinner.setText("水利工程管理执法巡查");
        } else if (5 == mGreenMissionLog.getItem()) {
            mItemSpinner.setText("举报案件核查巡查");
        } else if (6 == mGreenMissionLog.getItem()) {
            mItemSpinner.setText("其他");
        }

        String part = mGreenMissionLog.getOther_part();
        mTvLawEnforcement.setText(part);
        mEquipmentTextView.setText(mGreenMissionLog.getEquipment());

        mTvPatrol.setText(mGreenMissionLog.getPatrol());
        mTvResult.setText(mGreenMissionLog.getDzyj());


    }

    public void setMissionTask(GreenMissionTask greenMissionTask) {
        mGreenMissionTask = greenMissionTask;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.model;

import android.os.Environment;
import android.util.Log;

import com.google.gson.Gson;
import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.baselib.utils.FileUtil;
import com.zhang.baselib.utils.Util;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.beans.Point;
import com.zhang.okinglawenforcementphone.beans.RecordLogOV;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadJobLogContract;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;

/**
 * Created by Administrator on 2018/4/26/026.
 */

public class UploadJobLogModel implements UploadJobLogContract.Model {
    private UploadJobLogContract.Presenter mPresenter;
    private int mDatePoor;
    private long mBeforTime;
    private String mLocJson;
    private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");

    public UploadJobLogModel(UploadJobLogContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void uploadJobLog(final RecordLogOV recordLogOV, final Gson mGson) {

        BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .getHttpMissionLog("-1", recordLogOV.getGreenMissionTask().getTaskid())
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .observeOn(Schedulers.io())
                .concatMap(new Function<ResponseBody, ObservableSource<ResponseBody>>() {


                    @Override
                    public Observable<ResponseBody> apply(ResponseBody responseBody) throws Exception {
                        //提交文本资料
                        String result = responseBody.string();
                        Log.i("Oking", ">>>>>>>>>>>>>>>>>1" + result);
                        Log.i("Oking5", ">>>>>>>>>>>>>>>>>1" + recordLogOV.toString());
                        JSONObject jsonObject = new JSONObject(result);
                        int count = jsonObject.getInt("total");
                        HashMap<String, Object> stringStringHashMap = new HashMap<>();
                        if (count > 0) {
                            JSONArray rows = jsonObject.getJSONArray("rows");
                            String oldId = rows.getJSONObject(0).getString("id");
                            stringStringHashMap.put("mode", 1);
                            stringStringHashMap.put("id", oldId);
                            recordLogOV.getGreenMissionLog().setServer_id(oldId);
                        } else {
                            stringStringHashMap.put("mode", 0);
                        }

                        stringStringHashMap.put("task_id", recordLogOV.getGreenMissionTask().getTaskid());
                        stringStringHashMap.put("name", OkingContract.CURRENTUSER.getUserid());
                        stringStringHashMap.put("time", recordLogOV.getTime());
                        stringStringHashMap.put("plan", recordLogOV.getSelePlanPos());
                        stringStringHashMap.put("item", recordLogOV.getSeleMattersPos());
                        stringStringHashMap.put("type", recordLogOV.getGreenMissionTask().getTask_type());
                        stringStringHashMap.put("area", recordLogOV.getArea());
                        boolean swisopen = recordLogOV.isSwisopen();
                        if (swisopen) {
                            stringStringHashMap.put("whetherComplete", "0");
                        } else {
                            stringStringHashMap.put("whetherComplete", "1");
                        }
                        stringStringHashMap.put("patrol", recordLogOV.getSummary());
                        stringStringHashMap.put("dzyj", recordLogOV.getLeaderSummary());
                        stringStringHashMap.put("status", 0);
                        stringStringHashMap.put("other_part", recordLogOV.getParts()==null?"":recordLogOV.getParts());
                        stringStringHashMap.put("examine_status", 0);
                        stringStringHashMap.put("equipment", recordLogOV.getEquipment()==null?"":recordLogOV.getEquipment());

                        //获取轨迹
                        getLocationTrajectory(recordLogOV, mGson);
                        stringStringHashMap.put("route", mLocJson);
                        stringStringHashMap.put("tbr", OkingContract.CURRENTUSER.getUserName());
                        stringStringHashMap.put("tbrid", OkingContract.CURRENTUSER.getUserid());

                        return BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL).uploadJobLogForText(stringStringHashMap);
                    }
                })
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        String result = responseBody.string();
                        Log.i("Oking", "位置数据、文本数据上传成功>>>>>>>>>>>>>>>>>2" + result);
                        mPresenter.uploadJobLogSucc(result);
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        Log.i("Oking", "异常>>>>>>>>>>>>>>>>>3" + throwable.getLocalizedMessage() + throwable.toString());
                        mPresenter.uploadJobLogFail(throwable);

                    }
                });

    }

    private void getLocationTrajectory(RecordLogOV recordLogOV, Gson mGson) {
        Long beginTime = recordLogOV.getGreenMissionTask().getExecute_start_time();
        if (beginTime == null) {
            beginTime = System.currentTimeMillis() - 1000 * 60 * 20;
        }
        Long endTime = recordLogOV.getGreenMissionTask().getExecute_end_time();
        if (endTime == null) {
            endTime = System.currentTimeMillis();
            recordLogOV.getGreenMissionTask().setExecute_end_time(endTime);
        }
        mBeforTime = beginTime - 24 * 60 * 60 * 1000;
        final String file1 = sdf.format(beginTime);

        final ArrayList<Point> locationPath = new ArrayList<>();

        mDatePoor = Util.getDatePoor(beginTime, endTime);
        if (mDatePoor < 1) {        //表示在同一天
//                    Log.i("Oking","是同一天");
            List<String> locationPos = FileUtil.readFile2List(Environment.getExternalStorageDirectory() + "/oking/location/" + file1 + ".txt", "UTF-8");
            if (locationPos != null) {
                for (String s : locationPos) {
                    String[] items = s.split(",");
                    if (items.length != 3) {
                        continue;
                    }

                    String mLatitude = items[0];
                    String mLongitude = items[1];
                    String mDatetime = items[2];

                    if (Long.parseLong(mDatetime) > beginTime && Long.parseLong(mDatetime) < endTime) {
                        Point location = new Point();
                        location.setLatitude(Double.valueOf(mLatitude));
                        location.setLongitude(Double.valueOf(mLongitude));
                        location.setDatetime(Long.valueOf(mDatetime));
                        locationPath.add(location);
                    }
                }
            }


        } else {

            for (int i = 0; i <= mDatePoor; i++) {
                File file = new File(Environment.getExternalStorageDirectory() + "/oking/location/" + getAfterData(mBeforTime) + ".txt");
                if (file.exists()) {
//                            Log.i("Oking","不是同一天"+file.getName());
                    List<String> locationPos = FileUtil.readFile2List(file, "UTF-8");
                    for (String s : locationPos) {
                        String[] items = s.split(",");
                        if (items.length != 3) {
                            continue;
                        }

                        String Latitude = items[0];
                        String Longitude = items[1];
                        String datetime = items[2];

                        if (Long.parseLong(datetime) > beginTime && Long.parseLong(datetime) < endTime) {

                            Point location = new Point();
                            location.setLatitude(Double.valueOf(Latitude));
                            location.setLongitude(Double.valueOf(Longitude));
                            location.setDatetime(Long.valueOf(datetime));
                            locationPath.add(location);
                        }
                    }

                }

            }
        }

        //筛选一下，不然点集太多
        if (locationPath.size() > 100) {
            ArrayList<Point> newLocationPath = new ArrayList<>();
            for (int i = 0; i < locationPath.size(); i = i + 2) {

                newLocationPath.add(locationPath.get(i));
            }

            mLocJson = mGson.toJson(newLocationPath);

        } else {

            mLocJson = mGson.toJson(locationPath);
        }
    }

    private String getAfterData(long time) {
        //如果需要向后计算日期 -改为+
        Date newDate = new Date(time + 24 * 60 * 60 * 1000);
        mBeforTime = newDate.getTime();
        String dateOk = sdf.format(newDate);
        return dateOk;
    }


}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.MapTaskInfo;

import java.util.List;

/**
 * Created by Administrator on 2018/5/21/021.
 */

public class MapTaskRecyAdapter extends BaseQuickAdapter<MapTaskInfo, BaseViewHolder> {
    public MapTaskRecyAdapter(int layoutResId, @Nullable List<MapTaskInfo> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MapTaskInfo item) {
            helper.setText(R.id.tv_title,item.getTaskName());

    }
}
<file_sep>package com.zhang.baselib.http.interceptor;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Response;

/**
 * Created by Administrator on 2018/8/23/023.
 */

public class AddHeadInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        return null;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.model;

import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.contract.LoadUsersByDeptIdContract;

import io.reactivex.functions.Consumer;
import okhttp3.ResponseBody;

/**
 * Created by Administrator on 2018/6/8/008.
 */

public class LoadUsersByDeptIdModel implements LoadUsersByDeptIdContract.Model {
    private LoadUsersByDeptIdContract.Presenter mPresenter;

    public LoadUsersByDeptIdModel(LoadUsersByDeptIdContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void getUsersByDeptId(String deptId) {
        BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                .getUsersByDeptId(deptId)
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        String result = responseBody.string();
                        mPresenter.getUsersByDeptIdSucc(result);
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        mPresenter.getUsersByDeptIdFail(throwable);
                    }
                });
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Process;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.zhang.baselib.http.BaseHttpFactory;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.baselib.ui.views.RxDialogLoading;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.baselib.utils.ActivityUtil;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.http.service.GDWaterService;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;

import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import io.reactivex.functions.Consumer;
import okhttp3.ResponseBody;

public class ChangePasswordActivity extends BaseActivity {

    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.et_oldpwd)
    EditText mEtOldpwd;
    @BindView(R.id.et_newpwd)
    EditText mEtNewpwd;
    @BindView(R.id.et_confirm_pwd)
    EditText mEtConfirmPwd;
    @BindView(R.id.bt_submit)
    TextView mBtSubmit;
    private Unbinder mBind;
    private RxDialogLoading mRxDialogLoading;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_change_password);
        mBind = ButterKnife.bind(this);
        initData();
        setListener();
    }

    private void setListener() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    private void initData() {

    }

    @OnClick(R.id.bt_submit)
    public void onViewClicked() {
        String oldPwd = mEtOldpwd.getText().toString().trim();
        String newPwd = mEtNewpwd.getText().toString().trim();
        String confirmPwd = mEtConfirmPwd.getText().toString().trim();
        if (!TextUtils.isEmpty(oldPwd) && !TextUtils.isEmpty(newPwd) && !TextUtils.isEmpty(confirmPwd)) {
            if (newPwd.equals(confirmPwd)) {
                if (mRxDialogLoading == null) {
                    mRxDialogLoading = new RxDialogLoading(ChangePasswordActivity.this, false, new DialogInterface.OnCancelListener() {
                        @Override
                        public void onCancel(DialogInterface dialog) {
                            dialog.cancel();
                        }
                    });
                    mRxDialogLoading.setLoadingText("正在提交数据中请稍后...");
                }
                mRxDialogLoading.show();
                Map<String, Object> params = new HashMap<>();
                params.put("userid", OkingContract.CURRENTUSER.getUserid());
                params.put("account", OkingContract.CURRENTUSER.getAcount());
                params.put("oldPassword", <PASSWORD>);
                params.put("password", <PASSWORD>);

                BaseHttpFactory.getInstence().createService(GDWaterService.class, Api.BASE_URL)
                        .uploadUserInfo(params)
                        .compose(RxSchedulersHelper.<ResponseBody>io_main())
                        .subscribe(new Consumer<ResponseBody>() {
                            @Override
                            public void accept(ResponseBody responseBody) throws Exception {
                                String result = responseBody.string();
                                mRxDialogLoading.cancel();
                                if ("1".equals(result)) {
                                    RxToast.success("修改密码成功！");
                                    mBtSubmit.setEnabled(false);
                                    OkingContract.CURRENTUSER = null;

                                   new Handler().postDelayed(new Runnable() {
                                       @Override
                                       public void run() {
                                           ActivityUtil.finishAllActivity();
                                           Intent intent = getBaseContext().getPackageManager()
                                                   .getLaunchIntentForPackage(getBaseContext().getPackageName());
                                           intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                                           startActivity(intent);
                                           Process.killProcess(Process.myPid());
                                       }
                                   }, 500);



                                } else if ("0".equals(result)) {
                                    RxToast.error("修改密码失败！");
                                } else {
                                    RxToast.error("原密码错误！");
                                }

                            }
                        }, new Consumer<Throwable>() {
                            @Override
                            public void accept(Throwable throwable) throws Exception {
                                Log.i("Oking", "修改失败" + throwable.toString());
                                mRxDialogLoading.cancel();
                                RxToast.error("网络错误！");

                            }
                        });
            } else {
                RxToast.error("两次输入的密码不一致");
            }
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

        mBind.unbind();
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.contract;

/**
 * Created by Administrator on 2018/4/20.
 */

public interface AddMemberContract {
    interface Model {
        void addMember(String userid, String mtaskId, String userids);
    }

    interface View {
        void addMemberSucc(String result);

        void addMemberFail(Throwable ex);
    }

    interface Presenter {
        void addMember(String userid, String mtaskId, String userids);
        void addMemberSucc(String result);

        void addMemberFail(Throwable ex);
    }

}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.contract;

import com.google.gson.Gson;
import com.zhang.okinglawenforcementphone.beans.GreenMedia;
import com.zhang.okinglawenforcementphone.beans.GreenMissionLog;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import okhttp3.RequestBody;

/**
 * Created by Administrator on 2018/4/26/026.
 */

public interface UploadVideoContract {
    interface Model {
        void uploadVideo(GreenMissionLog greenMissionLog, List<GreenMedia> greenMedias, Map<String, RequestBody> photoParams, SimpleDateFormat videosdf, Gson gson);
    }

    interface View {
        void loadVideoSucc(String result);

        void uploadRetry(Throwable ex);

        void loadVideoFail(Throwable ex);

        void uploadIsCount(int pos);
    }

    interface Presenter {
        void uploadVideo(GreenMissionLog greenMissionLog, List<GreenMedia> greenMedias, Map<String, RequestBody> photoParams, SimpleDateFormat videosdf, Gson gson);

        void loadVideoSucc(String result);

        void uploadRetry(Throwable ex);

        void loadVideoFail(Throwable ex);

        void uploadIsCount(int pos);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zhang.baselib.BaseApplication;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.UserRecyAdaper;
import com.zhang.okinglawenforcementphone.beans.UserItemOV;
import com.zhang.okinglawenforcementphone.mvp.ui.activitys.FromAllLawEnforcementSpecificationActivity;
import com.zhang.okinglawenforcementphone.views.DividerItemDecoration;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;


/**
 * 执法规范
 */
public class LawEnforcementSpecificationFragment extends Fragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.recy_list)
    RecyclerView mRecyList;
    Unbinder unbinder;

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    private AdministrativeEnforcementFragment mAdministrativeEnforcementFragment;
    private View mInflate;
    private EnforcementLanguageSpecificationFragment mEnforcementLanguageSpecificationFragment;
    private EnforcementInspectionNormsFragment mEnforcementInspectionNormsFragment;
    private UserItemOV mUserItemOV;
    private UserRecyAdaper mLawEnforcementMenuRecyAdaper;
    private FromAllLawEnforcementSpecificationActivity mFromAllLawEnforcementSpecificationActivity;

    public LawEnforcementSpecificationFragment() {
        // Required empty public constructor
    }

    public static LawEnforcementSpecificationFragment newInstance(String param1, String param2) {
        LawEnforcementSpecificationFragment fragment = new LawEnforcementSpecificationFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_law_enforcement_specification, container, false);
        }
        unbinder = ButterKnife.bind(this, mInflate);
        initData();
        setListener();
        return mInflate;
    }


    private void setListener() {
        mLawEnforcementMenuRecyAdaper.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();

                    fragmentTransaction.hide(LawEnforcementSpecificationFragment.this);
                switch (position) {
                    case 0:
                        mFromAllLawEnforcementSpecificationActivity.setTitleText("水行政执法检查行为规范");



                        if (mEnforcementLanguageSpecificationFragment != null) {
                            fragmentTransaction.hide(mEnforcementLanguageSpecificationFragment);
                        }
                        if (mAdministrativeEnforcementFragment != null) {
                            fragmentTransaction.hide(mAdministrativeEnforcementFragment);
                        }

                        if (mEnforcementInspectionNormsFragment == null) {
                            mEnforcementInspectionNormsFragment = EnforcementInspectionNormsFragment.newInstance(null, null);
                            fragmentTransaction.add(R.id.rl_administrative_content, mEnforcementInspectionNormsFragment, "EnforcementInspectionNormsFragment").commit();
                        } else {
                            if (mEnforcementInspectionNormsFragment.isAdded()) {
                                fragmentTransaction.show(mEnforcementInspectionNormsFragment).commit();
                            }
                        }


                        break;
                    case 1:
                        mFromAllLawEnforcementSpecificationActivity.setTitleText("水行政执法用语规范");

                        if (mEnforcementInspectionNormsFragment != null) {
                            fragmentTransaction.hide(mEnforcementInspectionNormsFragment);
                        }
                        if (mAdministrativeEnforcementFragment != null) {
                            fragmentTransaction.hide(mAdministrativeEnforcementFragment);
                        }

                        if (mEnforcementLanguageSpecificationFragment == null) {
                            mEnforcementLanguageSpecificationFragment = EnforcementLanguageSpecificationFragment.newInstance(null, null);
                            fragmentTransaction.add(R.id.rl_administrative_content, mEnforcementLanguageSpecificationFragment, "EnforcementLanguageSpecificationFragment").commit();
                        } else {
                            if (mEnforcementLanguageSpecificationFragment.isAdded()) {
                                fragmentTransaction.show(mEnforcementLanguageSpecificationFragment).commit();
                            }
                        }


                        break;

                    case 2:
                        mFromAllLawEnforcementSpecificationActivity.setTitleText("水行政执法禁令");

                        if (mEnforcementInspectionNormsFragment != null) {
                            fragmentTransaction.hide(mEnforcementInspectionNormsFragment);
                        }

                        if (mEnforcementLanguageSpecificationFragment != null) {
                            fragmentTransaction.hide(mEnforcementLanguageSpecificationFragment);
                        }

                        if (mAdministrativeEnforcementFragment == null) {
                            mAdministrativeEnforcementFragment = AdministrativeEnforcementFragment.newInstance(null, null);
                            fragmentTransaction.add(R.id.rl_administrative_content, mAdministrativeEnforcementFragment, "AdministrativeEnforcementFragment").commit();
                        } else {
                            if (mAdministrativeEnforcementFragment.isAdded()) {
                                fragmentTransaction.show(mAdministrativeEnforcementFragment).commit();
                            }
                        }

                        break;
                    default:
                        break;
                }
            }
        });

    }

    private void initData() {
        mRecyList.setLayoutManager(new LinearLayoutManager(BaseApplication.getApplictaion(), LinearLayoutManager.VERTICAL, false));
        mRecyList.addItemDecoration(new DividerItemDecoration(BaseApplication.getApplictaion(), 0, 20, getResources().getColor(R.color.activity_bg)));

        List<UserItemOV> userItemOVS = new ArrayList<>();
        mUserItemOV = new UserItemOV();
        mUserItemOV.setTitle("水行政执法检查行为规范");
        mUserItemOV.setIcon(R.mipmap.falvfaguiku);
        userItemOVS.add(mUserItemOV);
        mUserItemOV = new UserItemOV();
        mUserItemOV.setTitle("水行政执法用语规范");
        mUserItemOV.setIcon(R.mipmap.zfgf);
        userItemOVS.add(mUserItemOV);
        mUserItemOV = new UserItemOV();
        mUserItemOV.setTitle("水行政执法禁令");
        mUserItemOV.setIcon(R.mipmap.zfjl);
        userItemOVS.add(mUserItemOV);

        mLawEnforcementMenuRecyAdaper = new UserRecyAdaper(R.layout.user_item, userItemOVS);
        mLawEnforcementMenuRecyAdaper.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
        mRecyList.setAdapter(mLawEnforcementMenuRecyAdaper);

    }
    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mFromAllLawEnforcementSpecificationActivity = (FromAllLawEnforcementSpecificationActivity) context;
    }
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;

import com.dd.CircularProgressButton;
import com.jaeger.library.StatusBarUtil;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.DefaultContants;
import com.zhang.baselib.http.progress.ProgressListener;
import com.zhang.baselib.http.progress.ProgressManager;
import com.zhang.baselib.http.progress.body.ProgressInfo;
import com.zhang.baselib.ui.views.RxDialogLoading;
import com.zhang.baselib.ui.views.RxDialogSure;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.baselib.utils.CrashUtil;
import com.zhang.baselib.utils.LocationUtil;
import com.zhang.baselib.utils.NetUtil;
import com.zhang.baselib.utils.PermissionUtil;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.http.Api;
import com.zhang.okinglawenforcementphone.mvp.contract.AppVersionContract;
import com.zhang.okinglawenforcementphone.mvp.contract.LoginContract;
import com.zhang.okinglawenforcementphone.mvp.presenter.AppVersionPresenter;
import com.zhang.okinglawenforcementphone.mvp.presenter.LoginPresenter;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class LoginActivity extends BaseActivity {
    @BindView(R.id.login_button)
    CircularProgressButton loginBtn;
    @BindView(R.id.userName_editText)
    EditText userNameEditText;
    @BindView(R.id.password_editText)
    EditText passwordEditText;
    @BindView(R.id.save_pwd_button)
    CheckBox savePwdCheckBox;
    private String mName;
    private String mPwd;
    private Unbinder mBind;
    private String mNewDownloadUrl;
    private RxDialogSure mRxDialogSure;
    private RxDialogLoading mRxDialogLoading;
    private File mApkFile;
    private SharedPreferences mSp;
    private Handler mHandler = new Handler();


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        StatusBarUtil.setTransparent(this);
        mBind = ButterKnife.bind(this, this);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            requestPm();
        }

        initView();
        initData();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (!Settings.Secure.isLocationProviderEnabled(getContentResolver(), LocationManager.GPS_PROVIDER)) {
            finish();
        }
    }

    private void initView() {
        if (!LocationUtil.isGpsEnabled(BaseApplication.getApplictaion())) {

            Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
            startActivityForResult(intent, 0); //此为设置完成后返回到获取界面Intent GPSIntent = new Intent();
        }

    }

    private void initData() {
        //初始化化数据存储
        GreenDAOManager.getInstence().initGreenDao(this);
        CrashUtil.getInstance(BaseApplication.getApplictaion()).init();

//        int o =  1/0;
        //检测更新
        detectionUpdate();

        loginBtn.setIndeterminateProgressMode(true);

        mSp = BaseApplication.getApplictaion().getSharedPreferences("user_config", Context.MODE_PRIVATE);
        if (mSp.getBoolean("savePwd", false)) {
            final String spname = mSp.getString("username", "");
            final String spwd = mSp.getString("pwd", "");
            userNameEditText.setText(spname);
            passwordEditText.setText(spwd);
        }

        savePwdCheckBox.setChecked(mSp.getBoolean("savePwd", false));
    }

    private void detectionUpdate() {
        if (NetUtil.isConnected(BaseApplication.getApplictaion())) {
            new AppVersionPresenter(new AppVersionContract.View() {
                @Override
                public void reqSucc(String result) {
                    if (mRxDialogSure == null) {
                        mRxDialogSure = new RxDialogSure(LoginActivity.this, false, new DialogInterface.OnCancelListener() {
                            @Override
                            public void onCancel(DialogInterface dialogInterface) {
                                dialogInterface.cancel();
                            }
                        });
                        mRxDialogSure.setTitle("APP需要更新");
                        mRxDialogSure.setContent("本次更新内容：");
                        mRxDialogSure.setContent(result);
                        mRxDialogSure.getTvSure().setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                mRxDialogSure.cancel();


                                donlowdApk();
                            }
                        });
                    }

                    mRxDialogSure.show();

                }

                @Override
                public void reqFail(Throwable ex) {

                }
            }).reqAppVersion();
        } else {
            RxToast.warning(BaseApplication.getApplictaion(), "网络无连接", Toast.LENGTH_SHORT).show();
        }

    }


    @OnClick(R.id.login_button)
    public void onClick(View view) {
        mName = userNameEditText.getText().toString().trim();
        mPwd = passwordEditText.getText().toString().trim();
        if (TextUtils.isEmpty(mName) || TextUtils.isEmpty(mPwd)) {
            RxToast.warning(BaseApplication.getApplictaion(), "用户名或密码不能为空", Toast.LENGTH_SHORT).show();
            return;
        }
        userNameEditText.setEnabled(false);
        passwordEditText.setEnabled(false);
        loginBtn.setProgress(50);
        loginBtn.setClickable(false);


        new LoginPresenter(new LoginContract.View() {
            @Override
            public void loginSucc(final String menuGroup) {
                SharedPreferences.Editor edit = mSp.edit();
                edit.putBoolean("savePwd", true);
                edit.putString("username", mName);
                edit.putString("pwd", mPwd);
                edit.commit();
                AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                    @Override
                    public void run() {
                        loginBtn.setCompleteText("登录成功");
                        loginBtn.setProgress(100);
                        DefaultContants.ISHTTPLOGIN = true;
                    }
                });
                mHandler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        Intent intent = new Intent(LoginActivity.this, MainActivity.class);

                        startActivity(intent);
                        finish();
                    }
                }, 800);

            }

            @Override
            public void loginFail(Throwable e) {
                if (e.getMessage().equals("密码错误")) {
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            userNameEditText.setEnabled(true);
                            passwordEditText.setEnabled(true);
                            loginBtn.setErrorText("密码错误，请重新登录");
                            loginBtn.setProgress(-1);
                            mHandler.postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    loginBtn.setClickable(true);
                                    loginBtn.setProgress(0);
                                }
                            }, 1600);
                        }
                    });
                } else {
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            userNameEditText.setEnabled(true);
                            passwordEditText.setEnabled(true);
                            loginBtn.setErrorText("登录失败，请重新登录");
                            loginBtn.setProgress(-1);

                            mHandler.postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    loginBtn.setClickable(true);
                                    loginBtn.setProgress(0);
                                }
                            }, 1600);
                        }
                    });

                }

            }
        }).login(mName, mPwd, mSp);

    }


    //下载apk
    private void donlowdApk() {
        if (mRxDialogLoading == null) {

            mRxDialogLoading = new RxDialogLoading(this, false, new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    dialogInterface.cancel();
                }
            });
        }
        mRxDialogLoading.setLoadingText("下载进度:0%");
        mRxDialogLoading.show();

        mNewDownloadUrl = ProgressManager.getInstance().addDiffResponseListenerOnSameUrl(Api.BASE_URL + "/gdWater/app/gdWater.apk", getDownloadListener());

        final OkHttpClient okHttpClient = ProgressManager.getInstance().with(new OkHttpClient.Builder())
                .build();

        Schedulers.io().createWorker().schedule(new Runnable() {
            @Override
            public void run() {
                try {
                    Request request = new Request.Builder()
                            .url(mNewDownloadUrl)
                            .build();

                    Response response = okHttpClient.newCall(request).execute();

                    InputStream is = response.body().byteStream();
                    mApkFile = new File(Environment.getExternalStorageDirectory().getPath(), "gdWater.apk");
                    mApkFile.mkdir();
                    if (mApkFile.exists()) {
                        mApkFile.delete();
                    }
                    FileOutputStream fos = new FileOutputStream(mApkFile);
                    BufferedInputStream bis = new BufferedInputStream(is);
                    byte[] buffer = new byte[1024];
                    int len;
                    while ((len = bis.read(buffer)) != -1) {
                        fos.write(buffer, 0, len);
                    }
                    fos.flush();
                    fos.close();
                    bis.close();
                    is.close();


                } catch (IOException e) {
                    e.printStackTrace();
                    //当外部发生错误时,使用此方法可以通知所有监听器的 onError 方法
                    ProgressManager.getInstance().notifyOnErorr(Api.BASE_URL + "/gdWater/app/gdWater.apk", e);
                }

            }
        });


    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBind.unbind();

    }

    private ProgressInfo mLastDownloadingInfo;

    public ProgressListener getDownloadListener() {
        return new ProgressListener() {
            @Override
            public void onProgress(ProgressInfo progressInfo) {
                // 如果你不屏蔽用户重复点击上传或下载按钮,就可能存在同一个 Url 地址,上一次的上传或下载操作都还没结束,
                // 又开始了新的上传或下载操作,那现在就需要用到 id(请求开始时的时间) 来区分正在执行的进度信息
                // 这里我就取最新的下载进度用来展示,顺便展示下 id 的用法

                if (mLastDownloadingInfo == null) {
                    mLastDownloadingInfo = progressInfo;
                }

                //因为是以请求开始时的时间作为 Id ,所以值越大,说明该请求越新
                if (progressInfo.getId() < mLastDownloadingInfo.getId()) {
                    return;
                } else if (progressInfo.getId() > mLastDownloadingInfo.getId()) {
                    mLastDownloadingInfo = progressInfo;
                }

                int progress = mLastDownloadingInfo.getPercent();

                mRxDialogLoading.setLoadingText("下载进度:" + progress + "%");

                if (progressInfo.isFinish()) {
                    //说明已经下载完成
                    AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                        @Override
                        public void run() {
                            RxToast.success(BaseApplication.getApplictaion(), "下载成功", Toast.LENGTH_SHORT).show();
                            mRxDialogLoading.cancel();
                            Intent intent = new Intent(Intent.ACTION_VIEW);
                            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            intent.setDataAndType(Uri.fromFile(mApkFile),
                                    "application/vnd.android.package-archive");
                            startActivity(intent);
                        }
                    });


                }
            }

            @Override
            public void onError(long id, final Exception e) {
                AndroidSchedulers.mainThread().createWorker().schedule(new Runnable() {
                    @Override
                    public void run() {
                        RxToast.error(BaseApplication.getApplictaion(), "下载失败，请检查网络和SD卡" + e.getMessage(), Toast.LENGTH_SHORT).show();

                    }
                });

            }
        };
    }


    private void requestPm() {
        PermissionUtil.with(this)
                .addPermission(Manifest.permission.READ_PHONE_STATE)
                .addPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
                .addPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
                .addPermission(Manifest.permission.WAKE_LOCK)
                .addPermission(Manifest.permission.RECEIVE_BOOT_COMPLETED)
                .addPermission(Manifest.permission.INTERNET)
                .addPermission(Manifest.permission.RECORD_AUDIO)
                .addPermission(Manifest.permission.CAMERA)
                .addPermission(Manifest.permission.ACCESS_NETWORK_STATE)
                .addPermission(Manifest.permission.ACCESS_COARSE_LOCATION)
                .addPermission(Manifest.permission.ACCESS_FINE_LOCATION)
                .initPermission();
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zhang.baselib.BaseApplication;
import com.zhang.baselib.ui.views.RxToast;
import com.zhang.okinglawenforcementphone.GreenDAOManager;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.SerchRecyAdapter;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTaskDao;
import com.zhang.okinglawenforcementphone.beans.GreenSearchHistory;
import com.zhang.okinglawenforcementphone.beans.GreenSearchHistoryDao;
import com.zhang.okinglawenforcementphone.beans.OkingContract;
import com.zhang.okinglawenforcementphone.beans.SeachBean;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;
import com.zhang.okinglawenforcementphone.views.DividerItemDecoration;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;
import com.zhy.view.flowlayout.TagFlowLayout;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class SerchActivity extends BaseActivity {

    @BindView(R.id.et_seach)
    EditText mEtSeach;
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.rcy_serch)
    RecyclerView mRcySerch;
    @BindView(R.id.seach_flow_layout)
    TagFlowLayout mSeachFlowLayout;
    @BindView(R.id.tv_tag)
    TextView mTvTag;
    @BindView(R.id.tv_clear)
    TextView mTvClear;
    private Unbinder mBind;
    private SerchRecyAdapter mSerchRecyAdapter;
    private List<SeachBean> seachBeans = new ArrayList<>();
    private String[] mStringArray;
    private TagAdapter<GreenSearchHistory> mTagAdapter;
    private List<GreenSearchHistory> mGreenSearchHistories;
    private Intent mIntent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_serch);
        mBind = ButterKnife.bind(this);
        initData();
        setListener();

    }

    private void setListener() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        mEtSeach.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void afterTextChanged(Editable editable) {
                if (editable.length() == 0) {
                    seachBeans.clear();
                    mRcySerch.setVisibility(View.GONE);
                    mTvTag.setText("搜索结果");
                    mSeachFlowLayout.setVisibility(View.GONE);
                }
            }
        });
        mEtSeach.setOnKeyListener(new View.OnKeyListener() {
            @Override
            public boolean onKey(View view, int keyCode, KeyEvent keyEvent) {
                if (keyCode == KeyEvent.KEYCODE_ENTER) {
                    // 先隐藏键盘
                    ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
                            .hideSoftInputFromWindow(SerchActivity.this.getCurrentFocus()
                                    .getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
                    //进行搜索操作的方法，在该方法中可以加入mEditSearchUser的非空判断
                    String trim = mEtSeach.getText().toString().trim();
                    if (!TextUtils.isEmpty(trim)) {

                        search(trim);
                    }


                }
                return false;
            }
        });
        mSeachFlowLayout.setOnTagClickListener(new TagFlowLayout.OnTagClickListener() {
            @Override
            public boolean onTagClick(View view, int position, FlowLayout parent) {
                search(mGreenSearchHistories.get(position).getSearchText());
                return false;
            }
        });

    }

    private void search(String trim) {
        GreenSearchHistory unique = GreenDAOManager.getInstence().getDaoSession().getGreenSearchHistoryDao()
                .queryBuilder().where(GreenSearchHistoryDao.Properties.UserId.eq(OkingContract.CURRENTUSER.getUserid()), GreenSearchHistoryDao.Properties.SearchText.eq(trim)).unique();
        if (unique == null) {
            GreenSearchHistory greenSearchHistory = new GreenSearchHistory();
            greenSearchHistory.setSearchText(trim);
            greenSearchHistory.setUserId(OkingContract.CURRENTUSER.getUserid());
            greenSearchHistory.setTime(System.currentTimeMillis());
            GreenDAOManager.getInstence().getDaoSession().getGreenSearchHistoryDao().insert(greenSearchHistory);
        }
        //查询任务
        List<GreenMissionTask> greenMissionTasks = GreenDAOManager.getInstence().getDaoSession().getGreenMissionTaskDao()
                .queryBuilder().where(GreenMissionTaskDao.Properties.Userid.eq(OkingContract.CURRENTUSER.getUserid()), GreenMissionTaskDao.Properties.Task_name.like("%" + trim + "%"))
                .list();
        seachBeans.clear();
        if (greenMissionTasks.size() > 0) {
            for (GreenMissionTask greenMissionTask : greenMissionTasks) {
                SeachBean seachBean = new SeachBean();
                seachBean.setItemType(0);
                seachBean.setPublisherName(greenMissionTask.getPublisher_name());
                seachBean.setState(greenMissionTask.getStatus());
                seachBean.setId(greenMissionTask.getId());
                seachBean.setTaskId(greenMissionTask.getTaskid());
                seachBean.setTaskName(greenMissionTask.getTask_name());
                seachBeans.add(seachBean);

            }


        } else {
            //去搜索菜单
            for (String s : mStringArray) {

                if (s.contains(trim)) {
                    SeachBean seachBean = new SeachBean();
                    seachBean.setItemType(1);
                    seachBean.setMenuItme(s);
                    seachBeans.add(seachBean);
                } else {

                }
            }

            if (seachBeans.size() == 0) {

                RxToast.warning("没有搜索到结果");
            }
        }

        mRcySerch.setVisibility(View.VISIBLE);
        mTvTag.setText("搜索结果");
        mSeachFlowLayout.setVisibility(View.GONE);
        if (mSerchRecyAdapter == null) {

            mSerchRecyAdapter = new SerchRecyAdapter(seachBeans);
            mSerchRecyAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
            mRcySerch.setAdapter(mSerchRecyAdapter);

            mSerchRecyAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
                @Override
                public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                    List<SeachBean> seachBeans = adapter.getData();
                    SeachBean seachBean = seachBeans.get(position);
                    switch (seachBean.getItemType()) {
                        case 0:
                            switch (seachBean.getState()) {
                                case "0":

                                case "1":

                                case "2":

                                    mIntent = new Intent(SerchActivity.this, ArrangeTeamMembersActivity.class);
                                    mIntent.putExtra("id", seachBean.getId());
                                    mIntent.putExtra("position", position);
                                    startActivity(mIntent);

                                    break;
                                case "3":
                                case "4":
                                    mIntent = new Intent(SerchActivity.this, MissionActivity.class);
                                    mIntent.putExtra("id", seachBean.getId());
                                    mIntent.putExtra("position", position);
                                    startActivity(mIntent);
                                    break;
                                case "100":
                                case "5":
                                case "9":
                                    mIntent = new Intent(SerchActivity.this, MissionRecorActivity.class);
                                    mIntent.putExtra("id", seachBean.getId());
                                    mIntent.putExtra("taskId", seachBean.getTaskId());
                                    startActivity(mIntent);

                                    break;
                                default:
                                    break;
                            }
                            break;

                        case 1:
                            switch (seachBean.getMenuItme()) {
                                case "一般任务":
                                    mIntent = new Intent(SerchActivity.this, PatrolsToReleaseActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "紧急任务":
                                    mIntent = new Intent(SerchActivity.this, TemporaryEmergencyTaskActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "待办":
                                    mIntent = new Intent(SerchActivity.this, ToDoActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "安排":
                                case "巡查任务接收安排":
                                    mIntent = new Intent(SerchActivity.this, TaskMissionProjectActivity.class);
                                    mIntent.putExtra("activity", "ArrangeMissionActivity");
                                    startActivity(mIntent);
                                    break;
                                case "任务执行":
                                case "执行":
                                    mIntent = new Intent(SerchActivity.this, TaskMissionProjectActivity.class);
                                    mIntent.putExtra("activity", "TaskExecutionActivity");
                                    startActivity(mIntent);
                                    break;
                                case "任务上报":
                                case "上报":
                                    mIntent = new Intent(SerchActivity.this, TaskMissionProjectActivity.class);
                                    mIntent.putExtra("activity", "ReportTaskActivity");
                                    startActivity(mIntent);
                                    break;
                                case "调查笔录":
                                case "笔录":
                                    mIntent = new Intent(SerchActivity.this, WrittenRecordActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "办案":
                                    mIntent = new Intent(SerchActivity.this, CaseManagerActivity.class);
                                    mIntent.putExtra("position", 0);
                                    startActivity(mIntent);
                                    break;
                                case "现场勘验":
                                case "勘验":
                                    mIntent = new Intent(SerchActivity.this, SceneInquestActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "日志统计":
                                case "统计":
                                    mIntent = new Intent(SerchActivity.this, StatisticalActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "执法":
                                    mIntent = new Intent(SerchActivity.this, LawEnforcementManagerActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "日志(已完成)":
                                case "日志":
                                    mIntent = new Intent(SerchActivity.this, TaskMissionProjectActivity.class);
                                    mIntent.putExtra("activity", "CompleteListActivity");
                                    startActivity(mIntent);
                                    break;
                                case "轨迹管理":
                                case "轨迹":
                                    mIntent = new Intent(SerchActivity.this, TaskMissionProjectActivity.class);
                                    mIntent.putExtra("activity", "TrajectoryListActivity");
                                    startActivity(mIntent);
                                    break;
                                case "全部":
                                    mIntent = new Intent(SerchActivity.this, AllActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "责令停止违法行为通知":
                                    mIntent = new Intent(SerchActivity.this, FromAllLawEnforcementActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "水行政当场处罚决定书":
                                    mIntent = new Intent(SerchActivity.this, FromAllPenaltyTheSpotActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "法律法规库":
                                    mIntent = new Intent(SerchActivity.this, FromAllLawsAndRegulationsActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "执法规范":
                                    mIntent = new Intent(SerchActivity.this, FromAllLawEnforcementSpecificationActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "预立案":
                                    mIntent = new Intent(SerchActivity.this, FromAllCaseInAdvanceActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "案例库":
                                    mIntent = new Intent(SerchActivity.this, PuttedForwardConActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "地图查询":
                                    mIntent = new Intent(SerchActivity.this, MapQueryActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "地图任务展示":
                                    mIntent = new Intent(SerchActivity.this, MapTaskActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "区域执法记录查询":
                                    mIntent = new Intent(SerchActivity.this, RegionalHistoryEnforcementActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "案件登记":
                                    mIntent = new Intent(SerchActivity.this, FromAllCaseRegistrationActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "案件受理":
                                    mIntent = new Intent(SerchActivity.this, FromAllOpenCasesActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "案件处理":
                                    mIntent = new Intent(SerchActivity.this, FromAllCaseProcessingListActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "案件转办":
                                    mIntent = new Intent(SerchActivity.this, FromAllCaseComplaintActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "修改密码":
                                    mIntent = new Intent(SerchActivity.this, ChangePasswordActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "意见反馈":
                                    mIntent = new Intent(SerchActivity.this, FeedbackActivity.class);
                                    startActivity(mIntent);
                                    break;
                                case "关于":
                                    mIntent = new Intent(SerchActivity.this, AboutActivity.class);
                                    startActivity(mIntent);
                                    break;
                                default:
                                    break;

                            }

                            break;
                        default:
                            break;
                    }
                }
            });

        } else {
            mSerchRecyAdapter.setNewData(seachBeans);
        }

    }

    private void initData() {
        mStringArray = getResources().getStringArray(R.array.menus);
        mRcySerch.setLayoutManager(new LinearLayoutManager(BaseApplication.getApplictaion(), LinearLayoutManager.VERTICAL, false));
        mRcySerch.addItemDecoration(new DividerItemDecoration(BaseApplication.getApplictaion(), 0, 20, getResources().getColor(R.color.activity_bg)));
        mGreenSearchHistories = GreenDAOManager.getInstence().getDaoSession().getGreenSearchHistoryDao()
                .queryBuilder().where(GreenSearchHistoryDao.Properties.UserId.eq(OkingContract.CURRENTUSER.getUserid()))
                .list();
        if (mGreenSearchHistories.size() > 0) {
            mTagAdapter = new TagAdapter<GreenSearchHistory>(mGreenSearchHistories) {
                @Override
                public View getView(FlowLayout parent, int position, GreenSearchHistory greenSearchHistory) {
                    View inflate = View.inflate(BaseApplication.getApplictaion(), R.layout.search_history_item, null);
                    TextView tvTitle = inflate.findViewById(R.id.tv_title);
                    tvTitle.setText(mGreenSearchHistories.get(position).getSearchText());
                    return inflate;
                }
            };
            mSeachFlowLayout.setAdapter(mTagAdapter);
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBind.unbind();
    }

    @OnClick(R.id.tv_clear)
    public void onViewClicked() {
        if (mGreenSearchHistories.size() > 0) {
            GreenDAOManager.getInstence().getDaoSession().getGreenSearchHistoryDao().deleteAll();
            mGreenSearchHistories.clear();
            mTagAdapter.notifyDataChanged();

        }

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.model;

import android.util.Log;

import com.google.gson.Gson;
import com.zhang.baselib.http.schedulers.RxSchedulersHelper;
import com.zhang.okinglawenforcementphone.beans.JPushMessageBean;
import com.zhang.okinglawenforcementphone.jpush.clien.JPushAPI;
import com.zhang.okinglawenforcementphone.jpush.clien.JPushClienService;
import com.zhang.okinglawenforcementphone.jpush.clien.JPushHttpFactory;
import com.zhang.okinglawenforcementphone.mvp.contract.JPushMessageContract;

import io.reactivex.functions.Consumer;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;

/**
 * Created by Administrator on 2018/8/27/027.
 */

public class JPushMessageModel implements JPushMessageContract.Model {
    private JPushMessageContract.Presenter mPresenter;

    public JPushMessageModel(JPushMessageContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void pushMessage(JPushMessageBean jPushMessageBean) {

        String s = new Gson().toJson(jPushMessageBean);
        Log.i("Oking5", s);
        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), s);

        JPushHttpFactory.getInstence().createService(JPushClienService.class, JPushAPI.BASE_URL)
                .pushMessage(requestBody)
                .compose(RxSchedulersHelper.<ResponseBody>io_main())
                .subscribe(new Consumer<ResponseBody>() {
                    @Override
                    public void accept(ResponseBody responseBody) throws Exception {
                        mPresenter.pushMessageSucc("推送成功");
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        mPresenter.pushMessageFail(throwable);
                    }
                });
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.presenter;

import com.zhang.okinglawenforcementphone.mvp.contract.LoadAcceptNumberContract;
import com.zhang.okinglawenforcementphone.mvp.model.LoadAcceptNumberModel;

/**
 * Created by Administrator on 2018/6/9/009.
 */

public class LoadAcceptNumberPresenter implements LoadAcceptNumberContract.Presenter {
    private LoadAcceptNumberContract.Model mModel;
    private LoadAcceptNumberContract.View mView;

    public LoadAcceptNumberPresenter(LoadAcceptNumberContract.View view) {
        mView = view;
        mModel = new LoadAcceptNumberModel(this);
    }

    @Override
    public void loadAcceptNumber() {
        mModel.loadAcceptNumber();
    }

    @Override
    public void loadAcceptNumberSucc(String result) {
        mView.loadAcceptNumberSucc(result);
    }

    @Override
    public void loadAcceptNumberFail(Throwable ex) {
        mView.loadAcceptNumberFail(ex);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

import java.util.List;

/**
 * Created by Administrator on 2018/6/9/009.
 */

public class SmameLeveOV {

    /**
     * data : {"msg":"获人员成功！","records":[{"DEPTID":"001007","DEPTNAME":"西江局水政监察支队"},{"DEPTID":"001003","DEPTNAME":"汕头水政监察支队"},{"DEPTID":"001005","DEPTNAME":"广州市水务局执法监察支队"},{"DEPTID":"001001","DEPTNAME":"广东省水利厅水利水政监察局"},{"DEPTID":"001002","DEPTNAME":"中山水政监察支队"},{"DEPTID":"001006","DEPTNAME":"德庆水政监察大队"}]}
     * status : 1
     */

    private DataBean data;
    private String status;

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public static class DataBean {
        /**
         * msg : 获人员成功！
         * records : [{"DEPTID":"001007","DEPTNAME":"西江局水政监察支队"},{"DEPTID":"001003","DEPTNAME":"汕头水政监察支队"},{"DEPTID":"001005","DEPTNAME":"广州市水务局执法监察支队"},{"DEPTID":"001001","DEPTNAME":"广东省水利厅水利水政监察局"},{"DEPTID":"001002","DEPTNAME":"中山水政监察支队"},{"DEPTID":"001006","DEPTNAME":"德庆水政监察大队"}]
         */

        private String msg;
        private List<RecordsBean> records;

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public List<RecordsBean> getRecords() {
            return records;
        }

        public void setRecords(List<RecordsBean> records) {
            this.records = records;
        }

        public static class RecordsBean {
            /**
             * DEPTID : 001007
             * DEPTNAME : 西江局水政监察支队
             */

            private String DEPTID;
            private String DEPTNAME;

            public String getDEPTID() {
                return DEPTID;
            }

            public void setDEPTID(String DEPTID) {
                this.DEPTID = DEPTID;
            }

            public String getDEPTNAME() {
                return DEPTNAME;
            }

            public void setDEPTNAME(String DEPTNAME) {
                this.DEPTNAME = DEPTNAME;
            }
        }
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.activitys;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.zhang.baselib.BaseApplication;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.adapter.ExpandableItemCaseRegistAdapter;
import com.zhang.okinglawenforcementphone.beans.WrittenItemBean;
import com.zhang.okinglawenforcementphone.beans.WrittenRecordLevel0;
import com.zhang.okinglawenforcementphone.mvp.ui.base.BaseActivity;
import com.zhang.okinglawenforcementphone.views.DividerItemDecoration;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class FromAllCaseRegistrationActivity extends BaseActivity {

    @BindView(R.id.case_regist_Recy)
    RecyclerView mCaseRegistRecy;
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    private Unbinder mBind;

    private WrittenRecordLevel0 mWrittenRecordLevel0;
    private WrittenItemBean mWrittenItemBean;
    private ExpandableItemCaseRegistAdapter mExpandableItemCaseRegistAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_from_all_case_registration);
        mBind = ButterKnife.bind(this);
        initData();
        setListener();

    }

    private void setListener() {
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    private void initData() {
        mCaseRegistRecy.setNestedScrollingEnabled(false);
        mCaseRegistRecy.setLayoutManager(new LinearLayoutManager(BaseApplication.getApplictaion(), LinearLayoutManager.VERTICAL, false));
        mCaseRegistRecy.addItemDecoration(new DividerItemDecoration(BaseApplication.getApplictaion(), 0, 3, BaseApplication.getApplictaion().getResources().getColor(R.color.bottom_nav_normal)));

        if (mExpandableItemCaseRegistAdapter == null) {

            mExpandableItemCaseRegistAdapter = new ExpandableItemCaseRegistAdapter(generateData());
            mCaseRegistRecy.setAdapter(mExpandableItemCaseRegistAdapter);
        }
        mExpandableItemCaseRegistAdapter.expand(0);
    }

    private List<MultiItemEntity> generateData() {

        ArrayList<MultiItemEntity> res = new ArrayList<>();

        mWrittenRecordLevel0 = new WrittenRecordLevel0("案件来源");
        mWrittenItemBean = new WrittenItemBean();
        mWrittenItemBean.setItemType(1);
        mWrittenRecordLevel0.addSubItem(mWrittenItemBean);
        res.add(mWrittenRecordLevel0);

        mWrittenRecordLevel0 = new WrittenRecordLevel0("上传证据");
        mWrittenItemBean = new WrittenItemBean();
        mWrittenItemBean.setItemType(2);
        mWrittenRecordLevel0.addSubItem(mWrittenItemBean);
        res.add(mWrittenRecordLevel0);

        mWrittenRecordLevel0 = new WrittenRecordLevel0("基本信息(可选)");
        mWrittenItemBean = new WrittenItemBean();
        mWrittenItemBean.setItemType(3);
        mWrittenRecordLevel0.addSubItem(mWrittenItemBean);
        res.add(mWrittenRecordLevel0);

        return res;

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBind.unbind();
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.zhang.okinglawenforcementphone.beans.GreenMedia;

import java.util.ArrayList;


/**
 * Created by zhao on 2016/10/9.
 */

public abstract class SimpleGridViewAdapter extends BaseAdapter {

    private ArrayList<GreenMedia> mGreenMedias;

    public SimpleGridViewAdapter(ArrayList<GreenMedia> greenMedias) {
        this.mGreenMedias = greenMedias;
    }

    @Override
    public int getCount() {
        return mGreenMedias.size() + 1;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public abstract View getView(int i, View view, ViewGroup viewGroup);
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.AllMenuItemBean;

import java.util.List;

/**
 * Created by Administrator on 2018/5/16.
 */

public class AllMenuSubRecyAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    public AllMenuSubRecyAdapter(int layoutResId, @Nullable List<String> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.tv_sub, item);

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenMissionTask;

import java.util.List;

/**
 * Created by Administrator on 2018/5/18/018.
 */

public class NoCompleteTaskListRecyAdapter extends BaseQuickAdapter<GreenMissionTask, BaseViewHolder> {
    public NoCompleteTaskListRecyAdapter(int layoutResId, @Nullable List<GreenMissionTask> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GreenMissionTask item) {
        helper.setText(R.id.tv_taskname, "任务名称：" + item.getTask_name());
        helper.setText(R.id.tv_taskid, "任务编号：" + item.getTaskid());
        helper.setText(R.id.tv_fbr, "发布人：" + item.getPublisher_name());

        if (item.getExamine_status() == -1) {
            if ("0".equals(item.getStatus())) {
                helper.setText(R.id.tv_state, "任务状态：未发布");
            } else if ("1".equals(item.getStatus())) {
                helper.setText(R.id.tv_state, "任务状态：已发布待审核");
            } else if ("2".equals(item.getStatus())) {
                helper.setText(R.id.tv_state, "任务状态：审核通过");
            } else if ("3".equals(item.getStatus())) {
                helper.setText(R.id.tv_state, "任务状态：已分配队员待执行");
            } else if ("4".equals(item.getStatus())) {
                helper.setText(R.id.tv_state, "任务状态：任务开始");
            } else if ("5".equals(item.getStatus())) {
                helper.setText(R.id.tv_state, "任务状态：任务完成");
            } else if ("7".equals(item.getStatus())) {
                helper.setText(R.id.tv_state, "任务状态：审核不通过");
            } else if ("100".equals(item.getStatus())) {
                helper.setText(R.id.tv_state, "任务状态：巡查结束，待上传");
            }

        } else {
            helper.setText(R.id.tv_state, "任务状态：等待领导批示");

        }

    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.contract;

import java.util.Map;

import retrofit2.http.Query;

/**
 * Created by Administrator on 2018/6/7/007.
 */

public interface TaskBackContract {
    interface Model {
       void taskBack(Map<String, Object> params);


    }

    interface View {
        void taskBackSucc(String result);
        void taskBackFail(Throwable ex);
    }

    interface Presenter {
        void taskBack(Map<String, Object> params);
        void taskBackSucc(String result);
        void taskBackFail(Throwable ex);
    }

}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.presenter;

import com.zhang.okinglawenforcementphone.beans.GreenEvidence;
import com.zhang.okinglawenforcementphone.beans.GreenEvidenceMedia;
import com.zhang.okinglawenforcementphone.beans.GreenMedia;
import com.zhang.okinglawenforcementphone.mvp.contract.UploadEvidenceContract;
import com.zhang.okinglawenforcementphone.mvp.model.UploadEvidenceModel;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/5/8/008.
 */

public class UploadEvidencePresenter implements UploadEvidenceContract.Presenter {
    private UploadEvidenceContract.Model mModel;
    private UploadEvidenceContract.View mView;

    public UploadEvidencePresenter(UploadEvidenceContract.View view) {
        mView = view;
        mModel = new UploadEvidenceModel(this);
    }

    @Override
    public void uploadEvidence(Map<String, Object> fields, GreenEvidence evidence, List<GreenEvidenceMedia> picGreenMedias) {
        mModel.uploadEvidence(fields,evidence,picGreenMedias);
    }

    @Override
    public void uploadEvidenceSucc(String result) {
        mView.uploadEvidenceSucc(result);
    }

    @Override
    public void uploadEvidenceFail(Throwable ex) {
        mView.uploadEvidenceFail(ex);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhang.okinglawenforcementphone.R;
import com.zhang.okinglawenforcementphone.beans.GreenEvidence;

import java.util.List;


/**
 * Created by Administrator on 2018/2/24.
 */

public class CaseAudioVideoEvidenceListRecyAdapter extends BaseQuickAdapter<GreenEvidence, BaseViewHolder> {
    public CaseAudioVideoEvidenceListRecyAdapter(int layoutResId, @Nullable List<GreenEvidence> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GreenEvidence item) {

        helper.setText(R.id.zjmc_tv, item.getZJMC());
        helper.setText(R.id.cjdd_tv, item.getCJDD());
        helper.setText(R.id.zjnr_tv, item.getZJNR());

        if (item.getOtype().equals("YYSP")) {
            helper.setText(R.id.lx_tv, "语音、视频");
        } else if (item.getOtype().equals("SP")) {
            helper.setText(R.id.lx_tv, "视频");
        } else if (item.getOtype().equals("YY")) {
            helper.setText(R.id.lx_tv, "语音");
        }

        helper.addOnClickListener(R.id.upload_button)
                .addOnClickListener(R.id.delete_button)
                .addOnClickListener(R.id.edit_button);

        if (item.getIsUpload()) {
            helper.setVisible(R.id.upload_button, false);
            helper.setVisible(R.id.delete_button, false);
            helper.setText(R.id.edit_button, "查看");
        }

    }
}
<file_sep>package com.zhang.baselib.utils;

import android.content.Context;
import android.content.Intent;

/**
 * Created by Administrator on 2018/4/29/029.
 */

public class IntentUtil {
    /**
     * 获取打开App的意图
     *
     * @param context     上下文
     * @param packageName 包名
     * @return 意图
     */
    public static Intent getLaunchAppIntent(Context context, String packageName) {
        return getIntentByPackageName(context, packageName);
    }

    /**
     * 根据包名获取意图
     *
     * @param context     上下文
     * @param packageName 包名
     * @return 意图
     */
    private static Intent getIntentByPackageName(Context context, String packageName) {
        return context.getPackageManager().getLaunchIntentForPackage(packageName);
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.beans;

/**
 * Created by Administrator on 2018/5/22/022.
 */

public class NewsTaskOV {
    public int mType;
    public String taskid;
    public GreenMissionTask mGreenMissionTask;

    public NewsTaskOV(int type, String taskid, GreenMissionTask greenMissionTask) {
        mType = type;
        this.taskid = taskid;
        mGreenMissionTask = greenMissionTask;
    }
}
<file_sep>package com.zhang.okinglawenforcementphone.mvp.ui.fragments;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.zhang.okinglawenforcementphone.R;


/**
 * 水行政执法禁令
 */
public class AdministrativeEnforcementFragment extends Fragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    private ListView mLv;
    private View mInflate;


    public AdministrativeEnforcementFragment() {
        // Required empty public constructor
    }

    public static AdministrativeEnforcementFragment newInstance(String param1, String param2) {
        AdministrativeEnforcementFragment fragment = new AdministrativeEnforcementFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (mInflate==null){

            mInflate = inflater.inflate(R.layout.fragment_administrative_enforcement, container, false);
        }
        initView(mInflate);

        return mInflate;
    }


    public void initView(View rootView) {
        mLv = rootView.findViewById(R.id.lv);
        initData();
        setListener();
    }

    private void setListener() {

    }

    private void initData() {
        final String[] administrationBanArray = getResources().getStringArray(R.array.lv_administration_ban);
        mLv.setAdapter(new BaseAdapter() {
            @Override
            public int getCount() {
                return administrationBanArray.length;
            }

            @Override
            public Object getItem(int i) {
                return null;
            }

            @Override
            public long getItemId(int i) {
                return 0;
            }

            @Override
            public View getView(int position, View contentView, ViewGroup viewGroup) {
                TextView textView = new TextView(getActivity());
                textView.setPadding(10,10,10,10);
                textView.setTextSize(12);
                textView.setTextColor(Color.RED);
                textView.setText(administrationBanArray[position]);
                return textView;
            }
        });
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        if (mInflate != null) {
            ViewGroup parent = (ViewGroup) mInflate.getParent();
            if (parent != null) {
                parent.removeView(mInflate);
            }

        }
    }
}
