refactor: move resources to flexiui-resources

This commit is contained in:
2023-11-23 01:46:55 +08:00
parent 845606a59a
commit 6190a4fccf
13 changed files with 77 additions and 1 deletions

1
flexiui-resources/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,64 @@
plugins {
autowire(libs.plugins.kotlin.multiplatform)
autowire(libs.plugins.android.library)
autowire(libs.plugins.jetbrains.compose)
}
group = property.project.groupName
kotlin {
androidTarget()
jvm("desktop")
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64(),
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = projects.flexiuiResources.name
isStatic = true
}
}
jvmToolchain(17)
sourceSets {
val commonMain by getting {
dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
}
}
val androidMain by getting
val desktopMain by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}
}
android {
namespace = property.project.groupName
compileSdk = property.project.android.compileSdk
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res")
sourceSets["main"].resources.srcDirs("src/commonMain/resources")
defaultConfig {
minSdk = property.project.android.minSdk
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

View File

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

View File

@@ -0,0 +1,26 @@
/*
* Flexi UI - A flexible and useful UI component library.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/BetterAndroid/FlexiUI
*
* 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 2023/11/10.
*/
@file:Suppress("unused")
package com.highcapable.flexiui.resources
object Icons

View File

@@ -0,0 +1,51 @@
/*
* Flexi UI - A flexible and useful UI component library.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/BetterAndroid/FlexiUI
*
* 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 2023/11/11.
*/
@file:Suppress("unused")
package com.highcapable.flexiui.resources.builder
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.DefaultGroupName
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.Dp
internal inline fun buildImageVector(
name: String = DefaultGroupName,
defaultWidth: Dp,
defaultHeight: Dp,
viewportWidth: Float,
viewportHeight: Float,
tintColor: Color = Color.Unspecified,
tintBlendMode: BlendMode = BlendMode.SrcIn,
autoMirror: Boolean = false,
builder: ImageVector.Builder.() -> Unit
) = ImageVector.Builder(
name = name,
defaultWidth = defaultWidth,
defaultHeight = defaultHeight,
viewportWidth = viewportWidth,
viewportHeight = viewportHeight,
tintColor = tintColor,
tintBlendMode = tintBlendMode,
autoMirror = autoMirror
).apply(builder).build()

View File

@@ -0,0 +1,89 @@
/*
* Flexi UI - A flexible and useful UI component library.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/BetterAndroid/FlexiUI
*
* 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 2023/11/19.
*/
@file:Suppress("unused")
package com.highcapable.flexiui.resources.icon
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.highcapable.flexiui.resources.Icons
import com.highcapable.flexiui.resources.builder.buildImageVector
val Icons.Backspace by lazy {
buildImageVector(
name = "backspace",
defaultWidth = 32.dp,
defaultHeight = 32.dp,
viewportWidth = 48f,
viewportHeight = 48f
) {
path(
fillAlpha = 1.0f,
stroke = SolidColor(Color.White),
strokeAlpha = 1.0f,
strokeLineWidth = 4f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Miter,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(14f, 11f)
lineTo(4f, 24f)
lineTo(14f, 37f)
horizontalLineTo(44f)
verticalLineTo(11f)
horizontalLineTo(14f)
close()
}
path(
fillAlpha = 1.0f,
stroke = SolidColor(Color.White),
strokeAlpha = 1.0f,
strokeLineWidth = 4f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Miter,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(21f, 19f)
lineTo(31f, 29f)
}
path(
fillAlpha = 1.0f,
stroke = SolidColor(Color.White),
strokeAlpha = 1.0f,
strokeLineWidth = 4f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Miter,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(31f, 19f)
lineTo(21f, 29f)
}
}
}

View File

@@ -0,0 +1,59 @@
/*
* Flexi UI - A flexible and useful UI component library.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/BetterAndroid/FlexiUI
*
* 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 2023/11/11.
*/
@file:Suppress("unused")
package com.highcapable.flexiui.resources.icon
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.highcapable.flexiui.resources.Icons
import com.highcapable.flexiui.resources.builder.buildImageVector
val Icons.CheckMark by lazy {
buildImageVector(
name = "check_mark",
defaultWidth = 32.dp,
defaultHeight = 32.dp,
viewportWidth = 48f,
viewportHeight = 48f
) {
path(
fillAlpha = 1.0f,
stroke = SolidColor(Color.White),
strokeAlpha = 1.0f,
strokeLineWidth = 7f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Round,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(43f, 11f)
lineTo(16.875f, 37f)
lineTo(5f, 25.1818f)
}
}
}

View File

@@ -0,0 +1,67 @@
/*
* Flexi UI - A flexible and useful UI component library.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/BetterAndroid/FlexiUI
*
* 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 2023/11/17.
*/
@file:Suppress("unused")
package com.highcapable.flexiui.resources.icon
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.highcapable.flexiui.resources.Icons
import com.highcapable.flexiui.resources.builder.buildImageVector
val Icons.Dropdown by lazy {
buildImageVector(
name = "dropdown",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f
) {
path(
fill = SolidColor(Color.White),
fillAlpha = 1.0f,
strokeAlpha = 1.0f,
strokeLineWidth = 1.0f,
strokeLineCap = StrokeCap.Butt,
strokeLineJoin = StrokeJoin.Miter,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(8.12f, 9.29f)
lineTo(12f, 13.17f)
lineToRelative(3.88f, -3.88f)
curveToRelative(0.39f, -0.39f, 1.02f, -0.39f, 1.41f, 0f)
curveToRelative(0.39f, 0.39f, 0.39f, 1.02f, 0f, 1.41f)
lineToRelative(-4.59f, 4.59f)
curveToRelative(-0.39f, 0.39f, -1.02f, 0.39f, -1.41f, 0f)
lineTo(6.7f, 10.7f)
curveToRelative(-0.39f, -0.39f, -0.39f, -1.02f, 0f, -1.41f)
curveToRelative(0.39f, -0.38f, 1.03f, -0.39f, 1.42f, 0f)
close()
}
}
}

View File

@@ -0,0 +1,113 @@
/*
* Flexi UI - A flexible and useful UI component library.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/BetterAndroid/FlexiUI
*
* 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 2023/11/18.
*/
@file:Suppress("unused")
package com.highcapable.flexiui.resources.icon
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.highcapable.flexiui.resources.Icons
import com.highcapable.flexiui.resources.builder.buildImageVector
val Icons.ViewerClose by lazy {
buildImageVector(
name = "viewer_close",
defaultWidth = 32.dp,
defaultHeight = 32.dp,
viewportWidth = 48f,
viewportHeight = 48f
) {
path(
fillAlpha = 1.0f,
stroke = SolidColor(Color.White),
strokeAlpha = 1.0f,
strokeLineWidth = 4f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Round,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(6f, 16f)
curveTo(6.6347f, 17.2193f, 7.5965f, 18.3504f, 8.8228f, 19.3554f)
curveTo(12.261f, 22.1733f, 17.779f, 24f, 24f, 24f)
curveTo(30.221f, 24f, 35.739f, 22.1733f, 39.1772f, 19.3554f)
curveTo(40.4035f, 18.3504f, 41.3653f, 17.2193f, 42f, 16f)
}
path(
fillAlpha = 1.0f,
stroke = SolidColor(Color.White),
strokeAlpha = 1.0f,
strokeLineWidth = 4f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Round,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(28.9775f, 24f)
lineTo(31.048f, 31.7274f)
}
path(
fillAlpha = 1.0f,
stroke = SolidColor(Color.White),
strokeAlpha = 1.0f,
strokeLineWidth = 4f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Round,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(37.3535f, 21.3536f)
lineTo(43.0103f, 27.0104f)
}
path(
fillAlpha = 1.0f,
stroke = SolidColor(Color.White),
strokeAlpha = 1.0f,
strokeLineWidth = 4f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Round,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(5.00004f, 27.0103f)
lineTo(10.6569f, 21.3534f)
}
path(
fillAlpha = 1.0f,
stroke = SolidColor(Color.White),
strokeAlpha = 1.0f,
strokeLineWidth = 4f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Round,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(16.9278f, 31.7276f)
lineTo(18.9983f, 24.0001f)
}
}
}

View File

@@ -0,0 +1,79 @@
/*
* Flexi UI - A flexible and useful UI component library.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/BetterAndroid/FlexiUI
*
* 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 2023/11/18.
*/
@file:Suppress("unused")
package com.highcapable.flexiui.resources.icon
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import com.highcapable.flexiui.resources.Icons
import com.highcapable.flexiui.resources.builder.buildImageVector
val Icons.ViewerOpen by lazy {
buildImageVector(
name = "viewer_open",
defaultWidth = 32.dp,
defaultHeight = 32.dp,
viewportWidth = 48f,
viewportHeight = 48f
) {
path(
fillAlpha = 1.0f,
stroke = SolidColor(Color.White),
strokeAlpha = 1.0f,
strokeLineWidth = 4f,
strokeLineCap = StrokeCap.Butt,
strokeLineJoin = StrokeJoin.Round,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(24f, 36f)
curveTo(35.0457f, 36f, 44f, 24f, 44f, 24f)
curveTo(44f, 24f, 35.0457f, 12f, 24f, 12f)
curveTo(12.9543f, 12f, 4f, 24f, 4f, 24f)
curveTo(4f, 24f, 12.9543f, 36f, 24f, 36f)
close()
}
path(
fillAlpha = 1.0f,
stroke = SolidColor(Color.White),
strokeAlpha = 1.0f,
strokeLineWidth = 4f,
strokeLineCap = StrokeCap.Butt,
strokeLineJoin = StrokeJoin.Round,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(24f, 29f)
curveTo(26.7614f, 29f, 29f, 26.7614f, 29f, 24f)
curveTo(29f, 21.2386f, 26.7614f, 19f, 24f, 19f)
curveTo(21.2386f, 19f, 19f, 21.2386f, 19f, 24f)
curveTo(19f, 26.7614f, 21.2386f, 29f, 24f, 29f)
close()
}
}
}