mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
android端bug修复
This commit is contained in:
@@ -126,6 +126,9 @@ dependencies {
|
|||||||
//rxutil2
|
//rxutil2
|
||||||
implementation deps.rxbinding
|
implementation deps.rxbinding
|
||||||
implementation 'com.github.xuexiangjys:rxutil2:1.2.0'
|
implementation 'com.github.xuexiangjys:rxutil2:1.2.0'
|
||||||
|
|
||||||
|
// circleprogressview 圆形进度动画控件
|
||||||
|
implementation 'com.king.view:circleprogressview:1.1.2'
|
||||||
}
|
}
|
||||||
//自动添加X-Library依赖
|
//自动添加X-Library依赖
|
||||||
apply from: 'x-library.gradle'
|
apply from: 'x-library.gradle'
|
||||||
|
|||||||
@@ -2,10 +2,7 @@
|
|||||||
package com.kerwin.wumei.activity;
|
package com.kerwin.wumei.activity;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.ProgressDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
import android.net.wifi.ScanResult;
|
import android.net.wifi.ScanResult;
|
||||||
@@ -14,7 +11,6 @@ import android.net.wifi.WifiManager;
|
|||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
@@ -35,12 +31,10 @@ import com.espressif.iot.esptouch.util.TouchNetUtil;
|
|||||||
import com.kerwin.wumei.R;
|
import com.kerwin.wumei.R;
|
||||||
import com.kerwin.wumei.adapter.entity.EspTouchViewModel;
|
import com.kerwin.wumei.adapter.entity.EspTouchViewModel;
|
||||||
import com.kerwin.wumei.core.BaseActivity;
|
import com.kerwin.wumei.core.BaseActivity;
|
||||||
import com.kerwin.wumei.fragment.LoginFragment;
|
|
||||||
import com.kerwin.wumei.fragment.device.AddDeviceFragment;
|
import com.kerwin.wumei.fragment.device.AddDeviceFragment;
|
||||||
import com.kerwin.wumei.utils.NetUtils;
|
import com.kerwin.wumei.utils.NetUtils;
|
||||||
import com.xuexiang.xui.utils.KeyboardUtils;
|
import com.xuexiang.xui.utils.KeyboardUtils;
|
||||||
import com.xuexiang.xui.utils.StatusBarUtils;
|
import com.xuexiang.xui.utils.StatusBarUtils;
|
||||||
import com.xuexiang.xui.widget.progress.CircleProgressView;
|
|
||||||
import com.xuexiang.xutil.display.Colors;
|
import com.xuexiang.xutil.display.Colors;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
@@ -334,7 +328,7 @@ public class AddDeviceActivity extends BaseActivity {
|
|||||||
activity.mTask = null;
|
activity.mTask = null;
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
addDeviceFragment.showMessage("建立 EspTouch 任务失败, 端口可能被其他程序占用",false);
|
addDeviceFragment.showMessage("建立 EspTouch 任务失败, 端口可能被其他程序占用",false);
|
||||||
addDeviceFragment.endCounter();
|
addDeviceFragment.cancleCounter();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,16 +340,16 @@ public class AddDeviceActivity extends BaseActivity {
|
|||||||
|
|
||||||
if (!firstResult.isSuc()) {
|
if (!firstResult.isSuc()) {
|
||||||
addDeviceFragment.showMessage("配网失败",false);
|
addDeviceFragment.showMessage("配网失败",false);
|
||||||
addDeviceFragment.endCounter();
|
addDeviceFragment.cancleCounter();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String message="";
|
String message="";
|
||||||
for (IEsptouchResult touchResult : result) {
|
for (IEsptouchResult touchResult : result) {
|
||||||
message += "BSSID: "+touchResult.getBssid()+", 地址: "+touchResult.getInetAddress().getHostAddress()+"\n";
|
message += "BSSID: "+touchResult.getBssid()+"\n 地址: "+touchResult.getInetAddress().getHostAddress()+"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
addDeviceFragment.endCounter();
|
addDeviceFragment.completeCounter();
|
||||||
addDeviceFragment.showMessage("完成配网\n"+message,true);
|
addDeviceFragment.showMessage("完成配网\n"+message,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import android.text.method.HideReturnsTransformationMethod;
|
|||||||
import android.text.method.PasswordTransformationMethod;
|
import android.text.method.PasswordTransformationMethod;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.CheckBox;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -30,16 +31,21 @@ import com.kerwin.wumei.activity.AddDeviceActivity;
|
|||||||
import com.kerwin.wumei.adapter.entity.EspTouchViewModel;
|
import com.kerwin.wumei.adapter.entity.EspTouchViewModel;
|
||||||
import com.kerwin.wumei.core.BaseFragment;
|
import com.kerwin.wumei.core.BaseFragment;
|
||||||
import com.xuexiang.xpage.annotation.Page;
|
import com.xuexiang.xpage.annotation.Page;
|
||||||
import com.xuexiang.xui.widget.progress.CircleProgressView;
|
import com.king.view.circleprogressview.CircleProgressView;
|
||||||
|
|
||||||
import com.xuexiang.xui.widget.textview.supertextview.SuperButton;
|
import com.xuexiang.xui.widget.textview.supertextview.SuperButton;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
|
|
||||||
|
import static com.kerwin.wumei.utils.SettingUtils.getWifiPassword;
|
||||||
|
import static com.kerwin.wumei.utils.SettingUtils.setWifiPassword;
|
||||||
|
|
||||||
|
|
||||||
@Page(name = "智能配网")
|
@Page(name = "智能配网")
|
||||||
public class AddDeviceFragment extends BaseFragment implements CircleProgressView.CircleProgressUpdateListener {
|
public class AddDeviceFragment extends BaseFragment {
|
||||||
@BindView(R.id.advance_frame_layout)
|
@BindView(R.id.advance_frame_layout)
|
||||||
FrameLayout advanceFrameLayout;
|
FrameLayout advanceFrameLayout;
|
||||||
@BindView(R.id.advance_linear_layout)
|
@BindView(R.id.advance_linear_layout)
|
||||||
@@ -48,14 +54,18 @@ public class AddDeviceFragment extends BaseFragment implements CircleProgressVie
|
|||||||
AppCompatImageView advanceIcon;
|
AppCompatImageView advanceIcon;
|
||||||
@BindView(R.id.wifi_password_icon)
|
@BindView(R.id.wifi_password_icon)
|
||||||
AppCompatImageView wifiPasswordIcon;
|
AppCompatImageView wifiPasswordIcon;
|
||||||
@BindView(R.id.progressView_circle_main)
|
// @BindView(R.id.progressView_circle_main)
|
||||||
CircleProgressView progressViewCircleMain;
|
// CircleProgressView progressViewCircleMain;
|
||||||
@BindView(R.id.progress_text_main)
|
@BindView(R.id.progress_text_main)
|
||||||
TextView progressTextMain;
|
TextView progressTextMain;
|
||||||
@BindView(R.id.btn_config_cancle)
|
@BindView(R.id.btn_config_cancle)
|
||||||
SuperButton btnConfigCancle;
|
SuperButton btnConfigCancle;
|
||||||
@BindView(R.id.btn_return)
|
@BindView(R.id.btn_return)
|
||||||
SuperButton btnReturn;
|
SuperButton btnReturn;
|
||||||
|
@BindView(R.id.chk_remeber)
|
||||||
|
CheckBox chk_remeber;
|
||||||
|
@BindView(R.id.circleProgressView)
|
||||||
|
CircleProgressView circleProgressView;
|
||||||
|
|
||||||
private static final String TAG = AddDeviceFragment.class.getSimpleName();
|
private static final String TAG = AddDeviceFragment.class.getSimpleName();
|
||||||
private static final int REQUEST_PERMISSION = 0x01;
|
private static final int REQUEST_PERMISSION = 0x01;
|
||||||
@@ -81,24 +91,33 @@ public class AddDeviceFragment extends BaseFragment implements CircleProgressVie
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void initViews() {
|
protected void initViews() {
|
||||||
progressViewCircleMain.setGraduatedEnabled(true);
|
|
||||||
progressViewCircleMain.setProgressViewUpdateListener(this);
|
|
||||||
|
|
||||||
//智能配网
|
//智能配网
|
||||||
mViewModel = ((AddDeviceActivity)this.getActivity()).GetMViewModel();
|
mViewModel = ((AddDeviceActivity)this.getActivity()).GetMViewModel();
|
||||||
mViewModel.ssidSpinner = findViewById(R.id.ssid_spinner);
|
|
||||||
mViewModel.apPasswordEdit = findViewById(R.id.wifi_password_txt);
|
mViewModel.apPasswordEdit = findViewById(R.id.wifi_password_txt);
|
||||||
|
mViewModel.apPasswordEdit.setText(getWifiPassword());
|
||||||
|
|
||||||
|
mViewModel.ssidSpinner = findViewById(R.id.ssid_spinner);
|
||||||
mViewModel.packageModeGroup = findViewById(R.id.packageModeGroup);
|
mViewModel.packageModeGroup = findViewById(R.id.packageModeGroup);
|
||||||
mViewModel.messageView = findViewById(R.id.txt_config_message);
|
mViewModel.messageView = findViewById(R.id.txt_config_message);
|
||||||
mViewModel.messageView.setText("");
|
mViewModel.messageView.setText("");
|
||||||
|
|
||||||
mViewModel.xsbDeviceCount = findViewById(R.id.xsb_device_count);
|
mViewModel.xsbDeviceCount = findViewById(R.id.xsb_device_count);
|
||||||
mViewModel.xsbDeviceCount.setDefaultValue(1);
|
mViewModel.xsbDeviceCount.setDefaultValue(1);
|
||||||
|
|
||||||
mViewModel.confirmBtn = findViewById(R.id.btn_begin);
|
mViewModel.confirmBtn = findViewById(R.id.btn_begin);
|
||||||
mViewModel.confirmBtn.setOnClickListener(v ->
|
mViewModel.confirmBtn.setOnClickListener(v ->
|
||||||
{
|
{
|
||||||
|
|
||||||
((AddDeviceActivity)this.getActivity()).executeEsptouch();
|
((AddDeviceActivity)this.getActivity()).executeEsptouch();
|
||||||
|
|
||||||
|
//存储wifi密码
|
||||||
|
if(chk_remeber.isChecked()){
|
||||||
|
setWifiPassword(mViewModel.apPasswordEdit.getText().toString());
|
||||||
|
}else{
|
||||||
|
setWifiPassword("");
|
||||||
|
}
|
||||||
|
|
||||||
// PageOption.to(AddDeviceTwoFragment.class) //跳转的fragment
|
// PageOption.to(AddDeviceTwoFragment.class) //跳转的fragment
|
||||||
// .setAnim(CoreAnim.slide) //页面转场动画
|
// .setAnim(CoreAnim.slide) //页面转场动画
|
||||||
// .setRequestCode(100) //请求码,用于返回结果
|
// .setRequestCode(100) //请求码,用于返回结果
|
||||||
@@ -131,42 +150,6 @@ public class AddDeviceFragment extends BaseFragment implements CircleProgressVie
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 进度条开始更新
|
|
||||||
*
|
|
||||||
* @param view
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onCircleProgressStart(View view) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 进度条更新结束
|
|
||||||
*
|
|
||||||
* @param view
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onCircleProgressFinished(View view) {
|
|
||||||
progressViewCircleMain.startProgressAnimation();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 进度条更新中
|
|
||||||
*
|
|
||||||
* @param view
|
|
||||||
* @param progress
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onCircleProgressUpdate(View view, float progress) {
|
|
||||||
|
|
||||||
// progressTextMain.setText("10");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initListeners() {
|
protected void initListeners() {
|
||||||
//单击高级设置项
|
//单击高级设置项
|
||||||
@@ -205,7 +188,7 @@ public class AddDeviceFragment extends BaseFragment implements CircleProgressVie
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view){
|
public void onClick(View view){
|
||||||
((AddDeviceActivity)getActivity()).interruptEspTouchTask();
|
((AddDeviceActivity)getActivity()).interruptEspTouchTask();
|
||||||
endCounter();
|
cancleCounter();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -213,7 +196,7 @@ public class AddDeviceFragment extends BaseFragment implements CircleProgressVie
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view){
|
public void onClick(View view){
|
||||||
popToBack();
|
popToBack();
|
||||||
endCounter();
|
cancleCounter();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -221,7 +204,7 @@ public class AddDeviceFragment extends BaseFragment implements CircleProgressVie
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
endCounter();
|
cancleCounter();
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,22 +212,50 @@ public class AddDeviceFragment extends BaseFragment implements CircleProgressVie
|
|||||||
* 打开计时器
|
* 打开计时器
|
||||||
*/
|
*/
|
||||||
public void beginCounter(){
|
public void beginCounter(){
|
||||||
progressViewCircleMain.startProgressAnimation();
|
|
||||||
mHander.post(mCounter);
|
|
||||||
showMessage("配网中...",true);
|
|
||||||
mViewModel.confirmBtn.setEnabled(false);
|
mViewModel.confirmBtn.setEnabled(false);
|
||||||
btnConfigCancle.setEnabled(true);
|
btnConfigCancle.setEnabled(true);
|
||||||
|
showMessage("配网中...",true);
|
||||||
|
mHander.post(mCounter);
|
||||||
|
|
||||||
|
//显示进度动画,进度,动画时长
|
||||||
|
circleProgressView.showAnimation(100,3000);
|
||||||
|
//设置进度改变监听
|
||||||
|
circleProgressView.setOnChangeListener(new CircleProgressView.OnChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onProgressChanged(float progress, float max) {
|
||||||
|
if(progress==100){
|
||||||
|
circleProgressView.setProgress(0);
|
||||||
|
circleProgressView.showAnimation(100);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计时器完成
|
||||||
|
*/
|
||||||
|
public void completeCounter(){
|
||||||
|
mCount=0;
|
||||||
|
mHander.removeCallbacks(mCounter);
|
||||||
|
progressTextMain.setText("100");
|
||||||
|
circleProgressView.setOnChangeListener(null);
|
||||||
|
circleProgressView.showAppendAnimation(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭计时器
|
* 关闭计时器
|
||||||
*/
|
*/
|
||||||
public void endCounter(){
|
public void cancleCounter(){
|
||||||
mHander.removeCallbacks(mCounter);
|
|
||||||
mViewModel.confirmBtn.setEnabled(true);
|
mViewModel.confirmBtn.setEnabled(true);
|
||||||
btnConfigCancle.setEnabled(false);
|
btnConfigCancle.setEnabled(false);
|
||||||
progressViewCircleMain.stopProgressAnimation();
|
showMessage("",true);
|
||||||
progressViewCircleMain.setProgressViewUpdateListener(null);
|
|
||||||
|
mCount=0;
|
||||||
|
mHander.removeCallbacks(mCounter);
|
||||||
|
progressTextMain.setText("0");
|
||||||
|
circleProgressView.setOnChangeListener(null);
|
||||||
|
circleProgressView.showAppendAnimation(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import com.xuexiang.xpage.annotation.Page;
|
|||||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||||
import com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText;
|
import com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText;
|
||||||
import com.xuexiang.xui.widget.textview.supertextview.SuperButton;
|
import com.xuexiang.xui.widget.textview.supertextview.SuperButton;
|
||||||
|
import com.xuexiang.xui.widget.toast.XToast;
|
||||||
import com.xuexiang.xutil.net.JsonUtil;
|
import com.xuexiang.xutil.net.JsonUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -64,6 +65,8 @@ public class DeviceEditFragment extends BaseFragment {
|
|||||||
SuperButton sp_device_temperature;
|
SuperButton sp_device_temperature;
|
||||||
@BindView(R.id.update_device_temp_icon)
|
@BindView(R.id.update_device_temp_icon)
|
||||||
AppCompatImageView update_temp_icon;
|
AppCompatImageView update_temp_icon;
|
||||||
|
@BindView(R.id.sp_upgrade)
|
||||||
|
SuperButton sp_upgrade;
|
||||||
|
|
||||||
private Long deviceId=0L;
|
private Long deviceId=0L;
|
||||||
private String deviceNum="";
|
private String deviceNum="";
|
||||||
@@ -100,7 +103,7 @@ public class DeviceEditFragment extends BaseFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SingleClick
|
@SingleClick
|
||||||
@OnClick({ R.id.btn_save,R.id.btn_cancle_edit,R.id.update_device_temp_icon})
|
@OnClick({ R.id.btn_save,R.id.btn_cancle_edit,R.id.update_device_temp_icon,R.id.sp_upgrade})
|
||||||
public void onViewClicked(View view) {
|
public void onViewClicked(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.btn_save:
|
case R.id.btn_save:
|
||||||
@@ -113,6 +116,8 @@ public class DeviceEditFragment extends BaseFragment {
|
|||||||
getNewStatusData();
|
getNewStatusData();
|
||||||
update_temp_icon.setVisibility(View.GONE);
|
update_temp_icon.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
|
case R.id.sp_upgrade:
|
||||||
|
XToastUtils.success("固件已经是最新版本");
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,27 +203,23 @@ public class SimpleTabFragment extends BaseFragment {
|
|||||||
|
|
||||||
holder.click(R.id.device_item_light_button, v -> {
|
holder.click(R.id.device_item_light_button, v -> {
|
||||||
if(device.getIsOnline()==0) return;
|
if(device.getIsOnline()==0) return;
|
||||||
// 更新灯状态
|
|
||||||
updateDeviceStatus(buildDeviceLightStatus(device.getDeviceId(),
|
|
||||||
device.getDeviceNum(),
|
|
||||||
lightIconView.isIconEnabled()==true?0:1));
|
|
||||||
//震动
|
//震动
|
||||||
Vibrator vibrator = (Vibrator) activity.getSystemService(activity.VIBRATOR_SERVICE);
|
Vibrator vibrator = (Vibrator) activity.getSystemService(activity.VIBRATOR_SERVICE);
|
||||||
vibrator.vibrate(100);
|
vibrator.vibrate(100);
|
||||||
lightIconView.switchState(true);
|
// 更新灯状态
|
||||||
|
updateDeviceStatus(
|
||||||
|
buildDeviceLightStatus(device.getDeviceId(), device.getDeviceNum(),lightIconView.isIconEnabled()==true?0:1)
|
||||||
|
, lightIconView);
|
||||||
});
|
});
|
||||||
holder.click(R.id.device_item_switch_button, v -> {
|
holder.click(R.id.device_item_switch_button, v -> {
|
||||||
if(device.getIsOnline()==0) return;
|
if(device.getIsOnline()==0) return;
|
||||||
// 更新继电器状态
|
|
||||||
updateDeviceStatus(buildDeviceRelayStatus(device.getDeviceId(),
|
|
||||||
device.getDeviceNum(),
|
|
||||||
switchIconView.isIconEnabled()==true?0:1));
|
|
||||||
//震动
|
//震动
|
||||||
Vibrator vibrator = (Vibrator) activity.getSystemService(activity.VIBRATOR_SERVICE);
|
Vibrator vibrator = (Vibrator) activity.getSystemService(activity.VIBRATOR_SERVICE);
|
||||||
vibrator.vibrate(100);
|
vibrator.vibrate(100);
|
||||||
switchIconView.switchState(true);
|
// 更新继电器状态
|
||||||
|
updateDeviceStatus(
|
||||||
|
buildDeviceRelayStatus(device.getDeviceId(),device.getDeviceNum(),switchIconView.isIconEnabled()==true?0:1)
|
||||||
|
, switchIconView);
|
||||||
});
|
});
|
||||||
holder.click(R.id.device_item_card_view, v -> {
|
holder.click(R.id.device_item_card_view, v -> {
|
||||||
|
|
||||||
@@ -307,7 +303,7 @@ public class SimpleTabFragment extends BaseFragment {
|
|||||||
/**
|
/**
|
||||||
* HTTP更新设备状态
|
* HTTP更新设备状态
|
||||||
*/
|
*/
|
||||||
private void updateDeviceStatus(IotDeviceStatus deviceStatus){
|
private void updateDeviceStatus(IotDeviceStatus deviceStatus,SwitchIconView iconView){
|
||||||
if(!hasToken()) return;
|
if(!hasToken()) return;
|
||||||
XHttp.put("/prod-api/system/status")
|
XHttp.put("/prod-api/system/status")
|
||||||
.upJson(JsonUtil.toJson(deviceStatus))
|
.upJson(JsonUtil.toJson(deviceStatus))
|
||||||
@@ -316,6 +312,7 @@ public class SimpleTabFragment extends BaseFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(String response) throws Throwable {
|
public void onSuccess(String response) throws Throwable {
|
||||||
Log.d("response:",response);
|
Log.d("response:",response);
|
||||||
|
iconView.switchState(true);
|
||||||
XToastUtils.success("设备状态更新成功");
|
XToastUtils.success("设备状态更新成功");
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public final class SettingUtils {
|
|||||||
private static final String SERVERPORT="serve_port";
|
private static final String SERVERPORT="serve_port";
|
||||||
private static final String ISHTTPS="is_https";
|
private static final String ISHTTPS="is_https";
|
||||||
private static final String APIP="ap_ip";
|
private static final String APIP="ap_ip";
|
||||||
|
private static final String WIFIPASSWORD="wifi_password";
|
||||||
/**
|
/**
|
||||||
* 是否是第一次启动
|
* 是否是第一次启动
|
||||||
*/
|
*/
|
||||||
@@ -98,6 +99,22 @@ public final class SettingUtils {
|
|||||||
return MMKVUtils.getString(APIP,"192.168.4.1");
|
return MMKVUtils.getString(APIP,"192.168.4.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置wifi密码
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static void setWifiPassword(String wifiPassword){
|
||||||
|
MMKVUtils.put(WIFIPASSWORD,wifiPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取wifi密码
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getWifiPassword(){
|
||||||
|
return MMKVUtils.getString(WIFIPASSWORD,"");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取服务端ip
|
* 获取服务端ip
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -34,30 +34,43 @@
|
|||||||
android:animationCache="false"
|
android:animationCache="false"
|
||||||
android:background="#FFFFFF">
|
android:background="#FFFFFF">
|
||||||
|
|
||||||
<com.xuexiang.xui.widget.progress.CircleProgressView
|
<com.king.view.circleprogressview.CircleProgressView
|
||||||
android:id="@+id/progressView_circle_main"
|
android:id="@+id/circleProgressView"
|
||||||
android:layout_width="220dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="220dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="0dp"
|
app:cpvBlockAngle="1"
|
||||||
android:layout_marginBottom="0dp"
|
app:cpvDuration="300"
|
||||||
app:cpv_animate_type="AccelerateDecelerateInterpolator"
|
app:cpvMax="100"
|
||||||
app:cpv_circle_broken="false"
|
app:cpvProgress="0"
|
||||||
app:cpv_end_color="#80006DFE"
|
app:cpvProgressColor="#006DFE"
|
||||||
app:cpv_end_progress="100"
|
app:cpvShowLabel="false"
|
||||||
app:cpv_isFilled="false"
|
app:cpvStrokeWidth="12dp"
|
||||||
app:cpv_isGraduated="false"
|
app:cpvTickSplitAngle="5" />
|
||||||
app:cpv_isTracked="true"
|
|
||||||
app:cpv_progress_duration="3000"
|
<!-- <com.xuexiang.xui.widget.progress.CircleProgressView-->
|
||||||
app:cpv_progress_textColor="#0D006DFE"
|
<!-- android:id="@+id/progressView_circle_main"-->
|
||||||
app:cpv_progress_textSize="48sp"
|
<!-- android:layout_width="220dp"-->
|
||||||
app:cpv_progress_textVisibility="false"
|
<!-- android:layout_height="220dp"-->
|
||||||
app:cpv_progress_width="16dp"
|
<!-- android:layout_gravity="center"-->
|
||||||
app:cpv_scaleZone_width="3dp"
|
<!-- android:layout_marginTop="0dp"-->
|
||||||
app:cpv_start_color="@color/cardview_light_background"
|
<!-- android:layout_marginBottom="0dp"-->
|
||||||
app:cpv_start_progress="0"
|
<!-- app:cpv_animate_type="LinearInterpolator"-->
|
||||||
app:cpv_track_color="#FAFAFF"
|
<!-- app:cpv_circle_broken="false"-->
|
||||||
app:cpv_track_width="26dp" />
|
<!-- app:cpv_end_color="#006dfe"-->
|
||||||
|
<!-- app:cpv_end_progress="98"-->
|
||||||
|
<!-- app:cpv_isFilled="false"-->
|
||||||
|
<!-- app:cpv_isGraduated="false"-->
|
||||||
|
<!-- app:cpv_isTracked="true"-->
|
||||||
|
<!-- app:cpv_progress_duration="3000"-->
|
||||||
|
<!-- app:cpv_progress_textSize="48sp"-->
|
||||||
|
<!-- app:cpv_progress_textVisibility="false"-->
|
||||||
|
<!-- app:cpv_progress_width="16dp"-->
|
||||||
|
<!-- app:cpv_scaleZone_width="3dp"-->
|
||||||
|
<!-- app:cpv_start_color="@color/cardview_light_background"-->
|
||||||
|
<!-- app:cpv_start_progress="0"-->
|
||||||
|
<!-- app:cpv_track_color="#FAFAFF"-->
|
||||||
|
<!-- app:cpv_track_width="26dp" />-->
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -71,14 +84,14 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="0"
|
android:text="0"
|
||||||
android:textColor="@color/colorAccent"
|
android:textColor="@color/colorAccent"
|
||||||
android:textSize="48sp" />
|
android:textSize="40dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="%"
|
android:text="%"
|
||||||
android:textColor="@color/colorAccent"
|
android:textColor="@color/colorAccent"
|
||||||
android:textSize="32sp" />
|
android:textSize="28dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
@@ -141,7 +154,7 @@
|
|||||||
app:met_errorMessage="WIFI密码无效"
|
app:met_errorMessage="WIFI密码无效"
|
||||||
app:met_floatingLabel="normal"
|
app:met_floatingLabel="normal"
|
||||||
app:met_floatingLabelText="WIFI密码"
|
app:met_floatingLabelText="WIFI密码"
|
||||||
app:met_passWordButton="true" />
|
app:met_passWordButton="false" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
@@ -159,14 +172,13 @@
|
|||||||
android:textColor="@color/colorAccent"
|
android:textColor="@color/colorAccent"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<RadioButton
|
<CheckBox
|
||||||
android:id="@+id/remember_passord_radio"
|
android:id="@+id/chk_remeber"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="42dp"
|
android:layout_height="42dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentRight="true"
|
||||||
android:checked="true"
|
android:checked="true"
|
||||||
android:text="记住密码"
|
android:text="记住密码" />
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -135,6 +135,18 @@
|
|||||||
android:layout_marginStart="80dp"
|
android:layout_marginStart="80dp"
|
||||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||||
android:text="v1.0" />
|
android:text="v1.0" />
|
||||||
|
|
||||||
|
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||||
|
android:id="@+id/sp_upgrade"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_marginStart="120dp"
|
||||||
|
android:layout_marginTop="18dp"
|
||||||
|
android:paddingStart="12dp"
|
||||||
|
android:paddingEnd="12dp"
|
||||||
|
android:text="升级"
|
||||||
|
app:sCornersRadius="5dp"
|
||||||
|
app:sSolidColor="@color/app_color_theme_2" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
@@ -202,7 +214,7 @@
|
|||||||
android:layout_height="35dp"
|
android:layout_height="35dp"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="40dp"
|
||||||
android:layout_marginBottom="40dp"
|
android:layout_marginBottom="40dp"
|
||||||
android:text="取消"
|
android:text="返 回"
|
||||||
app:sCornersRadius="5dp"
|
app:sCornersRadius="5dp"
|
||||||
app:sSolidColor="@color/app_color_theme_2" />
|
app:sSolidColor="@color/app_color_theme_2" />
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
<string name="esptouch1_package_multicast">组播</string>
|
<string name="esptouch1_package_multicast">组播</string>
|
||||||
<string name="esptouch1_confirm">确认</string>
|
<string name="esptouch1_confirm">确认</string>
|
||||||
<string name="esptouch1_wifi_5g_message">设备不支持 5G Wi-Fi, 请确认当前连接的 Wi-Fi 为 2.4G, 或者您可以尝试选择组播</string>
|
<string name="esptouch1_wifi_5g_message">设备不支持 5G Wi-Fi, 请确认当前连接的 Wi-Fi 为 2.4G, 或者您可以尝试选择组播</string>
|
||||||
<string name="esptouch1_location_permission_title">⚠️警告️</string>
|
<string name="esptouch1_location_permission_title">⚠ 警告 </string>
|
||||||
<string name="esptouch1_location_permission_message">在 Android M 及以上版本,如果您禁止授权位置权限,APP将无法获取 Wi-Fi 信息。</string>
|
<string name="esptouch1_location_permission_message">在 Android M 及以上版本,如果您禁止授权位置权限,APP将无法获取 Wi-Fi 信息。</string>
|
||||||
<string name="esptouch1_configure_wifi_change_message">Wi-Fi 已断开或发生了变化</string>
|
<string name="esptouch1_configure_wifi_change_message">Wi-Fi 已断开或发生了变化</string>
|
||||||
<string name="esptouch1_configuring_message">Esptouch 正在执行配网, 请稍等片刻…</string>
|
<string name="esptouch1_configuring_message">Esptouch 正在执行配网, 请稍等片刻…</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user