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 ObservableManager obsManager = new ObservableManager(EventBus.getDefault()); | |
| @Override | |
| public Subscription getStores() { | |
| // Get the observable if exists and is not too old | |
| Observable<StoresList> observable = obsManager.get(ObservableManager.Types.STORES); | |
| if (observable == null) { | |
| // If is null create it and us cache to keep it in memeroy | |
| observable = api.getStoresList() | |
| .compose(applySchedulers(api.getStoresList())) |
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
| abstract class GenericAdapter<T> : RecyclerView.Adapter<RecyclerView.ViewHolder> { | |
| var listItems: List<T> | |
| constructor(listItems: List<T>) { | |
| this.listItems = listItems | |
| } | |
| constructor() { |
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
| package calendar | |
| import java.text.SimpleDateFormat | |
| import java.util.* | |
| import java.text.DateFormat | |
| class KCalendar { | |
| private val holidays = listOf(SpecificDayHoliday(23, 6), |
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 | |
| fun EmailField(name: String, modifier: Modifier = Modifier) { | |
| var email: String by remember { | |
| mutableStateOf("") | |
| } | |
| TextField(value = email, modifier = modifier, onValueChange = { | |
| email = it | |
| }) | |
| } |
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
| @OptIn(ExperimentalMaterial3Api::class) | |
| @Composable | |
| fun EmailField(name: String, modifier: Modifier = Modifier) { | |
| var email: String by rememberSaveable { | |
| mutableStateOf("") | |
| } | |
| TextField(value = email, modifier = modifier, onValueChange = { | |
| email = it | |
| }) | |
| } |
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
| fun <T> autoSaver(): Saver<T, Any> = | |
| @Suppress("UNCHECKED_CAST") | |
| (AutoSaver as Saver<T, Any>) | |
| private val AutoSaver = Saver<Any?, Any>( | |
| save = { it }, | |
| restore = { it } | |
| ) |
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
| @Parcelize | |
| data class CheckBoxState constructor( | |
| val isSelected: Boolean = false, | |
| val name: String = "Checkbox State" | |
| ) : Parcelable | |
| @Composable | |
| fun UserItem() { | |
| var checkBoxState by rememberSaveable { |
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 CheckBoxStateSaver = Saver<CheckBoxState, Boolean>( | |
| save = { | |
| it.isSelected | |
| }, | |
| restore = { isSelected-> | |
| CheckBoxState(isSelected = isSelected) | |
| } | |
| ) |
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 Saver: Saver<LazyListState, *> = listSaver( | |
| save = { listOf(it.firstVisibleItemIndex, it.firstVisibleItemScrollOffset) }, | |
| restore = { | |
| LazyListState( | |
| firstVisibleItemIndex = it[0], | |
| firstVisibleItemScrollOffset = it[1] | |
| ) | |
| } | |
| ) |
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 CheckBoxStateSaver = listSaver<CheckBoxState, Any>( | |
| save = { | |
| listOf<Any>(it.isSelected,it.name) | |
| }, | |
| restore = { data-> | |
| CheckBoxState(isSelected = data[0] as Boolean,data[1] as String) | |
| } | |
| ) |
OlderNewer