Skip to content

Commit

Permalink
Merge pull request #80 from sheikh-20/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sheikh-20 authored Jun 20, 2024
2 parents 87ba3cb + 131308a commit 91e1270
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ android {
applicationId = "com.application.moviesapp"
minSdk = 24
targetSdk = 33
versionCode = 16
versionName = "1.0.15"
versionCode = 18
versionName = "1.0.17"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class DetailActivity : BaseActivity() {
viewModel.getTvSeriesTrailer(intent.getIntExtra(ID, 0))
}
}

viewModel.getMovieState(movieId)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.SnackbarDuration
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Tab
import androidx.compose.material3.TabRow
Expand Down Expand Up @@ -129,6 +130,7 @@ fun DetailScreen(modifier: Modifier = Modifier,
moviesFlow: LazyPagingItems<MovieNowPlaying>,
onBookmarkClicked: (String, Int, Boolean) -> Unit = { _, _, _ -> },
snackbarHostState: SnackbarHostState = SnackbarHostState(),
onBookmark: (Int) -> Unit = { _ -> },
bookmarkUiState: Resource<MovieState> = Resource.Loading,
onTrailerClick: (String) -> Unit = { _ -> },
downloaderUiState: DownloadUiState = DownloadUiState.Default,
Expand Down Expand Up @@ -216,8 +218,9 @@ fun DetailScreen(modifier: Modifier = Modifier,
isFavorite = bookmarkUiState.data.favorite != true

onBookmarkClicked("movie", movieUIState.data.id ?: 0, bookmarkUiState.data.favorite != true)
onBookmark(movieUIState.data.id ?: 0)
coroutineScope.launch {
snackbarHostState.showSnackbar(message = "Bookmark updated")
snackbarHostState.showSnackbar(message = if (!isFavorite) "Bookmark removed" else "Bookmark updated", duration = SnackbarDuration.Short)
}
}
) {
Expand Down Expand Up @@ -523,8 +526,9 @@ fun DetailScreen(modifier: Modifier = Modifier,
isFavorite = bookmarkUiState.data.favorite != true

onBookmarkClicked("tv", tvSeriesUIState.data.id ?: 0, bookmarkUiState.data.favorite != true)
onBookmark(tvSeriesUIState.data.id ?: 0)
coroutineScope.launch {
snackbarHostState.showSnackbar(message = "Bookmark updated")
snackbarHostState.showSnackbar(message = if (!isFavorite) "Bookmark removed" else "Bookmark updated", duration = SnackbarDuration.Short)
}
}
) {
Expand Down Expand Up @@ -993,7 +997,10 @@ private fun TvSeriesTrailerCard(modifier: Modifier = Modifier,
}
}

Column(modifier = modifier.weight(1f).requiredHeight(100.dp).padding(vertical = 16.dp), verticalArrangement = Arrangement.SpaceBetween) {
Column(modifier = modifier
.weight(1f)
.requiredHeight(100.dp)
.padding(vertical = 16.dp), verticalArrangement = Arrangement.SpaceBetween) {
Text(
text = tvSeriesTrailerWithYoutube.title ?: "",
style = MaterialTheme.typography.titleSmall,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ fun DetailScreenApp(modifier: Modifier = Modifier,
moviesTrailerUiState = movieTrailerUiState,
tvSeriesTrailerUiState = tvSeriesTrailerUiState,
moviesFlow = moviesFlow,
onBookmark = {
viewModel.getMovieState(it)
},
onBookmarkClicked = { movieType: String, movieId: Int, isFavorite ->
viewModel.updateMovieFavourite(movieType, movieId, isFavorite)
// viewModel.getMovieState(movieId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ fun LoginWithPasswordScreen(modifier: Modifier = Modifier,
mutableStateOf(false)
}

var isRemember by remember {
mutableStateOf(false)
}

val launcher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.StartIntentSenderForResult(),
onResult = { result ->
Expand Down Expand Up @@ -168,7 +172,7 @@ fun LoginWithPasswordScreen(modifier: Modifier = Modifier,
)

Row(verticalAlignment = Alignment.CenterVertically) {
Checkbox(checked = false, onCheckedChange = {})
Checkbox(checked = isRemember, onCheckedChange = { isRemember = !isRemember })
Text(text = stringResource(id = R.string.remember_me), style = MaterialTheme.typography.labelLarge)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ fun SignupWithPasswordScreen(modifier: Modifier = Modifier,

var isLoading by remember { mutableStateOf(false) }

var isTermsConditions by remember { mutableStateOf(false) }

var email by remember { mutableStateOf("") }
var password by remember { mutableStateOf("") }

Expand Down Expand Up @@ -183,8 +185,8 @@ fun SignupWithPasswordScreen(modifier: Modifier = Modifier,


Row(verticalAlignment = Alignment.CenterVertically) {
Checkbox(checked = false, onCheckedChange = {})
Text(text = stringResource(R.string.remember_me), style = MaterialTheme.typography.labelLarge)
Checkbox(checked = isTermsConditions, onCheckedChange = { isTermsConditions = !isTermsConditions })
Text(text = "I agree to Mflix\'s terms & conditions", style = MaterialTheme.typography.labelLarge)
}

Button(onClick = { onSignupClick(email, password) },
Expand All @@ -196,6 +198,7 @@ fun SignupWithPasswordScreen(modifier: Modifier = Modifier,
shape = RoundedCornerShape(50)
)
.fillMaxWidth(),
enabled = isTermsConditions,
colors = ButtonDefaults.filledTonalButtonColors(containerColor = Color.Red)) {

if (isLoading) {
Expand Down

0 comments on commit 91e1270

Please sign in to comment.