Skip to content

Commit

Permalink
Merge branch 'hotfix/refactorRemembersForTypes' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluchu committed Aug 30, 2023
2 parents 24439e7 + 354e235 commit 8132f15
Show file tree
Hide file tree
Showing 11 changed files with 529 additions and 10 deletions.
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ androidx-compose-material = "1.5.0"
androidx-compose-runtime = "1.5.0"
androidx-compose-ui = "1.5.0"
androidx-lifecycle = "2.6.1"
androidx-navigation = "2.7.0"
com-google-accompanist = "0.31.6-rc"
androidx-navigation = "2.7.1"
com-google-accompanist = "0.32.0"
com-squareup-okhttp3 = "4.11.0"
com-squareup-retrofit2 = "2.9.0"
io-coil-kt = "2.4.0"
Expand Down Expand Up @@ -36,7 +36,7 @@ androidx-lifecycle-lifecycle-livedata-core-ktx = { module = "androidx.lifecycle:
androidx-lifecycle-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" }
androidx-navigation-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidx-navigation" }
androidx-preference = "androidx.preference:preference-ktx:1.2.1"
com-android-tools-build-gradle = "com.android.tools.build:gradle:8.1.0"
com-android-tools-build-gradle = "com.android.tools.build:gradle:8.1.1"
com-google-accompanist-accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "com-google-accompanist" }
com-google-android-gms-play-services-base = "com.google.android.gms:play-services-base:18.2.0"
com-google-code-gson = "com.google.code.gson:gson:2.10.1"
Expand Down
2 changes: 1 addition & 1 deletion jchucomponents-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ afterEvaluate {
from components.release
groupId = "com.github.jeluchu"
artifactId = "jchucomponents-core"
version = "1.8.3"
version = "1.8.5"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jchucomponents-ktx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ afterEvaluate {
from components.release
groupId = "com.github.jeluchu"
artifactId = "jchucomponents-ktx"
version = "1.8.3"
version = "1.8.5"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jchucomponents-prefs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ afterEvaluate {
from components.release
groupId = "com.github.jeluchu"
artifactId = "jchucomponents-prefs"
version = "1.8.3"
version = "1.8.5"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jchucomponents-qr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ afterEvaluate {
from components.release
groupId = "com.github.jeluchu"
artifactId = "jchucomponents-qr"
version = "1.8.3"
version = "1.8.5"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jchucomponents-ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ afterEvaluate {
from components.release
groupId = "com.github.jeluchu"
artifactId = "jchucomponents-ui"
version = "1.8.3"
version = "1.8.5"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package com.jeluchu.jchucomponents.ui.runtime.remember
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.withFrameMillis
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
*
* Copyright 2022 Jeluchu
*
*/

@file:Suppress("unused")

package com.jeluchu.jchucomponents.ui.runtime.remember

import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableDoubleState
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.State
import androidx.compose.runtime.mutableDoubleStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.snapshots.Snapshot

/**
*
* This is an overload for the original method.
* If you have any questions, please see the documentation of the original method
*
* Remember a new [MutableDoubleState] initialized with the passed in [value]
*
* The MutableState class is a single value holder whose reads and writes are observed by
* Compose.
* Additionally, writes to it is transacted as part of the [Snapshot] system.
*
* @param value the initial value for the [MutableDoubleState]
*
* @see State
* @see MutableDoubleState
*/
@Composable
fun rememberMutableDoubleStateOf(
value: Double,
): MutableDoubleState = remember { mutableDoubleStateOf(value) }

/**
*
* This is an overload for the original method.
* If you have any questions, please see the documentation of the original method
*
* Remember a new [MutableDoubleState] initialized with the passed in [value]
*
* The MutableState class is a single value holder whose reads and writes are observed by
* Compose.
* Additionally, writes to it is transacted as part of the [Snapshot] system.
*
* @param value the initial value for the [MutableDoubleState]
*
* @see State
* @see MutableDoubleState
*/
@Composable
fun rememberMutableDoubleStateOf(
key1: Any?,
value: Double
): MutableDoubleState = remember(key1) { mutableDoubleStateOf(value) }


/**
*
* This is an overload for the original method.
* If you have any questions, please see the documentation of the original method
*
* Remember a new [MutableDoubleState] initialized with the passed in [value]
*
* The MutableState class is a single value holder whose reads and writes are observed by
* Compose.
* Additionally, writes to it is transacted as part of the [Snapshot] system.
*
* @param value the initial value for the [MutableDoubleState]
*
* @see State
* @see MutableDoubleState
*/
@Composable
fun <T> rememberMutableDoubleStateOf(
key1: Any?,
key2: Any?,
value: Double
): MutableDoubleState = remember(key1, key2) { mutableDoubleStateOf(value) }

/**
*
* This is an overload for the original method.
* If you have any questions, please see the documentation of the original method
*
* Remember a new [MutableDoubleState] initialized with the passed in [value]
*
* The MutableState class is a single value holder whose reads and writes are observed by
* Compose.
* Additionally, writes to it is transacted as part of the [Snapshot] system.
*
* @param value the initial value for the [MutableDoubleState]
*
* @see State
* @see MutableState
*/
@Composable
fun <T> rememberMutableDoubleStateOf(
key1: Any?,
key2: Any?,
key3: Any?,
value: Double
): MutableDoubleState = remember(key1, key2, key3) { mutableDoubleStateOf(value) }

/**
*
* This is an overload for the original method.
* If you have any questions, please see the documentation of the original method
*
* Remember a new [MutableDoubleState] initialized with the passed in [value]
*
* The MutableState class is a single value holder whose reads and writes are observed by
* Compose.
* Additionally, writes to it is transacted as part of the [Snapshot] system.
*
* @param value the initial value for the [MutableDoubleState]
*
* @see State
* @see MutableDoubleState
*/
@Composable
fun rememberMutableDoubleStateOf(
vararg keys: Any?,
value: Double
): MutableDoubleState = remember(keys) { mutableDoubleStateOf(value) }
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*
*
* Copyright 2022 Jeluchu
*
*/

@file:Suppress("unused")

package com.jeluchu.jchucomponents.ui.runtime.remember

import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableFloatState
import androidx.compose.runtime.MutableLongState
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.State
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.snapshots.Snapshot

/**
*
* This is an overload for the original method.
* If you have any questions, please see the documentation of the original method
*
* Remember a new [MutableLongState] initialized with the passed in [value]
*
* The MutableState class is a single value holder whose reads and writes are observed by
* Compose.
* Additionally, writes to it is transacted as part of the [Snapshot] system.
*
* @param value the initial value for the [MutableLongState]
*
* @see State
* @see MutableLongState
*/
@Composable
fun rememberMutableFloatStateOf(
value: Float
): MutableFloatState = remember { mutableFloatStateOf(value) }

/**
*
* This is an overload for the original method.
* If you have any questions, please see the documentation of the original method
*
* Remember a new [MutableLongState] initialized with the passed in [value]
*
* The MutableState class is a single value holder whose reads and writes are observed by
* Compose.
* Additionally, writes to it is transacted as part of the [Snapshot] system.
*
* @param value the initial value for the [MutableLongState]
*
* @see State
* @see MutableLongState
*/
@Composable
fun rememberMutableFloatStateOf(
key1: Any?,
value: Float
): MutableFloatState = remember(key1) { mutableFloatStateOf(value) }


/**
*
* This is an overload for the original method.
* If you have any questions, please see the documentation of the original method
*
* Remember a new [MutableLongState] initialized with the passed in [value]
*
* The MutableState class is a single value holder whose reads and writes are observed by
* Compose.
* Additionally, writes to it is transacted as part of the [Snapshot] system.
*
* @param value the initial value for the [MutableLongState]
*
* @see State
* @see MutableLongState
*/
@Composable
fun <T> rememberMutableFloatStateOf(
key1: Any?,
key2: Any?,
value: Float
): MutableFloatState = remember(key1, key2) { mutableFloatStateOf(value) }

/**
*
* This is an overload for the original method.
* If you have any questions, please see the documentation of the original method
*
* Remember a new [MutableLongState] initialized with the passed in [value]
*
* The MutableState class is a single value holder whose reads and writes are observed by
* Compose.
* Additionally, writes to it is transacted as part of the [Snapshot] system.
*
* @param value the initial value for the [MutableLongState]
*
* @see State
* @see MutableState
*/
@Composable
fun <T> rememberMutableFloatStateOf(
key1: Any?,
key2: Any?,
key3: Any?,
value: Float
): MutableFloatState = remember(key1, key2, key3) { mutableFloatStateOf(value) }

/**
*
* This is an overload for the original method.
* If you have any questions, please see the documentation of the original method
*
* Remember a new [MutableLongState] initialized with the passed in [value]
*
* The MutableState class is a single value holder whose reads and writes are observed by
* Compose.
* Additionally, writes to it is transacted as part of the [Snapshot] system.
*
* @param value the initial value for the [MutableLongState]
*
* @see State
* @see MutableLongState
*/
@Composable
fun rememberMutableFloatStateOf(
vararg keys: Any?,
value: Float
): MutableFloatState = remember(keys) { mutableFloatStateOf(value) }
Loading

0 comments on commit 8132f15

Please sign in to comment.