|
|
|
@ -3,8 +3,10 @@ package com.rehome.zhdcoa.ui.activity
|
|
|
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
|
|
import android.annotation.SuppressLint
|
|
|
|
import android.content.Intent
|
|
|
|
import android.content.Intent
|
|
|
|
|
|
|
|
import android.text.TextUtils
|
|
|
|
import android.view.View
|
|
|
|
import android.view.View
|
|
|
|
import com.rehome.zhdcoa.Contans
|
|
|
|
import com.rehome.zhdcoa.Contans
|
|
|
|
|
|
|
|
import com.rehome.zhdcoa.R
|
|
|
|
import com.rehome.zhdcoa.adapter.WeatherHistoryAdapter
|
|
|
|
import com.rehome.zhdcoa.adapter.WeatherHistoryAdapter
|
|
|
|
import com.rehome.zhdcoa.base.BaseActivityOaToolbarViewBinding
|
|
|
|
import com.rehome.zhdcoa.base.BaseActivityOaToolbarViewBinding
|
|
|
|
import com.rehome.zhdcoa.bean.WeatherHistoryBean
|
|
|
|
import com.rehome.zhdcoa.bean.WeatherHistoryBean
|
|
|
|
@ -13,6 +15,8 @@ import com.rehome.zhdcoa.databinding.ActivityWeatherHistoryBinding
|
|
|
|
import com.rehome.zhdcoa.utils.GsonUtils
|
|
|
|
import com.rehome.zhdcoa.utils.GsonUtils
|
|
|
|
import com.rehome.zhdcoa.utils.HttpListener
|
|
|
|
import com.rehome.zhdcoa.utils.HttpListener
|
|
|
|
import com.rehome.zhdcoa.utils.NohttpUtils
|
|
|
|
import com.rehome.zhdcoa.utils.NohttpUtils
|
|
|
|
|
|
|
|
import com.rehome.zhdcoa.utils.RSAUtils
|
|
|
|
|
|
|
|
import com.rehome.zhdcoa.utils.UiUtlis
|
|
|
|
import com.rehome.zhdcoa.weiget.DateTimeMinutePickDialog
|
|
|
|
import com.rehome.zhdcoa.weiget.DateTimeMinutePickDialog
|
|
|
|
import com.rehome.zhdcoa.weiget.LoadListView
|
|
|
|
import com.rehome.zhdcoa.weiget.LoadListView
|
|
|
|
import com.yolanda.nohttp.NoHttp
|
|
|
|
import com.yolanda.nohttp.NoHttp
|
|
|
|
@ -164,7 +168,7 @@ class WeatherHistoryActivity : BaseActivityOaToolbarViewBinding<ActivityWeatherH
|
|
|
|
|
|
|
|
|
|
|
|
private fun requestData(st: String, et: String) {
|
|
|
|
private fun requestData(st: String, et: String) {
|
|
|
|
val request = NoHttp.createStringRequest(
|
|
|
|
val request = NoHttp.createStringRequest(
|
|
|
|
Contans.BASE_URL + Contans.GET_WEATHER_HISTORY_DATA,
|
|
|
|
Contans.BASE_URL + Contans.GET_WEATHER_HISTORY_DATA_RSA,
|
|
|
|
RequestMethod.GET
|
|
|
|
RequestMethod.GET
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@ -208,20 +212,25 @@ class WeatherHistoryActivity : BaseActivityOaToolbarViewBinding<ActivityWeatherH
|
|
|
|
val result = response?.get()
|
|
|
|
val result = response?.get()
|
|
|
|
showLog("----------------")
|
|
|
|
showLog("----------------")
|
|
|
|
showLog(result)
|
|
|
|
showLog(result)
|
|
|
|
val bean = GsonUtils.GsonToBean(
|
|
|
|
val jsonDecode = RSAUtils.decryptBASE64StrClient(result)
|
|
|
|
result,
|
|
|
|
if (TextUtils.isEmpty(jsonDecode)) {
|
|
|
|
WeatherHistoryBean::class.java
|
|
|
|
showToast(UiUtlis.getString(context, R.string.data_error))
|
|
|
|
)
|
|
|
|
|
|
|
|
if (bean != null && bean.code == 1 && bean.data != null && bean.data.size > 0) {
|
|
|
|
|
|
|
|
binding.tvNodata.visibility = View.GONE
|
|
|
|
|
|
|
|
binding.lv.visibility = View.VISIBLE
|
|
|
|
|
|
|
|
datas.clear()
|
|
|
|
|
|
|
|
datas.addAll(bean.data)
|
|
|
|
|
|
|
|
mAdapter.notifyDataSetChanged()
|
|
|
|
|
|
|
|
page++
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
binding.tvNodata.visibility = View.VISIBLE
|
|
|
|
val bean = GsonUtils.GsonToBean(
|
|
|
|
binding.lv.visibility = View.GONE
|
|
|
|
jsonDecode,
|
|
|
|
|
|
|
|
WeatherHistoryBean::class.java
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
if (bean != null && bean.code == 1 && bean.data != null && bean.data.size > 0) {
|
|
|
|
|
|
|
|
binding.tvNodata.visibility = View.GONE
|
|
|
|
|
|
|
|
binding.lv.visibility = View.VISIBLE
|
|
|
|
|
|
|
|
datas.clear()
|
|
|
|
|
|
|
|
datas.addAll(bean.data)
|
|
|
|
|
|
|
|
mAdapter.notifyDataSetChanged()
|
|
|
|
|
|
|
|
page++
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
binding.tvNodata.visibility = View.VISIBLE
|
|
|
|
|
|
|
|
binding.lv.visibility = View.GONE
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -233,7 +242,7 @@ class WeatherHistoryActivity : BaseActivityOaToolbarViewBinding<ActivityWeatherH
|
|
|
|
|
|
|
|
|
|
|
|
private fun requestLoadMoreData(st: String, et: String) {
|
|
|
|
private fun requestLoadMoreData(st: String, et: String) {
|
|
|
|
val request = NoHttp.createStringRequest(
|
|
|
|
val request = NoHttp.createStringRequest(
|
|
|
|
Contans.BASE_URL + Contans.GET_WEATHER_HISTORY_DATA,
|
|
|
|
Contans.BASE_URL + Contans.GET_WEATHER_HISTORY_DATA_RSA,
|
|
|
|
RequestMethod.GET
|
|
|
|
RequestMethod.GET
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@ -277,17 +286,23 @@ class WeatherHistoryActivity : BaseActivityOaToolbarViewBinding<ActivityWeatherH
|
|
|
|
val result = response?.get()
|
|
|
|
val result = response?.get()
|
|
|
|
showLog("----------------")
|
|
|
|
showLog("----------------")
|
|
|
|
showLog(result)
|
|
|
|
showLog(result)
|
|
|
|
val bean = GsonUtils.GsonToBean(
|
|
|
|
|
|
|
|
result,
|
|
|
|
val jsonDecode = RSAUtils.decryptBASE64StrClient(result)
|
|
|
|
WeatherHistoryBean::class.java
|
|
|
|
if (TextUtils.isEmpty(jsonDecode)) {
|
|
|
|
)
|
|
|
|
showToast(UiUtlis.getString(context, R.string.data_error))
|
|
|
|
binding.lv.loadComplete()
|
|
|
|
} else {
|
|
|
|
if (bean != null && bean.code == 1 && bean.data != null && bean.data.size > 0) {
|
|
|
|
val bean = GsonUtils.GsonToBean(
|
|
|
|
datas.addAll(bean.data)
|
|
|
|
jsonDecode,
|
|
|
|
mAdapter.notifyDataSetChanged()
|
|
|
|
WeatherHistoryBean::class.java
|
|
|
|
page++
|
|
|
|
)
|
|
|
|
}else{
|
|
|
|
binding.lv.loadComplete()
|
|
|
|
showToast("没有更多数据啦")
|
|
|
|
if (bean != null && bean.code == 1 && bean.data != null && bean.data.size > 0) {
|
|
|
|
|
|
|
|
datas.addAll(bean.data)
|
|
|
|
|
|
|
|
mAdapter.notifyDataSetChanged()
|
|
|
|
|
|
|
|
page++
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
showToast("没有更多数据啦")
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|