-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(speakers-feature): rework experience for landscape mode.
- Loading branch information
1 parent
a77cb86
commit 821d903
Showing
18 changed files
with
295 additions
and
352 deletions.
There are no files selected for viewing
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
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
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
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
93 changes: 0 additions & 93 deletions
93
.../kotlin/org/gdglille/devfest/android/theme/m3/speakers/feature/SpeakerDetailHorizontal.kt
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
.../kotlin/org/gdglille/devfest/android/theme/m3/speakers/feature/SpeakerDetailOrientable.kt
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
...otlin/org/gdglille/devfest/android/theme/m3/speakers/feature/SpeakerDetailOrientableVM.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.gdglille.devfest.android.theme.m3.speakers.feature | ||
|
||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.collectAsState | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.lifecycle.viewmodel.compose.viewModel | ||
import org.gdglille.devfest.AlarmScheduler | ||
import org.gdglille.devfest.android.theme.m3.speakers.screens.SpeakerDetailOrientable | ||
import org.gdglille.devfest.android.theme.m3.style.R | ||
import org.gdglille.devfest.android.theme.m3.style.appbars.TopAppBar | ||
import org.gdglille.devfest.repositories.AgendaRepository | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun SpeakerDetailOrientableVM( | ||
speakerId: String, | ||
agendaRepository: AgendaRepository, | ||
alarmScheduler: AlarmScheduler, | ||
onTalkClicked: (id: String) -> Unit, | ||
onLinkClicked: (url: String) -> Unit, | ||
onBackClicked: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
viewModel: SpeakerDetailViewModel = viewModel( | ||
factory = SpeakerDetailViewModel.Factory.create(speakerId, agendaRepository, alarmScheduler) | ||
) | ||
) { | ||
val context = LocalContext.current | ||
val uiState = viewModel.uiState.collectAsState() | ||
Scaffold( | ||
modifier = modifier, | ||
topBar = { | ||
TopAppBar( | ||
title = stringResource(id = R.string.screen_speaker_detail), | ||
navigationIcon = { Back(onClick = onBackClicked) } | ||
) | ||
}, | ||
content = { | ||
when (uiState.value) { | ||
is SpeakerUiState.Loading -> SpeakerDetailOrientable( | ||
speaker = (uiState.value as SpeakerUiState.Loading).speaker, | ||
contentPadding = it, | ||
onTalkClicked = {}, | ||
onFavoriteClicked = {}, | ||
onLinkClicked = {} | ||
) | ||
|
||
is SpeakerUiState.Failure -> Text(text = stringResource(id = R.string.text_error)) | ||
is SpeakerUiState.Success -> SpeakerDetailOrientable( | ||
speaker = (uiState.value as SpeakerUiState.Success).speaker, | ||
contentPadding = it, | ||
onTalkClicked = onTalkClicked, | ||
onFavoriteClicked = { | ||
viewModel.markAsFavorite(context, it) | ||
}, | ||
onLinkClicked = onLinkClicked, | ||
) | ||
} | ||
} | ||
) | ||
} |
51 changes: 0 additions & 51 deletions
51
...src/main/kotlin/org/gdglille/devfest/android/theme/m3/speakers/feature/SpeakerDetailVM.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.