Disable overlay bakground animation (#170)

* remove slider background from animation, show only when slider is shown

* cleanup unused import in chatscreen
This commit is contained in:
Tobiloba Oyelekan
2025-08-05 23:38:16 +02:00
committed by GitHub
parent 325ce1730d
commit bff8b1112c
2 changed files with 21 additions and 30 deletions
@@ -4,39 +4,16 @@ import androidx.compose.animation.*
import androidx.compose.animation.core.*
import androidx.compose.foundation.*
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.zIndex
import com.bitchat.android.model.BitchatMessage
import com.bitchat.android.model.DeliveryStatus
import com.bitchat.android.mesh.BluetoothMeshService
import java.text.SimpleDateFormat
import java.util.*
/**
* Main ChatScreen - REFACTORED to use component-based architecture
@@ -161,8 +138,26 @@ fun ChatScreen(viewModel: ChatViewModel) {
onShowAppInfo = { viewModel.showAppInfo() },
onPanicClear = { viewModel.panicClearAllData() }
)
// Sidebar overlay
val alpha by animateFloatAsState(
targetValue = if (showSidebar) 0.5f else 0f,
animationSpec = tween(
durationMillis = 300,
easing = EaseOutCubic
), label = "overlayAlpha"
)
// Only render the background if it's visible
if (alpha > 0f) {
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.Black.copy(alpha = alpha))
.clickable { viewModel.hideSidebar() }
.zIndex(1f)
)
}
AnimatedVisibility(
visible = showSidebar,
enter = slideInHorizontally(
@@ -45,11 +45,7 @@ fun SidebarOverlay(
val peerNicknames = viewModel.meshService.getPeerNicknames()
val peerRSSI = viewModel.meshService.getPeerRSSI()
Box(
modifier = modifier
.background(Color.Black.copy(alpha = 0.5f))
.clickable { onDismiss() }
) {
Box(modifier = modifier) {
Row(
modifier = Modifier
.fillMaxHeight()