android: clean up profile screen layout and actions
Some checks failed
Android CI / android (push) Has started running
Android Release / release (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
Codex
2026-03-10 00:31:14 +03:00
parent bb1f59d1f4
commit eae6a2a90f
3 changed files with 10 additions and 82 deletions

View File

@@ -797,3 +797,13 @@
- Devices
- Data/Chat folders/Power/Language placeholders
- Kept theme logic intact and moved appearance controls into `Chat settings` folder.
### Step 116 - Profile cleanup (remove non-working extras)
- Removed non-functional profile tabs and placeholder blocks:
- `Posts`
- `Archived`
- `Gifts`
- Removed `Settings` hero button from profile header.
- Removed bottom `Back to chats` button from profile screen.
- Simplified profile layout so the editable profile form is the primary secondary section toggled by `Edit`.
- Updated `ProfileRoute` navigation contract to match the simplified screen API.

View File

@@ -266,8 +266,6 @@ fun MessengerNavHost(
composable(route = Routes.Profile) {
ProfileRoute(
onBackToChats = { navController.navigate(Routes.Chats) },
onOpenSettings = { navController.navigate(Routes.Settings) },
onMainBarVisibilityChanged = { isMainBarVisible = it },
)
}

View File

@@ -32,12 +32,10 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AddAPhoto
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.Button
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
@@ -67,14 +65,10 @@ import java.io.ByteArrayOutputStream
@Composable
fun ProfileRoute(
onBackToChats: () -> Unit,
onOpenSettings: () -> Unit,
onMainBarVisibilityChanged: (Boolean) -> Unit,
viewModel: AccountViewModel = hiltViewModel(),
) {
ProfileScreen(
onBackToChats = onBackToChats,
onOpenSettings = onOpenSettings,
onMainBarVisibilityChanged = onMainBarVisibilityChanged,
viewModel = viewModel,
)
@@ -82,8 +76,6 @@ fun ProfileRoute(
@Composable
fun ProfileScreen(
onBackToChats: () -> Unit,
onOpenSettings: () -> Unit,
onMainBarVisibilityChanged: (Boolean) -> Unit,
viewModel: AccountViewModel,
) {
@@ -93,7 +85,6 @@ fun ProfileScreen(
var username by remember(profile?.username) { mutableStateOf(profile?.username.orEmpty()) }
var bio by remember(profile?.bio) { mutableStateOf(profile?.bio.orEmpty()) }
var avatarUrl by remember(profile?.avatarUrl) { mutableStateOf(profile?.avatarUrl.orEmpty()) }
var selectedTab by remember { mutableStateOf(0) }
var editMode by remember { mutableStateOf(false) }
val scrollState = rememberScrollState()
@@ -218,13 +209,6 @@ fun ProfileScreen(
) {
editMode = !editMode
}
HeroActionButton(
label = "Settings",
icon = Icons.Filled.Settings,
modifier = Modifier.weight(1f),
) {
onOpenSettings()
}
}
}
}
@@ -253,47 +237,6 @@ fun ProfileScreen(
}
}
Surface(
color = MaterialTheme.colorScheme.surfaceContainer,
shape = RoundedCornerShape(18.dp),
modifier = Modifier.fillMaxWidth(),
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(6.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
ProfileTab("Posts", selectedTab == 0, modifier = Modifier.weight(1f)) { selectedTab = 0 }
ProfileTab("Archived", selectedTab == 1, modifier = Modifier.weight(1f)) { selectedTab = 1 }
ProfileTab("Gifts", selectedTab == 2, modifier = Modifier.weight(1f)) { selectedTab = 2 }
}
}
Surface(
color = MaterialTheme.colorScheme.surfaceContainer,
shape = RoundedCornerShape(22.dp),
modifier = Modifier.fillMaxWidth(),
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(18.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Text("No posts yet", style = MaterialTheme.typography.titleLarge)
Text(
"Publish something in your profile.",
color = MaterialTheme.colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.bodyMedium,
)
Button(onClick = {}, modifier = Modifier.padding(top = 6.dp)) {
Text("Add")
}
}
}
if (editMode) {
Surface(
color = MaterialTheme.colorScheme.surfaceContainer,
@@ -368,15 +311,6 @@ fun ProfileScreen(
modifier = Modifier.padding(horizontal = 4.dp),
)
}
OutlinedButton(
onClick = onBackToChats,
modifier = Modifier
.fillMaxWidth()
.padding(top = 2.dp),
) {
Text("Back to chats")
}
}
}
}
@@ -412,20 +346,6 @@ private fun ProfileInfoRow(label: String, value: String) {
}
}
@Composable
private fun ProfileTab(
label: String,
selected: Boolean,
modifier: Modifier = Modifier,
onClick: () -> Unit,
) {
if (selected) {
Button(onClick = onClick, modifier = modifier) { Text(label) }
} else {
OutlinedButton(onClick = onClick, modifier = modifier) { Text(label) }
}
}
private fun Uri.toSquareJpeg(context: Context): ByteArray? {
val bitmap = runCatching {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {