|
@@ -1,15 +1,20 @@
|
|
|
package com.example.neurea.views.screens
|
|
|
|
|
|
+import androidx.compose.foundation.BorderStroke
|
|
|
import androidx.compose.foundation.background
|
|
|
import androidx.compose.foundation.border
|
|
|
+import androidx.compose.foundation.clickable
|
|
|
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.Row
|
|
|
+import androidx.compose.foundation.layout.fillMaxHeight
|
|
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
import androidx.compose.foundation.layout.height
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
+import androidx.compose.foundation.layout.width
|
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
import androidx.compose.foundation.text.KeyboardOptions
|
|
|
import androidx.compose.material3.Button
|
|
@@ -18,6 +23,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
|
|
|
import androidx.compose.material3.HorizontalDivider
|
|
|
import androidx.compose.material3.Icon
|
|
|
import androidx.compose.material3.IconButton
|
|
|
+import androidx.compose.material3.IconButtonDefaults
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
import androidx.compose.material3.Slider
|
|
|
import androidx.compose.material3.SliderDefaults
|
|
@@ -33,6 +39,7 @@ import androidx.compose.runtime.remember
|
|
|
import androidx.compose.runtime.setValue
|
|
|
import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
|
+import androidx.compose.ui.draw.alpha
|
|
|
import androidx.compose.ui.draw.clip
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
import androidx.compose.ui.res.painterResource
|
|
@@ -45,31 +52,71 @@ import androidx.compose.ui.text.style.TextAlign
|
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
+import androidx.compose.ui.zIndex
|
|
|
import androidx.navigation.NavController
|
|
|
import com.example.neurea.R
|
|
|
import com.example.neurea.views.ui.theme.NeureaTheme
|
|
|
+import kotlin.math.roundToInt
|
|
|
|
|
|
@Preview()
|
|
|
@OptIn(ExperimentalMaterial3Api::class)
|
|
|
@Composable
|
|
|
fun ReadingScreen() { // navController: NavController
|
|
|
-
|
|
|
+ var menuVisibility by remember { mutableFloatStateOf(1f) }
|
|
|
NeureaTheme {
|
|
|
- Column(
|
|
|
- modifier = Modifier
|
|
|
+ Box(modifier = Modifier.fillMaxSize()){
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxSize()
|
|
|
+ .background(color = MaterialTheme.colorScheme.secondary)
|
|
|
+ .padding(top = 50.dp, start = 20.dp, end = 20.dp, bottom = 50.dp)
|
|
|
+ .clickable(onClick = { menuVisibility = if (menuVisibility == 1f) 0f else 1f }
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ Column(modifier = Modifier.fillMaxSize()){
|
|
|
+ Text("«Автостопом по Галактике», стартовав в качестве радиопостановки на Би-би-си, имел грандиозный успех. Одноименный роман в 1984 году возглавил список английских бестселлеров, а сам Адамс стал самым молодым писателем, получившим награду «Золотая ручка», вручаемую за 1 млн. проданных книг.\u2028Телепостановка 1982 года упрочила успех серии книг про «Автостоп», а полнометражный фильм 2005 года при бюджете в \$50 млн. дважды «отбил» расходы на экранизацию и был номинирован на 7 премий.",
|
|
|
+ textAlign = TextAlign.Justify, fontSize = 16.sp)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ var sliderPosition by remember { mutableFloatStateOf(1f) }
|
|
|
+ Box(modifier = Modifier
|
|
|
+ .alpha(menuVisibility)
|
|
|
+ .padding(horizontal = 20.dp, vertical = 20.dp)
|
|
|
.fillMaxSize()
|
|
|
- .background(color = MaterialTheme.colorScheme.secondary)
|
|
|
- ) {
|
|
|
- var sliderPosition by remember { mutableFloatStateOf(0f) }
|
|
|
- Column {
|
|
|
- Slider(
|
|
|
- value = sliderPosition,
|
|
|
- onValueChange = { sliderPosition = it },
|
|
|
- colors = SliderDefaults.colors(thumbColor = MaterialTheme.colorScheme.primary, inactiveTickColor = MaterialTheme.colorScheme.onSecondary)
|
|
|
- )
|
|
|
- Text(text = sliderPosition.toString())
|
|
|
+ .zIndex(12f), contentAlignment = Alignment.BottomCenter){
|
|
|
+ Column(){
|
|
|
+ Slider(
|
|
|
+ value = sliderPosition,
|
|
|
+ onValueChange = { sliderPosition = it },
|
|
|
+ valueRange = 1f..307f,
|
|
|
+ colors = SliderDefaults.colors(thumbColor = MaterialTheme.colorScheme.primary, inactiveTickColor = MaterialTheme.colorScheme.onSecondary)
|
|
|
+ )
|
|
|
+ Row(modifier = Modifier.height(30.dp).clip(RoundedCornerShape(30.dp)).background(MaterialTheme.colorScheme.surface).fillMaxWidth(),
|
|
|
+ horizontalArrangement = Arrangement.SpaceBetween){
|
|
|
+ IconButton(onClick = { if (sliderPosition > 1f) sliderPosition-=1f }, modifier = Modifier.width(90.dp).clip(RoundedCornerShape(20.dp))
|
|
|
+ ,
|
|
|
+ colors = IconButtonDefaults.iconButtonColors(
|
|
|
+ containerColor = MaterialTheme.colorScheme.primary)
|
|
|
+
|
|
|
+ ) {
|
|
|
+ Icon(painter = painterResource(id = R.drawable.arrow_left), contentDescription = "",tint=MaterialTheme.colorScheme.secondary,)
|
|
|
+
|
|
|
+ }
|
|
|
+ Text("${(sliderPosition).roundToInt()}/307", color = MaterialTheme.colorScheme.onSecondary, modifier = Modifier.align(Alignment.CenterVertically))
|
|
|
+ IconButton(onClick = { if (sliderPosition < 307f) sliderPosition+=1f }, modifier = Modifier.width(90.dp).clip(RoundedCornerShape(20.dp)),
|
|
|
+ colors = IconButtonDefaults.iconButtonColors(
|
|
|
+ containerColor = MaterialTheme.colorScheme.primary
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ Icon(painter = painterResource(id = R.drawable.arrow_right), contentDescription = "",tint=MaterialTheme.colorScheme.secondary,)
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|