This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
private fun PostHashtags( | |
hashtags: ImmutableList<String>, | |
onAddHashTag: (String) -> Unit, | |
modifier: Modifier | |
) { | |
- var inputHashTag by remember(hashtags) { mutableStateOf("") } | |
+ val inputHashTag = remember(hashtags) { mutableStateOf("") } | |
- val isValidHashtag: Boolean by remember { | |
+ val isValidHashtag: Boolean by remember(inputHashTag) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- val isValidHashtag: Boolean by remember { | |
+ val isValidHashtag: Boolean by remember(hashtags) { | |
derivedStateOf { | |
!inputHashTag.contains(" ") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val isValidHashtag: Boolean by remember { | |
+ Log.i("Saurabh", "Running remember block") | |
derivedStateOf { | |
+ Log.i("Saurabh", "Calculating derivedStateOf") | |
!inputHashTag.contains(" ") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
private fun PostHashtags( | |
hashtags: ImmutableList<String>, | |
onAddHashTag: (String) -> Unit, | |
modifier: Modifier | |
) { | |
var inputHashTag by remember(hashtags) { mutableStateOf("") } | |
+ val isValidHashtag: Boolean by remember { | |
+ derivedStateOf { | |
+ !inputHashTag.contains(" ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
private fun PostHashtags( | |
hashtags: ImmutableList<String>, | |
onAddHashTag: (String) -> Unit, | |
modifier: Modifier | |
) { | |
var inputHashTag by remember(hashtags) { mutableStateOf("") } | |
Column(modifier = modifier) { | |
OutlinedTextField( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.annotation.FloatRange | |
import androidx.compose.animation.core.Animatable | |
import androidx.compose.animation.core.LinearOutSlowInEasing | |
import androidx.compose.animation.core.tween | |
import androidx.compose.foundation.Canvas | |
import androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.padding | |
import androidx.compose.foundation.layout.requiredSize | |
import androidx.compose.material3.MaterialTheme | |
import androidx.compose.material3.Slider |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var completableList: MutableList<Completable> = ArrayList<Completable>() | |
for (initializer in appComponent.getInitializers()) { | |
completableList.add(initializer.initialize(context)) | |
} | |
Completable.mergeDelayError(completableList) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val initializedModules = HashSet<Class<out ModuleInitializer>>() | |
fun getInitializerCompletable(): Completable { | |
val completableList = mutableListOf<Completable>() | |
map.forEach { (clazz, moduleInitializer) -> | |
completableList.addAll(getCompletableForModule(clazz, moduleInitializer)) | |
} | |
return Completable.concat(completableList) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface AppComponent { | |
@Component.Factory | |
interface Factory { | |
fun create(@BindsInstance context: Context): AppComponent | |
} | |
..... | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomerCareInitializer @Inject constructor( | |
private val session: UserSession, | |
private val apiService: ApiService | |
) : ModuleInitializer { | |
override fun initialize(context: Context): Completable { | |
.... | |
} | |
override fun dependencies(): List<Class<out ModuleInitializer>> { |
NewerOlder