Cleanup + fixes to preference category

This commit is contained in:
Jay 2019-10-27 22:46:26 -07:00
parent 2ec46a7098
commit 1d7d40ba8c
4 changed files with 9 additions and 16 deletions

View File

@ -7,7 +7,6 @@ import android.content.IntentFilter
import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.extension.model.LoadResult
import eu.kanade.tachiyomi.util.launchNow
import kotlinx.coroutines.async
/**
* Broadcast receiver that listens for the system's packages installed, updated or removed, and only
@ -91,10 +90,6 @@ internal class ExtensionInstallReceiver(private val listener: Listener) :
private suspend fun getExtensionFromIntent(context: Context, intent: Intent?): LoadResult {
val pkgName = getPackageNameFromIntent(intent) ?:
return LoadResult.Error("Package name not found")
/*var result:LoadResult = LoadResult.Error("")
launchNow {
result = async { ExtensionLoader.loadExtensionFromPkgName(context, pkgName) }.await()
}*/
return ExtensionLoader.loadExtensionFromPkgName(context, pkgName)
}

View File

@ -25,13 +25,11 @@ class PageIndicatorTextView(
override fun onDraw(canvas: Canvas) {
setTextColor(strokeColor)
//textColorField.set(this, strokeColor)
paint.strokeWidth = 4f
paint.style = Paint.Style.STROKE
super.onDraw(canvas)
setTextColor(fillColor)
//textColorField.set(this, fillColor)
paint.strokeWidth = 0f
paint.style = Paint.Style.FILL
super.onDraw(canvas)
@ -52,12 +50,4 @@ class PageIndicatorTextView(
super.setText(finalText, TextView.BufferType.SPANNABLE)
}
private companion object {
// We need to use reflection to set the text color instead of using [setTextColor],
// otherwise the view is invalidated inside [onDraw] and there's an infinite loop
/* val textColorField = TextView::class.java.getDeclaredField("mCurTextColor").apply {
isAccessible = true
}!!*/
}
}

View File

@ -42,7 +42,9 @@ inline fun PreferenceGroup.multiSelectListPreference(block: (@DSL MultiSelectLis
}
inline fun PreferenceScreen.preferenceCategory(block: (@DSL PreferenceCategory).() -> Unit): PreferenceCategory {
return addThenInit(PreferenceCategory(context), block)
return addThenInit(PreferenceCategory(context).apply {
isIconSpaceReserved = false
}, block)
}
inline fun PreferenceScreen.preferenceScreen(block: (@DSL PreferenceScreen).() -> Unit): PreferenceScreen {

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<bool name="config_materialPreferenceIconSpaceReserved" tools:ignore="MissingDefaultResource,PrivateResource">false</bool>
<dimen name="preference_category_padding_start" tools:ignore="MissingDefaultResource,PrivateResource">0dp</dimen>
</resources>