From c887c8213c725f1b2cdb571f70a29859ff980f55 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Mon, 16 Sep 2024 20:57:27 +0200 Subject: [PATCH] fix new warnings, regenerate lint-baseline.xml (#4684) Mostly "StringFormatTrivial" which I think is new, but it makes totally sense to fix --- app/lint-baseline.xml | 101 ++++++------------ .../com/keylesspalace/tusky/BaseActivity.java | 1 - .../keylesspalace/tusky/StatusListActivity.kt | 2 +- .../java/com/keylesspalace/tusky/TabData.kt | 2 +- .../tusky/adapter/PlaceholderViewHolder.kt | 1 - .../compose/ComposeAutoCompleteAdapter.kt | 20 +--- .../tusky/components/compose/MediaUploader.kt | 8 +- .../compose/view/ComposeScheduleView.kt | 8 +- .../tusky/components/drafts/DraftHelper.kt | 2 +- .../tusky/components/login/LoginActivity.kt | 2 +- .../search/adapter/SearchHashtagsAdapter.kt | 3 +- .../NotificationFetcher.kt | 2 +- .../components/timeline/TimelineFragment.kt | 7 -- .../viewmodel/CachedTimelineViewModel.kt | 1 - .../viewmodel/NetworkTimelineViewModel.kt | 1 - .../timeline/viewmodel/TimelineViewModel.kt | 2 - .../trending/TrendingTagViewHolder.kt | 9 +- .../tusky/fragment/ViewImageFragment.kt | 1 - .../tusky/fragment/ViewVideoFragment.kt | 1 - .../tusky/network/FilterModel.kt | 2 +- .../keylesspalace/tusky/util/NumberUtils.kt | 8 +- .../tusky/util/StatusViewHelper.kt | 2 +- app/src/main/res/values-hu/strings.xml | 4 +- app/src/main/res/values/donottranslate.xml | 2 +- 24 files changed, 68 insertions(+), 124 deletions(-) diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml index aa4ba092c..fe77d2c8d 100644 --- a/app/lint-baseline.xml +++ b/app/lint-baseline.xml @@ -1,5 +1,5 @@ - + @@ -19,7 +19,7 @@ errorLine2=" ~~~~~~~~~~~"> @@ -53,14 +53,14 @@ + message="Overriding `@layout/exo_player_control_view` which is marked as private in androidx.media3:media3-ui:1.4.1. If deliberate, use tools:override="true", otherwise pick a different name."> + errorLine1=" <string name="notification_summary_report_format">%1$s · %2$d posts attached</string>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + errorLine1=" <string name="pref_title_http_proxy_port_message">Port should be between %1$d and %2$d</string>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -241,7 +241,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -252,7 +252,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -263,7 +263,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -384,7 +384,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -428,7 +428,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~"> @@ -545,11 +545,11 @@ + errorLine1=" ShortcutManagerCompat.setDynamicShortcuts(context, shortcuts)" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -725,7 +725,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~"> @@ -758,7 +758,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~"> @@ -850,37 +850,4 @@ column="9"/> - - - - - - - - - - - - diff --git a/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java b/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java index c8cab13d6..2231e7cea 100644 --- a/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java @@ -31,7 +31,6 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StringRes; -import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.lifecycle.ViewModelProvider; diff --git a/app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt b/app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt index ca501aeba..2ffcc894b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt @@ -75,7 +75,7 @@ class StatusListActivity : BottomSheetActivity() { val title = when (kind) { Kind.FAVOURITES -> getString(R.string.title_favourites) Kind.BOOKMARKS -> getString(R.string.title_bookmarks) - Kind.TAG -> getString(R.string.title_tag).format(hashtag) + Kind.TAG -> getString(R.string.hashtag_format, hashtag) Kind.PUBLIC_TRENDING_STATUSES -> getString(R.string.title_public_trending_statuses) else -> intent.getStringExtra(EXTRA_LIST_TITLE) } diff --git a/app/src/main/java/com/keylesspalace/tusky/TabData.kt b/app/src/main/java/com/keylesspalace/tusky/TabData.kt index 7dccd4955..caefa0dac 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TabData.kt +++ b/app/src/main/java/com/keylesspalace/tusky/TabData.kt @@ -118,7 +118,7 @@ fun createTabDataFromId(id: String, arguments: List = emptyList()): TabD arguments = arguments, title = { context -> arguments.joinToString(separator = " ") { - context.getString(R.string.title_tag, it) + context.getString(R.string.hashtag_format, it) } } ) diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/PlaceholderViewHolder.kt b/app/src/main/java/com/keylesspalace/tusky/adapter/PlaceholderViewHolder.kt index 88dead0e6..d64780a60 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/PlaceholderViewHolder.kt +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/PlaceholderViewHolder.kt @@ -18,7 +18,6 @@ import androidx.recyclerview.widget.RecyclerView import com.keylesspalace.tusky.databinding.ItemStatusPlaceholderBinding import com.keylesspalace.tusky.interfaces.StatusActionListener import com.keylesspalace.tusky.util.hide -import com.keylesspalace.tusky.util.show import com.keylesspalace.tusky.util.visible /** diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeAutoCompleteAdapter.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeAutoCompleteAdapter.kt index 25d78d3af..4b608d3b9 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeAutoCompleteAdapter.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeAutoCompleteAdapter.kt @@ -57,9 +57,9 @@ class ComposeAutoCompleteAdapter( override fun convertResultToString(resultValue: Any): CharSequence { return when (resultValue) { - is AutocompleteResult.AccountResult -> formatUsername(resultValue) - is AutocompleteResult.HashtagResult -> formatHashtag(resultValue) - is AutocompleteResult.EmojiResult -> formatEmoji(resultValue) + is AutocompleteResult.AccountResult -> "@${resultValue.account.username}" + is AutocompleteResult.HashtagResult -> "#${resultValue.hashtag}" + is AutocompleteResult.EmojiResult -> ":${resultValue.emoji.shortcode}:" else -> "" } } @@ -122,7 +122,7 @@ class ComposeAutoCompleteAdapter( } is ItemAutocompleteHashtagBinding -> { val result = getItem(position) as AutocompleteResult.HashtagResult - binding.root.text = formatHashtag(result) + binding.root.text = context.getString(R.string.hashtag_format, result.hashtag) } is ItemAutocompleteEmojiBinding -> { val emojiResult = getItem(position) as AutocompleteResult.EmojiResult @@ -162,17 +162,5 @@ class ComposeAutoCompleteAdapter( private const val ACCOUNT_VIEW_TYPE = 0 private const val HASHTAG_VIEW_TYPE = 1 private const val EMOJI_VIEW_TYPE = 2 - - private fun formatUsername(result: AutocompleteResult.AccountResult): String { - return String.format("@%s", result.account.username) - } - - private fun formatHashtag(result: AutocompleteResult.HashtagResult): String { - return String.format("#%s", result.hashtag) - } - - private fun formatEmoji(result: AutocompleteResult.EmojiResult): String { - return String.format(":%s:", result.emoji.shortcode) - } } } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/MediaUploader.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/MediaUploader.kt index 96d687cd0..d61f46a68 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/compose/MediaUploader.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/MediaUploader.kt @@ -265,12 +265,8 @@ class MediaUploader @Inject constructor( } val map = MimeTypeMap.getSingleton() val fileExtension = map.getExtensionFromMimeType(mimeType) - val filename = "%s_%d_%s.%s".format( - context.getString(R.string.app_name), - System.currentTimeMillis(), - randomAlphanumericString(10), - fileExtension - ) + val filename = + "${context.getString(R.string.app_name)}_${System.currentTimeMillis()}_${randomAlphanumericString(10)}.$fileExtension" if (mimeType == null) mimeType = "multipart/form-data" diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ComposeScheduleView.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ComposeScheduleView.kt index c7f6a503f..b061d6298 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ComposeScheduleView.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/view/ComposeScheduleView.kt @@ -14,6 +14,7 @@ * see . */ package com.keylesspalace.tusky.components.compose.view +import android.annotation.SuppressLint import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater @@ -80,11 +81,8 @@ class ComposeScheduleView } val scheduled = scheduleDateTimeUtc!!.time - binding.scheduledDateTime.text = String.format( - "%s %s", - dateFormat.format(scheduled), - timeFormat.format(scheduled) - ) + @SuppressLint("SetTextI18n") + binding.scheduledDateTime.text = "${dateFormat.format(scheduled)} ${timeFormat.format(scheduled)}" verifyScheduledTime(scheduled) } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftHelper.kt b/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftHelper.kt index e68896029..742f1adaf 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftHelper.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftHelper.kt @@ -178,7 +178,7 @@ class DraftHelper @Inject constructor( map.getExtensionFromMimeType(mimeType) } - val filename = String.format("Tusky_Draft_Media_%s_%d.%s", timeStamp, index, fileExtension) + val filename = "Tusky_Draft_Media_${timeStamp}_$index.$fileExtension" val file = File(folder, filename) if (scheme == "https") { diff --git a/app/src/main/java/com/keylesspalace/tusky/components/login/LoginActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/login/LoginActivity.kt index 014893e59..6cc909732 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/login/LoginActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/login/LoginActivity.kt @@ -257,7 +257,7 @@ class LoginActivity : BaseActivity() { getString(R.string.error_authorization_unknown) } else { // Use error returned by the server or fall back to the generic message - Log.e(TAG, "%s %s".format(getString(R.string.error_authorization_denied), error)) + Log.e(TAG, getString(R.string.error_authorization_denied) + " " + error) error.ifBlank { getString(R.string.error_authorization_denied) } } } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/search/adapter/SearchHashtagsAdapter.kt b/app/src/main/java/com/keylesspalace/tusky/components/search/adapter/SearchHashtagsAdapter.kt index 052ccc9b9..d31a48683 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/search/adapter/SearchHashtagsAdapter.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/search/adapter/SearchHashtagsAdapter.kt @@ -19,6 +19,7 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.paging.PagingDataAdapter import androidx.recyclerview.widget.DiffUtil +import com.keylesspalace.tusky.R import com.keylesspalace.tusky.databinding.ItemHashtagBinding import com.keylesspalace.tusky.entity.HashTag import com.keylesspalace.tusky.interfaces.LinkListener @@ -37,7 +38,7 @@ class SearchHashtagsAdapter(private val linkListener: LinkListener) : override fun onBindViewHolder(holder: BindingHolder, position: Int) { getItem(position)?.let { (name) -> - holder.binding.root.text = String.format("#%s", name) + holder.binding.root.text = holder.binding.root.context.getString(R.string.hashtag_format, name) holder.binding.root.setOnClickListener { linkListener.onViewTag(name) } } } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/systemnotifications/NotificationFetcher.kt b/app/src/main/java/com/keylesspalace/tusky/components/systemnotifications/NotificationFetcher.kt index 20b52923c..13ea0d909 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/systemnotifications/NotificationFetcher.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/systemnotifications/NotificationFetcher.kt @@ -162,7 +162,7 @@ class NotificationFetcher @Inject constructor( * than the marker. */ private suspend fun fetchNewNotifications(account: AccountEntity): List { - val authHeader = String.format("Bearer %s", account.accessToken) + val authHeader = "Bearer ${account.accessToken}" // Figure out where to read from. Choose the most recent notification ID from: // diff --git a/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt index bc0d75dbd..a4d98648f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt @@ -604,13 +604,6 @@ class TimelineFragment : viewModel.removeStatusWithId(status.id) } - private fun actionButtonPresent(): Boolean { - return viewModel.kind != TimelineViewModel.Kind.TAG && - viewModel.kind != TimelineViewModel.Kind.FAVOURITES && - viewModel.kind != TimelineViewModel.Kind.BOOKMARKS && - activity is ActionButtonActivity - } - private var talkBackWasEnabled = false override fun onPause() { diff --git a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/CachedTimelineViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/CachedTimelineViewModel.kt index 95015be26..2685fda14 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/CachedTimelineViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/CachedTimelineViewModel.kt @@ -70,7 +70,6 @@ class CachedTimelineViewModel @Inject constructor( private val db: AppDatabase ) : TimelineViewModel( timelineCases, - api, eventHub, accountManager, sharedPreferences, diff --git a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/NetworkTimelineViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/NetworkTimelineViewModel.kt index 61552e95e..41b5eb0bf 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/NetworkTimelineViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/NetworkTimelineViewModel.kt @@ -72,7 +72,6 @@ class NetworkTimelineViewModel @Inject constructor( filterModel: FilterModel ) : TimelineViewModel( timelineCases, - api, eventHub, accountManager, sharedPreferences, diff --git a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt index 5bfc16cd5..015725660 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt @@ -31,7 +31,6 @@ import com.keylesspalace.tusky.db.AccountManager import com.keylesspalace.tusky.entity.Filter import com.keylesspalace.tusky.entity.Poll import com.keylesspalace.tusky.network.FilterModel -import com.keylesspalace.tusky.network.MastodonApi import com.keylesspalace.tusky.settings.PrefKeys import com.keylesspalace.tusky.usecase.TimelineCases import com.keylesspalace.tusky.viewdata.StatusViewData @@ -41,7 +40,6 @@ import kotlinx.coroutines.launch abstract class TimelineViewModel( protected val timelineCases: TimelineCases, - private val api: MastodonApi, private val eventHub: EventHub, protected val accountManager: AccountManager, private val sharedPreferences: SharedPreferences, diff --git a/app/src/main/java/com/keylesspalace/tusky/components/trending/TrendingTagViewHolder.kt b/app/src/main/java/com/keylesspalace/tusky/components/trending/TrendingTagViewHolder.kt index ac1e8c72d..36a65f4fe 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/trending/TrendingTagViewHolder.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/trending/TrendingTagViewHolder.kt @@ -20,13 +20,16 @@ import com.keylesspalace.tusky.R import com.keylesspalace.tusky.databinding.ItemTrendingCellBinding import com.keylesspalace.tusky.util.formatNumber import com.keylesspalace.tusky.viewdata.TrendingViewData +import java.text.NumberFormat class TrendingTagViewHolder( private val binding: ItemTrendingCellBinding ) : RecyclerView.ViewHolder(binding.root) { + private val numberFormat: NumberFormat = NumberFormat.getNumberInstance() + fun setup(tagViewData: TrendingViewData.Tag, onViewTag: (String) -> Unit) { - binding.tag.text = binding.root.context.getString(R.string.title_tag, tagViewData.name) + binding.tag.text = binding.root.context.getString(R.string.hashtag_format, tagViewData.name) binding.graph.maxTrendingValue = tagViewData.maxTrendingValue binding.graph.primaryLineData = tagViewData.usage @@ -37,8 +40,8 @@ class TrendingTagViewHolder( val totalAccounts = tagViewData.accounts.sum() binding.totalAccounts.text = formatNumber(totalAccounts, 1000) - binding.currentUsage.text = tagViewData.usage.last().toString() - binding.currentAccounts.text = tagViewData.usage.last().toString() + binding.currentUsage.text = numberFormat.format(tagViewData.usage.last()) + binding.currentAccounts.text = numberFormat.format(tagViewData.usage.last()) itemView.setOnClickListener { onViewTag(tagViewData.name) diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewImageFragment.kt b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewImageFragment.kt index 9a62e1cc7..c3a176cb0 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewImageFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewImageFragment.kt @@ -37,7 +37,6 @@ import com.keylesspalace.tusky.R import com.keylesspalace.tusky.databinding.FragmentViewImageBinding import com.keylesspalace.tusky.entity.Attachment import com.keylesspalace.tusky.util.getParcelableCompat -import com.keylesspalace.tusky.util.hide import com.keylesspalace.tusky.util.viewBinding import com.keylesspalace.tusky.util.visible import com.ortiz.touchview.OnTouchCoordinatesListener diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt index d9ae9ff45..d450d0f28 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt @@ -53,7 +53,6 @@ import com.keylesspalace.tusky.ViewMediaActivity import com.keylesspalace.tusky.databinding.FragmentViewVideoBinding import com.keylesspalace.tusky.entity.Attachment import com.keylesspalace.tusky.util.getParcelableCompat -import com.keylesspalace.tusky.util.hide import com.keylesspalace.tusky.util.unsafeLazy import com.keylesspalace.tusky.util.viewBinding import com.keylesspalace.tusky.util.visible diff --git a/app/src/main/java/com/keylesspalace/tusky/network/FilterModel.kt b/app/src/main/java/com/keylesspalace/tusky/network/FilterModel.kt index c45070852..355212589 100644 --- a/app/src/main/java/com/keylesspalace/tusky/network/FilterModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/network/FilterModel.kt @@ -104,7 +104,7 @@ class FilterModel @Inject constructor( val phrase = filter.phrase val quotedPhrase = Pattern.quote(phrase) return if (filter.wholeWord && ALPHANUMERIC.matcher(phrase).matches()) { - String.format("(^|\\W)%s($|\\W)", quotedPhrase) + "(^|\\W)$quotedPhrase($|\\W)" } else { quotedPhrase } diff --git a/app/src/main/java/com/keylesspalace/tusky/util/NumberUtils.kt b/app/src/main/java/com/keylesspalace/tusky/util/NumberUtils.kt index 29a2ec67c..83bc1ab57 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/NumberUtils.kt +++ b/app/src/main/java/com/keylesspalace/tusky/util/NumberUtils.kt @@ -3,6 +3,7 @@ package com.keylesspalace.tusky.util import java.text.NumberFormat +import java.util.Locale import kotlin.math.abs import kotlin.math.ln import kotlin.math.pow @@ -24,5 +25,10 @@ fun formatNumber(num: Long, min: Int = 100000): String { val exp = (ln(absNum.toDouble()) / ln_1k).toInt() // Suffixes here are locale-agnostic - return String.format("%.1f%c", num / 1000.0.pow(exp.toDouble()), "KMGTPE"[exp - 1]) + return String.format( + Locale.getDefault(), + "%.1f%c", + num / 1000.0.pow(exp.toDouble()), + "KMGTPE"[exp - 1] + ) } diff --git a/app/src/main/java/com/keylesspalace/tusky/util/StatusViewHelper.kt b/app/src/main/java/com/keylesspalace/tusky/util/StatusViewHelper.kt index ee575ce66..c9f213de2 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/StatusViewHelper.kt +++ b/app/src/main/java/com/keylesspalace/tusky/util/StatusViewHelper.kt @@ -237,7 +237,7 @@ class StatusViewHelper(private val itemView: View) { var labelText = getLabelTypeText(context, attachments[0].type) if (sensitive) { val sensitiveText = context.getString(R.string.post_sensitive_media_title) - labelText += String.format(" (%s)", sensitiveText) + labelText += " ($sensitiveText)" } mediaLabel.text = labelText diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 2ab00f98e..9273718d2 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -501,7 +501,7 @@ Beszélgetés törlése Könyvjelző törlése Jóváhagyás megjelenítése kedvencnek jelölés előtt - %1$d szerkesztette a bejegyzését + %1$s szerkesztette a bejegyzését szerkesztették a bejegyzést, mellyel dolgod volt %1$s regisztrált valaki regisztrált @@ -710,4 +710,4 @@ Önmegtolások megjelenítése Valaki a saját bejegyzését tolja meg Értesítésszűrő megjelenítése - \ No newline at end of file + diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index f4272d17f..3484db0ca 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -8,7 +8,7 @@ \@ # - #%1$s + #%1$s :%1$s: %1$s *