修复一些bug

This commit is contained in:
ocean 2024-07-18 18:19:02 +08:00
parent 3328827ab6
commit 1d38c635dd
4 changed files with 63 additions and 42 deletions

View File

@ -45,3 +45,7 @@
-keep class * extends com.google.gson.TypeAdapter {
*;
}
-keep class org.chromium.** { *; }
-keep class androidx.media3.datasource.cronet.** { *; }
-keep class androidx.media3.exoplayer.scheduler.PlatformScheduler$PlatformSchedulerService { *; }

View File

@ -124,6 +124,10 @@
</intent-filter>
</service>
<service
android:name="androidx.media3.exoplayer.scheduler.PlatformScheduler$PlatformSchedulerService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
</application>
</manifest>

View File

@ -92,10 +92,17 @@ class MoSingerDetailsActivity : MoBaseActivity() {
showLoadingUi()
Innertube.moSingerListPage(browseId)
?.onSuccess {
if (isFinishing || isDestroyed) {
return
}
showDataUi()
Glide.with(this)
.load(it.thumbnail)
.into(binding.singerImg)
try {
Glide.with(this)
.load(it.thumbnail)
.into(binding.singerImg)
} catch (e: Exception) {
e.printStackTrace()
}
binding.singerName.text = it.title
if (it.description.isNullOrEmpty()) {
binding.singerDesc.visibility = View.GONE
@ -144,4 +151,9 @@ class MoSingerDetailsActivity : MoBaseActivity() {
binding.loadingLayout.visibility = View.GONE
binding.noContentLayout.visibility = View.VISIBLE
}
override fun onDestroy() {
super.onDestroy()
Glide.with(this).clear(binding.singerImg)
}
}

View File

@ -194,53 +194,54 @@ class SearchFragment : MoBaseFragment<FragmentSearchBinding>(), TextWatcher,
}
is Request.SearchData -> {
val input = it.input
if (input.isNotEmpty()) {
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_TRIGGER)
LolAdWrapper.shared.showAdTiming(
requireActivity(), AdPlacement.INST_SEARCH
)
showLoadingLayout()
binding.contentLayout.removeAllViews()
binding.searchEdit.clearFocus()
if (isAdded) {
val input = it.input
if (input.isNotEmpty()) {
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_TRIGGER)
LolAdWrapper.shared.showAdTiming(
requireActivity(), AdPlacement.INST_SEARCH
)
showLoadingLayout()
binding.contentLayout.removeAllViews()
binding.searchEdit.clearFocus()
searchHistorySet.clear()
searchHistorySet.addAll(appStore.searchHistoryStore)
if (!appStore.searchHistoryStore.contains(input)) {//把不存在的记录保存到集合中
searchHistorySet.add(input)
}
appStore.searchHistoryStore = searchHistorySet
updateHistoryUi()
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_RESULT_PV)
Innertube.moSearchPage(SearchBody(query = input))
?.onSuccess { result ->
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_RESULT_SUCCESS_ACTION)
showResultContent()
for (dataPage: Innertube.SearchDataPage in result) {
LogTag.LogD(TAG, "moSearchPage dataPage->$dataPage")
if (dataPage.type == 1) {//type为1的是最佳结果。
binding.contentLayout.addView(
SearchResultOptimalView(
requireActivity(), dataPage
)
)
} else if (dataPage.type == 2) {//type为2的是其他搜索结果。
if (dataPage.searchResultList.isNotEmpty()) {//如何数据集合为空就不添加view
searchHistorySet.clear()
searchHistorySet.addAll(appStore.searchHistoryStore)
if (!appStore.searchHistoryStore.contains(input)) {//把不存在的记录保存到集合中
searchHistorySet.add(input)
}
appStore.searchHistoryStore = searchHistorySet
updateHistoryUi()
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_RESULT_PV)
Innertube.moSearchPage(SearchBody(query = input))
?.onSuccess { result ->
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_RESULT_SUCCESS_ACTION)
showResultContent()
for (dataPage: Innertube.SearchDataPage in result) {
LogTag.LogD(TAG, "moSearchPage dataPage->$dataPage")
if (dataPage.type == 1) {//type为1的是最佳结果。
binding.contentLayout.addView(
SearchResultOtherView(
SearchResultOptimalView(
requireActivity(), dataPage
)
)
} else if (dataPage.type == 2) {//type为2的是其他搜索结果。
if (dataPage.searchResultList.isNotEmpty()) {//如何数据集合为空就不添加view
binding.contentLayout.addView(
SearchResultOtherView(
requireActivity(), dataPage
)
)
}
}
}
}?.onFailure {
showNoContentLayout()
}
}?.onFailure {
showNoContentLayout()
}
LolAdWrapper.shared.loadAdIfNotCached(
requireActivity(), AdPlacement.INST_SEARCH
)
LolAdWrapper.shared.loadAdIfNotCached(
requireActivity(), AdPlacement.INST_SEARCH
)
}
}
}
}