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 34 additions and 5 deletions
Showing only changes of commit 2a318d551c - Show all commits

View file

@ -1,12 +1,16 @@
package ru.nm17.narodmon.ui.pages package ru.nm17.narodmon.ui.pages
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.AssistChip import androidx.compose.material3.AssistChip
import androidx.compose.material3.Card
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FilterChip import androidx.compose.material3.FilterChip
import androidx.compose.material3.ModalBottomSheet import androidx.compose.material3.ModalBottomSheet
@ -21,6 +25,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController import androidx.navigation.NavController
import ru.nm17.narodmon.R import ru.nm17.narodmon.R
import ru.nm17.narodmon.ui.elements.GenericNavScaffold import ru.nm17.narodmon.ui.elements.GenericNavScaffold
@ -39,7 +44,7 @@ fun SensorsPage(navController: NavController) {
var filterShown by remember { mutableStateOf(false) } var filterShown by remember { mutableStateOf(false) }
var filterMine by remember { mutableStateOf(false) } var filterMine by remember { mutableStateOf(false) }
val filterItems = listOf<String>( val filterItems = listOf(
stringResource(R.string.filter_temp), stringResource(R.string.filter_temp),
stringResource(R.string.filter_temp_water), stringResource(R.string.filter_temp_water),
stringResource(R.string.filter_temp_ground), stringResource(R.string.filter_temp_ground),
@ -82,9 +87,7 @@ fun SensorsPage(navController: NavController) {
onQueryChange = { query -> searchQuery = query }, onQueryChange = { query -> searchQuery = query },
onSearch = { searchActive = false }, onSearch = { searchActive = false },
placeholder = { Text(stringResource(R.string.search)) }, placeholder = { Text(stringResource(R.string.search)) },
modifier = Modifier modifier = Modifier.fillMaxWidth()
//.padding(horizontal = 8.dp)
.fillMaxWidth()
) {} ) {}
Row( Row(
@ -112,7 +115,32 @@ fun SensorsPage(navController: NavController) {
if (filterShown) { if (filterShown) {
ModalBottomSheet(onDismissRequest = { filterShown = false }) { ModalBottomSheet(onDismissRequest = { filterShown = false }) {
Text(text = "Hello") Text(
text = stringResource(R.string.sensors_filter_title),
fontSize = 26.sp,
)
LazyColumn(
verticalArrangement = Arrangement.spacedBy(8.dp),
modifier = Modifier.padding(horizontal = 4.dp),
) {
items(filterItems) {
Card(
modifier = Modifier
.fillMaxWidth()
.clickable { }
) {
Text(
text = it,
fontSize = 18.sp,
modifier = Modifier.padding(
horizontal = 8.dp,
vertical = 16.dp,
),
)
}
}
}
} }
} }
} }

View file

@ -42,4 +42,5 @@
<string name="filter_signal">Сигнал в dBm</string> <string name="filter_signal">Сигнал в dBm</string>
<string name="filter_water_meter">Счётчик воды</string> <string name="filter_water_meter">Счётчик воды</string>
<string name="filter_time">Время работы</string> <string name="filter_time">Время работы</string>
<string name="sensors_filter_title">Тип датчиков</string>
</resources> </resources>