chore: Dev 6 发布
This commit is contained in:
parent
a4046ea98d
commit
877d1e4aa3
|
|
@ -80,6 +80,21 @@ interface ITiebaApi {
|
|||
goodClassifyId: String? = null
|
||||
): Call<ForumPageBean>
|
||||
|
||||
/**
|
||||
* 吧页面(异步)
|
||||
*
|
||||
* @param forumName 吧名
|
||||
* @param page 分页页码(从 1 开始)
|
||||
* @param sortType 排序类型 [com.huanchengfly.tieba.api.ForumSortType]
|
||||
* @param goodClassifyId 精品贴分类 ID
|
||||
*/
|
||||
fun forumPageAsync(
|
||||
forumName: String,
|
||||
page: Int = 1,
|
||||
sortType: ForumSortType = ForumSortType.REPLY_TIME,
|
||||
goodClassifyId: String? = null
|
||||
): Deferred<ApiResult<ForumPageBean>>
|
||||
|
||||
/**
|
||||
* 楼中楼页面
|
||||
*
|
||||
|
|
|
|||
|
|
@ -50,6 +50,19 @@ object MixedTiebaApiImpl : ITiebaApi {
|
|||
): Call<ForumPageBean> =
|
||||
RetrofitTiebaApi.MINI_TIEBA_API.forumPage(forumName, page, sortType.value, goodClassifyId)
|
||||
|
||||
override fun forumPageAsync(
|
||||
forumName: String,
|
||||
page: Int,
|
||||
sortType: ForumSortType,
|
||||
goodClassifyId: String?
|
||||
): Deferred<ApiResult<ForumPageBean>> =
|
||||
RetrofitTiebaApi.MINI_TIEBA_API.forumPageAsync(
|
||||
forumName,
|
||||
page,
|
||||
sortType.value,
|
||||
goodClassifyId
|
||||
)
|
||||
|
||||
override fun floor(
|
||||
threadId: String, page: Int, postId: String?, subPostId: String?
|
||||
): Call<SubFloorListBean> =
|
||||
|
|
|
|||
|
|
@ -115,6 +115,23 @@ interface MiniTiebaApi {
|
|||
@Field("scr_w") scr_w: String = getScreenWidth().toString()
|
||||
): Call<ForumPageBean>
|
||||
|
||||
@POST("/c/f/frs/page")
|
||||
@FormUrlEncoded
|
||||
fun forumPageAsync(
|
||||
@Field("kw") forumName: String,
|
||||
@Field("pn") page: Int = 1,
|
||||
@Field("sort_type") sort_type: Int,
|
||||
@Field("cid") goodClassifyId: String? = null,
|
||||
@Field("is_good") is_good: String? = if (TextUtils.isEmpty(goodClassifyId)) null else "1",
|
||||
@Field("q_type") q_type: String = "2",
|
||||
@Field("st_type") st_type: String = "tb_forumlist",
|
||||
@Field("with_group") with_group: String = "0",
|
||||
@Field("rn") rn: String = "20",
|
||||
@Field("scr_dip") scr_dip: String = ScreenInfo.DENSITY.toString(),
|
||||
@Field("scr_h") scr_h: String = getScreenHeight().toString(),
|
||||
@Field("scr_w") scr_w: String = getScreenWidth().toString()
|
||||
): Deferred<ApiResult<ForumPageBean>>
|
||||
|
||||
@POST("/c/f/pb/floor")
|
||||
@FormUrlEncoded
|
||||
fun floor(
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ import com.huanchengfly.tieba.post.api.ForumSortType
|
|||
import com.huanchengfly.tieba.post.api.ForumSortType.Companion.valueOf
|
||||
import com.huanchengfly.tieba.post.api.TiebaApi
|
||||
import com.huanchengfly.tieba.post.api.models.ForumPageBean
|
||||
import com.huanchengfly.tieba.post.api.retrofit.doIfFailure
|
||||
import com.huanchengfly.tieba.post.api.retrofit.doIfSuccess
|
||||
import com.huanchengfly.tieba.post.api.retrofit.exception.TiebaException
|
||||
import com.huanchengfly.tieba.post.components.dividers.ForumDivider
|
||||
import com.huanchengfly.tieba.post.interfaces.OnSwitchListener
|
||||
|
|
@ -172,25 +174,21 @@ class ForumFragment : BaseFragment(), Refreshable, OnSwitchListener, ScrollTopab
|
|||
}
|
||||
|
||||
private fun loadMore() {
|
||||
TiebaApi.getInstance().forumPage(forumName!!, page + 1, sortType, classifyId)
|
||||
.enqueue(object : Callback<ForumPageBean> {
|
||||
override fun onFailure(call: Call<ForumPageBean>, t: Throwable) {
|
||||
launchIO {
|
||||
TiebaApi.getInstance()
|
||||
.forumPageAsync(forumName!!, page + 1, sortType, classifyId)
|
||||
.doIfSuccess {
|
||||
page += 1
|
||||
mRefreshLayout.finishLoadMore()
|
||||
mDataBean = it
|
||||
pageSize = it.page?.pageSize?.toInt() ?: 0
|
||||
forumAdapter.addData(it)
|
||||
mRefreshLayout.setNoMoreData(it.page?.hasMore == "0")
|
||||
}
|
||||
.doIfFailure {
|
||||
mRefreshLayout.finishLoadMore(false)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<ForumPageBean>,
|
||||
response: Response<ForumPageBean>
|
||||
) {
|
||||
page += 1
|
||||
val forumPageBean = response.body()!!
|
||||
mRefreshLayout.finishLoadMore()
|
||||
mDataBean = forumPageBean
|
||||
pageSize = forumPageBean.page?.pageSize?.toInt()!!
|
||||
forumAdapter.addData(forumPageBean)
|
||||
mRefreshLayout.setNoMoreData(mDataBean!!.page?.hasMore == "0")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun refresh() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
versionCode=38300
|
||||
versionCode=39006
|
||||
versionName=4.0.0
|
||||
isPerRelease=true
|
||||
preReleaseName=dev
|
||||
preReleaseVer=5
|
||||
preReleaseVer=6
|
||||
Loading…
Reference in New Issue