| | |
| | | if (payload == null || payload.length == 0) { |
| | | if (baseCallBack != null) { |
| | | baseCallBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_NULL_ERROR)); |
| | | System.out.println("发送数据时负载数据时空的--->"); |
| | | System.out.println("发送数据时负载数据是空的--->"); |
| | | } |
| | | return; |
| | | } |
| | |
| | | public void editGatewayTime(String mac, String date, String time, String timezone, LinkCallBack<Boolean> linkCallBack) { |
| | | String requestUrl = TopicApi.SET_GATEWAY_TIME_EDIT; |
| | | JsonObject json = new JsonObject(); |
| | | if (!TextUtils.isEmpty(date)) { |
| | | json.addProperty("date", date);// "2020-08-15" |
| | | } |
| | | if (!TextUtils.isEmpty(time)) { |
| | | json.addProperty("time", time);//"17:25:20" |
| | | } |
| | | if (!TextUtils.isEmpty(timezone)) { |
| | | json.addProperty("timezone", timezone);//时区(语雀https://hdl-gz.yuque.com/wnkbmh/cdrglh/yckkyp#qWOPS) |
| | | } |
| | | |
| | | TcpClient.getInstance().sendDataToLinkGateway(mac, requestUrl, json, "", new HDLLinkCallBack() { |
| | | @Override |
| | |
| | | d.flush(); |
| | | d.close(); |
| | | if (file.length() > 1024 * 1024 * mDataSize) { |
| | | //文件大于1m,删除文件前10条日志 |
| | | this.delFileLien(fullPath, 10); |
| | | //文件大于1m,删除文件前20条日志 |
| | | this.delFileLien(fullPath, 20); |
| | | } |
| | | System.out.println("写入一行数据到文件成功--->" + dataLine); |
| | | } catch (Exception e) { |
| | |
| | | if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { |
| | | jsonObject.addProperty("result", -1);//没开启定位功能 |
| | | jsonObject.addProperty("des", "没开启定位功能"); |
| | | //提示用户打开定位功能或者引导用户去系统设置页面打开定位功能 |
| | | //todo 提示用户打开定位功能或者引导用户去系统设置页面打开定位功能 |
| | | uniCallbackData(jsonObject.toString(), callback); |
| | | return; |
| | | } |
| | |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.text.TextUtils; |
| | | import android.view.MotionEvent; |
| | | import android.view.View; |
| | | import android.widget.TextView; |
| | | |
| | |
| | | |
| | | } |
| | | }); |
| | | |
| | | viewBinding.messageNascentRecyclerview.addOnScrollListener(new RecyclerView.OnScrollListener() { |
| | | @Override |
| | | public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { |
| | | super.onScrolled(recyclerView, dx, dy); |
| | | |
| | | // int totalItemCount = layoutManager.getItemCount(); |
| | | // int lastVisibleItemPosition = layoutManager.findLastVisibleItemPosition(); |
| | | // |
| | | // if (!isLoadingMore && totalItemCount <= (lastVisibleItemPosition + visibleThreshold)) { |
| | | if (dy <= 0) { |
| | | //等于0是顶部 |
| | | return; |
| | | } |
| | | LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); |
| | | assert layoutManager != null; |
| | | // 只有垂直布局才会触发上拉事件 |
| | | if (!layoutManager.canScrollVertically()) { |
| | | return; |
| | | } |
| | | |
| | | int totalItemCount = layoutManager.getItemCount(); |
| | | int lastVisibleItemPosition = layoutManager.findLastVisibleItemPosition(); |
| | | |
| | | if (!isLoadingMore && totalItemCount <= (lastVisibleItemPosition + visibleThreshold)) { |
| | | // loadNextPage(); |
| | | // } |
| | | } |
| | | } |
| | | }); |
| | | } |