Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change app logo and improve ui #5

Merged
merged 6 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsCompose) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
alias(libs.plugins.kotlinCocoapods).apply(false)
alias(libs.plugins.kotlinMultiplatform) apply false
}
7 changes: 4 additions & 3 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.compose.compiler) // apply false
alias(libs.plugins.compose.compiler)
id("kotlin-parcelize") // add this
id("kotlin-kapt") // add this
kotlin("plugin.serialization") version "2.0.0"
Expand Down Expand Up @@ -38,14 +38,15 @@ kotlin {
sourceSets {

androidMain.dependencies {
implementation(libs.compose.ui.tooling.preview)
implementation(compose.preview)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.media3.ui)
implementation(libs.androidx.media3.common)
implementation(libs.androidx.media3.exoplayer)
implementation(libs.androidx.media3.session)
}
commonMain.dependencies {
implementation(compose.components.uiToolingPreview)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.materialIconsExtended)
Expand Down Expand Up @@ -127,6 +128,6 @@ android {
targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
debugImplementation(libs.compose.ui.tooling)
debugImplementation(compose.uiTooling)
}
}
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
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_round_background"/>
<foreground android:drawable="@mipmap/ic_launcher_round_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_round_monochrome"/>
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>
30 changes: 0 additions & 30 deletions composeApp/src/commonMain/composeResources/drawable/mgtvlogo.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package common.components

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
Expand Down Expand Up @@ -48,12 +49,13 @@ fun MGTopAppBar(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center,
) {
Icon(
Image(
painter = painterResource(Res.drawable.mgtvlogo),
contentDescription = null,
alignment = Alignment.Center,
modifier =
Modifier
.size(75.dp),
.size(85.dp),
)
}
},
Expand Down
5 changes: 5 additions & 0 deletions composeApp/src/commonMain/kotlin/features/home/Home.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package features.home

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
Expand All @@ -12,6 +14,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
Expand All @@ -30,6 +33,7 @@ fun Home(
getMainFeedClipsPagination: (offset: Int) -> Unit,
getMainFeedClips: (offset: Int, count: Int) -> Unit,
isInitial: Boolean,
innerPadding: PaddingValues
) {
val lazyColumnListState = rememberLazyListState()
var lastCalledIndex by remember { mutableStateOf<Int?>(null) }
Expand Down Expand Up @@ -58,6 +62,7 @@ fun Home(

is ViewState.Success -> {
LazyColumn(
Modifier.padding(innerPadding),
verticalArrangement = Arrangement.spacedBy(16.dp),
state = lazyColumnListState,
) {
Expand Down
49 changes: 24 additions & 25 deletions composeApp/src/commonMain/kotlin/features/home/HomeLayout.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package features.home

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import cafe.adriel.voyager.core.screen.Screen
import com.mgtvapi.viewModel.HomeViewModel
import com.mgtvapi.viewModel.MagazineOverviewViewModel
Expand Down Expand Up @@ -46,30 +43,32 @@ class HomeLayout : Screen {
)
},
) { innerPadding ->
Box(modifier = Modifier.padding(innerPadding)) {
when (route) {
HomeRoute.Home ->
Home(
mainFeedClipsState = homeViewModel.clips.collectAsState().value,
mainFeedClipsPaginationState = homeViewModel.paginationLoading.collectAsState().value,
getMainFeedClips = { offset, count ->
homeViewModel.getMainFeedClips(offset, count)
},
getMainFeedClipsPagination = { offset ->
homeViewModel.getMainFeedClipsPagination(offset)
},
isInitial = homeViewModel.isInitial.collectAsState().value,
)

HomeRoute.Tv -> MagazineOverview(
magazines = magazineOverviewViewModel.magazines.collectAsState().value,
fetchMagazines = { magazineOverviewViewModel.fetchMagazines() }
when (route) {
HomeRoute.Home ->
Home(
mainFeedClipsState = homeViewModel.clips.collectAsState().value,
mainFeedClipsPaginationState = homeViewModel.paginationLoading.collectAsState().value,
getMainFeedClips = { offset, count ->
homeViewModel.getMainFeedClips(offset, count)
},
getMainFeedClipsPagination = { offset ->
homeViewModel.getMainFeedClipsPagination(offset)
},
isInitial = homeViewModel.isInitial.collectAsState().value,
innerPadding = innerPadding
)

HomeRoute.Settings -> Settings(
onLogOutPressed = { homeViewModel.logout() }
)
}
HomeRoute.Tv -> MagazineOverview(
magazines = magazineOverviewViewModel.magazines.collectAsState().value,
fetchMagazines = { magazineOverviewViewModel.fetchMagazines() },
innerPadding = innerPadding
)

HomeRoute.Settings -> Settings(
onLogOutPressed = { homeViewModel.logout() },
innerPadding = innerPadding
)

}
}
}
Expand Down
3 changes: 2 additions & 1 deletion composeApp/src/commonMain/kotlin/features/login/Login.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
Expand Down Expand Up @@ -125,7 +126,7 @@ fun LoginContent(
Image(
painter = painterResource(Res.drawable.mgtvlogo),
contentDescription = "logo",
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.primary),
modifier = Modifier.size(200.dp, 150.dp)
)

Spacer(modifier = Modifier.padding(16.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import common.screens.MagazineScreen
@Composable
fun MagazineOverview(
fetchMagazines: () -> Unit,
magazines: ViewState<List<Magazine>>
magazines: ViewState<List<Magazine>>,
innerPadding: PaddingValues
) {
val navigator = LocalNavigator.currentOrThrow

Expand All @@ -43,6 +44,7 @@ fun MagazineOverview(
is ViewState.Error -> Text(magazines.message, style = MaterialTheme.typography.bodyLarge)
is ViewState.Success -> {
LazyVerticalGrid(
modifier = Modifier.padding(innerPadding),
contentPadding = PaddingValues(5.dp),
columns = GridCells.Adaptive(minSize = 128.dp)
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package features.settings

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
Expand All @@ -12,11 +13,11 @@ import androidx.compose.ui.unit.dp


@Composable
fun Settings(onLogOutPressed: () -> Unit) {
fun Settings(onLogOutPressed: () -> Unit, innerPadding: PaddingValues) {

Column {
Button(
modifier = Modifier.fillMaxWidth().padding(top = 20.dp),
modifier = Modifier.fillMaxWidth().padding(innerPadding),
shape = RoundedCornerShape(30.dp),
onClick = { onLogOutPressed() }
) {
Expand Down
Loading
Loading