|
@@ -1,49 +1,35 @@
|
|
|
package com.silence.commonframe.activity.mine.activity.setup;
|
|
package com.silence.commonframe.activity.mine.activity.setup;
|
|
|
|
|
|
|
|
-import android.content.DialogInterface;
|
|
|
|
|
-import android.support.annotation.NonNull;
|
|
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
-import android.view.View;
|
|
|
|
|
import android.widget.Toast;
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
|
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.Dialog.CDialog;
|
|
import com.silence.commonframe.Dialog.CDialog;
|
|
|
import com.silence.commonframe.R;
|
|
import com.silence.commonframe.R;
|
|
|
import com.silence.commonframe.activity.mine.Interface.FireMessageListener;
|
|
import com.silence.commonframe.activity.mine.Interface.FireMessageListener;
|
|
|
import com.silence.commonframe.activity.mine.presenter.FireMessagePresenter;
|
|
import com.silence.commonframe.activity.mine.presenter.FireMessagePresenter;
|
|
|
-import com.silence.commonframe.adapter.SitedetailAdapter1;
|
|
|
|
|
|
|
+import com.silence.commonframe.adapter.FireMessageAdapter;
|
|
|
import com.silence.commonframe.base.basemvp.BaseActivity;
|
|
import com.silence.commonframe.base.basemvp.BaseActivity;
|
|
|
import com.silence.commonframe.model.SiteModel;
|
|
import com.silence.commonframe.model.SiteModel;
|
|
|
-import com.silence.commonframe.utils.Data;
|
|
|
|
|
import com.silence.commonframe.utils.DividerItemDecoration;
|
|
import com.silence.commonframe.utils.DividerItemDecoration;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
import butterknife.BindView;
|
|
import butterknife.BindView;
|
|
|
|
|
|
|
|
public class FireMessageActivity extends BaseActivity implements FireMessageListener.View {
|
|
public class FireMessageActivity extends BaseActivity implements FireMessageListener.View {
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@BindView(R.id.my_recycler_view)
|
|
@BindView(R.id.my_recycler_view)
|
|
|
RecyclerView myRecyclerView;
|
|
RecyclerView myRecyclerView;
|
|
|
@BindView(R.id.srl_refresh)
|
|
@BindView(R.id.srl_refresh)
|
|
|
SmartRefreshLayout srlRefresh;
|
|
SmartRefreshLayout srlRefresh;
|
|
|
|
|
|
|
|
- private List<HashMap<String, String>> listmap = new ArrayList<HashMap<String, String>>();
|
|
|
|
|
|
|
+ List<SiteModel.DataBean.DataListBean> listDataBean = new ArrayList<>();
|
|
|
|
|
|
|
|
public ArrayList<String> list = new ArrayList<String>(); //数据源
|
|
public ArrayList<String> list = new ArrayList<String>(); //数据源
|
|
|
- private ArrayList<String> listId = new ArrayList<String>(); //场所id
|
|
|
|
|
- private SitedetailAdapter1 myAdapter1;
|
|
|
|
|
-
|
|
|
|
|
- private ArrayList<String> listCheckphone = new ArrayList<>();
|
|
|
|
|
- private ArrayList<String> listCheckmessage = new ArrayList<>();
|
|
|
|
|
|
|
+ private FireMessageAdapter myAdapter;
|
|
|
|
|
|
|
|
private FireMessagePresenter presenter;
|
|
private FireMessagePresenter presenter;
|
|
|
|
|
|
|
@@ -64,53 +50,34 @@ public class FireMessageActivity extends BaseActivity implements FireMessageList
|
|
|
setTitle(this,getResources().getString(R.string.message_management),"",true);
|
|
setTitle(this,getResources().getString(R.string.message_management),"",true);
|
|
|
startLoading();
|
|
startLoading();
|
|
|
presenter.getData();
|
|
presenter.getData();
|
|
|
- myAdapter1 = new SitedetailAdapter1(FireMessageActivity.this, listmap);
|
|
|
|
|
|
|
+ myAdapter = new FireMessageAdapter(listDataBean);
|
|
|
myRecyclerView.setLayoutManager(new LinearLayoutManager(FireMessageActivity.this));
|
|
myRecyclerView.setLayoutManager(new LinearLayoutManager(FireMessageActivity.this));
|
|
|
- myRecyclerView.setAdapter(myAdapter1);
|
|
|
|
|
|
|
+ myRecyclerView.setAdapter(myAdapter);
|
|
|
//设置分割线
|
|
//设置分割线
|
|
|
myRecyclerView.addItemDecoration(new DividerItemDecoration(FireMessageActivity.this, DividerItemDecoration.VERTICAL_LIST));
|
|
myRecyclerView.addItemDecoration(new DividerItemDecoration(FireMessageActivity.this, DividerItemDecoration.VERTICAL_LIST));
|
|
|
|
|
|
|
|
- myAdapter1.buttonSetOnclick(new SitedetailAdapter1.ButtonInterface() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onclick(View view, int position) {
|
|
|
|
|
- CDialog.Builder builder = new CDialog.Builder(FireMessageActivity.this);
|
|
|
|
|
- builder.setCancelable(false);
|
|
|
|
|
- builder.setTitle("提示");
|
|
|
|
|
- builder.setMessage("你确定要提交推送管理吗?");
|
|
|
|
|
-
|
|
|
|
|
- builder.setPositiveButton("确定", new DialogInterface.OnClickListener()
|
|
|
|
|
- {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(DialogInterface dialog, int which)
|
|
|
|
|
- {
|
|
|
|
|
- presenter.updatePhonePush();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- builder.setNegativeButton("取消", new DialogInterface.OnClickListener()
|
|
|
|
|
- {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(DialogInterface dialog, int which)
|
|
|
|
|
- {
|
|
|
|
|
- dialog.dismiss();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- builder.show();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ myAdapter.setButtonClickListener((view, position) -> {
|
|
|
|
|
+ CDialog.Builder builder = new CDialog.Builder(FireMessageActivity.this);
|
|
|
|
|
+ builder.setCancelable(false);
|
|
|
|
|
+ builder.setTitle("提示");
|
|
|
|
|
+ builder.setMessage("你确定要提交推送管理吗?");
|
|
|
|
|
+
|
|
|
|
|
+ builder.setPositiveButton("确定", (dialog, which) -> {
|
|
|
|
|
+ startLoading();
|
|
|
|
|
+ presenter.updatePhonePush();
|
|
|
|
|
+ });
|
|
|
|
|
+ builder.setNegativeButton("取消", (dialog, which) -> dialog.dismiss());
|
|
|
|
|
+ builder.show();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- srlRefresh.setOnRefreshListener(new OnRefreshListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
|
|
|
|
- page = 1;
|
|
|
|
|
- presenter.getData();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ srlRefresh.setOnRefreshListener(refreshLayout -> {
|
|
|
|
|
+ page = 1;
|
|
|
|
|
+ presenter.getData();
|
|
|
});
|
|
});
|
|
|
- srlRefresh.setOnLoadMoreListener(new OnLoadMoreListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
|
|
|
|
- page++;
|
|
|
|
|
- presenter.getData();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ srlRefresh.setOnLoadMoreListener(refreshLayout -> {
|
|
|
|
|
+ page++;
|
|
|
|
|
+ presenter.getData();
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -120,46 +87,15 @@ public class FireMessageActivity extends BaseActivity implements FireMessageList
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public ArrayList<String> getListId() {
|
|
|
|
|
- return listId;
|
|
|
|
|
|
|
+ public List<SiteModel.DataBean.DataListBean> getListData() {
|
|
|
|
|
+ return myAdapter.getListData();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onSuccess(List<SiteModel.DataBean.DataListBean> listData) {
|
|
public void onSuccess(List<SiteModel.DataBean.DataListBean> listData) {
|
|
|
- if (page==1){
|
|
|
|
|
- listmap.clear();
|
|
|
|
|
- listId.clear();
|
|
|
|
|
- list.clear();
|
|
|
|
|
- listCheckmessage.clear();
|
|
|
|
|
- listCheckphone.clear();
|
|
|
|
|
- }
|
|
|
|
|
- for (int i = 0;i<listData.size();i++){
|
|
|
|
|
- HashMap<String,String> hashMap = new HashMap<>();
|
|
|
|
|
- String RegionName = listData.get(i).getRegionName();
|
|
|
|
|
- String Location = listData.get(i).getLocation();
|
|
|
|
|
- String id = listData.get(i).getId();
|
|
|
|
|
- String deployment = listData.get(i).getDeployment();
|
|
|
|
|
- String isTel = listData.get(i).getIsTel();
|
|
|
|
|
- String isMsg = listData.get(i).getIsMsg();
|
|
|
|
|
-
|
|
|
|
|
- hashMap.put("RegionName",RegionName);
|
|
|
|
|
- hashMap.put("Location",Location);
|
|
|
|
|
- hashMap.put("id",id);
|
|
|
|
|
- hashMap.put("deployment",deployment);
|
|
|
|
|
- hashMap.put("isTel",isTel);
|
|
|
|
|
- hashMap.put("isMsg",isMsg);
|
|
|
|
|
-
|
|
|
|
|
- listId.add(id);
|
|
|
|
|
- list.add(deployment);
|
|
|
|
|
- listmap.add(hashMap);
|
|
|
|
|
-
|
|
|
|
|
- listCheckphone.add("");
|
|
|
|
|
- listCheckmessage.add("");
|
|
|
|
|
- }
|
|
|
|
|
- myAdapter1.notifyDataSetChanged();
|
|
|
|
|
- Data.setListmap(listmap);
|
|
|
|
|
- Data.setList_cb_photo(listCheckphone);
|
|
|
|
|
- Data.setList_cb_message(listCheckmessage);
|
|
|
|
|
|
|
+ if (page==1) listDataBean.clear();
|
|
|
|
|
+ listDataBean.addAll(listData);
|
|
|
|
|
+ myAdapter.notifyDataSetChanged();
|
|
|
if (srlRefresh != null){
|
|
if (srlRefresh != null){
|
|
|
srlRefresh.finishRefresh();
|
|
srlRefresh.finishRefresh();
|
|
|
srlRefresh.finishLoadMore();
|
|
srlRefresh.finishLoadMore();
|
|
@@ -168,6 +104,16 @@ public class FireMessageActivity extends BaseActivity implements FireMessageList
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ public void onSuccess() {
|
|
|
|
|
+ stopLoading();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onError() {
|
|
|
|
|
+ stopLoading();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
public void onFile(String msg) {
|
|
public void onFile(String msg) {
|
|
|
Toast.makeText(this,""+msg,Toast.LENGTH_SHORT).show();
|
|
Toast.makeText(this,""+msg,Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
}
|