Compare commits
5 Commits
0c692c77bd
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cd0ccd53e | ||
|
|
d8e9f60f25 | ||
|
|
c7556a42ab | ||
|
|
548419cf29 | ||
|
|
dff152e7e7 |
1
.codex_write_test.tmp
Normal file
1
.codex_write_test.tmp
Normal file
@@ -0,0 +1 @@
|
|||||||
|
write-ok
|
||||||
@@ -21,8 +21,8 @@ public class AppConfig {
|
|||||||
// public static boolean IS_TEST_REQUEST = true;
|
// public static boolean IS_TEST_REQUEST = true;
|
||||||
|
|
||||||
/**************************本地*******************************/
|
/**************************本地*******************************/
|
||||||
public static String BASE_URL = "http://192.168.1.217:8082/";//后端本地测试
|
// public static String BASE_URL = "http://192.168.1.217:8082/";//后端本地测试
|
||||||
// public static String BASE_URL = "http://47.97.217.123:8081/";//服务器测试
|
public static String BASE_URL = "http://47.97.217.123:8081/";//服务器测试
|
||||||
public static String BASE_URL_TWO = BASE_URL;//测试
|
public static String BASE_URL_TWO = BASE_URL;//测试
|
||||||
public static String BASE_URL_THREE = BASE_URL;//测试
|
public static String BASE_URL_THREE = BASE_URL;//测试
|
||||||
public static boolean IS_TEST_REQUEST = true;
|
public static boolean IS_TEST_REQUEST = true;
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import android.content.pm.PackageManager;
|
|||||||
import android.graphics.drawable.AnimationDrawable;
|
import android.graphics.drawable.AnimationDrawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.os.ParcelUuid;
|
import android.os.ParcelUuid;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -66,6 +68,9 @@ import pub.devrel.easypermissions.EasyPermissions;
|
|||||||
public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, DevicePresenter>
|
public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, DevicePresenter>
|
||||||
implements DeviceContract.DeviceView, EasyPermissions.PermissionCallbacks {
|
implements DeviceContract.DeviceView, EasyPermissions.PermissionCallbacks {
|
||||||
|
|
||||||
|
public static final String EXTRA_RESTART_BLE_SCAN = "restart_ble_scan";
|
||||||
|
private static final long BLE_RESCAN_DELAY_MS = 1800L;
|
||||||
|
|
||||||
// 蓝牙相关
|
// 蓝牙相关
|
||||||
private BluetoothAdapter bluetoothAdapter;
|
private BluetoothAdapter bluetoothAdapter;
|
||||||
private static final int REQUEST_ENABLE_BT = 1001;
|
private static final int REQUEST_ENABLE_BT = 1001;
|
||||||
@@ -75,6 +80,9 @@ public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, Devi
|
|||||||
private String mUuid = "1775244d-6b43-439b-877c-060f2d9bed07";
|
private String mUuid = "1775244d-6b43-439b-877c-060f2d9bed07";
|
||||||
private ScanCallback mScanCallback;
|
private ScanCallback mScanCallback;
|
||||||
private boolean bluetoothReady = false;
|
private boolean bluetoothReady = false;
|
||||||
|
private boolean isBleScanning = false;
|
||||||
|
private boolean restartScanOnResume = false;
|
||||||
|
private final Handler bleScanHandler = new Handler(Looper.getMainLooper());
|
||||||
private BleScanDeviceAdapter bleAdapter;
|
private BleScanDeviceAdapter bleAdapter;
|
||||||
private List<WaterDeviceEntity> mDeviceList = new ArrayList<>();
|
private List<WaterDeviceEntity> mDeviceList = new ArrayList<>();
|
||||||
private Set<String> discoveredMacSet = new HashSet<>();
|
private Set<String> discoveredMacSet = new HashSet<>();
|
||||||
@@ -121,7 +129,7 @@ public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, Devi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化监听g
|
* 初始化监听g111
|
||||||
*/
|
*/
|
||||||
private void initListener() {
|
private void initListener() {
|
||||||
setClick(viewBinding.includedTitle.imgBack);
|
setClick(viewBinding.includedTitle.imgBack);
|
||||||
@@ -137,6 +145,7 @@ public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, Devi
|
|||||||
"未知设备" : device.getDeviceName();
|
"未知设备" : device.getDeviceName();
|
||||||
// 停止扫描
|
// 停止扫描
|
||||||
stopBleScan();
|
stopBleScan();
|
||||||
|
restartScanOnResume = true;
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putInt(ConstantUtil.ACTIVITY_NAVIGATE_FLAG,100);
|
bundle.putInt(ConstantUtil.ACTIVITY_NAVIGATE_FLAG,100);
|
||||||
bundle.putSerializable("ble_device_entity",mDeviceList.get(position));
|
bundle.putSerializable("ble_device_entity",mDeviceList.get(position));
|
||||||
@@ -150,6 +159,9 @@ public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, Devi
|
|||||||
* 开始 BLE 扫描
|
* 开始 BLE 扫描
|
||||||
*/
|
*/
|
||||||
private void startBleScan() {
|
private void startBleScan() {
|
||||||
|
if (isBleScanning || !bluetoothReady || !checkBluetoothPermissions()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
|
BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
|
||||||
UUID SERVICE_UUID = UUID.fromString(mUuid);//1775244d-6b43-439b-877c-060f2d9bed07
|
UUID SERVICE_UUID = UUID.fromString(mUuid);//1775244d-6b43-439b-877c-060f2d9bed07
|
||||||
ParcelUuid parcelUuid = new ParcelUuid(SERVICE_UUID);
|
ParcelUuid parcelUuid = new ParcelUuid(SERVICE_UUID);
|
||||||
@@ -161,6 +173,7 @@ public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, Devi
|
|||||||
filters.add(new ScanFilter.Builder().setServiceUuid(parcelUuid).build());
|
filters.add(new ScanFilter.Builder().setServiceUuid(parcelUuid).build());
|
||||||
// filters.add(new ScanFilter.Builder().setDeviceName("PROV_Water_01").build());
|
// filters.add(new ScanFilter.Builder().setDeviceName("PROV_Water_01").build());
|
||||||
Log.e("TEST", "开始扫描");
|
Log.e("TEST", "开始扫描");
|
||||||
|
isBleScanning = true;
|
||||||
mScanCallback = new ScanCallback() {
|
mScanCallback = new ScanCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onScanResult(int callbackType, @NonNull ScanResult result) {
|
public void onScanResult(int callbackType, @NonNull ScanResult result) {
|
||||||
@@ -210,6 +223,8 @@ public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, Devi
|
|||||||
@Override
|
@Override
|
||||||
public void onScanFailed(int errorCode) {
|
public void onScanFailed(int errorCode) {
|
||||||
super.onScanFailed(errorCode);
|
super.onScanFailed(errorCode);
|
||||||
|
isBleScanning = false;
|
||||||
|
mScanCallback = null;
|
||||||
Log.e("TEST", "扫描失败: " + errorCode);
|
Log.e("TEST", "扫描失败: " + errorCode);
|
||||||
ToastUtil.showShort(mContext, "扫描失败,错误码: " + errorCode);
|
ToastUtil.showShort(mContext, "扫描失败,错误码: " + errorCode);
|
||||||
}
|
}
|
||||||
@@ -224,12 +239,28 @@ public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, Devi
|
|||||||
if (mScanCallback != null) {
|
if (mScanCallback != null) {
|
||||||
BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
|
BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
|
||||||
scanner.stopScan(mScanCallback);
|
scanner.stopScan(mScanCallback);
|
||||||
|
mScanCallback = null;
|
||||||
|
isBleScanning = false;
|
||||||
Log.e("TEST", "停止扫描");
|
Log.e("TEST", "停止扫描");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void restartBleScan() {
|
||||||
|
stopBleScan();
|
||||||
|
discoveredMacSet.clear();
|
||||||
|
mDeviceList.clear();
|
||||||
|
bleAdapter.notifyDataSetChanged();
|
||||||
|
viewBinding.rvDevices.setVisibility(GONE);
|
||||||
|
viewBinding.ivScanAnimation.setVisibility(VISIBLE);
|
||||||
|
if (viewBinding.ivScanAnimation.getDrawable() instanceof AnimationDrawable) {
|
||||||
|
((AnimationDrawable) viewBinding.ivScanAnimation.getDrawable()).start();
|
||||||
|
}
|
||||||
|
bleScanHandler.removeCallbacksAndMessages(null);
|
||||||
|
bleScanHandler.postDelayed(this::startBleScan, BLE_RESCAN_DELAY_MS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化蓝牙适配器
|
* 初始化蓝牙适配器
|
||||||
*/
|
*/
|
||||||
@@ -392,6 +423,30 @@ public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, Devi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (getIntent().getBooleanExtra(EXTRA_RESTART_BLE_SCAN, false)) {
|
||||||
|
restartScanOnResume = true;
|
||||||
|
getIntent().removeExtra(EXTRA_RESTART_BLE_SCAN);
|
||||||
|
}
|
||||||
|
if (restartScanOnResume) {
|
||||||
|
restartScanOnResume = false;
|
||||||
|
restartBleScan();
|
||||||
|
} else if (bluetoothReady && !isBleScanning) {
|
||||||
|
startBleScan();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
setIntent(intent);
|
||||||
|
if (intent.getBooleanExtra(EXTRA_RESTART_BLE_SCAN, false)) {
|
||||||
|
restartScanOnResume = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutResId(Bundle savedInstanceState) {
|
public int getLayoutResId(Bundle savedInstanceState) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -460,6 +515,7 @@ public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, Devi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
bleScanHandler.removeCallbacksAndMessages(null);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
// 停止扫描
|
// 停止扫描
|
||||||
stopBleScan();
|
stopBleScan();
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public class DeviceConnectActivity extends BaseActivity<DeviceConnectLayoutBindi
|
|||||||
private AnimationDrawable animationDrawable;
|
private AnimationDrawable animationDrawable;
|
||||||
private Handler handler = new Handler(Looper.getMainLooper());
|
private Handler handler = new Handler(Looper.getMainLooper());
|
||||||
private static final long ANIMATION_DURATION = 5000L; // 5秒
|
private static final long ANIMATION_DURATION = 5000L; // 5秒
|
||||||
|
private static final long PROVISION_TIMEOUT_MS = 60_000L;
|
||||||
|
|
||||||
private String mWifiName;
|
private String mWifiName;
|
||||||
private String mWifiPassword;
|
private String mWifiPassword;
|
||||||
@@ -42,6 +43,17 @@ public class DeviceConnectActivity extends BaseActivity<DeviceConnectLayoutBindi
|
|||||||
private boolean isBleConnecting = false;
|
private boolean isBleConnecting = false;
|
||||||
private boolean isBleConnected = false;
|
private boolean isBleConnected = false;
|
||||||
private boolean provisioningStarted = false;
|
private boolean provisioningStarted = false;
|
||||||
|
private boolean provisionTimeoutHandled;
|
||||||
|
private final Runnable provisionTimeoutRunnable = () -> {
|
||||||
|
if (provisionTimeoutHandled || isFinishing()) return;
|
||||||
|
provisionTimeoutHandled = true;
|
||||||
|
if (espProvisionManager != null) {
|
||||||
|
espProvisionManager.setCallback(null);
|
||||||
|
espProvisionManager.disconnect();
|
||||||
|
}
|
||||||
|
ToastUtil.showShort(mContext, getString(R.string.device_provision_timeout));
|
||||||
|
finish();
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -101,6 +113,9 @@ public class DeviceConnectActivity extends BaseActivity<DeviceConnectLayoutBindi
|
|||||||
|
|
||||||
|
|
||||||
private void initEspProvision() {
|
private void initEspProvision() {
|
||||||
|
provisionTimeoutHandled = false;
|
||||||
|
handler.removeCallbacks(provisionTimeoutRunnable);
|
||||||
|
handler.postDelayed(provisionTimeoutRunnable, PROVISION_TIMEOUT_MS);
|
||||||
espProvisionManager = EspProvisionManager.init(mContext).setCallback(new ProvisionCallback() {
|
espProvisionManager = EspProvisionManager.init(mContext).setCallback(new ProvisionCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onConnecting() {
|
public void onConnecting() {
|
||||||
@@ -128,6 +143,7 @@ public class DeviceConnectActivity extends BaseActivity<DeviceConnectLayoutBindi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String deviceName, String deviceType) {
|
public void onSuccess(String deviceName, String deviceType) {
|
||||||
|
handler.removeCallbacks(provisionTimeoutRunnable);
|
||||||
Log.i("TEST", "DeviceConnectActivity===== deviceName:" + deviceName + "配网成功");
|
Log.i("TEST", "DeviceConnectActivity===== deviceName:" + deviceName + "配网成功");
|
||||||
ToastUtil.showShort(mContext, deviceName + "配网成功");
|
ToastUtil.showShort(mContext, deviceName + "配网成功");
|
||||||
handler.postDelayed(new Runnable() {
|
handler.postDelayed(new Runnable() {
|
||||||
@@ -145,6 +161,7 @@ public class DeviceConnectActivity extends BaseActivity<DeviceConnectLayoutBindi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailed(int errorCode, String message) {
|
public void onFailed(int errorCode, String message) {
|
||||||
|
handler.removeCallbacks(provisionTimeoutRunnable);
|
||||||
isBleConnecting = false;
|
isBleConnecting = false;
|
||||||
if (errorCode != 0) {
|
if (errorCode != 0) {
|
||||||
isBleConnected = espProvisionManager != null && espProvisionManager.isConnected();
|
isBleConnected = espProvisionManager != null && espProvisionManager.isConnected();
|
||||||
@@ -200,9 +217,14 @@ public class DeviceConnectActivity extends BaseActivity<DeviceConnectLayoutBindi
|
|||||||
|
|
||||||
Intent intent = new Intent(this, AddDeviceActivity.class);
|
Intent intent = new Intent(this, AddDeviceActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
intent.putExtra(AddDeviceActivity.EXTRA_RESTART_BLE_SCAN, true);
|
||||||
|
handler.postDelayed(() -> {
|
||||||
|
if (!isFinishing()) {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
}, 1500L);
|
||||||
|
}
|
||||||
|
|
||||||
private void connectBleDevice() {
|
private void connectBleDevice() {
|
||||||
if (mBleDeviceEntity == null || espProvisionManager == null) {
|
if (mBleDeviceEntity == null || espProvisionManager == null) {
|
||||||
@@ -247,14 +269,15 @@ public class DeviceConnectActivity extends BaseActivity<DeviceConnectLayoutBindi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
handler.removeCallbacks(provisionTimeoutRunnable);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
handler.removeCallbacksAndMessages(null);
|
handler.removeCallbacksAndMessages(null);
|
||||||
if (animationDrawable != null && animationDrawable.isRunning()) {
|
if (animationDrawable != null && animationDrawable.isRunning()) {
|
||||||
animationDrawable.stop();
|
animationDrawable.stop();
|
||||||
}
|
}
|
||||||
if (espProvisionManager != null) {
|
if (espProvisionManager != null) {
|
||||||
espProvisionManager.disconnect();
|
|
||||||
espProvisionManager.setCallback(null);
|
espProvisionManager.setCallback(null);
|
||||||
|
espProvisionManager.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,3 +336,6 @@ public class DeviceConnectActivity extends BaseActivity<DeviceConnectLayoutBindi
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
|||||||
updateWorkProgress();
|
updateWorkProgress();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* 轮询请求设备详情
|
||||||
|
*/
|
||||||
private final Runnable mDeviceDetailPollRunnable = new Runnable() {
|
private final Runnable mDeviceDetailPollRunnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -398,12 +401,29 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
|||||||
@Override
|
@Override
|
||||||
public void getDeviceDetailInfo(WaterDeviceEntity bean) {
|
public void getDeviceDetailInfo(WaterDeviceEntity bean) {
|
||||||
hideDialogLoading();
|
hideDialogLoading();
|
||||||
|
if(!TextUtils.isEmpty(bean.getPowerStatus()) && bean.getPowerStatus().equals("1")){
|
||||||
|
viewBinding.imgBatStatus.setImageResource(R.mipmap.icon_charging);
|
||||||
|
}else{
|
||||||
viewBinding.imgBatStatus.setImageResource(PowerIconManage.getInstance().
|
viewBinding.imgBatStatus.setImageResource(PowerIconManage.getInstance().
|
||||||
getPowerVerIcon(Integer.parseInt(bean.getPowerLevel())));
|
getPowerVerIcon(Integer.parseInt(bean.getPowerLevel())));
|
||||||
mDeviceEntity = bean;
|
|
||||||
updateDeviceStatus( bean);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mDeviceEntity = bean;
|
||||||
|
updateDeviceStatus( bean);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deviceAccessLost() {
|
||||||
|
stopDeviceDetailPolling();
|
||||||
|
showDialogtextInterBackKey(null, false, false, false,
|
||||||
|
getString(R.string.tip_text), getString(R.string.device_control_access_lost),
|
||||||
|
"", getString(R.string.confirm_text), new BaseFragment.OnDialogClick() {
|
||||||
|
@Override public void onCancelClick() { finish(); }
|
||||||
|
@Override public void onConfirmClick() { finish(); }
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开关设备成功
|
* 开关设备成功
|
||||||
@@ -588,3 +608,5 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public class DeviceSettingsActivity extends BaseActivity<DeviceSettingsLayoutBin
|
|||||||
setClick(viewBinding.rlDevInfo);
|
setClick(viewBinding.rlDevInfo);
|
||||||
setClick(viewBinding.rlDevWifiManager);
|
setClick(viewBinding.rlDevWifiManager);
|
||||||
setClick(viewBinding.rlDevUnbind);
|
setClick(viewBinding.rlDevUnbind);
|
||||||
|
setClick(viewBinding.rlResetDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setClick(View view) {
|
private void setClick(View view) {
|
||||||
@@ -134,7 +135,7 @@ public class DeviceSettingsActivity extends BaseActivity<DeviceSettingsLayoutBin
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.rl_dev_unbind:
|
case R.id.rl_dev_unbind://解绑
|
||||||
showDialogtext(null, false, false, true,
|
showDialogtext(null, false, false, true,
|
||||||
getString(R.string.tip_text), getString(R.string.tip_unbind_device),
|
getString(R.string.tip_text), getString(R.string.tip_unbind_device),
|
||||||
getString(R.string.cancel_text), getString(R.string.confirm_text), new BaseFragment.OnDialogClick() {
|
getString(R.string.cancel_text), getString(R.string.confirm_text), new BaseFragment.OnDialogClick() {
|
||||||
@@ -149,6 +150,21 @@ public class DeviceSettingsActivity extends BaseActivity<DeviceSettingsLayoutBin
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case R.id.rl_reset_device://恢复出厂设置
|
||||||
|
showDialogtext(null, false, false, true,
|
||||||
|
getString(R.string.tip_text), getString(R.string.restore_factory_settings_warning),
|
||||||
|
getString(R.string.cancel_text), getString(R.string.confirm_text), new BaseFragment.OnDialogClick() {
|
||||||
|
@Override
|
||||||
|
public void onCancelClick() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick() {
|
||||||
|
mPresenter.factoryResetDevice(mDeviceEntity);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,6 +222,19 @@ public class DeviceSettingsActivity extends BaseActivity<DeviceSettingsLayoutBin
|
|||||||
},500);
|
},500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void factoryResetDeviceSuccess(BaseBean bean) {
|
||||||
|
hideDialogLoading();
|
||||||
|
ToastUtil.showShort(mContext, getString(R.string.factory_reset_success));
|
||||||
|
EventBus.getDefault().post(new EventMessage(EventMessage.ACTIVITY_FINISH));
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutResId(Bundle savedInstanceState) {
|
public int getLayoutResId(Bundle savedInstanceState) {
|
||||||
@@ -214,7 +243,8 @@ public class DeviceSettingsActivity extends BaseActivity<DeviceSettingsLayoutBin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showError(String message) {
|
public void showError(String message) {
|
||||||
|
hideDialogLoading();
|
||||||
|
ToastUtil.showShort(mContext,message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
|||||||
implements DeviceContract.DeviceView {
|
implements DeviceContract.DeviceView {
|
||||||
|
|
||||||
private static final long BLE_CONNECT_TIMEOUT = 40 * 1000L;
|
private static final long BLE_CONNECT_TIMEOUT = 40 * 1000L;
|
||||||
|
private static final long WIFI_SCAN_TIMEOUT = 15 * 1000L;
|
||||||
|
private static final long WIFI_SCAN_SEND_RETRY_DELAY = 1200L;
|
||||||
|
private static final int WIFI_SCAN_SEND_MAX_RETRIES = 1;
|
||||||
|
private static final String WIFI_SCAN_SEND_FAILED_MESSAGE = "Failed to send Wi-Fi scan command.";
|
||||||
//当前密码显示/隐藏
|
//当前密码显示/隐藏
|
||||||
private boolean isPasswordVisible = false;
|
private boolean isPasswordVisible = false;
|
||||||
|
|
||||||
@@ -70,6 +74,19 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
|||||||
private Handler bleConnectHandler = new Handler(Looper.getMainLooper());
|
private Handler bleConnectHandler = new Handler(Looper.getMainLooper());
|
||||||
private AnimationDrawable animationDrawable;
|
private AnimationDrawable animationDrawable;
|
||||||
private Handler handler = new Handler(Looper.getMainLooper());
|
private Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
private boolean isWifiScanning = false;
|
||||||
|
private int wifiScanSendRetryCount = 0;
|
||||||
|
private final Runnable wifiScanSendRetryTask = this::requestWifiScan;
|
||||||
|
private final Runnable wifiScanTimeoutTask = () -> {
|
||||||
|
if (!isWifiScanning || isFinishing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
handler.removeCallbacks(wifiScanSendRetryTask);
|
||||||
|
isWifiScanning = false;
|
||||||
|
hideDialogLoading();
|
||||||
|
viewBinding.tvNext.setVisibility(View.VISIBLE);
|
||||||
|
ToastUtil.showShort(mContext, getString(R.string.scan_failed));
|
||||||
|
};
|
||||||
private final Runnable bleConnectTask = new Runnable() {
|
private final Runnable bleConnectTask = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -96,6 +113,9 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
handler.removeCallbacks(wifiScanTimeoutTask);
|
||||||
|
handler.removeCallbacks(wifiScanSendRetryTask);
|
||||||
|
isWifiScanning = false;
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
cancelBleConnectTask();
|
cancelBleConnectTask();
|
||||||
if (WITCH_FROM_CODE == 100 && espProvisionManager != null && !keepBleConnectionForProvision) {
|
if (WITCH_FROM_CODE == 100 && espProvisionManager != null && !keepBleConnectionForProvision) {
|
||||||
@@ -417,6 +437,9 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void scanWifi() {
|
private void scanWifi() {
|
||||||
|
if (isWifiScanning) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
viewBinding.tvNext.setVisibility(View.GONE);
|
viewBinding.tvNext.setVisibility(View.GONE);
|
||||||
|
|
||||||
@@ -426,24 +449,57 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isWifiScanning = true;
|
||||||
|
wifiScanSendRetryCount = 0;
|
||||||
|
handler.removeCallbacks(wifiScanTimeoutTask);
|
||||||
|
handler.postDelayed(wifiScanTimeoutTask, WIFI_SCAN_TIMEOUT);
|
||||||
|
|
||||||
|
requestWifiScan();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void requestWifiScan() {
|
||||||
|
if (!isWifiScanning || isFinishing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
espProvisionManager.scanWifiFromDevice(new WiFiScanListener() {
|
espProvisionManager.scanWifiFromDevice(new WiFiScanListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWifiListReceived(ArrayList<WiFiAccessPoint> wifiList) {
|
public void onWifiListReceived(ArrayList<WiFiAccessPoint> wifiList) {
|
||||||
runOnUiThread(() -> displayWifiListFromDevice(wifiList));
|
runOnUiThread(() -> {
|
||||||
|
handler.removeCallbacks(wifiScanTimeoutTask);
|
||||||
|
handler.removeCallbacks(wifiScanSendRetryTask);
|
||||||
|
isWifiScanning = false;
|
||||||
|
displayWifiListFromDevice(wifiList);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWiFiScanFailed(Exception e) {
|
public void onWiFiScanFailed(Exception e) {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
ToastUtil.showShort(mContext, getString(R.string.scan_failed) + e.getMessage());
|
if (isWifiScanning && isWifiScanSendFailure(e)
|
||||||
|
&& wifiScanSendRetryCount < WIFI_SCAN_SEND_MAX_RETRIES) {
|
||||||
|
wifiScanSendRetryCount++;
|
||||||
|
handler.removeCallbacks(wifiScanSendRetryTask);
|
||||||
|
handler.postDelayed(wifiScanSendRetryTask, WIFI_SCAN_SEND_RETRY_DELAY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
handler.removeCallbacks(wifiScanTimeoutTask);
|
||||||
|
handler.removeCallbacks(wifiScanSendRetryTask);
|
||||||
|
isWifiScanning = false;
|
||||||
|
String errorMessage = e == null ? "" : e.getMessage();
|
||||||
|
ToastUtil.showShort(mContext, getString(R.string.scan_failed) + errorMessage);
|
||||||
hideDialogLoading();
|
hideDialogLoading();
|
||||||
|
viewBinding.tvNext.setVisibility(View.VISIBLE);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isWifiScanSendFailure(Exception e) {
|
||||||
|
return e != null && WIFI_SCAN_SEND_FAILED_MESSAGE.equals(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
private void displayWifiListFromDevice(ArrayList<WiFiAccessPoint> wifiNetworks) {
|
private void displayWifiListFromDevice(ArrayList<WiFiAccessPoint> wifiNetworks) {
|
||||||
Set<String> wifiSet = new HashSet<>();
|
Set<String> wifiSet = new HashSet<>();
|
||||||
List<String> wifiNameList = new ArrayList<>();
|
List<String> wifiNameList = new ArrayList<>();
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ public class DeviceContract {
|
|||||||
//删除设备信息
|
//删除设备信息
|
||||||
void deleteDevice(String id, IndexContract.CallBack callBack);
|
void deleteDevice(String id, IndexContract.CallBack callBack);
|
||||||
|
|
||||||
|
//恢复设备出厂设置
|
||||||
|
void factoryResetDevice(String id, IndexContract.CallBack callBack);
|
||||||
|
|
||||||
//手动开启关闭设备
|
//手动开启关闭设备
|
||||||
void turnOnOffDevice(JSONObject json, IndexContract.CallBack callBack);
|
void turnOnOffDevice(JSONObject json, IndexContract.CallBack callBack);
|
||||||
|
|
||||||
@@ -38,8 +41,12 @@ public class DeviceContract {
|
|||||||
//添加设备成功g
|
//添加设备成功g
|
||||||
void addDeviceSuccess(WaterDeviceEntity bean);
|
void addDeviceSuccess(WaterDeviceEntity bean);
|
||||||
void getDeviceDetailInfo(WaterDeviceEntity bean);
|
void getDeviceDetailInfo(WaterDeviceEntity bean);
|
||||||
|
default void deviceAccessLost() {
|
||||||
|
}
|
||||||
void editDeviceInfoSuccess(BaseBean bean);
|
void editDeviceInfoSuccess(BaseBean bean);
|
||||||
void deleteDeviceSuccess(BaseBean bean);
|
void deleteDeviceSuccess(BaseBean bean);
|
||||||
|
default void factoryResetDeviceSuccess(BaseBean bean) {
|
||||||
|
}
|
||||||
void turnOnOffDeviceSuccess(BaseBean bean, String status);
|
void turnOnOffDeviceSuccess(BaseBean bean, String status);
|
||||||
|
|
||||||
void queryDeviceBindStatusSuccess(WaterDeviceEntity bean);
|
void queryDeviceBindStatusSuccess(WaterDeviceEntity bean);
|
||||||
@@ -47,3 +54,5 @@ public class DeviceContract {
|
|||||||
void queryDeviceWorkTimeSuccess(WaterDeviceEntity bean);
|
void queryDeviceWorkTimeSuccess(WaterDeviceEntity bean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class DeviceImpl implements DeviceContract.DataModel{
|
|||||||
public void onNext(@NonNull BaseBean<WaterDeviceEntity> bean) {
|
public void onNext(@NonNull BaseBean<WaterDeviceEntity> bean) {
|
||||||
if (bean.getCode() == 200) {
|
if (bean.getCode() == 200) {
|
||||||
callBack.success(bean.getData(),0);
|
callBack.success(bean.getData(),0);
|
||||||
|
} else {
|
||||||
|
callBack.fail(bean.getCode() == 501 ? "DEVICE_ACCESS_LOST" : bean.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,6 +170,46 @@ public class DeviceImpl implements DeviceContract.DataModel{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 恢复设备出厂设置
|
||||||
|
* @param deviceNo 设备编号
|
||||||
|
* @param callBack 请求结果回调
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void factoryResetDevice(String deviceNo, IndexContract.CallBack callBack) {
|
||||||
|
try {
|
||||||
|
NetWorkManager.getRequest().deviceFactoryReset(NetWorkManager.getToken(), deviceNo)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.unsubscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<BaseBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseBean bean) {
|
||||||
|
if (bean.getCode() == 200) {
|
||||||
|
callBack.success(bean, 0);
|
||||||
|
} else {
|
||||||
|
callBack.fail(bean.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
callBack.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手动开启关闭设备
|
* 手动开启关闭设备
|
||||||
* @param json
|
* @param json
|
||||||
@@ -228,6 +270,8 @@ public class DeviceImpl implements DeviceContract.DataModel{
|
|||||||
public void onNext(@NonNull BaseBean<WaterDeviceEntity> bean) {
|
public void onNext(@NonNull BaseBean<WaterDeviceEntity> bean) {
|
||||||
if (bean.getCode() == 200) {
|
if (bean.getCode() == 200) {
|
||||||
callBack.success(bean.getData(),0);
|
callBack.success(bean.getData(),0);
|
||||||
|
} else {
|
||||||
|
callBack.fail(bean.getCode() == 501 ? "DEVICE_ACCESS_LOST" : bean.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,3 +286,4 @@ public class DeviceImpl implements DeviceContract.DataModel{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,11 @@ public class DevicePresenter extends BasePresenter<DeviceContract.DeviceView> {
|
|||||||
@Override
|
@Override
|
||||||
public void fail(String msg) {
|
public void fail(String msg) {
|
||||||
if(DevicePresenter.this.getView() != null){
|
if(DevicePresenter.this.getView() != null){
|
||||||
DevicePresenter.this.getView().showError( msg);
|
if ("DEVICE_ACCESS_LOST".equals(msg)) {
|
||||||
|
DevicePresenter.this.getView().deviceAccessLost();
|
||||||
|
} else {
|
||||||
|
DevicePresenter.this.getView().showError(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -76,7 +80,11 @@ public class DevicePresenter extends BasePresenter<DeviceContract.DeviceView> {
|
|||||||
@Override
|
@Override
|
||||||
public void fail(String msg) {
|
public void fail(String msg) {
|
||||||
if(DevicePresenter.this.getView() != null){
|
if(DevicePresenter.this.getView() != null){
|
||||||
DevicePresenter.this.getView().showError( msg);
|
if ("DEVICE_ACCESS_LOST".equals(msg)) {
|
||||||
|
DevicePresenter.this.getView().deviceAccessLost();
|
||||||
|
} else {
|
||||||
|
DevicePresenter.this.getView().showError(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -104,7 +112,11 @@ public class DevicePresenter extends BasePresenter<DeviceContract.DeviceView> {
|
|||||||
@Override
|
@Override
|
||||||
public void fail(String msg) {
|
public void fail(String msg) {
|
||||||
if(DevicePresenter.this.getView() != null){
|
if(DevicePresenter.this.getView() != null){
|
||||||
DevicePresenter.this.getView().showError( msg);
|
if ("DEVICE_ACCESS_LOST".equals(msg)) {
|
||||||
|
DevicePresenter.this.getView().deviceAccessLost();
|
||||||
|
} else {
|
||||||
|
DevicePresenter.this.getView().showError(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -135,6 +147,28 @@ public class DevicePresenter extends BasePresenter<DeviceContract.DeviceView> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 恢复设备出厂设置
|
||||||
|
* @param deviceEntity 设备信息
|
||||||
|
*/
|
||||||
|
public void factoryResetDevice(WaterDeviceEntity deviceEntity) {
|
||||||
|
impl.factoryResetDevice(deviceEntity.getDeviceNo(), new IndexContract.CallBack<BaseBean>() {
|
||||||
|
@Override
|
||||||
|
public void success(BaseBean bean, int total) {
|
||||||
|
if (DevicePresenter.this.getView() != null) {
|
||||||
|
DevicePresenter.this.getView().factoryResetDeviceSuccess(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fail(String msg) {
|
||||||
|
if (DevicePresenter.this.getView() != null) {
|
||||||
|
DevicePresenter.this.getView().showError(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开启/关闭浇水
|
* 开启/关闭浇水
|
||||||
* @param deviceEntity
|
* @param deviceEntity
|
||||||
@@ -159,7 +193,11 @@ public class DevicePresenter extends BasePresenter<DeviceContract.DeviceView> {
|
|||||||
@Override
|
@Override
|
||||||
public void fail(String msg) {
|
public void fail(String msg) {
|
||||||
if(DevicePresenter.this.getView() != null){
|
if(DevicePresenter.this.getView() != null){
|
||||||
DevicePresenter.this.getView().showError( msg);
|
if ("DEVICE_ACCESS_LOST".equals(msg)) {
|
||||||
|
DevicePresenter.this.getView().deviceAccessLost();
|
||||||
|
} else {
|
||||||
|
DevicePresenter.this.getView().showError(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -218,9 +256,14 @@ public class DevicePresenter extends BasePresenter<DeviceContract.DeviceView> {
|
|||||||
@Override
|
@Override
|
||||||
public void fail(String msg) {
|
public void fail(String msg) {
|
||||||
if(DevicePresenter.this.getView() != null){
|
if(DevicePresenter.this.getView() != null){
|
||||||
DevicePresenter.this.getView().showError( msg);
|
if ("DEVICE_ACCESS_LOST".equals(msg)) {
|
||||||
|
DevicePresenter.this.getView().deviceAccessLost();
|
||||||
|
} else {
|
||||||
|
DevicePresenter.this.getView().showError(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -210,6 +210,21 @@ public class IndexFragment extends BaseFragment<IndexFragmentLayoutBinding, Inde
|
|||||||
deviceAdapter = new DeviceAdapter(mContext,R.layout.index_device_list_item,devList);
|
deviceAdapter = new DeviceAdapter(mContext,R.layout.index_device_list_item,devList);
|
||||||
viewBinding.rvDevices.setAdapter(deviceAdapter);
|
viewBinding.rvDevices.setAdapter(deviceAdapter);
|
||||||
deviceAdapter.setOnItemClickListener((adapter, view, position) -> {
|
deviceAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||||
|
if(!devList.get(position).getBindingStatus().equals("ACTIVE")){
|
||||||
|
showDialogtext(null, false, false,
|
||||||
|
getString(R.string.tip_text), getString(R.string.device_no_permission_delete_message),
|
||||||
|
getString(R.string.cancel_text), getString(R.string.confirm_text), new BaseFragment.OnDialogClick() {
|
||||||
|
@Override
|
||||||
|
public void onCancelClick() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick() {
|
||||||
|
mPresenter.removeDeviceEntry(devList.get(position).getDeviceNo());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("device_info",devList.get(position));
|
bundle.putSerializable("device_info",devList.get(position));
|
||||||
goTo(mContext, DeviceControlActivity.class,bundle);
|
goTo(mContext, DeviceControlActivity.class,bundle);
|
||||||
@@ -253,6 +268,12 @@ public class IndexFragment extends BaseFragment<IndexFragmentLayoutBinding, Inde
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeDeviceEntrySuccess(BaseBean bean) {
|
||||||
|
ToastUtil.showShort(mContext, getString(R.string.remove_success));
|
||||||
|
mCurrentPage = 1;
|
||||||
|
mPresenter.getDevicesList(mCurrentPage);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 查询当前设备绑定状态
|
* 查询当前设备绑定状态
|
||||||
* @param entity
|
* @param entity
|
||||||
@@ -477,3 +498,5 @@ public class IndexFragment extends BaseFragment<IndexFragmentLayoutBinding, Inde
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import com.chad.library.adapter.base.BaseViewHolder;
|
|||||||
import com.ckkj.water.R;
|
import com.ckkj.water.R;
|
||||||
import com.ckkj.water.index.entity.WaterDeviceEntity;
|
import com.ckkj.water.index.entity.WaterDeviceEntity;
|
||||||
import com.ckkj.water.utils.manager.PowerIconManage;
|
import com.ckkj.water.utils.manager.PowerIconManage;
|
||||||
import com.esafirm.imagepicker.model.Image;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -28,10 +27,10 @@ public class DeviceAdapter extends BaseQuickAdapter<WaterDeviceEntity, BaseViewH
|
|||||||
ImageView imgPower = holder.getView(R.id.img_battery);
|
ImageView imgPower = holder.getView(R.id.img_battery);
|
||||||
View viewStatus = holder.getView(R.id.view_status_dot);
|
View viewStatus = holder.getView(R.id.view_status_dot);
|
||||||
holder.setText(R.id.tv_device_name,item.getDeviceName());
|
holder.setText(R.id.tv_device_name,item.getDeviceName());
|
||||||
holder.setText(R.id.tv_device_serial,item.getDeviceSn());
|
holder.setText(R.id.tv_device_serial,item.getDeviceNo());
|
||||||
//设备联网在线
|
//设备联网在线
|
||||||
if(item.getStatus().equals("1")){
|
if ("1".equals(item.getStatus())) {
|
||||||
switch (item.getWorkStatus()){
|
switch (item.getWorkStatus() == null ? "0" : item.getWorkStatus()){
|
||||||
case "0"://待机
|
case "0"://待机
|
||||||
holder.setText(R.id.tv_device_status,mContext.getString(R.string.device_status_not_working));
|
holder.setText(R.id.tv_device_status,mContext.getString(R.string.device_status_not_working));
|
||||||
holder.setTextColor(R.id.tv_device_status,mContext.getResources().getColor(R.color.color_999999));
|
holder.setTextColor(R.id.tv_device_status,mContext.getResources().getColor(R.color.color_999999));
|
||||||
@@ -50,55 +49,27 @@ public class DeviceAdapter extends BaseQuickAdapter<WaterDeviceEntity, BaseViewH
|
|||||||
viewStatus.setBackground(mContext.getResources().getDrawable(R.drawable.shape_status_dot_red));
|
viewStatus.setBackground(mContext.getResources().getDrawable(R.drawable.shape_status_dot_red));
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(item.getStatus().equals("1") || item.getStatus().equals("2")){
|
|
||||||
// }else{
|
|
||||||
// holder.setText(R.id.tv_device_status,mContext.getString(R.string.device_status_offline));
|
|
||||||
// holder.setTextColor(R.id.tv_device_status,mContext.getResources().getColor(R.color.color_999999));
|
|
||||||
// viewStatus.setBackground(mContext.getResources().getDrawable(R.drawable.shape_status_dot_999999));
|
|
||||||
// }
|
|
||||||
|
|
||||||
holder.setText(R.id.tv_battery_level,item.getPowerLevel());
|
String powerLevel = item.getPowerLevel();
|
||||||
imgPower.setImageResource(PowerIconManage.getInstance().getPowerIcon(Integer.parseInt(item.getPowerLevel())));
|
int power = 0;
|
||||||
|
if (powerLevel != null) {
|
||||||
|
try {
|
||||||
|
power = Integer.parseInt(powerLevel.trim());
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
power = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ("1".equals(item.getPowerStatus())) {
|
||||||
|
holder.setText(R.id.tv_battery_level, "充电中 " + (powerLevel == null ? "0%" : powerLevel + "%"));
|
||||||
|
imgPower.setImageResource(R.mipmap.icon_charging);
|
||||||
|
} else {
|
||||||
|
holder.setText(R.id.tv_battery_level, powerLevel == null ? "0%" : powerLevel + "%");
|
||||||
|
imgPower.setImageResource(PowerIconManage.getInstance().getPowerIcon(power));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public DeviceAdapter() {
|
|
||||||
// super();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onBindViewHolder(@NonNull ViewHolder holder, int position, @NonNull String data) {
|
|
||||||
// holder.tvDeviceName.setText(deviceNames[position]);
|
|
||||||
// holder.tvDeviceSerial.setText(deviceSerials[position]);
|
|
||||||
// holder.tvDeviceStatus.setText(deviceStatuses[position]);
|
|
||||||
// holder.tvBatteryLevel.setText(batteryLevels[position] + "%");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @NonNull
|
|
||||||
// @Override
|
|
||||||
// public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
||||||
// View view = LayoutInflater.from(parent.getContext())
|
|
||||||
// .inflate(R.layout.index_device_list_item, parent, false);
|
|
||||||
// return new ViewHolder(view);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void convert(ViewHolder helper, String item) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// static class ViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
// TextView tvDeviceName;
|
|
||||||
// TextView tvDeviceSerial;
|
|
||||||
// TextView tvDeviceStatus;
|
|
||||||
// TextView tvBatteryLevel;
|
|
||||||
//
|
|
||||||
// public ViewHolder(@NonNull View itemView) {
|
|
||||||
// super(itemView);
|
|
||||||
// tvDeviceName = itemView.findViewById(R.id.tv_device_name);
|
|
||||||
// tvDeviceSerial = itemView.findViewById(R.id.tv_device_serial);
|
|
||||||
// tvDeviceStatus = itemView.findViewById(R.id.tv_device_status);
|
|
||||||
// tvBatteryLevel = itemView.findViewById(R.id.tv_battery_level);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class WaterDeviceEntity implements Serializable {
|
|||||||
private String status;
|
private String status;
|
||||||
private String workStatus;
|
private String workStatus;
|
||||||
private String powerLevel;
|
private String powerLevel;
|
||||||
|
private String powerStatus;
|
||||||
private String powerLevelUpdatatime;
|
private String powerLevelUpdatatime;
|
||||||
private String wifiName;
|
private String wifiName;
|
||||||
private String wifiPassword;
|
private String wifiPassword;
|
||||||
@@ -50,6 +51,7 @@ public class WaterDeviceEntity implements Serializable {
|
|||||||
private WaterDeviceEntity bindDevice;
|
private WaterDeviceEntity bindDevice;
|
||||||
private String startTime;
|
private String startTime;
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
private String bindingStatus;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@@ -80,5 +82,8 @@ public class WaterDeviceEntity implements Serializable {
|
|||||||
private String powerLevelUpdatatimeX;
|
private String powerLevelUpdatatimeX;
|
||||||
private Object expirationTimeX;
|
private Object expirationTimeX;
|
||||||
private String checkStatus = "0";
|
private String checkStatus = "0";
|
||||||
|
private String bindingStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ckkj.water.index.mvp;
|
|||||||
|
|
||||||
import com.ckkj.water.base.IView;
|
import com.ckkj.water.base.IView;
|
||||||
import com.ckkj.water.index.entity.WaterDeviceEntity;
|
import com.ckkj.water.index.entity.WaterDeviceEntity;
|
||||||
|
import com.ckkj.water.network.BaseBean;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
@@ -25,6 +26,8 @@ public class IndexContract {
|
|||||||
void getDeviceList(Map<String,String> map,CallBack callBack);
|
void getDeviceList(Map<String,String> map,CallBack callBack);
|
||||||
//查询二维码当前设备绑定状态
|
//查询二维码当前设备绑定状态
|
||||||
void queryDeviceBindStatus(JSONObject json, CallBack callBack);
|
void queryDeviceBindStatus(JSONObject json, CallBack callBack);
|
||||||
|
//从设备列表中移除设备
|
||||||
|
void removeDeviceEntry(String deviceNo, CallBack callBack);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,5 +35,8 @@ public class IndexContract {
|
|||||||
void getDeviceListSuccess(List<WaterDeviceEntity> list, int total);
|
void getDeviceListSuccess(List<WaterDeviceEntity> list, int total);
|
||||||
//查询二维码当前设备绑定状态
|
//查询二维码当前设备绑定状态
|
||||||
void queryDeviceBindStatusSuccess(WaterDeviceEntity entity);
|
void queryDeviceBindStatusSuccess(WaterDeviceEntity entity);
|
||||||
|
//从设备列表中移除设备成功
|
||||||
|
void removeDeviceEntrySuccess(BaseBean bean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,4 +91,35 @@ public class IndexImpl implements IndexContract.DataModel{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public void removeDeviceEntry(String deviceNo, IndexContract.CallBack callBack) {
|
||||||
|
NetWorkManager.getRequest().removeDeviceEntry(NetWorkManager.getToken(), deviceNo)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.unsubscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<BaseBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseBean bean) {
|
||||||
|
if (bean.getCode() == 200) {
|
||||||
|
callBack.success(bean, 0);
|
||||||
|
} else {
|
||||||
|
callBack.fail(bean.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
callBack.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
|
||||||
|
|||||||
@@ -71,4 +71,22 @@ public class IndexPresenter extends BasePresenter<IndexContract.IndexView>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public void removeDeviceEntry(String deviceNo) {
|
||||||
|
mImpl.removeDeviceEntry(deviceNo, new IndexContract.CallBack<BaseBean>() {
|
||||||
|
@Override
|
||||||
|
public void success(BaseBean bean, int total) {
|
||||||
|
if (IndexPresenter.this.getView() != null) {
|
||||||
|
IndexPresenter.this.getView().removeDeviceEntrySuccess(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fail(String msg) {
|
||||||
|
if (IndexPresenter.this.getView() != null) {
|
||||||
|
IndexPresenter.this.getView().showError(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
|
||||||
|
|||||||
@@ -58,11 +58,13 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
//当前登录方式 验证码100 密码 200..
|
//当前登录方式 验证码100 密码 200..
|
||||||
private static int LOGIN_TYPE_STATUS_CODE = 100;
|
private static int LOGIN_TYPE_STATUS_CODE = 100;
|
||||||
|
|
||||||
|
/** 创建登录页面对应的 Presenter。 */
|
||||||
@Override
|
@Override
|
||||||
public LoginPresenter createPresenter() {
|
public LoginPresenter createPresenter() {
|
||||||
return new LoginPresenter(new LoginImpl());
|
return new LoginPresenter(new LoginImpl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 初始化登录页面数据、状态栏、协议文本及点击事件。 */
|
||||||
@Override
|
@Override
|
||||||
public void initData(Bundle savedInstanceState) {
|
public void initData(Bundle savedInstanceState) {
|
||||||
super.initData(savedInstanceState);
|
super.initData(savedInstanceState);
|
||||||
@@ -77,6 +79,7 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
initListener();
|
initListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 初始化页面控件的点击监听事件。 */
|
||||||
private void initListener() {
|
private void initListener() {
|
||||||
setClick(viewBinding.tabCode);
|
setClick(viewBinding.tabCode);
|
||||||
setClick(viewBinding.tabPsd);
|
setClick(viewBinding.tabPsd);
|
||||||
@@ -91,10 +94,12 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
setClick(viewBinding.btn151);
|
setClick(viewBinding.btn151);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 为指定控件统一设置点击监听。 */
|
||||||
private void setClick(View view) {
|
private void setClick(View view) {
|
||||||
view.setOnClickListener(this::onClick);
|
view.setOnClickListener(this::onClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 设置用户协议和隐私政策的可点击文本。 */
|
||||||
private void setupAgreementText() {
|
private void setupAgreementText() {
|
||||||
|
|
||||||
ClickUtil.addClickPart(viewBinding.checkboxRead, 100);
|
ClickUtil.addClickPart(viewBinding.checkboxRead, 100);
|
||||||
@@ -137,6 +142,7 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
tvAgreement.setHighlightColor(Color.TRANSPARENT);
|
tvAgreement.setHighlightColor(Color.TRANSPARENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 为协议文本中的指定内容添加可点击样式和响应事件。 */
|
||||||
private void addClickableSpan(
|
private void addClickableSpan(
|
||||||
SpannableString spannableString,
|
SpannableString spannableString,
|
||||||
String content,
|
String content,
|
||||||
@@ -181,6 +187,7 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 统一处理登录页面各控件的点击事件。 */
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
|
|
||||||
@@ -335,6 +342,7 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CountDownTimer cdTimer = new CountDownTimer(60000, 1000) {
|
private CountDownTimer cdTimer = new CountDownTimer(60000, 1000) {
|
||||||
|
/** 更新验证码重新发送倒计时状态。 */
|
||||||
@Override
|
@Override
|
||||||
public void onTick(long millisUntilFinished) {
|
public void onTick(long millisUntilFinished) {
|
||||||
viewBinding.tvGetVerifiCode.setText("(" + millisUntilFinished / 1000 + ") " + getString(R.string.login_resend));
|
viewBinding.tvGetVerifiCode.setText("(" + millisUntilFinished / 1000 + ") " + getString(R.string.login_resend));
|
||||||
@@ -344,6 +352,7 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
viewBinding.tvGetVerifiCode.setBackground(mContext.getResources().getDrawable(R.drawable.shape_gray_50));
|
viewBinding.tvGetVerifiCode.setBackground(mContext.getResources().getDrawable(R.drawable.shape_gray_50));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 倒计时结束后恢复验证码发送按钮状态。 */
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
viewBinding.tvGetVerifiCode.setText(getString(R.string.login_resend));
|
viewBinding.tvGetVerifiCode.setText(getString(R.string.login_resend));
|
||||||
@@ -354,6 +363,7 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 切换密码输入框的明文或密文显示状态。 */
|
||||||
private void togglePasswordVisibility() {
|
private void togglePasswordVisibility() {
|
||||||
EditText etPassword = viewBinding.etInputPsd;
|
EditText etPassword = viewBinding.etInputPsd;
|
||||||
ImageView ivToggle = viewBinding.imgPsdShowHide;
|
ImageView ivToggle = viewBinding.imgPsdShowHide;
|
||||||
@@ -379,11 +389,13 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
isPasswordVisible = !isPasswordVisible;
|
isPasswordVisible = !isPasswordVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 处理注册成功回调。 */
|
||||||
@Override
|
@Override
|
||||||
public void registerSuccess(BaseBean bean) {
|
public void registerSuccess(BaseBean bean) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 处理验证码发送成功回调并启动倒计时。 */
|
||||||
@Override
|
@Override
|
||||||
public void getPhoneCodeSuccess(BaseBean bean) {
|
public void getPhoneCodeSuccess(BaseBean bean) {
|
||||||
hideDialogLoading();
|
hideDialogLoading();
|
||||||
@@ -391,6 +403,7 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
cdTimer.start();
|
cdTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 处理登录成功结果,保存登录信息并进入首页。 */
|
||||||
@Override
|
@Override
|
||||||
public void loginBySmsCodeSuccess(LoginEntity entity) {
|
public void loginBySmsCodeSuccess(LoginEntity entity) {
|
||||||
hideDialogLoading();
|
hideDialogLoading();
|
||||||
@@ -409,22 +422,26 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 处理用户密码更新成功回调。 */
|
||||||
@Override
|
@Override
|
||||||
public void updateUserPasswordSuccess(BaseBean bean) {
|
public void updateUserPasswordSuccess(BaseBean bean) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取登录页面布局资源标识。 */
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutResId(Bundle savedInstanceState) {
|
public int getLayoutResId(Bundle savedInstanceState) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 展示接口错误信息并关闭加载弹窗。 */
|
||||||
@Override
|
@Override
|
||||||
public void showError(String message) {
|
public void showError(String message) {
|
||||||
hideDialogLoading();
|
hideDialogLoading();
|
||||||
ToastUtil.showShort(mContext, message);
|
ToastUtil.showShort(mContext, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 处理退出登录回调。 */
|
||||||
@Override
|
@Override
|
||||||
public void logOut(BaseBean bean) {
|
public void logOut(BaseBean bean) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,6 +147,17 @@ public interface Request {
|
|||||||
@DELETE("app/v1/deleteDevice/{deviceNo}")
|
@DELETE("app/v1/deleteDevice/{deviceNo}")
|
||||||
Observable<BaseBean> unBindDevice(@HeaderMap Map<String,String> headMap, @Path("deviceNo") String id);
|
Observable<BaseBean> unBindDevice(@HeaderMap Map<String,String> headMap, @Path("deviceNo") String id);
|
||||||
|
|
||||||
|
|
||||||
|
//设备列表中,移除该设备
|
||||||
|
@DELETE("app/v1/removeDeviceEntry/{deviceNo}")
|
||||||
|
Observable<BaseBean> removeDeviceEntry(@HeaderMap Map<String,String> headMap, @Path("deviceNo") String id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//设备恢复出厂设置
|
||||||
|
@DELETE("app/v1/factoryReset/{deviceNo}")
|
||||||
|
Observable<BaseBean> deviceFactoryReset(@HeaderMap Map<String,String> headMap, @Path("deviceNo") String id);
|
||||||
|
|
||||||
//排程解绑设备
|
//排程解绑设备
|
||||||
@DELETE("app/v1/deleteScheduleDevice")
|
@DELETE("app/v1/deleteScheduleDevice")
|
||||||
Observable<BaseBean> planUnBindDevice(@HeaderMap Map<String,String> headMap,@QueryMap Map<String, String> map);
|
Observable<BaseBean> planUnBindDevice(@HeaderMap Map<String,String> headMap,@QueryMap Map<String, String> map);
|
||||||
|
|||||||
@@ -134,5 +134,27 @@
|
|||||||
android:layout_marginRight="@dimen/dp_23"
|
android:layout_marginRight="@dimen/dp_23"
|
||||||
android:layout_alignParentRight="true"/>
|
android:layout_alignParentRight="true"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/rl_reset_device"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_45"
|
||||||
|
android:visibility="gone">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/dp_20"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="@color/textPrimaryColor"
|
||||||
|
android:text="@string/restore_factory_settings"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_point5"
|
||||||
|
android:layout_width="@dimen/dp_7"
|
||||||
|
android:layout_height="@dimen/dp_13"
|
||||||
|
android:src="@mipmap/icon_point_right"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginRight="@dimen/dp_23"
|
||||||
|
android:layout_alignParentRight="true"/>
|
||||||
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
android:id="@+id/img_noresult"
|
android:id="@+id/img_noresult"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@mipmap/icon_no_result"
|
android:src="@mipmap/img_nodata"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_centerHorizontal="true"/>
|
android:layout_centerHorizontal="true"/>
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="@dimen/dp_10">
|
android:paddingVertical="@dimen/dp_10"
|
||||||
|
android:paddingHorizontal="@dimen/dp_15">
|
||||||
<!-- 左侧:设备信息 -->
|
<!-- 左侧:设备信息 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|||||||
BIN
app/src/main/res/mipmap-xhdpi/icon_charging.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/icon_charging.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 873 B |
BIN
app/src/main/res/mipmap-xxhdpi/icon_charging.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/icon_charging.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/img_nodata.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/img_nodata.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/icon_charging.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/icon_charging.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/img_nodata.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/img_nodata.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -87,6 +87,7 @@
|
|||||||
<string name="device_setting_wifi_manager">Wi-Fi Settings</string>
|
<string name="device_setting_wifi_manager">Wi-Fi Settings</string>
|
||||||
<string name="device_setting_unbind">Remove Device</string>
|
<string name="device_setting_unbind">Remove Device</string>
|
||||||
<string name="unbind_success">Device removed successfully</string>
|
<string name="unbind_success">Device removed successfully</string>
|
||||||
|
<string name="factory_reset_success">Device restored to factory settings successfully</string>
|
||||||
|
|
||||||
<string name="settings_title">Settings</string>
|
<string name="settings_title">Settings</string>
|
||||||
<string name="confirm_text">Confirm</string>
|
<string name="confirm_text">Confirm</string>
|
||||||
@@ -106,7 +107,10 @@
|
|||||||
<string name="closed">Closed</string>
|
<string name="closed">Closed</string>
|
||||||
<string name="end_watering">Stop Watering</string>
|
<string name="end_watering">Stop Watering</string>
|
||||||
<string name="device_offline_tip">Device is offline</string>
|
<string name="device_offline_tip">Device is offline</string>
|
||||||
|
<string name="restore_factory_settings">Restore Factory Settings</string>
|
||||||
|
<string name="restore_factory_settings_warning">This operation will restore the device to factory settings.</string>
|
||||||
|
<string name="device_no_permission_delete_message">This device has been reset or bound to a new user. You no longer have permission to operate this device. Do you want to delete it now?</string>
|
||||||
|
<string name="remove_success">Removed successfully</string>
|
||||||
|
|
||||||
<!-- Schedule -->
|
<!-- Schedule -->
|
||||||
<string name="input_plan_name">Enter schedule name</string>
|
<string name="input_plan_name">Enter schedule name</string>
|
||||||
@@ -333,4 +337,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<string name="device_control_access_lost">You have lost control of this device</string>
|
||||||
|
<string name="device_provision_timeout">Network configuration timed out. Please try again.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
<string name="device_setting_wifi_manager">WiFi管理</string>
|
<string name="device_setting_wifi_manager">WiFi管理</string>
|
||||||
<string name="device_setting_unbind">解绑设备</string>
|
<string name="device_setting_unbind">解绑设备</string>
|
||||||
<string name="unbind_success">设备解绑成功</string>
|
<string name="unbind_success">设备解绑成功</string>
|
||||||
|
<string name="factory_reset_success">设备恢复出厂设置成功</string>
|
||||||
<string name="settings_title">设置</string>
|
<string name="settings_title">设置</string>
|
||||||
<string name="confirm_text">确定</string>
|
<string name="confirm_text">确定</string>
|
||||||
<string name="cancel_text">取消</string>
|
<string name="cancel_text">取消</string>
|
||||||
@@ -97,6 +98,9 @@
|
|||||||
<string name="device_offline_tip">设备已离线</string>
|
<string name="device_offline_tip">设备已离线</string>
|
||||||
<string name="reset_device_provision">该操作需要手动将设备重置到配网模式</string>
|
<string name="reset_device_provision">该操作需要手动将设备重置到配网模式</string>
|
||||||
<string name="device_binding_conflict_message">该设备已被其他用户绑定,您可以登录该账号尝试解绑,或重置设备进入配网模式</string>
|
<string name="device_binding_conflict_message">该设备已被其他用户绑定,您可以登录该账号尝试解绑,或重置设备进入配网模式</string>
|
||||||
|
<string name="restore_factory_settings">恢复出厂设置</string>
|
||||||
|
<string name="restore_factory_settings_warning">该操作将会使设备恢复出厂设置</string>
|
||||||
|
<string name="device_no_permission_delete_message">当前设备已被重置或被新用户绑定,您已无权限继续操作该设备,是否立即删除?</string>
|
||||||
|
|
||||||
|
|
||||||
<!--排程-->
|
<!--排程-->
|
||||||
@@ -131,7 +135,7 @@
|
|||||||
<string name="associated">已关联</string>
|
<string name="associated">已关联</string>
|
||||||
<string name="plan_on">开启</string>
|
<string name="plan_on">开启</string>
|
||||||
<string name="plan_off">关闭</string>
|
<string name="plan_off">关闭</string>
|
||||||
|
<string name="remove_success">移除成功</string>
|
||||||
|
|
||||||
<!--历史-->
|
<!--历史-->
|
||||||
<string name="history_title">历史</string>
|
<string name="history_title">历史</string>
|
||||||
@@ -611,4 +615,8 @@
|
|||||||
书法艺术体现了中华文化的深厚底蕴,学习书法有助于增强文化自信和民族认同感。
|
书法艺术体现了中华文化的深厚底蕴,学习书法有助于增强文化自信和民族认同感。
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
<string name="device_control_access_lost">已失去对该设备的控制权</string>
|
||||||
|
<string name="device_provision_timeout">配网超时,请重试</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user