update
This commit is contained in:
parent
2fc9fc93b1
commit
a5f6d1045b
@ -35,13 +35,13 @@ android {
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
debug {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
// debug {
|
||||
// isMinifyEnabled = true
|
||||
// proguardFiles(
|
||||
// getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
// "proguard-rules.pro"
|
||||
// )
|
||||
// }
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
@ -33,6 +33,7 @@ import melody.offline.music.innertube.Innertube
|
||||
import melody.offline.music.innertube.requests.moPlaylistPage
|
||||
import melody.offline.music.service.MyDownloadService
|
||||
import melody.offline.music.service.ViewModelMain
|
||||
import melody.offline.music.sp.AppStore
|
||||
import melody.offline.music.util.AnalysisUtil
|
||||
import melody.offline.music.util.DownloadUtil
|
||||
import melody.offline.music.util.LogTag
|
||||
@ -399,9 +400,19 @@ class MoListDetailsActivity : MoBaseActivity(), DetailsListAdapter.OnItemMoreCli
|
||||
size = size
|
||||
)
|
||||
}
|
||||
|
||||
myList.clear()
|
||||
myList.addAll(mapList)
|
||||
|
||||
val localData = JSONObject(appStore.hideFixedSongsJson)
|
||||
val namesArray = localData.getJSONArray("fixed_songs")
|
||||
for (myContent in mapList) {
|
||||
val videoId = myContent.videoId
|
||||
for (i in 0 until namesArray.length()) {
|
||||
if (videoId != (namesArray.getString(i))) {
|
||||
//ID不相等添加这条数据
|
||||
myList.add(myContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
adapter?.notifyDataSetChanged()
|
||||
} else {
|
||||
showNoContentUi()
|
||||
|
||||
@ -532,8 +532,20 @@ class MoPlayDetailsActivity : MoBaseActivity(), Player.Listener {
|
||||
val mediaItemAt = meController.getMediaItemAt(index)
|
||||
allMediaItems.add(mediaItemAt)
|
||||
}
|
||||
|
||||
playList.clear()
|
||||
playList.addAll(allMediaItems)
|
||||
|
||||
val localData = JSONObject(appStore.hideFixedSongsJson)
|
||||
val namesArray = localData.getJSONArray("fixed_songs")
|
||||
for (myContent in allMediaItems) {
|
||||
val videoId = myContent.mediaId
|
||||
for (i in 0 until namesArray.length()) {
|
||||
if (videoId != (namesArray.getString(i))) {
|
||||
//ID不相等添加这条数据
|
||||
playList.add(myContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
detailsPlayListAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import melody.offline.music.innertube.requests.moSearchPage
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.selects.select
|
||||
import org.json.JSONObject
|
||||
|
||||
class MoSearchMoreActivity : MoBaseActivity() {
|
||||
private val requests: Channel<Request> = Channel(Channel.UNLIMITED)
|
||||
@ -129,8 +130,20 @@ class MoSearchMoreActivity : MoBaseActivity() {
|
||||
binding.title.text = title
|
||||
}
|
||||
currentContinuation = myResult.continuation
|
||||
|
||||
list.clear()
|
||||
list.addAll(myResult.searchResultList)
|
||||
|
||||
val localData = JSONObject(appStore.hideFixedSongsJson)
|
||||
val namesArray = localData.getJSONArray("fixed_songs")
|
||||
for (myContent in myResult.searchResultList) {
|
||||
val videoId = myContent.videoId
|
||||
for (i in 0 until namesArray.length()) {
|
||||
if (videoId != (namesArray.getString(i))) {
|
||||
//ID不相等添加这条数据
|
||||
list.add(myContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
showNoContentUi()
|
||||
}
|
||||
|
||||
@ -12,8 +12,10 @@ import melody.offline.music.activity.MoPlayDetailsActivity
|
||||
import melody.offline.music.databinding.MusicResponsiveItemBinding
|
||||
import melody.offline.music.innertube.models.MusicCarouselShelfRenderer
|
||||
import melody.offline.music.media.MediaControllerManager
|
||||
import melody.offline.music.sp.AppStore
|
||||
import melody.offline.music.util.AnalysisUtil
|
||||
import melody.offline.music.util.LogTag
|
||||
import org.json.JSONObject
|
||||
|
||||
class ResponsiveListAdapter(
|
||||
private val context: Context,
|
||||
|
||||
@ -12,6 +12,15 @@ object Constants {
|
||||
"赵六"
|
||||
]
|
||||
}
|
||||
"""
|
||||
|
||||
const val KEY_HIDE_FIXED_SONGS_JSON = "key_hide_fixed_songs_json"
|
||||
const val DEFAULT_HIDE_FIXED_SONGS_JSON = """
|
||||
{
|
||||
"fixed_songs": [
|
||||
"赵六"
|
||||
]
|
||||
}
|
||||
"""
|
||||
|
||||
const val KEY_SHOULD_ENTER_MUSIC_JSON = "key_should_enter_music_json"
|
||||
|
||||
@ -136,6 +136,10 @@ class RemoteConfig {
|
||||
val hideJson = value.asString()
|
||||
appStore.hideSingerOrSongJson = hideJson
|
||||
}
|
||||
if (TextUtils.equals(Constants.KEY_HIDE_FIXED_SONGS_JSON, key)) {
|
||||
val fixedSongs = value.asString()
|
||||
appStore.hideFixedSongsJson = fixedSongs
|
||||
}
|
||||
} catch (ignore: Exception) {
|
||||
|
||||
}
|
||||
|
||||
@ -69,11 +69,18 @@ class AppStore(context: Context) {
|
||||
key = Constants.KEY_HIDE_DOWNLOAD_BTN, defaultValue = Constants.DEFAULT_HIDE_DOWNLOAD_BTN
|
||||
)
|
||||
|
||||
//根据配置隐藏对应的搜索
|
||||
var hideSingerOrSongJson: String by store.string(
|
||||
key = Constants.KEY_HIDE_SINGER_OR_SONG_JSON,
|
||||
defaultValue = Constants.DEFAULT_HIDE_SINGER_OR_SONG_JSON
|
||||
)
|
||||
|
||||
//根据配置隐藏对应的歌曲
|
||||
var hideFixedSongsJson: String by store.string(
|
||||
key = Constants.KEY_HIDE_FIXED_SONGS_JSON,
|
||||
defaultValue = Constants.DEFAULT_HIDE_FIXED_SONGS_JSON
|
||||
)
|
||||
|
||||
companion object {
|
||||
private const val FILE_NAME = "music_oo_app"
|
||||
const val SEARCH_HISTORY = "search_history"
|
||||
|
||||
@ -2,6 +2,7 @@ package melody.offline.music.view
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@ -10,6 +11,7 @@ import melody.offline.music.R
|
||||
import melody.offline.music.adapter.ResponsiveListAdapter
|
||||
import melody.offline.music.innertube.Innertube
|
||||
import melody.offline.music.innertube.models.MusicCarouselShelfRenderer
|
||||
import melody.offline.music.sp.AppStore
|
||||
import melody.offline.music.util.AnalysisUtil
|
||||
import melody.offline.music.util.LogTag
|
||||
|
||||
@ -25,8 +27,31 @@ class MusicResponsiveListView(context: Context, homePage: Innertube.HomePage) :
|
||||
title?.text = homePage.title
|
||||
|
||||
val rv = contentView?.findViewById<RecyclerView>(R.id.rv)
|
||||
val myContentList: MutableList<MusicCarouselShelfRenderer.Content> = mutableListOf()
|
||||
|
||||
adapter = ResponsiveListAdapter(context, homePage.contents)
|
||||
val localData = JSONObject(AppStore(context).hideFixedSongsJson)
|
||||
val namesArray = localData.getJSONArray("fixed_songs")
|
||||
for (myContent in homePage.contents) {
|
||||
val watchEndpoint = myContent.musicResponsiveListItemRenderer
|
||||
?.flexColumns
|
||||
?.firstOrNull()
|
||||
?.musicResponsiveListItemFlexColumnRenderer
|
||||
?.text
|
||||
?.runs
|
||||
?.firstOrNull()
|
||||
?.navigationEndpoint
|
||||
?.watchEndpoint
|
||||
val videoId = watchEndpoint?.videoId
|
||||
|
||||
for (i in 0 until namesArray.length()) {
|
||||
if (videoId != (namesArray.getString(i))) {
|
||||
//ID不相等添加这条数据
|
||||
myContentList.add(myContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
adapter = ResponsiveListAdapter(context, myContentList)
|
||||
adapter?.setOnItemClickListener(object : ResponsiveListAdapter.OnItemClickListener {
|
||||
override fun onItemClick(position: Int) {
|
||||
val jsonObject = JSONObject()
|
||||
@ -37,7 +62,7 @@ class MusicResponsiveListView(context: Context, homePage: Innertube.HomePage) :
|
||||
})
|
||||
adapter?.setOnItemMoreClickListener(object : ResponsiveListAdapter.OnItemMoreClickListener {
|
||||
override fun onItemMoreClick(position: Int) {
|
||||
val bean = homePage.contents[position]
|
||||
val bean = myContentList[position]
|
||||
if (moreClickListener != null) {
|
||||
moreClickListener?.onMoreClick(bean)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user