mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-15 18:20:14 +00:00
Addressed many aspects of PR feedback + misc. strings issues
This commit is contained in:
@@ -2101,8 +2101,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
override fun banUser(messages: Set<MessageRecord>) {
|
||||
showSessionDialog {
|
||||
title(R.string.banUser)
|
||||
// ACL TODO - We need a string for the below `text` element - have asked Lucy about this 2024/08/26 -AL
|
||||
text("This will ban the selected user from this room. It won't ban them from other rooms.")
|
||||
text(R.string.communityBanDescription)
|
||||
button(R.string.banUser) { viewModel.banUser(messages.first().individualRecipient); endActionMode() }
|
||||
cancelButton(::endActionMode)
|
||||
}
|
||||
@@ -2111,8 +2110,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
override fun banAndDeleteAll(messages: Set<MessageRecord>) {
|
||||
showSessionDialog {
|
||||
title(R.string.banUser)
|
||||
// ACL TODO - We need a string for the below `text` element - have asked Lucy about this 2024/08/26 -AL
|
||||
text("This will ban the selected user from this room and delete all messages sent by them. It won't ban them from other rooms or delete the messages they sent there.")
|
||||
text(R.string.communityBanDeleteDescription)
|
||||
button(R.string.banUser) { viewModel.banAndDeleteAll(messages.first()); endActionMode() }
|
||||
cancelButton(::endActionMode)
|
||||
}
|
||||
|
@@ -45,44 +45,6 @@ class SearchBottomBar : LinearLayout {
|
||||
setViewEnabled(searchDown, position > 0)
|
||||
}
|
||||
|
||||
/*
|
||||
fun setData(position: Int, count: Int, query: String?) = with(binding) {
|
||||
searchProgressWheel.visibility = GONE
|
||||
searchUp.setOnClickListener { v: View? ->
|
||||
if (eventListener != null) {
|
||||
eventListener!!.onSearchMoveUpPressed()
|
||||
}
|
||||
}
|
||||
searchDown.setOnClickListener { v: View? ->
|
||||
if (eventListener != null) {
|
||||
eventListener!!.onSearchMoveDownPressed()
|
||||
}
|
||||
}
|
||||
|
||||
// If we found search results list how many we found
|
||||
if (count > 0) {
|
||||
searchPosition.text = Phrase.from(context, R.string.searchMatches)
|
||||
.put(COUNT_KEY, position + 1)
|
||||
.put(TOTAL_COUNT_KEY, count)
|
||||
.format()
|
||||
} else {
|
||||
// If there are no results we don't display anything if the query is
|
||||
// empty, but we'll substitute "No results found for <query>" otherwise.
|
||||
var txt = ""
|
||||
if (query != null) {
|
||||
if (query.isNotEmpty()) {
|
||||
txt = Phrase.from(context, R.string.searchMatchesNoneSpecific)
|
||||
.put(QUERY_KEY, query)
|
||||
.format().toString()
|
||||
}
|
||||
}
|
||||
searchPosition.text = txt
|
||||
}
|
||||
setViewEnabled(searchUp, position < count - 1)
|
||||
setViewEnabled(searchDown, position > 0)
|
||||
}
|
||||
*/
|
||||
|
||||
fun showLoading() {
|
||||
binding.searchProgressWheel.visibility = VISIBLE
|
||||
}
|
||||
|
@@ -45,10 +45,6 @@ public class MultipleRecipientNotificationBuilder extends AbstractNotificationBu
|
||||
.put(CONVERSATION_COUNT_KEY, threadCount)
|
||||
.format().toString();
|
||||
setSubText(txt);
|
||||
|
||||
// Note: `setContentInfo` details are only visible in Android API 24 and below - as our minimum is now API 26 this can be skipped.
|
||||
//setContentInfo(String.valueOf(messageCount));
|
||||
|
||||
setNumber(messageCount);
|
||||
}
|
||||
|
||||
|
@@ -131,21 +131,17 @@ internal fun LandingScreen(
|
||||
MESSAGES.take(count),
|
||||
key = { it.stringId }
|
||||
) { item ->
|
||||
// Perform string substitution in the bubbles that require it
|
||||
if (item.stringId == R.string.onboardingBubbleWelcomeToSession ||
|
||||
item.stringId == R.string.onboardingBubbleSessionIsEngineered) {
|
||||
AnimateMessageText(
|
||||
Phrase.from(stringResource(item.stringId))
|
||||
.put(APP_NAME_KEY, stringResource(R.string.app_name))
|
||||
.format().toString(),
|
||||
item.isOutgoing
|
||||
)
|
||||
} else { // Non-substituted text bubbles
|
||||
AnimateMessageText(
|
||||
stringResource(item.stringId),
|
||||
item.isOutgoing
|
||||
)
|
||||
// Perform string substitution only in the bubbles that require it
|
||||
val bubbleTxt = if (item.stringId == R.string.onboardingBubbleWelcomeToSession ||
|
||||
item.stringId == R.string.onboardingBubbleSessionIsEngineered) {
|
||||
Phrase.from(stringResource(item.stringId)).put(APP_NAME_KEY, stringResource(R.string.app_name)).format().toString()
|
||||
} else {
|
||||
stringResource(item.stringId)
|
||||
}
|
||||
AnimateMessageText(
|
||||
bubbleTxt,
|
||||
item.isOutgoing
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -80,12 +80,13 @@ internal fun MessageNotificationsScreen(
|
||||
|
||||
// spacing between buttons is provided by ripple/downstate of NotificationRadioButton
|
||||
|
||||
val txt = Phrase.from(stringResource(R.string.onboardingMessageNotificationExplanation))
|
||||
val explanationTxt = Phrase.from(stringResource(R.string.notificationsSlowModeDescription))
|
||||
.put(APP_NAME_KEY, stringResource(R.string.app_name))
|
||||
.format().toString()
|
||||
|
||||
NotificationRadioButton(
|
||||
R.string.notificationsSlowMode,
|
||||
R.string.notificationsSlowModeDescription,
|
||||
stringResource(R.string.notificationsSlowMode),
|
||||
explanationTxt,
|
||||
modifier = Modifier.contentDescription(R.string.AccessibilityId_notificationsSlowMode),
|
||||
checked = state.pushDisabled,
|
||||
onClick = { setEnabled(false) }
|
||||
@@ -99,8 +100,8 @@ internal fun MessageNotificationsScreen(
|
||||
|
||||
@Composable
|
||||
private fun NotificationRadioButton(
|
||||
@StringRes title: Int,
|
||||
@StringRes explanation: Int,
|
||||
@StringRes titleId: Int,
|
||||
@StringRes explanationId: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
@StringRes tag: Int? = null,
|
||||
checked: Boolean = false,
|
||||
@@ -124,28 +125,65 @@ private fun NotificationRadioButton(
|
||||
Column(
|
||||
modifier = Modifier.padding(horizontal = LocalDimensions.current.smallSpacing, vertical = LocalDimensions.current.xsSpacing)) {
|
||||
Text(
|
||||
stringResource(title),
|
||||
stringResource(titleId),
|
||||
style = LocalType.current.h8
|
||||
)
|
||||
|
||||
// If this radio button is the one for slow mode notifications then substitute the app name..
|
||||
if (explanation == R.string.notificationsSlowModeDescription) {
|
||||
val txt = Phrase.from(stringResource(explanation))
|
||||
.put(APP_NAME_KEY, stringResource(R.string.app_name))
|
||||
.format().toString()
|
||||
Text(
|
||||
stringResource(explanationId),
|
||||
style = LocalType.current.small,
|
||||
modifier = Modifier.padding(top = LocalDimensions.current.xxsSpacing)
|
||||
)
|
||||
|
||||
tag?.let {
|
||||
Text(
|
||||
txt,
|
||||
style = LocalType.current.small,
|
||||
modifier = Modifier.padding(top = LocalDimensions.current.xxsSpacing)
|
||||
)
|
||||
} else {
|
||||
// ..otherwise just pass through the text as it is.
|
||||
Text(
|
||||
stringResource(explanation),
|
||||
style = LocalType.current.small,
|
||||
modifier = Modifier.padding(top = LocalDimensions.current.xxsSpacing)
|
||||
stringResource(it),
|
||||
modifier = Modifier.padding(top = LocalDimensions.current.xxsSpacing),
|
||||
color = LocalColors.current.primary,
|
||||
style = LocalType.current.h9
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun NotificationRadioButton(
|
||||
titleTxt: String,
|
||||
explanationTxt: String,
|
||||
modifier: Modifier = Modifier,
|
||||
@StringRes tag: Int? = null,
|
||||
checked: Boolean = false,
|
||||
onClick: () -> Unit = {}
|
||||
) {
|
||||
RadioButton(
|
||||
onClick = onClick,
|
||||
modifier = modifier,
|
||||
selected = checked,
|
||||
contentPadding = PaddingValues(horizontal = LocalDimensions.current.mediumSpacing, vertical = 7.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.border(
|
||||
LocalDimensions.current.borderStroke,
|
||||
LocalColors.current.borders,
|
||||
RoundedCornerShape(8.dp)
|
||||
),
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(horizontal = LocalDimensions.current.smallSpacing, vertical = LocalDimensions.current.xsSpacing)) {
|
||||
Text(
|
||||
titleTxt,
|
||||
style = LocalType.current.h8
|
||||
)
|
||||
|
||||
Text(
|
||||
explanationTxt,
|
||||
style = LocalType.current.small,
|
||||
modifier = Modifier.padding(top = LocalDimensions.current.xxsSpacing)
|
||||
)
|
||||
|
||||
tag?.let {
|
||||
Text(
|
||||
|
@@ -46,13 +46,13 @@ class HelpSettingsFragment: CorrectedPreferenceFragment() {
|
||||
addPreferencesFromResource(R.xml.preferences_help)
|
||||
|
||||
// String sub the summary text of the `export_logs` element in preferences_help.xml
|
||||
var exportPref = preferenceScreen.findPreference<Preference>(EXPORT_LOGS)
|
||||
val exportPref = preferenceScreen.findPreference<Preference>(EXPORT_LOGS)
|
||||
exportPref?.summary = Phrase.from(context, R.string.helpReportABugExportLogsDescription)
|
||||
.put(APP_NAME_KEY, getString(R.string.app_name))
|
||||
.format()
|
||||
|
||||
// String sub the summary text of the `translate_session` element in preferences_help.xml
|
||||
var translatePref = preferenceScreen.findPreference<Preference>(TRANSLATE)
|
||||
val translatePref = preferenceScreen.findPreference<Preference>(TRANSLATE)
|
||||
translatePref?.title = Phrase.from(context, R.string.helpHelpUsTranslateSession)
|
||||
.put(APP_NAME_KEY, getString(R.string.app_name))
|
||||
.format()
|
||||
|
@@ -3,14 +3,13 @@ package org.thoughtcrime.securesms.preferences
|
||||
import android.app.KeyguardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceCategory
|
||||
import androidx.preference.PreferenceDataStore
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
import network.loki.messenger.BuildConfig
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
@@ -24,7 +23,6 @@ import org.thoughtcrime.securesms.service.KeyCachingService
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
import org.thoughtcrime.securesms.util.CallNotificationBuilder.Companion.areNotificationsEnabled
|
||||
import org.thoughtcrime.securesms.util.IntentUtils
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class PrivacySettingsPreferenceFragment : ListSummaryPreferenceFragment() {
|
||||
|
@@ -39,6 +39,7 @@
|
||||
android:key="pref_typing_indicators"
|
||||
android:title="@string/typingIndicators"
|
||||
android:summary="@string/typingIndicatorsDescription" />
|
||||
<ImagePreference />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
Reference in New Issue
Block a user