mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-08-14 01:03:28 +01:00
Add view archive to menu and add icons.
This commit is contained in:
@@ -1174,10 +1174,6 @@ class MainActivity :
|
||||
toolbarViewModel.markAllMessagesRead()
|
||||
}
|
||||
|
||||
override fun onInviteFriendsClick() {
|
||||
openSettings.launch(AppSettingsActivity.invite(this@MainActivity))
|
||||
}
|
||||
|
||||
override fun onFilterUnreadChatsClick() {
|
||||
toolbarViewModel.setChatFilter(ConversationFilter.UNREAD)
|
||||
}
|
||||
@@ -1186,6 +1182,10 @@ class MainActivity :
|
||||
toolbarViewModel.setChatFilter(ConversationFilter.OFF)
|
||||
}
|
||||
|
||||
override fun onOpenArchiveClick() {
|
||||
mainNavigationViewModel.onArchiveSelected()
|
||||
}
|
||||
|
||||
override fun onStarredMessagesClick() {
|
||||
startActivity(StarredMessagesActivity.createIntent(this@MainActivity))
|
||||
}
|
||||
|
||||
@@ -85,14 +85,15 @@ import org.thoughtcrime.securesms.conversationlist.model.ConversationFilter
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.rememberRecipientField
|
||||
import org.signal.core.ui.R as CoreUiR
|
||||
|
||||
interface MainToolbarCallback {
|
||||
fun onNewGroupClick()
|
||||
fun onClearPassphraseClick()
|
||||
fun onMarkReadClick()
|
||||
fun onInviteFriendsClick()
|
||||
fun onFilterUnreadChatsClick()
|
||||
fun onClearUnreadChatsFilterClick()
|
||||
fun onOpenArchiveClick()
|
||||
fun onSettingsClick()
|
||||
fun onNotificationProfileClick()
|
||||
fun onProxyClick()
|
||||
@@ -114,9 +115,9 @@ interface MainToolbarCallback {
|
||||
override fun onNewGroupClick() = Unit
|
||||
override fun onClearPassphraseClick() = Unit
|
||||
override fun onMarkReadClick() = Unit
|
||||
override fun onInviteFriendsClick() = Unit
|
||||
override fun onFilterUnreadChatsClick() = Unit
|
||||
override fun onClearUnreadChatsFilterClick() = Unit
|
||||
override fun onOpenArchiveClick() = Unit
|
||||
override fun onSettingsClick() = Unit
|
||||
override fun onNotificationProfileClick() = Unit
|
||||
override fun onProxyClick() = Unit
|
||||
@@ -570,6 +571,7 @@ private fun HeadsUpIndicator(state: MainToolbarState, modifier: Modifier = Modif
|
||||
@Composable
|
||||
private fun StoryDropDownItems(callback: MainToolbarCallback, onOptionSelected: () -> Unit) {
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = CoreUiR.drawable.symbol_lock_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.StoriesLandingFragment__story_privacy)
|
||||
@@ -585,6 +587,7 @@ private fun StoryDropDownItems(callback: MainToolbarCallback, onOptionSelected:
|
||||
@Composable
|
||||
private fun CallDropdownItems(callFilter: CallLogFilter, callback: MainToolbarCallback, onOptionSelected: () -> Unit) {
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = R.drawable.symbol_x_circle_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.CallLogFragment__clear_call_history)
|
||||
@@ -598,6 +601,7 @@ private fun CallDropdownItems(callFilter: CallLogFilter, callback: MainToolbarCa
|
||||
|
||||
if (callFilter == CallLogFilter.ALL) {
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = R.drawable.symbol_filter_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.CallLogFragment__filter_missed_calls)
|
||||
@@ -610,6 +614,7 @@ private fun CallDropdownItems(callFilter: CallLogFilter, callback: MainToolbarCa
|
||||
)
|
||||
} else {
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = R.drawable.symbol_filter_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.CallLogFragment__clear_filter)
|
||||
@@ -623,18 +628,7 @@ private fun CallDropdownItems(callFilter: CallLogFilter, callback: MainToolbarCa
|
||||
}
|
||||
|
||||
DropdownMenus.Item(
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.text_secure_normal__menu_settings)
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
callback.onSettingsClick()
|
||||
onOptionSelected()
|
||||
}
|
||||
)
|
||||
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = R.drawable.symbol_bell_sleep_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.ConversationListFragment__notification_profile)
|
||||
@@ -645,11 +639,25 @@ private fun CallDropdownItems(callFilter: CallLogFilter, callback: MainToolbarCa
|
||||
onOptionSelected()
|
||||
}
|
||||
)
|
||||
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = CoreUiR.drawable.symbol_settings_android_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.text_secure_normal__menu_settings)
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
callback.onSettingsClick()
|
||||
onOptionSelected()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ChatDropdownItems(state: MainToolbarState, callback: MainToolbarCallback, onOptionSelected: () -> Unit) {
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = R.drawable.symbol_group_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.text_secure_normal__menu_new_group)
|
||||
@@ -663,6 +671,7 @@ private fun ChatDropdownItems(state: MainToolbarState, callback: MainToolbarCall
|
||||
|
||||
if (state.hasPassphrase) {
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = CoreUiR.drawable.symbol_lock_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.text_secure_normal__menu_clear_passphrase)
|
||||
@@ -676,6 +685,7 @@ private fun ChatDropdownItems(state: MainToolbarState, callback: MainToolbarCall
|
||||
}
|
||||
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = R.drawable.symbol_chat_check,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.text_secure_normal__mark_all_as_read)
|
||||
@@ -687,20 +697,9 @@ private fun ChatDropdownItems(state: MainToolbarState, callback: MainToolbarCall
|
||||
}
|
||||
)
|
||||
|
||||
DropdownMenus.Item(
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.text_secure_normal__invite_friends)
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
callback.onInviteFriendsClick()
|
||||
onOptionSelected()
|
||||
}
|
||||
)
|
||||
|
||||
if (state.chatFilter == ConversationFilter.OFF) {
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = R.drawable.symbol_filter_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.text_secure_normal__filter_unread_chats)
|
||||
@@ -713,6 +712,7 @@ private fun ChatDropdownItems(state: MainToolbarState, callback: MainToolbarCall
|
||||
)
|
||||
} else {
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = R.drawable.symbol_filter_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.text_secure_normal__clear_unread_filter)
|
||||
@@ -725,8 +725,35 @@ private fun ChatDropdownItems(state: MainToolbarState, callback: MainToolbarCall
|
||||
)
|
||||
}
|
||||
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = R.drawable.symbol_bell_sleep_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.ConversationListFragment__notification_profile)
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
callback.onNotificationProfileClick()
|
||||
onOptionSelected()
|
||||
}
|
||||
)
|
||||
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = R.drawable.symbol_archive_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.AndroidManifest_archived_conversations)
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
callback.onOpenArchiveClick()
|
||||
onOptionSelected()
|
||||
}
|
||||
)
|
||||
|
||||
if (SignalStore.labs.starredMessages) {
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = R.drawable.symbol_star_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.text_secure_normal__starred_messages)
|
||||
@@ -740,6 +767,7 @@ private fun ChatDropdownItems(state: MainToolbarState, callback: MainToolbarCall
|
||||
}
|
||||
|
||||
DropdownMenus.Item(
|
||||
leadingIconResId = CoreUiR.drawable.symbol_settings_android_24,
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.text_secure_normal__menu_settings)
|
||||
@@ -750,18 +778,6 @@ private fun ChatDropdownItems(state: MainToolbarState, callback: MainToolbarCall
|
||||
onOptionSelected()
|
||||
}
|
||||
)
|
||||
|
||||
DropdownMenus.Item(
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.ConversationListFragment__notification_profile)
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
callback.onNotificationProfileClick()
|
||||
onOptionSelected()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@DayNightPreviews
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M6.54 8.47C6.65 5.33 9.1 3.12 12 3.12c0.76 0 1.5 0.16 2.16 0.44 0.44 0.19 0.96-0.02 1.15-0.46 0.18-0.45-0.02-0.96-0.47-1.15C13.96 1.58 13 1.38 12 1.38c-3.82 0-7.07 2.93-7.2 7.03-0.14 3.64-0.87 4.94-1.42 5.6-0.15 0.17-0.3 0.31-0.46 0.46l-0.07 0.07c-0.14 0.12-0.3 0.27-0.43 0.42-0.4 0.43-0.67 0.95-0.67 1.74 0 1.32 1.06 2.43 2.4 2.43H7.7c0.39 2.02 2.12 3.5 4.29 3.5s3.9-1.48 4.3-3.5h3.55c1.34 0 2.4-1.1 2.4-2.43 0-0.41-0.07-0.77-0.23-1.1-0.15-0.33-0.36-0.57-0.55-0.76L21.1 14.5c-0.24-0.23-0.45-0.42-0.69-0.75-0.28-0.4-0.82-0.5-1.22-0.21-0.4 0.27-0.49 0.82-0.2 1.21 0.35 0.5 0.76 0.89 1.03 1.14l0.2 0.18c0.12 0.13 0.17 0.2 0.2 0.28 0.04 0.06 0.07 0.16 0.07 0.35 0 0.39-0.3 0.68-0.65 0.68H4.15c-0.35 0-0.65-0.3-0.65-0.68 0-0.29 0.07-0.4 0.21-0.56l0.3-0.3 0.1-0.09c0.18-0.16 0.39-0.36 0.6-0.62 0.9-1.06 1.7-2.8 1.83-6.66Zm2.97 10.65h4.98c-0.35 1.05-1.3 1.75-2.49 1.75-1.19 0-2.14-0.7-2.49-1.75Z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M11.75 7.25c0-0.41 0.34-0.75 0.75-0.75h4c0.3 0 0.56 0.17 0.68 0.44 0.13 0.27 0.08 0.59-0.12 0.8L14.17 11h2.33c0.41 0 0.75 0.34 0.75 0.75s-0.34 0.75-0.75 0.75h-4c-0.3 0-0.56-0.17-0.68-0.44-0.13-0.27-0.08-0.59 0.12-0.8L14.83 8H12.5c-0.41 0-0.75-0.34-0.75-0.75Z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19 3.5c-0.41 0-0.75 0.34-0.75 0.75S18.59 5 19 5h1.44L18.4 7.53c-0.18 0.23-0.21 0.54-0.09 0.8 0.13 0.25 0.4 0.42 0.68 0.42h3c0.41 0 0.75-0.34 0.75-0.75S22.41 7.25 22 7.25h-1.44l2.03-2.53c0.18-0.23 0.21-0.54 0.09-0.8C22.55 3.68 22.28 3.5 22 3.5h-3Z"/>
|
||||
</vector>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:title="@string/text_secure_normal__menu_new_group"
|
||||
android:id="@+id/menu_new_group" />
|
||||
|
||||
<item android:title="@string/text_secure_normal__menu_clear_passphrase"
|
||||
android:id="@+id/menu_clear_passphrase" />
|
||||
|
||||
<item android:title="@string/text_secure_normal__mark_all_as_read"
|
||||
android:id="@+id/menu_mark_all_read" />
|
||||
|
||||
<item android:title="@string/text_secure_normal__invite_friends"
|
||||
android:id="@+id/menu_invite" />
|
||||
|
||||
<item android:title="@string/text_secure_normal__filter_unread_chats"
|
||||
android:id="@+id/menu_filter_unread_chats" />
|
||||
|
||||
<item android:title="@string/text_secure_normal__clear_unread_filter"
|
||||
android:id="@+id/menu_clear_unread_filter"
|
||||
android:visible="false" />
|
||||
|
||||
<item android:title="@string/text_secure_normal__menu_settings"
|
||||
android:id="@+id/menu_settings" />
|
||||
|
||||
<item android:title="@string/ConversationListFragment__notification_profile"
|
||||
android:id="@+id/menu_notification_profile" />
|
||||
|
||||
</menu>
|
||||
@@ -21,6 +21,7 @@ import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.LocalTextStyle
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.MenuDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
@@ -80,6 +81,7 @@ object DropdownMenus {
|
||||
fun Item(
|
||||
modifier: Modifier = Modifier,
|
||||
contentPadding: PaddingValues = PaddingValues(horizontal = 16.dp),
|
||||
@DrawableRes leadingIconResId: Int? = null,
|
||||
text: @Composable () -> Unit,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
@@ -90,6 +92,17 @@ object DropdownMenus {
|
||||
text()
|
||||
}
|
||||
},
|
||||
leadingIcon = if (leadingIconResId != null) {
|
||||
{
|
||||
Icon(
|
||||
imageVector = ImageVector.vectorResource(id = leadingIconResId),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
} else {
|
||||
null
|
||||
},
|
||||
colors = MenuDefaults.itemColors(leadingIconColor = MaterialTheme.colorScheme.onSurface),
|
||||
onClick = onClick,
|
||||
modifier = modifier
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user