Skip to content

Commit

Permalink
reformat code
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Hibbe <[email protected]>
  • Loading branch information
mahibi committed Nov 26, 2024
1 parent f037564 commit 7a9c281
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down Expand Up @@ -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())
Expand All @@ -724,7 +726,6 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu
val r = RingtoneManager.getRingtone(context, ringtoneUri)
r.getTitle(context)
}
}

private fun themeSwitchPreferences() {
binding.run {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/nextcloud/talk/utils/DrawableUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ object DrawableUtils {
}
}

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

0 comments on commit 7a9c281

Please sign in to comment.