Add HRS service
@@ -1,24 +0,0 @@
|
||||
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))
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,67 @@
|
||||
package no.nordicsemi.android.theme
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
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 AlmostWhite = Color(0xFFDADADA)
|
||||
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)
|
||||
val NordicLake = Color(0xFF008CD2)
|
||||
|
||||
val NordicDarkGray = ThemedColor(Color(0xFF333F48), Color(0xFFCCCBC8))
|
||||
|
||||
// val NordicGray4 = ThemedColor(Color(0xFFD1D1D6), Color(0xFF3A3A3C))
|
||||
val NordicGray4 = ThemedColor(Color.White, Color(0xFF3A3A3C))
|
||||
|
||||
val NordicGray5 = ThemedColor(Color(0xFFE5E5EA), Color(0xFF2C2C2E))
|
||||
val NordicLightGray = NeutralColor(Color(0xFF929CA2))
|
||||
val NordicMediumGray = NeutralColor(Color(0xFF929CA2))
|
||||
|
||||
val NordicFall = ThemedColor(Color(0xFFF99535), Color(0xFFFF9F0A))
|
||||
val NordicGreen = ThemedColor(Color(0xFF3ED052), Color(0xFF32D74B))
|
||||
|
||||
val NordicOrange = ThemedColor(Color(0xFFDF9B16), Color(0xFFFF9F0A))
|
||||
val NordicRed = ThemedColor(Color(0xFFD03E51), Color(0xFFFF453A))
|
||||
val NordicSky = NeutralColor(Color(0xFF6AD1E3))
|
||||
val NordicYellow = ThemedColor(Color(0xFFF9EE35), Color(0xFFFFD60A))
|
||||
val TableViewBackground = NeutralColor(Color(0xFFF2F2F6))
|
||||
val TableViewSeparator = NeutralColor(Color(0xFFD2D2D6))
|
||||
|
||||
val Primary = ThemedColor(Color(0xFF00A9CE), Color(0xFF212121))
|
||||
val PrimaryVariant = ThemedColor(Color(0xFF008CD2), Color.Black)
|
||||
val Secondary = ThemedColor(Color(0xFF00A9CE), Color(0xFF008CD2))
|
||||
val SecondaryVariant = ThemedColor(Color(0xFF008CD2), Color(0xFF008CD2))
|
||||
val OnPrimary = ThemedColor(Color.White, Color.White)
|
||||
val OnSecondary = ThemedColor(Color.White, Color.White)
|
||||
val OnBackground = ThemedColor(Color.Black, Color.White)
|
||||
val OnSurface = ThemedColor(Color.Black, Color.White)
|
||||
val Background = ThemedColor(Color(0xFFDADADA), Color.Black)
|
||||
val Surface = ThemedColor(Color(0xFFDADADA), Color.Black)
|
||||
}
|
||||
|
||||
sealed class NordicColor {
|
||||
|
||||
@Composable
|
||||
abstract fun value(): Color
|
||||
}
|
||||
|
||||
data class ThemedColor(val light: Color, val dark: Color): NordicColor() {
|
||||
|
||||
@Composable
|
||||
override fun value(): Color {
|
||||
return if (isSystemInDarkTheme()) {
|
||||
dark
|
||||
} else {
|
||||
light
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class NeutralColor(val color: Color): NordicColor() {
|
||||
|
||||
@Composable
|
||||
override fun value(): Color {
|
||||
return color
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,41 +5,40 @@ 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 darkColorPalette = darkColors(
|
||||
primary = NordicColors.Primary.value(),
|
||||
primaryVariant = NordicColors.PrimaryVariant.value(),
|
||||
secondary = NordicColors.Secondary.value(),
|
||||
secondaryVariant = NordicColors.SecondaryVariant.value(),
|
||||
onSecondary = NordicColors.OnSecondary.value(),
|
||||
onPrimary = NordicColors.OnPrimary.value(),
|
||||
onBackground = NordicColors.OnBackground.value(),
|
||||
onSurface = NordicColors.OnSurface.value(),
|
||||
background = NordicColors.Background.value(),
|
||||
surface = NordicColors.Surface.value(),
|
||||
)
|
||||
|
||||
val lightColorPalette = lightColors(
|
||||
primary = NordicColors.Primary.value(),
|
||||
primaryVariant = NordicColors.PrimaryVariant.value(),
|
||||
secondary = NordicColors.Secondary.value(),
|
||||
secondaryVariant = NordicColors.SecondaryVariant.value(),
|
||||
onSecondary = NordicColors.OnSecondary.value(),
|
||||
onPrimary = NordicColors.OnPrimary.value(),
|
||||
onBackground = NordicColors.OnBackground.value(),
|
||||
onSurface = NordicColors.OnSurface.value(),
|
||||
background = NordicColors.Background.value(),
|
||||
surface = NordicColors.Surface.value(),
|
||||
)
|
||||
|
||||
val colors = if (darkTheme) {
|
||||
DarkColorPalette
|
||||
darkColorPalette
|
||||
} else {
|
||||
LightColorPalette
|
||||
lightColorPalette
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package no.nordicsemi.android.theme.view
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Card
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import no.nordicsemi.android.theme.NordicColors
|
||||
import no.nordicsemi.android.theme.R
|
||||
|
||||
@Composable
|
||||
fun BatteryLevelView(batteryLevel: Int) {
|
||||
Card(
|
||||
backgroundColor = NordicColors.NordicGray4.value(),
|
||||
shape = RoundedCornerShape(10.dp),
|
||||
elevation = 0.dp
|
||||
) {
|
||||
Box(modifier = Modifier.padding(16.dp)) {
|
||||
KeyValueField(
|
||||
stringResource(id = R.string.field_battery),
|
||||
"$batteryLevel%"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package no.nordicsemi.android.theme.view
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import no.nordicsemi.android.theme.NordicColors
|
||||
|
||||
@Composable
|
||||
fun KeyValueField(key: String, value: String) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(text = key)
|
||||
Text(
|
||||
color = NordicColors.NordicDarkGray.value(),
|
||||
text = value
|
||||
)
|
||||
}
|
||||
}
|
||||
27
lib_theme/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2017, Nordic Semiconductor
|
||||
~ All rights reserved.
|
||||
~
|
||||
~ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
~
|
||||
~ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
~
|
||||
~ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
|
||||
~ documentation and/or other materials provided with the distribution.
|
||||
~
|
||||
~ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this
|
||||
~ software without specific prior written permission.
|
||||
~
|
||||
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
~ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
~ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
~ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
~ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/actionBarColor"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2017, Nordic Semiconductor
|
||||
~ All rights reserved.
|
||||
~
|
||||
~ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
~
|
||||
~ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
~
|
||||
~ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
|
||||
~ documentation and/or other materials provided with the distribution.
|
||||
~
|
||||
~ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this
|
||||
~ software without specific prior written permission.
|
||||
~
|
||||
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
~ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
~ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
~ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
~ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/actionBarColor"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
BIN
lib_theme/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
lib_theme/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
lib_theme/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
lib_theme/src/main/res/mipmap-hdpi/ic_shortcut_dfu.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
lib_theme/src/main/res/mipmap-hdpi/ic_shortcut_uart.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
lib_theme/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
lib_theme/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
lib_theme/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
lib_theme/src/main/res/mipmap-mdpi/ic_shortcut_dfu.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
lib_theme/src/main/res/mipmap-mdpi/ic_shortcut_uart.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
lib_theme/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
lib_theme/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
lib_theme/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
lib_theme/src/main/res/mipmap-xhdpi/ic_shortcut_dfu.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
lib_theme/src/main/res/mipmap-xhdpi/ic_shortcut_uart.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
lib_theme/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
lib_theme/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
lib_theme/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
lib_theme/src/main/res/mipmap-xxhdpi/ic_shortcut_dfu.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
lib_theme/src/main/res/mipmap-xxhdpi/ic_shortcut_uart.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
lib_theme/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
BIN
lib_theme/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
lib_theme/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
lib_theme/src/main/res/mipmap-xxxhdpi/ic_shortcut_dfu.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
lib_theme/src/main/res/mipmap-xxxhdpi/ic_shortcut_uart.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
11
lib_theme/src/main/res/values-night/colors.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#FF212121</color>
|
||||
<color name="colorPrimaryDark">@android:color/black</color>
|
||||
<color name="colorSecondary">#FF008CD2</color>
|
||||
<color name="colorSecondaryDark">#FF008CD2</color>
|
||||
<color name="colorOnSecondary">#FFFFFFFF</color>
|
||||
<color name="colorOnPrimary">#FFFFFFFF</color>
|
||||
<color name="background">@android:color/black</color>
|
||||
<color name="actionBarColor">#FF0090B0</color>
|
||||
</resources>
|
||||
@@ -6,4 +6,6 @@
|
||||
<color name="colorSecondary">#FF0077c8</color>
|
||||
<color name="colorSecondaryDark">#FF004c97</color>
|
||||
<color name="colorOnSecondary">#FFFFFFFF</color>
|
||||
<color name="background">#FFDADADA</color>
|
||||
<color name="actionBarColor">#FF0090B0</color>
|
||||
</resources>
|
||||
|
||||
7
lib_theme/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">nRF Toolbox</string>
|
||||
|
||||
<string name="disconnect">Disconnect</string>
|
||||
<string name="field_battery">Battery</string>
|
||||
</resources>
|
||||
@@ -2,6 +2,7 @@
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Test" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="android:background">@color/background</item>
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryVariant">@color/colorPrimaryDark</item>
|
||||
<item name="colorOnPrimary">@color/colorOnPrimary</item>
|
||||
|
||||