Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak layout a bit to save more space #172

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,12 @@ val GROUPITEM_HEIGHT = 50.dp
val GROUP_PEER_HEIGHT = 33.dp
val SETTINGS_HEADER_SIZE = 56.dp
val CONTACT_COLUMN_WIDTH = 230.dp
val GROUPS_COLUMN_WIDTH = 210.dp
val GROUP_PEER_COLUMN_WIDTH = 180.dp
val MESAGE_INPUT_LINE_HEIGHT = 58.dp
const val CONTACT_COLUMN_CONTACTNAME_LEN_THRESHOLD = 13
val GROUPS_COLUMN_WIDTH = 190.dp
const val GROUPS_COLUMN_GROUPNAME_LEN_THRESHOLD = 13
val GROUP_PEER_COLUMN_WIDTH = 165.dp
const val GROUP_PEER_COLUMN_PEERNAME_LEN_THRESHOLD = 12
val MESSAGE_INPUT_LINE_HEIGHT = 58.dp
val MAIN_TOP_TAB_HEIGHT = 160.dp
const val IMAGE_PREVIEW_SIZE = 70f
const val AVATAR_SIZE = 40f
Expand Down
5 changes: 2 additions & 3 deletions src/main/kotlin/com/zoffcc/applications/trifa2/ChatApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import com.zoffcc.applications.trifa.HelperGeneric.send_message_onclick
import com.zoffcc.applications.trifa.HelperGroup
import com.zoffcc.applications.trifa.HelperGroup.tox_group_by_groupid__wrapper
import com.zoffcc.applications.trifa.HelperMessage.take_screen_shot_with_selection
import com.zoffcc.applications.trifa.HelperOSFile
import com.zoffcc.applications.trifa.Log
import com.zoffcc.applications.trifa.MainActivity
import com.zoffcc.applications.trifa.MainActivity.Companion.add_ngc_outgoing_file
Expand Down Expand Up @@ -347,7 +346,7 @@ fun ChatApp(focusRequester: FocusRequester, displayTextField: Boolean = true, se
}
}
}
Box(Modifier.width(80.dp).height(MESAGE_INPUT_LINE_HEIGHT).
Box(Modifier.width(80.dp).height(MESSAGE_INPUT_LINE_HEIGHT).
background(MaterialTheme.colors.background)) {
Row(modifier = Modifier.width(80.dp)){
IconButton(
Expand Down Expand Up @@ -473,7 +472,7 @@ fun GroupApp(focusRequester: FocusRequester, displayTextField: Boolean = true, s
}
}
}
Box(Modifier.width(40.dp).height(MESAGE_INPUT_LINE_HEIGHT).
Box(Modifier.width(40.dp).height(MESSAGE_INPUT_LINE_HEIGHT).
background(MaterialTheme.colors.background)) {
Row(modifier = Modifier.width(40.dp)){
IconButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.briarproject.briar.desktop.contact

import CONTACT_COLUMN_CONTACTNAME_LEN_THRESHOLD
import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
Expand Down Expand Up @@ -91,7 +92,8 @@ private fun ContactItemViewInfo(contactItem: ContactItem) = Column(
) {
val show_name = if (contactItem.name.isEmpty()) contactItem.pubkey.toUpperCase().take(6) else contactItem.name
val tooltip_name = if (contactItem.name.isEmpty()) "" else contactItem.name
val name_style = if (contactItem.name.length > 14) MaterialTheme.typography.body1.copy(fontSize = 13.sp) else MaterialTheme.typography.body1
val name_style = if (contactItem.name.length > CONTACT_COLUMN_CONTACTNAME_LEN_THRESHOLD)
MaterialTheme.typography.body1.copy(fontSize = 13.sp) else MaterialTheme.typography.body1
val friend_relay = get_relay_for_friend(contactItem.pubkey.toUpperCase())
val relay_str = if (friend_relay.isNullOrEmpty()) "" else ("\n" + "Relay (ToxProxy): " + friend_relay)
Tooltip(text = "Name: " + tooltip_name + "\n" + "Pubkey: " + contactItem.pubkey + relay_str) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.briarproject.briar.desktop.contact

import GROUPS_COLUMN_GROUPNAME_LEN_THRESHOLD
import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
Expand Down Expand Up @@ -146,7 +147,8 @@ private fun GroupItemViewInfo(groupItem: GroupItem) = Column(
) {
Text(
text = groupItem.name,
style = if (groupItem.name.length > 14) MaterialTheme.typography.body1.copy(fontSize = 13.sp) else MaterialTheme.typography.body1,
style = if (groupItem.name.length > GROUPS_COLUMN_GROUPNAME_LEN_THRESHOLD)
MaterialTheme.typography.body1.copy(fontSize = 13.sp) else MaterialTheme.typography.body1,
maxLines = 1,
overflow = Ellipsis,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.briarproject.briar.desktop.contact

import GROUP_PEER_COLUMN_PEERNAME_LEN_THRESHOLD
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
Expand Down Expand Up @@ -163,7 +164,8 @@ private fun GrouppeerItemViewInfo(grouppeerItem: GroupPeerItem) = Column(
) {
val show_peer_name = if (grouppeerItem.name.isEmpty()) grouppeerItem.pubkey.toUpperCase().take(6) else grouppeerItem.name
val tooltip_name = if (grouppeerItem.name.isEmpty()) "" else grouppeerItem.name
val name_style = if (grouppeerItem.name.length > 14) MaterialTheme.typography.body1.copy(fontSize = 12.sp) else MaterialTheme.typography.body1
val name_style = if (grouppeerItem.name.length > GROUP_PEER_COLUMN_PEERNAME_LEN_THRESHOLD)
MaterialTheme.typography.body1.copy(fontSize = 12.sp) else MaterialTheme.typography.body1
Tooltip(text = "Peer Name: " + tooltip_name + "\n"
+ "Peer Role: " + GroupPeerRoleAsStringLong(grouppeerItem.peerRole) + "\n"
+ "Pubkey: " + grouppeerItem.pubkey) {
Expand Down
Loading