This commit is contained in:
ocean 2024-07-30 15:40:08 +08:00
parent e9921c6cae
commit f5d7ecc2ec
7 changed files with 67 additions and 11 deletions

View File

@ -16,8 +16,8 @@ android {
applicationId = "com.hi.melody.music.noise" applicationId = "com.hi.melody.music.noise"
minSdk = 24 minSdk = 24
targetSdk = 34 targetSdk = 34
versionCode = 8 versionCode = 9
versionName = "1.0.8" versionName = "1.0.9"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@ -35,13 +35,13 @@ android {
"proguard-rules.pro" "proguard-rules.pro"
) )
} }
// debug { debug {
// isMinifyEnabled = true isMinifyEnabled = true
// proguardFiles( proguardFiles(
// getDefaultProguardFile("proguard-android-optimize.txt"), getDefaultProguardFile("proguard-android-optimize.txt"),
// "proguard-rules.pro" "proguard-rules.pro"
// ) )
// } }
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8

View File

@ -379,6 +379,12 @@ class MoPlayDetailsActivity : MoBaseActivity(), Player.Listener {
// updateFavoriteUi(currentFavoriteBean.isFavorite) // updateFavoriteUi(currentFavoriteBean.isFavorite)
// } // }
// } // }
if (appStore.hideDownloadBtn) {
binding.downloadBtn.visibility = View.GONE
} else {
binding.downloadBtn.visibility = View.VISIBLE
}
} }
private fun initDownloadFlow() { private fun initDownloadFlow() {

View File

@ -2,6 +2,21 @@ package melody.offline.music.firebase
object Constants { object Constants {
const val KEY_HIDE_DOWNLOAD_BTN = "key_hide_download_btn"
const val DEFAULT_HIDE_DOWNLOAD_BTN = false
const val KEY_HIDE_SINGER_OR_SONG_JSON = "key_hide_singer_or_song_json"
const val DEFAULT_HIDE_SINGER_OR_SONG_JSON = """
{
"search_input": [
"张三",
"李四",
"王五",
"赵六"
]
}
"""
const val KEY_SHOULD_ENTER_MUSIC_JSON = "key_should_enter_music_json" const val KEY_SHOULD_ENTER_MUSIC_JSON = "key_should_enter_music_json"
const val DEFAULT_SHOULD_ENTER_MUSIC_JSON = """ const val DEFAULT_SHOULD_ENTER_MUSIC_JSON = """
{ {

View File

@ -128,6 +128,14 @@ class RemoteConfig {
appStore.adJson = ad appStore.adJson = ad
LoLAds.setAdConfig(ad) LoLAds.setAdConfig(ad)
} }
if (TextUtils.equals(Constants.KEY_HIDE_DOWNLOAD_BTN, key)) {
val hideDownload = value.asBoolean()
appStore.hideDownloadBtn = hideDownload
}
if (TextUtils.equals(Constants.KEY_HIDE_SINGER_OR_SONG_JSON, key)) {
val hideJson = value.asString()
appStore.hideSingerOrSongJson = hideJson
}
} catch (ignore: Exception) { } catch (ignore: Exception) {
} }

View File

@ -197,6 +197,16 @@ class SearchFragment : MoBaseFragment<FragmentSearchBinding>(), TextWatcher,
if (isAdded) { if (isAdded) {
val input = it.input val input = it.input
if (input.isNotEmpty()) { if (input.isNotEmpty()) {
val localData = JSONObject(appStore.hideSingerOrSongJson)
val namesArray = localData.getJSONArray("search_input")
for (i in 0 until namesArray.length()) {
if (input.contains(namesArray.getString(i))) {
binding.searchEdit.clearFocus()
showNoContentLayout()
return@onReceive
}
}
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_TRIGGER) AnalysisUtil.logEvent(AnalysisUtil.SEARCH_TRIGGER)
LolAdWrapper.shared.showAdTiming( LolAdWrapper.shared.showAdTiming(
requireActivity(), AdPlacement.INST_SEARCH requireActivity(), AdPlacement.INST_SEARCH

View File

@ -61,8 +61,17 @@ class AppStore(context: Context) {
//记录弹出dialog的时间 //记录弹出dialog的时间
var showRateDialogTime: Long by store.long( var showRateDialogTime: Long by store.long(
key = SHOW_RATE_DIALOG_TIME, key = SHOW_RATE_DIALOG_TIME, defaultValue = 0L
defaultValue = 0L )
//根据配置,判断是否隐藏下载按钮
var hideDownloadBtn: Boolean by store.boolean(
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
) )
companion object { companion object {

View File

@ -19,6 +19,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog
import melody.offline.music.R import melody.offline.music.R
import melody.offline.music.bean.PlaylistItem import melody.offline.music.bean.PlaylistItem
import melody.offline.music.service.ViewModelMain import melody.offline.music.service.ViewModelMain
import melody.offline.music.sp.AppStore
import melody.offline.music.util.AnalysisUtil import melody.offline.music.util.AnalysisUtil
import melody.offline.music.util.DownloadUtil import melody.offline.music.util.DownloadUtil
import melody.offline.music.util.LogTag import melody.offline.music.util.LogTag
@ -73,6 +74,13 @@ class ListMoreBottomSheetDialog(
bottomDialogDownloadTv = findViewById(R.id.bottomDialogDownloadTv) bottomDialogDownloadTv = findViewById(R.id.bottomDialogDownloadTv)
bottomDialogMoreAddPlaylistBtn = findViewById(R.id.bottomDialogMoreAddPlaylistBtn) bottomDialogMoreAddPlaylistBtn = findViewById(R.id.bottomDialogMoreAddPlaylistBtn)
bottomDialogAddPlaylistTv = findViewById(R.id.bottomDialogAddPlaylistTv) bottomDialogAddPlaylistTv = findViewById(R.id.bottomDialogAddPlaylistTv)
if (AppStore(context).hideDownloadBtn) {
bottomDialogMoreDownloadBtn?.visibility = View.GONE
} else {
bottomDialogMoreDownloadBtn?.visibility = View.VISIBLE
}
} }
private fun initInfoUi() { private fun initInfoUi() {