mirror of
https://github.com/BetterAndroid/Hikage.git
synced 2026-02-04 12:07:07 +08:00
refactor: migrate to BetterAndroid new usage
This commit is contained in:
@@ -31,7 +31,7 @@ import android.content.res.loader.AssetsProvider
|
|||||||
import android.content.res.loader.ResourcesProvider
|
import android.content.res.loader.ResourcesProvider
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import androidx.annotation.StyleRes
|
import androidx.annotation.StyleRes
|
||||||
import com.highcapable.betterandroid.system.extension.tool.AndroidVersion
|
import com.highcapable.betterandroid.system.extension.utils.AndroidVersion
|
||||||
import com.highcapable.betterandroid.ui.extension.view.inflateOrNull
|
import com.highcapable.betterandroid.ui.extension.view.inflateOrNull
|
||||||
import com.highcapable.betterandroid.ui.extension.view.layoutInflater
|
import com.highcapable.betterandroid.ui.extension.view.layoutInflater
|
||||||
import com.highcapable.hikage.core.R
|
import com.highcapable.hikage.core.R
|
||||||
@@ -194,7 +194,7 @@ internal object XmlBlockBypass {
|
|||||||
if (AndroidVersion.isAtLeast(AndroidVersion.BAKLAVA))
|
if (AndroidVersion.isAtLeast(AndroidVersion.BAKLAVA))
|
||||||
it.createQuietly(null, xmlBlock, false)
|
it.createQuietly(null, xmlBlock, false)
|
||||||
else it.createQuietly(null, xmlBlock)
|
else it.createQuietly(null, xmlBlock)
|
||||||
} ?: error("Failed to create XmlBlock\$Parser.")
|
} ?: error($$"Failed to create XmlBlock$Parser.")
|
||||||
|
|
||||||
isInitOnce = true
|
isInitOnce = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,9 +81,6 @@ class Hikage private constructor(private val factories: List<HikageFactory>) {
|
|||||||
/** The Android widget class prefix. */
|
/** The Android widget class prefix. */
|
||||||
internal const val ANDROID_WIDGET_CLASS_PREFIX = "android.widget."
|
internal const val ANDROID_WIDGET_CLASS_PREFIX = "android.widget."
|
||||||
|
|
||||||
/** The unspecified layout params value. */
|
|
||||||
private const val LayoutParamsUnspecified = LayoutParamsWrapContent - 1
|
|
||||||
|
|
||||||
/** The view constructors map. */
|
/** The view constructors map. */
|
||||||
private val viewConstructors = mutableMapOf<String, ViewConstructor<*>>()
|
private val viewConstructors = mutableMapOf<String, ViewConstructor<*>>()
|
||||||
|
|
||||||
@@ -225,7 +222,7 @@ class Hikage private constructor(private val factories: List<HikageFactory>) {
|
|||||||
* @param resolver the constructor resolver.
|
* @param resolver the constructor resolver.
|
||||||
* @param parameterCount the parameter count.
|
* @param parameterCount the parameter count.
|
||||||
*/
|
*/
|
||||||
private inner class ViewConstructor<V : View>(
|
private class ViewConstructor<V : View>(
|
||||||
private val resolver: ConstructorResolver<V>,
|
private val resolver: ConstructorResolver<V>,
|
||||||
private val parameterCount: Int
|
private val parameterCount: Int
|
||||||
) {
|
) {
|
||||||
@@ -852,8 +849,8 @@ class Hikage private constructor(private val factories: List<HikageFactory>) {
|
|||||||
* @return [LayoutParams]
|
* @return [LayoutParams]
|
||||||
*/
|
*/
|
||||||
fun LayoutParams(
|
fun LayoutParams(
|
||||||
width: Int = LayoutParamsUnspecified,
|
width: Int? = null,
|
||||||
height: Int = LayoutParamsUnspecified,
|
height: Int? = null,
|
||||||
matchParent: Boolean = false,
|
matchParent: Boolean = false,
|
||||||
widthMatchParent: Boolean = false,
|
widthMatchParent: Boolean = false,
|
||||||
heightMatchParent: Boolean = false,
|
heightMatchParent: Boolean = false,
|
||||||
@@ -893,6 +890,7 @@ class Hikage private constructor(private val factories: List<HikageFactory>) {
|
|||||||
* @param attrs the attributes set.
|
* @param attrs the attributes set.
|
||||||
* @param viewClass the view class.
|
* @param viewClass the view class.
|
||||||
*/
|
*/
|
||||||
|
@ConsistentCopyVisibility
|
||||||
data class PerformerParams internal constructor(
|
data class PerformerParams internal constructor(
|
||||||
val id: String?,
|
val id: String?,
|
||||||
val attrs: AttributeSet,
|
val attrs: AttributeSet,
|
||||||
@@ -916,8 +914,8 @@ class Hikage private constructor(private val factories: List<HikageFactory>) {
|
|||||||
* Builder params of body.
|
* Builder params of body.
|
||||||
*/
|
*/
|
||||||
private class BodyBuilder(
|
private class BodyBuilder(
|
||||||
val width: Int,
|
val width: Int?,
|
||||||
val height: Int,
|
val height: Int?,
|
||||||
val matchParent: Boolean,
|
val matchParent: Boolean,
|
||||||
val widthMatchParent: Boolean,
|
val widthMatchParent: Boolean,
|
||||||
val heightMatchParent: Boolean,
|
val heightMatchParent: Boolean,
|
||||||
@@ -951,8 +949,8 @@ class Hikage private constructor(private val factories: List<HikageFactory>) {
|
|||||||
current: Hikage,
|
current: Hikage,
|
||||||
lpClass: Class<LP>,
|
lpClass: Class<LP>,
|
||||||
parent: ViewGroup?,
|
parent: ViewGroup?,
|
||||||
width: Int,
|
width: Int?,
|
||||||
height: Int,
|
height: Int?,
|
||||||
matchParent: Boolean,
|
matchParent: Boolean,
|
||||||
widthMatchParent: Boolean,
|
widthMatchParent: Boolean,
|
||||||
heightMatchParent: Boolean,
|
heightMatchParent: Boolean,
|
||||||
|
|||||||
Reference in New Issue
Block a user