Skip to content

Commit

Permalink
Add playground project
Browse files Browse the repository at this point in the history
  • Loading branch information
egorikftp committed Aug 5, 2024
1 parent 519cb41 commit 3a95f4e
Show file tree
Hide file tree
Showing 56 changed files with 1,374 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ bin/
### Mac OS ###
.DS_Store
.kotlin
local.properties
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import com.diffplug.gradle.spotless.SpotlessExtension

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.jetbrains.compose) apply false
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ org.gradle.parallel=true
kotlin.stdlib.default.dependency=false
kotlin.code.style=official

android.useAndroidX=true

GROUP=io.github.composegears
VERSION_NAME=0.6.0-SNAPSHOT
Expand Down
5 changes: 4 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
kotlin = "2.0.0"

[libraries]
androidx-activity-compose = "androidx.activity:activity-compose:1.9.1"
android-build-tools = "com.android.tools:sdk-common:31.5.1"

koin-compose = "io.insert-koin:koin-compose:4.0.0-RC1"
Expand All @@ -23,8 +24,10 @@ ktlint = "com.pinterest.ktlint:ktlint-cli:1.3.1"
composeRules = "io.nlopez.compose.rules:ktlint:0.4.8"

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
android-application = { id = "com.android.application", version = "8.2.0" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
jetbrains-compose = { id = "org.jetbrains.compose", version = "1.6.11" }
jetbrains-intellij = "org.jetbrains.intellij.platform:2.0.0"
spotless = "com.diffplug.spotless:7.0.0.BETA1"
Expand Down
49 changes: 49 additions & 0 deletions playground/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.jetbrains.compose)
}

android {
namespace = "io.github.composegears.valkyrie.playground"
compileSdk = 34

defaultConfig {
applicationId = "io.github.composegears.valkyrie.playground"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
}

buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {
implementation(libs.androidx.activity.compose)

implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
}
26 changes: 26 additions & 0 deletions playground/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Playground"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Playground">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package io.github.composegears.valkyrie.playground

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import io.github.composegears.valkyrie.playground.icons.backing.BackingIcons
import io.github.composegears.valkyrie.playground.icons.backing.colored.Videocam
import io.github.composegears.valkyrie.playground.icons.backing.outlined.Add
import io.github.composegears.valkyrie.playground.icons.backing.outlined.Appearance
import io.github.composegears.valkyrie.playground.icons.backing.outlined.Arrow
import io.github.composegears.valkyrie.playground.icons.backing.outlined.ArrowLeft
import io.github.composegears.valkyrie.playground.icons.backing.outlined.ArrowRight
import io.github.composegears.valkyrie.playground.icons.backing.outlined.Brightness
import io.github.composegears.valkyrie.playground.icons.backing.outlined.Car
import io.github.composegears.valkyrie.playground.icons.backing.outlined.Changelog
import io.github.composegears.valkyrie.playground.icons.lazy.LazyIcons
import io.github.composegears.valkyrie.playground.icons.lazy.colored.Videocam
import io.github.composegears.valkyrie.playground.icons.lazy.outlined.Add
import io.github.composegears.valkyrie.playground.icons.lazy.outlined.Appearance
import io.github.composegears.valkyrie.playground.icons.lazy.outlined.Arrow
import io.github.composegears.valkyrie.playground.icons.lazy.outlined.ArrowLeft
import io.github.composegears.valkyrie.playground.icons.lazy.outlined.ArrowRight
import io.github.composegears.valkyrie.playground.icons.lazy.outlined.Brightness
import io.github.composegears.valkyrie.playground.icons.lazy.outlined.Car
import io.github.composegears.valkyrie.playground.icons.lazy.outlined.Changelog
import io.github.composegears.valkyrie.playground.ui.theme.PlaygroundTheme

class MainActivity : ComponentActivity() {

@OptIn(ExperimentalFoundationApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()

setContent {
PlaygroundTheme {
val iconsSet = remember {
listOf(
IconsSet(
name = "Backing field",
icons = listOf(
BackingIcons.Colored.Videocam,
BackingIcons.Outlined.Add,
BackingIcons.Outlined.Appearance,
BackingIcons.Outlined.Arrow,
BackingIcons.Outlined.ArrowLeft,
BackingIcons.Outlined.ArrowRight,
BackingIcons.Outlined.Brightness,
BackingIcons.Outlined.Car,
BackingIcons.Outlined.Changelog,
),
),
IconsSet(
name = "Lazy field",
icons = listOf(
LazyIcons.Colored.Videocam,
LazyIcons.Outlined.Add,
LazyIcons.Outlined.Appearance,
LazyIcons.Outlined.Arrow,
LazyIcons.Outlined.ArrowLeft,
LazyIcons.Outlined.ArrowRight,
LazyIcons.Outlined.Brightness,
LazyIcons.Outlined.Car,
LazyIcons.Outlined.Changelog,
),
),
)
}
Surface(modifier = Modifier.systemBarsPadding()) {
LazyColumn(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
iconsSet.forEach { (name, icons) ->
stickyHeader {
Row(
modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.primary)
.padding(vertical = 4.dp),
) {
Text(
modifier = Modifier.padding(horizontal = 8.dp),
text = name,
color = MaterialTheme.colorScheme.onPrimary,
)
}
}
items(icons) { icon ->
Row(
modifier = Modifier.padding(
horizontal = 16.dp,
vertical = 8.dp,
),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Image(
imageVector = icon,
contentDescription = null,
)
Text(
text = icon.name,
style = MaterialTheme.typography.bodySmall,
)
}
}
}
}
}
}
}
}
}

data class IconsSet(
val name: String,
val icons: List<ImageVector>,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.github.composegears.valkyrie.playground.icons.backing

object BackingIcons {
object Outlined

object Colored
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package io.github.composegears.valkyrie.playground.icons.backing.colored

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import io.github.composegears.valkyrie.playground.icons.backing.BackingIcons
import kotlin.Suppress

val BackingIcons.Colored.Videocam: ImageVector
get() {
if (_Videocam != null) {
return _Videocam!!
}
_Videocam = ImageVector.Builder(
name = "Colored.Videocam",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f
).apply {
path(fill = SolidColor(Color(0xFF2CA5D1))) {
moveTo(15f, 8f)
verticalLineToRelative(8f)
horizontalLineTo(5f)
verticalLineTo(8f)
horizontalLineToRelative(10f)
moveToRelative(1f, -2f)
horizontalLineTo(4f)
curveToRelative(-0.55f, 0f, -1f, 0.45f, -1f, 1f)
verticalLineToRelative(10f)
curveToRelative(0f, 0.55f, 0.45f, 1f, 1f, 1f)
horizontalLineToRelative(12f)
curveToRelative(0.55f, 0f, 1f, -0.45f, 1f, -1f)
verticalLineToRelative(-3.5f)
lineToRelative(4f, 4f)
verticalLineToRelative(-11f)
lineToRelative(-4f, 4f)
verticalLineTo(7f)
curveToRelative(0f, -0.55f, -0.45f, -1f, -1f, -1f)
close()
}
}.build()

return _Videocam!!
}

@Suppress("ObjectPropertyName")
private var _Videocam: ImageVector? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.github.composegears.valkyrie.playground.icons.backing.outlined

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import io.github.composegears.valkyrie.playground.icons.backing.BackingIcons
import kotlin.Suppress

val BackingIcons.Outlined.Add: ImageVector
get() {
if (_Add != null) {
return _Add!!
}
_Add = ImageVector.Builder(
name = "Outlined.Add",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f
).apply {
path(fill = SolidColor(Color(0xFF232F34))) {
moveTo(19f, 13f)
lineTo(13f, 13f)
lineTo(13f, 19f)
lineTo(11f, 19f)
lineTo(11f, 13f)
lineTo(5f, 13f)
lineTo(5f, 11f)
lineTo(11f, 11f)
lineTo(11f, 5f)
lineTo(13f, 5f)
lineTo(13f, 11f)
lineTo(19f, 11f)
lineTo(19f, 13f)
close()
}
}.build()

return _Add!!
}

@Suppress("ObjectPropertyName")
private var _Add: ImageVector? = null
Loading

0 comments on commit 3a95f4e

Please sign in to comment.