UI/UX fixes
This commit is contained in:
@@ -23,7 +23,7 @@ object NotificationHelper {
|
|||||||
val channel = NotificationChannel(
|
val channel = NotificationChannel(
|
||||||
CHANNEL_ID,
|
CHANNEL_ID,
|
||||||
CHANNEL_NAME,
|
CHANNEL_NAME,
|
||||||
NotificationManager.IMPORTANCE_DEFAULT,
|
NotificationManager.IMPORTANCE_HIGH,
|
||||||
)
|
)
|
||||||
nm.createNotificationChannel(channel)
|
nm.createNotificationChannel(channel)
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ object NotificationHelper {
|
|||||||
|
|
||||||
val nm = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
val nm = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
val notif = NotificationCompat.Builder(context, CHANNEL_ID)
|
val notif = NotificationCompat.Builder(context, CHANNEL_ID)
|
||||||
.setSmallIcon(R.mipmap.ic_launcher)
|
.setSmallIcon(R.drawable.ic_notification)
|
||||||
.setContentTitle(roomName)
|
.setContentTitle(roomName)
|
||||||
.setContentText(content)
|
.setContentText(content)
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
|
|||||||
@@ -116,12 +116,13 @@ fun MainScreen(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.pointerInput(showChannelList) {
|
.pointerInput(showChannelList) {
|
||||||
if (!showChannelList) {
|
if (!showChannelList) {
|
||||||
|
val thresholdPx = 60.dp.toPx()
|
||||||
var totalDrag = 0f
|
var totalDrag = 0f
|
||||||
detectHorizontalDragGestures(
|
detectHorizontalDragGestures(
|
||||||
onDragStart = { totalDrag = 0f },
|
onDragStart = { totalDrag = 0f },
|
||||||
onHorizontalDrag = { _, dragAmount ->
|
onHorizontalDrag = { _, dragAmount ->
|
||||||
totalDrag += dragAmount
|
totalDrag += dragAmount
|
||||||
if (totalDrag > 60f) {
|
if (totalDrag > thresholdPx) {
|
||||||
viewModel.toggleChannelList()
|
viewModel.toggleChannelList()
|
||||||
totalDrag = 0f
|
totalDrag = 0f
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,12 +171,13 @@ fun ChannelList(
|
|||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
.background(MaterialTheme.colorScheme.surface)
|
.background(MaterialTheme.colorScheme.surface)
|
||||||
.pointerInput(Unit) {
|
.pointerInput(Unit) {
|
||||||
|
val thresholdPx = 60.dp.toPx()
|
||||||
var totalDrag = 0f
|
var totalDrag = 0f
|
||||||
detectHorizontalDragGestures(
|
detectHorizontalDragGestures(
|
||||||
onDragStart = { totalDrag = 0f },
|
onDragStart = { totalDrag = 0f },
|
||||||
onHorizontalDrag = { _, dragAmount ->
|
onHorizontalDrag = { _, dragAmount ->
|
||||||
totalDrag += dragAmount
|
totalDrag += dragAmount
|
||||||
if (totalDrag < -60f) {
|
if (totalDrag < -thresholdPx) {
|
||||||
onDismiss()
|
onDismiss()
|
||||||
totalDrag = 0f
|
totalDrag = 0f
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ fun SpaceList(
|
|||||||
.size(8.dp)
|
.size(8.dp)
|
||||||
.align(Alignment.TopEnd)
|
.align(Alignment.TopEnd)
|
||||||
.background(
|
.background(
|
||||||
if (homeUnreadStatus == UnreadStatus.MENTIONED) androidx.compose.ui.graphics.Color.Red
|
if (homeUnreadStatus == UnreadStatus.MENTIONED) MaterialTheme.colorScheme.error
|
||||||
else androidx.compose.ui.graphics.Color.Gray,
|
else MaterialTheme.colorScheme.primary,
|
||||||
CircleShape,
|
CircleShape,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -147,8 +147,8 @@ fun SpaceList(
|
|||||||
.size(8.dp)
|
.size(8.dp)
|
||||||
.align(Alignment.TopEnd)
|
.align(Alignment.TopEnd)
|
||||||
.background(
|
.background(
|
||||||
if (space.unreadStatus == UnreadStatus.MENTIONED) androidx.compose.ui.graphics.Color.Red
|
if (space.unreadStatus == UnreadStatus.MENTIONED) MaterialTheme.colorScheme.error
|
||||||
else androidx.compose.ui.graphics.Color.Gray,
|
else MaterialTheme.colorScheme.primary,
|
||||||
CircleShape,
|
CircleShape,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Spacer
|
|||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
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.heightIn
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
@@ -29,7 +30,7 @@ import androidx.compose.material3.Text
|
|||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
import androidx.compose.material3.TopAppBarDefaults
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
@@ -63,13 +64,13 @@ fun SettingsScreen(
|
|||||||
) {
|
) {
|
||||||
val preferencesManager: PreferencesManager = koinInject()
|
val preferencesManager: PreferencesManager = koinInject()
|
||||||
val pushRegistrationManager: PushRegistrationManager = koinInject()
|
val pushRegistrationManager: PushRegistrationManager = koinInject()
|
||||||
val userId by preferencesManager.userId.collectAsState(initial = null)
|
val userId by preferencesManager.userId.collectAsStateWithLifecycle(initialValue = null)
|
||||||
val homeserver by preferencesManager.homeserverUrl.collectAsState(initial = null)
|
val homeserver by preferencesManager.homeserverUrl.collectAsStateWithLifecycle(initialValue = null)
|
||||||
val deviceId by preferencesManager.deviceId.collectAsState(initial = null)
|
val deviceId by preferencesManager.deviceId.collectAsStateWithLifecycle(initialValue = null)
|
||||||
val hideSpacesWhenClosed by preferencesManager.hideSpacesWhenClosed.collectAsState(initial = false)
|
val hideSpacesWhenClosed by preferencesManager.hideSpacesWhenClosed.collectAsStateWithLifecycle(initialValue = false)
|
||||||
val notificationsEnabled by preferencesManager.notificationsEnabled.collectAsState(initial = true)
|
val notificationsEnabled by preferencesManager.notificationsEnabled.collectAsStateWithLifecycle(initialValue = true)
|
||||||
val upEndpoint by preferencesManager.upEndpoint.collectAsState(initial = null)
|
val upEndpoint by preferencesManager.upEndpoint.collectAsStateWithLifecycle(initialValue = null)
|
||||||
val savedGiphyKey by preferencesManager.tenorApiKey.collectAsState(initial = "")
|
val savedGiphyKey by preferencesManager.tenorApiKey.collectAsStateWithLifecycle(initialValue = "")
|
||||||
var giphyKeyInput by remember { mutableStateOf("") }
|
var giphyKeyInput by remember { mutableStateOf("") }
|
||||||
var giphyKeyStatus by remember { mutableStateOf<GiphyKeyStatus>(GiphyKeyStatus.Idle) }
|
var giphyKeyStatus by remember { mutableStateOf<GiphyKeyStatus>(GiphyKeyStatus.Idle) }
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
@@ -302,13 +303,14 @@ fun SettingsScreen(
|
|||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
.heightIn(min = 48.dp)
|
||||||
.clickable {
|
.clickable {
|
||||||
UnifiedPush.saveDistributor(context, pkg)
|
UnifiedPush.saveDistributor(context, pkg)
|
||||||
UnifiedPush.register(context)
|
UnifiedPush.register(context)
|
||||||
upDistributor = pkg
|
upDistributor = pkg
|
||||||
showDistributorPicker = false
|
showDistributorPicker = false
|
||||||
}
|
}
|
||||||
.padding(vertical = 12.dp),
|
.padding(horizontal = 4.dp, vertical = 12.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Text(label, style = MaterialTheme.typography.bodyMedium)
|
Text(label, style = MaterialTheme.typography.bodyMedium)
|
||||||
@@ -357,6 +359,7 @@ private fun SettingToggleRow(
|
|||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
.heightIn(min = 48.dp)
|
||||||
.padding(vertical = 6.dp),
|
.padding(vertical = 6.dp),
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -380,6 +383,7 @@ private fun SettingRow(label: String, value: String) {
|
|||||||
text = label,
|
text = label,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
)
|
)
|
||||||
|
androidx.compose.foundation.text.selection.SelectionContainer {
|
||||||
Text(
|
Text(
|
||||||
text = value,
|
text = value,
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
@@ -389,14 +393,16 @@ private fun SettingRow(label: String, value: String) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SettingNavRow(label: String, onClick: () -> Unit) {
|
private fun SettingNavRow(label: String, onClick: () -> Unit) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
.heightIn(min = 48.dp)
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(vertical = 12.dp),
|
.padding(vertical = 14.dp),
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
|
|||||||
10
app/src/main/res/drawable/ic_notification.xml
Normal file
10
app/src/main/res/drawable/ic_notification.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z" />
|
||||||
|
</vector>
|
||||||
Reference in New Issue
Block a user