mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
A lil cache fixing & search fixes
This commit is contained in:
parent
60a2f7c1c5
commit
60bcbf0060
4 changed files with 11 additions and 7 deletions
|
@ -61,6 +61,7 @@ object CommonActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@MainThread
|
||||
fun showToast(act: Activity?, @StringRes message: Int, duration: Int) {
|
||||
if (act == null) return
|
||||
showToast(act, act.getString(message), duration)
|
||||
|
@ -69,6 +70,7 @@ object CommonActivity {
|
|||
const val TAG = "COMPACT"
|
||||
|
||||
/** duration is Toast.LENGTH_SHORT if null*/
|
||||
@MainThread
|
||||
fun showToast(act: Activity?, message: String?, duration: Int? = null) {
|
||||
if (act == null || message == null) {
|
||||
Log.w(TAG, "invalid showToast act = $act message = $message")
|
||||
|
|
|
@ -131,9 +131,9 @@ class SearchFragment : Fragment() {
|
|||
context?.let { ctx ->
|
||||
val default = enumValues<TvType>().sorted().filter { it != TvType.NSFW }
|
||||
.map { it.ordinal.toString() }.toSet()
|
||||
val preferredTypes = PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||
.getStringSet(this.getString(R.string.prefer_media_type_key), default)
|
||||
?.mapNotNull { it.toIntOrNull() ?: return@mapNotNull null } ?: default
|
||||
val preferredTypes = (PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||
.getStringSet(this.getString(R.string.prefer_media_type_key), default)?.ifEmpty { default } ?: default)
|
||||
.mapNotNull { it.toIntOrNull() ?: return@mapNotNull null }
|
||||
|
||||
val settings = ctx.getApiSettings()
|
||||
|
||||
|
|
|
@ -200,7 +200,9 @@ class ExtensionsFragment : Fragment() {
|
|||
val url = dialog.repo_url_input?.text?.toString()
|
||||
?.let { it1 -> RepositoryManager.parseRepoUrl(it1) }
|
||||
if (url.isNullOrBlank()) {
|
||||
showToast(activity, R.string.error_invalid_data, Toast.LENGTH_SHORT)
|
||||
main {
|
||||
showToast(activity, R.string.error_invalid_data, Toast.LENGTH_SHORT)
|
||||
}
|
||||
} else {
|
||||
val fixedName = if (!name.isNullOrBlank()) name
|
||||
else RepositoryManager.parseRepository(url)?.name ?: "No name"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue