diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d17be9a4..f5342ac4 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -227,6 +227,10 @@
android:name="com.xiaoyv.bangumi.ui.feature.setting.robot.RobotConfigActivity"
android:configChanges="orientation|keyboard|screenSize"
android:exported="false" />
+
\ No newline at end of file
diff --git a/app/src/main/java/com/xiaoyv/bangumi/helper/RouteHelper.kt b/app/src/main/java/com/xiaoyv/bangumi/helper/RouteHelper.kt
index 248ed4e9..5a2934cc 100644
--- a/app/src/main/java/com/xiaoyv/bangumi/helper/RouteHelper.kt
+++ b/app/src/main/java/com/xiaoyv/bangumi/helper/RouteHelper.kt
@@ -37,6 +37,7 @@ import com.xiaoyv.bangumi.ui.feature.summary.SummaryActivity
import com.xiaoyv.bangumi.ui.feature.tag.TagDetailActivity
import com.xiaoyv.bangumi.ui.feature.topic.TopicActivity
import com.xiaoyv.bangumi.ui.feature.user.UserActivity
+import com.xiaoyv.bangumi.ui.feature.user.blog.UserBlogActivity
import com.xiaoyv.bangumi.ui.feature.web.WebActivity
import com.xiaoyv.bangumi.ui.media.detail.MediaDetailActivity
import com.xiaoyv.bangumi.ui.profile.edit.EditProfileActivity
@@ -52,6 +53,7 @@ import com.xiaoyv.common.config.bean.SearchItem
import com.xiaoyv.common.helper.CacheHelper
import com.xiaoyv.common.kts.debugLog
import com.xiaoyv.common.kts.decodeUrl
+import com.xiaoyv.widget.kts.showToastCompat
/**
* Class: [RouteHelper]
@@ -226,6 +228,13 @@ object RouteHelper {
)
}
+ fun jumpUserBlog(userId: String) {
+ ActivityUtils.startActivity(
+ bundleOf(NavKey.KEY_STRING to userId),
+ UserBlogActivity::class.java
+ )
+ }
+
fun jumpPostTopic(postAttach: PostAttach? = null) {
ActivityUtils.startActivity(
bundleOf(NavKey.KEY_PARCELABLE to postAttach),
@@ -270,8 +279,18 @@ object RouteHelper {
IndexDetailActivity::class.open(bundleOf(NavKey.KEY_STRING to id))
}
- fun jumpIndexList(isSortByNewest: Boolean) {
- IndexListActivity::class.open(bundleOf(NavKey.KEY_BOOLEAN to isSortByNewest))
+ /**
+ * 目录列表查询,没有指定用户则查询全部目录
+ *
+ * @param targetUserId 如果指定了用户ID,[isSortByNewest] 则表示是否查询用户创建的目录,否则查询收藏的目录
+ */
+ fun jumpIndexList(isSortByNewest: Boolean, targetUserId: String? = null) {
+ IndexListActivity::class.open(
+ bundleOf(
+ NavKey.KEY_BOOLEAN to isSortByNewest,
+ NavKey.KEY_STRING to targetUserId
+ )
+ )
}
fun jumpGroupList() {
@@ -393,7 +412,7 @@ object RouteHelper {
}
fun jumpSendMessage(userId: String) {
-
+ showToastCompat("正在开发中...")
}
/**
diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/discover/blog/BlogViewModel.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/discover/blog/BlogViewModel.kt
index 50792b01..ad29deec 100644
--- a/app/src/main/java/com/xiaoyv/bangumi/ui/discover/blog/BlogViewModel.kt
+++ b/app/src/main/java/com/xiaoyv/bangumi/ui/discover/blog/BlogViewModel.kt
@@ -1,14 +1,11 @@
package com.xiaoyv.bangumi.ui.discover.blog
-import com.blankj.utilcode.util.StringUtils
import com.xiaoyv.bangumi.base.BaseListViewModel
-import com.xiaoyv.blueprint.kts.launchUI
import com.xiaoyv.common.api.BgmApiManager
import com.xiaoyv.common.api.parser.entity.BlogEntity
import com.xiaoyv.common.api.parser.impl.parserBlogList
import com.xiaoyv.common.config.annotation.MediaType
import com.xiaoyv.common.helper.UserHelper
-import com.xiaoyv.common.kts.CommonString
/**
* Class: [BlogViewModel]
@@ -48,30 +45,8 @@ class BlogViewModel : BaseListViewModel() {
require(UserHelper.isLogin) { "你还没有登录呢" }
}
- return BgmApiManager.bgmWebApi.queryBlogList(
- queryPath = queryPath,
- tagPath = tagPath,
- page = current
- ).parserBlogList(userId.isNotBlank()).apply {
- // 刷新时,检测是否为空数据
- if (isRefresh) require(isNotEmpty()) {
- StringUtils.getString(CommonString.common_empty_tip)
- }
- }
- }
-
- private fun queryBlogList() {
- launchUI(
- stateView = loadingViewState,
- error = {
- it.printStackTrace()
- if (isRefresh) onListLiveData.value = null
- else current--
- },
- block = {
-
- }
- )
+ return BgmApiManager.bgmWebApi.queryBlogList(queryPath, tagPath, current)
+ .parserBlogList(userId.isNotBlank(), isMine)
}
/**
diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/discover/index/list/IndexListActivity.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/discover/index/list/IndexListActivity.kt
index 267db0e6..04e06d15 100644
--- a/app/src/main/java/com/xiaoyv/bangumi/ui/discover/index/list/IndexListActivity.kt
+++ b/app/src/main/java/com/xiaoyv/bangumi/ui/discover/index/list/IndexListActivity.kt
@@ -27,6 +27,7 @@ class IndexListActivity : BaseListActivity(
override fun initIntentData(intent: Intent, bundle: Bundle, isNewIntent: Boolean) {
viewModel.isSortByNewest = bundle.getBoolean(NavKey.KEY_BOOLEAN, false)
+ viewModel.userId = bundle.getString(NavKey.KEY_STRING).orEmpty()
}
override fun initListener() {
@@ -43,9 +44,9 @@ class IndexListActivity : BaseListActivity(
override fun onListDataFinish(list: List) {
binding.toolbar.title = if (viewModel.isSortByNewest) {
- "目录列表-时间排序"
+ if (viewModel.queryForUser) "目录列表-TA 的创建" else "目录列表-时间排序"
} else {
- "目录列表-热门排序"
+ if (viewModel.queryForUser) "目录列表-TA 的收藏" else "目录列表-热门排序"
}
invalidateMenu()
@@ -53,14 +54,14 @@ class IndexListActivity : BaseListActivity(
override fun onCreateOptionsMenu(menu: Menu): Boolean {
if (viewModel.isSortByNewest) {
- menu.add("按热门排序")
+ menu.add(if (viewModel.queryForUser) "TA 收藏的目录" else "按热门排序")
.setOnMenuItemClickListener {
viewModel.isSortByNewest = false
viewModel.refresh()
true
}
} else {
- menu.add("按创建时间排序")
+ menu.add(if (viewModel.queryForUser) "TA 创建的目录" else "按热门排序")
.setOnMenuItemClickListener {
viewModel.isSortByNewest = true
viewModel.refresh()
diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/discover/index/list/IndexListViewModel.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/discover/index/list/IndexListViewModel.kt
index 2005f08e..e9b49281 100644
--- a/app/src/main/java/com/xiaoyv/bangumi/ui/discover/index/list/IndexListViewModel.kt
+++ b/app/src/main/java/com/xiaoyv/bangumi/ui/discover/index/list/IndexListViewModel.kt
@@ -23,19 +23,32 @@ class IndexListViewModel : BaseListViewModel() {
internal val isMine: Boolean
get() = userId.isNotBlank() && userId == UserHelper.currentUser.id
+ internal val queryForUser: Boolean
+ get() = userId.isNotBlank()
+
override suspend fun onRequestListImpl(): List {
if (requireLogin) {
require(UserHelper.isLogin) { "你还没有登录呢" }
}
- return if (userId.isNotBlank()) {
- BgmApiManager.bgmWebApi.queryUserIndex(userId, current)
- .parserUserIndexList()
- } else {
- BgmApiManager.bgmWebApi.queryIndexList(
- orderBy = if (isSortByNewest) null else "collect",
- page = current
- ).parserIndexList()
+ return when {
+ // 查询指定用户的目录
+ queryForUser -> {
+ // 是否拼接查询收藏路径,复用下 isSortByNewest 字段
+ // 指定用户ID时,isSortByNewest == true,查询创建的目录,反之查询收藏的目录
+ val queryCollect = if (isSortByNewest) "" else "/collect"
+ BgmApiManager.bgmWebApi.queryUserIndex(userId, queryCollect, current).let {
+ if (isSortByNewest) it.parserUserIndexList()
+ else it.parserIndexList()
+ }
+ }
+ // 查询全部目录列表
+ else -> {
+ BgmApiManager.bgmWebApi.queryIndexList(
+ orderBy = if (isSortByNewest) null else "collect",
+ page = current
+ ).parserIndexList()
+ }
}
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/feature/user/UserActivity.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/feature/user/UserActivity.kt
index 1e8a9891..8671c685 100644
--- a/app/src/main/java/com/xiaoyv/bangumi/ui/feature/user/UserActivity.kt
+++ b/app/src/main/java/com/xiaoyv/bangumi/ui/feature/user/UserActivity.kt
@@ -25,6 +25,7 @@ import com.xiaoyv.common.kts.randomY
import com.xiaoyv.common.kts.showConfirmDialog
import com.xiaoyv.common.widget.dialog.AnimeLoadingDialog
import com.xiaoyv.common.widget.dialog.AnimeReportDialog
+import com.xiaoyv.widget.callback.setOnFastLimitClickListener
import com.xiaoyv.widget.dialog.UiDialog
@@ -82,7 +83,13 @@ class UserActivity : BaseViewModelActivity()
}
override fun initListener() {
+ binding.bottomRightTextView.setOnFastLimitClickListener {
+ RouteHelper.jumpIndexList(true, viewModel.userId)
+ }
+ binding.middleRightTextView.setOnFastLimitClickListener {
+ RouteHelper.jumpUserBlog(viewModel.userId)
+ }
}
override fun LifecycleOwner.initViewObserver() {
diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/feature/user/UserAdapter.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/feature/user/UserAdapter.kt
index 4017309b..43035188 100644
--- a/app/src/main/java/com/xiaoyv/bangumi/ui/feature/user/UserAdapter.kt
+++ b/app/src/main/java/com/xiaoyv/bangumi/ui/feature/user/UserAdapter.kt
@@ -9,6 +9,8 @@ import com.xiaoyv.bangumi.ui.feature.user.chart.ChartFragment
import com.xiaoyv.bangumi.ui.feature.user.overview.UserOverviewFragment
import com.xiaoyv.bangumi.ui.feature.user.sign.SignFragment
import com.xiaoyv.bangumi.ui.profile.page.save.SaveListFragment
+import com.xiaoyv.bangumi.ui.timeline.page.TimelinePageFragment
+import com.xiaoyv.common.config.annotation.TimelineType
import com.xiaoyv.common.config.annotation.UserCenterType
import com.xiaoyv.common.config.bean.UserCenterTab
@@ -28,7 +30,6 @@ class UserAdapter(fragmentManager: FragmentManager, lifecycle: Lifecycle) :
UserCenterTab("收藏", UserCenterType.TYPE_SAVE),
UserCenterTab("统计", UserCenterType.TYPE_CHART),
UserCenterTab("时间线", UserCenterType.TYPE_TIMELINE),
- UserCenterTab("超展开", UserCenterType.TYPE_SUPER),
UserCenterTab("关于", UserCenterType.TYPE_ABOUT)
)
@@ -40,6 +41,11 @@ class UserAdapter(fragmentManager: FragmentManager, lifecycle: Lifecycle) :
UserCenterType.TYPE_SAVE -> SaveListFragment.newInstance(userId)
UserCenterType.TYPE_ABOUT -> SignFragment.newInstance()
UserCenterType.TYPE_CHART -> ChartFragment.newInstance()
+ UserCenterType.TYPE_TIMELINE -> TimelinePageFragment.newInstance(
+ type = TimelineType.TYPE_ALL,
+ userId = userId,
+ requireLogin = false
+ )
else -> EmptyFragment.newInstance()
}
}
diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/feature/user/blog/UserBlogActivity.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/feature/user/blog/UserBlogActivity.kt
new file mode 100644
index 00000000..06fa4c92
--- /dev/null
+++ b/app/src/main/java/com/xiaoyv/bangumi/ui/feature/user/blog/UserBlogActivity.kt
@@ -0,0 +1,38 @@
+package com.xiaoyv.bangumi.ui.feature.user.blog
+
+import android.content.Intent
+import android.os.Bundle
+import android.view.MenuItem
+import com.xiaoyv.bangumi.databinding.ActivityUserBlogListBinding
+import com.xiaoyv.bangumi.ui.discover.blog.BlogFragment
+import com.xiaoyv.blueprint.base.binding.BaseBindingActivity
+import com.xiaoyv.blueprint.constant.NavKey
+import com.xiaoyv.blueprint.kts.LazyUtils.loadRootFragment
+import com.xiaoyv.common.kts.initNavBack
+
+/**
+ * Class: [UserBlogActivity]
+ *
+ * @author why
+ * @since 12/19/23
+ */
+class UserBlogActivity : BaseBindingActivity() {
+ private var userId: String = ""
+
+ override fun initIntentData(intent: Intent, bundle: Bundle, isNewIntent: Boolean) {
+ userId = bundle.getString(NavKey.KEY_STRING).orEmpty()
+ }
+
+ override fun initView() {
+ binding.toolbar.initNavBack(this)
+ }
+
+ override fun initData() {
+ loadRootFragment(binding.flContainer.id, BlogFragment.newInstance(userId, false))
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ item.initNavBack(this)
+ return super.onOptionsItemSelected(item)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/media/detail/overview/binder/OverviewEpBinder.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/media/detail/overview/binder/OverviewEpBinder.kt
index f4ca54af..051516f7 100644
--- a/app/src/main/java/com/xiaoyv/bangumi/ui/media/detail/overview/binder/OverviewEpBinder.kt
+++ b/app/src/main/java/com/xiaoyv/bangumi/ui/media/detail/overview/binder/OverviewEpBinder.kt
@@ -13,6 +13,7 @@ import com.xiaoyv.common.api.parser.entity.MediaDetailEntity
import com.xiaoyv.common.config.annotation.InterestType
import com.xiaoyv.common.helper.callback.IdDiffItemCallback
import com.xiaoyv.common.helper.callback.RecyclerItemTouchedListener
+import com.xiaoyv.common.kts.CommonColor
import com.xiaoyv.common.kts.GoogleAttr
import com.xiaoyv.common.kts.forceCast
import com.xiaoyv.common.kts.inflater
@@ -98,6 +99,13 @@ class OverviewEpBinder(
override fun BaseQuickBindingHolder.converted(item: MediaDetailEntity.MediaProgress) {
binding.tvEp.text = item.number
when {
+ item.isWatched -> {
+ binding.tvEp.setTextColor(context.getAttrColor(GoogleAttr.colorOnPrimarySurface))
+ binding.tvEp.backgroundTintList = ColorStateList.valueOf(
+ context.getColor(CommonColor.save_collect)
+ )
+ }
+
item.isRelease -> {
binding.tvEp.setTextColor(context.getAttrColor(GoogleAttr.colorOnPrimaryContainer))
binding.tvEp.backgroundTintList = ColorStateList.valueOf(
diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/profile/ProfileAdapter.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/profile/ProfileAdapter.kt
index 452b2528..61ed6c55 100644
--- a/app/src/main/java/com/xiaoyv/bangumi/ui/profile/ProfileAdapter.kt
+++ b/app/src/main/java/com/xiaoyv/bangumi/ui/profile/ProfileAdapter.kt
@@ -27,12 +27,12 @@ class ProfileAdapter(fragmentManager: FragmentManager, lifecycle: Lifecycle) :
internal val tabs = listOf(
ProfileTab("收藏", ProfileType.TYPE_COLLECTION),
- ProfileTab("日志", ProfileType.TYPE_BLOG),
ProfileTab("目录", ProfileType.TYPE_INDEX),
+ ProfileTab("时间胶囊", ProfileType.TYPE_TIMELINE),
+ ProfileTab("日志", ProfileType.TYPE_BLOG),
+ ProfileTab("小组", ProfileType.TYPE_GROUP),
ProfileTab("好友", ProfileType.TYPE_FRIEND),
ProfileTab("人物", ProfileType.TYPE_MONO),
- ProfileTab("小组", ProfileType.TYPE_GROUP),
- ProfileTab("时间胶囊", ProfileType.TYPE_TIMELINE),
ProfileTab("维基", ProfileType.TYPE_WIKI)
)
@@ -49,7 +49,7 @@ class ProfileAdapter(fragmentManager: FragmentManager, lifecycle: Lifecycle) :
)
// 时间线
ProfileType.TYPE_TIMELINE -> TimelinePageFragment.newInstance(
- type = TimelineType.TYPE_USER,
+ type = TimelineType.TYPE_ALL,
userId = myId,
requireLogin = true
)
diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/profile/ProfileFragment.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/profile/ProfileFragment.kt
index 7eac526e..e4340a85 100644
--- a/app/src/main/java/com/xiaoyv/bangumi/ui/profile/ProfileFragment.kt
+++ b/app/src/main/java/com/xiaoyv/bangumi/ui/profile/ProfileFragment.kt
@@ -6,6 +6,7 @@ import androidx.lifecycle.LifecycleOwner
import com.blankj.utilcode.util.ColorUtils
import com.google.android.material.badge.BadgeDrawable
import com.google.android.material.badge.BadgeUtils
+import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.xiaoyv.bangumi.databinding.FragmentProfileBinding
import com.xiaoyv.bangumi.helper.RouteHelper
@@ -79,6 +80,19 @@ class ProfileFragment : BaseViewModelFragment() {
+ private lateinit var filter: ViewIndexFilterBinding
override val isOnlyOnePage: Boolean
get() = false
@@ -35,6 +41,38 @@ class UserIndexFragment : BaseListFragment(
viewModel.userId = arguments.getString(NavKey.KEY_STRING).orEmpty()
viewModel.selectedMode = arguments.getBoolean(NavKey.KEY_BOOLEAN, false)
viewModel.requireLogin = arguments.getBoolean(NavKey.KEY_BOOLEAN_SECOND, false)
+
+ // 个人中心嵌套,默认显示自己的目录
+ if (viewModel.requireLogin) {
+ viewModel.isSortByNewest = true
+ }
+ }
+
+ override fun initView() {
+ super.initView()
+ if (viewModel.requireLogin) {
+ filter = ViewIndexFilterBinding.inflate(layoutInflater, binding.flContainer, true)
+ filter.root.doOnPreDraw {
+ binding.rvContent.updateLayoutParams {
+ topMargin = filter.root.height
+ }
+ }
+
+ // 创建的和收藏的切换
+ filter.listType.setOnCheckedStateChangeListener { _, ints ->
+ when (ints.firstOrNull()) {
+ CommonId.type_create -> {
+ viewModel.isSortByNewest = true
+ viewModel.refresh()
+ }
+
+ CommonId.type_collect -> {
+ viewModel.isSortByNewest = false
+ viewModel.refresh()
+ }
+ }
+ }
+ }
}
override fun initListener() {
diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/timeline/page/TimelinePageViewModel.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/timeline/page/TimelinePageViewModel.kt
index 9952ecb7..505572bb 100644
--- a/app/src/main/java/com/xiaoyv/bangumi/ui/timeline/page/TimelinePageViewModel.kt
+++ b/app/src/main/java/com/xiaoyv/bangumi/ui/timeline/page/TimelinePageViewModel.kt
@@ -46,6 +46,7 @@ class TimelinePageViewModel : BaseViewModel() {
}
onTimelineLiveData.value = withContext(Dispatchers.IO) {
+ // 指定用户的时间线
if (hasTargetUserId) {
BgmApiManager.bgmWebApi.queryUserTimeline(
userId = userId,
diff --git a/app/src/main/res/layout/activity_user_blog_list.xml b/app/src/main/res/layout/activity_user_blog_list.xml
new file mode 100644
index 00000000..77bacbec
--- /dev/null
+++ b/app/src/main/res/layout/activity_user_blog_list.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_list.xml b/app/src/main/res/layout/fragment_list.xml
index 823dba09..96eb0dba 100644
--- a/app/src/main/res/layout/fragment_list.xml
+++ b/app/src/main/res/layout/fragment_list.xml
@@ -7,6 +7,7 @@
android:background="?attr/colorSurface">
diff --git a/lib-common/src/main/java/com/xiaoyv/common/api/api/BgmWebApi.kt b/lib-common/src/main/java/com/xiaoyv/common/api/api/BgmWebApi.kt
index fb713bd0..dc989ccd 100644
--- a/lib-common/src/main/java/com/xiaoyv/common/api/api/BgmWebApi.kt
+++ b/lib-common/src/main/java/com/xiaoyv/common/api/api/BgmWebApi.kt
@@ -617,9 +617,10 @@ interface BgmWebApi {
@Query("page") page: Int,
): Document
- @GET("/user/{userId}/index")
+ @GET("/user/{userId}/index{collect}")
suspend fun queryUserIndex(
@Path("userId", encoded = true) userId: String,
+ @Path("collect", encoded = true) collect: String = "",
@Query("page") page: Int,
): Document
diff --git a/lib-common/src/main/java/com/xiaoyv/common/api/parser/entity/BlogEntity.kt b/lib-common/src/main/java/com/xiaoyv/common/api/parser/entity/BlogEntity.kt
index 76bd6eae..6b8bbce2 100644
--- a/lib-common/src/main/java/com/xiaoyv/common/api/parser/entity/BlogEntity.kt
+++ b/lib-common/src/main/java/com/xiaoyv/common/api/parser/entity/BlogEntity.kt
@@ -13,8 +13,8 @@ data class BlogEntity(
var time: String = "",
var content: String = "",
var commentCount: Int = 0,
- var nestingProfile: Boolean = false,
var mediaName: String = "",
var recentUserName: String = "",
var recentUserId: String = "",
+ var nestingProfile: Boolean = false,
)
diff --git a/lib-common/src/main/java/com/xiaoyv/common/api/parser/entity/MediaDetailEntity.kt b/lib-common/src/main/java/com/xiaoyv/common/api/parser/entity/MediaDetailEntity.kt
index 2e3407d4..5b6083e5 100644
--- a/lib-common/src/main/java/com/xiaoyv/common/api/parser/entity/MediaDetailEntity.kt
+++ b/lib-common/src/main/java/com/xiaoyv/common/api/parser/entity/MediaDetailEntity.kt
@@ -145,6 +145,7 @@ data class MediaDetailEntity(
@SerializedName("isToday") var isToday: Boolean = false,
@SerializedName("isWaiting") var isWaiting: Boolean = false,
@SerializedName("isRelease") var isRelease: Boolean = false,
+ @SerializedName("isWatched") var isWatched: Boolean = false,
@SerializedName("commentCount") var commentCount: Int = 0,
) : Parcelable, IdEntity
diff --git a/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/BlogParser.kt b/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/BlogParser.kt
index 81cfc3ae..85f87ef0 100644
--- a/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/BlogParser.kt
+++ b/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/BlogParser.kt
@@ -21,9 +21,9 @@ import org.jsoup.nodes.Element
* @author why
* @since 11/28/23
*/
-fun Document.parserBlogList(userCenter: Boolean): List {
+fun Document.parserBlogList(isQueryTargetUser: Boolean, isQueryMine: Boolean): List {
requireNoError()
- val div = if (userCenter) "div" else "div.entry"
+ val div = if (isQueryTargetUser) "div" else "div.entry"
return select("#news_list > .item, #entry_list > .item").map {
val blogEntity = BlogEntity()
@@ -32,12 +32,12 @@ fun Document.parserBlogList(userCenter: Boolean): List {
blogEntity.id = it.select("$div .title a").hrefId()
// 区别解析
- if (userCenter) {
+ if (isQueryTargetUser) {
blogEntity.time = it.select("$div small.time").text()
it.select("$div .content").apply {
select("small").remove()
- blogEntity.content = text()
blogEntity.commentCount = it.select("$div small.orange").text().parseCount()
+ blogEntity.content = text()
}
} else {
blogEntity.time = it.select("$div .time small").lastOrNull()?.text().orEmpty()
@@ -54,7 +54,7 @@ fun Document.parserBlogList(userCenter: Boolean): List {
blogEntity.mediaName = getOrNull(1)?.text().orEmpty()
}
// 是否嵌套在用户中心的解析
- blogEntity.nestingProfile = userCenter
+ blogEntity.nestingProfile = isQueryMine
blogEntity
}
}
diff --git a/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/MediaDetailParser.kt b/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/MediaDetailParser.kt
index c57580a0..be93334f 100644
--- a/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/MediaDetailParser.kt
+++ b/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/MediaDetailParser.kt
@@ -257,11 +257,13 @@ fun Document.parserMediaDetail(): MediaDetailEntity {
// 序号
progress.number = text().ifBlank { item.text() }
// 是否已经放送
- progress.isRelease = hasClass("epBtnAir")
+ progress.isRelease = hasClass("epBtnAir") || hasClass("epBtnWatched")
// 是否今天放送
progress.isToday = hasClass("epBtnToday")
// 是否正在等待放送中
progress.isWaiting = hasClass("epBtnNA")
+ // 是否看过了
+ progress.isWatched = hasClass("epBtnWatched")
}
val relId = item.select("a").attr("rel")
diff --git a/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/TimeParser.kt b/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/TimeParser.kt
index 93deddf9..52e1c45e 100644
--- a/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/TimeParser.kt
+++ b/lib-common/src/main/java/com/xiaoyv/common/api/parser/impl/TimeParser.kt
@@ -29,6 +29,11 @@ fun Document.parserTimelineForms(
return select("#timeline ul > li").map { item ->
val entity = TimelineEntity()
item.handleItem(entity, userId)
+ // 如果指定了用户的时间线,单独解析头像和用户名登
+ if (userId.isNotBlank()) {
+ entity.name = select(".nameSingle .name").text()
+ entity.avatar = select(".headerAvatar a.avatar > span").styleBackground()
+ }
entity
}
}
@@ -190,6 +195,7 @@ private fun Elements.fetchHtmlTitle(): CharSequence {
}
infoUserActionText += node.toString()
}
+ if (infoUserActionText.isBlank()) infoUserActionText = "时间线"
return infoUserActionText.parseHtml()
}
diff --git a/lib-common/src/main/java/com/xiaoyv/common/config/annotation/TimelineType.kt b/lib-common/src/main/java/com/xiaoyv/common/config/annotation/TimelineType.kt
index 8e718e40..6d4295e1 100644
--- a/lib-common/src/main/java/com/xiaoyv/common/config/annotation/TimelineType.kt
+++ b/lib-common/src/main/java/com/xiaoyv/common/config/annotation/TimelineType.kt
@@ -10,7 +10,6 @@ import androidx.annotation.StringDef
*/
@StringDef(
TimelineType.TYPE_ALL,
- TimelineType.TYPE_USER,
TimelineType.TYPE_SAY,
TimelineType.TYPE_SUBJECT,
TimelineType.TYPE_PROGRESS,
@@ -25,7 +24,6 @@ import androidx.annotation.StringDef
annotation class TimelineType {
companion object {
const val TYPE_ALL = ""
- const val TYPE_USER = ""
const val TYPE_SAY = "say"
const val TYPE_SUBJECT = "subject"
const val TYPE_PROGRESS = "process"
diff --git a/lib-common/src/main/java/com/xiaoyv/common/config/annotation/UserCenterType.kt b/lib-common/src/main/java/com/xiaoyv/common/config/annotation/UserCenterType.kt
index e74f2b6c..9f769f22 100644
--- a/lib-common/src/main/java/com/xiaoyv/common/config/annotation/UserCenterType.kt
+++ b/lib-common/src/main/java/com/xiaoyv/common/config/annotation/UserCenterType.kt
@@ -13,7 +13,6 @@ import androidx.annotation.IntDef
UserCenterType.TYPE_SAVE,
UserCenterType.TYPE_CHART,
UserCenterType.TYPE_TIMELINE,
- UserCenterType.TYPE_SUPER,
UserCenterType.TYPE_ABOUT
)
@Retention(AnnotationRetention.SOURCE)
@@ -23,7 +22,6 @@ annotation class UserCenterType {
const val TYPE_SAVE = 1
const val TYPE_CHART = 2
const val TYPE_TIMELINE = 3
- const val TYPE_SUPER = 4
- const val TYPE_ABOUT = 5
+ const val TYPE_ABOUT = 4
}
}
diff --git a/lib-common/src/main/res/layout/view_index_filter.xml b/lib-common/src/main/res/layout/view_index_filter.xml
new file mode 100644
index 00000000..4362e51d
--- /dev/null
+++ b/lib-common/src/main/res/layout/view_index_filter.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
diff --git a/lib-h5/public/test.http b/lib-h5/public/test.http
index c3b2bdd3..8adf09ff 100644
--- a/lib-h5/public/test.http
+++ b/lib-h5/public/test.http
@@ -63,3 +63,20 @@ TE: trailers
GET https://tinygrail.oss-cn-hangzhou.aliyuncs.com/avatar/edbbcd8f731821b6172a74bf1e6ba9ec.jpg
Referer: https://bgm.tv
+###
+GET https://upload.cc/i1/2018/12/29/GIA76g.png HTTP/2
+Host: upload.cc
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:120.0) Gecko/20100101 Firefox/120.0
+Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
+Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.6,zh-HK;q=0.4,en;q=0.2
+Accept-Encoding: gzip, deflate, br
+Connection: keep-alive
+Cookie: __ddgid_=9RP6cs60ITY5p0ro; __ddgmark_=gABL0LPoM3izzR3x; __ddg5_=hGq0ym764UxhScLw; __ddg2_=su92IOC1Wxb2UvsS; __ddg1_=LsTrPSbwyN45Hhj5zl37
+Upgrade-Insecure-Requests: 1
+Sec-Fetch-Dest: document
+Sec-Fetch-Mode: navigate
+Sec-Fetch-Site: none
+Sec-Fetch-User: ?1
+Pragma: no-cache
+Cache-Control: no-cache
+TE: trailers
\ No newline at end of file