mirror of
https://github.com/BetterAndroid/Hikage.git
synced 2025-12-07 22:23:41 +08:00
feat: add LP generic function in ViewGroup
This commit is contained in:
@@ -30,6 +30,18 @@ import com.highcapable.hikage.core.base.HikageFactoryBuilder
|
||||
import com.highcapable.hikage.core.base.HikagePerformer
|
||||
import com.highcapable.hikage.core.base.Hikageable
|
||||
|
||||
/**
|
||||
* @see ViewGroup.addView
|
||||
* @see Hikageable
|
||||
* @return [Hikage]
|
||||
*/
|
||||
@JvmName("addViewTyped")
|
||||
inline fun <reified LP : ViewGroup.LayoutParams> ViewGroup.addView(
|
||||
index: Int = -1,
|
||||
factory: HikageFactoryBuilder.() -> Unit = {},
|
||||
performer: HikagePerformer<LP>
|
||||
) = Hikageable<LP>(context = context, factory = factory, performer = performer).apply { addView(root, index) }
|
||||
|
||||
/**
|
||||
* @see ViewGroup.addView
|
||||
* @see Hikageable
|
||||
@@ -39,7 +51,7 @@ inline fun ViewGroup.addView(
|
||||
index: Int = -1,
|
||||
factory: HikageFactoryBuilder.() -> Unit = {},
|
||||
performer: HikagePerformer<ViewGroup.LayoutParams>
|
||||
) = Hikageable(context = context, factory = factory, performer = performer).apply { addView(root, index) }
|
||||
) = addView<ViewGroup.LayoutParams>(index, factory, performer)
|
||||
|
||||
/**
|
||||
* @see ViewGroup.addView
|
||||
|
||||
Reference in New Issue
Block a user