mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-27 12:15:50 +01:00
committed by
Greyson Parrelli
parent
be92b3cf0a
commit
cafbf48783
@@ -246,7 +246,7 @@ class AppSettingsActivity : DSLSettingsActivity(), InAppPaymentComponent {
|
||||
|
||||
companion object {
|
||||
fun fromCode(code: Int?): StartLocation {
|
||||
return values().find { code == it.code } ?: HOME
|
||||
return entries.find { code == it.code } ?: HOME
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1091,7 +1091,7 @@ private fun BackupFrequencyDialog(
|
||||
modifier = Modifier.padding(24.dp)
|
||||
)
|
||||
|
||||
BackupFrequency.values().forEach {
|
||||
BackupFrequency.entries.forEach {
|
||||
Rows.RadioRow(
|
||||
selected = selected == it,
|
||||
text = getTextForFrequency(backupsFrequency = it),
|
||||
|
||||
@@ -93,8 +93,8 @@ class DataAndStorageSettingsFragment : DSLSettingsFragment(R.string.preferences_
|
||||
radioListPref(
|
||||
title = DSLSettingsText.from(R.string.DataAndStorageSettingsFragment__sent_media_quality),
|
||||
listItems = sentMediaQualityLabels,
|
||||
selected = SentMediaQuality.values().indexOf(state.sentMediaQuality),
|
||||
onSelected = { viewModel.setSentMediaQuality(SentMediaQuality.values()[it]) }
|
||||
selected = SentMediaQuality.entries.indexOf(state.sentMediaQuality),
|
||||
onSelected = { viewModel.setSentMediaQuality(SentMediaQuality.entries[it]) }
|
||||
)
|
||||
|
||||
textPref(
|
||||
|
||||
@@ -140,7 +140,7 @@ private fun Content(
|
||||
expanded = expanded,
|
||||
onDismissRequest = { expanded = false }
|
||||
) {
|
||||
PendingOneTimeDonation.PaymentMethodType.values().forEach { item ->
|
||||
PendingOneTimeDonation.PaymentMethodType.entries.forEach { item ->
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = item.name) },
|
||||
onClick = {
|
||||
|
||||
@@ -516,19 +516,19 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
|
||||
|
||||
radioListPref(
|
||||
title = DSLSettingsText.from("Audio processing method"),
|
||||
listItems = CallManager.AudioProcessingMethod.values().map { it.name }.toTypedArray(),
|
||||
selected = CallManager.AudioProcessingMethod.values().indexOf(state.callingAudioProcessingMethod),
|
||||
listItems = CallManager.AudioProcessingMethod.entries.map { it.name }.toTypedArray(),
|
||||
selected = CallManager.AudioProcessingMethod.entries.indexOf(state.callingAudioProcessingMethod),
|
||||
onSelected = {
|
||||
viewModel.setInternalCallingAudioProcessingMethod(CallManager.AudioProcessingMethod.values()[it])
|
||||
viewModel.setInternalCallingAudioProcessingMethod(CallManager.AudioProcessingMethod.entries[it])
|
||||
}
|
||||
)
|
||||
|
||||
radioListPref(
|
||||
title = DSLSettingsText.from("Bandwidth mode"),
|
||||
listItems = CallManager.DataMode.values().map { it.name }.toTypedArray(),
|
||||
selected = CallManager.DataMode.values().indexOf(state.callingDataMode),
|
||||
listItems = CallManager.DataMode.entries.map { it.name }.toTypedArray(),
|
||||
selected = CallManager.DataMode.entries.indexOf(state.callingDataMode),
|
||||
onSelected = {
|
||||
viewModel.setInternalCallingDataMode(CallManager.DataMode.values()[it])
|
||||
viewModel.setInternalCallingDataMode(CallManager.DataMode.entries[it])
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ fun DonationErrorValueTypeSelector(
|
||||
expanded = expanded,
|
||||
onDismissRequest = { expanded = false }
|
||||
) {
|
||||
DonationErrorValue.Type.values().filterNot {
|
||||
DonationErrorValue.Type.entries.filterNot {
|
||||
selectedPaymentMethodType == PendingOneTimeDonation.PaymentMethodType.PAYPAL && it == DonationErrorValue.Type.FAILURE_CODE
|
||||
}.forEach { item ->
|
||||
DropdownMenuItem(
|
||||
@@ -149,8 +149,8 @@ private fun DeclineCodeErrorsDropdown(
|
||||
) {
|
||||
val values = remember(paymentMethodType) {
|
||||
when (paymentMethodType) {
|
||||
PendingOneTimeDonation.PaymentMethodType.PAYPAL -> PayPalDeclineCode.KnownCode.values()
|
||||
else -> StripeDeclineCode.Code.values()
|
||||
PendingOneTimeDonation.PaymentMethodType.PAYPAL -> PayPalDeclineCode.KnownCode.entries.toTypedArray()
|
||||
else -> StripeDeclineCode.Code.entries.toTypedArray()
|
||||
}.map { it.name }.toTypedArray()
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ private fun FailureCodeErrorsDropdown(
|
||||
onErrorCodeSelected: (String) -> Unit
|
||||
) {
|
||||
val values = remember {
|
||||
StripeFailureCode.Code.values().map { it.name }.toTypedArray()
|
||||
StripeFailureCode.Code.entries.map { it.name }.toTypedArray()
|
||||
}
|
||||
|
||||
ValuesDropdown(values = values, onErrorCodeSelected = onErrorCodeSelected)
|
||||
|
||||
@@ -33,16 +33,16 @@ class InternalDonorErrorConfigurationFragment : DSLSettingsFragment() {
|
||||
|
||||
radioListPref(
|
||||
title = DSLSettingsText.from("Cancellation Reason"),
|
||||
selected = UnexpectedSubscriptionCancellation.values().indexOf(state.selectedUnexpectedSubscriptionCancellation),
|
||||
listItems = UnexpectedSubscriptionCancellation.values().map { it.status }.toTypedArray(),
|
||||
selected = UnexpectedSubscriptionCancellation.entries.indexOf(state.selectedUnexpectedSubscriptionCancellation),
|
||||
listItems = UnexpectedSubscriptionCancellation.entries.map { it.status }.toTypedArray(),
|
||||
onSelected = { viewModel.setSelectedUnexpectedSubscriptionCancellation(it) },
|
||||
isEnabled = state.selectedBadge == null || state.selectedBadge.isSubscription()
|
||||
)
|
||||
|
||||
radioListPref(
|
||||
title = DSLSettingsText.from("Charge Failure"),
|
||||
selected = StripeDeclineCode.Code.values().indexOf(state.selectedStripeDeclineCode),
|
||||
listItems = StripeDeclineCode.Code.values().map { it.code }.toTypedArray(),
|
||||
selected = StripeDeclineCode.Code.entries.indexOf(state.selectedStripeDeclineCode),
|
||||
listItems = StripeDeclineCode.Code.entries.map { it.code }.toTypedArray(),
|
||||
onSelected = { viewModel.setStripeDeclineCode(it) },
|
||||
isEnabled = state.selectedBadge == null || state.selectedBadge.isSubscription()
|
||||
)
|
||||
|
||||
@@ -77,8 +77,8 @@ class InternalDonorErrorConfigurationViewModel : ViewModel() {
|
||||
fun setSelectedUnexpectedSubscriptionCancellation(unexpectedSubscriptionCancellationIndex: Int) {
|
||||
store.update {
|
||||
it.copy(
|
||||
selectedUnexpectedSubscriptionCancellation = if (unexpectedSubscriptionCancellationIndex in UnexpectedSubscriptionCancellation.values().indices) {
|
||||
UnexpectedSubscriptionCancellation.values()[unexpectedSubscriptionCancellationIndex]
|
||||
selectedUnexpectedSubscriptionCancellation = if (unexpectedSubscriptionCancellationIndex in UnexpectedSubscriptionCancellation.entries.toTypedArray().indices) {
|
||||
UnexpectedSubscriptionCancellation.entries[unexpectedSubscriptionCancellationIndex]
|
||||
} else {
|
||||
null
|
||||
}
|
||||
@@ -89,8 +89,8 @@ class InternalDonorErrorConfigurationViewModel : ViewModel() {
|
||||
fun setStripeDeclineCode(stripeDeclineCodeIndex: Int) {
|
||||
store.update {
|
||||
it.copy(
|
||||
selectedStripeDeclineCode = if (stripeDeclineCodeIndex in StripeDeclineCode.Code.values().indices) {
|
||||
StripeDeclineCode.Code.values()[stripeDeclineCodeIndex]
|
||||
selectedStripeDeclineCode = if (stripeDeclineCodeIndex in StripeDeclineCode.Code.entries.toTypedArray().indices) {
|
||||
StripeDeclineCode.Code.entries[stripeDeclineCodeIndex]
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@ class CustomExpireTimerSelectorView @JvmOverloads constructor(
|
||||
return
|
||||
}
|
||||
|
||||
TimerUnit.values()
|
||||
TimerUnit.entries
|
||||
.find { (timer / it.valueMultiplier) < it.maxValue }
|
||||
?.let { timerUnit ->
|
||||
valuePicker.value = (timer / timerUnit.valueMultiplier).toInt()
|
||||
unitPicker.value = TimerUnit.values().indexOf(timerUnit)
|
||||
unitPicker.value = TimerUnit.entries.indexOf(timerUnit)
|
||||
unitChange(unitPicker.value)
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class CustomExpireTimerSelectorView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun unitChange(newValue: Int) {
|
||||
val timerUnit: TimerUnit = TimerUnit.values()[newValue]
|
||||
val timerUnit: TimerUnit = TimerUnit.entries[newValue]
|
||||
|
||||
valuePicker.minValue = timerUnit.minValue
|
||||
valuePicker.maxValue = timerUnit.maxValue
|
||||
@@ -79,7 +79,7 @@ class CustomExpireTimerSelectorView @JvmOverloads constructor(
|
||||
WEEKS(1, 4, TimeUnit.DAYS.toSeconds(7));
|
||||
|
||||
companion object {
|
||||
fun get(value: Int) = values()[value]
|
||||
fun get(value: Int) = entries[value]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ private fun SetKeepMessagesScreen(
|
||||
.verticalScroll(rememberScrollState())
|
||||
) {
|
||||
KeepMessagesDuration
|
||||
.values()
|
||||
.entries
|
||||
.forEach {
|
||||
Rows.RadioRow(
|
||||
text = stringResource(id = it.stringResource),
|
||||
|
||||
@@ -97,7 +97,7 @@ enum class IdealBank(
|
||||
}
|
||||
|
||||
fun fromCode(code: String): IdealBank {
|
||||
return values().first { it.code == code }
|
||||
return entries.first { it.code == code }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ private fun BankSelectionContent(
|
||||
navigationIconPainter = painterResource(id = R.drawable.symbol_x_24)
|
||||
) { paddingValues ->
|
||||
LazyColumn(modifier = Modifier.padding(paddingValues)) {
|
||||
items(IdealBank.values()) {
|
||||
items(IdealBank.entries.toTypedArray()) {
|
||||
val uiValues = it.getUIValues()
|
||||
|
||||
Row(
|
||||
|
||||
@@ -131,7 +131,7 @@ sealed class DonationError(val source: DonationErrorSource, cause: Throwable) :
|
||||
|
||||
private val TAG = Log.tag(DonationError::class.java)
|
||||
|
||||
private val donationErrorSubjectSourceMap: Map<DonationErrorSource, Subject<DonationError>> = DonationErrorSource.values().associate { source ->
|
||||
private val donationErrorSubjectSourceMap: Map<DonationErrorSource, Subject<DonationError>> = DonationErrorSource.entries.associate { source ->
|
||||
source to PublishSubject.create()
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ enum class DonationErrorSource(private val code: String) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun deserialize(code: String): DonationErrorSource {
|
||||
return values().firstOrNull { it.code == code } ?: UNKNOWN
|
||||
return entries.firstOrNull { it.code == code } ?: UNKNOWN
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ data class PayPalDeclineCode(
|
||||
PROCESSOR_NETWORK_UNAVAILABLE_TRY_AGAIN(3000);
|
||||
|
||||
companion object {
|
||||
fun fromCode(code: Int): KnownCode? = values().firstOrNull { it.code == code }
|
||||
fun fromCode(code: Int): KnownCode? = entries.firstOrNull { it.code == code }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ enum class UnexpectedSubscriptionCancellation(val status: String) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun fromStatus(status: String?): UnexpectedSubscriptionCancellation? {
|
||||
return values().firstOrNull { it.status == status }
|
||||
return entries.firstOrNull { it.status == status }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ enum class UsernameQrCodeColorScheme(
|
||||
*/
|
||||
@JvmStatic
|
||||
fun deserialize(serialized: String?): UsernameQrCodeColorScheme {
|
||||
return values().firstOrNull { it.key == serialized } ?: Blue
|
||||
return entries.firstOrNull { it.key == serialized } ?: Blue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ class UsernameLinkQrColorPickerFragment : ComposeFragment() {
|
||||
SignalTheme(isDarkMode = false) {
|
||||
Surface {
|
||||
ColorPicker(
|
||||
colors = UsernameQrCodeColorScheme.values().toList().toImmutableList(),
|
||||
colors = UsernameQrCodeColorScheme.entries.toImmutableList(),
|
||||
selected = UsernameQrCodeColorScheme.Blue,
|
||||
onSelectionChanged = {}
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ class UsernameLinkQrColorPickerViewModel : ViewModel() {
|
||||
UsernameLinkQrColorPickerState(
|
||||
username = SignalStore.account.username!!,
|
||||
qrCodeData = QrCodeState.Loading,
|
||||
colorSchemes = UsernameQrCodeColorScheme.values().asList().toImmutableList(),
|
||||
colorSchemes = UsernameQrCodeColorScheme.entries.toImmutableList(),
|
||||
selectedColorScheme = SignalStore.misc.usernameQrCodeColorScheme
|
||||
)
|
||||
)
|
||||
|
||||
@@ -64,7 +64,7 @@ class PendingParticipantsBottomSheet : ComposeBottomSheetDialogFragment() {
|
||||
@JvmStatic
|
||||
fun getAction(bundle: Bundle): Action {
|
||||
val code = bundle.getInt(ACTION, 0)
|
||||
return Action.values().first { it.code == code }
|
||||
return Action.entries.first { it.code == code }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user