Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
.cxx
local.properties
.idea/jarRepositories.xml
*.klib
20 changes: 11 additions & 9 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
plugins {
id("org.jetbrains.compose")
id("org.jetbrains.kotlin.plugin.compose")
id("com.android.application")
kotlin("android")
}

dependencies {
implementation(project(":reorderable"))
implementation("androidx.compose.runtime:runtime:1.3.3")
implementation("androidx.compose.material:material:1.3.1")
implementation("androidx.activity:activity-compose:1.6.1")
implementation("com.google.android.material:material:1.8.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1")
implementation("androidx.navigation:navigation-compose:2.5.3")
implementation("androidx.compose.runtime:runtime:1.8.1")
implementation("androidx.compose.material3:material3:1.3.2")
implementation("androidx.activity:activity-compose:1.10.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.9.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.9.0")
implementation("androidx.navigation:navigation-compose:2.9.0")
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.appcompat:appcompat-resources:1.7.0")
implementation("io.coil-kt:coil-compose:2.2.2")
}

Expand All @@ -38,7 +40,7 @@ android {
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}
namespace = "org.burnoutcrew.android"
}
}
26 changes: 14 additions & 12 deletions android/src/main/kotlin/org/burnoutcrew/android/ui/Root.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@
package org.burnoutcrew.android.ui

import androidx.compose.foundation.layout.padding
import androidx.compose.material.BottomNavigation
import androidx.compose.material.BottomNavigationItem
import androidx.compose.material.Icon
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.List
import androidx.compose.material.icons.automirrored.filled.List
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material.icons.filled.Star
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.NavigationBar
import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand All @@ -44,6 +45,7 @@ import org.burnoutcrew.android.ui.reorderlist.ReorderList
import org.burnoutcrew.android.ui.theme.ReorderListTheme


@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun Root() {
ReorderListTheme {
Expand Down Expand Up @@ -87,11 +89,11 @@ private fun Navigation(navController: NavHostController, modifier: Modifier) {

@Composable
private fun BottomNavigationBar(items: List<NavigationItem>, navController: NavController) {
BottomNavigation(contentColor = Color.White) {
NavigationBar (contentColor = Color.White) {
val navBackStackEntry = navController.currentBackStackEntryAsState()
val currentRoute = navBackStackEntry.value?.destination?.route
items.forEach { item ->
BottomNavigationItem(
NavigationBarItem(
icon = { Icon(item.icon, item.title) },
label = { Text(text = item.title) },
selected = currentRoute == item.route,
Expand All @@ -112,7 +114,7 @@ private fun BottomNavigationBar(items: List<NavigationItem>, navController: NavC
}

private sealed class NavigationItem(var route: String, var icon: ImageVector, var title: String) {
object Lists : NavigationItem("lists", Icons.Default.List, "Lists")
object Grids : NavigationItem("grids", Icons.Default.Settings, "Grids")
object Fixed : NavigationItem("fixed", Icons.Default.Star, "Fixed")
data object Lists : NavigationItem("lists", Icons.AutoMirrored.Filled.List, "Lists")
data object Grids : NavigationItem("grids", Icons.Default.Settings, "Grids")
data object Fixed : NavigationItem("fixed", Icons.Default.Star, "Fixed")
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyHorizontalGrid
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -78,7 +78,7 @@ private fun HorizontalGrid(
modifier = Modifier
.shadow(elevation.value)
.aspectRatio(1f)
.background(MaterialTheme.colors.secondary)
.background(MaterialTheme.colorScheme.secondary)
) {
Text(item.title)
}
Expand Down Expand Up @@ -107,7 +107,7 @@ private fun VerticalGrid(
contentAlignment = Alignment.Center,
modifier = Modifier
.size(100.dp)
.background(MaterialTheme.colors.surface)
.background(MaterialTheme.colorScheme.surface)
) {
Text(item.title)
}
Expand All @@ -120,7 +120,7 @@ private fun VerticalGrid(
.detectReorderAfterLongPress(state)
.shadow(elevation.value)
.aspectRatio(1f)
.background(MaterialTheme.colors.primary)
.background(MaterialTheme.colorScheme.primary)
) {
Text(item.title)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.Divider
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.List
import androidx.compose.material.icons.automirrored.filled.List
import androidx.compose.material3.HorizontalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -71,14 +71,14 @@ fun ReorderImageList(
modifier = Modifier
.shadow(elevation.value)
.fillMaxWidth()
.background(MaterialTheme.colors.surface)
.background(MaterialTheme.colorScheme.surface)

) {
Row(verticalAlignment = Alignment.CenterVertically) {
Image(
Icons.Default.List,
Icons.AutoMirrored.Filled.List,
"",
colorFilter = ColorFilter.tint(color = MaterialTheme.colors.onBackground),
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onBackground),
modifier = Modifier.detectReorder(state)
)
Image(
Expand All @@ -91,7 +91,7 @@ fun ReorderImageList(
modifier = Modifier.padding(16.dp)
)
}
Divider()
HorizontalDivider()
}
}
}
Expand All @@ -112,7 +112,7 @@ private fun HeaderFooter(title: String, url: String) {
)
Text(
title,
style = MaterialTheme.typography.h2,
style = MaterialTheme.typography.displayMedium,
color = Color.White,
modifier = Modifier.align(Alignment.Center)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Divider
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -86,13 +86,13 @@ private fun VerticalReorderList(
.detectReorderAfterLongPress(state)
.shadow(elevation.value)
.fillMaxWidth()
.background(MaterialTheme.colors.surface)
.background(MaterialTheme.colorScheme.surface)
) {
Text(
text = item.title,
modifier = Modifier.padding(16.dp)
)
Divider()
HorizontalDivider()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package org.burnoutcrew.android.ui.theme

import androidx.compose.ui.graphics.Color

val Purple200 = Color(0xFFBB86FC)
val Purple500 = Color(0xFF6200EE)
val Purple700 = Color(0xFF3700B3)
val Teal200 = Color(0xFF03DAC5)
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)

val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.burnoutcrew.android.ui.theme

import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
import androidx.compose.material3.Shapes
import androidx.compose.ui.unit.dp

val Shapes = Shapes(
Expand Down
58 changes: 41 additions & 17 deletions android/src/main/kotlin/org/burnoutcrew/android/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
@@ -1,33 +1,57 @@
package org.burnoutcrew.android.ui.theme


import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme
import androidx.compose.material.darkColors
import androidx.compose.material.lightColors
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext

private val DarkColorPalette = darkColors(
primary = Purple200,
primaryVariant = Purple700,
secondary = Teal200
private val DarkColorScheme = darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80
)

private val LightColorPalette = lightColors(
primary = Purple500,
primaryVariant = Purple700,
secondary = Teal200
private val LightColorScheme = lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40

/* Other default colors to override
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
onPrimary = Color.White,
onSecondary = Color.White,
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
)

@Composable
fun ReorderListTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
val colors = if (darkTheme) {
DarkColorPalette
} else {
LightColorPalette
fun ReorderListTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}

darkTheme -> DarkColorScheme
else -> LightColorScheme
}

MaterialTheme(
colors = colors,
colorScheme = colorScheme,
typography = Typography,
shapes = Shapes,
content = content
Expand Down
26 changes: 22 additions & 4 deletions android/src/main/kotlin/org/burnoutcrew/android/ui/theme/Type.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
package org.burnoutcrew.android.ui.theme

import androidx.compose.material.Typography
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp

// Set of Material typography styles to start with
val Typography = Typography(
body1 = TextStyle(
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
)
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
)
10 changes: 10 additions & 0 deletions android/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
9 changes: 3 additions & 6 deletions android/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>

<style name="Theme.LazyReorderList" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<item name="android:windowBackground">?attr/colorSurface</item>
</style>
</resources>
<style name="Theme.LazyReorderList" parent="android:Theme.Material.Light.NoActionBar"/>
</resources>
Loading