排程编辑更新
This commit is contained in:
@@ -16,7 +16,7 @@ import com.ckkj.water.databinding.IndexFragmentLayoutBinding;
|
||||
import com.ckkj.water.device.AddDeviceActivity;
|
||||
import com.ckkj.water.device.DeviceControlActivity;
|
||||
import com.ckkj.water.index.adapter.DeviceAdapter;
|
||||
import com.ckkj.water.index.entity.IndexDeviceEntity;
|
||||
import com.ckkj.water.index.entity.WaterDeviceEntity;
|
||||
import com.ckkj.water.index.mvp.IndexContract;
|
||||
import com.ckkj.water.index.mvp.IndexImpl;
|
||||
import com.ckkj.water.index.mvp.IndexPresenter;
|
||||
@@ -37,7 +37,7 @@ public class IndexFragment extends BaseFragment<IndexFragmentLayoutBinding, Inde
|
||||
implements IndexContract.IndexView , EasyPermissions.PermissionCallbacks{
|
||||
|
||||
private DeviceAdapter deviceAdapter;
|
||||
private List<IndexDeviceEntity> devList = new ArrayList<>();
|
||||
private List<WaterDeviceEntity> devList = new ArrayList<>();
|
||||
private int mCurrentPage = 1;
|
||||
|
||||
@Override
|
||||
@@ -153,7 +153,7 @@ public class IndexFragment extends BaseFragment<IndexFragmentLayoutBinding, Inde
|
||||
* 获取设备列表成功
|
||||
*/
|
||||
@Override
|
||||
public void getDeviceListSuccess(List<IndexDeviceEntity> list,int total) {
|
||||
public void getDeviceListSuccess(List<WaterDeviceEntity> list, int total) {
|
||||
hideDialogLoading();
|
||||
viewBinding.refresh.finishRefresh(300);
|
||||
viewBinding.refresh.finishLoadMore(300);
|
||||
|
||||
@@ -1,32 +1,26 @@
|
||||
package com.ckkj.water.index.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.ckkj.water.R;
|
||||
import com.ckkj.water.index.entity.IndexDeviceEntity;
|
||||
import com.ckkj.water.index.entity.WaterDeviceEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DeviceAdapter extends BaseQuickAdapter<IndexDeviceEntity, BaseViewHolder> {
|
||||
public class DeviceAdapter extends BaseQuickAdapter<WaterDeviceEntity, BaseViewHolder> {
|
||||
|
||||
public DeviceAdapter(Context context, int layoutResId, @Nullable List<IndexDeviceEntity> data) {
|
||||
public DeviceAdapter(Context context, int layoutResId, @Nullable List<WaterDeviceEntity> data) {
|
||||
super(layoutResId, data);
|
||||
this.mContext = context;
|
||||
this.mData = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder holder, IndexDeviceEntity item) {
|
||||
protected void convert(BaseViewHolder holder, WaterDeviceEntity item) {
|
||||
holder.setText(R.id.tv_device_name,item.getDeviceName());
|
||||
holder.setText(R.id.tv_device_serial,item.getDeviceSn());
|
||||
holder.setText(R.id.tv_device_status,"工作中");
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.ckkj.water.index.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class IndexDeviceEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* id : 2056638783822123010
|
||||
* deviceNo : 1779175872972
|
||||
* userId : 2056543507514097665
|
||||
* deviceName : 50号设备
|
||||
* deviceImg : null
|
||||
* status : 0
|
||||
* powerLevel : null
|
||||
* powerLevelUpdatatime : null
|
||||
* wifiName : 橙空科技WiFi
|
||||
* wifiPassword : 12321212
|
||||
* deviceEm : 213123123123
|
||||
* deviceSn : sdfsd32423gdfgdf3
|
||||
* fwVer : fwVer-56565644
|
||||
* macAddress : 2E:8H:00:KK:N7
|
||||
* expirationTime : null
|
||||
*/
|
||||
|
||||
private String id;
|
||||
private String deviceNo;
|
||||
private String userId;
|
||||
private String deviceName;
|
||||
private Object deviceImg;
|
||||
private String status;
|
||||
private Object powerLevel;
|
||||
private Object powerLevelUpdatatime;
|
||||
private String wifiName;
|
||||
private String wifiPassword;
|
||||
private String deviceEm;
|
||||
private String deviceSn;
|
||||
private String fwVer;
|
||||
private String macAddress;
|
||||
private Object expirationTime;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.ckkj.water.index.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class WaterDeviceEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* id : 2056638783822123010
|
||||
* deviceNo : 1779175872972
|
||||
* userId : 2056543507514097665
|
||||
* deviceName : 50号设备
|
||||
* deviceImg : null
|
||||
* status : 0
|
||||
* powerLevel : null
|
||||
* powerLevelUpdatatime : null
|
||||
* wifiName : 橙空科技WiFi
|
||||
* wifiPassword : 12321212
|
||||
* deviceEm : 213123123123
|
||||
* deviceSn : sdfsd32423gdfgdf3
|
||||
* fwVer : fwVer-56565644
|
||||
* macAddress : 2E:8H:00:KK:N7
|
||||
* expirationTime : null
|
||||
*/
|
||||
|
||||
private String id;
|
||||
private String deviceNo;
|
||||
private String userId;
|
||||
private String deviceName;
|
||||
private Object deviceImg;
|
||||
private String status;
|
||||
private Object powerLevel;
|
||||
private Object powerLevelUpdatatime;
|
||||
private String wifiName;
|
||||
private String wifiPassword;
|
||||
private String deviceEm;
|
||||
private String deviceSn;
|
||||
private String fwVer;
|
||||
private String macAddress;
|
||||
private Object expirationTime;
|
||||
private List<DeviceListBean> deviceList;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class DeviceListBean implements Serializable{
|
||||
/**
|
||||
* id : 2056641699765178369
|
||||
* deviceNo : 1779176568237
|
||||
* userId : 2056543507514097665
|
||||
* deviceName : 40号设备
|
||||
* deviceImg : null
|
||||
* status : 0
|
||||
* workStatus : 0
|
||||
* powerLevel : null
|
||||
* powerLevelUpdatatime : null
|
||||
* wifiName : 橙空科技WiFi
|
||||
* wifiPassword : 12321212
|
||||
* deviceEm : 213123123123
|
||||
* deviceSn : sdfsd32423gdfgdf3
|
||||
* fwVer : fwVer-56565644
|
||||
* macAddress : 2E:8H:00:KK:N7
|
||||
* expirationTime : null
|
||||
*/
|
||||
|
||||
private String idX;
|
||||
private String deviceNoX;
|
||||
private String userIdX;
|
||||
private String deviceNameX;
|
||||
private Object deviceImgX;
|
||||
private String statusX;
|
||||
private String workStatus;
|
||||
private Object powerLevelX;
|
||||
private Object powerLevelUpdatatimeX;
|
||||
private String wifiNameX;
|
||||
private String wifiPasswordX;
|
||||
private String deviceEmX;
|
||||
private String deviceSnX;
|
||||
private String fwVerX;
|
||||
private String macAddressX;
|
||||
private Object expirationTimeX;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,7 @@
|
||||
package com.ckkj.water.index.mvp;
|
||||
|
||||
import com.ckkj.water.base.IView;
|
||||
import com.ckkj.water.index.entity.IndexDeviceEntity;
|
||||
import com.ckkj.water.login.entity.LoginEntity;
|
||||
import com.ckkj.water.network.BaseBean;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import com.ckkj.water.index.entity.WaterDeviceEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -29,6 +25,6 @@ public class IndexContract {
|
||||
}
|
||||
|
||||
public interface IndexView extends IView{
|
||||
void getDeviceListSuccess(List<IndexDeviceEntity> list,int total);
|
||||
void getDeviceListSuccess(List<WaterDeviceEntity> list, int total);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.ckkj.water.index.mvp;
|
||||
|
||||
import com.ckkj.water.index.entity.IndexDeviceEntity;
|
||||
import com.ckkj.water.index.entity.WaterDeviceEntity;
|
||||
import com.ckkj.water.network.BaseBean;
|
||||
import com.ckkj.water.network.NetWorkManager;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -28,13 +26,13 @@ public class IndexImpl implements IndexContract.DataModel{
|
||||
.subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseBean<List<IndexDeviceEntity>>>() {
|
||||
.subscribe(new Observer<BaseBean<List<WaterDeviceEntity>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseBean<List<IndexDeviceEntity>> bean) {
|
||||
public void onNext(@NonNull BaseBean<List<WaterDeviceEntity>> bean) {
|
||||
if (bean.getCode() == 200) {
|
||||
callBack.success(bean.getRows(),bean.getTotal());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.ckkj.water.index.mvp;
|
||||
|
||||
import com.ckkj.water.base.BasePresenter;
|
||||
import com.ckkj.water.index.entity.IndexDeviceEntity;
|
||||
import com.ckkj.water.index.entity.WaterDeviceEntity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -18,10 +18,10 @@ public class IndexPresenter extends BasePresenter<IndexContract.IndexView>{
|
||||
* 查询设备列表
|
||||
*/
|
||||
public void getDevicesList(int mCurrentPage) {
|
||||
mImpl.getDeviceList(new HashMap<>(), new IndexContract.CallBack<List<IndexDeviceEntity>>() {
|
||||
mImpl.getDeviceList(new HashMap<>(), new IndexContract.CallBack<List<WaterDeviceEntity>>() {
|
||||
|
||||
@Override
|
||||
public void success(List<IndexDeviceEntity> list, int total) {
|
||||
public void success(List<WaterDeviceEntity> list, int total) {
|
||||
if(IndexPresenter.this.getView() != null){
|
||||
IndexPresenter.this.getView().getDeviceListSuccess(list,total);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user