update ktlint plugin to 11.3.1, format code (#3442)
This commit is contained in:
parent
774d79d666
commit
d839f18267
141 changed files with 589 additions and 428 deletions
|
|
@ -14,6 +14,7 @@
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
@file:JvmName("CustomEmojiHelper")
|
||||
|
||||
package com.keylesspalace.tusky.util
|
||||
|
||||
import android.graphics.Canvas
|
||||
|
|
@ -39,8 +40,9 @@ import java.util.regex.Pattern
|
|||
* @return the text with the shortcodes replaced by EmojiSpans
|
||||
*/
|
||||
fun CharSequence.emojify(emojis: List<Emoji>?, view: View, animate: Boolean): CharSequence {
|
||||
if (emojis.isNullOrEmpty())
|
||||
if (emojis.isNullOrEmpty()) {
|
||||
return this
|
||||
}
|
||||
|
||||
val builder = SpannableStringBuilder.valueOf(this)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ import androidx.core.net.toUri
|
|||
*
|
||||
* @see [RFC5988](https://tools.ietf.org/html/rfc5988)
|
||||
*/
|
||||
class HttpHeaderLink @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) constructor(
|
||||
class HttpHeaderLink
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
|
||||
constructor(
|
||||
uri: String
|
||||
) {
|
||||
data class Parameter(val name: String, val value: String?)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ fun Closeable?.closeQuietly() {
|
|||
|
||||
fun Uri.copyToFile(
|
||||
contentResolver: ContentResolver,
|
||||
file: File,
|
||||
file: File
|
||||
): Boolean {
|
||||
val from: InputStream?
|
||||
val to: FileOutputStream
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import com.keylesspalace.tusky.R
|
|||
private val centerCropTransformation = CenterCrop()
|
||||
|
||||
fun loadAvatar(url: String?, imageView: ImageView, @Px radius: Int, animate: Boolean) {
|
||||
|
||||
if (url.isNullOrBlank()) {
|
||||
Glide.with(imageView)
|
||||
.load(R.drawable.avatar_default)
|
||||
|
|
|
|||
|
|
@ -196,7 +196,8 @@ class ListStatusAccessibilityDelegate(
|
|||
.setAdapter(
|
||||
ArrayAdapter<CharSequence>(
|
||||
host.context,
|
||||
android.R.layout.simple_list_item_1, stringMentions
|
||||
android.R.layout.simple_list_item_1,
|
||||
stringMentions
|
||||
)
|
||||
) { _, which ->
|
||||
statusActionListener.onViewAccount(mentions[which].id)
|
||||
|
|
@ -213,7 +214,8 @@ class ListStatusAccessibilityDelegate(
|
|||
.setAdapter(
|
||||
ArrayAdapter(
|
||||
host.context,
|
||||
android.R.layout.simple_list_item_1, tags
|
||||
android.R.layout.simple_list_item_1,
|
||||
tags
|
||||
)
|
||||
) { _, which ->
|
||||
statusActionListener.onViewTag(tags[which].toString())
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ class LocaleManager @Inject constructor(
|
|||
}
|
||||
|
||||
override fun putString(key: String?, value: String?) {
|
||||
|
||||
// if we are on Android < 13 we have to save the selected language so we can apply it at appstart
|
||||
// on Android 13+ the system handles it for us
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ fun calculateInSampleSize(options: BitmapFactory.Options, reqWidth: Int, reqHeig
|
|||
var inSampleSize = 1
|
||||
|
||||
if (height > reqHeight || width > reqWidth) {
|
||||
|
||||
val halfHeight = height / 2
|
||||
val halfWidth = width / 2
|
||||
|
||||
|
|
@ -130,8 +129,13 @@ fun reorientBitmap(bitmap: Bitmap?, orientation: Int): Bitmap? {
|
|||
|
||||
return try {
|
||||
val result = Bitmap.createBitmap(
|
||||
bitmap, 0, 0, bitmap.width,
|
||||
bitmap.height, matrix, true
|
||||
bitmap,
|
||||
0,
|
||||
0,
|
||||
bitmap.width,
|
||||
bitmap.height,
|
||||
matrix,
|
||||
true
|
||||
)
|
||||
if (!bitmap.sameAs(result)) {
|
||||
bitmap.recycle()
|
||||
|
|
|
|||
|
|
@ -37,8 +37,9 @@ fun deserialize(data: String?): Set<Notification.Type> {
|
|||
for (i in 0 until array.length()) {
|
||||
val item = array.getString(i)
|
||||
val type = Notification.Type.byString(item)
|
||||
if (type != Notification.Type.UNKNOWN)
|
||||
if (type != Notification.Type.UNKNOWN) {
|
||||
ret.add(type)
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret
|
||||
|
|
|
|||
|
|
@ -35,9 +35,7 @@ import io.reactivex.rxjava3.core.Single
|
|||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
|
||||
fun updateShortcut(context: Context, account: AccountEntity) {
|
||||
|
||||
Single.fromCallable {
|
||||
|
||||
val innerSize = context.resources.getDimensionPixelSize(R.dimen.adaptive_bitmap_inner_size)
|
||||
val outerSize = context.resources.getDimensionPixelSize(R.dimen.adaptive_bitmap_outer_size)
|
||||
|
||||
|
|
@ -94,6 +92,5 @@ fun updateShortcut(context: Context, account: AccountEntity) {
|
|||
}
|
||||
|
||||
fun removeShortcut(context: Context, account: AccountEntity) {
|
||||
|
||||
ShortcutManagerCompat.removeDynamicShortcuts(context, listOf(account.id.toString()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,6 @@ object SmartLengthInputFilter : InputFilter {
|
|||
|
||||
keep = boundary
|
||||
} else {
|
||||
|
||||
// If no runway is allowed simply remove whitespace if present
|
||||
while (source[keep - 1].isWhitespace()) {
|
||||
--keep
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ private enum class FoundMatchType {
|
|||
HTTP_URL,
|
||||
HTTPS_URL,
|
||||
TAG,
|
||||
MENTION,
|
||||
MENTION
|
||||
}
|
||||
|
||||
private class FindCharsResult {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
@file:JvmName("StatusParsingHelper")
|
||||
|
||||
package com.keylesspalace.tusky.util
|
||||
|
||||
import android.text.Html.TagHandler
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ class StatusViewHelper(private val itemView: View) {
|
|||
showingContent: Boolean,
|
||||
mediaPreviewHeight: Int
|
||||
) {
|
||||
|
||||
val context = itemView.context
|
||||
val mediaPreviews = arrayOf<MediaPreviewImageView>(
|
||||
itemView.findViewById(R.id.status_media_preview_0),
|
||||
|
|
@ -110,9 +109,11 @@ class StatusViewHelper(private val itemView: View) {
|
|||
.centerInside()
|
||||
.into(mediaPreviews[i])
|
||||
} else {
|
||||
val placeholder = if (attachment.blurhash != null)
|
||||
val placeholder = if (attachment.blurhash != null) {
|
||||
decodeBlurHash(context, attachment.blurhash)
|
||||
else mediaPreviewUnloaded
|
||||
} else {
|
||||
mediaPreviewUnloaded
|
||||
}
|
||||
val meta = attachment.meta
|
||||
val focus = meta?.focus
|
||||
if (showingContent) {
|
||||
|
|
@ -185,8 +186,12 @@ class StatusViewHelper(private val itemView: View) {
|
|||
v.visibility = View.GONE
|
||||
sensitiveMediaWarning.visibility = View.VISIBLE
|
||||
setMediasPreview(
|
||||
statusDisplayOptions, attachments, sensitive, previewListener,
|
||||
false, mediaPreviewHeight
|
||||
statusDisplayOptions,
|
||||
attachments,
|
||||
sensitive,
|
||||
previewListener,
|
||||
false,
|
||||
mediaPreviewHeight
|
||||
)
|
||||
}
|
||||
sensitiveMediaWarning.setOnClickListener { v ->
|
||||
|
|
@ -194,8 +199,12 @@ class StatusViewHelper(private val itemView: View) {
|
|||
v.visibility = View.GONE
|
||||
sensitiveMediaShow.visibility = View.VISIBLE
|
||||
setMediasPreview(
|
||||
statusDisplayOptions, attachments, sensitive, previewListener,
|
||||
true, mediaPreviewHeight
|
||||
statusDisplayOptions,
|
||||
attachments,
|
||||
sensitive,
|
||||
previewListener,
|
||||
true,
|
||||
mediaPreviewHeight
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,13 +67,13 @@ fun Notification.toViewData(
|
|||
this.id,
|
||||
this.account,
|
||||
this.status?.toViewData(isShowingContent, isExpanded, isCollapsed),
|
||||
this.report,
|
||||
this.report
|
||||
)
|
||||
}
|
||||
|
||||
@JvmName("tagToViewData")
|
||||
fun TrendingTag.toViewData(): TrendingViewData.Tag {
|
||||
return TrendingViewData.Tag(
|
||||
tag = this,
|
||||
tag = this
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue