pref: 令 POJO 不可变
This commit is contained in:
parent
144439e27c
commit
ac5168a2ea
|
|
@ -49,6 +49,7 @@ import com.huanchengfly.tieba.post.interfaces.CommonCallback
|
||||||
import com.huanchengfly.tieba.post.models.ReplyInfoBean
|
import com.huanchengfly.tieba.post.models.ReplyInfoBean
|
||||||
import com.huanchengfly.tieba.post.models.ThreadHistoryInfoBean
|
import com.huanchengfly.tieba.post.models.ThreadHistoryInfoBean
|
||||||
import com.huanchengfly.tieba.post.models.database.History
|
import com.huanchengfly.tieba.post.models.database.History
|
||||||
|
import com.huanchengfly.tieba.post.toJson
|
||||||
import com.huanchengfly.tieba.post.toastShort
|
import com.huanchengfly.tieba.post.toastShort
|
||||||
import com.huanchengfly.tieba.post.ui.common.theme.utils.ThemeUtils
|
import com.huanchengfly.tieba.post.ui.common.theme.utils.ThemeUtils
|
||||||
import com.huanchengfly.tieba.post.ui.widgets.VideoPlayerStandard
|
import com.huanchengfly.tieba.post.ui.widgets.VideoPlayerStandard
|
||||||
|
|
@ -488,15 +489,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener, IThreadMenuFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getItemByPosition(itemPosition: Int): PostListItemBean? {
|
private fun getItemPositionByPid(pid: String): Int {
|
||||||
return if (itemPosition == 0) {
|
|
||||||
threadMainPostAdapter.threadPostBean
|
|
||||||
} else {
|
|
||||||
replyAdapter.getItem(itemPosition - 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getItemPositionByPid(pid: String): Int {
|
|
||||||
val threadPostId = threadMainPostAdapter.threadBean.postId
|
val threadPostId = threadMainPostAdapter.threadBean.postId
|
||||||
return if (threadPostId == pid) {
|
return if (threadPostId == pid) {
|
||||||
0
|
0
|
||||||
|
|
@ -659,10 +652,10 @@ class ThreadActivity : BaseActivity(), View.OnClickListener, IThreadMenuFragment
|
||||||
}
|
}
|
||||||
var extras = ""
|
var extras = ""
|
||||||
if (postListItemBean != null) {
|
if (postListItemBean != null) {
|
||||||
extras = ThreadHistoryInfoBean()
|
extras = ThreadHistoryInfoBean(
|
||||||
.setPid(postListItemBean.id)
|
pid = postListItemBean.id,
|
||||||
.setSeeLz(seeLz)
|
isSeeLz = seeLz
|
||||||
.toString()
|
).toJson()
|
||||||
}
|
}
|
||||||
val history = History(
|
val history = History(
|
||||||
title = dataBean!!.thread?.title ?: "",
|
title = dataBean!!.thread?.title ?: "",
|
||||||
|
|
|
||||||
|
|
@ -400,8 +400,8 @@ object MixedTiebaApiImpl : ITiebaApi {
|
||||||
RetrofitTiebaApi.NEW_TIEBA_API.addStore(
|
RetrofitTiebaApi.NEW_TIEBA_API.addStore(
|
||||||
listOf(
|
listOf(
|
||||||
CollectDataBean(
|
CollectDataBean(
|
||||||
postId,
|
|
||||||
threadId,
|
threadId,
|
||||||
|
postId,
|
||||||
"0",
|
"0",
|
||||||
"0"
|
"0"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -2,29 +2,13 @@ package com.huanchengfly.tieba.post.api.models
|
||||||
|
|
||||||
import com.huanchengfly.tieba.post.utils.GsonUtil
|
import com.huanchengfly.tieba.post.utils.GsonUtil
|
||||||
|
|
||||||
class CollectDataBean(var pid: String, var tid: String, var status: String, var type: String) {
|
data class CollectDataBean(
|
||||||
fun setPid(pid: String): CollectDataBean {
|
val pid: String,
|
||||||
this.pid = pid
|
val tid: String,
|
||||||
return this
|
val status: String,
|
||||||
}
|
val type: String? = null
|
||||||
|
) {
|
||||||
fun setStatus(status: String): CollectDataBean {
|
|
||||||
this.status = status
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setTid(tid: String): CollectDataBean {
|
|
||||||
this.tid = tid
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setType(type: String): CollectDataBean {
|
|
||||||
this.type = type
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return GsonUtil.getGson().toJson(this)
|
return GsonUtil.getGson().toJson(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -7,8 +7,8 @@ import com.huanchengfly.tieba.post.models.BaseBean
|
||||||
|
|
||||||
data class CommonResponse(
|
data class CommonResponse(
|
||||||
@SerializedName("error_code", alternate = ["errno", "no"])
|
@SerializedName("error_code", alternate = ["errno", "no"])
|
||||||
var errorCode: Int?,
|
val errorCode: Int = 0,
|
||||||
@JsonAdapter(ErrorMsgAdapter::class)
|
@JsonAdapter(ErrorMsgAdapter::class)
|
||||||
@SerializedName("error_msg", alternate = ["errmsg", "error"])
|
@SerializedName("error_msg", alternate = ["errmsg", "error"])
|
||||||
var errorMsg: String?
|
val errorMsg: String = ""
|
||||||
) : BaseBean()
|
) : BaseBean()
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
package com.huanchengfly.tieba.post.models;
|
|
||||||
|
|
||||||
public class ThreadHistoryInfoBean extends BaseBean {
|
|
||||||
private boolean seeLz;
|
|
||||||
private String pid;
|
|
||||||
private String forumName;
|
|
||||||
private String floor;
|
|
||||||
|
|
||||||
public String getForumName() {
|
|
||||||
return forumName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ThreadHistoryInfoBean setForumName(String forumName) {
|
|
||||||
this.forumName = forumName;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFloor() {
|
|
||||||
return floor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ThreadHistoryInfoBean setFloor(String floor) {
|
|
||||||
this.floor = floor;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSeeLz() {
|
|
||||||
return seeLz;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ThreadHistoryInfoBean setSeeLz(boolean seeLz) {
|
|
||||||
this.seeLz = seeLz;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPid() {
|
|
||||||
return pid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ThreadHistoryInfoBean setPid(String pid) {
|
|
||||||
this.pid = pid;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.huanchengfly.tieba.post.models
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ThreadHistoryInfoBean(
|
||||||
|
val isSeeLz: Boolean = false,
|
||||||
|
val pid: String? = null,
|
||||||
|
val forumName: String? = null,
|
||||||
|
val floor: String? = null,
|
||||||
|
) : BaseBean()
|
||||||
Loading…
Reference in New Issue