Skip to content

Commit

Permalink
Amoled theme (#211)
Browse files Browse the repository at this point in the history
* Amoled theme

* Amoled theme

* Amoled theme
  • Loading branch information
michaelbel authored Jan 30, 2024
1 parent 8057d52 commit 585ca23
Show file tree
Hide file tree
Showing 69 changed files with 1,153 additions and 117 deletions.
Binary file added config/images/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added config/images/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added config/images/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ sealed interface AppTheme {

data object FollowSystem: AppTheme

data object Amoled: AppTheme

companion object {
val VALUES: List<AppTheme> = listOf(
NightNo,
NightYes,
FollowSystem
FollowSystem,
Amoled
)

fun transform(name: String): AppTheme {
return when (name) {
NightNo.toString() -> NightNo
NightYes.toString() -> NightYes
FollowSystem.toString() -> FollowSystem
Amoled.toString() -> Amoled
else -> throw InvalidThemeException
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.michaelbel.movies.ui.R
import org.michaelbel.movies.ui.preview.DevicePreviews
import org.michaelbel.movies.ui.theme.AmoledTheme
import org.michaelbel.movies.ui.theme.MoviesTheme

@Composable
Expand All @@ -28,7 +30,7 @@ fun ApiKeyBox(
Text(
text = stringResource(R.string.error_api_key_null),
style = MaterialTheme.typography.bodyLarge.copy(
color = MaterialTheme.colorScheme.onBackground
color = MaterialTheme.colorScheme.onPrimaryContainer
)
)
}
Expand All @@ -42,7 +44,20 @@ private fun ApiKeyBoxPreview() {
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 16.dp)
.background(MaterialTheme.colorScheme.background)
.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}

@Composable
@Preview
private fun ApiKeyBoxAmoledPreview() {
AmoledTheme {
ApiKeyBox(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 16.dp)
.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -33,12 +34,14 @@ import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.michaelbel.movies.ui.R
import org.michaelbel.movies.ui.accessibility.MoviesContentDescription
import org.michaelbel.movies.ui.icons.MoviesIcons
import org.michaelbel.movies.ui.ktx.appNotificationSettingsIntent
import org.michaelbel.movies.ui.preview.DevicePreviews
import org.michaelbel.movies.ui.theme.AmoledTheme
import org.michaelbel.movies.ui.theme.MoviesTheme

@Composable
Expand Down Expand Up @@ -96,8 +99,8 @@ fun NotificationBottomSheet(
contentDescription = MoviesContentDescription.None,
modifier = Modifier.graphicsLayer(
transformOrigin = TransformOrigin(
pivotFractionX = 0.5f,
pivotFractionY = 0.0f,
pivotFractionX = 0.5F,
pivotFractionY = 0.0F,
),
rotationZ = value
),
Expand All @@ -110,7 +113,7 @@ fun NotificationBottomSheet(
modifier = Modifier.padding(start = 16.dp, top = 16.dp, end = 16.dp),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.titleLarge.copy(
color = MaterialTheme.colorScheme.onBackground
color = MaterialTheme.colorScheme.onPrimaryContainer
)
)

Expand All @@ -119,7 +122,7 @@ fun NotificationBottomSheet(
modifier = Modifier.padding(start = 16.dp, top = 8.dp, end = 16.dp),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodyMedium.copy(
color = MaterialTheme.colorScheme.onBackground
color = MaterialTheme.colorScheme.onPrimaryContainer
)
)

Expand All @@ -135,6 +138,9 @@ fun NotificationBottomSheet(
}
}
},
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.surfaceTint
),
modifier = Modifier.padding(top = 16.dp, bottom = 32.dp)
) {
Text(
Expand All @@ -149,7 +155,22 @@ fun NotificationBottomSheet(
private fun NotificationBottomSheetPreview() {
MoviesTheme {
NotificationBottomSheet(
modifier = Modifier.fillMaxWidth(),
modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.primaryContainer),
onBottomSheetHide = {}
)
}
}

@Composable
@Preview
private fun NotificationBottomSheetAmoledPreview() {
AmoledTheme {
NotificationBottomSheet(
modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.primaryContainer),
onBottomSheetHide = {}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import org.michaelbel.movies.ui.accessibility.MoviesContentDescription
import org.michaelbel.movies.ui.icons.MoviesIcons
import org.michaelbel.movies.ui.preview.DevicePreviews
import org.michaelbel.movies.ui.theme.AmoledTheme
import org.michaelbel.movies.ui.theme.MoviesTheme

@Composable
Expand All @@ -36,7 +38,18 @@ private fun BackIconPreview() {
MoviesTheme {
BackIcon(
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.background)
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}

@Composable
@Preview
private fun BackIconAmoledPreview() {
AmoledTheme {
BackIcon(
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import org.michaelbel.movies.ui.accessibility.MoviesContentDescription
import org.michaelbel.movies.ui.icons.MoviesIcons
import org.michaelbel.movies.ui.preview.DevicePreviews
import org.michaelbel.movies.ui.theme.AmoledTheme
import org.michaelbel.movies.ui.theme.MoviesTheme

@Composable
Expand All @@ -36,7 +38,18 @@ private fun CloseIconPreview() {
MoviesTheme {
CloseIcon(
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.background)
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}

@Composable
@Preview
private fun CloseIconAmoledPreview() {
AmoledTheme {
CloseIcon(
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import org.michaelbel.movies.ui.accessibility.MoviesContentDescription
import org.michaelbel.movies.ui.icons.MoviesIcons
import org.michaelbel.movies.ui.preview.DevicePreviews
import org.michaelbel.movies.ui.theme.AmoledTheme
import org.michaelbel.movies.ui.theme.MoviesTheme

@Composable
Expand All @@ -36,7 +38,18 @@ fun DownloadIconPreview() {
MoviesTheme {
DownloadIcon(
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.background)
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}

@Composable
@Preview
private fun DownloadIconAmoledPreview() {
AmoledTheme {
DownloadIcon(
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package org.michaelbel.movies.ui.compose.iconbutton

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import org.michaelbel.movies.ui.accessibility.MoviesContentDescription
import org.michaelbel.movies.ui.icons.MoviesIcons
import org.michaelbel.movies.ui.preview.DevicePreviews
import org.michaelbel.movies.ui.preview.provider.BooleanPreviewParameterProvider
import org.michaelbel.movies.ui.theme.AmoledTheme
import org.michaelbel.movies.ui.theme.MoviesTheme

@Composable
Expand All @@ -24,9 +27,10 @@ fun PasswordIcon(
onClick = onClick,
modifier = modifier
) {
Icon(
Image(
imageVector = if (state) MoviesIcons.Visibility else MoviesIcons.VisibilityOff,
contentDescription = stringResource(if (state) MoviesContentDescription.PasswordIcon else MoviesContentDescription.PasswordOffIcon)
contentDescription = stringResource(if (state) MoviesContentDescription.PasswordIcon else MoviesContentDescription.PasswordOffIcon),
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onPrimaryContainer)
)
}
}
Expand All @@ -40,7 +44,21 @@ private fun PasswordIconPreview(
PasswordIcon(
state = state,
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.background)
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}

@Composable
@Preview
private fun PasswordIconAmoledPreview(
@PreviewParameter(BooleanPreviewParameterProvider::class) state: Boolean
) {
AmoledTheme {
PasswordIcon(
state = state,
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import org.michaelbel.movies.ui.accessibility.MoviesContentDescription
import org.michaelbel.movies.ui.icons.MoviesIcons
import org.michaelbel.movies.ui.preview.DevicePreviews
import org.michaelbel.movies.ui.theme.AmoledTheme
import org.michaelbel.movies.ui.theme.MoviesTheme

@Composable
Expand All @@ -36,7 +38,18 @@ private fun SearchIconPreview() {
MoviesTheme {
SearchIcon(
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.background)
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}

@Composable
@Preview
private fun SearchIconAmoledPreview() {
AmoledTheme {
SearchIcon(
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import org.michaelbel.movies.ui.accessibility.MoviesContentDescription
import org.michaelbel.movies.ui.icons.MoviesIcons
import org.michaelbel.movies.ui.preview.DevicePreviews
import org.michaelbel.movies.ui.theme.AmoledTheme
import org.michaelbel.movies.ui.theme.MoviesTheme

@Composable
Expand All @@ -36,7 +38,18 @@ private fun SettingsIconPreview() {
MoviesTheme {
SettingsIcon(
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.background)
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}

@Composable
@Preview
private fun SettingsIconAmoledPreview() {
AmoledTheme {
SettingsIcon(
onClick = {},
modifier = Modifier.background(MaterialTheme.colorScheme.primaryContainer)
)
}
}
Loading

0 comments on commit 585ca23

Please sign in to comment.