Skip to content

Commit

Permalink
Update project
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbel committed Aug 4, 2023
1 parent f92a43a commit 697c0b7
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import org.michaelbel.movies.common.BuildConfig
import org.michaelbel.movies.domain.data.converter.CalendarConverter
import org.michaelbel.movies.domain.data.dao.AccountDao
import org.michaelbel.movies.domain.data.dao.MovieDao
Expand Down Expand Up @@ -33,7 +34,7 @@ internal abstract class AppDatabase: RoomDatabase() {
abstract fun pagingKeyDao(): PagingKeyDao

companion object {
private const val DATABASE_NAME = "movies-db"
private val DATABASE_NAME: String = if (BuildConfig.DEBUG) "movies-db-debug" else "movies-db"
const val DATABASE_VERSION = 14

@Volatile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import org.michaelbel.movies.ui.R
object MoviesIcons {
@DrawableRes val TmdbLogo: Int = R.drawable.ic_tmdb_logo
@DrawableRes val ThemeLightDark: Int = R.drawable.ic_theme_light_dark_24
@DrawableRes val ShortcutSettingsOutline: Int = R.drawable.ic_shortcut_settings_outline_48
@DrawableRes val NotificationSmallIconMovieFilter = R.drawable.ic_movie_filter_24
@DrawableRes val AdultOutline = R.drawable.ic_18_up_rating_outline_24
@DrawableRes val ShortcutSettingsOutline: Int = R.drawable.ic_shortcut_settings_outline_48

val Account: ImageVector = Icons.Outlined.AccountCircle
val ArrowBack: ImageVector = Icons.Outlined.ArrowBack
Expand Down
18 changes: 18 additions & 0 deletions core/ui/src/main/res/drawable/ic_18_up_rating_outline_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M8.5,15l1.5,0l0,-6l-3,0l0,1.5l1.5,0z" />
<path
android:fillColor="@android:color/white"
android:pathData="M19,3H5C3.9,3 3,3.9 3,5v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5C21,3.9 20.1,3 19,3zM19,19H5V5h14V19z" />
<path
android:fillColor="@android:color/white"
android:pathData="M12.5,15H15c0.55,0 1,-0.45 1,-1v-4c0,-0.55 -0.45,-1 -1,-1h-2.5c-0.55,0 -1,0.45 -1,1v4C11.5,14.55 11.95,15 12.5,15zM13,10h1.5v1.5H13V10zM13,12.5h1.5V14H13V12.5z" />
</vector>
9 changes: 5 additions & 4 deletions core/ui/src/main/res/drawable/ic_launcher_monochrome.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:pathData="M66,38L70,44H64L60,38H56L60,44H54L50,38H46L50,44H44L40,38H38C35.8,38 34,39.8 34,42V66C34,68.2 35.8,70 38,70H70C72.2,70 74,68.2 74,66V38H66ZM52.5,60.5L50,66L47.5,60.5L42,58L47.5,55.5L50,50L52.5,55.5L58,58L52.5,60.5ZM63.88,53.88L62,58L60.12,53.88L56,52L60.12,50.12L62,46L63.88,50.12L68,52L63.88,53.88Z"
android:fillColor="#000000"/>
</vector>
<path
android:fillColor="#000000"
android:pathData="M66,38L70,44H64L60,38H56L60,44H54L50,38H46L50,44H44L40,38H38C35.8,38 34,39.8 34,42V66C34,68.2 35.8,70 38,70H70C72.2,70 74,68.2 74,66V38H66ZM52.5,60.5L50,66L47.5,60.5L42,58L47.5,55.5L50,50L52.5,55.5L58,58L52.5,60.5ZM63.88,53.88L62,58L60.12,53.88L56,52L60.12,50.12L62,46L63.88,50.12L68,52L63.88,53.88Z" />
</vector>
1 change: 1 addition & 0 deletions core/ui/src/main/res/drawable/ic_movie_filter_24.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
Expand Down
1 change: 1 addition & 0 deletions core/ui/src/main/res/drawable/ic_theme_light_dark_24.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Button
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
Expand All @@ -28,7 +30,10 @@ import org.michaelbel.movies.account_impl.R
import org.michaelbel.movies.domain.data.entity.AccountDb
import org.michaelbel.movies.domain.data.ktx.orEmpty
import org.michaelbel.movies.ui.compose.AccountAvatar
import org.michaelbel.movies.ui.icons.MoviesIcons
import org.michaelbel.movies.ui.ktx.lettersTextFontSizeLarge
import org.michaelbel.movies.ui.preview.DevicePreviews
import org.michaelbel.movies.ui.theme.MoviesTheme

@Composable
fun AccountRoute(
Expand Down Expand Up @@ -73,6 +78,7 @@ internal fun AccountScreenContent(
nameText,
usernameText,
countryBox,
adultIcon,
logoutButton
) = createRefs()
createVerticalChain(nameText, usernameText, chainStyle = ChainStyle.Packed)
Expand Down Expand Up @@ -101,6 +107,25 @@ internal fun AccountScreenContent(
}
)

if (account.adult) {
Icon(
painter = painterResource(MoviesIcons.AdultOutline),
contentDescription = null,
modifier = Modifier
.constrainAs(adultIcon) {
width = Dimension.value(24.dp)
height = Dimension.value(24.dp)
end.linkTo(accountAvatar.end)
bottom.linkTo(accountAvatar.bottom)
}
.background(
color = MaterialTheme.colorScheme.primaryContainer,
shape = MaterialTheme.shapes.small
),
tint = MaterialTheme.colorScheme.onPrimaryContainer
)
}

Column(
modifier = Modifier
.constrainAs(nameColumn) {
Expand Down Expand Up @@ -146,7 +171,6 @@ internal fun AccountScreenContent(
height = Dimension.wrapContent
start.linkTo(parent.start, 16.dp)
top.linkTo(accountAvatar.bottom, 8.dp)
end.linkTo(parent.end, 16.dp)
}
)
}
Expand Down Expand Up @@ -179,4 +203,25 @@ internal fun AccountScreenContent(
}
}
}
}

@Composable
@DevicePreviews
private fun AccountScreenContentPreview() {
MoviesTheme {
AccountScreenContent(
account = AccountDb(
accountId = 0,
avatarUrl = "",
language = "",
country = "Finland",
name = "Michael Bely",
adult = true,
username = "michaelbel"
),
loading = false,
onBackClick = {},
onLogoutClick = {}
)
}
}

0 comments on commit 697c0b7

Please sign in to comment.