mirror of
https://github.com/BetterAndroid/Hikage.git
synced 2025-12-13 04:51:13 +08:00
Bump hikage-core, hikage-extension, hikage-extension-betterandroid, hikage-extension-compose, hikage-compiler, hikage-widget-androidx, hikage-widget-material version to 1.0.0
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.highcapable.hikage
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.highcapable.hikage.test", appContext.packageName)
|
||||
}
|
||||
}
|
||||
2
hikage-extension-compose/src/main/AndroidManifest.xml
Normal file
2
hikage-extension-compose/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest />
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Hikage - An Android responsive UI building tool.
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/BetterAndroid/Hikage
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is created by fankes on 2025/2/28.
|
||||
*/
|
||||
@file:Suppress("unused", "FunctionName")
|
||||
@file:JvmName("ComposeViewPerformer")
|
||||
|
||||
package com.highcapable.hikage.extension.androidx.compose
|
||||
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import com.highcapable.hikage.annotation.Hikageable
|
||||
import com.highcapable.hikage.core.Hikage
|
||||
import com.highcapable.hikage.core.base.HikageView
|
||||
|
||||
/**
|
||||
* Composable in [Hikage].
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* ```kotlin
|
||||
* Hikageable {
|
||||
* ComposeView(
|
||||
* lparams = LayoutParams(matchParent = true)
|
||||
* ) {
|
||||
* Text("Hello, Compose in Hikage!")
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* @see ComposeView
|
||||
* @see Hikage.Performer.View
|
||||
*/
|
||||
@Hikageable
|
||||
inline fun <LP : ViewGroup.LayoutParams> Hikage.Performer<LP>.ComposeView(
|
||||
lparams: Hikage.LayoutParams? = null,
|
||||
id: String? = null,
|
||||
init: HikageView<ComposeView> = {},
|
||||
noinline content: (@Composable () -> Unit)? = null
|
||||
) {
|
||||
View<ComposeView>(lparams, id) {
|
||||
init(this)
|
||||
content?.let { setContent(it) }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Hikage - An Android responsive UI building tool.
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/BetterAndroid/Hikage
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is created by fankes on 2025/3/12.
|
||||
*/
|
||||
@file:Suppress("unused")
|
||||
@file:JvmName("HikageViewUtils")
|
||||
|
||||
package com.highcapable.hikage.extension.androidx.compose
|
||||
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.UiComposable
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import com.highcapable.hikage.core.Hikage
|
||||
import com.highcapable.hikage.core.base.HikageFactoryBuilder
|
||||
import com.highcapable.hikage.core.base.HikagePerformer
|
||||
import com.highcapable.hikage.core.base.Hikageable
|
||||
|
||||
/**
|
||||
* [Hikage] in composable.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* ```kotlin
|
||||
* Column(
|
||||
* modifier = Modifier.fillMaxSize()
|
||||
* ) {
|
||||
* HikageView {
|
||||
* TextView(
|
||||
* lparams = LayoutParams(matchParent = true)
|
||||
* ) {
|
||||
* text = "Hello, Hikage in Compose!"
|
||||
* textSize = 20f
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* @see AndroidView
|
||||
*/
|
||||
@Composable
|
||||
@UiComposable
|
||||
fun HikageView(
|
||||
modifier: Modifier = Modifier,
|
||||
update: (View) -> Unit = {},
|
||||
factory: HikageFactoryBuilder.() -> Unit = {},
|
||||
performer: HikagePerformer<ViewGroup.LayoutParams>
|
||||
) {
|
||||
AndroidView(
|
||||
factory = { context ->
|
||||
Hikageable(
|
||||
context = context,
|
||||
factory = factory,
|
||||
performer = performer
|
||||
).root
|
||||
},
|
||||
modifier = modifier,
|
||||
update = update
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* [Hikage] in composable.
|
||||
* @see AndroidView
|
||||
* @param delegate the [Hikage.Delegate] instance.
|
||||
*/
|
||||
@Composable
|
||||
@UiComposable
|
||||
fun HikageView(
|
||||
delegate: Hikage.Delegate<*>,
|
||||
modifier: Modifier = Modifier,
|
||||
update: (View) -> Unit = {}
|
||||
) {
|
||||
AndroidView(
|
||||
factory = { context ->
|
||||
delegate.create(context).root
|
||||
},
|
||||
modifier = modifier,
|
||||
update = update
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.highcapable.hikage
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user