mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Upgrade ktlint and add twitter compose rules.
This commit is contained in:
committed by
Greyson Parrelli
parent
52e9b31554
commit
605289aca4
@@ -11,5 +11,5 @@ data class ActionItem @JvmOverloads constructor(
|
||||
@DrawableRes val iconRes: Int,
|
||||
val title: CharSequence,
|
||||
@ColorRes val tintRes: Int = R.color.signal_colorOnSurface,
|
||||
val action: Runnable,
|
||||
val action: Runnable
|
||||
)
|
||||
|
||||
@@ -65,7 +65,7 @@ class ContextMenuList(recyclerView: RecyclerView, onItemClick: () -> Unit) {
|
||||
|
||||
private class ItemViewHolder(
|
||||
itemView: View,
|
||||
private val onItemClick: () -> Unit,
|
||||
private val onItemClick: () -> Unit
|
||||
) : MappingViewHolder<DisplayItem>(itemView) {
|
||||
val icon: ImageView = itemView.findViewById(R.id.signal_context_menu_item_icon)
|
||||
val title: TextView = itemView.findViewById(R.id.signal_context_menu_item_title)
|
||||
|
||||
@@ -36,7 +36,7 @@ class SignalContextMenu private constructor(
|
||||
|
||||
private val contextMenuList = ContextMenuList(
|
||||
recyclerView = contentView.findViewById(R.id.signal_context_menu_list),
|
||||
onItemClick = { dismiss() },
|
||||
onItemClick = { dismiss() }
|
||||
)
|
||||
|
||||
init {
|
||||
|
||||
@@ -211,6 +211,7 @@ class SegmentedProgressBar : View, ViewPager.OnPageChangeListener, View.OnTouchL
|
||||
corners[6] = radius.toFloat()
|
||||
corners[7] = radius.toFloat()
|
||||
}
|
||||
|
||||
segments.lastIndex -> {
|
||||
corners.indices.forEach { corners[it] = 0f }
|
||||
corners[2] = radius.toFloat()
|
||||
@@ -227,6 +228,7 @@ class SegmentedProgressBar : View, ViewPager.OnPageChangeListener, View.OnTouchL
|
||||
path.addRoundRect(rectangle, corners, Path.Direction.CW)
|
||||
canvas?.drawPath(path, drawingComponents.second[drawingIndex])
|
||||
}
|
||||
|
||||
else -> canvas?.drawRect(
|
||||
rectangle,
|
||||
drawingComponents.second[drawingIndex]
|
||||
@@ -325,12 +327,14 @@ class SegmentedProgressBar : View, ViewPager.OnPageChangeListener, View.OnTouchL
|
||||
|
||||
segments.mapIndexed { index, segment ->
|
||||
if (offset > 0) {
|
||||
if (index < nextSegmentIndex) segment.animationState =
|
||||
Segment.AnimationState.ANIMATED
|
||||
if (index < nextSegmentIndex) {
|
||||
segment.animationState = Segment.AnimationState.ANIMATED
|
||||
}
|
||||
} else if (offset < 0) {
|
||||
if (index > nextSegmentIndex - 1) segment.animationState =
|
||||
Segment.AnimationState.IDLE
|
||||
} else if (offset == 0) {
|
||||
if (index > nextSegmentIndex - 1) {
|
||||
segment.animationState = Segment.AnimationState.IDLE
|
||||
}
|
||||
} else {
|
||||
if (index == nextSegmentIndex) segment.animationState = Segment.AnimationState.IDLE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ fun SegmentedProgressBar.getDrawingComponents(
|
||||
segment: Segment,
|
||||
segmentIndex: Int
|
||||
): Pair<MutableList<RectF>, MutableList<Paint>> {
|
||||
|
||||
val rectangles = mutableListOf<RectF>()
|
||||
val paints = mutableListOf<Paint>()
|
||||
val segmentWidth = segmentWidth
|
||||
|
||||
@@ -32,7 +32,7 @@ sealed class DSLSettingsIcon {
|
||||
@ColorRes private val iconTintId: Int,
|
||||
@DrawableRes private val backgroundId: Int,
|
||||
@ColorRes private val backgroundTint: Int,
|
||||
@Px private val insetPx: Int,
|
||||
@Px private val insetPx: Int
|
||||
) : DSLSettingsIcon() {
|
||||
override fun resolve(context: Context): Drawable {
|
||||
return LayerDrawable(
|
||||
|
||||
@@ -46,7 +46,6 @@ class AppSettingsFragment : DSLSettingsFragment(R.string.text_secure_normal__men
|
||||
|
||||
private fun getConfiguration(state: AppSettingsState): DSLConfiguration {
|
||||
return configure {
|
||||
|
||||
customPref(
|
||||
BioPreference(state.self) {
|
||||
findNavController().safeNavigate(R.id.action_appSettingsFragment_to_manageProfileActivity)
|
||||
|
||||
@@ -59,7 +59,6 @@ class AccountSettingsFragment : DSLSettingsFragment(R.string.AccountSettingsFrag
|
||||
|
||||
private fun getConfiguration(state: AccountSettingsState): DSLConfiguration {
|
||||
return configure {
|
||||
|
||||
sectionHeaderPref(R.string.preferences_app_protection__signal_pin)
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
|
||||
@@ -161,7 +161,9 @@ class ChangeNumberEnterPhoneNumberFragment : LoggingFragment(R.layout.fragment_c
|
||||
ContinueStatus.CAN_CONTINUE -> findNavController().safeNavigate(R.id.action_enterPhoneNumberChangeFragment_to_changePhoneNumberConfirmFragment)
|
||||
ContinueStatus.INVALID_NUMBER -> {
|
||||
Dialogs.showAlertDialog(
|
||||
context, getString(R.string.RegistrationActivity_invalid_number), String.format(getString(R.string.RegistrationActivity_the_number_you_specified_s_is_invalid), viewModel.number.e164Number)
|
||||
context,
|
||||
getString(R.string.RegistrationActivity_invalid_number),
|
||||
String.format(getString(R.string.RegistrationActivity_the_number_you_specified_s_is_invalid), viewModel.number.e164Number)
|
||||
)
|
||||
}
|
||||
ContinueStatus.OLD_NUMBER_DOESNT_MATCH -> {
|
||||
|
||||
@@ -44,7 +44,6 @@ class ChatsSettingsFragment : DSLSettingsFragment(R.string.preferences_chats__ch
|
||||
|
||||
private fun getConfiguration(state: ChatsSettingsState): DSLConfiguration {
|
||||
return configure {
|
||||
|
||||
if (!state.useAsDefaultSmsApp) {
|
||||
when (state.smsExportState) {
|
||||
SmsExportState.FETCHING -> Unit
|
||||
|
||||
@@ -60,7 +60,6 @@ class SmsSettingsFragment : DSLSettingsFragment(R.string.preferences__sms_mms) {
|
||||
|
||||
private fun getConfiguration(state: SmsSettingsState): DSLConfiguration {
|
||||
return configure {
|
||||
|
||||
if (state.useAsDefaultSmsApp) {
|
||||
customPref(
|
||||
OutlinedLearnMore.Model(
|
||||
|
||||
@@ -108,7 +108,6 @@ class NotificationsSettingsFragment : DSLSettingsFragment(R.string.preferences__
|
||||
}
|
||||
)
|
||||
} else {
|
||||
|
||||
clickPref(
|
||||
title = DSLSettingsText.from(R.string.preferences__sound),
|
||||
summary = DSLSettingsText.from(getRingtoneSummary(state.messageNotificationsState.sound)),
|
||||
|
||||
@@ -41,7 +41,6 @@ class NotificationProfileSelectionFragment : DSLSettingsBottomSheetFragment() {
|
||||
val activeProfile: NotificationProfile? = NotificationProfiles.getActiveProfile(state.notificationProfiles)
|
||||
|
||||
return configure {
|
||||
|
||||
state.notificationProfiles.sortedDescending().forEach { profile ->
|
||||
customPref(
|
||||
NotificationProfileSelection.Entry(
|
||||
|
||||
@@ -148,7 +148,7 @@ class EditNotificationProfileFragment : DSLSettingsFragment(layoutId = R.layout.
|
||||
NotificationProfileNamePreset.Model("\uD83D\uDE34", R.string.EditNotificationProfileFragment__sleep, onClick),
|
||||
NotificationProfileNamePreset.Model("\uD83D\uDE97", R.string.EditNotificationProfileFragment__driving, onClick),
|
||||
NotificationProfileNamePreset.Model("\uD83D\uDE0A", R.string.EditNotificationProfileFragment__downtime, onClick),
|
||||
NotificationProfileNamePreset.Model("\uD83D\uDCA1", R.string.EditNotificationProfileFragment__focus, onClick),
|
||||
NotificationProfileNamePreset.Model("\uD83D\uDCA1", R.string.EditNotificationProfileFragment__focus, onClick)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ private val DAY_TO_STARTING_LETTER: Map<DayOfWeek, Int> = mapOf(
|
||||
DayOfWeek.WEDNESDAY to R.string.EditNotificationProfileSchedule__wednesday_first_letter,
|
||||
DayOfWeek.THURSDAY to R.string.EditNotificationProfileSchedule__thursday_first_letter,
|
||||
DayOfWeek.FRIDAY to R.string.EditNotificationProfileSchedule__friday_first_letter,
|
||||
DayOfWeek.SATURDAY to R.string.EditNotificationProfileSchedule__saturday_first_letter,
|
||||
DayOfWeek.SATURDAY to R.string.EditNotificationProfileSchedule__saturday_first_letter
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
@@ -95,7 +95,6 @@ class NotificationProfileDetailsFragment : DSLSettingsFragment() {
|
||||
val (profile: NotificationProfile, recipients: List<Recipient>, isOn: Boolean, expanded: Boolean) = state
|
||||
|
||||
return configure {
|
||||
|
||||
customPref(
|
||||
NotificationProfilePreference.Model(
|
||||
title = DSLSettingsText.from(profile.name),
|
||||
|
||||
@@ -263,7 +263,8 @@ class PrivacySettingsFragment : DSLSettingsFragment(R.string.preferences__privac
|
||||
val timeoutMinutes = max(TimeUnit.MILLISECONDS.toMinutes(duration).toInt(), 1)
|
||||
viewModel.setObsoletePasswordTimeout(timeoutMinutes)
|
||||
},
|
||||
0, TimeDurationPicker.HH_MM
|
||||
0,
|
||||
TimeDurationPicker.HH_MM
|
||||
).show()
|
||||
}
|
||||
)
|
||||
@@ -297,7 +298,8 @@ class PrivacySettingsFragment : DSLSettingsFragment(R.string.preferences__privac
|
||||
val timeoutSeconds = TimeUnit.MILLISECONDS.toSeconds(duration)
|
||||
viewModel.setScreenLockTimeout(timeoutSeconds)
|
||||
},
|
||||
0, TimeDurationPicker.HH_MM
|
||||
0,
|
||||
TimeDurationPicker.HH_MM
|
||||
).show()
|
||||
}
|
||||
)
|
||||
@@ -328,7 +330,7 @@ class PrivacySettingsFragment : DSLSettingsFragment(R.string.preferences__privac
|
||||
)
|
||||
|
||||
textPref(
|
||||
summary = DSLSettingsText.from(incognitoSummary),
|
||||
summary = DSLSettingsText.from(incognitoSummary)
|
||||
)
|
||||
|
||||
dividerPref()
|
||||
|
||||
@@ -107,7 +107,6 @@ class AdvancedPrivacySettingsFragment : DSLSettingsFragment(R.string.preferences
|
||||
|
||||
private fun getConfiguration(state: AdvancedPrivacySettingsState): DSLConfiguration {
|
||||
return configure {
|
||||
|
||||
switchPref(
|
||||
title = DSLSettingsText.from(R.string.preferences__signal_messages_and_calls),
|
||||
summary = DSLSettingsText.from(getPushToggleSummary(state.isPushEnabled)),
|
||||
|
||||
@@ -24,5 +24,5 @@ enum class CensorshipCircumventionState(val available: Boolean) {
|
||||
AVAILABLE_AUTOMATICALLY_ENABLED(true),
|
||||
|
||||
/** The setting is generically available */
|
||||
AVAILABLE(true),
|
||||
AVAILABLE(true)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ data class ExpireTimerSettingsState(
|
||||
val userSetTimer: Int? = null,
|
||||
val saveState: ProcessState<Int> = ProcessState.Idle(),
|
||||
val isGroupCreate: Boolean = false,
|
||||
val isForRecipient: Boolean = isGroupCreate,
|
||||
val isForRecipient: Boolean = isGroupCreate
|
||||
) {
|
||||
val currentTimer: Int
|
||||
get() = userSetTimer ?: initialTimer
|
||||
|
||||
@@ -108,7 +108,7 @@ data class Boost(
|
||||
val isCustomAmountFocused: Boolean,
|
||||
val isCustomAmountTooSmall: Boolean,
|
||||
val onCustomAmountChanged: (String) -> Unit,
|
||||
val onCustomAmountFocusChanged: (Boolean) -> Unit,
|
||||
val onCustomAmountFocusChanged: (Boolean) -> Unit
|
||||
) : PreferenceModel<SelectionModel>(isEnabled = isEnabled) {
|
||||
override fun areItemsTheSame(newItem: SelectionModel): Boolean = true
|
||||
|
||||
@@ -156,7 +156,8 @@ data class Boost(
|
||||
error.text = context.getString(
|
||||
R.string.Boost__the_minimum_amount_you_can_donate_is_s,
|
||||
FiatMoneyUtil.format(
|
||||
context.resources, model.minimumAmount,
|
||||
context.resources,
|
||||
model.minimumAmount,
|
||||
FiatMoneyUtil.formatOptions().trimZerosAfterDecimal()
|
||||
)
|
||||
)
|
||||
@@ -253,7 +254,6 @@ data class Boost(
|
||||
dstart: Int,
|
||||
dend: Int
|
||||
): CharSequence? {
|
||||
|
||||
val result = dest.subSequence(0, dstart).toString() + source.toString() + dest.subSequence(dend, dest.length)
|
||||
val resultWithoutCurrencyPrefix = StringUtil.stripBidiIndicator(result.removePrefix(symbol).removeSuffix(symbol).trim())
|
||||
|
||||
|
||||
@@ -247,7 +247,8 @@ class DonateToSignalViewModel(
|
||||
selectableCurrencyCodes = availableCurrencies.map(Currency::getCurrencyCode),
|
||||
isCustomAmountFocused = false,
|
||||
customAmount = FiatMoney(
|
||||
BigDecimal.ZERO, currency
|
||||
BigDecimal.ZERO,
|
||||
currency
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -247,7 +247,8 @@ class DonationCheckoutDelegate(
|
||||
|
||||
Log.d(TAG, "Displaying donation error dialog.", true)
|
||||
errorDialog = DonationErrorDialogs.show(
|
||||
fragment!!.requireContext(), throwable,
|
||||
fragment!!.requireContext(),
|
||||
throwable,
|
||||
object : DonationErrorDialogs.DialogCallback() {
|
||||
var tryCCAgain = false
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import androidx.activity.OnBackPressedCallback
|
||||
*/
|
||||
class DonationWebViewOnBackPressedCallback(
|
||||
private val dismissAllowingStateLoss: () -> Unit,
|
||||
private val webView: WebView,
|
||||
private val webView: WebView
|
||||
) : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
if (webView.canGoBack()) {
|
||||
|
||||
@@ -19,7 +19,6 @@ class YourInformationIsPrivateBottomSheet : DSLSettingsBottomSheetFragment() {
|
||||
|
||||
private fun getConfiguration(): DSLConfiguration {
|
||||
return configure {
|
||||
|
||||
space(10.dp)
|
||||
|
||||
noPadTextPref(
|
||||
|
||||
@@ -97,14 +97,16 @@ class DonationErrorParams<V> private constructor(
|
||||
return when (declinedError.declineCode) {
|
||||
is StripeDeclineCode.Known -> when (declinedError.declineCode.code) {
|
||||
StripeDeclineCode.Code.APPROVE_WITH_ID -> getStripeDeclineCodePositiveActionParams(
|
||||
context, callback,
|
||||
context,
|
||||
callback,
|
||||
when (declinedError.method) {
|
||||
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__verify_your_card_details_are_correct_and_try_again
|
||||
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__verify_your_payment_method_is_up_to_date_in_google_pay_and_try_again
|
||||
}
|
||||
)
|
||||
StripeDeclineCode.Code.CALL_ISSUER -> getStripeDeclineCodePositiveActionParams(
|
||||
context, callback,
|
||||
context,
|
||||
callback,
|
||||
when (declinedError.method) {
|
||||
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__verify_your_card_details_are_correct_and_try_again_if_the_problem_continues
|
||||
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__verify_your_payment_method_is_up_to_date_in_google_pay_and_try_again_if_the_problem
|
||||
@@ -112,21 +114,24 @@ class DonationErrorParams<V> private constructor(
|
||||
)
|
||||
StripeDeclineCode.Code.CARD_NOT_SUPPORTED -> getLearnMoreParams(context, callback, R.string.DeclineCode__your_card_does_not_support_this_type_of_purchase)
|
||||
StripeDeclineCode.Code.EXPIRED_CARD -> getStripeDeclineCodePositiveActionParams(
|
||||
context, callback,
|
||||
context,
|
||||
callback,
|
||||
when (declinedError.method) {
|
||||
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__your_card_has_expired_verify_your_card_details
|
||||
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__your_card_has_expired
|
||||
}
|
||||
)
|
||||
StripeDeclineCode.Code.INCORRECT_NUMBER -> getStripeDeclineCodePositiveActionParams(
|
||||
context, callback,
|
||||
context,
|
||||
callback,
|
||||
when (declinedError.method) {
|
||||
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__your_card_number_is_incorrect_verify_your_card_details
|
||||
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__your_card_number_is_incorrect
|
||||
}
|
||||
)
|
||||
StripeDeclineCode.Code.INCORRECT_CVC -> getStripeDeclineCodePositiveActionParams(
|
||||
context, callback,
|
||||
context,
|
||||
callback,
|
||||
when (declinedError.method) {
|
||||
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__your_cards_cvc_number_is_incorrect_verify_your_card_details
|
||||
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__your_cards_cvc_number_is_incorrect
|
||||
@@ -134,28 +139,32 @@ class DonationErrorParams<V> private constructor(
|
||||
)
|
||||
StripeDeclineCode.Code.INSUFFICIENT_FUNDS -> getLearnMoreParams(context, callback, R.string.DeclineCode__your_card_does_not_have_sufficient_funds)
|
||||
StripeDeclineCode.Code.INVALID_CVC -> getStripeDeclineCodePositiveActionParams(
|
||||
context, callback,
|
||||
context,
|
||||
callback,
|
||||
when (declinedError.method) {
|
||||
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__your_cards_cvc_number_is_incorrect_verify_your_card_details
|
||||
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__your_cards_cvc_number_is_incorrect
|
||||
}
|
||||
)
|
||||
StripeDeclineCode.Code.INVALID_EXPIRY_MONTH -> getStripeDeclineCodePositiveActionParams(
|
||||
context, callback,
|
||||
context,
|
||||
callback,
|
||||
when (declinedError.method) {
|
||||
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__the_expiration_month_on_your_card_is_incorrect
|
||||
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__the_expiration_month
|
||||
}
|
||||
)
|
||||
StripeDeclineCode.Code.INVALID_EXPIRY_YEAR -> getStripeDeclineCodePositiveActionParams(
|
||||
context, callback,
|
||||
context,
|
||||
callback,
|
||||
when (declinedError.method) {
|
||||
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__the_expiration_year_on_your_card_is_incorrect
|
||||
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__the_expiration_year
|
||||
}
|
||||
)
|
||||
StripeDeclineCode.Code.INVALID_NUMBER -> getStripeDeclineCodePositiveActionParams(
|
||||
context, callback,
|
||||
context,
|
||||
callback,
|
||||
when (declinedError.method) {
|
||||
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__your_card_number_is_incorrect_verify_your_card_details
|
||||
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__your_card_number_is_incorrect
|
||||
|
||||
@@ -105,7 +105,8 @@ class ManageDonationsFragment :
|
||||
noPadTextPref(
|
||||
title = DSLSettingsText.from(
|
||||
R.string.DonateToSignalFragment__privacy_over_profit,
|
||||
DSLSettingsText.CenterModifier, DSLSettingsText.TitleLargeModifier
|
||||
DSLSettingsText.CenterModifier,
|
||||
DSLSettingsText.TitleLargeModifier
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class ThanksForYourSupportBottomSheetDialogFragment : FixedRoundedCornerBottomSh
|
||||
.append(
|
||||
SpanUtil.clickable(
|
||||
getString(R.string.SubscribeThanksForYourSupportBottomSheetDialogFragment__become_a_montly_sustainer),
|
||||
ContextCompat.getColor(requireContext(), R.color.signal_accent_primary),
|
||||
ContextCompat.getColor(requireContext(), R.color.signal_accent_primary)
|
||||
) {
|
||||
requireActivity().finish()
|
||||
requireActivity().startActivity(AppSettingsActivity.subscriptions(requireContext()))
|
||||
|
||||
@@ -18,7 +18,6 @@ abstract class SettingsWrapperFragment : Fragment(R.layout.settings_wrapper_frag
|
||||
private set
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
toolbar = view.findViewById(R.id.toolbar)
|
||||
|
||||
toolbar.setNavigationOnClickListener {
|
||||
|
||||
@@ -55,7 +55,7 @@ class ConversationSettingsActivity : DSLSettingsActivity(), ConversationSettings
|
||||
ActivityOptionsCompat.makeSceneTransitionAnimation(
|
||||
context,
|
||||
avatar,
|
||||
"avatar",
|
||||
"avatar"
|
||||
).toBundle()
|
||||
} else {
|
||||
null
|
||||
|
||||
@@ -561,7 +561,6 @@ class ConversationSettingsFragment : DSLSettingsFragment(
|
||||
}
|
||||
|
||||
if (recipientSettingsState.selfHasGroups && !state.recipient.isReleaseNotes) {
|
||||
|
||||
dividerPref()
|
||||
|
||||
val groupsInCommonCount = recipientSettingsState.allGroupsInCommon.size
|
||||
|
||||
@@ -20,7 +20,7 @@ data class ConversationSettingsState(
|
||||
val sharedMediaIds: List<Long> = listOf(),
|
||||
val displayInternalRecipientDetails: Boolean = false,
|
||||
private val sharedMediaLoaded: Boolean = false,
|
||||
private val specificSettingsState: SpecificSettingsState,
|
||||
private val specificSettingsState: SpecificSettingsState
|
||||
) {
|
||||
|
||||
val isLoaded: Boolean = recipient != Recipient.UNKNOWN && sharedMediaLoaded && specificSettingsState.isLoaded
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.Optional
|
||||
|
||||
sealed class ConversationSettingsViewModel(
|
||||
private val repository: ConversationSettingsRepository,
|
||||
specificSettingsState: SpecificSettingsState,
|
||||
specificSettingsState: SpecificSettingsState
|
||||
) : ViewModel() {
|
||||
|
||||
private val openedMediaCursors = HashSet<Cursor>()
|
||||
@@ -407,7 +407,6 @@ sealed class ConversationSettingsViewModel(
|
||||
override fun onAddToGroup() {
|
||||
repository.getGroupCapacity(groupId) { capacityResult ->
|
||||
if (capacityResult.getRemainingCapacity() > 0) {
|
||||
|
||||
internalEvents.onNext(
|
||||
ConversationSettingsEvent.AddMembersToGroup(
|
||||
groupId,
|
||||
@@ -480,7 +479,7 @@ sealed class ConversationSettingsViewModel(
|
||||
class Factory(
|
||||
private val recipientId: RecipientId? = null,
|
||||
private val groupId: GroupId? = null,
|
||||
private val repository: ConversationSettingsRepository,
|
||||
private val repository: ConversationSettingsRepository
|
||||
) : ViewModelProvider.Factory {
|
||||
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
|
||||
@@ -278,7 +278,7 @@ class InternalConversationSettingsFragment : DSLSettingsFragment(
|
||||
", ",
|
||||
colorize("ChangeNumber", capabilities.changeNumberCapability),
|
||||
", ",
|
||||
colorize("Stories", capabilities.storiesCapability),
|
||||
colorize("Stories", capabilities.storiesCapability)
|
||||
)
|
||||
} else {
|
||||
"Recipient not found!"
|
||||
|
||||
@@ -48,7 +48,6 @@ class PermissionsSettingsFragment : DSLSettingsFragment(
|
||||
|
||||
private fun getConfiguration(state: PermissionsSettingsState): DSLConfiguration {
|
||||
return configure {
|
||||
|
||||
radioListPref(
|
||||
title = DSLSettingsText.from(R.string.PermissionsSettingsFragment__add_members),
|
||||
isEnabled = state.selfCanEditSettings,
|
||||
|
||||
@@ -34,7 +34,7 @@ object BioTextPreference {
|
||||
}
|
||||
|
||||
class RecipientModel(
|
||||
private val recipient: Recipient,
|
||||
private val recipient: Recipient
|
||||
) : BioTextPreferenceModel<RecipientModel>() {
|
||||
|
||||
override fun getHeadlineText(context: Context): CharSequence {
|
||||
|
||||
@@ -16,7 +16,7 @@ object InternalPreference {
|
||||
|
||||
class Model(
|
||||
private val recipient: Recipient,
|
||||
val onInternalDetailsClicked: () -> Unit,
|
||||
val onInternalDetailsClicked: () -> Unit
|
||||
) : PreferenceModel<Model>() {
|
||||
|
||||
override fun areItemsTheSame(newItem: Model): Boolean {
|
||||
|
||||
@@ -48,7 +48,6 @@ class SoundsAndNotificationsSettingsFragment : DSLSettingsFragment(
|
||||
|
||||
private fun getConfiguration(state: SoundsAndNotificationsSettingsState): DSLConfiguration {
|
||||
return configure {
|
||||
|
||||
val muteSummary = if (state.muteUntil > 0) {
|
||||
state.muteUntil.formatMutedUntil(requireContext())
|
||||
} else {
|
||||
|
||||
@@ -74,7 +74,6 @@ class CustomNotificationsSettingsFragment : DSLSettingsFragment(R.string.CustomN
|
||||
|
||||
private fun getConfiguration(state: CustomNotificationsSettingsState): DSLConfiguration {
|
||||
return configure {
|
||||
|
||||
sectionHeaderPref(R.string.CustomNotificationsDialogFragment__messages)
|
||||
|
||||
if (NotificationChannels.supported()) {
|
||||
|
||||
@@ -14,5 +14,5 @@ data class CustomNotificationsSettingsState(
|
||||
val messageSound: Uri? = null,
|
||||
val callVibrateState: RecipientTable.VibrateState = RecipientTable.VibrateState.DEFAULT,
|
||||
val callSound: Uri? = null,
|
||||
val showCallingOptions: Boolean = false,
|
||||
val showCallingOptions: Boolean = false
|
||||
)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("ktlint:filename")
|
||||
|
||||
package org.thoughtcrime.securesms.components.settings
|
||||
|
||||
import androidx.annotation.CallSuper
|
||||
@@ -212,7 +214,7 @@ abstract class PreferenceModel<T : PreferenceModel<T>>(
|
||||
open val summary: DSLSettingsText? = null,
|
||||
open val icon: DSLSettingsIcon? = null,
|
||||
open val iconEnd: DSLSettingsIcon? = null,
|
||||
open val isEnabled: Boolean = true,
|
||||
open val isEnabled: Boolean = true
|
||||
) : MappingModel<T> {
|
||||
override fun areItemsTheSame(newItem: T): Boolean {
|
||||
return when {
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.thoughtcrime.securesms.util.adapter.mapping.MappingViewHolder
|
||||
* A Text without any padding, allowing for exact padding to be handed in at runtime.
|
||||
*/
|
||||
data class Text(
|
||||
val text: DSLSettingsText,
|
||||
val text: DSLSettingsText
|
||||
) {
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -186,7 +186,6 @@ data class CallParticipantsState(
|
||||
webRtcViewModel: WebRtcViewModel,
|
||||
enableVideo: Boolean
|
||||
): CallParticipantsState {
|
||||
|
||||
var newShowVideoForOutgoing: Boolean = oldState.showVideoForOutgoing
|
||||
if (enableVideo) {
|
||||
newShowVideoForOutgoing = webRtcViewModel.state == WebRtcViewModel.State.CALL_OUTGOING
|
||||
@@ -281,7 +280,6 @@ data class CallParticipantsState(
|
||||
isViewingFocusedParticipant: Boolean = oldState.isViewingFocusedParticipant,
|
||||
isExpanded: Boolean = oldState.localRenderState == WebRtcLocalRenderState.EXPANDED
|
||||
): WebRtcLocalRenderState {
|
||||
|
||||
val displayLocal: Boolean = (numberOfRemoteParticipants == 0 || !isInPip) && (isNonIdleGroupCall || localParticipant.isVideoEnabled)
|
||||
var localRenderState: WebRtcLocalRenderState = WebRtcLocalRenderState.GONE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user