reformat code

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2024-11-26 13:35:01 +01:00
parent 8e6072bbc7
commit c7fd94ba9b
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
3 changed files with 20 additions and 18 deletions

View file

@ -775,9 +775,8 @@ class ConversationsListActivity :
)
}
private fun hasActivityActionSendIntent(): Boolean {
return Intent.ACTION_SEND == intent.action || Intent.ACTION_SEND_MULTIPLE == intent.action
}
private fun hasActivityActionSendIntent(): Boolean =
Intent.ACTION_SEND == intent.action || Intent.ACTION_SEND_MULTIPLE == intent.action
private fun showSearchView(searchView: SearchView?, searchItem: MenuItem?) {
binding.conversationListAppbar.stateListAnimator = AnimatorInflater.loadStateListAnimator(
@ -1286,10 +1285,9 @@ class ConversationsListActivity :
!participantPermissions.canIgnoreLobby()
}
private fun isReadOnlyConversation(conversation: ConversationModel): Boolean {
return conversation.conversationReadOnlyState ===
private fun isReadOnlyConversation(conversation: ConversationModel): Boolean =
conversation.conversationReadOnlyState ===
ConversationEnums.ConversationReadOnlyState.CONVERSATION_READ_ONLY
}
private fun handleSharedData() {
collectDataFromIntent()
@ -1514,7 +1512,7 @@ class ConversationsListActivity :
}
}
private fun shouldShowNotificationWarning() : Boolean {
private fun shouldShowNotificationWarning(): Boolean {
val notificationPermissionNotGranted = Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
!platformPermissionUtil.isPostNotificationsPermissionGranted()
val batteryOptimizationNotIgnored = !PowerManagerUtils().isIgnoringBatteryOptimizations()
@ -1525,8 +1523,11 @@ class ConversationsListActivity :
val serverNotificationAppInstalled =
userManager.currentUser.blockingGet().capabilities?.notificationsCapability?.features?.isNotEmpty() ?: false
val settingsOfUserAreWrong = notificationPermissionNotGranted || batteryOptimizationNotIgnored ||
messagesChannelNotEnabled || callsChannelNotEnabled || !serverNotificationAppInstalled
val settingsOfUserAreWrong = notificationPermissionNotGranted ||
batteryOptimizationNotIgnored ||
messagesChannelNotEnabled ||
callsChannelNotEnabled ||
!serverNotificationAppInstalled
val userWantsToBeNotifiedAboutWrongSettings = appPreferences.getShowNotificationWarning()

View file

@ -103,7 +103,9 @@ import javax.inject.Inject
@Suppress("LargeClass", "TooManyFunctions")
@AutoInjector(NextcloudTalkApplication::class)
class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNumberDialogClickListener {
class SettingsActivity :
BaseActivity(),
SetPhoneNumberDialogFragment.SetPhoneNumberDialogClickListener {
private lateinit var binding: ActivitySettingsBinding
@Inject
@ -351,7 +353,7 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu
resources.getColor(R.color.nc_darkRed, null)
)
if (openedByNotificationWarning){
if (openedByNotificationWarning) {
DrawableUtils.blinkDrawable(binding.settingsNotificationsPermissionWrapper.background)
}
@ -388,7 +390,7 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu
)
binding.callsRingtone.text = resources!!.getString(R.string.nc_common_disabled)
if (openedByNotificationWarning){
if (openedByNotificationWarning) {
DrawableUtils.blinkDrawable(binding.settingsCallSound.background)
}
}
@ -403,7 +405,7 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu
)
binding.messagesRingtone.text = resources!!.getString(R.string.nc_common_disabled)
if (openedByNotificationWarning){
if (openedByNotificationWarning) {
DrawableUtils.blinkDrawable(binding.settingsMessageSound.background)
}
}
@ -713,8 +715,8 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu
startActivity(intent)
}
private fun getRingtoneName(context: Context, ringtoneUri: Uri?): String {
return if (ringtoneUri == null) {
private fun getRingtoneName(context: Context, ringtoneUri: Uri?): String =
if (ringtoneUri == null) {
resources!!.getString(R.string.nc_settings_no_ringtone)
} else if ((NotificationUtils.DEFAULT_CALL_RINGTONE_URI == ringtoneUri.toString()) ||
(NotificationUtils.DEFAULT_MESSAGE_RINGTONE_URI == ringtoneUri.toString())
@ -724,7 +726,6 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu
val r = RingtoneManager.getRingtone(context, ringtoneUri)
r.getTitle(context)
}
}
private fun themeSwitchPreferences() {
binding.run {

View file

@ -162,7 +162,7 @@ object DrawableUtils {
}
}
@Suppress("MagicNumber")
@Suppress("MagicNumber", "TooGenericExceptionCaught")
fun blinkDrawable(rippleView: Drawable) {
try {
(rippleView as RippleDrawable).let { rippleDrawable ->
@ -176,7 +176,7 @@ object DrawableUtils {
}
}
}
} catch (e: Exception){
} catch (e: Exception) {
Log.e(TAG, "Failed to blink Drawable", e)
}
}