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:
2025-04-20 05:32:06 +08:00
parent 794c535789
commit 99abe3cd18
218 changed files with 13256 additions and 627 deletions

View File

@@ -0,0 +1,52 @@
plugins {
autowire(libs.plugins.android.library)
autowire(libs.plugins.kotlin.android)
autowire(libs.plugins.compose.compiler)
autowire(libs.plugins.kotlin.dokka)
autowire(libs.plugins.maven.publish)
}
group = property.project.groupName
version = property.project.hikage.extension.compose.version
android {
namespace = property.project.hikage.extension.compose.namespace
compileSdk = property.project.android.compileSdk
defaultConfig {
minSdk = property.project.android.minSdk
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
dependencies {
implementation(projects.hikageCore)
implementation(com.highcapable.yukireflection.api)
implementation(com.highcapable.betterandroid.ui.extension)
implementation(com.highcapable.betterandroid.system.extension)
implementation(androidx.core.core.ktx)
implementation(androidx.appcompat.appcompat)
implementation(androidx.compose.ui.ui)
testImplementation(junit.junit)
androidTestImplementation(androidx.test.ext.junit)
androidTestImplementation(androidx.test.espresso.espresso.core)
}

View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -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)
}
}

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@@ -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) }
}
}

View File

@@ -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
)
}

View File

@@ -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)
}
}