Compare commits
12 Commits
a31443fa4c
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8e9f60f25 | ||
|
|
c7556a42ab | ||
|
|
548419cf29 | ||
|
|
dff152e7e7 | ||
|
|
0c692c77bd | ||
|
|
22f197a929 | ||
|
|
b25e3540fb | ||
|
|
ec59249b3b | ||
|
|
192ca7d3a4 | ||
|
|
69830dfc69 | ||
|
|
a9ed6f9452 | ||
|
|
5dae94788c |
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2026-07-10T01:12:18.170652300Z">
|
<DropdownSelection timestamp="2026-07-14T09:31:19.203364400Z">
|
||||||
<Target type="DEFAULT_BOOT">
|
<Target type="DEFAULT_BOOT">
|
||||||
<handle>
|
<handle>
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=D122222104A9" />
|
<DeviceId pluginId="Default" identifier="serial=emulator-5554;connection=53435af5" />
|
||||||
</handle>
|
</handle>
|
||||||
</Target>
|
</Target>
|
||||||
</DropdownSelection>
|
</DropdownSelection>
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ public class AppConfig {
|
|||||||
|
|
||||||
|
|
||||||
/**************************测试*******************************/
|
/**************************测试*******************************/
|
||||||
// public static String BASE_URL = "http://47.106.83.229:8081/";//测试http://47.106.83.166:8001/
|
// public static String BASE_URL = "http://47.106.83.229:8081/";//测试http://47.106.83.166:8001/ .
|
||||||
// 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;
|
||||||
|
|
||||||
/**************************本地*******************************/
|
/**************************本地*******************************/
|
||||||
// public static String BASE_URL = "http://192.168.1.217:8081/";//后端本地测试
|
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;
|
||||||
|
|||||||
@@ -156,11 +156,11 @@ public class MyApplication extends Application {
|
|||||||
public void onActivityDestroyed(Activity activity) {}
|
public void onActivityDestroyed(Activity activity) {}
|
||||||
});
|
});
|
||||||
|
|
||||||
AutoSizeConfig.getInstance()
|
// AutoSizeConfig.getInstance()
|
||||||
// 是否使用设备真实尺寸
|
// // 是否使用设备真实尺寸
|
||||||
.setUseDeviceSize(true)
|
// .setUseDeviceSize(true)
|
||||||
// 是否支持 fragment
|
// // 是否支持 fragment
|
||||||
.setCustomFragment(true);
|
// .setCustomFragment(true);
|
||||||
android.util.Log.e("TEST", "hello");
|
android.util.Log.e("TEST", "hello");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -547,10 +547,9 @@ public abstract class BaseActivity<T extends ViewBinding, P extends IPresenter>
|
|||||||
editText.requestFocus();
|
editText.requestFocus();
|
||||||
//设置输入类型
|
//设置输入类型
|
||||||
setEditInputType(editText,inputType);
|
setEditInputType(editText,inputType);
|
||||||
|
|
||||||
if(TextUtils.isEmpty(content)){
|
|
||||||
editText.setHint(hint);
|
editText.setHint(hint);
|
||||||
}else{
|
|
||||||
|
if(!TextUtils.isEmpty(content)){
|
||||||
editText.setText(content);
|
editText.setText(content);
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(content)) {
|
if (!TextUtils.isEmpty(content)) {
|
||||||
@@ -1202,6 +1201,7 @@ public abstract class BaseActivity<T extends ViewBinding, P extends IPresenter>
|
|||||||
editText.setInputType(
|
editText.setInputType(
|
||||||
InputType.TYPE_CLASS_NUMBER
|
InputType.TYPE_CLASS_NUMBER
|
||||||
);
|
);
|
||||||
|
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(4)});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INPUT_TYPE_LETTER:
|
case INPUT_TYPE_LETTER:
|
||||||
@@ -1252,6 +1252,10 @@ public abstract class BaseActivity<T extends ViewBinding, P extends IPresenter>
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case INPUT_TYPE_NORMAL:
|
||||||
|
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(20)});
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
editText.setInputType(
|
editText.setInputType(
|
||||||
InputType.TYPE_CLASS_TEXT
|
InputType.TYPE_CLASS_TEXT
|
||||||
|
|||||||
@@ -950,10 +950,9 @@ public abstract class BaseFragment<T extends ViewBinding,P extends IPresenter> e
|
|||||||
|
|
||||||
//设置输入类型
|
//设置输入类型
|
||||||
setEditInputType(editText,inputType);
|
setEditInputType(editText,inputType);
|
||||||
|
|
||||||
if(TextUtils.isEmpty(content)){
|
|
||||||
editText.setHint(hint);
|
editText.setHint(hint);
|
||||||
}else{
|
|
||||||
|
if(!TextUtils.isEmpty(content)){
|
||||||
editText.setText(content);
|
editText.setText(content);
|
||||||
editText.setSelection(content.length());
|
editText.setSelection(content.length());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public class AddDeviceActivity extends BaseActivity<AddDeviceLayoutBinding, Devi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化监听g
|
* 初始化监听g111
|
||||||
*/
|
*/
|
||||||
private void initListener() {
|
private void initListener() {
|
||||||
setClick(viewBinding.includedTitle.imgBack);
|
setClick(viewBinding.includedTitle.imgBack);
|
||||||
|
|||||||
@@ -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,13 @@ 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);
|
||||||
|
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 +268,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 +335,6 @@ public class DeviceConnectActivity extends BaseActivity<DeviceConnectLayoutBindi
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import de.greenrobot.event.ThreadMode;
|
|||||||
public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBinding, DevicePresenter>
|
public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBinding, DevicePresenter>
|
||||||
implements DeviceContract.DeviceView {
|
implements DeviceContract.DeviceView {
|
||||||
|
|
||||||
|
private static final long DEVICE_DETAIL_POLL_INTERVAL_MS = 10_000L;
|
||||||
private List<String> mTimeList = new ArrayList<>();
|
private List<String> mTimeList = new ArrayList<>();
|
||||||
private WaterDeviceEntity mDeviceEntity;
|
private WaterDeviceEntity mDeviceEntity;
|
||||||
private WaterDeviceEntity mRemoteDeviceEntity;
|
private WaterDeviceEntity mRemoteDeviceEntity;
|
||||||
@@ -53,6 +54,8 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
|||||||
//用户自定义的浇水时长
|
//用户自定义的浇水时长
|
||||||
private int mCustomDuration = 0;
|
private int mCustomDuration = 0;
|
||||||
private final Handler mProgressHandler = new Handler(Looper.getMainLooper());
|
private final Handler mProgressHandler = new Handler(Looper.getMainLooper());
|
||||||
|
private final Handler mDeviceDetailPollHandler = new Handler(Looper.getMainLooper());
|
||||||
|
private boolean mIsDeviceDetailPolling;
|
||||||
private long mWorkStartTime = 0L;
|
private long mWorkStartTime = 0L;
|
||||||
private long mWorkEndTime = 0L;
|
private long mWorkEndTime = 0L;
|
||||||
private boolean mHasRefreshAfterWorkFinished = false;
|
private boolean mHasRefreshAfterWorkFinished = false;
|
||||||
@@ -62,6 +65,21 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
|||||||
updateWorkProgress();
|
updateWorkProgress();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* 轮询请求设备详情
|
||||||
|
*/
|
||||||
|
private final Runnable mDeviceDetailPollRunnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (!mIsDeviceDetailPolling) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mDeviceEntity != null && !TextUtils.isEmpty(mDeviceEntity.getDeviceNo())) {
|
||||||
|
mPresenter.getDeviceDetailInfo(mDeviceEntity.getDeviceNo());
|
||||||
|
}
|
||||||
|
mDeviceDetailPollHandler.postDelayed(this, DEVICE_DETAIL_POLL_INTERVAL_MS);
|
||||||
|
}
|
||||||
|
};
|
||||||
@Override
|
@Override
|
||||||
public DevicePresenter createPresenter() {
|
public DevicePresenter createPresenter() {
|
||||||
return new DevicePresenter(new DeviceImpl());
|
return new DevicePresenter(new DeviceImpl());
|
||||||
@@ -383,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);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开关设备成功
|
* 开关设备成功
|
||||||
@@ -513,9 +548,33 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
|||||||
mWorkEndTime = 0L;
|
mWorkEndTime = 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startDeviceDetailPolling() {
|
||||||
|
mIsDeviceDetailPolling = true;
|
||||||
|
mDeviceDetailPollHandler.removeCallbacks(mDeviceDetailPollRunnable);
|
||||||
|
mDeviceDetailPollHandler.postDelayed(mDeviceDetailPollRunnable, DEVICE_DETAIL_POLL_INTERVAL_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopDeviceDetailPolling() {
|
||||||
|
mIsDeviceDetailPolling = false;
|
||||||
|
mDeviceDetailPollHandler.removeCallbacks(mDeviceDetailPollRunnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
startDeviceDetailPolling();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
stopDeviceDetailPolling();
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
stopWorkProgressUpdate();
|
stopWorkProgressUpdate();
|
||||||
|
stopDeviceDetailPolling();
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,3 +608,5 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.view.View;
|
|||||||
import com.ckkj.water.ConstantUtil;
|
import com.ckkj.water.ConstantUtil;
|
||||||
import com.ckkj.water.R;
|
import com.ckkj.water.R;
|
||||||
import com.ckkj.water.base.BaseActivity;
|
import com.ckkj.water.base.BaseActivity;
|
||||||
|
import com.ckkj.water.base.BaseFragment;
|
||||||
import com.ckkj.water.databinding.SetDeviceNameLayoutBinding;
|
import com.ckkj.water.databinding.SetDeviceNameLayoutBinding;
|
||||||
import com.ckkj.water.device.mvp.DeviceContract;
|
import com.ckkj.water.device.mvp.DeviceContract;
|
||||||
import com.ckkj.water.device.mvp.DeviceImpl;
|
import com.ckkj.water.device.mvp.DeviceImpl;
|
||||||
@@ -90,7 +91,7 @@ public class DeviceReNameActivity extends BaseActivity<SetDeviceNameLayoutBindin
|
|||||||
@Override
|
@Override
|
||||||
public void addDeviceSuccess(WaterDeviceEntity bean) {
|
public void addDeviceSuccess(WaterDeviceEntity bean) {
|
||||||
hideDialogLoading();
|
hideDialogLoading();
|
||||||
ToastUtil.showShort(mContext,"设备保存成功");
|
ToastUtil.showShort(mContext,getString(R.string.device_save_success));
|
||||||
ActivityManager.removeActivityByTag(ConstantUtil.ADD_DEVICE_FLAG);
|
ActivityManager.removeActivityByTag(ConstantUtil.ADD_DEVICE_FLAG);
|
||||||
new Handler().postDelayed(new Runnable() {
|
new Handler().postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -116,7 +117,22 @@ public class DeviceReNameActivity extends BaseActivity<SetDeviceNameLayoutBindin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showError(String message) {
|
public void showError(String message) {
|
||||||
|
hideDialogLoading();
|
||||||
|
showDialogtext(null, false, false, false,
|
||||||
|
getString(R.string.tip_text),
|
||||||
|
message,
|
||||||
|
null,
|
||||||
|
getString(R.string.confirm_text),
|
||||||
|
new BaseFragment.OnDialogClick() {
|
||||||
|
@Override
|
||||||
|
public void onCancelClick() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -9,9 +9,13 @@ import android.graphics.drawable.AnimationDrawable;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.text.InputType;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.text.method.PasswordTransformationMethod;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import com.ckkj.water.ConstantUtil;
|
import com.ckkj.water.ConstantUtil;
|
||||||
import com.ckkj.water.R;
|
import com.ckkj.water.R;
|
||||||
@@ -46,6 +50,8 @@ 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 boolean isPasswordVisible = false;
|
||||||
|
|
||||||
private WifiListAdapter wifiListAdapter;
|
private WifiListAdapter wifiListAdapter;
|
||||||
//100 来自设备添加, 200 来自设备信息
|
//100 来自设备添加, 200 来自设备信息
|
||||||
@@ -166,6 +172,7 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
|||||||
setClick(viewBinding.includedTitle.imgBack);
|
setClick(viewBinding.includedTitle.imgBack);
|
||||||
setClick(viewBinding.tvSelectWifi);
|
setClick(viewBinding.tvSelectWifi);
|
||||||
setClick(viewBinding.tvNext);
|
setClick(viewBinding.tvNext);
|
||||||
|
setClick(viewBinding.imgPsdShowHide);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setClick(View view) {
|
private void setClick(View view) {
|
||||||
@@ -210,9 +217,38 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case R.id.img_psd_show_hide:
|
||||||
|
togglePasswordVisibility();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void togglePasswordVisibility() {
|
||||||
|
EditText etPassword = viewBinding.etInputPsd;
|
||||||
|
ImageView ivToggle = viewBinding.imgPsdShowHide;
|
||||||
|
|
||||||
|
if (etPassword == null || ivToggle == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isPasswordVisible) {
|
||||||
|
// 隐藏密码
|
||||||
|
etPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||||
|
etPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||||
|
ivToggle.setImageResource(R.mipmap.icon_psd_hide);
|
||||||
|
} else {
|
||||||
|
// 显示密码
|
||||||
|
etPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
|
||||||
|
etPassword.setTransformationMethod(null);
|
||||||
|
ivToggle.setImageResource(R.mipmap.icon_psd_show);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保持光标位置
|
||||||
|
etPassword.setSelection(etPassword.getText().length());
|
||||||
|
isPasswordVisible = !isPasswordVisible;
|
||||||
|
}
|
||||||
|
|
||||||
private void goToDeviceConnect(String wifiPassword) {
|
private void goToDeviceConnect(String wifiPassword) {
|
||||||
if (espProvisionManager == null) {
|
if (espProvisionManager == null) {
|
||||||
initEspProvision();
|
initEspProvision();
|
||||||
|
|||||||
@@ -1,396 +0,0 @@
|
|||||||
package com.ckkj.water.device;
|
|
||||||
|
|
||||||
import android.Manifest;
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.net.wifi.ScanResult;
|
|
||||||
import android.net.wifi.WifiManager;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import androidx.core.app.ActivityCompat;
|
|
||||||
|
|
||||||
import com.ckkj.water.ConstantUtil;
|
|
||||||
import com.ckkj.water.R;
|
|
||||||
import com.ckkj.water.base.BaseActivity;
|
|
||||||
import com.ckkj.water.databinding.DeviceResetWifiBinding;
|
|
||||||
import com.ckkj.water.device.adapter.WifiListAdapter;
|
|
||||||
import com.ckkj.water.device.mvp.DeviceContract;
|
|
||||||
import com.ckkj.water.device.mvp.DeviceImpl;
|
|
||||||
import com.ckkj.water.device.mvp.DevicePresenter;
|
|
||||||
import com.ckkj.water.espBle.EspProvisionManager;
|
|
||||||
import com.ckkj.water.espBle.ProvisionCallback;
|
|
||||||
import com.ckkj.water.index.entity.WaterDeviceEntity;
|
|
||||||
import com.ckkj.water.network.BaseBean;
|
|
||||||
import com.ckkj.water.permission.PermissionActivity;
|
|
||||||
import com.ckkj.water.utils.manager.ActivityManager;
|
|
||||||
import com.ckkj.water.utils.manager.ThemeManager;
|
|
||||||
import com.ckkj.water.utils.show.ToastUtil;
|
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置wifi
|
|
||||||
*/
|
|
||||||
public class SelectWifiActivity_copy extends BaseActivity<DeviceResetWifiBinding, DevicePresenter>
|
|
||||||
implements DeviceContract.DeviceView {
|
|
||||||
|
|
||||||
private WifiManager wifiManager;
|
|
||||||
private WifiListAdapter wifiListAdapter;
|
|
||||||
private WifiScanReceiver wifiScanReceiver;
|
|
||||||
//100 来自设备添加, 200 来自设备信息
|
|
||||||
private int WITCH_FROM_CODE = 100;
|
|
||||||
|
|
||||||
private String mWifiName = "";
|
|
||||||
|
|
||||||
private WaterDeviceEntity mBleDeviceEntity;
|
|
||||||
private EspProvisionManager espProvisionManager;
|
|
||||||
private boolean isBleConnecting = false;
|
|
||||||
private boolean isBleConnected = false;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DevicePresenter createPresenter() {
|
|
||||||
return new DevicePresenter(new DeviceImpl());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
|
|
||||||
wifiScanReceiver = new WifiScanReceiver();
|
|
||||||
ActivityManager.addActivity(this,getClass().getSimpleName() + "_" + ConstantUtil.ADD_DEVICE_FLAG);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
registerReceiver(wifiScanReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
unregisterReceiver(wifiScanReceiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
if (WITCH_FROM_CODE == 100 && espProvisionManager != null) {
|
|
||||||
espProvisionManager.disconnect();
|
|
||||||
espProvisionManager.setCallback(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initData(Bundle savedInstanceState) {
|
|
||||||
super.initData(savedInstanceState);
|
|
||||||
Bundle bundle = getIntent().getExtras();
|
|
||||||
if(bundle != null){
|
|
||||||
WITCH_FROM_CODE = bundle.getInt(ConstantUtil.ACTIVITY_NAVIGATE_FLAG);
|
|
||||||
mBleDeviceEntity = (WaterDeviceEntity) bundle.getSerializable("ble_device_entity");
|
|
||||||
}
|
|
||||||
|
|
||||||
ImmersionBar.with(this)
|
|
||||||
.statusBarColor(R.color.color_gray_theme)
|
|
||||||
.statusBarDarkFont(ThemeManager.isAppThemeLight(mContext))
|
|
||||||
.titleBar(viewBinding.rlTitle)
|
|
||||||
.init();
|
|
||||||
if(WITCH_FROM_CODE == 200){
|
|
||||||
viewBinding.tvNext.setText(getString(R.string.confirm_text));
|
|
||||||
}
|
|
||||||
viewBinding.includedTitle.tvTitle.setText(R.string.select_wifi_tip);
|
|
||||||
|
|
||||||
initListener();
|
|
||||||
initWifiList();
|
|
||||||
if (WITCH_FROM_CODE == 100) {
|
|
||||||
initEspProvision();
|
|
||||||
connectBleDevice();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initWifiList() {
|
|
||||||
wifiListAdapter = new WifiListAdapter(mContext);
|
|
||||||
viewBinding.rvWifiList.setAdapter(wifiListAdapter);
|
|
||||||
wifiListAdapter.setOnWifiItemClickListener(wifiName -> {
|
|
||||||
mWifiName = wifiName;
|
|
||||||
viewBinding.etWifiName.setText(wifiName);
|
|
||||||
viewBinding.rvWifiList.setVisibility(View.GONE);
|
|
||||||
viewBinding.linearWifiInfo.setVisibility(View.VISIBLE);
|
|
||||||
viewBinding.tvNext.setVisibility(View.VISIBLE);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initListener() {
|
|
||||||
setClick(viewBinding.includedTitle.imgBack);
|
|
||||||
setClick(viewBinding.tvSelectWifi);
|
|
||||||
setClick(viewBinding.tvNext);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setClick(View view) {
|
|
||||||
view.setOnClickListener(this::onClick);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClick(View view){
|
|
||||||
switch (view.getId()){
|
|
||||||
case R.id.img_back:
|
|
||||||
finish();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.tv_select_wifi:
|
|
||||||
String[] permission = {
|
|
||||||
Manifest.permission.ACCESS_FINE_LOCATION
|
|
||||||
};
|
|
||||||
boolean hasPermission = hasRecordPermission(permission);
|
|
||||||
if(!hasPermission){
|
|
||||||
goTo(mContext, PermissionActivity.class,null);
|
|
||||||
}else{
|
|
||||||
}
|
|
||||||
scanWifi();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.tv_next:
|
|
||||||
if(TextUtils.isEmpty(mWifiName)){
|
|
||||||
ToastUtil.showShort(mContext,getString(R.string.toast_select_wifi_tip));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(TextUtils.isEmpty(viewBinding.etInputPsd.getText().toString())){
|
|
||||||
ToastUtil.showShort(mContext,getString(R.string.toast_select_wifi_psd_tip));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(WITCH_FROM_CODE == 100){
|
|
||||||
provisionWifi();
|
|
||||||
}else{
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.putExtra("wifi_name",mWifiName);
|
|
||||||
intent.putExtra("wifi_psd",viewBinding.etInputPsd.getText().toString());
|
|
||||||
setResult(RESULT_OK,intent);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置网络
|
|
||||||
*/
|
|
||||||
private void provisionWifi() {
|
|
||||||
if (espProvisionManager == null) {
|
|
||||||
ToastUtil.showShort(mContext, "设备连接未初始化");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!isBleConnected) {
|
|
||||||
if (!isBleConnecting) {
|
|
||||||
connectBleDevice();
|
|
||||||
}
|
|
||||||
ToastUtil.showShort(mContext, "设备连接中,请稍后再试");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
showProgressLoadingDialog(0);
|
|
||||||
espProvisionManager.provisionWifi(mWifiName, viewBinding.etInputPsd.getText().toString());
|
|
||||||
// goTo(mContext,DeviceConnectActivity.class,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initEspProvision() {
|
|
||||||
espProvisionManager = EspProvisionManager.init(mContext).setCallback(new ProvisionCallback() {
|
|
||||||
@Override
|
|
||||||
public void onConnecting() {
|
|
||||||
isBleConnecting = true;
|
|
||||||
isBleConnected = false;
|
|
||||||
Log.i("TEST","onConnecting");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnected() {
|
|
||||||
isBleConnecting = false;
|
|
||||||
isBleConnected = true;
|
|
||||||
Log.i("TEST","onConnected设备连接成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onProvisioning(int progress) {
|
|
||||||
Log.i("TEST","WIFI连接进度 == " + progress);
|
|
||||||
mProgressLoadingDialog.setProgress(progress);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String deviceName, String deviceType) {
|
|
||||||
Log.i("TEST","deviceName:" + deviceName + "连接成功");
|
|
||||||
ToastUtil.showShort(mContext, deviceName + "连接成功");
|
|
||||||
new Handler().postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
hideDialogLoading();
|
|
||||||
}
|
|
||||||
}, 800);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(int errorCode, String message) {
|
|
||||||
isBleConnecting = false;
|
|
||||||
if (errorCode != 0) {
|
|
||||||
isBleConnected = espProvisionManager != null && espProvisionManager .isConnected();
|
|
||||||
}
|
|
||||||
Log.i("TEST","errorCode == " + errorCode + " message == " + message);
|
|
||||||
ToastUtil.showShort(mContext, message);
|
|
||||||
hideDialogLoading();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisconnected() {
|
|
||||||
isBleConnecting = false;
|
|
||||||
isBleConnected = false;
|
|
||||||
hideDialogLoading();
|
|
||||||
Log.i("TEST","onDisconnected");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWifiListReceived(String[] wifiList) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWifiListFailed(String message) {
|
|
||||||
Log.i("TEST","onWifiListFailed-Msg==" + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onProvisioningRejected() {
|
|
||||||
Log.i("TEST","onProvisioningRejected");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 连接设备
|
|
||||||
*/
|
|
||||||
private void connectBleDevice() {
|
|
||||||
if (WITCH_FROM_CODE != 100 || mBleDeviceEntity == null || espProvisionManager == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isBleConnected || isBleConnecting) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
espProvisionManager.connect(mBleDeviceEntity.getMacAddress(), mBleDeviceEntity.getDeviceName());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void scanWifi() {
|
|
||||||
showLoadingDialog();
|
|
||||||
viewBinding.tvNext.setVisibility(View.GONE);
|
|
||||||
if (wifiManager != null && wifiManager.isWifiEnabled()) {
|
|
||||||
wifiManager.startScan();
|
|
||||||
} else {
|
|
||||||
ToastUtil.showShort(mContext, getString(R.string.wifi_not_enabled));
|
|
||||||
hideDialogLoading();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayWifiList(List<ScanResult> scanResults) {
|
|
||||||
Set<String> wifiSet = new HashSet<>();
|
|
||||||
List<String> wifiNameList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (ScanResult result : scanResults) {
|
|
||||||
String wifiName = result.SSID;
|
|
||||||
if (wifiName != null && !wifiName.isEmpty() && !wifiSet.contains(wifiName)) {
|
|
||||||
wifiSet.add(wifiName);
|
|
||||||
wifiNameList.add(wifiName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hideDialogLoading();
|
|
||||||
|
|
||||||
if (wifiNameList.isEmpty()) {
|
|
||||||
ToastUtil.showShort(mContext, getString(R.string.no_wifi_found));
|
|
||||||
viewBinding.linearWifiInfo.setVisibility(View.VISIBLE);
|
|
||||||
viewBinding.rvWifiList.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
wifiListAdapter.setData(wifiNameList);
|
|
||||||
viewBinding.linearWifiInfo.setVisibility(View.GONE);
|
|
||||||
viewBinding.rvWifiList.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addDeviceSuccess(WaterDeviceEntity bean) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getDeviceDetailInfo(WaterDeviceEntity bean) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void editDeviceInfoSuccess(BaseBean bean) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteDeviceSuccess(BaseBean bean) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void turnOnOffDeviceSuccess(BaseBean bean, String status) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void queryDeviceBindStatusSuccess(WaterDeviceEntity bean) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void queryDeviceWorkTimeSuccess(WaterDeviceEntity bean) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private class WifiScanReceiver extends BroadcastReceiver {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals(intent.getAction())) {
|
|
||||||
boolean success = intent.getBooleanExtra(WifiManager.EXTRA_RESULTS_UPDATED, false);
|
|
||||||
if (success) {
|
|
||||||
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
|
||||||
// TODO: Consider calling
|
|
||||||
// ActivityCompat#requestPermissions
|
|
||||||
// here to request the missing permissions, and then overriding
|
|
||||||
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
|
||||||
// int[] grantResults)
|
|
||||||
// to handle the case where the user grants the permission. See the documentation
|
|
||||||
// for ActivityCompat#requestPermissions for more details.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<ScanResult> results = wifiManager.getScanResults();
|
|
||||||
displayWifiList(results);
|
|
||||||
} else {
|
|
||||||
ToastUtil.showShort(mContext, getString(R.string.wifi_scan_failed));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLayoutResId(Bundle savedInstanceState) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showError(String message) {
|
|
||||||
ToastUtil.showShort(mContext,message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void logOut(BaseBean bean) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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,9 +49,13 @@ 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){
|
||||||
|
if ("DEVICE_ACCESS_LOST".equals(msg)) {
|
||||||
|
DevicePresenter.this.getView().deviceAccessLost();
|
||||||
|
} else {
|
||||||
DevicePresenter.this.getView().showError(msg);
|
DevicePresenter.this.getView().showError(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -76,9 +80,13 @@ 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){
|
||||||
|
if ("DEVICE_ACCESS_LOST".equals(msg)) {
|
||||||
|
DevicePresenter.this.getView().deviceAccessLost();
|
||||||
|
} else {
|
||||||
DevicePresenter.this.getView().showError(msg);
|
DevicePresenter.this.getView().showError(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,9 +112,13 @@ 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){
|
||||||
|
if ("DEVICE_ACCESS_LOST".equals(msg)) {
|
||||||
|
DevicePresenter.this.getView().deviceAccessLost();
|
||||||
|
} else {
|
||||||
DevicePresenter.this.getView().showError(msg);
|
DevicePresenter.this.getView().showError(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -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,9 +193,13 @@ 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){
|
||||||
|
if ("DEVICE_ACCESS_LOST".equals(msg)) {
|
||||||
|
DevicePresenter.this.getView().deviceAccessLost();
|
||||||
|
} else {
|
||||||
DevicePresenter.this.getView().showError(msg);
|
DevicePresenter.this.getView().showError(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -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){
|
||||||
|
if ("DEVICE_ACCESS_LOST".equals(msg)) {
|
||||||
|
DevicePresenter.this.getView().deviceAccessLost();
|
||||||
|
} else {
|
||||||
DevicePresenter.this.getView().showError(msg);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
|||||||
|
|
||||||
private boolean mYinsiConfirm = false;
|
private boolean mYinsiConfirm = false;
|
||||||
private boolean isPasswordVisible = false;
|
private boolean isPasswordVisible = false;
|
||||||
//当前登录方式 验证码100 密码 200
|
//当前登录方式 验证码100 密码 200..
|
||||||
private static int LOGIN_TYPE_STATUS_CODE = 100;
|
private static int LOGIN_TYPE_STATUS_CODE = 100;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package com.ckkj.water.mine;
|
package com.ckkj.water.mine;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.InputType;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.text.method.PasswordTransformationMethod;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import com.ckkj.water.R;
|
import com.ckkj.water.R;
|
||||||
import com.ckkj.water.base.BaseActivity;
|
import com.ckkj.water.base.BaseActivity;
|
||||||
@@ -25,6 +29,10 @@ import com.gyf.immersionbar.ImmersionBar;
|
|||||||
public class ResetPsdActivity extends BaseActivity<ResetPsdLayoutBinding, MinePresenter>
|
public class ResetPsdActivity extends BaseActivity<ResetPsdLayoutBinding, MinePresenter>
|
||||||
implements MineContract.MineView {
|
implements MineContract.MineView {
|
||||||
|
|
||||||
|
private boolean isOldPasswordVisible = false;
|
||||||
|
private boolean isNewPasswordVisible = false;
|
||||||
|
private boolean isConfirmPasswordVisible = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initData(Bundle savedInstanceState) {
|
public void initData(Bundle savedInstanceState) {
|
||||||
super.initData(savedInstanceState);
|
super.initData(savedInstanceState);
|
||||||
@@ -41,6 +49,9 @@ public class ResetPsdActivity extends BaseActivity<ResetPsdLayoutBinding, MinePr
|
|||||||
private void initListener() {
|
private void initListener() {
|
||||||
setClick(viewBinding.includedTitle.imgBack);
|
setClick(viewBinding.includedTitle.imgBack);
|
||||||
setClick(viewBinding.tvCommit);
|
setClick(viewBinding.tvCommit);
|
||||||
|
setClick(viewBinding.imgPsdShowHideOld);
|
||||||
|
setClick(viewBinding.imgPsdShowHideNew1);
|
||||||
|
setClick(viewBinding.imgPsdShowHideNew2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setClick(View view) {
|
private void setClick(View view) {
|
||||||
@@ -78,9 +89,45 @@ public class ResetPsdActivity extends BaseActivity<ResetPsdLayoutBinding, MinePr
|
|||||||
mPresenter.updateUserPsdByOld(viewBinding.etCurrentPsd.getText().toString(),
|
mPresenter.updateUserPsdByOld(viewBinding.etCurrentPsd.getText().toString(),
|
||||||
viewBinding.etInputConfirmPsd.getText().toString());
|
viewBinding.etInputConfirmPsd.getText().toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case R.id.img_psd_show_hide_old:
|
||||||
|
togglePasswordVisibility(viewBinding.etCurrentPsd, viewBinding.imgPsdShowHideOld,
|
||||||
|
isOldPasswordVisible);
|
||||||
|
isOldPasswordVisible = !isOldPasswordVisible;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.img_psd_show_hide_new1:
|
||||||
|
togglePasswordVisibility(viewBinding.etNewPsd, viewBinding.imgPsdShowHideNew1,
|
||||||
|
isNewPasswordVisible);
|
||||||
|
isNewPasswordVisible = !isNewPasswordVisible;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.img_psd_show_hide_new2:
|
||||||
|
togglePasswordVisibility(viewBinding.etInputConfirmPsd, viewBinding.imgPsdShowHideNew2,
|
||||||
|
isConfirmPasswordVisible);
|
||||||
|
isConfirmPasswordVisible = !isConfirmPasswordVisible;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void togglePasswordVisibility(EditText editText, ImageView imageView, boolean isVisible) {
|
||||||
|
if (editText == null || imageView == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isVisible) {
|
||||||
|
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||||
|
editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||||
|
imageView.setImageResource(R.mipmap.icon_psd_hide);
|
||||||
|
} else {
|
||||||
|
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
|
||||||
|
editText.setTransformationMethod(null);
|
||||||
|
imageView.setImageResource(R.mipmap.icon_psd_show);
|
||||||
|
}
|
||||||
|
|
||||||
|
editText.setSelection(editText.getText().length());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码重置成功
|
* 密码重置成功
|
||||||
* @param bean
|
* @param bean
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class MinePresenter extends BasePresenter<MineContract.MineView> {
|
|||||||
public void updateUserInfo(String nickName,String avatar) {
|
public void updateUserInfo(String nickName,String avatar) {
|
||||||
try {
|
try {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
if(!TextUtils.isEmpty(avatar)){
|
if(!TextUtils.isEmpty(nickName)){
|
||||||
json.put("nickName", nickName);
|
json.put("nickName", nickName);
|
||||||
}
|
}
|
||||||
if(!TextUtils.isEmpty(avatar)){
|
if(!TextUtils.isEmpty(avatar)){
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ckkj.water.network;
|
package com.ckkj.water.network;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@@ -388,7 +389,9 @@ public class NetWorkManager {
|
|||||||
public static Map<String, String> getToken() {
|
public static Map<String, String> getToken() {
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
|
if(!TextUtils.isEmpty(AppConfig.USER_TOKEN)){
|
||||||
map.put("Authorization", "Bearer " + AppConfig.USER_TOKEN);
|
map.put("Authorization", "Bearer " + AppConfig.USER_TOKEN);
|
||||||
|
}
|
||||||
map.put("clientId", AppConfig.APP_CLIENT_ID);
|
map.put("clientId", AppConfig.APP_CLIENT_ID);
|
||||||
map.put("content-language", LanguageManager.getCurrentRequestLanguage());
|
map.put("content-language", LanguageManager.getCurrentRequestLanguage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ public class PlanDetailActivity extends BaseActivity<WaterPlanDetailLayoutBindin
|
|||||||
// 开启任务,调用接口后再更新 Switch
|
// 开启任务,调用接口后再更新 Switch
|
||||||
mPresenter.updatePlanStatus(mDetailEntity, "1");
|
mPresenter.updatePlanStatus(mDetailEntity, "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,8 +174,10 @@ public class PlanDetailActivity extends BaseActivity<WaterPlanDetailLayoutBindin
|
|||||||
viewBinding.tvPlanName.setText(entity.getName());
|
viewBinding.tvPlanName.setText(entity.getName());
|
||||||
if(entity.getStatus().equals("1")){
|
if(entity.getStatus().equals("1")){
|
||||||
viewBinding.switchButton.setChecked(true);
|
viewBinding.switchButton.setChecked(true);
|
||||||
|
viewBinding.tvPlanStatus.setText(getString(R.string.plan_on));
|
||||||
}else{
|
}else{
|
||||||
viewBinding.switchButton.setChecked(false);
|
viewBinding.switchButton.setChecked(false);
|
||||||
|
viewBinding.tvPlanStatus.setText(getString(R.string.plan_off));
|
||||||
}
|
}
|
||||||
//针对周一 --- 周日的日期,只显示勾选的日期
|
//针对周一 --- 周日的日期,只显示勾选的日期
|
||||||
List<WaterPlanWeekEntity.DetailsBean> list = new ArrayList<>();
|
List<WaterPlanWeekEntity.DetailsBean> list = new ArrayList<>();
|
||||||
@@ -248,8 +251,10 @@ public class PlanDetailActivity extends BaseActivity<WaterPlanDetailLayoutBindin
|
|||||||
if(status.equals("1")){
|
if(status.equals("1")){
|
||||||
showCenterTipDialog(R.mipmap.icon_dialog_success,getString(R.string.task_started));
|
showCenterTipDialog(R.mipmap.icon_dialog_success,getString(R.string.task_started));
|
||||||
viewBinding.switchButton.setChecked(true);
|
viewBinding.switchButton.setChecked(true);
|
||||||
|
viewBinding.tvPlanStatus.setText(getString(R.string.plan_on));
|
||||||
}else{
|
}else{
|
||||||
viewBinding.switchButton.setChecked(false);
|
viewBinding.switchButton.setChecked(false);
|
||||||
|
viewBinding.tvPlanStatus.setText(getString(R.string.plan_off));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import com.yanzhenjie.recyclerview.widget.DefaultItemDecoration;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -524,6 +525,18 @@ public class WaterConfigFragment extends BaseFragment<WaterConfigFragmentLayoutC
|
|||||||
*/
|
*/
|
||||||
private void selectStartTime(int position) {
|
private void selectStartTime(int position) {
|
||||||
boolean times[] = {false, false, false, true, true, false};
|
boolean times[] = {false, false, false, true, true, false};
|
||||||
|
Calendar selectedTime = Calendar.getInstance();
|
||||||
|
String startTime = weekList.get(mWeekAdapter.getmPos()).getTimeData().get(position).getStartTime();
|
||||||
|
if (!TextUtils.isEmpty(startTime)) {
|
||||||
|
try {
|
||||||
|
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm", Locale.getDefault());
|
||||||
|
timeFormat.setLenient(false);
|
||||||
|
Date date = timeFormat.parse(startTime);
|
||||||
|
selectedTime.set(Calendar.HOUR_OF_DAY, date.getHours());
|
||||||
|
selectedTime.set(Calendar.MINUTE, date.getMinutes());
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
//时间选择器
|
//时间选择器
|
||||||
TimePickerView pvTime = new TimePickerBuilder(mContext, new OnTimeSelectListener() {
|
TimePickerView pvTime = new TimePickerBuilder(mContext, new OnTimeSelectListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -537,6 +550,7 @@ public class WaterConfigFragment extends BaseFragment<WaterConfigFragmentLayoutC
|
|||||||
.setCancelColor(mContext.getColor(R.color.color_999999))
|
.setCancelColor(mContext.getColor(R.color.color_999999))
|
||||||
.setSubmitColor(mContext.getColor(R.color.color_zhu))
|
.setSubmitColor(mContext.getColor(R.color.color_zhu))
|
||||||
.setTextColorCenter(mContext.getColor(R.color.color_zhu))
|
.setTextColorCenter(mContext.getColor(R.color.color_zhu))
|
||||||
|
.setDate(selectedTime)
|
||||||
.build();
|
.build();
|
||||||
pvTime.show();
|
pvTime.show();
|
||||||
}
|
}
|
||||||
@@ -564,6 +578,10 @@ public class WaterConfigFragment extends BaseFragment<WaterConfigFragmentLayoutC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfirmClisk(String content) {
|
public void onConfirmClisk(String content) {
|
||||||
|
if(TextUtils.isEmpty(content)){
|
||||||
|
ToastUtil.showShort(mContext, getString(R.string.input_water_plan_time_error));
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Integer.parseInt(content) <= 0) {
|
if (Integer.parseInt(content) <= 0) {
|
||||||
ToastUtil.showShort(mContext, getString(R.string.input_water_plan_time_error));
|
ToastUtil.showShort(mContext, getString(R.string.input_water_plan_time_error));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ckkj.water.plan;
|
package com.ckkj.water.plan;
|
||||||
|
|
||||||
import static android.view.View.INVISIBLE;
|
import static android.view.View.INVISIBLE;
|
||||||
|
import static android.view.View.VISIBLE;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -51,6 +52,7 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
|||||||
.init();
|
.init();
|
||||||
viewBinding.includedTitle.imgBack.setVisibility(INVISIBLE);
|
viewBinding.includedTitle.imgBack.setVisibility(INVISIBLE);
|
||||||
viewBinding.includedTitle.tvTitle.setText(getString(R.string.plan_title));
|
viewBinding.includedTitle.tvTitle.setText(getString(R.string.plan_title));
|
||||||
|
viewBinding.includedNoresult.tvAddPlan.setVisibility(VISIBLE);
|
||||||
initListener();
|
initListener();
|
||||||
mAdapter = new WaterPlanListAdapter(mContext,R.layout.water_plan_list_item,mPlanList);
|
mAdapter = new WaterPlanListAdapter(mContext,R.layout.water_plan_list_item,mPlanList);
|
||||||
viewBinding.rvPlans.setAdapter(mAdapter);
|
viewBinding.rvPlans.setAdapter(mAdapter);
|
||||||
@@ -110,6 +112,7 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
|||||||
private void initListener() {
|
private void initListener() {
|
||||||
setClick(viewBinding.tvAdd);
|
setClick(viewBinding.tvAdd);
|
||||||
setClick(viewBinding.includedNoresult.btnRefresh);
|
setClick(viewBinding.includedNoresult.btnRefresh);
|
||||||
|
setClick(viewBinding.includedNoresult.tvAddPlan);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setClick(View view) {
|
private void setClick(View view) {
|
||||||
@@ -119,6 +122,7 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
|||||||
public void onClick(View v){
|
public void onClick(View v){
|
||||||
switch (v.getId()){
|
switch (v.getId()){
|
||||||
case R.id.tv_add:
|
case R.id.tv_add:
|
||||||
|
case R.id.tv_add_plan:
|
||||||
goTo(mContext, AddWaterPlanActivity.class,null);
|
goTo(mContext, AddWaterPlanActivity.class,null);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -148,7 +152,7 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
|||||||
if (mAdapter.getItemCount() >= total || pageList.size() == 0) {
|
if (mAdapter.getItemCount() >= total || pageList.size() == 0) {
|
||||||
// 使用 post 延迟调用,避免内部状态冲突导致的循环调用
|
// 使用 post 延迟调用,避免内部状态冲突导致的循环调用
|
||||||
viewBinding.refresh.postDelayed(() -> viewBinding.refresh.setNoMoreData(true), 300);
|
viewBinding.refresh.postDelayed(() -> viewBinding.refresh.setNoMoreData(true), 300);
|
||||||
viewBinding.relNoMore.setVisibility(View.VISIBLE); // 自定义底部提示"暂无更多数据"
|
viewBinding.relNoMore.setVisibility(VISIBLE); // 自定义底部提示"暂无更多数据"
|
||||||
} else {
|
} else {
|
||||||
viewBinding.refresh.setNoMoreData(false);
|
viewBinding.refresh.setNoMoreData(false);
|
||||||
viewBinding.relNoMore.setVisibility(View.GONE);
|
viewBinding.relNoMore.setVisibility(View.GONE);
|
||||||
@@ -156,11 +160,11 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
|||||||
|
|
||||||
// 5. 控制空布局和内容显示
|
// 5. 控制空布局和内容显示
|
||||||
if (mAdapter.getItemCount() != 0) {
|
if (mAdapter.getItemCount() != 0) {
|
||||||
viewBinding.refresh.setVisibility(View.VISIBLE);
|
viewBinding.refresh.setVisibility(VISIBLE);
|
||||||
viewBinding.relNoresult.setVisibility(View.GONE);
|
viewBinding.relNoresult.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
viewBinding.refresh.setVisibility(View.GONE);
|
viewBinding.refresh.setVisibility(View.GONE);
|
||||||
viewBinding.relNoresult.setVisibility(View.VISIBLE);
|
viewBinding.relNoresult.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,14 +91,22 @@
|
|||||||
android:src="@mipmap/icon_phone_code"/>
|
android:src="@mipmap/icon_phone_code"/>
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_input_psd"
|
android:id="@+id/et_input_psd"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="8"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="textPassword"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColorHint="@color/textPrimaryColor"
|
android:textColorHint="@color/textPrimaryColor"
|
||||||
android:textColor="@color/textPrimaryColor"
|
android:textColor="@color/textPrimaryColor"
|
||||||
android:hint="@string/input_wifi_psd_tip"/>
|
android:hint="@string/input_wifi_psd_tip"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_psd_show_hide"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -16,10 +16,9 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/dp_270"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/dp_83"
|
||||||
android:src="@mipmap/icon_launch_icon"
|
android:src="@mipmap/icon_launch_icon"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"/>
|
||||||
android:layout_marginBottom="@dimen/dp_120"/>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -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
|
||||||
@@ -35,6 +35,22 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/btn_manual_refresh"
|
android:text="@string/btn_manual_refresh"
|
||||||
android:textColor="@color/color_white"
|
android:textColor="@color/color_white"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_add_plan"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/tv_noresult"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:paddingHorizontal="@dimen/dp_20"
|
||||||
|
android:paddingVertical="@dimen/dp_10"
|
||||||
|
android:layout_marginTop="@dimen/dp_10"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:text="@string/add_water_plan"
|
||||||
|
android:background="@drawable/shape_green_50"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="gone"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -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"
|
||||||
@@ -30,7 +31,8 @@
|
|||||||
android:id="@+id/tv_device_name"
|
android:id="@+id/tv_device_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="智能浇水设备A1"
|
android:singleLine="true"
|
||||||
|
android:text=""
|
||||||
android:textColor="@color/textPrimaryColor"
|
android:textColor="@color/textPrimaryColor"
|
||||||
android:textSize="17sp"
|
android:textSize="17sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|||||||
@@ -106,6 +106,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
|
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/color_222222"
|
android:textColor="@color/color_222222"
|
||||||
@@ -133,6 +134,8 @@
|
|||||||
android:layout_weight="2"
|
android:layout_weight="2"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="number"
|
||||||
|
android:maxLength="6"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/color_222222"
|
android:textColor="@color/color_222222"
|
||||||
android:hint="@string/hint_input_verifi"/>
|
android:hint="@string/hint_input_verifi"/>
|
||||||
@@ -172,16 +175,49 @@
|
|||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
android:maxLength="16"
|
||||||
android:textColor="@color/color_222222"
|
android:textColor="@color/color_222222"
|
||||||
android:hint="@string/hint_input_psd"
|
android:hint="@string/hint_input_psd"
|
||||||
android:inputType="textPassword"/>
|
android:inputType="textPassword"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_psd_show_hide"
|
android:id="@+id/img_psd_show_hide"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="20dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:src="@mipmap/icon_psd_hide"/>
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_30"
|
||||||
|
android:layout_marginLeft="@dimen/dp_20">
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/realtive_read_finish"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/checkbox_read"
|
||||||
|
android:layout_width="@dimen/dp_14"
|
||||||
|
android:layout_height="@dimen/dp_14"
|
||||||
|
android:background="@drawable/select_radio"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:button="@null"
|
||||||
|
android:clickable="false"
|
||||||
|
android:visibility="visible" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_agreement_full"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/dp_12"
|
||||||
|
android:layout_marginRight="@dimen/dp_12"
|
||||||
|
android:layout_toRightOf="@+id/checkbox_read"
|
||||||
|
android:autoLink="none"
|
||||||
|
android:lineSpacingExtra="4dp"
|
||||||
|
android:textColor="@color/color_gray_tab"
|
||||||
|
android:textSize="11sp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_login"
|
android:id="@+id/tv_login"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -192,7 +228,7 @@
|
|||||||
android:background="@drawable/shape_green_button_bg"
|
android:background="@drawable/shape_green_button_bg"
|
||||||
android:paddingVertical="10dp"
|
android:paddingVertical="10dp"
|
||||||
android:layout_marginHorizontal="20dp"
|
android:layout_marginHorizontal="20dp"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="20dp"
|
||||||
android:gravity="center"/>
|
android:gravity="center"/>
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -232,37 +268,5 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dp_100"
|
|
||||||
android:layout_alignParentBottom="true">
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/realtive_read_finish"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginHorizontal="@dimen/dp_15"
|
|
||||||
android:layout_marginBottom="@dimen/dp_30">
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/checkbox_read"
|
|
||||||
android:layout_width="@dimen/dp_14"
|
|
||||||
android:layout_height="@dimen/dp_14"
|
|
||||||
android:background="@drawable/select_radio"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:button="@null"
|
|
||||||
android:clickable="false"
|
|
||||||
android:visibility="visible" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_agreement_full"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/dp_12"
|
|
||||||
android:layout_marginRight="@dimen/dp_12"
|
|
||||||
android:layout_toRightOf="@+id/checkbox_read"
|
|
||||||
android:autoLink="none"
|
|
||||||
android:lineSpacingExtra="4dp"
|
|
||||||
android:textColor="@color/color_gray_tab"
|
|
||||||
android:textSize="11sp" />
|
|
||||||
</RelativeLayout>
|
|
||||||
</RelativeLayout>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
android:layout_height="@dimen/dp_45"
|
android:layout_height="@dimen/dp_45"
|
||||||
android:layout_marginTop="@dimen/dp_20">
|
android:layout_marginTop="@dimen/dp_20">
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_name_key"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/dp_20"
|
android:layout_marginLeft="@dimen/dp_20"
|
||||||
@@ -76,14 +77,18 @@
|
|||||||
android:layout_alignParentRight="true"/>
|
android:layout_alignParentRight="true"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_nickname_value"
|
android:id="@+id/tv_nickname_value"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_toLeftOf="@+id/img_point1"
|
android:layout_toLeftOf="@+id/img_point1"
|
||||||
|
android:layout_toRightOf="@+id/tv_name_key"
|
||||||
android:layout_marginRight="@dimen/dp_20"
|
android:layout_marginRight="@dimen/dp_20"
|
||||||
|
android:layout_marginLeft="@dimen/dp_20"
|
||||||
|
android:gravity="right"
|
||||||
|
android:singleLine="true"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/color_999999"
|
android:textColor="@color/color_999999"
|
||||||
android:text="这里是昵称"/>
|
android:text=""/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
android:layout_width="@dimen/dp_135"
|
android:layout_width="@dimen/dp_135"
|
||||||
android:layout_height="@dimen/dp_35"
|
android:layout_height="@dimen/dp_35"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:background="@drawable/shape_dialog_confirm_jb_bg"
|
android:background="@drawable/shape_green_button_bg"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="@color/color_white" />
|
android:textColor="@color/color_white" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@@ -50,9 +50,9 @@
|
|||||||
android:background="@drawable/shape_line_gray_bg"
|
android:background="@drawable/shape_line_gray_bg"
|
||||||
android:layout_marginTop="@dimen/dp_10"
|
android:layout_marginTop="@dimen/dp_10"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textColor="@color/textPrimaryColor"
|
android:textColor="@color/dialog_input_hint_color"
|
||||||
android:textColorHint="@color/color_subtitle"
|
android:textColorHint="@color/dialog_input_hint_color"
|
||||||
android:hint="请输入激活码"/>
|
android:hint=""/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_click"
|
android:id="@+id/tv_click"
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
@@ -70,6 +71,8 @@
|
|||||||
android:layout_weight="2"
|
android:layout_weight="2"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="number"
|
||||||
|
android:maxLength="6"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
@@ -109,14 +112,15 @@
|
|||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
|
android:maxLength="16"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
android:hint="@string/hint_input_psd"/>
|
android:hint="@string/hint_input_new_psd"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_psd_show_hide"
|
android:id="@+id/img_psd_show_hide"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="20dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:src="@mipmap/icon_psd_hide"/>
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -143,14 +147,15 @@
|
|||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:maxLength="16"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
android:hint="@string/hint_input_psd_agin"/>
|
android:hint="@string/hint_input_new_psd_agin"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_psd_show_hide_agin"
|
android:id="@+id/img_psd_show_hide_agin"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="20dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:src="@mipmap/icon_psd_hide"/>
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -29,14 +29,23 @@
|
|||||||
android:src="@mipmap/icon_psd"/>
|
android:src="@mipmap/icon_psd"/>
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_current_psd"
|
android:id="@+id/et_current_psd"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="8"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:maxLength="16"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
android:hint="@string/hint_input_old_psd"/>
|
android:hint="@string/hint_input_old_psd"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_psd_show_hide_old"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -54,14 +63,23 @@
|
|||||||
android:src="@mipmap/icon_psd"/>
|
android:src="@mipmap/icon_psd"/>
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_new_psd"
|
android:id="@+id/et_new_psd"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="8"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:maxLength="16"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
android:hint="@string/hint_input_new_psd"/>
|
android:hint="@string/hint_input_new_psd"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_psd_show_hide_new1"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -80,14 +98,23 @@
|
|||||||
android:src="@mipmap/icon_psd"/>
|
android:src="@mipmap/icon_psd"/>
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_input_confirm_psd"
|
android:id="@+id/et_input_confirm_psd"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="8"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:maxLength="16"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
android:hint="@string/hint_input_new_psd_agin"/>
|
android:hint="@string/hint_input_new_psd_agin"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_psd_show_hide_new2"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:maxLength="20"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/color_222222"
|
android:textColor="@color/color_222222"
|
||||||
android:hint="@string/input_device_name_hint"/>
|
android:hint="@string/input_device_name_hint"/>
|
||||||
|
|||||||
@@ -7,5 +7,5 @@
|
|||||||
android:id="@+id/ivRefresh"
|
android:id="@+id/ivRefresh"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:src="@mipmap/icon_water_loading" />
|
android:src="@mipmap/icon_water_head_refresh" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -41,7 +41,8 @@
|
|||||||
android:textColor="@color/textPrimaryColor"
|
android:textColor="@color/textPrimaryColor"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:layout_marginLeft="@dimen/dp_10"
|
android:layout_marginLeft="@dimen/dp_10"
|
||||||
android:hint="@string/input_plan_name"/>
|
android:hint="@string/input_plan_name"
|
||||||
|
android:maxLength="20"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -137,6 +137,7 @@
|
|||||||
android:paddingVertical="@dimen/dp_15">
|
android:paddingVertical="@dimen/dp_15">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_sta"
|
||||||
android:layout_width="82dp"
|
android:layout_width="82dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
@@ -144,6 +145,15 @@
|
|||||||
android:textColor="@color/textPrimaryColor"
|
android:textColor="@color/textPrimaryColor"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_plan_status"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_toRightOf="@+id/tv_sta"
|
||||||
|
android:textColor="@color/textPrimaryColor"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<com.kyleduo.switchbutton.SwitchButton
|
<com.kyleduo.switchbutton.SwitchButton
|
||||||
android:id="@+id/switch_button"
|
android:id="@+id/switch_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingVertical="@dimen/dp_12">
|
android:paddingVertical="@dimen/dp_22">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -27,7 +27,8 @@
|
|||||||
android:id="@+id/tv_device_name"
|
android:id="@+id/tv_device_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="智能浇水设备A1"
|
android:singleLine="true"
|
||||||
|
android:text=""
|
||||||
android:textColor="@color/textPrimaryColor"
|
android:textColor="@color/textPrimaryColor"
|
||||||
android:textSize="17sp"
|
android:textSize="17sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
@@ -39,7 +40,8 @@
|
|||||||
android:layout_marginTop="@dimen/dp_5"
|
android:layout_marginTop="@dimen/dp_5"
|
||||||
android:text="YA226641000107"
|
android:text="YA226641000107"
|
||||||
android:textColor="@color/color_666666"
|
android:textColor="@color/color_666666"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp"
|
||||||
|
android:visibility="gone"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
app/src/main/res/mipmap-xhdpi/icon_charging.png
Normal file
|
After Width: | Height: | Size: 873 B |
BIN
app/src/main/res/mipmap-xxhdpi/icon_charging.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/icon_water_head_refresh.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/img_nodata.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/icon_charging.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/icon_water_head_refresh.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/img_nodata.png
Normal file
|
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,11 +107,14 @@
|
|||||||
<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>
|
||||||
<string name="add_water_plan">+ New Schedule</string>
|
<string name="add_water_plan">+ Add</string>
|
||||||
<string name="plan_title">Schedules</string>
|
<string name="plan_title">Schedules</string>
|
||||||
<string name="water_device_config">Watering Settings</string>
|
<string name="water_device_config">Watering Settings</string>
|
||||||
<string name="water_bound_device">Linked Devices</string>
|
<string name="water_bound_device">Linked Devices</string>
|
||||||
@@ -138,6 +142,8 @@
|
|||||||
<string name="btn_manual_refresh">Refresh</string>
|
<string name="btn_manual_refresh">Refresh</string>
|
||||||
<string name="task_started">Task Started</string>
|
<string name="task_started">Task Started</string>
|
||||||
<string name="associated">Associated</string>
|
<string name="associated">Associated</string>
|
||||||
|
<string name="plan_on">ON</string>
|
||||||
|
<string name="plan_off">OFF</string>
|
||||||
|
|
||||||
<!-- History -->
|
<!-- History -->
|
||||||
<string name="history_title">History</string>
|
<string name="history_title">History</string>
|
||||||
@@ -312,6 +318,7 @@
|
|||||||
<string name="device_battery">Battery:</string>
|
<string name="device_battery">Battery:</string>
|
||||||
|
|
||||||
<string name="update_time">Last Updated:</string>
|
<string name="update_time">Last Updated:</string>
|
||||||
|
<string name="device_save_success">Device saved successfully</string>
|
||||||
<!-- End -->
|
<!-- End -->
|
||||||
|
|
||||||
|
|
||||||
@@ -330,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>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<color name="mainBackgroundColor">#303030</color>
|
<color name="mainBackgroundColor">#303030</color>
|
||||||
<color name="color_gray_theme">#303030</color>
|
<color name="color_gray_theme">#303030</color>
|
||||||
<color name="textPrimaryColor">#E0E0E0</color>
|
<color name="textPrimaryColor">#E0E0E0</color>
|
||||||
|
<color name="dialog_input_hint_color">#666666</color>
|
||||||
<color name="color_subtitle">#E0E0E0</color>
|
<color name="color_subtitle">#E0E0E0</color>
|
||||||
<color name="text_hint_theme_color">#303030</color>
|
<color name="text_hint_theme_color">#303030</color>
|
||||||
<color name="deviceControlItemColor">#878787</color>
|
<color name="deviceControlItemColor">#878787</color>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<color name="colorAccent">#FF4081</color>
|
<color name="colorAccent">#FF4081</color>
|
||||||
<color name="mainBackgroundColor">#FFFFFF</color>
|
<color name="mainBackgroundColor">#FFFFFF</color>
|
||||||
<color name="textPrimaryColor">#222222</color>
|
<color name="textPrimaryColor">#222222</color>
|
||||||
|
<color name="dialog_input_hint_color">#222222</color>
|
||||||
<color name="text_hint_theme_color">#838080</color>
|
<color name="text_hint_theme_color">#838080</color>
|
||||||
<color name="color_subtitle">#666666</color>
|
<color name="color_subtitle">#666666</color>
|
||||||
<color name="color_gray_theme">#F9F9F9</color>
|
<color name="color_gray_theme">#F9F9F9</color>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|
||||||
|
|
||||||
<!--排程-->
|
<!--排程-->
|
||||||
@@ -129,7 +133,9 @@
|
|||||||
<string name="btn_manual_refresh">手动刷新</string>
|
<string name="btn_manual_refresh">手动刷新</string>
|
||||||
<string name="task_started">任务已开启</string>
|
<string name="task_started">任务已开启</string>
|
||||||
<string name="associated">已关联</string>
|
<string name="associated">已关联</string>
|
||||||
|
<string name="plan_on">开启</string>
|
||||||
|
<string name="plan_off">关闭</string>
|
||||||
|
<string name="remove_success">移除成功</string>
|
||||||
|
|
||||||
<!--历史-->
|
<!--历史-->
|
||||||
<string name="history_title">历史</string>
|
<string name="history_title">历史</string>
|
||||||
@@ -305,6 +311,8 @@
|
|||||||
|
|
||||||
<string name="update_time">更新时间:</string>
|
<string name="update_time">更新时间:</string>
|
||||||
|
|
||||||
|
<string name="device_save_success">设备保存成功</string>
|
||||||
|
|
||||||
<!--结束-->
|
<!--结束-->
|
||||||
|
|
||||||
|
|
||||||
@@ -368,7 +376,7 @@
|
|||||||
<string name="tips_network_not_connected">网络未连接</string>
|
<string name="tips_network_not_connected">网络未连接</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="tips_yinsizhengce_click">《星语明灯平台隐私政策》</string>
|
<string name="tips_yinsizhengce_click">《隐私政策》</string>
|
||||||
|
|
||||||
<string name="common_permission_description">权限说明</string>
|
<string name="common_permission_description">权限说明</string>
|
||||||
<string name="common_permission_message">使用此功能需要先授予%s</string>
|
<string name="common_permission_message">使用此功能需要先授予%s</string>
|
||||||
@@ -607,4 +615,8 @@
|
|||||||
书法艺术体现了中华文化的深厚底蕴,学习书法有助于增强文化自信和民族认同感。
|
书法艺术体现了中华文化的深厚底蕴,学习书法有助于增强文化自信和民族认同感。
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
<string name="device_control_access_lost">已失去对该设备的控制权</string>
|
||||||
|
<string name="device_provision_timeout">配网超时,请重试</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#Fri Jul 10 09:12:26 CST 2026
|
#Tue Aug 18 10:51:55 CST 2026
|
||||||
D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\src\\main\\res\\drawable-hdpi\\ef_ic_arrow_back.png=D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\build\\intermediates\\packaged_res\\debug\\drawable-hdpi-v4\\ef_ic_arrow_back.png
|
D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\src\\main\\res\\drawable-hdpi\\ef_ic_arrow_back.png=D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\build\\intermediates\\packaged_res\\debug\\drawable-hdpi-v4\\ef_ic_arrow_back.png
|
||||||
D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\src\\main\\res\\drawable-hdpi\\ef_ic_arrow_forward.png=D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\build\\intermediates\\packaged_res\\debug\\drawable-hdpi-v4\\ef_ic_arrow_forward.png
|
D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\src\\main\\res\\drawable-hdpi\\ef_ic_arrow_forward.png=D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\build\\intermediates\\packaged_res\\debug\\drawable-hdpi-v4\\ef_ic_arrow_forward.png
|
||||||
D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\src\\main\\res\\drawable-hdpi\\ef_ic_camera_white.png=D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\build\\intermediates\\packaged_res\\debug\\drawable-hdpi-v4\\ef_ic_camera_white.png
|
D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\src\\main\\res\\drawable-hdpi\\ef_ic_camera_white.png=D\:\\AndroidWorkSpace\\WaterProject\\WaterProject\\imagepickerl\\build\\intermediates\\packaged_res\\debug\\drawable-hdpi-v4\\ef_ic_camera_white.png
|
||||||
|
|||||||