mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-20 07:54:20 +01:00
feature: Add new CSC Screen
This commit is contained in:
9
lib_theme/build.gradle
Normal file
9
lib_theme/build.gradle
Normal file
@@ -0,0 +1,9 @@
|
||||
apply from: rootProject.file("library.gradle")
|
||||
|
||||
dependencies {
|
||||
implementation libs.material
|
||||
|
||||
implementation libs.bundles.compose
|
||||
implementation libs.compose.lifecycle
|
||||
implementation libs.compose.activity
|
||||
}
|
||||
5
lib_theme/src/main/AndroidManifest.xml
Normal file
5
lib_theme/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="no.nordicsemi.android.theme">
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,24 @@
|
||||
package no.nordicsemi.android.theme
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
object Background {
|
||||
|
||||
@Composable
|
||||
fun whiteRoundedCorners(): Modifier {
|
||||
return Modifier
|
||||
.background(Color(0xffffffff))
|
||||
.padding(16.dp)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.clip(RoundedCornerShape(10.dp))
|
||||
}
|
||||
}
|
||||
26
lib_theme/src/main/java/no/nordicsemi/android/theme/Color.kt
Normal file
26
lib_theme/src/main/java/no/nordicsemi/android/theme/Color.kt
Normal file
@@ -0,0 +1,26 @@
|
||||
package no.nordicsemi.android.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
object NordicColors {
|
||||
val Primary = Color(0xFF00A9CE)
|
||||
val PrimaryLight = Color(0xFF5fdbff)
|
||||
val PrimaryDark = Color(0xFF007a9d)
|
||||
val Secondary = Color(0xFF0077c8)
|
||||
val SecondaryLight = Color(0xFF57c0e2)
|
||||
val SecondaryDark = Color(0xFF004c97)
|
||||
val Text = Color(0xFF00A9CE)
|
||||
|
||||
val NordicBlue = Color(0xFF00A9CE)
|
||||
val NordicBlueDark = Color(0xFF0090B0)
|
||||
val NordicSky = Color(0xFF6AD1E3)
|
||||
val NordicBlueLate = Color(0xFF0033A0)
|
||||
val NordicLake = Color(0xFF0077C8)
|
||||
val NordicLightGray = Color(0xFFD9E1E2)
|
||||
val NordicMediumGray = Color(0xFF768692)
|
||||
val NordicDarkGray = Color(0xFF333F48)
|
||||
val NordicGrass = Color(0xFFD0DF00)
|
||||
val NordicSun = Color(0xFFFFCD00)
|
||||
val NordicRed = Color(0xFFEE2F4E)
|
||||
val NordicFall = Color(0xFFF58220)
|
||||
}
|
||||
11
lib_theme/src/main/java/no/nordicsemi/android/theme/Shape.kt
Normal file
11
lib_theme/src/main/java/no/nordicsemi/android/theme/Shape.kt
Normal file
@@ -0,0 +1,11 @@
|
||||
package no.nordicsemi.android.theme
|
||||
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Shapes
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
val Shapes = Shapes(
|
||||
small = RoundedCornerShape(4.dp),
|
||||
medium = RoundedCornerShape(4.dp),
|
||||
large = RoundedCornerShape(0.dp)
|
||||
)
|
||||
51
lib_theme/src/main/java/no/nordicsemi/android/theme/Theme.kt
Normal file
51
lib_theme/src/main/java/no/nordicsemi/android/theme/Theme.kt
Normal file
@@ -0,0 +1,51 @@
|
||||
package no.nordicsemi.android.theme
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.darkColors
|
||||
import androidx.compose.material.lightColors
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
//TODO
|
||||
private val DarkColorPalette = darkColors(
|
||||
primary = NordicColors.Primary,
|
||||
primaryVariant = NordicColors.PrimaryDark,
|
||||
secondary = NordicColors.Secondary,
|
||||
secondaryVariant = NordicColors.SecondaryDark,
|
||||
onSecondary = Color.White,
|
||||
onPrimary = Color.White,
|
||||
onBackground = Color.Black,
|
||||
onSurface = Color.Black,
|
||||
background = Color.White,
|
||||
surface = Color.White,
|
||||
)
|
||||
|
||||
private val LightColorPalette = lightColors(
|
||||
primary = NordicColors.Primary,
|
||||
primaryVariant = NordicColors.PrimaryDark,
|
||||
secondary = NordicColors.Secondary,
|
||||
secondaryVariant = NordicColors.SecondaryDark,
|
||||
onSecondary = Color.White,
|
||||
onPrimary = Color.White,
|
||||
onBackground = Color.Black,
|
||||
onSurface = Color.Black,
|
||||
background = Color.White,
|
||||
surface = Color.White,
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun TestTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable() () -> Unit) {
|
||||
val colors = if (darkTheme) {
|
||||
DarkColorPalette
|
||||
} else {
|
||||
LightColorPalette
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
colors = colors,
|
||||
typography = Typography,
|
||||
shapes = Shapes,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
28
lib_theme/src/main/java/no/nordicsemi/android/theme/Type.kt
Normal file
28
lib_theme/src/main/java/no/nordicsemi/android/theme/Type.kt
Normal file
@@ -0,0 +1,28 @@
|
||||
package no.nordicsemi.android.theme
|
||||
|
||||
import androidx.compose.material.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(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp
|
||||
)
|
||||
/* Other default text styles to override
|
||||
button = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.W500,
|
||||
fontSize = 14.sp
|
||||
),
|
||||
caption = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 12.sp
|
||||
)
|
||||
*/
|
||||
)
|
||||
9
lib_theme/src/main/res/values/colors.xml
Normal file
9
lib_theme/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#FF00A9CE</color>
|
||||
<color name="colorPrimaryDark">#FF007a9d</color>
|
||||
<color name="colorOnPrimary">#FFFFFFFF</color>
|
||||
<color name="colorSecondary">#FF0077c8</color>
|
||||
<color name="colorSecondaryDark">#FF004c97</color>
|
||||
<color name="colorOnSecondary">#FFFFFFFF</color>
|
||||
</resources>
|
||||
25
lib_theme/src/main/res/values/themes.xml
Normal file
25
lib_theme/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Test" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryVariant">@color/colorPrimaryDark</item>
|
||||
<item name="colorOnPrimary">@color/colorOnPrimary</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/colorSecondary</item>
|
||||
<item name="colorSecondaryVariant">@color/colorSecondaryDark</item>
|
||||
<item name="colorOnSecondary">@color/colorOnSecondary</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
|
||||
<style name="Theme.Test.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Test.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="Theme.Test.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
</resources>
|
||||
Reference in New Issue
Block a user