Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support multi-platform #4

Merged
merged 9 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly thinking out loud here, but I'm wondering if there isn't a way to only use this dependency only if its the Desktop version, and if that makes sense to do. I think all we need it for is color conversions to and from HSV right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true that we can rely on this only on the desktop, but there are a lot of color conversion tools in this library, and since I don't know so much about color things , it might be useful to keep it if you want to expand other functions for this library in the future, What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me give it a bit more thinking and chat with the rest of the GoDaddy Studio Android Team about it tomorrow.

Otherwise, the PR looks good and it is now working for me on Desktop. I'll revert back tomorrow 👍🏻

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright I think we are good to go with this library 💯 Thanks so much for the contribution, merging it now.

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