Skip to content

Commit

Permalink
use new group id com.kmpalette
Browse files Browse the repository at this point in the history
  • Loading branch information
jordond committed Sep 17, 2023
1 parent 3a434c1 commit 0565e0a
Show file tree
Hide file tree
Showing 95 changed files with 244 additions and 251 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img width="500px" src="art/logo.png" alt="logo"/>
<br />

![Maven Central](https://img.shields.io/maven-central/v/dev.jordond.kmpalette/kmpalette)
![Maven Central](https://img.shields.io/maven-central/v/com.kmpalette/kmpalette)
[![Kotlin](https://img.shields.io/badge/kotlin-v1.9.10-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![Build](https://github.com/jordond/kmpalette/actions/workflows/ci.yml/badge.svg)](https://github.com/jordond/kmpalette/actions/workflows/ci.yml)
[![License](https://img.shields.io/github/license/jordond/kmPalette)](https://opensource.org/license/mit/)
Expand Down Expand Up @@ -76,13 +76,13 @@ In `libs.versions.toml`:
kmpalette = "1.0.0"

[libraries]
kmpalette-core = { module = "dev.jordond.kmpalette:kmpalette-core", version.ref = "kmpalette" }
kmpalette-core = { module = "com.kmpalette:kmpalette-core", version.ref = "kmpalette" }
# Optional source libraries
kmpalette-extensions-base64 = { module = "dev.jordond.kmpalette:extensions-base64", version.ref = "kmpalette" }
kmpalette-extensions-bytearray = { module = "dev.jordond.kmpalette:extensions-bytearray", version.ref = "kmpalette" }
kmpalette-extensions-libres = { module = "dev.jordond.kmpalette:extensions-libres", version.ref = "kmpalette" }
kmpalette-extensions-network = { module = "dev.jordond.kmpalette:extensions-network", version.ref = "kmpalette" }
kmpalette-extensions-resources = { module = "dev.jordond.kmpalette:extensions-resources", version.ref = "kmpalette" }
kmpalette-extensions-base64 = { module = "com.kmpalette:extensions-base64", version.ref = "kmpalette" }
kmpalette-extensions-bytearray = { module = "com.kmpalette:extensions-bytearray", version.ref = "kmpalette" }
kmpalette-extensions-libres = { module = "com.kmpalette:extensions-libres", version.ref = "kmpalette" }
kmpalette-extensions-network = { module = "com.kmpalette:extensions-network", version.ref = "kmpalette" }
kmpalette-extensions-resources = { module = "com.kmpalette:extensions-resources", version.ref = "kmpalette" }
```

To add to a multiplatform project, add the dependency to the common source-set:
Expand Down
3 changes: 1 addition & 2 deletions androidx-palette/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ kotlin {
}

android {
namespace = "dev.jordond.kmpalette.palette"
namespace = "com.kmpalette.palette"

compileSdk = libs.versions.sdk.compile.get().toInt()
defaultConfig {
Expand All @@ -83,7 +83,6 @@ android {

sourceSets["main"].apply {
res.srcDirs("src/androidInstrumentedTest/res")
// res.srcDirs("src/androidTest/res")
}

kotlin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.jordond.kmpalette.graphics
package androidx.palette.graphics

import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import androidx.compose.ui.graphics.asImageBitmap
import androidx.palette.graphics.TestUtils.assertCloseColors
import androidx.palette.graphics.TestUtils.loadSampleBitmap
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import dev.jordond.kmpalette.graphics.TestUtils.assertCloseColors
import dev.jordond.kmpalette.graphics.TestUtils.loadSampleBitmap
import dev.jordond.kmpalette.palette.graphics.Palette
import dev.jordond.kmpalette.palette.graphics.Palette.Swatch
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.junit.Assert
Expand All @@ -39,10 +37,10 @@ class BucketTests {
@Test
@SmallTest
fun testSwatchesBuilder() {
val swatches = ArrayList<Swatch>()
swatches.add(Swatch(Color.BLACK, 40))
swatches.add(Swatch(Color.GREEN, 60))
swatches.add(Swatch(Color.BLUE, 10))
val swatches = ArrayList<Palette.Swatch>()
swatches.add(Palette.Swatch(Color.BLACK, 40))
swatches.add(Palette.Swatch(Color.GREEN, 60))
swatches.add(Palette.Swatch(Color.BLUE, 10))
val p = Palette.from(swatches)
Assert.assertEquals(swatches, p.swatches)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
*/
@file:OptIn(ExperimentalCoroutinesApi::class)

package dev.jordond.kmpalette.graphics
package androidx.palette.graphics

import androidx.compose.ui.graphics.ImageBitmap
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import dev.jordond.kmpalette.palette.graphics.Palette
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.junit.Assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
*/
@file:OptIn(ExperimentalCoroutinesApi::class)

package dev.jordond.kmpalette.graphics
package androidx.palette.graphics

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import dev.jordond.kmpalette.graphics.TestUtils.loadSampleBitmap
import dev.jordond.kmpalette.palette.graphics.Palette
import androidx.palette.graphics.TestUtils.loadSampleBitmap
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.junit.Assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@

@file:OptIn(ExperimentalCoroutinesApi::class)

package dev.jordond.kmpalette.graphics
package androidx.palette.graphics

import android.graphics.Color
import androidx.core.graphics.ColorUtils
import androidx.palette.graphics.Palette.Swatch
import androidx.palette.graphics.TestUtils.loadSampleBitmap
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import dev.jordond.kmpalette.graphics.TestUtils.loadSampleBitmap
import dev.jordond.kmpalette.palette.graphics.Palette
import dev.jordond.kmpalette.palette.graphics.Palette.Swatch
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.junit.Assert
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package dev.jordond.kmpalette.graphics
package androidx.palette.graphics

import android.content.Context
import android.graphics.BitmapFactory
import android.graphics.Color
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.asImageBitmap
import androidx.test.core.app.ApplicationProvider
import dev.jordond.kmpalette.palette.test.R
import com.kmpalette.palette.test.R
import kotlin.test.assertEquals

internal object TestUtils {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette.palette.internal
package com.kmpalette.palette.internal

import android.graphics.Bitmap
import androidx.compose.ui.graphics.ImageBitmap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.jordond.kmpalette.palette.graphics
package androidx.palette.graphics

import androidx.annotation.ColorInt
import androidx.collection.SimpleArrayMap
import androidx.collection.SparseArrayCompat
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.ImageBitmap
import androidx.palette.graphics.Palette.Builder
import com.kmpalette.palette.internal.ColorCutQuantizer
import com.kmpalette.palette.internal.scale
import com.kmpalette.palette.internal.utils.ColorUtils
import dev.drewhamilton.poko.Poko
import dev.jordond.kmpalette.palette.graphics.Palette.Builder
import dev.jordond.kmpalette.palette.internal.ColorCutQuantizer
import dev.jordond.kmpalette.palette.internal.scale
import dev.jordond.kmpalette.palette.internal.utils.ColorUtils
import kotlin.math.abs
import kotlin.math.ceil
import kotlin.math.floor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.jordond.kmpalette.palette.graphics
package androidx.palette.graphics

/**
* A class which allows custom selection of colors in a [Palette]'s generation. Instances
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette.palette.internal
package com.kmpalette.palette.internal

import androidx.compose.ui.graphics.ImageBitmap

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.jordond.kmpalette.palette.internal
package com.kmpalette.palette.internal

import dev.jordond.kmpalette.palette.graphics.Palette
import dev.jordond.kmpalette.palette.internal.utils.ColorUtils
import dev.jordond.kmpalette.palette.internal.utils.PriorityQueue
import androidx.palette.graphics.Palette
import com.kmpalette.palette.internal.utils.ColorUtils
import com.kmpalette.palette.internal.utils.PriorityQueue
import kotlin.math.min
import kotlin.math.round

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette.palette.internal.utils
package com.kmpalette.palette.internal.utils

import androidx.annotation.ColorInt
import androidx.annotation.FloatRange
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette.palette.internal.utils
package com.kmpalette.palette.internal.utils

internal class PriorityQueue<T>(
private val comparator: Comparator<in T>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette.palette.internal.utils
package com.kmpalette.palette.internal.utils

import kotlin.math.pow

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.jordond.kmpalette.palette.internal.utils
package com.kmpalette.palette.internal.utils

import com.kmpalette.palette.internal.utils.ColorUtils
import kotlin.math.pow
import kotlin.math.roundToInt
import kotlin.test.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.jordond.kmpalette.palette.internal.utils
package com.kmpalette.palette.internal.utils

import com.kmpalette.palette.internal.utils.pow
import kotlin.test.Test
import kotlin.test.assertTrue

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette.palette.internal
package com.kmpalette.palette.internal

import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.toAwtImage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette.palette.internal
package com.kmpalette.palette.internal

import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.asComposeImageBitmap
Expand Down
6 changes: 3 additions & 3 deletions demo/composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ kotlin {
}

android {
namespace = "dev.jordond.kmpalette.demo"
namespace = "com.kmpalette.demo"
compileSdk = libs.versions.sdk.compile.get().toInt()

defaultConfig {
minSdk = libs.versions.sdk.min.get().toInt()
targetSdk = libs.versions.sdk.target.get().toInt()

applicationId = "dev.jordond.kmpalette.demo"
applicationId = "com.kmpalette.demo"
versionCode = 1
versionName = "1.0.0"
}
Expand All @@ -127,7 +127,7 @@ compose.desktop {

nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "dev.jordond.kmpalette.desktopApp"
packageName = "com.kmpalette.desktopApp"
packageVersion = "1.0.0"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette.demo
package com.kmpalette.demo

import android.app.Activity
import android.app.Application
Expand All @@ -9,7 +9,7 @@ import androidx.compose.runtime.SideEffect
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat
import androidx.fragment.app.FragmentActivity
import dev.jordond.kmpalette.App
import com.kmpalette.demo.App

class AndroidApp : Application() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette
package com.kmpalette.demo

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette
package com.kmpalette.demo

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -12,12 +12,12 @@ import androidx.compose.ui.graphics.Color
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import dev.jordond.kmpalette.dominant.Base64DemoScreen
import dev.jordond.kmpalette.dominant.DominantPhotoColorScreen
import dev.jordond.kmpalette.dominant.NetworkDemoScreen
import dev.jordond.kmpalette.palette.LibresPaletteScreen
import dev.jordond.kmpalette.palette.ResourcesPaletteScreen
import dev.jordond.kmpalette.theme.AppTheme
import com.kmpalette.demo.dominant.Base64DemoScreen
import com.kmpalette.demo.dominant.DominantPhotoColorScreen
import com.kmpalette.demo.dominant.NetworkDemoScreen
import com.kmpalette.demo.palette.LibresPaletteScreen
import com.kmpalette.demo.palette.ResourcesPaletteScreen
import com.kmpalette.demo.theme.AppTheme

class HomeScreen : Screen {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette.dominant
package com.kmpalette.demo.dominant

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -9,8 +9,8 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.ImageBitmap
import cafe.adriel.voyager.core.screen.Screen
import dev.jordond.kmpalette.loader.Base64Loader
import dev.jordond.kmpalette.rememberDominantColorState
import com.kmpalette.loader.Base64Loader
import com.kmpalette.rememberDominantColorState
import kotlin.io.encoding.ExperimentalEncodingApi

private const val demoBase64Image =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette.dominant
package com.kmpalette.demo.dominant

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
Expand Down Expand Up @@ -33,24 +33,24 @@ import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.core.screen.Screen
import com.kmpalette.DominantColorState
import com.kmpalette.PaletteResult
import com.kmpalette.demo.theme.AppTheme
import com.kmpalette.demo.util.ColorBox
import com.kmpalette.demo.util.colorSchemePairs
import com.kmpalette.rememberDominantColorState
import com.materialkolor.PaletteStyle
import com.mohamedrejeb.calf.io.readByteArray
import com.mohamedrejeb.calf.picker.FilePickerFileType
import com.mohamedrejeb.calf.picker.FilePickerSelectionMode
import com.mohamedrejeb.calf.picker.rememberFilePickerLauncher
import com.mohamedrejeb.calf.picker.toImageBitmap
import dev.jordond.kmpalette.DominantColorState
import dev.jordond.kmpalette.PaletteResult
import dev.jordond.kmpalette.rememberDominantColorState
import dev.jordond.kmpalette.theme.AppTheme
import dev.jordond.kmpalette.util.ColorBox
import dev.jordond.kmpalette.util.colorSchemePairs

class DominantPhotoColorScreen : Screen {

@Composable
override fun Content() {
val dominantColorState = rememberDominantColorState() {
val dominantColorState = rememberDominantColorState {
clearFilters()
}
var selectedPhoto: ImageBitmap? by remember { mutableStateOf(null) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.jordond.kmpalette.dominant
package com.kmpalette.demo.dominant

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -9,8 +9,8 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.ImageBitmap
import cafe.adriel.voyager.core.screen.Screen
import dev.jordond.kmpalette.loader.NetworkLoader
import dev.jordond.kmpalette.rememberDominantColorState
import com.kmpalette.loader.NetworkLoader
import com.kmpalette.rememberDominantColorState
import io.ktor.http.Url

class NetworkDemoScreen : Screen {
Expand Down
Loading

0 comments on commit 0565e0a

Please sign in to comment.