Skip to content

Commit 2092875

Browse files
committed
WIP
1 parent b84ab88 commit 2092875

File tree

6 files changed

+18
-28
lines changed

6 files changed

+18
-28
lines changed

library/src/androidMain/kotlin/ir/mahozad/multiplatform/wavyslider/Common.android.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
package ir.mahozad.multiplatform.wavyslider
22

3-
import android.view.KeyEvent.KEYCODE_MOVE_END
4-
import android.view.KeyEvent.KEYCODE_MOVE_HOME
5-
import android.view.KeyEvent.KEYCODE_PAGE_UP
6-
import android.view.KeyEvent.KEYCODE_PAGE_DOWN
7-
import android.view.KeyEvent.KEYCODE_DPAD_UP
8-
import android.view.KeyEvent.KEYCODE_DPAD_DOWN
9-
import android.view.KeyEvent.KEYCODE_DPAD_LEFT
10-
import android.view.KeyEvent.KEYCODE_DPAD_RIGHT
3+
import android.view.KeyEvent.*
114
import androidx.compose.ui.input.key.KeyEvent
125
import androidx.compose.ui.input.key.key
136
import androidx.compose.ui.input.key.nativeKeyCode

library/src/commonMain/kotlin/ir/mahozad/multiplatform/wavyslider/material3/WavySlider.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,20 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
2020
import androidx.compose.foundation.layout.*
2121
import androidx.compose.foundation.progressSemantics
2222
import androidx.compose.material3.*
23-
import androidx.compose.runtime.*
23+
import androidx.compose.runtime.Composable
24+
import androidx.compose.runtime.Stable
25+
import androidx.compose.runtime.getValue
26+
import androidx.compose.runtime.remember
2427
import androidx.compose.ui.Modifier
2528
import androidx.compose.ui.draw.rotate
2629
import androidx.compose.ui.geometry.*
27-
import androidx.compose.ui.geometry.Offset
2830
import androidx.compose.ui.graphics.Color
2931
import androidx.compose.ui.graphics.Path
3032
import androidx.compose.ui.graphics.StrokeCap
3133
import androidx.compose.ui.graphics.StrokeJoin
3234
import androidx.compose.ui.graphics.drawscope.DrawScope
3335
import androidx.compose.ui.graphics.drawscope.Stroke
34-
import androidx.compose.ui.input.key.Key
35-
import androidx.compose.ui.input.key.KeyEventType
36-
import androidx.compose.ui.input.key.key
37-
import androidx.compose.ui.input.key.onKeyEvent
38-
import androidx.compose.ui.input.key.type
36+
import androidx.compose.ui.input.key.*
3937
import androidx.compose.ui.input.pointer.pointerInput
4038
import androidx.compose.ui.layout.Layout
4139
import androidx.compose.ui.layout.layoutId

library/src/desktopTest/kotlin/ir/mahozad/multiplatform/wavyslider/ScreenshotTest.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ import ir.mahozad.multiplatform.wavyslider.WaveDirection.HEAD
1414
import org.jetbrains.skia.EncodedImageFormat
1515
import org.jetbrains.skia.Image
1616
import org.junit.Test
17-
import kotlin.io.path.*
17+
import kotlin.io.path.createTempDirectory
18+
import kotlin.io.path.div
19+
import kotlin.io.path.writeBytes
1820
import ir.mahozad.multiplatform.wavyslider.material.WavySlider as WavySlider2
1921
import ir.mahozad.multiplatform.wavyslider.material3.WavySlider as WavySlider3
2022

21-
@OptIn(ExperimentalTestApi::class)
2223
class ScreenshotTest {
2324

2425
// @get:Rule
@@ -125,7 +126,7 @@ class ScreenshotTest {
125126
WavySlider3(value = 0.5f, onValueChange = {}, waveVelocity = 0.dp to HEAD, trackThickness = 18.dp)
126127
}
127128

128-
@OptIn(InternalComposeUiApi::class)
129+
@OptIn(InternalComposeUiApi::class, ExperimentalTestApi::class)
129130
private fun runScreenshotTest(
130131
windowSize: IntSize,
131132
referenceName: String,

library/src/desktopTest/kotlin/ir/mahozad/multiplatform/wavyslider/VisualTest.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
package ir.mahozad.multiplatform.wavyslider
22

3-
import androidx.compose.animation.core.AnimationSpec
4-
import androidx.compose.animation.core.EaseOutBounce
5-
import androidx.compose.animation.core.LinearEasing
6-
import androidx.compose.animation.core.snap
7-
import androidx.compose.animation.core.tween
3+
import androidx.compose.animation.core.*
84
import androidx.compose.foundation.BorderStroke
95
import androidx.compose.foundation.background
106
import androidx.compose.foundation.border
@@ -13,7 +9,6 @@ import androidx.compose.foundation.interaction.collectIsDraggedAsState
139
import androidx.compose.foundation.layout.*
1410
import androidx.compose.material3.*
1511
import androidx.compose.material3.Slider
16-
import androidx.compose.material3.SliderDefaults
1712
import androidx.compose.runtime.*
1813
import androidx.compose.ui.Alignment
1914
import androidx.compose.ui.ExperimentalComposeUiApi
@@ -25,7 +20,10 @@ import androidx.compose.ui.input.pointer.onPointerEvent
2520
import androidx.compose.ui.platform.LocalDensity
2621
import androidx.compose.ui.platform.LocalLayoutDirection
2722
import androidx.compose.ui.unit.*
28-
import androidx.compose.ui.window.*
23+
import androidx.compose.ui.window.Window
24+
import androidx.compose.ui.window.WindowPosition
25+
import androidx.compose.ui.window.application
26+
import androidx.compose.ui.window.rememberWindowState
2927
import ir.mahozad.multiplatform.wavyslider.WaveDirection.*
3028
import ir.mahozad.multiplatform.wavyslider.material3.Track
3129
import ir.mahozad.multiplatform.wavyslider.material3.WaveAnimationSpecs

showcase/shared/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ kotlin {
4444
implementation(compose.runtime)
4545
implementation(compose.foundation)
4646
implementation(compose.material)
47-
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
4847
implementation(compose.components.resources)
4948
// api("ir.mahozad.multiplatform:wavy-slider:x.y.z")
5049
api(projects.wavySlider)

showcase/shared/src/commonMain/kotlin/showcase/App.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package showcase
22

3-
import androidx.compose.animation.core.*
3+
import androidx.compose.animation.core.snap
44
import androidx.compose.foundation.background
55
import androidx.compose.foundation.layout.Box
66
import androidx.compose.foundation.layout.Column
77
import androidx.compose.foundation.layout.size
88
import androidx.compose.material3.ExperimentalMaterial3Api
99
import androidx.compose.material3.SliderDefaults
1010
import androidx.compose.material3.SliderState
11-
import androidx.compose.runtime.*
11+
import androidx.compose.runtime.Composable
12+
import androidx.compose.runtime.remember
1213
import androidx.compose.ui.Modifier
1314
import androidx.compose.ui.graphics.Color
1415
import androidx.compose.ui.unit.dp

0 commit comments

Comments
 (0)