Add map data flow and port legacy app theming.

This bundles the GraphQL-backed map scaffolding with the old AirMQ visual style by applying legacy colors, reusable button styles, and original bottom navigation icons for UI parity.

Made-with: Cursor
This commit is contained in:
2026-02-28 15:52:55 +01:00
parent 43c21a0cd5
commit efcd140966
16 changed files with 1546 additions and 236 deletions

View File

@@ -0,0 +1,10 @@
query MapLocations {
locations {
_id
name
city
latitude
longitude
isOnline
}
}

View File

@@ -0,0 +1,709 @@
"""
A custom scalar that returns date and time as JavaScript Date object
"""
scalar Date
"""
A custom scalar that returns data as a generic JavaScript Object. Data will be returned
as a String, when data is published as a simple string.
"""
scalar Object
enum Role {
visitor
apiUser
admin
}
"""
Location
"""
type Location {
"""
Location ID
"""
_id: String!
"""
City name in English
"""
city: String
"""
Location name
"""
name: String!
"""
Location online state
"""
isOnline: Boolean
"""
Location latitude
"""
latitude: Float!
"""
Location longitude
"""
longitude: Float!
"""
Location telemetry info
"""
status: Status
"""
Location metric list
"""
metricList: [String]!
"""
Last sensor value set
"""
currentValue(filter: TimeSpan): SensorData
"""
Sensor values for certain time span
"""
timeSeries(filter: TimeSpan): [SensorData]
"""
Sensor values to export for certain time span
"""
timeSeries_export(filter: TimeSpan): [SensorData]
}
"""
The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
"""
scalar String
"""
The `Boolean` scalar type represents `true` or `false`.
"""
scalar Boolean
"""
The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).
"""
scalar Float
type Status {
_id: String!
RSSI: Int
channel: Int
build: String
created: String
ext_ip: String
local_ip: String
isOnline: Boolean
start: String
uptime: Int
}
"""
The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
"""
scalar Int
"""
Sensor values
"""
type SensorData {
"""
Time in ISO 8601 format, UTC time
"""
time: DateTime!
"""
Primary temperature, °C
"""
Temp: Float
"""
Secondary temperature, °C
"""
Temp1: Float
"""
Water temperature, °C
"""
wTemp: Float
"""
Relative humidity, %
"""
Hum: Float
"""
Air pressure, Pa
"""
Press: Float
"""
PM1 particulate matter, μg/m³
"""
PMS1: Float
"""
PM2.5 particulate matter, μg/m³
"""
PMS25: Float
"""
PM10 particulate matter, μg/m³
"""
PMS10: Float
"""
Ambient radioactivity, μSv/h
"""
Count: Float
"""
NOx index
"""
NOx: Float
"""
VOC index
"""
VOC: Float
"""
AQI index
"""
AQI: Int
"""
IKAV index
"""
IKAV: Float
"""
Water level
"""
WaterLevel: Float
"""
Solar irradiance
"""
SolRad: Float
"""
Illumination level
"""
Light: Float
}
type Telemetry {
deviceId: String
time: String!
IP: String
VCC: String
RSSI: String
Uptime: String
}
type AuthResponse {
token: String
name: String
email: String
id: String
}
type City {
_id: String
countryCode: String
cityName: CityName
locationCount: Int
latitude: Float
longitude: Float
}
type CityName {
be: String
ru: String
en: String
ge: String
pl: String
}
type Marker {
_id: String
name: String
latitude: Float
longitude: Float
"""
status: Status
"""
text: String
isPublic: Boolean
owned: Boolean
metricList: [String]
value: Float
values: [SensorData]
}
input LocationFilter {
_id: String
name: String
}
input LocationsFilter {
_ids: [String]
city: String
cityName: String
cityId: String
isOnline: Boolean
}
input TimeSpan {
t_from: String
t_to: String
interval_d: Int = 0
interval_h: Int = 0
interval_m: Int = 0
}
input LastFilter {
city: String
interval_d: Int = 0
interval_h: Int = 0
interval_m: Int = 15
}
input MeanFilter {
city: String
t_from: String!
t_to: String!
interval_d: Int = 0
interval_h: Int = 0
interval_m: Int = 15
}
input AuthInput {
uid: String
accessToken: String!
}
input LocInput {
_id: String
}
enum Sensor {
DUST
TEMPERATURE
HUMIDITY
PRESSURE
RADIOACTIVITY
WATERLEVEL
}
enum TimeFilter {
HOUR
DAY
WEEK
MONTH
}
input MarkerFilter {
city: String
isOnline: Boolean
mapLayer: String
}
type Query {
location(filter: LocationFilter): Location
locations(filter: LocationsFilter): [Location]
myLocation: Location
myLocations: [Location]
cityList(countryCode: String): [City]
cityAverage(filter: LastFilter): SensorData
cityAverages(filter: MeanFilter): [SensorData]
getMarkers(filter: MarkerFilter): [Marker]
}
"""
A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.
"""
scalar DateTime
"""
A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.
"""
type __Schema {
description: String
"""
A list of all types supported by this server.
"""
types: [__Type!]!
"""
The type that query operations will be rooted at.
"""
queryType: __Type!
"""
If this server supports mutation, the type that mutation operations will be rooted at.
"""
mutationType: __Type
"""
If this server support subscription, the type that subscription operations will be rooted at.
"""
subscriptionType: __Type
"""
A list of all directives supported by this server.
"""
directives: [__Directive!]!
}
"""
The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.
Depending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByUrl`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.
"""
type __Type {
kind: __TypeKind!
name: String
description: String
specifiedByUrl: String
fields(includeDeprecated: Boolean = false): [__Field!]
interfaces: [__Type!]
possibleTypes: [__Type!]
enumValues(includeDeprecated: Boolean = false): [__EnumValue!]
inputFields(includeDeprecated: Boolean = false): [__InputValue!]
ofType: __Type
}
"""
An enum describing what kind of type a given `__Type` is.
"""
enum __TypeKind {
"""
Indicates this type is a scalar.
"""
SCALAR
"""
Indicates this type is an object. `fields` and `interfaces` are valid fields.
"""
OBJECT
"""
Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.
"""
INTERFACE
"""
Indicates this type is a union. `possibleTypes` is a valid field.
"""
UNION
"""
Indicates this type is an enum. `enumValues` is a valid field.
"""
ENUM
"""
Indicates this type is an input object. `inputFields` is a valid field.
"""
INPUT_OBJECT
"""
Indicates this type is a list. `ofType` is a valid field.
"""
LIST
"""
Indicates this type is a non-null. `ofType` is a valid field.
"""
NON_NULL
}
"""
Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.
"""
type __Field {
name: String!
description: String
args(includeDeprecated: Boolean = false): [__InputValue!]!
type: __Type!
isDeprecated: Boolean!
deprecationReason: String
}
"""
Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.
"""
type __InputValue {
name: String!
description: String
type: __Type!
"""
A GraphQL-formatted string representing the default value for this input value.
"""
defaultValue: String
isDeprecated: Boolean!
deprecationReason: String
}
"""
One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.
"""
type __EnumValue {
name: String!
description: String
isDeprecated: Boolean!
deprecationReason: String
}
"""
A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.
In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.
"""
type __Directive {
name: String!
description: String
isRepeatable: Boolean!
locations: [__DirectiveLocation!]!
args: [__InputValue!]!
}
"""
A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.
"""
enum __DirectiveLocation {
"""
Location adjacent to a query operation.
"""
QUERY
"""
Location adjacent to a mutation operation.
"""
MUTATION
"""
Location adjacent to a subscription operation.
"""
SUBSCRIPTION
"""
Location adjacent to a field.
"""
FIELD
"""
Location adjacent to a fragment definition.
"""
FRAGMENT_DEFINITION
"""
Location adjacent to a fragment spread.
"""
FRAGMENT_SPREAD
"""
Location adjacent to an inline fragment.
"""
INLINE_FRAGMENT
"""
Location adjacent to a variable definition.
"""
VARIABLE_DEFINITION
"""
Location adjacent to a schema definition.
"""
SCHEMA
"""
Location adjacent to a scalar definition.
"""
SCALAR
"""
Location adjacent to an object type definition.
"""
OBJECT
"""
Location adjacent to a field definition.
"""
FIELD_DEFINITION
"""
Location adjacent to an argument definition.
"""
ARGUMENT_DEFINITION
"""
Location adjacent to an interface definition.
"""
INTERFACE
"""
Location adjacent to a union definition.
"""
UNION
"""
Location adjacent to an enum definition.
"""
ENUM
"""
Location adjacent to an enum value definition.
"""
ENUM_VALUE
"""
Location adjacent to an input object type definition.
"""
INPUT_OBJECT
"""
Location adjacent to an input object field definition.
"""
INPUT_FIELD_DEFINITION
}
directive @hasScope(scopes: [String]) on OBJECT | FIELD_DEFINITION
directive @hasRole(roles: [Role]) on OBJECT | FIELD_DEFINITION
directive @isAuthenticated on OBJECT | FIELD_DEFINITION
directive @isHidden on OBJECT | FIELD_DEFINITION | ENUM
directive @undocumented on OBJECT | FIELD_DEFINITION | ENUM
"""
Directs the executor to include this field or fragment only when the `if` argument is true.
"""
directive @include("Included when true." if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
"""
Directs the executor to skip this field or fragment when the `if` argument is true.
"""
directive @skip("Skipped when true." if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
"""
Marks an element of a GraphQL schema as no longer supported.
"""
directive @deprecated("Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/)." reason: String = "No longer supported") on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE
"""
Exposes a URL that specifies the behaviour of this scalar.
"""
directive @specifiedBy("The URL that specifies the behaviour of this scalar." url: String!) on SCALAR
schema {
query: Query
}

View File

@@ -0,0 +1,202 @@
package org.db3.airmq.features.common
import androidx.compose.foundation.background
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.BorderStroke
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import org.db3.airmq.ui.theme.LegacyButtonContained
import org.db3.airmq.ui.theme.LegacyButtonGradientEnd
import org.db3.airmq.ui.theme.LegacyButtonGradientStart
import org.db3.airmq.ui.theme.LegacyButtonOnContained
import org.db3.airmq.ui.theme.LegacyButtonOnOutlined
import org.db3.airmq.ui.theme.LegacyButtonOnText
import org.db3.airmq.ui.theme.LegacyOutlineLight
enum class AirMqButtonStyle {
Contained,
Outlined,
Text,
Gradient
}
private val LegacyButtonShape = RoundedCornerShape(18.dp)
private val LegacyButtonHeight = 36.dp
private val LegacyDisabledContainer = Color(0xFFE0E0E0)
private val LegacyDisabledContent = Color(0x61000000)
@Composable
fun AirMqButton(
text: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
style: AirMqButtonStyle = AirMqButtonStyle.Contained
) {
when (style) {
AirMqButtonStyle.Contained -> AirMqContainedButton(
text = text,
onClick = onClick,
modifier = modifier,
enabled = enabled
)
AirMqButtonStyle.Outlined -> AirMqOutlinedButton(
text = text,
onClick = onClick,
modifier = modifier,
enabled = enabled
)
AirMqButtonStyle.Text -> AirMqTextButton(
text = text,
onClick = onClick,
modifier = modifier,
enabled = enabled
)
AirMqButtonStyle.Gradient -> AirMqGradientButton(
text = text,
onClick = onClick,
modifier = modifier,
enabled = enabled
)
}
}
@Composable
fun AirMqContainedButton(
text: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true
) {
Button(
onClick = onClick,
enabled = enabled,
shape = LegacyButtonShape,
modifier = modifier.heightIn(min = LegacyButtonHeight),
colors = ButtonDefaults.buttonColors(
containerColor = LegacyButtonContained,
contentColor = LegacyButtonOnContained,
disabledContainerColor = LegacyDisabledContainer,
disabledContentColor = LegacyDisabledContent
)
) {
Text(text = text, fontWeight = FontWeight.Medium)
}
}
@Composable
fun AirMqOutlinedButton(
text: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true
) {
OutlinedButton(
onClick = onClick,
enabled = enabled,
shape = LegacyButtonShape,
border = BorderStroke(
width = 1.dp,
color = if (enabled) LegacyOutlineLight else LegacyDisabledContent
),
modifier = modifier.heightIn(min = LegacyButtonHeight),
colors = ButtonDefaults.outlinedButtonColors(
contentColor = LegacyButtonOnOutlined,
disabledContentColor = LegacyDisabledContent
)
) {
Text(text = text, fontWeight = FontWeight.Medium)
}
}
@Composable
fun AirMqTextButton(
text: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true
) {
TextButton(
onClick = onClick,
enabled = enabled,
shape = LegacyButtonShape,
modifier = modifier.heightIn(min = LegacyButtonHeight),
colors = ButtonDefaults.textButtonColors(
contentColor = LegacyButtonOnText,
disabledContentColor = LegacyDisabledContent
)
) {
Text(text = text, fontWeight = FontWeight.Medium)
}
}
@Composable
fun AirMqGradientButton(
text: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true
) {
val interactionSource = remember { MutableInteractionSource() }
val isPressed by interactionSource.collectIsPressedAsState()
val overlay = when {
!enabled -> Color.Black.copy(alpha = 0.12f)
isPressed -> Color.Black.copy(alpha = 0.2f)
else -> Color.Transparent
}
Button(
onClick = onClick,
enabled = enabled,
shape = LegacyButtonShape,
interactionSource = interactionSource,
modifier = modifier
.heightIn(min = LegacyButtonHeight)
.clip(LegacyButtonShape),
contentPadding = PaddingValues(0.dp),
colors = ButtonDefaults.buttonColors(
containerColor = Color.Transparent,
contentColor = LegacyButtonOnContained,
disabledContainerColor = Color.Transparent,
disabledContentColor = LegacyDisabledContent
)
) {
Box(
modifier = Modifier
.fillMaxWidth()
.clip(LegacyButtonShape)
.background(
brush = Brush.horizontalGradient(
colors = listOf(LegacyButtonGradientStart, LegacyButtonGradientEnd)
)
)
.background(overlay),
contentAlignment = Alignment.Center
) {
Text(
text = text,
fontWeight = FontWeight.Medium,
color = if (enabled) LegacyButtonOnContained else LegacyDisabledContent
)
}
}
}

View File

@@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text import androidx.compose.material3.Text
@@ -18,7 +17,8 @@ import androidx.compose.ui.unit.dp
data class ScreenAction( data class ScreenAction(
val label: String, val label: String,
val onClick: () -> Unit val onClick: () -> Unit,
val style: AirMqButtonStyle = AirMqButtonStyle.Contained
) )
@Composable @Composable
@@ -61,9 +61,12 @@ private fun ScreenContent(
} }
content?.invoke() content?.invoke()
actions.forEach { action -> actions.forEach { action ->
Button(onClick = action.onClick, modifier = Modifier.fillMaxWidth()) { AirMqButton(
Text(text = action.label) text = action.label,
} onClick = action.onClick,
style = action.style,
modifier = Modifier.fillMaxWidth()
)
} }
} }
} }

View File

@@ -0,0 +1,110 @@
package org.db3.airmq.features.map
import org.json.JSONArray
import org.json.JSONObject
import java.io.BufferedReader
import java.io.OutputStreamWriter
import java.net.HttpURLConnection
import java.net.URL
class AirMqMapApi {
fun fetchMapItems(): List<MapItem> {
val payload = JSONObject()
.put("query", LOCATIONS_QUERY)
.put("variables", JSONObject())
val connection = (URL(API_URL).openConnection() as HttpURLConnection).apply {
requestMethod = "POST"
connectTimeout = 15_000
readTimeout = 15_000
setRequestProperty("Content-Type", "application/json")
doInput = true
doOutput = true
}
return try {
OutputStreamWriter(connection.outputStream).use { writer ->
writer.write(payload.toString())
writer.flush()
}
val responseCode = connection.responseCode
val body = readResponseBody(connection, responseCode)
if (responseCode !in 200..299) {
throw IllegalStateException("Map API request failed: HTTP $responseCode")
}
parseMapItems(body)
} finally {
connection.disconnect()
}
}
private fun parseMapItems(rawJson: String): List<MapItem> {
val root = JSONObject(rawJson)
val errors = root.optJSONArray("errors")
if (errors != null && errors.length() > 0) {
throw IllegalStateException(firstGraphQlError(errors))
}
val data = root.optJSONObject("data")
?: throw IllegalStateException("Map API response is missing data")
val locations = data.optJSONArray("locations") ?: JSONArray()
return buildList {
for (index in 0 until locations.length()) {
val location = locations.optJSONObject(index) ?: continue
val id = location.optString("_id")
val latitude = location.optDouble("latitude", Double.NaN)
val longitude = location.optDouble("longitude", Double.NaN)
if (id.isBlank() || latitude.isNaN() || longitude.isNaN()) {
continue
}
add(
MapItem(
id = id,
title = location.optString("name").ifBlank { id },
city = location.optString("city").ifBlank { null },
latitude = latitude,
longitude = longitude,
isOnline = location.optBoolean("isOnline", false)
)
)
}
}
}
private fun readResponseBody(connection: HttpURLConnection, responseCode: Int): String {
val source = if (responseCode in 200..299) {
connection.inputStream
} else {
connection.errorStream ?: connection.inputStream
}
return source.bufferedReader().use(BufferedReader::readText)
}
private fun firstGraphQlError(errors: JSONArray): String {
val firstError = errors.optJSONObject(0)
return firstError?.optString("message").orEmpty().ifBlank {
"Map API returned an unknown GraphQL error"
}
}
companion object {
private const val API_URL = "https://api.airmq.cc"
private const val LOCATIONS_QUERY = """
query MapLocations {
locations {
_id
name
city
latitude
longitude
isOnline
}
}
"""
}
}

View File

@@ -0,0 +1,10 @@
package org.db3.airmq.features.map
data class MapItem(
val id: String,
val title: String,
val city: String?,
val latitude: Double,
val longitude: Double,
val isOnline: Boolean
)

View File

@@ -1,20 +1,129 @@
package org.db3.airmq.features.map package org.db3.airmq.features.map
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import org.db3.airmq.features.common.MockScreenScaffold import androidx.compose.runtime.DisposableEffect
import org.db3.airmq.features.common.ScreenAction import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.viewmodel.compose.viewModel
import org.db3.airmq.features.common.AirMqContainedButton
import org.osmdroid.config.Configuration
import org.osmdroid.tileprovider.tilesource.TileSourceFactory
import org.osmdroid.util.GeoPoint
import org.osmdroid.views.MapView
import org.osmdroid.views.overlay.Marker
@Composable @Composable
fun MapScreen( fun MapScreen(
onOpenDevice: () -> Unit, viewModel: MapViewModel = viewModel()
onBackToDashboard: () -> Unit
) { ) {
MockScreenScaffold( val uiState by viewModel.uiState.collectAsState()
title = "Map", val context = LocalContext.current
subtitle = "Bottom-tab equivalent: map", val lifecycleOwner = LocalLifecycleOwner.current
actions = listOf(
ScreenAction("Open Device", onOpenDevice), val mapView = remember {
ScreenAction("Back to Dashboard", onBackToDashboard) Configuration.getInstance().userAgentValue = context.packageName
MapView(context).apply {
setTileSource(TileSourceFactory.MAPNIK)
setMultiTouchControls(true)
controller.setZoom(7.0)
controller.setCenter(GeoPoint(53.7098, 27.9534))
}
}
DisposableEffect(lifecycleOwner, mapView) {
val observer = LifecycleEventObserver { _, event ->
when (event) {
Lifecycle.Event.ON_RESUME -> mapView.onResume()
Lifecycle.Event.ON_PAUSE -> mapView.onPause()
else -> Unit
}
}
lifecycleOwner.lifecycle.addObserver(observer)
onDispose {
lifecycleOwner.lifecycle.removeObserver(observer)
mapView.onDetach()
}
}
Box(modifier = Modifier.fillMaxSize()) {
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { mapView },
update = { map ->
map.overlays.removeAll { it is Marker }
uiState.items.forEach { item ->
val marker = Marker(map).apply {
position = GeoPoint(item.latitude, item.longitude)
title = listOfNotNull(item.title, item.city).joinToString(" - ")
subDescription = if (item.isOnline) "Online" else "Offline"
setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM)
}
map.overlays.add(marker)
}
uiState.items.firstOrNull()?.let { first ->
map.controller.animateTo(GeoPoint(first.latitude, first.longitude))
}
map.invalidate()
}
) )
if (uiState.isLoading) {
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.Black.copy(alpha = 0.2f)),
contentAlignment = Alignment.Center
) {
CircularProgressIndicator(modifier = Modifier.size(40.dp))
}
}
if (uiState.errorMessage != null) {
ErrorOverlay(
message = uiState.errorMessage ?: "Unknown error",
onRetry = viewModel::refresh
) )
} }
}
}
@Composable
private fun ErrorOverlay(
message: String,
onRetry: () -> Unit
) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(PaddingValues(16.dp)),
verticalArrangement = Arrangement.Bottom,
horizontalAlignment = Alignment.CenterHorizontally
) {
AirMqContainedButton(
text = "Retry: $message",
onClick = onRetry,
modifier = Modifier.fillMaxWidth()
)
}
}

View File

@@ -0,0 +1,7 @@
package org.db3.airmq.features.map
data class MapUiState(
val isLoading: Boolean = false,
val items: List<MapItem> = emptyList(),
val errorMessage: String? = null
)

View File

@@ -0,0 +1,44 @@
package org.db3.airmq.features.map
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
class MapViewModel(
private val mapApi: AirMqMapApi = AirMqMapApi()
) : ViewModel() {
private val _uiState = MutableStateFlow(MapUiState(isLoading = true))
val uiState: StateFlow<MapUiState> = _uiState.asStateFlow()
init {
refresh()
}
fun refresh() {
_uiState.value = _uiState.value.copy(isLoading = true, errorMessage = null)
viewModelScope.launch(Dispatchers.IO) {
val result = runCatching { mapApi.fetchMapItems() }
_uiState.value = result.fold(
onSuccess = { items ->
MapUiState(
isLoading = false,
items = items,
errorMessage = null
)
},
onFailure = { throwable ->
MapUiState(
isLoading = false,
items = emptyList(),
errorMessage = throwable.message ?: "Failed to load map items"
)
}
)
}
}
}

View File

@@ -0,0 +1,251 @@
package org.db3.airmq.features.navigation
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.material3.NavigationBar
import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.NavigationBarItemDefaults
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.navigation.NavType
import androidx.navigation.NavGraph.Companion.findStartDestination
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navArgument
import org.db3.airmq.R
import org.db3.airmq.features.city.CityScreen
import org.db3.airmq.features.constructor.ChartConstructorScreen
import org.db3.airmq.features.constructor.MapConstructorScreen
import org.db3.airmq.features.constructor.NewsConstructorScreen
import org.db3.airmq.features.constructor.SelectMapWidgetLocationScreen
import org.db3.airmq.features.constructor.WidgetConstructorScreen
import org.db3.airmq.features.dashboard.DashboardScreen
import org.db3.airmq.features.debug.DebugScreen
import org.db3.airmq.features.device.DeviceScreen
import org.db3.airmq.features.entry.SplashScreen
import org.db3.airmq.features.entry.WizardScreen
import org.db3.airmq.features.location.LocationScreen
import org.db3.airmq.features.login.LoginScreen
import org.db3.airmq.features.manage.ManageScreen
import org.db3.airmq.features.map.MapScreen
import org.db3.airmq.features.news.NewsDetailScreen
import org.db3.airmq.features.news.NewsScreen
import org.db3.airmq.features.settings.SettingsScreen
import org.db3.airmq.features.setup.SetupScreen
import org.db3.airmq.ui.theme.LegacyNavContainer
import org.db3.airmq.ui.theme.LegacyNavSelected
import org.db3.airmq.ui.theme.LegacyNavUnselected
@Composable
fun AirMQNavGraph(modifier: Modifier = Modifier) {
val navController = rememberNavController()
val tabItems = listOf(
BottomTabItem(route = AirMqRoutes.MAP, label = "Map", iconRes = R.drawable.ic_map),
BottomTabItem(route = AirMqRoutes.DASHBOARD, label = "Dashboard", iconRes = R.drawable.ic_dashboard),
BottomTabItem(route = AirMqRoutes.MANAGE, label = "Manage", iconRes = R.drawable.ic_manage_active)
)
val tabRoutes = tabItems.map { it.route }.toSet()
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentRoute = navBackStackEntry?.destination?.route
val showBottomBar = currentRoute in tabRoutes
Scaffold(
modifier = modifier,
bottomBar = {
if (showBottomBar) {
NavigationBar(
containerColor = LegacyNavContainer
) {
tabItems.forEach { tabItem ->
NavigationBarItem(
selected = currentRoute == tabItem.route,
onClick = {
navController.navigate(tabItem.route) {
popUpTo(navController.graph.findStartDestination().id) {
saveState = true
}
launchSingleTop = true
restoreState = true
}
},
colors = NavigationBarItemDefaults.colors(
selectedIconColor = LegacyNavSelected,
unselectedIconColor = LegacyNavUnselected,
selectedTextColor = LegacyNavSelected,
unselectedTextColor = LegacyNavUnselected,
indicatorColor = LegacyNavContainer
),
icon = {
Icon(
painter = painterResource(id = tabItem.iconRes),
contentDescription = tabItem.label
)
},
label = { Text(tabItem.label) }
)
}
}
}
}
) { innerPadding ->
NavHost(
navController = navController,
startDestination = AirMqRoutes.DASHBOARD,
modifier = Modifier.padding(innerPadding)
) {
composable(AirMqRoutes.SPLASH) {
SplashScreen(
onContinue = { navController.navigate(AirMqRoutes.WIZARD) }
)
}
composable(AirMqRoutes.WIZARD) {
WizardScreen(
onFinish = {
navController.navigate(AirMqRoutes.DASHBOARD) {
popUpTo(AirMqRoutes.SPLASH) { inclusive = true }
}
}
)
}
composable(AirMqRoutes.DASHBOARD) {
DashboardScreen(
onOpenMap = { navController.navigate(AirMqRoutes.MAP) },
onOpenManage = { navController.navigate(AirMqRoutes.MANAGE) },
onOpenCity = { navController.navigate(AirMqRoutes.CITY) },
onOpenDevice = { navController.navigate(AirMqRoutes.device()) },
onOpenNews = { navController.navigate(AirMqRoutes.NEWS) },
onOpenWidgetConstructor = { navController.navigate(AirMqRoutes.WIDGET_CONSTRUCTOR) }
)
}
composable(AirMqRoutes.MAP) {
MapScreen()
}
composable(AirMqRoutes.MANAGE) {
ManageScreen(
onOpenDevice = { navController.navigate(AirMqRoutes.device()) },
onOpenSetup = { navController.navigate(AirMqRoutes.SETUP) },
onOpenSettings = { navController.navigate(AirMqRoutes.SETTINGS) },
onOpenLogin = { navController.navigate(AirMqRoutes.LOGIN) },
onOpenLocation = { navController.navigate(AirMqRoutes.LOCATION) },
onOpenWidgetConstructor = { navController.navigate(AirMqRoutes.WIDGET_CONSTRUCTOR) },
onBackToDashboard = { navController.navigate(AirMqRoutes.DASHBOARD) }
)
}
composable(
route = AirMqRoutes.DEVICE,
arguments = listOf(
navArgument("deviceId") {
type = NavType.StringType
defaultValue = "mock-device-id"
}
)
) { backStackEntry ->
DeviceScreen(
deviceId = backStackEntry.arguments?.getString("deviceId") ?: "mock-device-id",
onOpenLocation = { navController.navigate(AirMqRoutes.LOCATION) },
onShowOnMap = { navController.navigate(AirMqRoutes.MAP) }
)
}
composable(AirMqRoutes.CITY) {
CityScreen(
onBackToDashboard = { navController.navigate(AirMqRoutes.DASHBOARD) }
)
}
composable(AirMqRoutes.SETTINGS) {
SettingsScreen(
onOpenDebug = { navController.navigate(AirMqRoutes.DEBUG) },
onOpenCity = { navController.navigate(AirMqRoutes.CITY) },
onLogOutToManage = {
navController.navigate(AirMqRoutes.MANAGE) {
popUpTo(AirMqRoutes.MANAGE) { inclusive = true }
}
}
)
}
composable(AirMqRoutes.DEBUG) {
DebugScreen(
onBackToSettings = { navController.popBackStack() }
)
}
composable(AirMqRoutes.LOCATION) {
LocationScreen(
onBackToManage = { navController.navigate(AirMqRoutes.MANAGE) }
)
}
composable(AirMqRoutes.SETUP) {
SetupScreen(
onFinishSetup = { navController.navigate(AirMqRoutes.MANAGE) },
onCancelSetup = { navController.navigate(AirMqRoutes.MANAGE) }
)
}
composable(AirMqRoutes.LOGIN) {
LoginScreen(
onLogInToManage = { navController.navigate(AirMqRoutes.MANAGE) }
)
}
composable(AirMqRoutes.NEWS) {
NewsScreen(
onOpenNewsDetail = { navController.navigate(AirMqRoutes.newsDetail()) },
onBackToDashboard = { navController.navigate(AirMqRoutes.DASHBOARD) }
)
}
composable(
route = AirMqRoutes.NEWS_DETAIL,
arguments = listOf(
navArgument("newsId") {
type = NavType.StringType
defaultValue = "mock-news-id"
}
)
) { backStackEntry ->
NewsDetailScreen(
newsId = backStackEntry.arguments?.getString("newsId") ?: "mock-news-id",
onBackToNews = { navController.popBackStack() }
)
}
composable(AirMqRoutes.WIDGET_CONSTRUCTOR) {
WidgetConstructorScreen(
onOpenSelectMapWidgetLocation = {
navController.navigate(AirMqRoutes.SELECT_MAP_WIDGET_LOCATION)
},
onOpenMapConstructor = { navController.navigate(AirMqRoutes.MAP_CONSTRUCTOR) },
onOpenChartConstructor = { navController.navigate(AirMqRoutes.CHART_CONSTRUCTOR) },
onOpenNewsConstructor = { navController.navigate(AirMqRoutes.NEWS_CONSTRUCTOR) },
onBackToManage = { navController.navigate(AirMqRoutes.MANAGE) }
)
}
composable(AirMqRoutes.SELECT_MAP_WIDGET_LOCATION) {
SelectMapWidgetLocationScreen(
onDone = { navController.popBackStack() }
)
}
composable(AirMqRoutes.MAP_CONSTRUCTOR) {
MapConstructorScreen(
onBackToWidgetConstructor = { navController.popBackStack() }
)
}
composable(AirMqRoutes.CHART_CONSTRUCTOR) {
ChartConstructorScreen(
onBackToWidgetConstructor = { navController.popBackStack() }
)
}
composable(AirMqRoutes.NEWS_CONSTRUCTOR) {
NewsConstructorScreen(
onBackToWidgetConstructor = { navController.popBackStack() }
)
}
}
}
}
private data class BottomTabItem(
val route: String,
val label: String,
val iconRes: Int
)

View File

@@ -1,184 +0,0 @@
package org.db3.airmq.features.navigation
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navArgument
import org.db3.airmq.features.city.CityScreen
import org.db3.airmq.features.constructor.ChartConstructorScreen
import org.db3.airmq.features.constructor.MapConstructorScreen
import org.db3.airmq.features.constructor.NewsConstructorScreen
import org.db3.airmq.features.constructor.SelectMapWidgetLocationScreen
import org.db3.airmq.features.constructor.WidgetConstructorScreen
import org.db3.airmq.features.dashboard.DashboardScreen
import org.db3.airmq.features.debug.DebugScreen
import org.db3.airmq.features.device.DeviceScreen
import org.db3.airmq.features.entry.SplashScreen
import org.db3.airmq.features.entry.WizardScreen
import org.db3.airmq.features.location.LocationScreen
import org.db3.airmq.features.login.LoginScreen
import org.db3.airmq.features.manage.ManageScreen
import org.db3.airmq.features.map.MapScreen
import org.db3.airmq.features.news.NewsDetailScreen
import org.db3.airmq.features.news.NewsScreen
import org.db3.airmq.features.settings.SettingsScreen
import org.db3.airmq.features.setup.SetupScreen
@Composable
fun AirMqNavGraph(modifier: Modifier = Modifier) {
val navController = rememberNavController()
NavHost(
navController = navController,
startDestination = AirMqRoutes.SPLASH,
modifier = modifier
) {
composable(AirMqRoutes.SPLASH) {
SplashScreen(
onContinue = { navController.navigate(AirMqRoutes.WIZARD) }
)
}
composable(AirMqRoutes.WIZARD) {
WizardScreen(
onFinish = {
navController.navigate(AirMqRoutes.DASHBOARD) {
popUpTo(AirMqRoutes.SPLASH) { inclusive = true }
}
}
)
}
composable(AirMqRoutes.DASHBOARD) {
DashboardScreen(
onOpenMap = { navController.navigate(AirMqRoutes.MAP) },
onOpenManage = { navController.navigate(AirMqRoutes.MANAGE) },
onOpenCity = { navController.navigate(AirMqRoutes.CITY) },
onOpenDevice = { navController.navigate(AirMqRoutes.device()) },
onOpenNews = { navController.navigate(AirMqRoutes.NEWS) },
onOpenWidgetConstructor = { navController.navigate(AirMqRoutes.WIDGET_CONSTRUCTOR) }
)
}
composable(AirMqRoutes.MAP) {
MapScreen(
onOpenDevice = { navController.navigate(AirMqRoutes.device()) },
onBackToDashboard = { navController.navigate(AirMqRoutes.DASHBOARD) }
)
}
composable(AirMqRoutes.MANAGE) {
ManageScreen(
onOpenDevice = { navController.navigate(AirMqRoutes.device()) },
onOpenSetup = { navController.navigate(AirMqRoutes.SETUP) },
onOpenSettings = { navController.navigate(AirMqRoutes.SETTINGS) },
onOpenLogin = { navController.navigate(AirMqRoutes.LOGIN) },
onOpenLocation = { navController.navigate(AirMqRoutes.LOCATION) },
onOpenWidgetConstructor = { navController.navigate(AirMqRoutes.WIDGET_CONSTRUCTOR) },
onBackToDashboard = { navController.navigate(AirMqRoutes.DASHBOARD) }
)
}
composable(
route = AirMqRoutes.DEVICE,
arguments = listOf(
navArgument("deviceId") {
type = NavType.StringType
defaultValue = "mock-device-id"
}
)
) { backStackEntry ->
DeviceScreen(
deviceId = backStackEntry.arguments?.getString("deviceId") ?: "mock-device-id",
onOpenLocation = { navController.navigate(AirMqRoutes.LOCATION) },
onShowOnMap = { navController.navigate(AirMqRoutes.MAP) }
)
}
composable(AirMqRoutes.CITY) {
CityScreen(
onBackToDashboard = { navController.navigate(AirMqRoutes.DASHBOARD) }
)
}
composable(AirMqRoutes.SETTINGS) {
SettingsScreen(
onOpenDebug = { navController.navigate(AirMqRoutes.DEBUG) },
onOpenCity = { navController.navigate(AirMqRoutes.CITY) },
onLogOutToManage = {
navController.navigate(AirMqRoutes.MANAGE) {
popUpTo(AirMqRoutes.MANAGE) { inclusive = true }
}
}
)
}
composable(AirMqRoutes.DEBUG) {
DebugScreen(
onBackToSettings = { navController.popBackStack() }
)
}
composable(AirMqRoutes.LOCATION) {
LocationScreen(
onBackToManage = { navController.navigate(AirMqRoutes.MANAGE) }
)
}
composable(AirMqRoutes.SETUP) {
SetupScreen(
onFinishSetup = { navController.navigate(AirMqRoutes.MANAGE) },
onCancelSetup = { navController.navigate(AirMqRoutes.MANAGE) }
)
}
composable(AirMqRoutes.LOGIN) {
LoginScreen(
onLogInToManage = { navController.navigate(AirMqRoutes.MANAGE) }
)
}
composable(AirMqRoutes.NEWS) {
NewsScreen(
onOpenNewsDetail = { navController.navigate(AirMqRoutes.newsDetail()) },
onBackToDashboard = { navController.navigate(AirMqRoutes.DASHBOARD) }
)
}
composable(
route = AirMqRoutes.NEWS_DETAIL,
arguments = listOf(
navArgument("newsId") {
type = NavType.StringType
defaultValue = "mock-news-id"
}
)
) { backStackEntry ->
NewsDetailScreen(
newsId = backStackEntry.arguments?.getString("newsId") ?: "mock-news-id",
onBackToNews = { navController.popBackStack() }
)
}
composable(AirMqRoutes.WIDGET_CONSTRUCTOR) {
WidgetConstructorScreen(
onOpenSelectMapWidgetLocation = {
navController.navigate(AirMqRoutes.SELECT_MAP_WIDGET_LOCATION)
},
onOpenMapConstructor = { navController.navigate(AirMqRoutes.MAP_CONSTRUCTOR) },
onOpenChartConstructor = { navController.navigate(AirMqRoutes.CHART_CONSTRUCTOR) },
onOpenNewsConstructor = { navController.navigate(AirMqRoutes.NEWS_CONSTRUCTOR) },
onBackToManage = { navController.navigate(AirMqRoutes.MANAGE) }
)
}
composable(AirMqRoutes.SELECT_MAP_WIDGET_LOCATION) {
SelectMapWidgetLocationScreen(
onDone = { navController.popBackStack() }
)
}
composable(AirMqRoutes.MAP_CONSTRUCTOR) {
MapConstructorScreen(
onBackToWidgetConstructor = { navController.popBackStack() }
)
}
composable(AirMqRoutes.CHART_CONSTRUCTOR) {
ChartConstructorScreen(
onBackToWidgetConstructor = { navController.popBackStack() }
)
}
composable(AirMqRoutes.NEWS_CONSTRUCTOR) {
NewsConstructorScreen(
onBackToWidgetConstructor = { navController.popBackStack() }
)
}
}
}

View File

@@ -2,10 +2,27 @@ package org.db3.airmq.ui.theme
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF) val LegacyPrimary = Color(0xFF295989)
val PurpleGrey80 = Color(0xFFCCC2DC) val LegacyPrimaryDark = Color(0xFF0069C0)
val Pink80 = Color(0xFFEFB8C8) val LegacyAccent = Color(0xFF295989)
val LegacyBackground = Color(0xFFFAFAFA)
val LegacySurface = Color(0xFFFFFFFF)
val LegacyOnPrimary = Color(0xFFFFFFFF)
val LegacyOnSecondary = Color(0xFFFFFFFF)
val LegacyOnBackground = Color(0xFF000000)
val LegacyOnSurface = Color(0xFF000000)
val LegacyOutline = Color(0x61000000)
val LegacyOutlineLight = Color(0x3B000000)
val LegacyNavSelected = Color(0xFFFFFFFF)
val LegacyNavUnselected = Color(0x8AFFFFFF)
val LegacyNavContainer = Color(0xFF295989)
val Purple40 = Color(0xFF6650a4) val LegacyButtonContained = Color(0xFF135CA5)
val PurpleGrey40 = Color(0xFF625b71) val LegacyButtonContainedDisabledOverlay = Color(0x1F000000)
val Pink40 = Color(0xFF7D5260) val LegacyButtonPressedOverlayDark = Color(0x33000000)
val LegacyButtonPressedOverlayLight = Color(0x33FFFFFF)
val LegacyButtonOnContained = Color(0xFFFFFFFF)
val LegacyButtonOnOutlined = Color(0xFF135CA5)
val LegacyButtonOnText = Color(0xFF295989)
val LegacyButtonGradientStart = Color(0xFF03B6EC)
val LegacyButtonGradientEnd = Color(0xFF01DEA7)

View File

@@ -1,51 +1,46 @@
package org.db3.airmq.ui.theme package org.db3.airmq.ui.theme
import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
private val DarkColorScheme = darkColorScheme( private val DarkColorScheme = darkColorScheme(
primary = Purple80, primary = LegacyPrimary,
secondary = PurpleGrey80, onPrimary = LegacyOnPrimary,
tertiary = Pink80 secondary = LegacyAccent,
onSecondary = LegacyOnSecondary,
tertiary = LegacyPrimaryDark,
background = LegacyBackground,
onBackground = LegacyOnBackground,
surface = LegacySurface,
onSurface = LegacyOnSurface,
outline = LegacyOutline,
onSurfaceVariant = LegacyNavUnselected
) )
private val LightColorScheme = lightColorScheme( private val LightColorScheme = lightColorScheme(
primary = Purple40, primary = LegacyPrimary,
secondary = PurpleGrey40, onPrimary = LegacyOnPrimary,
tertiary = Pink40 secondary = LegacyAccent,
onSecondary = LegacyOnSecondary,
/* Other default colors to override tertiary = LegacyPrimaryDark,
background = Color(0xFFFFFBFE), background = LegacyBackground,
surface = Color(0xFFFFFBFE), onBackground = LegacyOnBackground,
onPrimary = Color.White, surface = LegacySurface,
onSecondary = Color.White, onSurface = LegacyOnSurface,
onTertiary = Color.White, outline = LegacyOutline,
onBackground = Color(0xFF1C1B1F), onSurfaceVariant = LegacyNavUnselected
onSurface = Color(0xFF1C1B1F),
*/
) )
@Composable @Composable
fun AirMQTheme( fun AirMQTheme(
darkTheme: Boolean = isSystemInDarkTheme(), darkTheme: Boolean = false,
// Dynamic color is available on Android 12+ dynamicColor: Boolean = false,
dynamicColor: Boolean = true,
content: @Composable () -> Unit content: @Composable () -> Unit
) { ) {
val colorScheme = when { val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { dynamicColor -> LightColorScheme
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
darkTheme -> DarkColorScheme darkTheme -> DarkColorScheme
else -> LightColorScheme else -> LightColorScheme
} }

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M4,13h6c0.55,0 1,-0.45 1,-1L11,4c0,-0.55 -0.45,-1 -1,-1L4,3c-0.55,0 -1,0.45 -1,1v8c0,0.55 0.45,1 1,1zM4,21h6c0.55,0 1,-0.45 1,-1v-4c0,-0.55 -0.45,-1 -1,-1L4,15c-0.55,0 -1,0.45 -1,1v4c0,0.55 0.45,1 1,1zM14,21h6c0.55,0 1,-0.45 1,-1v-8c0,-0.55 -0.45,-1 -1,-1h-6c-0.55,0 -1,0.45 -1,1v8c0,0.55 0.45,1 1,1zM13,4v4c0,0.55 0.45,1 1,1h6c0.55,0 1,-0.45 1,-1L21,4c0,-0.55 -0.45,-1 -1,-1h-6c-0.55,0 -1,0.45 -1,1z" />
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M22,18.67c0,0.61 -0.5,1.11 -1.11,1.11h-5.56v-2.22h5.56C21.5,17.56 22,18.06 22,18.67zM22,5.33c0,0.61 -0.5,1.11 -1.11,1.11h-10V4.22h10C21.5,4.22 22,4.72 22,5.33zM10.89,20.89v-1.11H3.11C2.5,19.78 2,19.28 2,18.67c0,-0.61 0.5,-1.11 1.11,-1.11h7.78v-1.11c0,-0.61 0.5,-1.11 1.11,-1.11s1.11,0.5 1.11,1.11v4.44c0,0.61 -0.5,1.11 -1.11,1.11S10.89,21.5 10.89,20.89zM17.56,9.78v1.11h3.33c0.61,0 1.11,0.5 1.11,1.11s-0.5,1.11 -1.11,1.11h-3.33v1.11c0,0.61 -0.5,1.11 -1.11,1.11c-0.61,0 -1.11,-0.5 -1.11,-1.11V9.78c0,-0.61 0.5,-1.11 1.11,-1.11C17.06,8.67 17.56,9.17 17.56,9.78zM2,12c0,-0.61 0.5,-1.11 1.11,-1.11h10v2.22h-10C2.5,13.11 2,12.61 2,12zM7.56,8.67c-0.61,0 -1.11,-0.5 -1.11,-1.11V6.44H3.11C2.5,6.44 2,5.94 2,5.33s0.5,-1.11 1.11,-1.11h3.33V3.11C6.44,2.5 6.94,2 7.56,2s1.11,0.5 1.11,1.11v4.44C8.67,8.17 8.17,8.67 7.56,8.67z" />
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M14.65,4.98l-5,-1.75c-0.42,-0.15 -0.88,-0.15 -1.3,-0.01L4.36,4.56C3.55,4.84 3,5.6 3,6.46v11.85c0,1.41 1.41,2.37 2.72,1.86l2.93,-1.14c0.22,-0.09 0.47,-0.09 0.69,-0.01l5,1.75c0.42,0.15 0.88,0.15 1.3,0.01l3.99,-1.34c0.81,-0.27 1.36,-1.04 1.36,-1.9V5.69c0,-1.41 -1.41,-2.37 -2.72,-1.86l-2.93,1.14c-0.22,0.08 -0.46,0.09 -0.69,0.01zM15,18.89l-6,-2.11V5.11l6,2.11v11.67z" />
</vector>