扫描二维码,连接配网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.setText(getString(R.string.device_status_offline));
|
||||||
viewBinding.tvDeviceStatus.setTextColor(mContext.getResources().getColor(R.color.color_999999));
|
viewBinding.tvDeviceStatus.setTextColor(mContext.getResources().getColor(R.color.color_999999));
|
||||||
viewBinding.tvConfirm.setEnabled(false);
|
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.linearWifi.setBackground(mContext.getResources().getDrawable(R.drawable.shape_device_ctrl_white_cor12));
|
||||||
viewBinding.imgWifiLogo.setImageResource(R.mipmap.icon_ctrl_wifi_green);
|
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);
|
Log.i("TEST","errorCode == " + errorCode + " message == " + message);
|
||||||
ToastUtil.showShort(mContext, message);
|
ToastUtil.showShort(mContext, message);
|
||||||
hideDialogLoading();
|
hideDialogLoading();
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -158,7 +158,6 @@ public class IndexFragment extends BaseFragment<IndexFragmentLayoutBinding, Inde
|
|||||||
public void onActivityResult(int resultCode, Intent data) {
|
public void onActivityResult(int resultCode, Intent data) {
|
||||||
switch (resultCode) {
|
switch (resultCode) {
|
||||||
case MNScanManager.RESULT_SUCCESS:
|
case MNScanManager.RESULT_SUCCESS:
|
||||||
try {
|
|
||||||
ArrayList<String> results = data.getStringArrayListExtra(MNScanManager.INTENT_KEY_RESULT_SUCCESS);
|
ArrayList<String> results = data.getStringArrayListExtra(MNScanManager.INTENT_KEY_RESULT_SUCCESS);
|
||||||
|
|
||||||
if (results == null || results.isEmpty()) {
|
if (results == null || results.isEmpty()) {
|
||||||
@@ -179,6 +178,7 @@ public class IndexFragment extends BaseFragment<IndexFragmentLayoutBinding, Inde
|
|||||||
ToastUtil.showShort(mContext, "二维码格式错误");
|
ToastUtil.showShort(mContext, "二维码格式错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
WaterDeviceEntity entity = new WaterDeviceEntity();
|
WaterDeviceEntity entity = new WaterDeviceEntity();
|
||||||
if(TextUtils.isEmpty(json.getString("mac"))
|
if(TextUtils.isEmpty(json.getString("mac"))
|
||||||
|| TextUtils.isEmpty(json.getString("name"))){
|
|| TextUtils.isEmpty(json.getString("name"))){
|
||||||
@@ -192,7 +192,8 @@ public class IndexFragment extends BaseFragment<IndexFragmentLayoutBinding, Inde
|
|||||||
mPresenter.bindDeviceStatus(entity);
|
mPresenter.bindDeviceStatus(entity);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
throw new RuntimeException(e);
|
ToastUtil.showShort(mContext, "二维码格式错误");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MNScanManager.RESULT_FAIL:
|
case MNScanManager.RESULT_FAIL:
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ public class PlanDetailActivity extends BaseActivity<WaterPlanDetailLayoutBindin
|
|||||||
}
|
}
|
||||||
//设备显示
|
//设备显示
|
||||||
if(deviceAdapter != null){
|
if(deviceAdapter != null){
|
||||||
deviceAdapter.setNewData(entity.getDeviceIds());
|
deviceAdapter.setNewData(entity.getDeviceNos());
|
||||||
if(deviceAdapter.getItemCount() == 0){
|
if(deviceAdapter.getItemCount() == 0){
|
||||||
viewBinding.rvBindDevices.setVisibility(View.GONE);
|
viewBinding.rvBindDevices.setVisibility(View.GONE);
|
||||||
viewBinding.tvNoDevice.setVisibility(View.VISIBLE);
|
viewBinding.tvNoDevice.setVisibility(View.VISIBLE);
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ package com.ckkj.water.plan;
|
|||||||
|
|
||||||
import static android.view.View.INVISIBLE;
|
import static android.view.View.INVISIBLE;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
import com.ckkj.water.R;
|
import com.ckkj.water.R;
|
||||||
@@ -33,6 +36,7 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
|||||||
private List<WaterPlanWeekEntity> mPlanList = new ArrayList<>();
|
private List<WaterPlanWeekEntity> mPlanList = new ArrayList<>();
|
||||||
private WaterPlanListAdapter mAdapter;
|
private WaterPlanListAdapter mAdapter;
|
||||||
private int mCurrentPage = 1;
|
private int mCurrentPage = 1;
|
||||||
|
private String mSearchOption = "";
|
||||||
@Override
|
@Override
|
||||||
public void initData(Bundle state) {
|
public void initData(Bundle state) {
|
||||||
|
|
||||||
@@ -63,13 +67,36 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
|||||||
viewBinding.refresh.setRefreshHeader(header);
|
viewBinding.refresh.setRefreshHeader(header);
|
||||||
viewBinding.refresh.setRefreshFooter(new ClassicsFooter(mContext));
|
viewBinding.refresh.setRefreshFooter(new ClassicsFooter(mContext));
|
||||||
viewBinding.refresh.setOnRefreshListener(layout -> {
|
viewBinding.refresh.setOnRefreshListener(layout -> {
|
||||||
|
mSearchOption = "";
|
||||||
mCurrentPage = 1;
|
mCurrentPage = 1;
|
||||||
viewBinding.refresh.setNoMoreData(false);
|
viewBinding.refresh.setNoMoreData(false);
|
||||||
mPresenter.getWaterPlanList(mCurrentPage);
|
mPresenter.getWaterPlanList(mCurrentPage,mSearchOption);
|
||||||
|
viewBinding.etInputPlanName.setText("");
|
||||||
});
|
});
|
||||||
viewBinding.refresh.setOnLoadMoreListener(layout -> {
|
viewBinding.refresh.setOnLoadMoreListener(layout -> {
|
||||||
mCurrentPage++;
|
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() {
|
protected void onResumeInitData() {
|
||||||
super.onResumeInitData();
|
super.onResumeInitData();
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
mPresenter.getWaterPlanList(mCurrentPage);
|
mPresenter.getWaterPlanList(mCurrentPage,mSearchOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initListener() {
|
private void initListener() {
|
||||||
@@ -97,7 +124,7 @@ public class WaterPlanFragment extends BaseFragment<WaterPlanFragmentBinding, Wa
|
|||||||
|
|
||||||
case R.id.btn_refresh:
|
case R.id.btn_refresh:
|
||||||
mCurrentPage = 1;
|
mCurrentPage = 1;
|
||||||
mPresenter.getWaterPlanList(mCurrentPage);
|
mPresenter.getWaterPlanList(mCurrentPage,mSearchOption);
|
||||||
break;
|
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<String,String> map = new HashMap<>();
|
||||||
map.put("pageNum", mCurrentPage + "");
|
map.put("pageNum", mCurrentPage + "");
|
||||||
map.put("pageSize", "10");
|
map.put("pageSize", "10");
|
||||||
|
map.put("name", searchOption);
|
||||||
impl.getWaterConfigList(map, new WaterPlanContract.CallBack<List<WaterPlanWeekEntity>>() {
|
impl.getWaterConfigList(map, new WaterPlanContract.CallBack<List<WaterPlanWeekEntity>>() {
|
||||||
|
|
||||||
@Override
|
@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:gravity="center"
|
||||||
android:background="@drawable/shape_device_ctrl_green_cor12">
|
android:background="@drawable/shape_device_ctrl_green_cor12">
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/img_ble"
|
||||||
android:layout_width="@dimen/dp_24"
|
android:layout_width="@dimen/dp_24"
|
||||||
android:layout_height="@dimen/dp_24"
|
android:layout_height="@dimen/dp_24"
|
||||||
android:src="@mipmap/icon_ctrl_bt_white"/>
|
android:src="@mipmap/icon_ctrl_bt_white"/>
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
android:layout_toRightOf="@+id/img_search"
|
android:layout_toRightOf="@+id/img_search"
|
||||||
android:layout_marginLeft="@dimen/dp_8"
|
android:layout_marginLeft="@dimen/dp_8"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
android:imeOptions="actionSearch"
|
||||||
|
android:inputType="text"
|
||||||
android:hint="@string/input_plan_name"
|
android:hint="@string/input_plan_name"
|
||||||
android:textColorHint="@color/color_subtitle"/>
|
android:textColorHint="@color/color_subtitle"/>
|
||||||
</RelativeLayout>
|
</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