扫描二维码,连接配网1
This commit is contained in:
@@ -75,7 +75,8 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
||||
viewBinding.tvDeviceStatus.setText(getString(R.string.device_status_offline));
|
||||
viewBinding.tvDeviceStatus.setTextColor(mContext.getResources().getColor(R.color.color_999999));
|
||||
viewBinding.tvConfirm.setEnabled(false);
|
||||
viewBinding.tvConfirm.setBackgroundColor(mContext.getResources().getColor(R.color.color_999999));
|
||||
viewBinding.tvConfirm.setTextColor(mContext.getResources().getColor(R.color.color_999999));
|
||||
viewBinding.tvConfirm.setBackgroundResource((R.drawable.shape_gray_button_bg_enable));
|
||||
viewBinding.linearWifi.setBackground(mContext.getResources().getDrawable(R.drawable.shape_device_ctrl_white_cor12));
|
||||
viewBinding.imgWifiLogo.setImageResource(R.mipmap.icon_ctrl_wifi_green);
|
||||
}
|
||||
|
||||
@@ -276,6 +276,7 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
||||
Log.i("TEST","errorCode == " + errorCode + " message == " + message);
|
||||
ToastUtil.showShort(mContext, message);
|
||||
hideDialogLoading();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -158,27 +158,27 @@ public class IndexFragment extends BaseFragment<IndexFragmentLayoutBinding, Inde
|
||||
public void onActivityResult(int resultCode, Intent data) {
|
||||
switch (resultCode) {
|
||||
case MNScanManager.RESULT_SUCCESS:
|
||||
ArrayList<String> results = data.getStringArrayListExtra(MNScanManager.INTENT_KEY_RESULT_SUCCESS);
|
||||
|
||||
if (results == null || results.isEmpty()) {
|
||||
ToastUtil.showShort(mContext, "二维码内容不能为空");
|
||||
return;
|
||||
}
|
||||
|
||||
String scanContent = results.get(0);
|
||||
if (TextUtils.isEmpty(scanContent)) {
|
||||
ToastUtil.showShort(mContext, "二维码内容不能为空");
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject json;
|
||||
try {
|
||||
json = new JSONObject(scanContent);
|
||||
} catch (JSONException e) {
|
||||
ToastUtil.showShort(mContext, "二维码格式错误");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ArrayList<String> results = data.getStringArrayListExtra(MNScanManager.INTENT_KEY_RESULT_SUCCESS);
|
||||
|
||||
if (results == null || results.isEmpty()) {
|
||||
ToastUtil.showShort(mContext, "二维码内容不能为空");
|
||||
return;
|
||||
}
|
||||
|
||||
String scanContent = results.get(0);
|
||||
if (TextUtils.isEmpty(scanContent)) {
|
||||
ToastUtil.showShort(mContext, "二维码内容不能为空");
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject json;
|
||||
try {
|
||||
json = new JSONObject(scanContent);
|
||||
} catch (JSONException e) {
|
||||
ToastUtil.showShort(mContext, "二维码格式错误");
|
||||
return;
|
||||
}
|
||||
WaterDeviceEntity entity = new WaterDeviceEntity();
|
||||
if(TextUtils.isEmpty(json.getString("mac"))
|
||||
|| TextUtils.isEmpty(json.getString("name"))){
|
||||
@@ -192,7 +192,8 @@ public class IndexFragment extends BaseFragment<IndexFragmentLayoutBinding, Inde
|
||||
mPresenter.bindDeviceStatus(entity);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
ToastUtil.showShort(mContext, "二维码格式错误");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case MNScanManager.RESULT_FAIL:
|
||||
|
||||
@@ -200,7 +200,7 @@ public class PlanDetailActivity extends BaseActivity<WaterPlanDetailLayoutBindin
|
||||
}
|
||||
//设备显示
|
||||
if(deviceAdapter != null){
|
||||
deviceAdapter.setNewData(entity.getDeviceIds());
|
||||
deviceAdapter.setNewData(entity.getDeviceNos());
|
||||
if(deviceAdapter.getItemCount() == 0){
|
||||
viewBinding.rvBindDevices.setVisibility(View.GONE);
|
||||
viewBinding.tvNoDevice.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -2,8 +2,11 @@ package com.ckkj.water.plan;
|
||||
|
||||
import static android.view.View.INVISIBLE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.ckkj.water.R;
|
||||
@@ -33,6 +36,7 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
||||
private List<WaterPlanWeekEntity> mPlanList = new ArrayList<>();
|
||||
private WaterPlanListAdapter mAdapter;
|
||||
private int mCurrentPage = 1;
|
||||
private String mSearchOption = "";
|
||||
@Override
|
||||
public void initData(Bundle state) {
|
||||
|
||||
@@ -63,13 +67,36 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
||||
viewBinding.refresh.setRefreshHeader(header);
|
||||
viewBinding.refresh.setRefreshFooter(new ClassicsFooter(mContext));
|
||||
viewBinding.refresh.setOnRefreshListener(layout -> {
|
||||
mSearchOption = "";
|
||||
mCurrentPage = 1;
|
||||
viewBinding.refresh.setNoMoreData(false);
|
||||
mPresenter.getWaterPlanList(mCurrentPage);
|
||||
mPresenter.getWaterPlanList(mCurrentPage,mSearchOption);
|
||||
viewBinding.etInputPlanName.setText("");
|
||||
});
|
||||
viewBinding.refresh.setOnLoadMoreListener(layout -> {
|
||||
mCurrentPage++;
|
||||
mPresenter.getWaterPlanList(mCurrentPage);
|
||||
mPresenter.getWaterPlanList(mCurrentPage,mSearchOption);
|
||||
});
|
||||
//文本输入搜索排程
|
||||
viewBinding.etInputPlanName.setOnEditorActionListener((v, actionId, event) -> {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||
// 隐藏键盘
|
||||
InputMethodManager imm = (InputMethodManager) v.getContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
// 清除焦点(可选,避免键盘再次弹出)
|
||||
v.clearFocus();
|
||||
mSearchOption = v.getText().toString().trim();
|
||||
mCurrentPage = 1;
|
||||
// 执行搜索
|
||||
mPresenter.getWaterPlanList(mCurrentPage,mSearchOption);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -77,7 +104,7 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
||||
protected void onResumeInitData() {
|
||||
super.onResumeInitData();
|
||||
showLoadingDialog();
|
||||
mPresenter.getWaterPlanList(mCurrentPage);
|
||||
mPresenter.getWaterPlanList(mCurrentPage,mSearchOption);
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
@@ -97,7 +124,7 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
||||
|
||||
case R.id.btn_refresh:
|
||||
mCurrentPage = 1;
|
||||
mPresenter.getWaterPlanList(mCurrentPage);
|
||||
mPresenter.getWaterPlanList(mCurrentPage,mSearchOption);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,11 @@ public class WaterPlanPresenter extends BasePresenter<WaterPlanContract.WaterPla
|
||||
/**
|
||||
* 获取排程信息
|
||||
*/
|
||||
public void getWaterPlanList(int mCurrentPage) {
|
||||
public void getWaterPlanList(int mCurrentPage,String searchOption) {
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("pageNum", mCurrentPage + "");
|
||||
map.put("pageSize", "10");
|
||||
map.put("name", searchOption);
|
||||
impl.getWaterConfigList(map, new WaterPlanContract.CallBack<List<WaterPlanWeekEntity>>() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="5dp"/>
|
||||
<solid android:color="@color/color_d9d9d9"/>
|
||||
</shape>
|
||||
@@ -46,6 +46,7 @@
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_device_ctrl_green_cor12">
|
||||
<ImageView
|
||||
android:id="@+id/img_ble"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:src="@mipmap/icon_ctrl_bt_white"/>
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
android:layout_toRightOf="@+id/img_search"
|
||||
android:layout_marginLeft="@dimen/dp_8"
|
||||
android:textSize="14sp"
|
||||
android:imeOptions="actionSearch"
|
||||
android:inputType="text"
|
||||
android:hint="@string/input_plan_name"
|
||||
android:textColorHint="@color/color_subtitle"/>
|
||||
</RelativeLayout>
|
||||
|
||||
BIN
app/src/main/res/mipmap-xxhdpi/icon_ctrl_bt_green.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/icon_ctrl_bt_green.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 959 B |
BIN
app/src/main/res/mipmap-xxxhdpi/icon_ctrl_bt_green.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/icon_ctrl_bt_green.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Reference in New Issue
Block a user