|
|
|
@ -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,8 +212,12 @@ class WeatherHistoryActivity : BaseActivityOaToolbarViewBinding<ActivityWeatherH
|
|
|
|
val result = response?.get()
|
|
|
|
val result = response?.get()
|
|
|
|
showLog("----------------")
|
|
|
|
showLog("----------------")
|
|
|
|
showLog(result)
|
|
|
|
showLog(result)
|
|
|
|
|
|
|
|
val jsonDecode = RSAUtils.decryptBASE64StrClient(result)
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(jsonDecode)) {
|
|
|
|
|
|
|
|
showToast(UiUtlis.getString(context, R.string.data_error))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
val bean = GsonUtils.GsonToBean(
|
|
|
|
val bean = GsonUtils.GsonToBean(
|
|
|
|
result,
|
|
|
|
jsonDecode,
|
|
|
|
WeatherHistoryBean::class.java
|
|
|
|
WeatherHistoryBean::class.java
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if (bean != null && bean.code == 1 && bean.data != null && bean.data.size > 0) {
|
|
|
|
if (bean != null && bean.code == 1 && bean.data != null && bean.data.size > 0) {
|
|
|
|
@ -224,6 +232,7 @@ class WeatherHistoryActivity : BaseActivityOaToolbarViewBinding<ActivityWeatherH
|
|
|
|
binding.lv.visibility = View.GONE
|
|
|
|
binding.lv.visibility = View.GONE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
override fun onFailed(what: Int, response: Response<String?>?) {
|
|
|
|
override fun onFailed(what: Int, response: Response<String?>?) {
|
|
|
|
|
|
|
|
|
|
|
|
@ -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,8 +286,13 @@ class WeatherHistoryActivity : BaseActivityOaToolbarViewBinding<ActivityWeatherH
|
|
|
|
val result = response?.get()
|
|
|
|
val result = response?.get()
|
|
|
|
showLog("----------------")
|
|
|
|
showLog("----------------")
|
|
|
|
showLog(result)
|
|
|
|
showLog(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val jsonDecode = RSAUtils.decryptBASE64StrClient(result)
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(jsonDecode)) {
|
|
|
|
|
|
|
|
showToast(UiUtlis.getString(context, R.string.data_error))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
val bean = GsonUtils.GsonToBean(
|
|
|
|
val bean = GsonUtils.GsonToBean(
|
|
|
|
result,
|
|
|
|
jsonDecode,
|
|
|
|
WeatherHistoryBean::class.java
|
|
|
|
WeatherHistoryBean::class.java
|
|
|
|
)
|
|
|
|
)
|
|
|
|
binding.lv.loadComplete()
|
|
|
|
binding.lv.loadComplete()
|
|
|
|
@ -290,6 +304,7 @@ class WeatherHistoryActivity : BaseActivityOaToolbarViewBinding<ActivityWeatherH
|
|
|
|
showToast("没有更多数据啦")
|
|
|
|
showToast("没有更多数据啦")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
override fun onFailed(what: Int, response: Response<String?>?) {
|
|
|
|
override fun onFailed(what: Int, response: Response<String?>?) {
|
|
|
|
binding.lv.loadComplete()
|
|
|
|
binding.lv.loadComplete()
|
|
|
|
|