From 3a873725f289fdee4b0cac85dc2e71d174cf29f5 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Tue, 6 Jun 2023 17:12:20 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20BottomSheet=20=D0=B4=D0=BB=D1=8F=20=D1=84=D0=B8=D0=BB?= =?UTF-8?q?=D1=8C=D1=82=D1=80=D0=BE=D0=B2=20=D0=B8=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/ru/nm17/narodmon/ui/pages/Sensors.kt | 50 ++++++++++++++++++- app/src/main/res/values/strings.xml | 28 +++++++++-- 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/ru/nm17/narodmon/ui/pages/Sensors.kt b/app/src/main/java/ru/nm17/narodmon/ui/pages/Sensors.kt index d08d804..d016d78 100644 --- a/app/src/main/java/ru/nm17/narodmon/ui/pages/Sensors.kt +++ b/app/src/main/java/ru/nm17/narodmon/ui/pages/Sensors.kt @@ -8,6 +8,8 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.AssistChip import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.FilterChip +import androidx.compose.material3.ModalBottomSheet import androidx.compose.material3.SearchBar import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -34,6 +36,35 @@ fun SensorsPage(navController: NavController) { var searchQuery by remember { mutableStateOf("") } var searchActive by remember { mutableStateOf(false) } + var filterShown by remember { mutableStateOf(false) } + var filterMine by remember { mutableStateOf(false) } + + val filterItems = listOf( + stringResource(R.string.filter_temp), + stringResource(R.string.filter_temp_water), + stringResource(R.string.filter_temp_ground), + stringResource(R.string.filter_temp_dew_point), + stringResource(R.string.filter_humidity), + stringResource(R.string.filter_pressure), + stringResource(R.string.filter_lightness), + stringResource(R.string.filter_uv), + stringResource(R.string.filter_radiation), + stringResource(R.string.filter_rainfall), + stringResource(R.string.filter_dust), + stringResource(R.string.filter_wind_speed), + stringResource(R.string.filter_wind_direction), + stringResource(R.string.filter_concentration), + stringResource(R.string.filter_power), + stringResource(R.string.filter_voltage), + stringResource(R.string.filter_amperage), + stringResource(R.string.filter_energy), + stringResource(R.string.filter_battery), + stringResource(R.string.filter_rxtx), + stringResource(R.string.filter_signal), + stringResource(R.string.filter_water_meter), + stringResource(R.string.filter_time), + ) + val scrConfig = LocalConfiguration.current val mapHeight = scrConfig.screenHeightDp / 3 @@ -61,10 +92,27 @@ fun SensorsPage(navController: NavController) { modifier = Modifier.padding(horizontal = 8.dp), ) { AssistChip( - onClick = { }, + onClick = { filterShown = true }, label = { Text(text = stringResource(R.string.sensors_filter)) }, ) + + AssistChip( + onClick = { }, + label = { Text(text = stringResource(R.string.sensors_sorting)) }, + ) + + FilterChip( + selected = filterMine, + onClick = { filterMine = !filterMine }, + label = { Text(text = stringResource(R.string.sensors_mine)) }, + ) } } } + + if (filterShown) { + ModalBottomSheet(onDismissRequest = { filterShown = false }) { + Text(text = "Hello") + } + } } \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 037d8ed..5db243f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -15,9 +15,31 @@ Примите необходимые соглашения Сенсоры Ожидаю соглашение пользователя - Все - Термометры - Камеры Поиск Фильтр + Сортировка + Мои + Температура точки росы + Температура воздуха + Температура воды + Температура почвы + Влажность + Давление + Освещённость + УФ-индекс + Радиация + Осадки + Запылённость + Скорость ветра + Направление ветра + Концентрация + Мощность + Напряжение + Сила тока + Энергия + % батареи + Rx/Tx трафик + Сигнал в dBm + Счётчик воды + Время работы \ No newline at end of file