Skip to content

Commit fffa2f9

Browse files
authored
chore: merge branch dev into main
2 parents 3ef9802 + 71d3ed9 commit fffa2f9

File tree

8 files changed

+28
-169
lines changed

8 files changed

+28
-169
lines changed

build.gradle.kts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
plugins {
2-
id("com.android.application") version "8.2.2" apply false
3-
id("com.android.library") version "8.2.2" apply false
4-
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
2+
id("com.android.application") version "8.5.2" apply false
3+
id("com.android.library") version "8.5.2" apply false
4+
id("org.jetbrains.kotlin.android") version "1.9.25" apply false
55
}
66

7-
val libraryVersionName by extra { "2.0.1" }
8-
val libraryVersionCode by extra { 20110 }
7+
val libraryVersionName by extra { "2.1.0" }
8+
val libraryVersionCode by extra { 21010 }
99

10-
val coreVersion by extra { "1.12.0" }
11-
val composeCompilerVersion by extra { "1.5.8" }
12-
val composeVersion by extra { "1.6.0" }
13-
val material3Version by extra { "1.2.0" }
10+
val coreVersion by extra { "1.13.1" }
11+
val composeCompilerVersion by extra { "1.5.15" }
12+
val composeMaterialVersion by extra { "1.7.0" }
13+
val composeMaterial3Version by extra { "1.3.0" }

demo/build.gradle.kts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ val libraryVersionCode: Int by rootProject.extra
88

99
val coreVersion: String by rootProject.extra
1010
val composeCompilerVersion: String by rootProject.extra
11-
val composeVersion: String by rootProject.extra
12-
val material3Version: String by rootProject.extra
11+
val composeMaterialVersion: String by rootProject.extra
12+
val composeMaterial3Version: String by rootProject.extra
1313

1414
android {
1515
namespace = "com.aliernfrog.toptoastdemo"
@@ -59,10 +59,10 @@ android {
5959

6060
dependencies {
6161
implementation("androidx.core:core-ktx:$coreVersion")
62-
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
63-
implementation("androidx.activity:activity-compose:1.8.2")
64-
implementation("androidx.compose.ui:ui:$composeVersion")
65-
implementation("androidx.compose.material:material:$composeVersion")
66-
implementation("androidx.compose.material3:material3:$material3Version")
62+
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.5")
63+
implementation("androidx.activity:activity-compose:1.9.2")
64+
implementation("androidx.compose.ui:ui:$composeMaterialVersion")
65+
implementation("androidx.compose.material:material:$composeMaterialVersion")
66+
implementation("androidx.compose.material3:material3:$composeMaterial3Version")
6767
implementation(project(":library"))
6868
}

demo/src/main/java/com/aliernfrog/toptoastdemo/MainActivity.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import androidx.compose.material.icons.filled.MoreVert
3636
import androidx.compose.material.icons.rounded.Check
3737
import androidx.compose.material.icons.rounded.Close
3838
import androidx.compose.material.icons.rounded.Info
39-
import androidx.compose.material.ripple.rememberRipple
4039
import androidx.compose.material3.AlertDialog
4140
import androidx.compose.material3.Checkbox
4241
import androidx.compose.material3.DropdownMenu
@@ -54,6 +53,7 @@ import androidx.compose.material3.TextButton
5453
import androidx.compose.material3.TopAppBar
5554
import androidx.compose.material3.TopAppBarDefaults
5655
import androidx.compose.material3.contentColorFor
56+
import androidx.compose.material3.ripple
5757
import androidx.compose.runtime.Composable
5858
import androidx.compose.runtime.LaunchedEffect
5959
import androidx.compose.runtime.getValue
@@ -252,6 +252,7 @@ class MainActivity : ComponentActivity() {
252252
},
253253
singleLine = true,
254254
keyboardOptions = KeyboardOptions.Default.copy(
255+
autoCorrectEnabled = null,
255256
keyboardType = KeyboardType.Number
256257
),
257258
modifier = Modifier.fillMaxWidth()
@@ -304,7 +305,7 @@ class MainActivity : ComponentActivity() {
304305
.width(50.dp)
305306
.clickable(
306307
interactionSource = remember { MutableInteractionSource() },
307-
indication = rememberRipple(bounded = false),
308+
indication = ripple(bounded = false),
308309
onClick = onSelect
309310
)
310311
) {
@@ -340,7 +341,7 @@ class MainActivity : ComponentActivity() {
340341
.fillMaxHeight()
341342
.clickable(
342343
interactionSource = remember { MutableInteractionSource() },
343-
indication = rememberRipple(bounded = false),
344+
indication = ripple(bounded = false),
344345
onClick = onSelect
345346
)
346347
.size(45.dp)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Mon Aug 08 22:57:35 TRT 2022
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

library/build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ val libraryVersionName: String by rootProject.extra
1010

1111
val coreVersion: String by rootProject.extra
1212
val composeCompilerVersion: String by rootProject.extra
13-
val composeVersion: String by rootProject.extra
14-
val material3Version: String by rootProject.extra
13+
val composeMaterialVersion: String by rootProject.extra
14+
val composeMaterial3Version: String by rootProject.extra
1515

1616
android {
1717
namespace = "com.aliernfrog.toptoast"
@@ -48,8 +48,8 @@ android {
4848

4949
dependencies {
5050
implementation("androidx.core:core-ktx:$coreVersion")
51-
implementation("androidx.compose.ui:ui:$composeVersion")
52-
implementation("androidx.compose.material3:material3:$material3Version")
51+
implementation("androidx.compose.ui:ui:$composeMaterialVersion")
52+
implementation("androidx.compose.material3:material3:$composeMaterial3Version")
5353
implementation("androidx.savedstate:savedstate-ktx:1.2.1")
5454
}
5555

library/src/main/java/com/aliernfrog/toptoast/component/TopToast.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ package com.aliernfrog.toptoast.component
33
import androidx.compose.animation.animateContentSize
44
import androidx.compose.foundation.background
55
import androidx.compose.foundation.clickable
6-
import androidx.compose.foundation.interaction.MutableInteractionSource
76
import androidx.compose.foundation.layout.Row
87
import androidx.compose.foundation.layout.padding
98
import androidx.compose.foundation.layout.size
10-
import androidx.compose.material.ripple.rememberRipple
119
import androidx.compose.material3.Icon
1210
import androidx.compose.material3.MaterialTheme
1311
import androidx.compose.material3.Text
12+
import androidx.compose.material3.ripple
1413
import androidx.compose.material3.surfaceColorAtElevation
1514
import androidx.compose.runtime.Composable
16-
import androidx.compose.runtime.remember
1715
import androidx.compose.ui.Alignment
1816
import androidx.compose.ui.Modifier
1917
import androidx.compose.ui.draw.clip
@@ -48,8 +46,8 @@ fun TopToast(
4846
.animateContentSize()
4947
.run { onClick?.let {
5048
clickable(
51-
interactionSource = remember { MutableInteractionSource() },
52-
indication = rememberRipple(color = MaterialTheme.colorScheme.onBackground),
49+
interactionSource = null,
50+
indication = ripple(color = MaterialTheme.colorScheme.onBackground),
5351
onClick = it
5452
)
5553
} ?: this }

library/src/main/java/com/aliernfrog/toptoast/enum/TopToastType.kt

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

library/src/main/java/com/aliernfrog/toptoast/state/TopToastState.kt

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import androidx.savedstate.findViewTreeSavedStateRegistryOwner
2626
import androidx.savedstate.setViewTreeSavedStateRegistryOwner
2727
import com.aliernfrog.toptoast.component.TopToast
2828
import com.aliernfrog.toptoast.enum.TopToastColor
29-
import com.aliernfrog.toptoast.enum.TopToastType
3029
import java.util.Timer
3130
import java.util.TimerTask
3231
import kotlin.concurrent.schedule
@@ -35,14 +34,11 @@ import kotlin.concurrent.schedule
3534
* State of TopToasts
3635
* @param composeView Compose view used for Android type toasts, can also be set later using [TopToastState.setComposeView]
3736
* @param appTheme App theme to be used for Android type toasts
38-
* @param defaultType [TopToastType] to use when not specified
3937
* @param allowSwipingByDefault Whether to allow swiping toasts to dismiss them by default
4038
*/
4139
class TopToastState(
4240
private var composeView: View?,
4341
private var appTheme: (@Composable (content: @Composable () -> Unit) -> Unit)?,
44-
@Deprecated("This is no longer needed as showAndroidToast is now a separate method. Will be removed in next releases.")
45-
private val defaultType: TopToastType = TopToastType.INTERACTIVE,
4642
private val allowSwipingByDefault: Boolean = true,
4743
private val defaultAndroidToast: @Composable (text: String, icon: Painter?, iconTintColor: Color) -> Unit = { title, icon, iconTintColor ->
4844
TopToast(
@@ -85,121 +81,6 @@ class TopToastState(
8581
private val timer = Timer()
8682
private var task: TimerTask? = null
8783

88-
/**
89-
* Shows a [TopToast].
90-
* @param text Text shown in toast, can be a [String] or [Int] representing a string constant
91-
* @param icon [Painter] of icon in toast, can be a [Painter], [ImageVector] or [Int] representing a drawable constant
92-
* @param iconTintColor Tint color of icon in toast, can be a [Color] or [TopToastColor]
93-
* @param stayMs Duration of toast in milliseconds, only for [TopToastType.INTERACTIVE]
94-
* @param type [TopToastType] of toast, defaults to [defaultType]
95-
* @param dismissOnClick Whether to dismiss the toast on click, only for [TopToastType.INTERACTIVE]
96-
* @param onToastClick Unit to invoke on toast click, only for [TopToastType.INTERACTIVE]
97-
*/
98-
@Deprecated(
99-
message = "Use showToast(text, icon, iconTintColor, duration, swipeToDismiss, dismissOnClick, onToastClick) or showAndroidToast(text, icon, iconTintColor, duration) instead. This method will be removed in next releases.",
100-
replaceWith = ReplaceWith("showToast", "showToast(text, icon, iconTintColor, duration, swipeToDismiss, dismissOnClick, onToastClick)")
101-
)
102-
fun showToast(
103-
text: Any,
104-
icon: Any? = null,
105-
iconTintColor: Any = TopToastColor.PRIMARY,
106-
stayMs: Long,
107-
type: TopToastType,
108-
dismissOnClick: Boolean? = null,
109-
onToastClick: (() -> Unit)? = null
110-
) {
111-
when (type) {
112-
TopToastType.INTERACTIVE -> showToast(
113-
text = text,
114-
icon = icon,
115-
iconTintColor = iconTintColor,
116-
duration = stayMs,
117-
dismissOnClick = dismissOnClick,
118-
onToastClick = onToastClick
119-
)
120-
TopToastType.ANDROID -> showAndroidToast(
121-
text = text,
122-
icon = icon,
123-
iconTintColor = iconTintColor
124-
)
125-
}
126-
}
127-
128-
/**
129-
* Shows a [TopToast].
130-
* @param text Text shown in toast, can be a [String] or [Int] representing a string constant
131-
* @param icon [Painter] of icon in toast, can be a [Painter], [ImageVector] or [Int] representing a drawable constant
132-
* @param iconTintColor Tint color of icon in toast, can be a [Color] or [TopToastColor]
133-
* @param type [TopToastType] of toast, defaults to [defaultType]
134-
* @param dismissOnClick Whether to dismiss the toast on click, only for [TopToastType.INTERACTIVE]
135-
* @param onToastClick Unit to invoke on toast click, only for [TopToastType.INTERACTIVE]
136-
*/
137-
@Deprecated(
138-
message = "Use showToast(text, icon, iconTintColor, duration, swipeToDismiss, dismissOnClick, onToastClick) or showAndroidToast(text, icon, iconTintColor, duration) instead. This method will be removed in next releases.",
139-
replaceWith = ReplaceWith("showToast", "showToast(text, icon, iconTintColor, duration, swipeToDismiss, dismissOnClick, onToastClick)")
140-
)
141-
fun showToast(
142-
text: Any,
143-
icon: Any? = null,
144-
iconTintColor: Any = TopToastColor.PRIMARY,
145-
type: TopToastType,
146-
dismissOnClick: Boolean? = null,
147-
onToastClick: (() -> Unit)? = null
148-
) {
149-
when (type) {
150-
TopToastType.INTERACTIVE -> showToast(
151-
text = text,
152-
icon = icon,
153-
iconTintColor = iconTintColor,
154-
dismissOnClick = dismissOnClick,
155-
onToastClick = onToastClick
156-
)
157-
TopToastType.ANDROID -> showAndroidToast(
158-
text = text,
159-
icon = icon,
160-
iconTintColor = iconTintColor
161-
)
162-
}
163-
}
164-
165-
/**
166-
* Shows a [TopToast].
167-
* @param text Text shown in toast, can be a [String] or [Int] representing a string constant
168-
* @param icon [Painter] of icon in toast, can be a [Painter], [ImageVector] or [Int] representing a drawable constant
169-
* @param iconTintColor Tint color of icon in toast, can be a [Color] or [TopToastColor]
170-
* @param stayMs Duration of toast in milliseconds, only for [TopToastType.INTERACTIVE]
171-
* @param dismissOnClick Whether to dismiss the toast on click, only for [TopToastType.INTERACTIVE]
172-
* @param onToastClick Unit to invoke on toast click, only for [TopToastType.INTERACTIVE]
173-
*/
174-
@Deprecated(
175-
message = "Use showToast(text, icon, iconTintColor, duration, swipeToDismiss, dismissOnClick, onToastClick) or showAndroidToast(text, icon, iconTintColor, duration) instead. This method will be removed in next releases.",
176-
replaceWith = ReplaceWith("showToast", "showToast(text, icon, iconTintColor, duration, swipeToDismiss, dismissOnClick, onToastClick)")
177-
)
178-
fun showToast(
179-
text: Any,
180-
icon: Any? = null,
181-
iconTintColor: Any = TopToastColor.PRIMARY,
182-
stayMs: Long,
183-
dismissOnClick: Boolean? = null,
184-
onToastClick: (() -> Unit)? = null
185-
) {
186-
when (defaultType) {
187-
TopToastType.INTERACTIVE -> showToast(
188-
text = text,
189-
icon = icon,
190-
iconTintColor = iconTintColor,
191-
duration = stayMs,
192-
dismissOnClick = dismissOnClick,
193-
onToastClick = onToastClick
194-
)
195-
TopToastType.ANDROID -> showAndroidToast(
196-
text = text,
197-
icon = icon,
198-
iconTintColor = iconTintColor
199-
)
200-
}
201-
}
202-
20384
/**
20485
* Shows a [TopToast].
20586
*

0 commit comments

Comments
 (0)