app/src/main/AndroidManifest.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/DeviceSearchActivity.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseSearchActivity.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/layout/activity_device_search.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/AndroidManifest.xml
@@ -77,6 +77,9 @@ android:supportsRtl="true" android:theme="@style/Theme.PhotovoltaicDebug"> <activity android:name=".ui.powerstation.DeviceSearchActivity" android:exported="false" /> <activity android:name=".ui.powerstation.HouseSearchActivity" android:exported="false" /> <activity app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java
@@ -2,17 +2,27 @@ import android.content.Context; import android.graphics.Bitmap; import android.os.SystemClock; import android.text.TextUtils; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.google.gson.JsonObject; import com.google.zxing.BarcodeFormat; import com.google.zxing.EncodeHintType; import com.google.zxing.common.BitMatrix; import com.google.zxing.qrcode.QRCodeWriter; import com.hdl.linkpm.sdk.user.HDLLinkPMUser; import com.hdl.photovoltaic.config.UserConfigManage; import com.hdl.photovoltaic.utils.GlideUtils; import org.json.JSONObject; import java.io.InputStream; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Socket; import java.util.Hashtable; /** @@ -122,4 +132,6 @@ } } } app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -10,6 +10,7 @@ import android.location.Location; import android.location.LocationManager; import android.os.IBinder; import android.provider.Settings; import android.text.TextUtils; import androidx.core.app.ActivityCompat; @@ -68,9 +69,13 @@ import java.io.File; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.Type; import java.math.BigDecimal; import java.math.RoundingMode; import java.net.InetSocketAddress; import java.net.Socket; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -278,18 +283,28 @@ } break; //当前wifi详情 case HDLUniMP.UNI_EVENT_REPLY_WIFI_INFO: { case HDLUniMP.UNI_EVENT_REPLY_WIFI_PHONE_INFO: { if (callback != null) { uniCallbackData(mode_type, wifiUtils.getCurrentConnectWifiInfo(), callback); } } break; //wifi连接 case HDLUniMP.UNI_EVENT_REPLY_WIFI_CONNECT: { //配置WiFi信息给逆变器 case HDLUniMP.UNI_EVENT_REPLY_WIFI_SET_DEVICE: { String mac = getKeyValue("mac", getKeyValue("data", data));// String wif_type = getKeyValue("wif_type", getKeyValue("data", data));//1:热点,2:无线wifi,3:以太网 String ssid = getKeyValue("ssid", getKeyValue("data", data));// String password = getKeyValue("password", getKeyValue("data", data));// startTcpThreadSendAccountAndPassword(mode_type, ssid, password, callback); } break; //打开手机Wifi设置界面 case HDLUniMP.UNI_EVENT_REPLY_OPEN_WIFI_SETTINGS: { Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS); HDLApp.getInstance().startActivity(intent); } break; } } else if (HDLUniMP.UNI_EVENT_REPLY_OTA_MODEL.equals(topic)) { //OTA升级模块 @@ -1629,6 +1644,84 @@ /** * 发送账号和密码给逆变器 * * @param ssid 账号 * @param password 密码 * @param callback uni回调 */ public void startTcpThreadSendAccountAndPassword(String type, String ssid, String password, DCUniMPJSCallback callback) { new Thread( () -> { Socket socket = null; OutputStream outputStreamTcp = null; InputStream inputStreamTcp = null; try { socket = new Socket(); socket.setTcpNoDelay(true); socket.setSoTimeout(10 * 1000);//10秒超时 socket.connect(new InetSocketAddress("192.168.8.1", 8586)); socket.setKeepAlive(true); // logMessage("tcp连接状态成功", 0, ""); outputStreamTcp = socket.getOutputStream(); JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("id", "102030"); jsonObject.addProperty("ssid", ssid); jsonObject.addProperty("password", password); jsonObject.addProperty("server_addr", HDLLinkPMUser.getInstance().getHomeRegionUrl()); jsonObject.addProperty("homeId", UserConfigManage.getInstance().getHomeId()); String sendData = "Topic:/user/id/custom/wifi/set\r\n"; sendData += "Length:" + jsonObject.toString().getBytes().length + "\r\n\r\n"; sendData += jsonObject.toString(); outputStreamTcp.write(sendData.getBytes()); outputStreamTcp.flush(); Thread.sleep(200); inputStreamTcp = socket.getInputStream(); byte[] bytes = new byte[1204 * 2]; int len = inputStreamTcp.read(bytes); if (len != -1) { String str = new String(bytes, 0, bytes.length); String[] strings = str.split("\r\n\r\n"); String[] topicAndLength = strings[0].split("\r\n"); String topic = topicAndLength[0]; JSONObject json = new JSONObject(strings[1]); // logMessage("tcp回复数据", 0, strings[0] + "\r\n" + json.toString()); if (topic.endsWith("wifi/set_reply") || topic.endsWith("wifi/result/notify")) { if (callback != null) { uniCallbackData(type, json, callback); } if (json.has("mac")) { //回复成功再拿设备mac // this.device_mac = json.getString("mac"); // this.isSucceedTcp = true;//表示成功 } } } } catch (Exception ignored) { } finally { try { if (outputStreamTcp != null) { outputStreamTcp.close(); outputStreamTcp = null; } if (inputStreamTcp != null) { inputStreamTcp.close(); inputStreamTcp = null; } if (socket != null) { socket.close(); socket = null; } } catch (Exception ignored) { } } } ).start(); } /** * 发送modbus协议数据 * 透传协议 * 下发主题:/user/${gw_id}/custom/native/${driver}/down; @@ -1731,7 +1824,7 @@ HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); try { uniCallBackBaseBean.setCode(code); uniCallBackBaseBean.setMes(msg); uniCallBackBaseBean.setMsg(msg); uniCallBackBaseBean.setData(obj); if (callback != null) { callback.invoke(getJSONObject(uniCallBackBaseBean)); app/src/main/java/com/hdl/photovoltaic/ui/powerstation/DeviceSearchActivity.java
New file @@ -0,0 +1,393 @@ package com.hdl.photovoltaic.ui.powerstation; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import android.os.Bundle; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.view.View; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.hdl.linkpm.sdk.core.exception.HDLException; import com.hdl.photovoltaic.R; import com.hdl.photovoltaic.base.CustomBaseActivity; import com.hdl.photovoltaic.bean.PageNumberObject; import com.hdl.photovoltaic.databinding.ActivityDeviceSearchBinding; import com.hdl.photovoltaic.enums.ShowErrorMode; import com.hdl.photovoltaic.listener.CloudCallBeak; import com.hdl.photovoltaic.other.HdlDeviceLogic; import com.hdl.photovoltaic.other.HdlFileLogic; import com.hdl.photovoltaic.other.HdlLogLogic; import com.hdl.photovoltaic.other.HdlThreadLogic; import com.hdl.photovoltaic.ui.adapter.DeviceInfoAdapter; import com.hdl.photovoltaic.ui.adapter.SearchDeviceAdapter; import com.hdl.photovoltaic.ui.adapter.SearchHistoryAdapter; import com.hdl.photovoltaic.ui.bean.DeviceBean; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * 设备搜索界面 */ public class DeviceSearchActivity extends CustomBaseActivity { private ActivityDeviceSearchBinding viewBinding; SearchDeviceAdapter searchDeviceAdapter;//设备适配器 SearchHistoryAdapter searchHistoryAdapter;//历史记录适配器 private List<DeviceBean> deviceList = new ArrayList<>(); private int currentHouseListPage = 0; // 当前电站列表页码 private int currentHouseListTotal = 0; // 电站列表总页码 private boolean isHouseLoadingMore = false; // 标记电站列表正在加载更多数据 private String currSearchText; List<String> searchHistoryTitleList = new ArrayList<>(); @Override public Object getContentView() { viewBinding = ActivityDeviceSearchBinding.inflate(getLayoutInflater()); return viewBinding.getRoot(); } @Override public void onBindView(Bundle savedInstanceState) { setStatusBarTranslucent(); //历史记录文件夹创建 HdlFileLogic.getInstance().createFileDir(HdlFileLogic.getInstance().getCurrentUserRootPath()); //初始化数据 initData(); //初始化 initView(); //初始化界面监听器 initEvent(); } private void initData() { try { String json = HdlFileLogic.getInstance().readFile(getHistoryFileNamePath()); if (TextUtils.isEmpty(json)) { return; } searchHistoryTitleList = new Gson().fromJson(json, new TypeToken<List<String>>() { }.getType()); } catch (Exception ignored) { } } private void initEvent() { //后退 viewBinding.backRl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); viewBinding.powerStationSearchEt.addTextChangedListener(textWatcher); //搜索 viewBinding.powerStationSearchTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //搜索关键字 currSearchText = viewBinding.powerStationSearchEt.getText().toString().replace(" ", ""); if (TextUtils.isEmpty(currSearchText)) { HdlThreadLogic.toast(_mActivity, R.string.search_content_null); return; } viewBinding.historyListParent.setVisibility(View.GONE); viewBinding.listParent.setVisibility(View.VISIBLE); addSearchTextToList(); loadNextPageHouseList(true, 1, true); } }); //下拉箭头颜色 viewBinding.listSrl.setColorSchemeResources(R.color.text_FF245EC3); //下拉读取 viewBinding.listSrl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { viewBinding.listSrl.setRefreshing(false); loadNextPageHouseList(true, 1, true); } }); //上拉读取 viewBinding.listRcv.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); if (layoutManager == null) { return; } int visibleItemCount = layoutManager.getChildCount(); int totalItemCount = layoutManager.getItemCount(); int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition(); if (visibleItemCount > 0 && visibleItemCount + firstVisibleItemPosition == totalItemCount) { if (!isHouseLoadingMore) { // 滑动到了底部,执行相应的操作 HdlLogLogic.print("--->滑动到了底部"); loadNextPageHouseList(false, ++currentHouseListPage, false); } } } }); //清除 viewBinding.powerStationClearIv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currSearchText = ""; viewBinding.powerStationSearchEt.setText(""); viewBinding.historyListParent.setVisibility(View.VISIBLE); viewBinding.listParent.setVisibility(View.GONE); searchHistoryAdapter.setList(searchHistoryTitleList); clearData(); } }); //删除 viewBinding.powerStationDelIv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { searchHistoryTitleList = new ArrayList<>(); searchHistoryAdapter.setList(searchHistoryTitleList); HdlFileLogic.getInstance().deleteFile(getHistoryFileNamePath()); } }); //历史记录点击事件 searchHistoryAdapter.setOnclickListener(new SearchHistoryAdapter.OnClickListener() { @Override public void onClick(int position, String title) { viewBinding.powerStationSearchEt.setText(title); } }); //电站点击是事件 searchDeviceAdapter.setOnclickListener(new DeviceInfoAdapter.OnClickListener() { @Override public void onClick(int position, DeviceBean deviceBean) { } }); } private void initView() { viewBinding.historyListParent.setVisibility(View.VISIBLE); viewBinding.listParent.setVisibility(View.GONE); viewBinding.powerStationClearIv.setVisibility(View.GONE); //初始化历史记录适配器 searchHistoryAdapter = new SearchHistoryAdapter(_mActivity); viewBinding.historyListRcv.setLayoutManager(new LinearLayoutManager(_mActivity)); viewBinding.historyListRcv.setAdapter(searchHistoryAdapter); searchHistoryAdapter.setList(searchHistoryTitleList); //初始化电站适配器 searchDeviceAdapter = new SearchDeviceAdapter(_mActivity); viewBinding.listRcv.setLayoutManager(new LinearLayoutManager(_mActivity)); viewBinding.listRcv.setAdapter(searchDeviceAdapter); } /** * 输入电站名称进行过滤 */ private final TextWatcher textWatcher = new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { String et = viewBinding.powerStationSearchEt.getText().toString().replace(" ", ""); if (TextUtils.isEmpty(et)) { viewBinding.powerStationClearIv.setVisibility(View.GONE); } else { viewBinding.powerStationClearIv.setVisibility(View.VISIBLE); } viewBinding.powerStationSearchEt.setSelection(viewBinding.powerStationSearchEt.length()); } }; /** * 物理按键返回事件 */ @Override public void onBackPressed() { super.onBackPressed(); } @Override protected void onDestroy() { viewBinding.powerStationSearchEt.removeTextChangedListener(textWatcher); if (searchHistoryTitleList.size() > 0) { HdlFileLogic.getInstance().deleteFile(getHistoryFileNamePath()); HdlFileLogic.getInstance().appendFile(getHistoryFileNamePath(), new Gson().toJson(searchHistoryTitleList)); } super.onDestroy(); } /** * 刷新UI(设备) * * @param isRefreshing 表示是下拉刷新的 */ private void loadNextPageHouseList(boolean isRefreshing, long pageNo, boolean isClear) { //搜索关键字 if (TextUtils.isEmpty(currSearchText)) { return; } if (isClear) { clearData(); } //第一页读取数据强制读取 if (pageNo > 1 && currentHouseListPage > currentHouseListTotal) { --currentHouseListPage; //当前页不能大于总页数 return; } isHouseLoadingMore = true;//标记读取状态 if (isRefreshing) { showLoading(); } //获取云端上设备列表 HdlDeviceLogic.getInstance().getPowerStationDeviceList(currSearchText, pageNo, 20, new CloudCallBeak<PageNumberObject<DeviceBean>>() { @Override public void onSuccess(PageNumberObject<DeviceBean> deviceClass) { HdlThreadLogic.runMainThread(new Runnable() { @Override public void run() { if (isRefreshing) { hideLoading(); } isHouseLoadingMore = false; if (deviceClass != null) { currentHouseListTotal = (int) deviceClass.getTotalPage(); currentHouseListPage = (int) deviceClass.getPageNo(); //更新缓存 setDeviceList(deviceClass.getList()); if (searchDeviceAdapter != null) { initData(); //更新UI searchDeviceAdapter.setList(deviceList); } } } }, _mActivity, ShowErrorMode.YES); } @Override public void onFailure(HDLException e) { HdlThreadLogic.runMainThread(new Runnable() { @Override public void run() { if (currentHouseListPage > 1) { --currentHouseListPage; } isHouseLoadingMore = false; if (isRefreshing) { hideLoading(); } } }, _mActivity, ShowErrorMode.YES); } }); } private void clearData() { if (deviceList != null && deviceList.size() > 0) { deviceList.clear(); } } public void setDeviceList(List<DeviceBean> list) { if (list == null || list.size() == 0) { return; } if (this.deviceList.size() == 0) { this.deviceList.addAll(list); return; } for (int i = 0; i < list.size(); i++) { this.setSingleDevice(list.get(i)); } } /** * 添加设备到列表里面 * * @param deviceBean -设备对象 */ public void setSingleDevice(DeviceBean deviceBean) { try { if (deviceBean == null) { return; } boolean if_boolean = false; for (int i = 0; i < deviceList.size(); i++) { if (deviceList.get(i).getHomeId().equals(deviceBean.getHomeId())) { //存在替换 deviceList.remove(i); deviceList.add(i, deviceBean); if_boolean = true; break; } } if (!if_boolean) { //没有添加 this.deviceList.add(deviceBean); } } catch (Exception e) { String mes = e.getMessage(); HdlLogLogic.print("--->" + mes); } } /** * 添加历史记录 */ private void addSearchTextToList() { for (int i = 0; i < searchHistoryTitleList.size(); i++) { if (searchHistoryTitleList.get(i).equals(currSearchText)) { searchHistoryTitleList.remove(searchHistoryTitleList.get(i)); } } searchHistoryTitleList.add(currSearchText); // 倒序排列数据(搜索最后排在前面) Collections.reverse(searchHistoryTitleList); if (searchHistoryTitleList.size() > 10) { //历史记录不能超出10 searchHistoryTitleList.remove(searchHistoryTitleList.get(11)); } } /** * 获取【搜索历史记录文件】全路径 */ public String getHistoryFileNamePath() { return HdlFileLogic.getInstance().getCurrentUserRootPath() + "/house_device.txt"; } } app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
@@ -369,6 +369,15 @@ } } }); //设备添搜索 viewBinding.deviceSearchCl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(_mActivity, DeviceSearchActivity.class); startActivity(intent); } }); } app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseSearchActivity.java
@@ -51,7 +51,7 @@ private String currSearchText; List<String> SearchHistoryTitleList = new ArrayList<>(); List<String> searchHistoryTitleList = new ArrayList<>(); @Override public Object getContentView() { @@ -78,7 +78,7 @@ if (TextUtils.isEmpty(json)) { return; } SearchHistoryTitleList = new Gson().fromJson(json, new TypeToken<List<String>>() { searchHistoryTitleList = new Gson().fromJson(json, new TypeToken<List<String>>() { }.getType()); } catch (Exception ignored) { } @@ -153,7 +153,7 @@ viewBinding.powerStationSearchEt.setText(""); viewBinding.historyListParent.setVisibility(View.VISIBLE); viewBinding.listParent.setVisibility(View.GONE); searchHistoryAdapter.setList(SearchHistoryTitleList); searchHistoryAdapter.setList(searchHistoryTitleList); clearData(); } }); @@ -161,8 +161,8 @@ viewBinding.powerStationDelIv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SearchHistoryTitleList = new ArrayList<>(); searchHistoryAdapter.setList(SearchHistoryTitleList); searchHistoryTitleList = new ArrayList<>(); searchHistoryAdapter.setList(searchHistoryTitleList); HdlFileLogic.getInstance().deleteFile(getHistoryFileNamePath()); } }); @@ -191,7 +191,7 @@ searchHistoryAdapter = new SearchHistoryAdapter(_mActivity); viewBinding.historyListRcv.setLayoutManager(new LinearLayoutManager(_mActivity)); viewBinding.historyListRcv.setAdapter(searchHistoryAdapter); searchHistoryAdapter.setList(SearchHistoryTitleList); searchHistoryAdapter.setList(searchHistoryTitleList); //初始化电站适配器 searchHouseAdapter = new SearchHouseAdapter(_mActivity); viewBinding.listRcv.setLayoutManager(new LinearLayoutManager(_mActivity)); @@ -236,9 +236,9 @@ @Override protected void onDestroy() { viewBinding.powerStationSearchEt.removeTextChangedListener(textWatcher); if (SearchHistoryTitleList.size() > 0) { if (searchHistoryTitleList.size() > 0) { HdlFileLogic.getInstance().deleteFile(getHistoryFileNamePath()); HdlFileLogic.getInstance().appendFile(getHistoryFileNamePath(), new Gson().toJson(SearchHistoryTitleList)); HdlFileLogic.getInstance().appendFile(getHistoryFileNamePath(), new Gson().toJson(searchHistoryTitleList)); } super.onDestroy(); } @@ -368,17 +368,17 @@ * 添加历史记录 */ private void addSearchTextToList() { for (int i = 0; i < SearchHistoryTitleList.size(); i++) { if (SearchHistoryTitleList.get(i).equals(currSearchText)) { SearchHistoryTitleList.remove(SearchHistoryTitleList.get(i)); for (int i = 0; i < searchHistoryTitleList.size(); i++) { if (searchHistoryTitleList.get(i).equals(currSearchText)) { searchHistoryTitleList.remove(searchHistoryTitleList.get(i)); } } SearchHistoryTitleList.add(currSearchText); searchHistoryTitleList.add(currSearchText); // 倒序排列数据(搜索最后排在前面) Collections.reverse(SearchHistoryTitleList); if (SearchHistoryTitleList.size() > 10) { Collections.reverse(searchHistoryTitleList); if (searchHistoryTitleList.size() > 10) { //历史记录不能超出10 SearchHistoryTitleList.remove(SearchHistoryTitleList.get(11)); searchHistoryTitleList.remove(searchHistoryTitleList.get(11)); } } app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
@@ -97,8 +97,9 @@ /*********Wifi模块*********/ //卫锦定义 public final static String UNI_EVENT_REPLY_WIFI_MODEL = "uni_wifi_model";//wifi模块(大类) public final static String UNI_EVENT_REPLY_WIFI_LIST = "list";//获取wifi列表 public final static String UNI_EVENT_REPLY_WIFI_INFO = "info";//获取当前wifi信息 public final static String UNI_EVENT_REPLY_WIFI_CONNECT = "connect";//连接wifi public final static String UNI_EVENT_REPLY_WIFI_PHONE_INFO = "wifi_phone_info";//获取当前wifi信息 public final static String UNI_EVENT_REPLY_WIFI_SET_DEVICE = "wifi_set_device";//设置wifi给设备 public final static String UNI_EVENT_REPLY_OPEN_WIFI_SETTINGS = "open_wifi_settings";//调用打开手机Wifi设置界面 //endregion //region --------【原生】主动发送到【小程序】-------- @@ -135,18 +136,18 @@ public static class UniCallBackBaseBean implements Serializable { private int code;//状态码 private String mes;//信息描述 private String msg;//信息描述 private String type;//功能类型 private Object data;//附加json数据 public UniCallBackBaseBean(int code, String mes) { public UniCallBackBaseBean(int code, String msg) { this.code = code; this.mes = mes; this.msg = msg; } public UniCallBackBaseBean() { this.code = 0; this.mes = "成功"; this.msg = "成功"; } @@ -158,12 +159,12 @@ this.code = code; } public String getMes() { return mes == null ? "" : mes; public String getMsg() { return msg == null ? "" : msg; } public void setMes(String mes) { this.mes = mes; public void setMsg(String msg) { this.msg = msg; } public Object getData() { app/src/main/res/layout/activity_device_search.xml
New file @@ -0,0 +1,168 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/text_F5F7FA" tools:context=".ui.powerstation.DeviceSearchActivity"> <!--搜索--> <RelativeLayout android:id="@+id/power_station_search_cl" android:layout_width="match_parent" android:layout_height="@dimen/dp_35" android:layout_marginTop="@dimen/dp_48" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <RelativeLayout android:id="@+id/back_rl" android:layout_width="@dimen/dp_50" android:layout_height="match_parent"> <ImageView android:id="@+id/power_station_back_iv" android:layout_width="@dimen/dp_10" android:layout_height="@dimen/dp_17" android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_marginStart="@dimen/dp_16" android:src="@drawable/search_back" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginStart="@dimen/dp_7" android:layout_marginEnd="@dimen/dp_21" android:layout_toStartOf="@+id/power_station_search_tv" android:layout_toEndOf="@+id/back_rl" android:background="@drawable/search_bj_ff05000000"> <ImageView android:id="@+id/power_station_search_iv" android:layout_width="@dimen/dp_18" android:layout_height="@dimen/dp_18" android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_marginStart="@dimen/dp_13" android:src="@drawable/search_path" /> <EditText android:id="@+id/power_station_search_et" android:layout_width="0dp" android:layout_height="match_parent" android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:layout_marginStart="@dimen/dp_11" android:layout_marginEnd="@dimen/dp_40" android:layout_toEndOf="@+id/power_station_search_iv" android:background="@null" android:gravity="start|center_vertical" android:hint="Search the power station" android:textColor="@color/text_90000000" android:textColorHint="@color/text_40000000" android:textSize="@dimen/text_14" /> <ImageView android:id="@+id/power_station_clear_iv" android:layout_width="@dimen/dp_20" android:layout_height="@dimen/dp_20" android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:layout_marginEnd="@dimen/dp_13" android:src="@drawable/clear" /> </RelativeLayout> <TextView android:id="@+id/power_station_search_tv" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:layout_marginEnd="@dimen/dp_21" android:gravity="center" android:text="@string/search" android:textColor="@color/text_90000000" android:textSize="@dimen/text_16" /> </RelativeLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/history_list_parent" android:layout_width="match_parent" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/power_station_search_cl"> <TextView android:id="@+id/history_list_title_tv" android:layout_width="wrap_content" android:layout_height="@dimen/dp_23" android:layout_marginStart="@dimen/dp_16" android:layout_marginTop="@dimen/dp_23" android:layout_marginEnd="@dimen/dp_21" android:text="@string/history_search" android:textColor="@color/text_90000000" android:textSize="@dimen/text_16" android:textStyle="bold" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/power_station_del_iv" android:layout_width="@dimen/dp_26" android:layout_height="@dimen/dp_26" android:layout_marginTop="@dimen/dp_21" android:layout_marginEnd="@dimen/dp_16" android:src="@drawable/history_del" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> <androidx.recyclerview.widget.RecyclerView android:id="@+id/history_list_rcv" android:layout_width="match_parent" android:layout_height="0dp" android:layout_marginTop="67dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/list_parent" android:layout_width="match_parent" android:layout_height="0dp" android:layout_marginTop="@dimen/dp_30" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/power_station_search_cl"> <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/list_srl" android:layout_width="match_parent" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/list_rcv" android:layout_width="match_parent" android:layout_height="match_parent" /> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>