Skip to content

Commit b4cd44b

Browse files
add gestures from jitpack
1 parent db4116b commit b4cd44b

File tree

11 files changed

+23
-415
lines changed

11 files changed

+23
-415
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
### Jetpack Compose Colorful Customizable Sliders
1+
# Jetpack Compose Colorful Customizable Sliders
22

33
Colorful sliders that can have Solid or Gradient colors for thumb or track which can have thumb and
44
track with varying sizes, borders with solid or gradient colors. And Sliders with emojis, or custom
55
Composables like **Icon**.
66

7-
|Properties | Dimensions | Slider with Icon | Slider with Label | Gradient |
7+
| Slider with Icon | Gradient | Properties | Slider with Label | Dimensions |
88
| ----------|-----------| -----------| -----------| -----------|
9-
| <img src="./screenshots/slider_properties.png"/> | <img src="./screenshots/slider_dimensions.png"/> | <img src="./screenshots/slider_icons.png"/> | <img src="./screenshots/slider_labels.png"/> | <img src="./screenshots/slider_gradient.png"/> |
9+
| <img src="./screenshots/slider_icons.png"/> | <img src="./screenshots/slider_gradient.png"/> | <img src="./screenshots/slider_properties.png"/> | <img src="./screenshots/slider_labels.png"/> | <img src="./screenshots/slider_dimensions.png"/> |
1010

11-
### ColorfulSlider
11+
## ColorfulSlider
1212

1313
Sliders that can use Color or gradient for track, thumb, or tick colors with custom thumb and track
1414
heights.
@@ -122,7 +122,7 @@ data class SliderBrushColor(
122122
}
123123
```
124124

125-
### SliderWithLabel
125+
## SliderWithLabel
126126

127127
Sliders that can move a label above the Slider and display progress
128128

@@ -173,7 +173,7 @@ SliderWithLabel(
173173
)
174174
```
175175

176-
### ColorfulIconSlider
176+
## ColorfulIconSlider
177177

178178
Sliders that can use any Composable for thumb and use Color or gradient for track, thumb, or tick
179179
colors with custom thumb and track heights.

app/build.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,19 @@ dependencies {
5050
implementation project(':slider')
5151

5252
implementation 'androidx.core:core-ktx:1.7.0'
53+
implementation 'androidx.appcompat:appcompat:1.4.1'
54+
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
55+
5356
implementation "androidx.compose.ui:ui:$compose_version"
5457
implementation "androidx.compose.material:material:$compose_version"
5558
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
56-
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
5759
implementation 'androidx.activity:activity-compose:1.4.0'
5860

59-
implementation 'com.google.accompanist:accompanist-systemuicontroller:0.24.3-alpha'
60-
implementation "com.google.accompanist:accompanist-pager:0.24.3-alpha"
61-
implementation "com.google.accompanist:accompanist-pager-indicators:0.24.3-alpha"
61+
def accompanist_version = "0.24.6-alpha"
62+
// Accompanist
63+
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"
64+
implementation "com.google.accompanist:accompanist-pager:$accompanist_version"
65+
implementation "com.google.accompanist:accompanist-drawablepainter:$accompanist_version"
6266

6367
testImplementation 'junit:junit:4.13.2'
6468
androidTestImplementation 'androidx.test.ext:junit:1.1.3'

app/src/main/java/com/smarttoolfactory/composematerialslider/MainActivity.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@ import android.os.Bundle
44
import androidx.activity.ComponentActivity
55
import androidx.activity.compose.setContent
66
import androidx.compose.animation.ExperimentalAnimationApi
7-
import androidx.compose.foundation.background
87
import androidx.compose.foundation.layout.*
98
import androidx.compose.material.*
109
import androidx.compose.runtime.Composable
1110
import androidx.compose.runtime.rememberCoroutineScope
1211
import androidx.compose.ui.Modifier
1312
import androidx.compose.ui.graphics.Color
1413
import androidx.compose.ui.unit.dp
15-
import androidx.compose.ui.unit.sp
1614
import com.google.accompanist.pager.*
1715
import com.smarttoolfactory.composematerialslider.demo.*
18-
import com.smarttoolfactory.composematerialslider.ui.theme.BlueSmart
1916
import com.smarttoolfactory.composematerialslider.ui.theme.BlueSmartDark
2017
import com.smarttoolfactory.composematerialslider.ui.theme.ComposeMaterialSliderTheme
2118
import kotlinx.coroutines.launch
@@ -54,11 +51,7 @@ private fun HomeContent() {
5451
// Our selected tab is our current page
5552
selectedTabIndex = pagerState.currentPage,
5653
// Override the indicator, using the provided pagerTabIndicatorOffset modifier
57-
indicator = { tabPositions ->
58-
TabRowDefaults.Indicator(
59-
Modifier.pagerTabIndicatorOffset(pagerState, tabPositions)
60-
)
61-
}
54+
indicator = {}
6255
) {
6356
// Add tabs for all of our pages
6457
tabList.forEachIndexed { index, title ->

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
buildscript {
22
ext {
3-
compose_version = '1.2.0-alpha06'
3+
compose_version = '1.2.0-alpha07'
44
}
55
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
66
plugins {
7-
id 'com.android.application' version '7.1.2' apply false
8-
id 'com.android.library' version '7.1.2' apply false
7+
id 'com.android.application' version '7.1.3' apply false
8+
id 'com.android.library' version '7.1.3' apply false
99
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
1010
}
1111

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dependencyResolutionManagement {
1010
repositories {
1111
google()
1212
mavenCentral()
13+
maven { url 'https://jitpack.io'}
1314
}
1415
}
1516
rootProject.name = "Compose Material Slider"

slider/build.gradle

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,15 @@ android {
4444
dependencies {
4545

4646
implementation 'androidx.core:core-ktx:1.7.0'
47-
implementation 'androidx.appcompat:appcompat:1.4.1'
48-
implementation 'com.google.android.material:material:1.5.0'
47+
48+
implementation 'com.github.SmartToolFactory:Compose-Extended-Gestures:1.0.0'
4949

5050
// Jetpack Compose
5151
implementation "androidx.compose.ui:ui:$compose_version"
52-
implementation "androidx.compose.ui:ui-tooling:$compose_version"
5352
implementation "androidx.compose.material:material:$compose_version"
5453
implementation "androidx.compose.material:material-icons-extended:$compose_version"
5554
implementation "androidx.compose.runtime:runtime:$compose_version"
5655

57-
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
58-
implementation 'androidx.activity:activity-compose:1.4.0'
59-
6056
testImplementation 'junit:junit:4.13.2'
6157
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
6258
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

slider/src/main/java/com/smarttoolfactory/slider/ColorfulIconSlider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import androidx.compose.ui.layout.SubcomposeLayout
2424
import androidx.compose.ui.platform.LocalDensity
2525
import androidx.compose.ui.platform.LocalLayoutDirection
2626
import androidx.compose.ui.unit.*
27-
import com.smarttoolfactory.slider.gesture.pointerMotionEvents
27+
import com.smarttoolfactory.gesture.pointerMotionEvents
2828

2929
/**
3030
* Material Slider allows to choose height for track and thumb radius and selection between

slider/src/main/java/com/smarttoolfactory/slider/ColorfulSlider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import androidx.compose.ui.unit.Dp
2323
import androidx.compose.ui.unit.IntOffset
2424
import androidx.compose.ui.unit.LayoutDirection
2525
import androidx.compose.ui.unit.dp
26-
import com.smarttoolfactory.slider.gesture.pointerMotionEvents
26+
import com.smarttoolfactory.gesture.pointerMotionEvents
2727
import kotlin.math.abs
2828

2929
/**

slider/src/main/java/com/smarttoolfactory/slider/gesture/AwaitPointerMotionEvent.kt

Lines changed: 0 additions & 165 deletions
This file was deleted.

slider/src/main/java/com/smarttoolfactory/slider/gesture/MotionEvent.kt

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)