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
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:thickness="0dp" | |
android:shape="rectangle"> | |
<stroke android:width="1dp" | |
android:color="@color/divider"/> | |
<corners android:radius="0dp" /> | |
</shape> |
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 actions(): Flow<MoviesFlowAction> = merge( | |
actionChannel.consumeAsFlow(), | |
binding.refreshButton.clicks().map { MoviesAction.RefreshAction } | |
) |
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
@Composable | |
private fun SearchField( | |
actionChannel: ActionChannel | |
) { | |
... | |
Button( | |
/*Send a new action in the actionChannel */ | |
onClick = { actionChannel.trySend(MoviesAction.SearchMovieAction(query) }, | |
... | |
) { |
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
@Composable | |
fun MoviesScreenContent( | |
uiState: TransferScreenState, | |
actionChannel: ActionChannel | |
) { | |
... | |
} | |
... | |
@Composable |
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
@Composable | |
fun MoviesScreenContent( | |
uiState: TransferScreenState, | |
onSearchMovie: (String) -> Unit = { }, | |
onCategoryChange: (String) -> Unit = { }, | |
onFirstNameChange: (String) -> Unit = { }, | |
onLastNameChange: (String) -> Unit = { }, | |
onFavoriteChange: (String) -> Unit = { }, | |
onDownloadClicked: (MovieUI) -> Unit = { }, | |
onUploadClicked: () -> Unit = { }, |
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
class MoviesActivity : ComponentActivity() { | |
private val viewModel by viewModels<MoviesViewModel>() | |
private val actionChannel = Channel<MoviesAction>() | |
private fun actions(): Flow<MoviesAction> = actionChannel.consumeAsFlow() | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) |
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
data class Transaction( | |
val id: Long?, | |
val amount: Double?, | |
val currency: Currency?, | |
val reference: String?, | |
val transactiontype: String?, | |
val direction: String?, | |
val correspondent: TransactionCorrespondent?, | |
val beginDate: Long? = 0, | |
val endDate: Long? = 0, |
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
class MoviesViewModel @Inject constructor(private val mapper: MoviesUIMapper) : ViewModel() { | |
private val _actionFlow = | |
MutableSharedFlow<MoviesAction>(extraBufferCapacity = 16) | |
init { | |
_actionFlow.process().launchIn(viewModelScope) | |
} | |
private fun Flow<MoviesAction>.process() = onEach { | |
when(it) { |
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
sealed class MoviesAction { | |
data class SearchMovieAction(val query: String): MoviesAction() | |
data class AddToHistoryAction(val movieId: Int): MoviesAction() | |
object RefreshMoviesAction: MoviesAction() | |
} |
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
data class TransactionUI( | |
val title: String = "", | |
val type: String = "", | |
val image: String = "", | |
val amount: String = "", | |
val date: String = "", | |
val color: Color = Color.Yellow | |
) |
NewerOlder