Skip to content

Commit

Permalink
Merge pull request #4 from HuixingWong/main
Browse files Browse the repository at this point in the history
support multi-platform
  • Loading branch information
Rebecca Franks authored Nov 8, 2021
2 parents 0c26177 + 0e346b7 commit 8c3b31f
Show file tree
Hide file tree
Showing 21 changed files with 344 additions and 238 deletions.
66 changes: 0 additions & 66 deletions app/build.gradle

This file was deleted.

39 changes: 39 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

plugins {
id("org.jetbrains.compose") version "1.0.0-beta5"
id("com.android.application")
kotlin("android")
}

group = "com.godaddy"
version = "1.0"


dependencies {
implementation(project(":color-picker"))
implementation ("androidx.activity:activity-compose:1.4.0")
implementation("com.google.android.material:material:1.4.0")
}

android {
compileSdkVersion(31)
defaultConfig {
applicationId = "com.godaddy.android.colorpicker"
minSdkVersion(21)
targetSdkVersion(31)
versionCode = 1
versionName = "1.0"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
packagingOptions {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ExperimentalGraphicsApi
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.godaddy.android.colorpicker.theme.ComposeColorPickerTheme

Expand Down Expand Up @@ -87,7 +86,6 @@ fun ColorPreviewInfo(currentColor: Color) {


@ExperimentalGraphicsApi
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
ComposeColorPickerTheme {
Expand All @@ -102,7 +100,6 @@ fun DefaultPreview() {
}

@ExperimentalGraphicsApi
@Preview(showBackground = true)
@Composable
fun NoAlphaBarPreview() {
ComposeColorPickerTheme {
Expand Down
19 changes: 0 additions & 19 deletions build.gradle

This file was deleted.

25 changes: 25 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31")
classpath("com.android.tools.build:gradle:4.1.3")
classpath("com.vanniktech:gradle-maven-publish-plugin:0.18.0")
}
}

group = "com.godaddy"
version = "1.0"

allprojects {
repositories {
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
}
61 changes: 0 additions & 61 deletions color-picker/build.gradle

This file was deleted.

66 changes: 66 additions & 0 deletions color-picker/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import org.jetbrains.compose.compose

plugins {
kotlin("multiplatform")
id("org.jetbrains.compose") version "1.0.0-beta5"
id("com.android.library")
id("kotlin-android-extensions")
id("com.vanniktech.maven.publish")
}

group = "com.godaddy"
version = "1.0"

kotlin {
android()
jvm("desktop") {
compilations.all {
kotlinOptions.jvmTarget = "11"
}
}
sourceSets {
val commonMain by getting {
dependencies {
api(compose.runtime)
api(compose.foundation)
api(compose.material)
implementation("com.github.ajalt.colormath:colormath:3.1.1")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val androidMain by getting {
dependencies {
api("androidx.appcompat:appcompat:1.3.1")
api("androidx.core:core-ktx:1.6.0")
}
}
val androidTest by getting {
dependencies {
implementation("junit:junit:4.13.2")
}
}
val desktopMain by getting {
dependencies {
api(compose.preview)
}
}
val desktopTest by getting
}
}

android {
compileSdkVersion(31)
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdkVersion(21)
targetSdkVersion(31)
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.godaddy.android.colorpicker">
package="com.godaddy.common.colorpicker">

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fun ClassicColorPicker(
showAlphaBar: Boolean = true,
onColorChanged: (HsvColor) -> Unit
) {
val colorPickerValueState = rememberSaveable {
val colorPickerValueState = rememberSaveable(stateSaver = HsvColor.Saver) {
mutableStateOf(HsvColor.from(color))
}
Row(modifier = modifier) {
Expand Down
Loading

0 comments on commit 8c3b31f

Please sign in to comment.