dc09-sensors2 #5

Merged
nm17 merged 28 commits from dc09-sensors2 into master 2023-06-18 13:15:53 +03:00
2 changed files with 74 additions and 4 deletions
Showing only changes of commit 3a873725f2 - Show all commits

View file

@ -8,6 +8,8 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material3.AssistChip import androidx.compose.material3.AssistChip
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FilterChip
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SearchBar import androidx.compose.material3.SearchBar
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -34,6 +36,35 @@ fun SensorsPage(navController: NavController) {
var searchQuery by remember { mutableStateOf("") } var searchQuery by remember { mutableStateOf("") }
var searchActive by remember { mutableStateOf(false) } var searchActive by remember { mutableStateOf(false) }
var filterShown by remember { mutableStateOf(false) }
var filterMine by remember { mutableStateOf(false) }
val filterItems = listOf<String>(
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 scrConfig = LocalConfiguration.current
val mapHeight = scrConfig.screenHeightDp / 3 val mapHeight = scrConfig.screenHeightDp / 3
@ -61,10 +92,27 @@ fun SensorsPage(navController: NavController) {
modifier = Modifier.padding(horizontal = 8.dp), modifier = Modifier.padding(horizontal = 8.dp),
) { ) {
AssistChip( AssistChip(
onClick = { }, onClick = { filterShown = true },
label = { Text(text = stringResource(R.string.sensors_filter)) }, label = { Text(text = stringResource(R.string.sensors_filter)) },
) )
AssistChip(
onClick = { },
label = { Text(text = stringResource(R.string.sensors_sorting)) },
)
FilterChip(
selected = filterMine,
onClick = { filterMine = !filterMine },
Review

Молодцы что сделали стейт хойстинг

Молодцы что сделали стейт хойстинг
label = { Text(text = stringResource(R.string.sensors_mine)) },
)
} }
} }
} }
if (filterShown) {
ModalBottomSheet(onDismissRequest = { filterShown = false }) {
Text(text = "Hello")
}
}
} }

View file

@ -15,9 +15,31 @@
<string name="agreement_dialog_title">Примите необходимые соглашения</string> <string name="agreement_dialog_title">Примите необходимые соглашения</string>
<string name="sensors_page_title">Сенсоры</string> <string name="sensors_page_title">Сенсоры</string>
<string name="waiting_for_user_agreement">Ожидаю соглашение пользователя</string> <string name="waiting_for_user_agreement">Ожидаю соглашение пользователя</string>
<string name="sensors_filter_all">Все</string>
<string name="sensors_filter_temp">Термометры</string>
<string name="sensors_filter_camera">Камеры</string>
<string name="search">Поиск</string> <string name="search">Поиск</string>
<string name="sensors_filter">Фильтр</string> <string name="sensors_filter">Фильтр</string>
<string name="sensors_sorting">Сортировка</string>
<string name="sensors_mine">Мои</string>
<string name="filter_temp_dew_point">Температура точки росы</string>
<string name="filter_temp">Температура воздуха</string>
<string name="filter_temp_water">Температура воды</string>
<string name="filter_temp_ground">Температура почвы</string>
<string name="filter_humidity">Влажность</string>
<string name="filter_pressure">Давление</string>
<string name="filter_lightness">Освещённость</string>
<string name="filter_uv">УФ-индекс</string>
<string name="filter_radiation">Радиация</string>
<string name="filter_rainfall">Осадки</string>
<string name="filter_dust">Запылённость</string>
<string name="filter_wind_speed">Скорость ветра</string>
<string name="filter_wind_direction">Направление ветра</string>
<string name="filter_concentration">Концентрация</string>
<string name="filter_power">Мощность</string>
<string name="filter_voltage">Напряжение</string>
<string name="filter_amperage">Сила тока</string>
<string name="filter_energy">Энергия</string>
<string name="filter_battery">% батареи</string>
<string name="filter_rxtx">Rx/Tx трафик</string>
<string name="filter_signal">Сигнал в dBm</string>
<string name="filter_water_meter">Счётчик воды</string>
<string name="filter_time">Время работы</string>
</resources> </resources>