style: rename

This commit is contained in:
AnranYus
2023-10-19 17:14:29 +08:00
parent d2c903ca41
commit bbd4c3b7d1
6 changed files with 14 additions and 16 deletions
@@ -25,7 +25,7 @@ import com.lsp.view.activity.BaseActivity
import com.lsp.view.activity.favtag.FavTagActivity
import com.lsp.view.activity.model.MainActivityModelImpl
import com.lsp.view.activity.setting.SettingsActivity
import com.lsp.view.bean.Post_yand
import com.lsp.view.bean.YandPost
import com.lsp.view.util.CallBackStatus
@@ -303,10 +303,10 @@ class MainActivity : BaseActivity() {
CallBackStatus.OK.ordinal -> {
if (type == ISREFRESH )
//刷新数据
adapter.refreshData(msg.obj as ArrayList<Post_yand>)
adapter.refreshData(msg.obj as ArrayList<YandPost>)
else if (type == ISADDDATA)
//加载数据
adapter.addData(msg.obj as ArrayList<Post_yand>)
adapter.addData(msg.obj as ArrayList<YandPost>)
}
CallBackStatus.NETWORKERROR.ordinal -> {
@@ -12,10 +12,10 @@ import com.bumptech.glide.load.model.GlideUrl
import com.bumptech.glide.load.model.LazyHeaders
import com.lsp.view.R
import com.lsp.view.activity.pic.PicActivity
import com.lsp.view.bean.Post_yand
import com.lsp.view.bean.YandPost
class PostAdapter(val context: Context, private var postYandList: ArrayList<Post_yand>) :
class PostAdapter(val context: Context, private var postYandList: ArrayList<YandPost>) :
RecyclerView.Adapter<PostAdapter.ViewHolder>() {
val TAG = this::class.java.simpleName
private val UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"
@@ -26,13 +26,13 @@ class PostAdapter(val context: Context, private var postYandList: ArrayList<Post
}
fun addData(list: ArrayList<Post_yand>) {
fun addData(list: ArrayList<YandPost>) {
val pos = postYandList.size
postYandList.addAll(list)
notifyItemRangeInserted(pos, list.size)
}
fun refreshData(list: ArrayList<Post_yand>) {
fun refreshData(list: ArrayList<YandPost>) {
val oldSize = postYandList.size
postYandList.clear()
@@ -3,7 +3,7 @@ package com.lsp.view.activity.model
import android.os.Handler
import com.lsp.view.retrofit.PostService
import com.lsp.view.retrofit.ServiceCreator
import com.lsp.view.bean.Post_yand
import com.lsp.view.bean.YandPost
import retrofit2.Call
import kotlin.collections.ArrayList
@@ -11,7 +11,7 @@ class MainActivityModelImpl :MainActivityModel, BaseModel() {
private val TAG = this::class.java.simpleName
override fun requestPostList(handler: Handler, source: String, tage: String?, page: Int,safeMode: Boolean){
val postService: PostService = ServiceCreator.create(source)
val service: Call<ArrayList<Post_yand>> = postService.getPostData("100",tage, page)
val service: Call<ArrayList<YandPost>> = postService.getPostData("100",tage, page)
request(service,safeMode, handler)
}
@@ -37,7 +37,6 @@ import kotlin.properties.Delegates
class PicActivity : BaseActivity() {
private val tagList = ArrayList<Tags>()
private val idList = ArrayList<ID>()
private val sizeList = ArrayList<Size>()
private lateinit var image: ImageView
@@ -200,9 +199,7 @@ class PicActivity : BaseActivity() {
target: Target<Drawable?>?,
isFirstResource: Boolean
): Boolean {
if (e != null) {
e.printStackTrace()
}
e?.printStackTrace()
val back = findViewById<ImageView>(R.id.back)
Snackbar.make(back, R.string.toast_load_fail, Snackbar.LENGTH_LONG).setAction(R.string.button_check) {
AlertDialog.Builder(this@PicActivity).apply {
@@ -251,6 +248,7 @@ class PicActivity : BaseActivity() {
//设置tags列表
//这写的很烂 得改
private fun loadTags(tags: String, type: String) {
val tagList = ArrayList<Tags>()
when (type) {
"tags" -> {
@@ -1,6 +1,6 @@
package com.lsp.view.bean
class Post_yand(
class YandPost(
val preview_url: String,
val file_url: String,
val sample_url: String,
@@ -1,6 +1,6 @@
package com.lsp.view.retrofit
import com.lsp.view.bean.Post_yand
import com.lsp.view.bean.YandPost
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.Query
@@ -11,5 +11,5 @@ interface PostService {
@Query("limit") limit: String,
@Query("tags") tags: String?,
@Query("page") page: Int
): Call<ArrayList<Post_yand>>
): Call<ArrayList<YandPost>>
}