ソースを参照

6.21.3 我的页面重写

Moon 6 年 前
コミット
30c50fd35f

+ 12 - 22
app/src/main/java/com/silence/commonframe/activity/CoustomerActivity.java

@@ -11,40 +11,30 @@ import android.view.Window;
 import android.view.WindowManager;
 
 import com.silence.commonframe.R;
+import com.silence.commonframe.base.basemvp.BaseActivity;
 
-public class CoustomerActivity extends AppCompatActivity {
+public class CoustomerActivity extends BaseActivity {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_coustomer);
-        initWindows();
+    public int getLayoutId() {
+        return R.layout.activity_coustomer;
+    }
+
+    @Override
+    public void initPresenter() {
 
     }
 
-    public void click(View view) {
-        finish();
+    @Override
+    public void initView() {
+        setTitle(this,"客服电话","",true);
     }
 
     public void diallPhone(View view) {
         Intent intent = new Intent(Intent.ACTION_DIAL);
-        Uri data = Uri.parse("tel:" + "4006005531");
+        Uri data = Uri.parse("tel:" + getResources().getString(R.string.tel));
         intent.setData(data);
         startActivity(intent);
-
     }
 
-
-    private void initWindows() {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-            Window window = getWindow();
-            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
-                    | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
-            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
-                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
-            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
-            window.setStatusBarColor(Color.TRANSPARENT);
-            window.setNavigationBarColor(Color.BLACK);
-        }
-    }
 }

+ 133 - 7
app/src/main/java/com/silence/commonframe/activity/HistoryActivity.java

@@ -29,7 +29,10 @@ import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
 import com.silence.commonframe.ApiService;
 import com.silence.commonframe.Dialog.CDialog;
 import com.silence.commonframe.R;
+import com.silence.commonframe.activity.Interface.HistoryListener;
+import com.silence.commonframe.activity.presenter.HistoryPresenter;
 import com.silence.commonframe.adapter.FireAlarmAdapter;
+import com.silence.commonframe.base.basemvp.BaseActivity;
 import com.silence.commonframe.bean.JsonBean;
 import com.silence.commonframe.common.constant.BaseConstants;
 import com.silence.commonframe.model.FireAlarmModel;
@@ -51,7 +54,7 @@ import butterknife.ButterKnife;
 import okhttp3.Call;
 import okhttp3.Response;
 
-public class HistoryActivity extends AppCompatActivity {
+public class HistoryActivity extends BaseActivity implements HistoryListener.View {
 
    @BindView(R.id.my_recycler_view)
     RecyclerView myRecyclerView;
@@ -66,13 +69,52 @@ public class HistoryActivity extends AppCompatActivity {
     private String id;
     private int page=1;
 
+    private int itemPosition;
+
+    HistoryPresenter presenter;
+
+//    @Override
+//    protected void onCreate(Bundle savedInstanceState) {
+//        super.onCreate(savedInstanceState);
+//        setContentView(R.layout.activity_history);
+//        ButterKnife.bind(this);
+//        AtyContainer.getInstance().addActivity(this);
+//        // getData();
+//        getData1();
+//        initWindows();
+//
+//        mAdapter = new FireAlarmAdapter(HistoryActivity.this, listmap, myItemClickListener);
+//        myRecyclerView.setLayoutManager(new LinearLayoutManager(HistoryActivity.this));
+//        myRecyclerView.setAdapter(mAdapter);
+//
+//        srlRefresh.setOnRefreshListener(new OnRefreshListener() {
+//            @Override
+//            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+//                page=1;
+//                getData1();
+//            }
+//        });
+//        srlRefresh.setOnLoadMoreListener(new OnLoadMoreListener() {
+//            @Override
+//            public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
+//                page++;
+//                getData1();
+//            }
+//        });
+//    }
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.activity_history;
+    }
+
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_history);
-        ButterKnife.bind(this);
-        AtyContainer.getInstance().addActivity(this);
-        // getData();
+    public void initPresenter() {
+        presenter = new HistoryPresenter(this,this);
+    }
+
+    @Override
+    public void initView() {
         getData1();
         initWindows();
 
@@ -169,6 +211,7 @@ public class HistoryActivity extends AppCompatActivity {
                                 @Override
                                 public void onclick(View view, int position) {
                                     id = Data.getListIdKnowid().get(position);
+                                    itemPosition = position;
                                     getKnowMessage();
                                 }
                             });
@@ -217,7 +260,90 @@ public class HistoryActivity extends AppCompatActivity {
 
                 });
     }
+
     public void myclick(View view) {
         finish();
     }
+
+    @Override
+    public int getPage() {
+        return page;
+    }
+
+    @Override
+    public String getProcessId() {
+        return id;
+    }
+
+    @Override
+    public int getItemPosition() {
+        return itemPosition;
+    }
+
+    @Override
+    public void onSuccess(List<FireAlarmModel.DataBean> dataBean) {
+        if (page==1) listmap.clear();
+        for (int i = 0; i < dataBean.size(); i++) {
+            HashMap<String, String> hashMap = new HashMap<>();
+            String deviceName = dataBean.get(i).getDeviceName();
+            String deployment = dataBean.get(i).getDeployment();
+            String deviceLocation = dataBean.get(i).getDeviceLocation();
+            String troubleType = dataBean.get(i).getTroubleType();
+            String deviceId = dataBean.get(i).getDeviceId();
+            String regionName = dataBean.get(i).getRegionName();
+            String gmtCreate = dataBean.get(i).getGmtCreate();
+            String location = dataBean.get(i).getLocation();
+            String ifRead = dataBean.get(i).getIfRead();
+            String id = dataBean.get(i).getId();
+
+            hashMap.put("deviceName", deviceName);
+            hashMap.put("deployment", deployment);
+            hashMap.put("deviceLocation", deviceLocation);
+            hashMap.put("troubleType", troubleType);
+            hashMap.put("deviceId", deviceId);
+            hashMap.put("regionName", regionName);
+            hashMap.put("gmtCreate", gmtCreate);
+            hashMap.put("location", location);
+            hashMap.put("ifRead", ifRead);
+            hashMap.put("id", id);
+
+            listmap.add(hashMap);
+            listIdKnown.add(id);
+        }
+        Data.setListIdKnowid(listIdKnown);
+        mAdapter.notifyDataSetChanged();
+        if (listmap.size() == 0) {
+            no_message.setVisibility(View.VISIBLE);
+        }
+        mAdapter.buttonSetOnclick(new FireAlarmAdapter.ButtonInterface() {
+            @Override
+            public void onclick(View view, int position) {
+                id = Data.getListIdKnowid().get(position);
+                itemPosition = position;
+                presenter.getKnowMessage();
+            }
+        });
+        if (srlRefresh!=null){
+            srlRefresh.finishRefresh();
+            srlRefresh.finishLoadMore();
+        }
+    }
+
+    @Override
+    public void onError() {
+        if (srlRefresh!=null){
+            srlRefresh.finishRefresh();
+            srlRefresh.finishLoadMore();
+        }
+    }
+
+    @Override
+    public void onReadSuccess(int position) {
+
+    }
+
+    @Override
+    public void onFile(String msg) {
+        Toast.makeText(this,""+msg,Toast.LENGTH_SHORT).show();
+    }
 }

+ 24 - 0
app/src/main/java/com/silence/commonframe/activity/Interface/HistoryListener.java

@@ -0,0 +1,24 @@
+package com.silence.commonframe.activity.Interface;
+
+import com.silence.commonframe.base.basemvp.BaseModel;
+import com.silence.commonframe.base.basemvp.BasePresenter;
+import com.silence.commonframe.model.FireAlarmModel;
+
+import java.util.List;
+
+public interface HistoryListener {
+    interface View{
+        int getPage();
+        String getProcessId();
+        int getItemPosition();
+
+        void onSuccess(List<FireAlarmModel.DataBean> dataBean);
+        void onError();
+        void onReadSuccess(int position);
+        void onFile(String msg);
+    }
+    abstract class Presenter extends BasePresenter<View, BaseModel> {
+        public abstract void getData();
+        public abstract void getKnowMessage();
+    }
+}

+ 21 - 0
app/src/main/java/com/silence/commonframe/activity/Interface/SiteDetailListener.java

@@ -0,0 +1,21 @@
+package com.silence.commonframe.activity.Interface;
+
+import com.silence.commonframe.base.basemvp.BaseModel;
+import com.silence.commonframe.base.basemvp.BasePresenter;
+import com.silence.commonframe.model.SiteModel;
+
+public interface SiteDetailListener {
+    interface View{
+        String getIds();
+        int getPage();
+
+        void onDelSuccess();
+        void onDelError();
+        void onGetSiteSuccess(SiteModel.DataBean data);
+        void onFile(String msg);
+    }
+    abstract class Presenter extends BasePresenter<View,BaseModel> {
+        public abstract void delSite();
+        public abstract void getSite();
+    }
+}

+ 3 - 12
app/src/main/java/com/silence/commonframe/activity/NewSubmitActivity.java

@@ -7,7 +7,6 @@ import android.content.Intent;
 import android.database.Cursor;
 import android.media.MediaPlayer;
 import android.net.Uri;
-import android.os.Bundle;
 import android.provider.MediaStore;
 import android.support.v7.widget.GridLayoutManager;
 import android.support.v7.widget.RecyclerView;
@@ -30,7 +29,6 @@ import com.google.gson.Gson;
 import com.mylhyl.acp.Acp;
 import com.mylhyl.acp.AcpListener;
 import com.mylhyl.acp.AcpOptions;
-import com.silence.commonframe.ApiService;
 import com.silence.commonframe.Dialog.LoadingDialog;
 import com.silence.commonframe.Dialog.TakePhotoPopwindow;
 import com.silence.commonframe.R;
@@ -39,19 +37,13 @@ import com.silence.commonframe.activity.presenter.NewSubmitPresenter;
 import com.silence.commonframe.adapter.NewSubmitAdapter;
 import com.silence.commonframe.base.basemvp.BaseActivity;
 import com.silence.commonframe.bean.PhotoNormalBean;
-import com.silence.commonframe.common.constant.BaseConstants;
 import com.silence.commonframe.model.TroubleDeviceModel;
-import com.silence.commonframe.model.UploadModel;
 import com.silence.commonframe.soundrecording.AudioRecoderUtils;
 import com.silence.commonframe.soundrecording.PopupWindowFactory;
 import com.silence.commonframe.soundrecording.TimeUtils;
-import com.silence.commonframe.utils.AtyContainer;
 
-import java.io.File;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.EventListener;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Timer;
 import java.util.TimerTask;
@@ -161,7 +153,7 @@ public class NewSubmitActivity extends BaseActivity implements NewSubmitListener
         mPop = new PopupWindowFactory(this, view);
         format = new SimpleDateFormat("mm:ss");
         takePhotoPopwindow=new TakePhotoPopwindow(this);
-        loadingDialog=new LoadingDialog();
+
         mImageView = (ImageView) view.findViewById(R.id.iv_recording_icon);
         mTextView = (TextView) view.findViewById(R.id.tv_recording_time);
         if (mMediaPlayer == null) mMediaPlayer = new MediaPlayer();
@@ -259,7 +251,6 @@ public class NewSubmitActivity extends BaseActivity implements NewSubmitListener
                 ivVideo.setImageResource(R.mipmap.addvideo);
                 break;
             case R.id.btn_next:
-                loadingDialog.loadind(this,btnNext).showLoading();
                 presenter.putData();
                 break;
             case R.id.iv_back:
@@ -339,7 +330,7 @@ public class NewSubmitActivity extends BaseActivity implements NewSubmitListener
 
     @Override
     public void onSuccess(String msg) {
-        loadingDialog.loadind(this,btnNext).dismissLoading();
+
         Toast.makeText(NewSubmitActivity.this,"火警信息上报成功", Toast.LENGTH_LONG).show();
         setResult(2);
         finish();
@@ -349,7 +340,7 @@ public class NewSubmitActivity extends BaseActivity implements NewSubmitListener
 
     @Override
     public void onFile(String msg) {
-        loadingDialog.loadind(this,btnNext).dismissLoading();
+
         Toast.makeText(NewSubmitActivity.this, msg, Toast.LENGTH_LONG).show();
     }
 

+ 2 - 0
app/src/main/java/com/silence/commonframe/activity/NewsdetailActivity.java

@@ -103,6 +103,7 @@ public class NewsdetailActivity extends BaseActivity implements NewsDetailListen
     @Override
     public void initView() {
         initWindows();
+
         Intent intent = getIntent();
         //  list1 = (List<HashMap<String, String>>) bundle.getSerializable("listmap");
         String jsonData = getIntent().getStringExtra("listmap");
@@ -185,6 +186,7 @@ public class NewsdetailActivity extends BaseActivity implements NewsDetailListen
         recheckMsgAdapter = new RecheckMsgAdapter(R.layout.item_recheckmsg,dataBean,itemClickListener);
         RecyclerView_RecheckMsg.setLayoutManager(new LinearLayoutManager(NewsdetailActivity.this));
         RecyclerView_RecheckMsg.setAdapter(recheckMsgAdapter);
+        RecyclerView_RecheckMsg.setNestedScrollingEnabled(false);
         recheckMsgAdapter.notifyDataSetChanged();
     }
 

+ 143 - 254
app/src/main/java/com/silence/commonframe/activity/SitedetailActivity.java

@@ -5,6 +5,7 @@ import android.content.Intent;
 import android.graphics.Color;
 import android.os.Build;
 import android.os.Bundle;
+import android.support.annotation.NonNull;
 import android.support.v7.app.AppCompatActivity;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
@@ -22,10 +23,16 @@ import com.google.gson.Gson;
 import com.lzy.okgo.OkGo;
 import com.lzy.okgo.cache.CacheMode;
 import com.lzy.okgo.callback.StringCallback;
+import com.scwang.smartrefresh.layout.SmartRefreshLayout;
+import com.scwang.smartrefresh.layout.api.RefreshLayout;
+import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
 import com.silence.commonframe.ApiService;
 import com.silence.commonframe.R;
+import com.silence.commonframe.activity.Interface.SiteDetailListener;
+import com.silence.commonframe.activity.presenter.SiteDetailPresenter;
 import com.silence.commonframe.adapter.MyAdapter;
 import com.silence.commonframe.adapter.SitedetailMineAdapter;
+import com.silence.commonframe.base.basemvp.BaseActivity;
 import com.silence.commonframe.bean.IsDeviceChange;
 import com.silence.commonframe.bean.JsonBean;
 import com.silence.commonframe.model.IsChoose;
@@ -48,10 +55,9 @@ import butterknife.ButterKnife;
 import okhttp3.Call;
 import okhttp3.Response;
 
-public class SitedetailActivity extends AppCompatActivity {//implements View.OnClickListener
+public class SitedetailActivity extends BaseActivity implements SiteDetailListener.View {
     private List<HashMap<String, String>> listmap = new ArrayList<HashMap<String, String>>() ;
     private SitedetailMineAdapter myAdapter1;
-    private TitlePopupMenu titlePopup;
     private ArrayList<Integer>  listChose = new ArrayList<Integer>();
     private IsChoose isChoose;
     private ArrayList<IsChoose> arrayList;
@@ -61,12 +67,15 @@ public class SitedetailActivity extends AppCompatActivity {//implements View.OnC
     private String strId = "";
     StringBuilder str = new StringBuilder();
 
-   @BindView(R.id.my_recycler_view)
+    @BindView(R.id.my_recycler_view)
     RecyclerView  myRecyclerView;
-   @BindView(R.id.edit)
+    @BindView(R.id.edit)
     Button bt;
-   @BindView(R.id.delete)
-     Button btdel;
+    @BindView(R.id.delete)
+    Button btdel;
+   @BindView(R.id.srl_refresh)
+    SmartRefreshLayout srlRefresh;
+
     private ArrayList<String> listData = new ArrayList<>();
     private int iSSHOW = GONECHECK;
     private static final int GONECHECK = 0;
@@ -77,17 +86,25 @@ public class SitedetailActivity extends AppCompatActivity {//implements View.OnC
     List<String> listdata0 = Data.getList();
     ArrayList<Integer> listIndex = new ArrayList<>();
 
+    int page = 1;
+
+    SiteDetailPresenter presenter;
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.activity_sitedetail;
+    }
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_sitedetail);
-        ButterKnife.bind(this);
-        AtyContainer.getInstance().addActivity(this);
-        initWindows();
+    public void initPresenter() {
+        presenter = new SiteDetailPresenter(this,this);
+    }
+
+    @Override
+    public void initView() {
+        setTitle(this,"场所列表","",true);
         arrayList = new ArrayList<>();
         deleteArrayList = new ArrayList<>();
-        init();
         myAdapter1 = new SitedetailMineAdapter(SitedetailActivity.this,listmap,arrayList);
         myRecyclerView.setLayoutManager(new LinearLayoutManager(SitedetailActivity.this));
         myRecyclerView.setAdapter(myAdapter1);
@@ -98,32 +115,23 @@ public class SitedetailActivity extends AppCompatActivity {//implements View.OnC
                     iSSHOW = (iSSHOW == GONECHECK) ? SHOWCHECK : GONECHECK;
                     myAdapter1.setMode(iSSHOW);
                 }
-
             }
         });
 
         btdel.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-
-
                 if (deleteArrayList.size() == 0){
                     Toast.makeText(SitedetailActivity.this,"请选中对应删除的场所!",Toast.LENGTH_SHORT).show();
                     return;
-                }
-                if (deleteArrayList.size() > 5){
-                    Toast.makeText(SitedetailActivity.this,"请删除对应的对应数据不要大于5条",Toast.LENGTH_SHORT).show();
-                    return;
                 } else {
-
                     for (int i = 0; i < deleteArrayList.size(); i++) {
                         myAdapter1.remove(deleteArrayList.get(i));
                         //  myAdapter1.removeData(i);
                     }
                 }
                 getSiteId();
-                delSite();
-
+                presenter.delSite();
                 if (flagId.equals(Data.getListSiteid().toString())){
                     Toast.makeText(SitedetailActivity.this,"数据已经删除!",Toast.LENGTH_SHORT).show();
                     return;
@@ -131,25 +139,27 @@ public class SitedetailActivity extends AppCompatActivity {//implements View.OnC
                 flagId = Data.getListSiteid().toString();
             }
         });
-    }
 
-    @Override
-    protected void onResume() {
-        super.onResume();
-        int size = listmap.size();
-        if (size > 0){
-            listmap.clear();
-            listIndex.clear();
-            myRecyclerView.setAdapter(myAdapter1);
-            myAdapter1.notifyDataSetChanged();
-        }
-        getSite();
+        srlRefresh.setOnRefreshListener(new OnRefreshListener() {
+            @Override
+            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+                int size = listmap.size();
+                if (size > 0){
+                    listmap.clear();
+                    listIndex.clear();
+                    myRecyclerView.setAdapter(myAdapter1);
+                    myAdapter1.notifyDataSetChanged();
+                }
+                presenter.getSite();
+            }
+        });
+        srlRefresh.setEnableLoadMore(false);
+        srlRefresh.autoRefresh();
     }
 
     /**
      * 对设备的号码进行对应的拼接
      */
-
     private  void getSiteId(){
         for(int i = 0; i<Data.getListSiteid().size(); i++){
             str.append(Data.getListSiteid().get(i));
@@ -159,136 +169,6 @@ public class SitedetailActivity extends AppCompatActivity {//implements View.OnC
         str.setLength(0);
 
     }
-    private void delSite() {
-        String  url =   ApiService.httpUrl1+Data.getConfigUrl()+"/deleteSite?ids="+ strId;
-        OkGo.get(url)
-                .tag(this)                       // 请求的 tag, 主要用于取消对应的请求
-                .cacheKey("cacheGetKey")            // 设置当前请求的缓存key,建议每个不同功能的请求设置一个
-                .cacheMode(CacheMode.DEFAULT)    // 缓存模式,详细请看缓存介绍
-                .headers("token", Data.getToken())
-                .execute(new StringCallback() {
-                    @Override
-                    public void onSuccess(String s, Call call, Response response) {
-                        SiteModel siteModel = new Gson().fromJson(s,SiteModel.class);
-                        String message = siteModel.getMsg();
-                        int code = siteModel.getCode();
-                            if (message.equalsIgnoreCase("success")){
-                                Toast.makeText(SitedetailActivity.this,"数据删除成功!",Toast.LENGTH_SHORT).show();
-                                for (int i = 0;i<listIndex.size();i++){     //不需要删除的删掉
-                                    if (listIndex.get(i) == -1){
-                                        listIndex.remove(i);
-                                        i--;
-                                    }
-                                }
-                                Collections.sort(listIndex);        //对listIndex存的值排序
-                                for(int i = 0; i<Data.getListSiteid().size(); i++){
-                                    listdata0.remove((int)listIndex.get(Data.getListSiteid().size()-i-1));       //尾删,头删的话比较麻烦
-                                }
-                                Data.getListSiteid().clear();
-                                Data.setList(listdata0);                                 //上面可以直接Data.getList().remove()操作
-                                listIndex.clear();
-                                IsDeviceChange.setChangeSize(true);                     //判断设备页面场所列表要进行刷新
-                                onResume();
-                            }else {
-                                Toast.makeText(SitedetailActivity.this,""+message,Toast.LENGTH_SHORT).show();
-                                LoginIn.tokenOut(code,message,SitedetailActivity.this);
-                                iSSHOW = 0;
-                                deleteArrayList.clear();
-                                onResume();
-                                return;
-                            }
-                    }
-
-                });
-    }
-
-
-    private void init() {
-        titlePopup = new TitlePopupMenu(this, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
-        titlePopup.setItemOnClickListener(new TitlePopupMenu.OnItemOnClickListener() {
-            @Override
-            public void onItemClick(String desc) {
-                showToast(desc);
-            }
-        });
-        titlePopup.addItem(getResources().getDrawable(R.mipmap.homeadd),
-                "添加联系人");
-        titlePopup.addItem(getResources().getDrawable(R.mipmap.homeadd),
-                "删除联系人");
-    }
-
-    private void showToast(String msg) {
-        if (msg.equals("添加联系人")) {
-            Toast.makeText(this,"添加联系人!",Toast.LENGTH_SHORT).show();
-            android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this);
-            builder.setTitle("添加联系人");
-            //    通过LayoutInflater来加载一个xml的布局文件作为一个View对象
-            View view = LayoutInflater.from(this).inflate(R.layout.item_addsite, null);
-            //    设置我们自己定义的布局文件作为弹出框的Content
-            builder.setView(view);
-
-            final EditText username = (EditText)view.findViewById(R.id.deviceno);
-            builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
-                @Override
-                public void onClick(DialogInterface dialog, int which)
-                {
-                    String a = username.getText().toString().trim();
-                    getdata1();
-                }
-            });
-            builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
-                @Override
-                public void onClick(DialogInterface dialog, int which)
-                {
-
-                }
-            });
-            builder.show();
-
-        } else if (msg.equals("删除联系人")){
-            Intent intent = new Intent(this,AddSiteActivity.class);
-            startActivity(intent);
-        }
-
-    }
-    private void getdata1() {
-
-        HashMap<String, String> params = new HashMap<>();
-        params.put("siteid", "7");//id
-        params.put("name", "liming");
-        params.put("phone", "13124257879");
-        JSONObject jsonObject = new JSONObject(params);
-        String s = Data.getToken();
-        Log.v("Tag",s);
-        String str = jsonObject.toString();
-
-        OkGo.post(ApiService.httpUrl+"addlinkman")
-                .tag(this)
-                .cacheKey("cachePostRegister11")
-                .cacheMode(CacheMode.DEFAULT)
-                .upJson(jsonObject.toString())
-                .headers("token", Data.getToken())
-                .execute(new StringCallback() {
-                    @Override
-                    public void onSuccess(String s, Call call, Response response) {
-                        SiteModel siteModel = new Gson().fromJson(s,SiteModel.class);
-                        String message = siteModel.getMsg();
-                        int code = siteModel.getCode();
-                        //     LoginIn.tokenOut(code,message,getContext());
-                        if (message.equalsIgnoreCase("success")) {
-                            Toast.makeText(SitedetailActivity.this,"联系中人添加成功!"+s,Toast.LENGTH_SHORT).show();
-                        }else {
-                            return;
-                        }
-                    }
-
-                    @Override
-                    public void onError(Call call, Response response, Exception e) {
-                        super.onError(call, response, e);
-                        System.out.println("sss"+e);
-                    }
-                });
-    }
 
     private void initWindows() {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
@@ -303,98 +183,107 @@ public class SitedetailActivity extends AppCompatActivity {//implements View.OnC
         }
     }
 
-    private void   getSite(){
-        runOnUiThread(new Runnable() {
-            @Override
-            public void run() {
-                String url = ApiService.httpUrl1 +Data.getConfigUrl()+ "/getSite?page=1&pagesize=11";
-                OkGo.get(url)
-                        .tag(this)                       // 请求的 tag, 主要用于取消对应的请求
-                        .cacheKey("cacheGetKey")            // 设置当前请求的缓存key,建议每个不同功能的请求设置一个
-                        .cacheMode(CacheMode.DEFAULT)    // 缓存模式,详细请看缓存介绍
-                        .headers("token", Data.getToken())
-                        .execute(new StringCallback() {
-                            @Override
-                            public void onSuccess(String s, Call call, Response response) {
-
-                                SiteModel siteModel = new Gson().fromJson(s,SiteModel.class);
-                                String message = siteModel.getMsg();
-                                int code = siteModel.getCode();
-                                    if (message.equalsIgnoreCase("success")) {
-                                        final List<SiteModel.DataBean.DataListBean>  listBeans =  siteModel.getData().getDataList();
-                                        for (int i = 0;i<listBeans.size();i++){
-                                            isChoose = new IsChoose();
-                                            HashMap<String,String>  hashMap = new HashMap<>();
-                                            String RegionName = listBeans.get(i).getRegionName();//区域
-                                            String Location = listBeans.get(i).getLocation();//详细地址
-                                            String id = listBeans.get(i).getId();//设备id
-                                            String  deployment  = listBeans.get(i).getDeployment();//位置
-                                            System.out.println("id:"+ id);
-
-                                            hashMap.put("RegionName",RegionName);
-                                            hashMap.put("Location",Location);
-                                            hashMap.put("id",id);
-                                            hashMap.put("deployment",deployment);
-
-                                            listData.add(id);
-                                            //   listid.add(id);
-                                            listIndex.add(-1);
-                                            listmap.add(hashMap);
-                                            arrayList.add(isChoose);
-                                        }
-                                        myAdapter1.notifyDataSetChanged();
-                                        //设置分割线
-
-                                        //RecyclerView点击事件
-                                        myAdapter1.setOnItemClickLitener(new SitedetailMineAdapter.OnItemClickLitener() {
-                                            private IsChoose e;
-                                            @Override
-                                            public void onItemClick(View view, int position) {
-                                                //判断是否显示选择筐
-                                                if (iSSHOW == 1) {
-                                                    //获取当前条目然后设置是否为选中,这里没有直接用boolean值判断
-                                                    e = arrayList.get(position);
-
-                                                    if (e.getIsSelect() == 1) {
-                                                        //  e.setSelect(1);
-                                                        e.setIsSelect(0);
-                                                        listIndex.set(position,-1);     //listIndex中移除取消删除的值
-                                                        deleteArrayList.remove(e);
-                                                    } else {
-                                                        e.setIsSelect(1);
-                                                        listIndex.set(position,position);     //listIndex中加入要删除的值
-                                                        deleteArrayList.add(e);
-                                                    }
-                                                    myAdapter1.notifyDataSetChanged();
-                                                } else {
-                                                    Data.setLinkmanname(listData.get(position));
-                                                    Intent intent = new Intent(SitedetailActivity.this,SiteManagement.class);
-                                                    Bundle  bundle = new Bundle();
-                                                    bundle.putSerializable("listmap", listmap.get(position));
-                                                    intent.putExtras(bundle);
-                                                    startActivity(intent);
-                                                }
-                                            }
-                                            @Override
-                                            public void onItemLongClick(View view, final int position) {
-                                                //这里长按定义的是删除
-                                            }
-                                        });
-                                    }else {
-                                        LoginIn.tokenOut(code,message,SitedetailActivity.this);
-                                    }
-                            }
-                            @Override
-                            public void onError(Call call, Response response, Exception e) {
-                                super.onError(call, response, e);
-                            }
-                        });
+    @Override
+    public String getIds() {
+        return strId;
+    }
+
+    @Override
+    public int getPage() {
+        return page;
+    }
 
+    @Override
+    public void onDelSuccess() {
+        for (int i = 0;i<listIndex.size();i++){     //不需要删除的删掉
+            if (listIndex.get(i) == -1){
+                listIndex.remove(i);
+                i--;
+            }
+        }
+        Collections.sort(listIndex);        //对listIndex存的值排序
+        for(int i = 0; i<Data.getListSiteid().size(); i++){
+            listdata0.remove((int)listIndex.get(Data.getListSiteid().size()-i-1));       //尾删
+        }
+        Data.getListSiteid().clear();
+        Data.setList(listdata0);                                 //上面可以直接Data.getList().remove()操作
+        listIndex.clear();
+        IsDeviceChange.setChangeSize(true);                     //判断设备页面场所列表要进行刷新
+        srlRefresh.autoRefresh();
+    }
+
+    @Override
+    public void onDelError() {
+        iSSHOW = 0;
+        deleteArrayList.clear();
+        srlRefresh.autoRefresh();
+    }
+
+    @Override
+    public void onGetSiteSuccess(SiteModel.DataBean data) {
+        for (int i = 0;i<data.getDataList().size();i++){
+            isChoose = new IsChoose();
+            HashMap<String,String>  hashMap = new HashMap<>();
+            String RegionName = data.getDataList().get(i).getRegionName();//区域
+            String Location = data.getDataList().get(i).getLocation();//详细地址
+            String id = data.getDataList().get(i).getId();//设备id
+            String  deployment  = data.getDataList().get(i).getDeployment();//位置
+            System.out.println("id:"+ id);
+
+            hashMap.put("RegionName",RegionName);
+            hashMap.put("Location",Location);
+            hashMap.put("id",id);
+            hashMap.put("deployment",deployment);
+
+            listData.add(id);
+            //   listid.add(id);
+            listIndex.add(-1);
+            listmap.add(hashMap);
+            arrayList.add(isChoose);
+        }
+        myAdapter1.notifyDataSetChanged();
+        //设置分割线
+
+        //RecyclerView点击事件
+        myAdapter1.setOnItemClickLitener(new SitedetailMineAdapter.OnItemClickLitener() {
+            private IsChoose e;
+            @Override
+            public void onItemClick(View view, int position) {
+                //判断是否显示选择筐
+                if (iSSHOW == 1) {
+                    //获取当前条目然后设置是否为选中,这里没有直接用boolean值判断
+                    e = arrayList.get(position);
+
+                    if (e.getIsSelect() == 1) {
+                        //  e.setSelect(1);
+                        e.setIsSelect(0);
+                        listIndex.set(position,-1);     //listIndex中移除取消删除的值
+                        deleteArrayList.remove(e);
+                    } else {
+                        e.setIsSelect(1);
+                        listIndex.set(position,position);     //listIndex中加入要删除的值
+                        deleteArrayList.add(e);
+                    }
+                    myAdapter1.notifyDataSetChanged();
+                } else {
+                    Data.setLinkmanname(listData.get(position));
+                    Intent intent = new Intent(SitedetailActivity.this,SiteManagement.class);
+                    Bundle  bundle = new Bundle();
+                    bundle.putSerializable("listmap", listmap.get(position));
+                    intent.putExtras(bundle);
+                    startActivity(intent);
+                }
+            }
+            @Override
+            public void onItemLongClick(View view, final int position) {
             }
         });
 
+        srlRefresh.finishRefresh();
     }
-    public void myclick(View view) {
-        finish();
+
+    @Override
+    public void onFile(String msg) {
+        Toast.makeText(this,""+msg,Toast.LENGTH_SHORT).show();
     }
 }

+ 85 - 0
app/src/main/java/com/silence/commonframe/activity/presenter/HistoryPresenter.java

@@ -0,0 +1,85 @@
+package com.silence.commonframe.activity.presenter;
+
+import android.app.Activity;
+
+import com.google.gson.Gson;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.cache.CacheMode;
+import com.lzy.okgo.callback.StringCallback;
+import com.silence.commonframe.activity.Interface.HistoryListener;
+import com.silence.commonframe.bean.BaseBean;
+import com.silence.commonframe.common.constant.BaseConstants;
+import com.silence.commonframe.common.constant.UrlConstants;
+import com.silence.commonframe.model.FireAlarmModel;
+import com.silence.commonframe.utils.Data;
+import com.silence.commonframe.utils.LoginIn;
+
+import okhttp3.Call;
+import okhttp3.Response;
+
+public class HistoryPresenter extends HistoryListener.Presenter {
+
+    public HistoryPresenter(Activity mContext, HistoryListener.View mView){
+        this.mContext = mContext;
+        this.mView = mView;
+    }
+
+    @Override
+    public void getData() {
+        OkGo.get(UrlConstants.GET_FIRE_ALARM)
+                .tag(this)
+                .params("page",mView.getPage())
+                .params("pageSize",BaseConstants.PAGE_SIZE)
+                .cacheKey("cacheGetKey")            // 设置当前请求的缓存key,建议每个不同功能的请求设置一个
+                .cacheMode(CacheMode.DEFAULT)    // 缓存模式,详细请看缓存介绍
+                .headers("token", Data.getToken())
+                .execute(new StringCallback() {
+                    @Override
+                    public void onSuccess(String s, Call call, Response response) {
+                        FireAlarmModel fireAlarmModel = new Gson().fromJson(s, FireAlarmModel.class);
+                        if (fireAlarmModel.getCode() == 0){
+                            mView.onSuccess(fireAlarmModel.getData());
+                        }else {
+                            LoginIn.tokenOut(fireAlarmModel.getCode(),mContext);
+                            mView.onFile(fireAlarmModel.getMsg());
+                            mView.onError();
+                        }
+                    }
+
+                    @Override
+                    public void onError(Call call, Response response, Exception e) {
+                        super.onError(call, response, e);
+                        mView.onFile("信息获取失败");
+                        mView.onError();
+                    }
+                });
+    }
+
+    @Override
+    public void getKnowMessage() {
+        OkGo.get(UrlConstants.READ_FIRE_ALARM)
+                .tag(this)
+                .params("processId",mView.getProcessId())
+                .cacheKey("cacheGetKey")            // 设置当前请求的缓存key,建议每个不同功能的请求设置一个
+                .cacheMode(CacheMode.DEFAULT)    // 缓存模式,详细请看缓存介绍
+                .headers("token", Data.getToken())
+                .execute(new StringCallback() {
+                    @Override
+                    public void onSuccess(String s, Call call, Response response) {
+                        BaseBean data = new Gson().fromJson(s,BaseBean.class);
+                        if (data.code == 0){
+                            mView.onReadSuccess(mView.getItemPosition());
+                        }else {
+                            LoginIn.tokenOut(data.getCode(),mContext);
+                            mView.onFile(data.getMsg());
+                        }
+                    }
+                    @Override
+                    public void onError(Call call, Response response, Exception e) {
+                        super.onError(call, response, e);
+                        mView.onFile("信息获取失败");
+                    }
+                });
+
+    }
+}

+ 2 - 2
app/src/main/java/com/silence/commonframe/activity/presenter/NewSubmitPresenter.java

@@ -50,7 +50,7 @@ public class NewSubmitPresenter extends NewSubmitListener.Presenter {
         this.view=view;
     }
     public void putData(){
-        if (view.getImgUrl().size()>=0){
+        if (view.getImgUrl().size()>0){
             files.clear();
             luban(view.getImgUrl());
         }else if (!TextUtils.isEmpty(view.getVideoUrl())){
@@ -159,7 +159,7 @@ public class NewSubmitPresenter extends NewSubmitListener.Presenter {
                         .tag(this)
                         .cacheKey("cachePostRegister11")
                         .cacheMode(CacheMode.DEFAULT)
-                        .upJson(jsonObject.toString())
+                        .upJson(jsonObject)
                         .headers("token", Data.getToken())
                         .execute(new StringCallback() {
                             @Override

+ 83 - 0
app/src/main/java/com/silence/commonframe/activity/presenter/SiteDetailPresenter.java

@@ -0,0 +1,83 @@
+package com.silence.commonframe.activity.presenter;
+
+import android.app.Activity;
+
+import com.google.gson.Gson;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.cache.CacheMode;
+import com.lzy.okgo.callback.StringCallback;
+import com.silence.commonframe.activity.Interface.SiteDetailListener;
+import com.silence.commonframe.common.constant.BaseConstants;
+import com.silence.commonframe.common.constant.UrlConstants;
+import com.silence.commonframe.model.SiteModel;
+import com.silence.commonframe.utils.Data;
+import com.silence.commonframe.utils.LoginIn;
+
+import okhttp3.Call;
+import okhttp3.Response;
+
+public class SiteDetailPresenter extends SiteDetailListener.Presenter{
+
+    public SiteDetailPresenter(Activity mContext, SiteDetailListener.View mView){
+        this.mContext = mContext;
+        this.mView = mView;
+    }
+
+    @Override
+    public void delSite() {
+        OkGo.get(UrlConstants.DELETE_SITE)
+                .tag(this)
+                .params("ids",mView.getIds())
+                .cacheKey("cacheGetKey")
+                .cacheMode(CacheMode.DEFAULT)
+                .headers("token", Data.getToken())
+                .execute(new StringCallback() {
+                    @Override
+                    public void onSuccess(String s, Call call, Response response) {
+                        SiteModel data = new Gson().fromJson(s,SiteModel.class);
+                        if (data.getCode() == 0){
+                            mView.onFile("数据已删除");
+                            mView.onDelSuccess();
+                        }else {
+                            LoginIn.tokenOut(data.getCode(),mContext);
+                            mView.onFile(data.getMsg());
+                        }
+                    }
+                    @Override
+                    public void onError(Call call, Response response, Exception e) {
+                        super.onError(call, response, e);
+                        mView.onFile("信息获取失败");
+                    }
+                });
+    }
+
+    @Override
+    public void getSite() {
+        OkGo.get(UrlConstants.GET_SITE_LIST)
+                .tag(this)
+                .params("page",mView.getPage())
+                .params("pagesize",BaseConstants.PAGE_SIZE)
+                .cacheKey("cacheGetKey")
+                .cacheMode(CacheMode.DEFAULT)
+                .headers("token", Data.getToken())
+                .execute(new StringCallback() {
+                    @Override
+                    public void onSuccess(String s, Call call, Response response) {
+                        SiteModel data = new Gson().fromJson(s,SiteModel.class);
+                        if (data.getCode() == 0){
+                            mView.onGetSiteSuccess(data.getData());
+                        }else {
+                            mView.onDelError();
+                            LoginIn.tokenOut(data.getCode(),mContext);
+                            mView.onFile(data.getMsg());
+                        }
+                    }
+
+                    @Override
+                    public void onError(Call call, Response response, Exception e) {
+                        super.onError(call, response, e);
+                        mView.onFile("信息获取失败");
+                    }
+                });
+    }
+}

+ 1 - 88
app/src/main/java/com/silence/commonframe/adapter/FindAdapter.java

@@ -95,98 +95,11 @@ public class FindAdapter extends BaseQuickAdapter<TroubleDeviceModel.DataBean, B
         });
     }
 
-//    @Override
-//    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
-//        viewHolder1.tv.setText("编号:"+listmap1.get(i).get("deviceId"));//tv_devicename
-//        viewHolder1.tv_devicename.setText("设备:"+listmap1.get(i).get("deviceName"));//tv_time
-//        viewHolder1.tv_time.setText("时间:"+listmap1.get(i).get("gmtCreate"));
-//        viewHolder1.tv_place.setText("区域名:"+listmap1.get(i).get("deployment"));
-//        viewHolder1.tv_place1.setText("位置:"+listmap1.get(i).get("deviceLocation"));
-//        viewHolder1.tv_place3.setText("地址:"+listmap1.get(i).get("location"));//deployment
-//        System.out.println("pp1"+listmap1.get(i).get("recheckId"));
-//
-//        if ("11".equals(listmap1.get(i).get("recheckId"))){
-//            viewHolder1.imageView.setImageResource(R.mipmap.unaudited1);
-//        }else {
-//           if ("0".equals(listmap1.get(i).get("isValid"))){
-//               viewHolder1.imageView.setImageResource(R.mipmap.unaudited3);
-//           }
-//            if ("1".equals(listmap1.get(i).get("isValid"))){
-//               viewHolder1.imageView.setImageResource(R.mipmap.unaudited0);
-//           }
-//        }
-//        if ("1".equals(listmap1.get(i).get("troubleType"))){
-//            viewHolder1.fire.setText("火警");
-//            viewHolder1.fire.setTextColor(Color.rgb(250,85,58));//imageViewfire
-//            viewHolder1.imageViewfire.setImageResource(R.mipmap.redlinght);
-//       //     finalImageView.setImageResource(R.drawable.guzhang);
-//        }
-//        if ("0".equals(listmap1.get(i).get("troubleType"))){
-//            viewHolder1.fire.setText("故障");
-//            viewHolder1.fire.setTextColor(Color.rgb(255,153,51));//imageViewfire
-//            viewHolder1.imageViewfire.setImageResource(R.mipmap.redlinght0);
-//        }
-//        if ("2".equals(listmap1.get(i).get("troubleType"))){
-//            viewHolder1.fire.setText("其它");
-//           // viewHolder1.fire.setTextColor(Color.rgb(250,85,58));//imageViewfire
-//            viewHolder1.imageViewfire.setImageResource(R.mipmap.light);
-//        }
-//    }
-
-
-//    class MyViewHolder extends RecyclerView.ViewHolder {
-//        View itemView;
-//        TextView tv;
-//        TextView tv_devicename;
-//        TextView tv_time;
-//        TextView tv_place;
-//        TextView tv_place1;
-//        TextView tv_place3;
-//        MyItemClickListener mListener;
-//        ImageView  imageView;
-//        ImageView  imageViewfire;
-//        TextView  fire;
-//
-//        public MyViewHolder(View itemView, final MyItemClickListener mListener) {
-//            super(itemView);
-//            this.itemView = itemView;
-//            // iv = (ImageView) itemView.findViewById(R.id.number);
-//            tv = (TextView) itemView.findViewById(R.id.number);//recycler_view_test_item_person_name_tv
-//            tv_devicename = (TextView) itemView.findViewById(R.id.recycler_view_test_item_person_name_tv);//recycler_view_place
-//
-//            tv_time = (TextView) itemView.findViewById(R.id.time);
-//            tv_place = (TextView) itemView.findViewById(R.id.recycler_view_place);
-//            tv_place1 = (TextView) itemView.findViewById(R.id.place);
-//            tv_place3 = (TextView) itemView.findViewById(R.id.place1);//imageView_check  fire
-//            fire = (TextView) itemView.findViewById(R.id.fire);
-//            imageView = (ImageView) itemView.findViewById(R.id.imageView_check); //imageView_fire
-//            imageViewfire = (ImageView) itemView.findViewById(R.id.imageView_fire);
-//
-//            itemView.setOnClickListener(new View.OnClickListener() {
-//                @Override
-//                public void onClick(View v) {
-//                    mListener.onItemClick(v, getAdapterPosition());
-//                }
-//            });
-//        }
-//
-//    }
-
     /**
      * 回调接口
      */
     public interface MyItemClickListener {
-        void onItemClick(int postion, List<TroubleDeviceModel.DataBean> listData);
+        void onItemClick(int position, List<TroubleDeviceModel.DataBean> listData);
     }
 
-//    /**
-//     * 设置Item点击监听
-//     *
-//     * @param listener
-//     */
-//    public void setOnItemClickListener(MyItemClickListener listener) {
-//        this.listener = listener;
-//    }
-
-
 }

+ 4 - 5
app/src/main/java/com/silence/commonframe/fragment/FindFragment1.java

@@ -124,7 +124,7 @@ public class FindFragment1 extends BaseFragment implements NewFindListener.View
             }
         });
         srlRefresh.autoRefresh();
-        srlRefresh.setEnableAutoLoadMore(false);
+        srlRefresh.setEnableLoadMore(false);
     }
 
     @Override
@@ -204,16 +204,16 @@ public class FindFragment1 extends BaseFragment implements NewFindListener.View
         mAdapter.notifyDataSetChanged();
         if (dataBean.size() >= Integer.valueOf(BaseConstants.PAGE_SIZE)){
             page = page + 1;
-            srlRefresh.setEnableAutoLoadMore(true);
+            srlRefresh.setEnableLoadMore(true);
         }
 
     }
 
     FindAdapter.MyItemClickListener onclick = new FindAdapter.MyItemClickListener() {
         @Override
-        public void onItemClick(int postion, List<TroubleDeviceModel.DataBean> listData) {
+        public void onItemClick(int position, List<TroubleDeviceModel.DataBean> listData) {
             Intent intent = new Intent(getContext(), NewsdetailActivity.class);
-            intent.putExtra("listmap", new Gson().toJson(listData.get(postion)));
+            intent.putExtra("listmap", new Gson().toJson(listData.get(position)));
             startActivity(intent);
         }
     };
@@ -229,5 +229,4 @@ public class FindFragment1 extends BaseFragment implements NewFindListener.View
         this.mActivity = (Activity) context;
     }
 
-
 }

+ 6 - 2
app/src/main/java/com/silence/tech/ui/moni/activity/MoniFragment.java

@@ -10,11 +10,13 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.google.gson.Gson;
 import com.scwang.smartrefresh.layout.SmartRefreshLayout;
 import com.scwang.smartrefresh.layout.api.RefreshLayout;
 import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
 import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
 import com.silence.commonframe.R;
+import com.silence.commonframe.activity.NewsdetailActivity;
 import com.silence.commonframe.base.basemvp.BaseFragment;
 import com.silence.commonframe.common.constant.BaseConstants;
 import com.silence.tech.adapter.MoniTroubleAdapter;
@@ -76,7 +78,7 @@ public class MoniFragment extends BaseFragment implements MoniListener.View{
     @Override
     protected void initView() {
 //        getActivity().getResources().getString(R.string.text_tab_moni)
-        setTitle(getActivity(),getResources().getString(R.string.text_tab_moni),"",true);
+        setTitle(getActivity(),getResources().getString(R.string.text_tab_moni),"",false);
 
         srlRefresh.setOnRefreshListener(new OnRefreshListener() {
             @Override
@@ -168,7 +170,9 @@ public class MoniFragment extends BaseFragment implements MoniListener.View{
     MoniTroubleAdapter.mOnClickListener onclick = new MoniTroubleAdapter.mOnClickListener() {
         @Override
         public void itemOnClick(int position, List<TroubleListBean.DataBean.DataListBean> listData) {
-
+            Intent intent = new Intent(getContext(), NewsdetailActivity.class);
+            intent.putExtra("listmap", new Gson().toJson(listData.get(position)));
+            startActivity(intent);
         }
     };
 

+ 6 - 1
app/src/main/java/com/silence/tech/ui/moni/activity/MoniTroubleActivity.java

@@ -1,5 +1,6 @@
 package com.silence.tech.ui.moni.activity;
 
+import android.content.Intent;
 import android.graphics.Color;
 import android.os.Build;
 import android.support.annotation.NonNull;
@@ -13,11 +14,13 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.google.gson.Gson;
 import com.scwang.smartrefresh.layout.SmartRefreshLayout;
 import com.scwang.smartrefresh.layout.api.RefreshLayout;
 import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
 import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
 import com.silence.commonframe.R;
+import com.silence.commonframe.activity.NewsdetailActivity;
 import com.silence.commonframe.base.basemvp.BaseActivity;
 import com.silence.commonframe.common.constant.BaseConstants;
 import com.silence.tech.adapter.MoniTroubleAdapter;
@@ -121,7 +124,9 @@ public class MoniTroubleActivity extends BaseActivity implements MoniTroubleList
     MoniTroubleAdapter.mOnClickListener onclick = new MoniTroubleAdapter.mOnClickListener() {
         @Override
         public void itemOnClick(int position, List<TroubleListBean.DataBean.DataListBean> listData) {
-
+            Intent intent = new Intent(mContext, NewsdetailActivity.class);
+            intent.putExtra("listmap", new Gson().toJson(listData.get(position)));
+            startActivity(intent);
         }
     };
 

+ 8 - 152
app/src/main/res/layout/activity_coustomer.xml

@@ -1,124 +1,16 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:orientation="vertical"
     tools:context=".activity.CoustomerActivity">
 
-    <LinearLayout
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        tools:ignore="MissingConstraints">
-
-
-        <!--<LinearLayout-->
-        <!--android:layout_width="match_parent"-->
-        <!--android:layout_height="45dp"-->
-        <!--android:background="#000000"-->
-        <!--android:orientation="horizontal">-->
-
-
-        <!--<ImageView-->
-        <!--android:id="@+id/imageView3"-->
-        <!--android:layout_width="35dp"-->
-        <!--android:layout_height="match_parent"-->
-        <!--android:background="@mipmap/black"-->
-        <!--android:gravity="center"-->
-        <!--android:onClick="click" />-->
-
-        <!--<TextView-->
-
-        <!--android:layout_width="wrap_content"-->
-        <!--android:layout_height="match_parent"-->
-        <!--android:gravity="center"-->
-        <!--android:text="返回"-->
-        <!--android:textColor="#fff"-->
-        <!--android:textSize="19sp" />-->
-
-        <!--<LinearLayout-->
-        <!--android:layout_width="0dp"-->
-        <!--android:layout_height="match_parent"-->
-        <!--android:layout_weight="1"-->
-        <!--android:gravity="center">-->
-
-        <!--<TextView-->
-        <!--android:layout_width="wrap_content"-->
-        <!--android:layout_height="wrap_content"-->
-        <!--android:text="客服电话"-->
-        <!--android:textColor="#fff"-->
-        <!--android:textSize="19sp" />-->
-        <!--</LinearLayout>-->
-
-
-        <RelativeLayout
-            android:layout_width="match_parent"
-            android:layout_height="63dp"
-            android:gravity="bottom"
-            android:background="#4e69ff">
-
-            <LinearLayout
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginBottom="6dp"
-                android:layout_alignParentBottom="true"
-                android:gravity="center_vertical"
-                android:onClick="click"
-                android:layout_marginLeft="10dp">
-
-                <ImageView
-                    android:id="@+id/imageView4"
-                    android:layout_width="20dp"
-                    android:layout_height="20dp"
-                    android:background="@mipmap/whiteback"
-                    />
-
-                <TextView
-                    android:id="@+id/textView15"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:gravity="center"
-                    android:textColor="#00000000"
-                    android:textSize="19sp"
-                    android:text="返回" />
-
-            </LinearLayout>
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="true"
-                android:gravity="center_horizontal"
-                android:layout_marginBottom="6dp">
-
-                <TextView
-                    android:id="@id/textView3"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="客服电话"
-                    android:textColor="#fff"
-                    android:textSize="19sp"/>
-
-            </LinearLayout>
-
-
-
-            <!--<ImageView-->
-            <!--android:id="@+id/imageView_daohang"-->
-            <!--android:layout_width="35dp"-->
-            <!--android:layout_height="31dp"-->
-            <!--android:layout_marginBottom="9dp"-->
-            <!--app:srcCompat="@mipmap/daohang" />-->
-
-        </RelativeLayout>
-
-
-
-    </LinearLayout>
+    <com.silence.commonframe.base.basemvp.TitleBar
+        android:id="@+id/base_title_bar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"/>
 
     <LinearLayout
         android:layout_width="match_parent"
@@ -127,10 +19,6 @@
 
         <LinearLayout
             android:layout_width="match_parent"
-            android:layout_height="63dp"></LinearLayout>
-
-        <LinearLayout
-            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="horizontal">
 
@@ -149,8 +37,6 @@
                     android:text="客服电话"
                     />
 
-
-
                 <TextView
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
@@ -161,29 +47,6 @@
                     android:text="工作时间"
                     />
 
-                <!--<TextView-->
-                <!--android:id="@+id/textView38"-->
-                <!--android:layout_width="wrap_content"-->
-                <!--android:layout_height="wrap_content"-->
-                <!--android:text="09:00&#45;&#45;18:00(周一至周六)"-->
-                <!--app:layout_constraintBaseline_toBaselineOf="@+id/textView36"-->
-                <!--app:layout_constraintStart_toStartOf="@+id/textView35" />-->
-
-                <!--<ImageView-->
-                <!--android:id="@+id/imageView7"-->
-                <!--android:layout_width="40dp"-->
-                <!--android:layout_height="40dp"-->
-                <!--android:layout_marginEnd="40dp"-->
-                <!--android:layout_marginRight="40dp"-->
-                <!--android:layout_marginBottom="16dp"-->
-                <!--android:background="@mipmap/sitetel1"-->
-                <!--android:onClick="diallPhone"-->
-                <!--app:layout_constraintBottom_toTopOf="@+id/textView38"-->
-                <!--app:layout_constraintEnd_toEndOf="@+id/linearLayout5" />-->
-
-
-
-
             </LinearLayout>
 
             <LinearLayout
@@ -226,18 +89,11 @@
 
         </LinearLayout>
 
-
         <View
             android:layout_width="match_parent"
             android:layout_height="1dp"
-            android:background="#ccc"></View>
-
+            android:background="#ccc"/>
 
     </LinearLayout>
 
-
-
-
-
-
-</android.support.constraint.ConstraintLayout>
+</LinearLayout>

+ 56 - 99
app/src/main/res/layout/activity_sitedetail.xml

@@ -1,117 +1,74 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:orientation="vertical"
     tools:context=".activity.SitedetailActivity">
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical">
 
-        <RelativeLayout
+        <com.silence.commonframe.base.basemvp.TitleBar
+            android:id="@+id/base_title_bar"
             android:layout_width="match_parent"
-            android:layout_height="63dp"
-            android:gravity="bottom"
-            android:background="#4e69ff">
+            android:layout_height="wrap_content"/>
 
-            <LinearLayout
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginBottom="6dp"
-                android:layout_alignParentBottom="true"
-                android:gravity="center_vertical"
-                android:onClick="myclick"
-                android:layout_marginLeft="10dp">
-
-                <ImageView
-                    android:id="@+id/imageView4"
-                    android:layout_width="20dp"
-                    android:layout_height="20dp"
-                    android:background="@mipmap/whiteback"
-                    />
-
-                <TextView
-                    android:id="@+id/textView15"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:gravity="center"
-                    android:textColor="#00000000"
-                    android:textSize="19sp"
-                    android:text="返回" />
-
-            </LinearLayout>
+        <com.scwang.smartrefresh.layout.SmartRefreshLayout
+            android:id="@+id/srl_refresh"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
 
             <LinearLayout
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="true"
-                android:gravity="center_horizontal"
-                android:layout_marginBottom="6dp">
+                android:layout_height="match_parent"
+                android:orientation="vertical">
+                <android.support.v7.widget.RecyclerView
+                    android:id="@+id/my_recycler_view"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    android:layout_weight="1"
+                    android:scrollbars="vertical"
+                    tools:layout_editor_absoluteX="0dp"
+                    tools:layout_editor_absoluteY="68dp" />
 
-                <TextView
-                    android:id="@id/textView3"
-                    android:layout_width="wrap_content"
+                <LinearLayout
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:text="场所列表"
-                    android:textColor="#fff"
-                    android:textSize="19sp"/>
+                    android:layout_gravity="center"
+                    android:layout_alignParentBottom="true"
+                    android:layout_marginBottom="3dp"
+                    android:orientation="horizontal">
+                    <View
+                        android:layout_width="5dp"
+                        android:layout_height="match_parent"></View>
 
-            </LinearLayout>
+                    <Button
+                        android:id="@+id/edit"
+                        android:layout_width="0dp"
+                        android:layout_height="40dp"
+                        android:layout_weight="1"
+                        android:background="@drawable/bg_corner_blue"
+                        android:layout_margin="5dp"
+                        android:textColor="#fff"
+                        android:textSize="18sp"
+                        android:text="编辑" />
 
-        </RelativeLayout>
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:orientation="vertical">
-            <android.support.v7.widget.RecyclerView
-                android:id="@+id/my_recycler_view"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_weight="1"
-                android:scrollbars="vertical"
-                tools:layout_editor_absoluteX="0dp"
-                tools:layout_editor_absoluteY="68dp" />
+                    <Button
+                        android:id="@+id/delete"
+                        android:layout_width="0dp"
+                        android:layout_height="40dp"
+                        android:background="@drawable/bg_corner_blue"
+                        android:layout_margin="5dp"
+                        android:textColor="#fff"
+                        android:textSize="18sp"
+                        android:layout_weight="1"
+                        android:text="删除" />
 
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center"
-                android:layout_alignParentBottom="true"
-                android:layout_marginBottom="3dp"
-                android:orientation="horizontal">
-                <View
-                    android:layout_width="5dp"
-                    android:layout_height="match_parent"></View>
-
-                <Button
-                    android:id="@+id/edit"
-                    android:layout_width="0dp"
-                    android:layout_height="40dp"
-                    android:layout_weight="1"
-                    android:background="@drawable/bg_corner_blue"
-                    android:layout_margin="5dp"
-                    android:textColor="#fff"
-                    android:textSize="18sp"
-                    android:text="编辑" />
-
-                <Button
-                    android:id="@+id/delete"
-                    android:layout_width="0dp"
-                    android:layout_height="40dp"
-                    android:background="@drawable/bg_corner_blue"
-                    android:layout_margin="5dp"
-                    android:textColor="#fff"
-                    android:textSize="18sp"
-                    android:layout_weight="1"
-                    android:text="删除" />
-
-                <View
-                    android:layout_width="5dp"
-                    android:layout_height="match_parent"></View>
+                    <View
+                        android:layout_width="5dp"
+                        android:layout_height="match_parent"></View>
+                </LinearLayout>
             </LinearLayout>
-        </LinearLayout>
 
-    </LinearLayout>
-</android.support.constraint.ConstraintLayout>
+        </com.scwang.smartrefresh.layout.SmartRefreshLayout>
+
+</LinearLayout>

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -8,6 +8,8 @@
     <string name="text_tab_moni">监控</string>
     <string name="text_tab_files">档案</string>
 
+    <string name="tel">4006005531</string>
+
     <!--<string name="app_name">MyZxing</string>-->
     <string name="confirm">确认</string>
     <string name="submit">提交</string>