This file contains 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
group: Borrower Example | |
borrower = {customerName loanNumber | |
adams L16 | |
curry L93 | |
hayes L15 | |
jackson L14 | |
jones L17 | |
smith L11 | |
smith L23 | |
williams L17 |
This file contains 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
fun View.scale( | |
alpha: Float = 0f, | |
scaleBy: Float = 1f, | |
duration: Long = 0L, | |
startingDelay: Long = 0 | |
) { | |
animate().alpha(alpha).scaleX(scaleBy).scaleY(scaleBy) | |
.setStartDelay(startingDelay) | |
.setDuration(duration).start() | |
} |
This file contains 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
fun View.translateXBy( | |
alpha: Float = 0f, | |
translateBy: Float = 50f, | |
duration: Long = 0L, | |
startingDelay: Long = 0 | |
) { | |
animate().alpha(alpha).translationXBy(context.toPx(translateBy)) | |
.setStartDelay(startingDelay) | |
.setDuration(duration).start() | |
} |
This file contains 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 duration = 300L | |
val startDelay = 300L | |
// View1 | |
binding.bannerPager.translateYBy(1f, -50, duration, startDelay) | |
// View2 | |
binding.smallBannerPager.translateYBy( | |
1f, | |
-50, | |
duration, | |
startDelay + 150 |
This file contains 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
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
binding.bannerPager.translateYBy() | |
binding.smallBannerPager.translateYBy() | |
binding.subCategoryRv.translateYBy() | |
} |
This file contains 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
fun View.translateYBy( | |
alpha: Float = 0f, | |
translateBy: Float = 50f, | |
duration: Long = 0L, | |
startingDelay: Long = 0 | |
) { | |
animate().alpha(alpha).translationYBy(context.toPx(translateBy)) | |
.setStartDelay(startingDelay) | |
.setDuration(duration).start() | |
} |
This file contains 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 Context.dataStore: DataStore<Preferences> by preferencesDataStore( | |
name = "MyDataStore", | |
produceMigrations = { context -> | |
listOf( | |
SharedPreferencesMigration(context, "MySharedPref") | |
) | |
}) |
This file contains 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
suspend fun clearDatStore() { | |
dataStore.edit { myDataStore -> | |
myDataStore.clear() | |
} | |
} |
This file contains 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
// Using runBlocking | |
// It blocks the UI Thread | |
val userName = runBlocking { | |
dataStore.data.first()[DataStoreManager.userNameKey] | |
} | |
binding.userName.text = userName | |
// Using UI thread safe lifecycleScope | |
lifecycleScope.launch { | |
val userName = dataStoreManager.dataStore.data.first()[DataStoreManager.userNameKey] |
NewerOlder