mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-24 10:25:51 +03:00
ktlint: fix (experimental:multiline-if-else) issues
This commit is contained in:
parent
99d9704a50
commit
e5779d425a
10 changed files with 49 additions and 37 deletions
|
@ -28,3 +28,4 @@ disabled_rules=no-wildcard-imports,no-multi-spaces,colon-spacing,chain-wrapping,
|
|||
# curly-spacing
|
||||
# no-semi
|
||||
# no-empty-class-body
|
||||
# experimental:multiline-if-else
|
||||
|
|
|
@ -38,9 +38,10 @@ object ContentUtils {
|
|||
fun extractUsefulTextFromHtmlReply(repliedBody: String): String {
|
||||
if (repliedBody.startsWith("<mx-reply>")) {
|
||||
val closingTagIndex = repliedBody.lastIndexOf("</mx-reply>")
|
||||
if (closingTagIndex != -1)
|
||||
if (closingTagIndex != -1) {
|
||||
return repliedBody.substring(closingTagIndex + "</mx-reply>".length).trim()
|
||||
}
|
||||
}
|
||||
return repliedBody
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,11 +52,12 @@ fun base58encode(input: ByteArray): String {
|
|||
s.insert(0, ALPHABET[bi.toInt()])
|
||||
// Convert leading zeros too.
|
||||
for (anInput in input) {
|
||||
if (anInput.toInt() == 0)
|
||||
if (anInput.toInt() == 0) {
|
||||
s.insert(0, ALPHABET[0])
|
||||
else
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return s.toString()
|
||||
}
|
||||
|
||||
|
|
|
@ -68,11 +68,12 @@ internal abstract class SASVerificationTransaction(
|
|||
|
||||
// older devices have limited support of emoji, so reply with decimal
|
||||
val KNOWN_SHORT_CODES =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
listOf(SasMode.EMOJI, SasMode.DECIMAL)
|
||||
else
|
||||
} else {
|
||||
listOf(SasMode.DECIMAL)
|
||||
}
|
||||
}
|
||||
|
||||
override var state by Delegates.observable(SasVerificationTxState.None) { _, _, new ->
|
||||
// println("$property has changed from $old to $new")
|
||||
|
|
|
@ -352,11 +352,12 @@ internal class LocalEchoEventFactory @Inject constructor(@UserId private val use
|
|||
}
|
||||
}
|
||||
val isReply = content.isReply() || originalContent.isReply()
|
||||
return if (isReply)
|
||||
return if (isReply) {
|
||||
TextContent(content.body, formattedText).removeInReplyFallbacks()
|
||||
else
|
||||
} else {
|
||||
TextContent(content.body, formattedText)
|
||||
}
|
||||
}
|
||||
MessageType.MSGTYPE_FILE -> return TextContent(stringProvider.getString(R.string.reply_to_a_file))
|
||||
MessageType.MSGTYPE_AUDIO -> return TextContent(stringProvider.getString(R.string.reply_to_an_audio_file))
|
||||
MessageType.MSGTYPE_IMAGE -> return TextContent(stringProvider.getString(R.string.reply_to_an_image))
|
||||
|
|
|
@ -177,10 +177,11 @@ class BingRulePreference : VectorPreference {
|
|||
&& !TextUtils.equals(rule.ruleId, BingRule.RULE_ID_INVITE_ME)
|
||||
&& NOTIFICATION_NOISY_INDEX == index)
|
||||
if (NOTIFICATION_NOISY_INDEX == index) {
|
||||
rule.notificationSound = if (TextUtils.equals(rule.ruleId, BingRule.RULE_ID_CALL))
|
||||
rule.notificationSound = if (TextUtils.equals(rule.ruleId, BingRule.RULE_ID_CALL)) {
|
||||
BingRule.ACTION_VALUE_RING
|
||||
else
|
||||
} else {
|
||||
BingRule.ACTION_VALUE_DEFAULT
|
||||
}
|
||||
} else {
|
||||
rule.removeNotificationSound()
|
||||
}
|
||||
|
|
|
@ -82,10 +82,11 @@ fun logPermissionStatuses(context: Context) {
|
|||
|
||||
for (permission in permissions) {
|
||||
Timber.v(("Status of [$permission] : " +
|
||||
if (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(context, permission))
|
||||
if (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(context, permission)) {
|
||||
"PERMISSION_GRANTED"
|
||||
else
|
||||
"PERMISSION_DENIED"))
|
||||
} else {
|
||||
"PERMISSION_DENIED"
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,12 +90,13 @@ class CreateDirectRoomActivity : SimpleFragmentActivity() {
|
|||
hideWaitingView()
|
||||
if (error is CreateRoomFailure.CreatedWithTimeout) {
|
||||
finish()
|
||||
} else
|
||||
} else {
|
||||
AlertDialog.Builder(this)
|
||||
.setMessage(errorFormatter.toHumanReadable(error))
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderCreationSuccess(roomId: String?) {
|
||||
// Navigate to freshly created room
|
||||
|
|
|
@ -988,9 +988,10 @@ class RoomDetailFragment :
|
|||
override fun onFinish() {}
|
||||
|
||||
override fun onSuccess(image: File?) {
|
||||
if (image != null)
|
||||
if (image != null) {
|
||||
shareMedia(requireContext(), image, "image/*")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(error: Exception?) {}
|
||||
|
||||
|
|
|
@ -117,13 +117,15 @@ class ReactionButton @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||
|
||||
circleStartColor = array.getColor(R.styleable.ReactionButton_circle_start_color, 0)
|
||||
|
||||
if (circleStartColor != 0)
|
||||
if (circleStartColor != 0) {
|
||||
circleView.startColor = circleStartColor
|
||||
}
|
||||
|
||||
circleEndColor = array.getColor(R.styleable.ReactionButton_circle_end_color, 0)
|
||||
|
||||
if (circleEndColor != 0)
|
||||
if (circleEndColor != 0) {
|
||||
circleView.endColor = circleEndColor
|
||||
}
|
||||
|
||||
dotPrimaryColor = array.getColor(R.styleable.ReactionButton_dots_primary_color, 0)
|
||||
dotSecondaryColor = array.getColor(R.styleable.ReactionButton_dots_secondary_color, 0)
|
||||
|
@ -159,8 +161,9 @@ class ReactionButton @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||
*/
|
||||
override fun onClick(v: View) {
|
||||
|
||||
if (!isEnabled)
|
||||
if (!isEnabled) {
|
||||
return
|
||||
}
|
||||
|
||||
isChecked = !isChecked
|
||||
|
||||
|
|
Loading…
Reference in a new issue