This commit is contained in:
ocean 2024-07-31 11:31:31 +08:00
parent a5f6d1045b
commit 70972c51d8
4 changed files with 36 additions and 11 deletions

View File

@ -406,12 +406,18 @@ class MoListDetailsActivity : MoBaseActivity(), DetailsListAdapter.OnItemMoreCli
val namesArray = localData.getJSONArray("fixed_songs") val namesArray = localData.getJSONArray("fixed_songs")
for (myContent in mapList) { for (myContent in mapList) {
val videoId = myContent.videoId val videoId = myContent.videoId
// 确定是否在名称数组中找到 videoId 的标志
var found = false
for (i in 0 until namesArray.length()) { for (i in 0 until namesArray.length()) {
if (videoId != (namesArray.getString(i))) { if (videoId == (namesArray.getString(i))) {
//ID不相等添加这条数据 found = true
myList.add(myContent) break
} }
} }
// 如果在namesArray中找不到videoId则将myContent添加到列表中
if (!found) {
myList.add(myContent)
}
} }
adapter?.notifyDataSetChanged() adapter?.notifyDataSetChanged()
} else { } else {

View File

@ -539,12 +539,19 @@ class MoPlayDetailsActivity : MoBaseActivity(), Player.Listener {
val namesArray = localData.getJSONArray("fixed_songs") val namesArray = localData.getJSONArray("fixed_songs")
for (myContent in allMediaItems) { for (myContent in allMediaItems) {
val videoId = myContent.mediaId val videoId = myContent.mediaId
// 确定是否在名称数组中找到 videoId 的标志
var found = false
for (i in 0 until namesArray.length()) { for (i in 0 until namesArray.length()) {
if (videoId != (namesArray.getString(i))) { if (videoId == (namesArray.getString(i))) {
//ID不相等添加这条数据 //ID不相等添加这条数据
playList.add(myContent) found = true
break
} }
} }
// 如果在namesArray中找不到videoId则将myContent添加到列表中
if (!found) {
playList.add(myContent)
}
} }
detailsPlayListAdapter?.notifyDataSetChanged() detailsPlayListAdapter?.notifyDataSetChanged()
} }

View File

@ -137,12 +137,18 @@ class MoSearchMoreActivity : MoBaseActivity() {
val namesArray = localData.getJSONArray("fixed_songs") val namesArray = localData.getJSONArray("fixed_songs")
for (myContent in myResult.searchResultList) { for (myContent in myResult.searchResultList) {
val videoId = myContent.videoId val videoId = myContent.videoId
// 确定是否在名称数组中找到 videoId 的标志
var found = false
for (i in 0 until namesArray.length()) { for (i in 0 until namesArray.length()) {
if (videoId != (namesArray.getString(i))) { if (videoId == (namesArray.getString(i))) {
//ID不相等添加这条数据 found = true
list.add(myContent) break
} }
} }
// 如果在namesArray中找不到videoId则将myContent添加到列表中
if (!found) {
list.add(myContent)
}
} }
} else { } else {
showNoContentUi() showNoContentUi()

View File

@ -43,12 +43,18 @@ class MusicResponsiveListView(context: Context, homePage: Innertube.HomePage) :
?.watchEndpoint ?.watchEndpoint
val videoId = watchEndpoint?.videoId val videoId = watchEndpoint?.videoId
// 确定是否在名称数组中找到 videoId 的标志
var found = false
for (i in 0 until namesArray.length()) { for (i in 0 until namesArray.length()) {
if (videoId != (namesArray.getString(i))) { if (videoId == (namesArray.getString(i))) {
//ID不相等添加这条数据 found = true
myContentList.add(myContent) break
} }
} }
// 如果在namesArray中找不到videoId则将myContent添加到列表中
if (!found) {
myContentList.add(myContent)
}
} }
adapter = ResponsiveListAdapter(context, myContentList) adapter = ResponsiveListAdapter(context, myContentList)