fix new warnings, regenerate lint-baseline.xml (#4684)

Mostly "StringFormatTrivial" which I think is new, but it makes totally
sense to fix
This commit is contained in:
Konrad Pozniak 2024-09-16 20:57:27 +02:00 committed by GitHub
parent a98154101b
commit c887c8213c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 68 additions and 124 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.3.2" type="baseline" client="gradle" dependencies="false" name="AGP (8.3.2)" variant="all" version="8.3.2"> <issues format="6" by="lint 8.6.0" type="baseline" client="gradle" dependencies="false" name="AGP (8.6.0)" variant="all" version="8.6.0">
<issue <issue
id="GestureBackNavigation" id="GestureBackNavigation"
@ -8,7 +8,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt" file="src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt"
line="1314" line="1288"
column="28"/> column="28"/>
</issue> </issue>
@ -19,7 +19,7 @@
errorLine2=" ~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~">
<location <location
file="src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java" file="src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java"
line="104" line="101"
column="32"/> column="32"/>
</issue> </issue>
@ -53,14 +53,14 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="Overriding `@layout/exo_player_control_view` which is marked as private in androidx.media3:media3-ui:1.3.1. If deliberate, use tools:override=&quot;true&quot;, otherwise pick a different name."> 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=&quot;true&quot;, otherwise pick a different name.">
<location <location
file="src/main/res/layout/exo_player_control_view.xml"/> file="src/main/res/layout/exo_player_control_view.xml"/>
</issue> </issue>
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@color/exo_bottom_bar_background` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@color/exo_bottom_bar_background` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:background=&quot;@color/exo_bottom_bar_background&quot;" errorLine1=" android:background=&quot;@color/exo_bottom_bar_background&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -71,7 +71,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@dimen/exo_styled_controls_padding` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@dimen/exo_styled_controls_padding` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:padding=&quot;@dimen/exo_styled_controls_padding&quot;" errorLine1=" android:padding=&quot;@dimen/exo_styled_controls_padding&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -82,7 +82,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@layout/exo_player_control_rewind_button` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@layout/exo_player_control_rewind_button` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" &lt;include layout=&quot;@layout/exo_player_control_rewind_button&quot; />" errorLine1=" &lt;include layout=&quot;@layout/exo_player_control_rewind_button&quot; />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -93,7 +93,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@layout/exo_player_control_ffwd_button` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@layout/exo_player_control_ffwd_button` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" &lt;include layout=&quot;@layout/exo_player_control_ffwd_button&quot; />" errorLine1=" &lt;include layout=&quot;@layout/exo_player_control_ffwd_button&quot; />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -104,7 +104,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@dimen/exo_styled_bottom_bar_height` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@dimen/exo_styled_bottom_bar_height` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:layout_height=&quot;@dimen/exo_styled_bottom_bar_height&quot;" errorLine1=" android:layout_height=&quot;@dimen/exo_styled_bottom_bar_height&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -115,7 +115,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@dimen/exo_styled_bottom_bar_margin_top` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@dimen/exo_styled_bottom_bar_margin_top` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:layout_marginTop=&quot;@dimen/exo_styled_bottom_bar_margin_top&quot;" errorLine1=" android:layout_marginTop=&quot;@dimen/exo_styled_bottom_bar_margin_top&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -126,7 +126,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@color/exo_bottom_bar_background` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@color/exo_bottom_bar_background` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:background=&quot;@color/exo_bottom_bar_background&quot;" errorLine1=" android:background=&quot;@color/exo_bottom_bar_background&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -137,7 +137,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@dimen/exo_styled_bottom_bar_time_padding` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@dimen/exo_styled_bottom_bar_time_padding` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:paddingStart=&quot;@dimen/exo_styled_bottom_bar_time_padding&quot;" errorLine1=" android:paddingStart=&quot;@dimen/exo_styled_bottom_bar_time_padding&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -148,7 +148,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@dimen/exo_styled_bottom_bar_time_padding` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@dimen/exo_styled_bottom_bar_time_padding` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:paddingEnd=&quot;@dimen/exo_styled_bottom_bar_time_padding&quot;" errorLine1=" android:paddingEnd=&quot;@dimen/exo_styled_bottom_bar_time_padding&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -159,7 +159,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@dimen/exo_styled_bottom_bar_time_padding` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@dimen/exo_styled_bottom_bar_time_padding` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:paddingLeft=&quot;@dimen/exo_styled_bottom_bar_time_padding&quot;" errorLine1=" android:paddingLeft=&quot;@dimen/exo_styled_bottom_bar_time_padding&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -170,7 +170,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@dimen/exo_styled_bottom_bar_time_padding` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@dimen/exo_styled_bottom_bar_time_padding` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:paddingRight=&quot;@dimen/exo_styled_bottom_bar_time_padding&quot;" errorLine1=" android:paddingRight=&quot;@dimen/exo_styled_bottom_bar_time_padding&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -181,7 +181,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@dimen/exo_styled_progress_layout_height` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@dimen/exo_styled_progress_layout_height` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:layout_height=&quot;@dimen/exo_styled_progress_layout_height&quot;" errorLine1=" android:layout_height=&quot;@dimen/exo_styled_progress_layout_height&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -192,7 +192,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@dimen/exo_styled_progress_margin_bottom` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@dimen/exo_styled_progress_margin_bottom` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:layout_marginBottom=&quot;@dimen/exo_styled_progress_margin_bottom&quot;/>" errorLine1=" android:layout_marginBottom=&quot;@dimen/exo_styled_progress_margin_bottom&quot;/>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -203,7 +203,7 @@
<issue <issue
id="PrivateResource" id="PrivateResource"
message="The resource `@dimen/exo_styled_minimal_controls_margin_bottom` is marked as private in androidx.media3:media3-ui:1.3.1" message="The resource `@dimen/exo_styled_minimal_controls_margin_bottom` is marked as private in androidx.media3:media3-ui:1.4.1"
errorLine1=" android:layout_marginBottom=&quot;@dimen/exo_styled_minimal_controls_margin_bottom&quot;" errorLine1=" android:layout_marginBottom=&quot;@dimen/exo_styled_minimal_controls_margin_bottom&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
@ -215,22 +215,22 @@
<issue <issue
id="PluralsCandidate" id="PluralsCandidate"
message="Formatting %d followed by words (&quot;posts&quot;): This should probably be a plural rather than a string" message="Formatting %d followed by words (&quot;posts&quot;): This should probably be a plural rather than a string"
errorLine1=" &lt;string name=&quot;notification_summary_report_format&quot;>%s · %d posts attached&lt;/string>" errorLine1=" &lt;string name=&quot;notification_summary_report_format&quot;>%1$s · %2$d posts attached&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="src/main/res/values/strings.xml" file="src/main/res/values/strings.xml"
line="109" line="111"
column="5"/> column="5"/>
</issue> </issue>
<issue <issue
id="PluralsCandidate" id="PluralsCandidate"
message="Formatting %d followed by words (&quot;and&quot;): This should probably be a plural rather than a string" message="Formatting %d followed by words (&quot;and&quot;): This should probably be a plural rather than a string"
errorLine1=" &lt;string name=&quot;pref_title_http_proxy_port_message&quot;>Port should be between %d and %d&lt;/string>" errorLine1=" &lt;string name=&quot;pref_title_http_proxy_port_message&quot;>Port should be between %1$d and %2$d&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="src/main/res/values/strings.xml" file="src/main/res/values/strings.xml"
line="331" line="336"
column="5"/> column="5"/>
</issue> </issue>
@ -241,7 +241,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="src/main/res/values/strings.xml" file="src/main/res/values/strings.xml"
line="389" line="398"
column="5"/> column="5"/>
</issue> </issue>
@ -252,7 +252,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="src/main/res/values/strings.xml" file="src/main/res/values/strings.xml"
line="570" line="579"
column="5"/> column="5"/>
</issue> </issue>
@ -263,7 +263,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="src/main/res/values/strings.xml" file="src/main/res/values/strings.xml"
line="790" line="801"
column="5"/> column="5"/>
</issue> </issue>
@ -384,7 +384,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt" file="src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt"
line="532" line="478"
column="9"/> column="9"/>
</issue> </issue>
@ -428,7 +428,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="src/main/java/com/keylesspalace/tusky/components/announcements/AnnouncementAdapter.kt" file="src/main/java/com/keylesspalace/tusky/components/announcements/AnnouncementAdapter.kt"
line="157" line="175"
column="9"/> column="9"/>
</issue> </issue>
@ -545,11 +545,11 @@
<issue <issue
id="ReportShortcutUsage" id="ReportShortcutUsage"
message="Calling this method indicates use of dynamic shortcuts, but there are no calls to methods that track shortcut usage, such as `pushDynamicShortcut` or `reportShortcutUsed`. Calling these methods is recommended, as they track shortcut usage and allow launchers to adjust which shortcuts appear based on activation history. Please see https://developer.android.com/develop/ui/views/launch/shortcuts/managing-shortcuts#track-usage" message="Calling this method indicates use of dynamic shortcuts, but there are no calls to methods that track shortcut usage, such as `pushDynamicShortcut` or `reportShortcutUsed`. Calling these methods is recommended, as they track shortcut usage and allow launchers to adjust which shortcuts appear based on activation history. Please see https://developer.android.com/develop/ui/views/launch/shortcuts/managing-shortcuts#track-usage"
errorLine1=" ShortcutManagerCompat.addDynamicShortcuts(context, listOf(shortcutInfo))" errorLine1=" ShortcutManagerCompat.setDynamicShortcuts(context, shortcuts)"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location <location
file="src/main/java/com/keylesspalace/tusky/util/ShareShortcutHelper.kt" file="src/main/java/com/keylesspalace/tusky/util/ShareShortcutHelper.kt"
line="96" line="101"
column="13"/> column="13"/>
</issue> </issue>
@ -725,7 +725,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location <location
file="src/main/res/layout/activity_edit_profile.xml" file="src/main/res/layout/activity_edit_profile.xml"
line="129" line="128"
column="21"/> column="21"/>
</issue> </issue>
@ -758,7 +758,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location <location
file="src/main/res/layout/item_report_notification.xml" file="src/main/res/layout/item_report_notification.xml"
line="23" line="22"
column="9"/> column="9"/>
</issue> </issue>
@ -850,37 +850,4 @@
column="9"/> column="9"/>
</issue> </issue>
<issue
id="RtlHardcoded"
message="Consider replacing `android:layout_marginLeft` with `android:layout_marginStart=&quot;8dp&quot;` to better support right-to-left layouts"
errorLine1=" android:layout_marginLeft=&quot;8dp&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/layout/item_list.xml"
line="37"
column="9"/>
</issue>
<issue
id="RtlHardcoded"
message="Consider replacing `android:layout_marginLeft` with `android:layout_marginStart=&quot;8dp&quot;` to better support right-to-left layouts"
errorLine1=" android:layout_marginLeft=&quot;8dp&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/layout/item_list.xml"
line="48"
column="9"/>
</issue>
<issue
id="RtlHardcoded"
message="Consider replacing `android:layout_marginLeft` with `android:layout_marginStart=&quot;8dp&quot;` to better support right-to-left layouts"
errorLine1=" android:layout_marginLeft=&quot;8dp&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/layout/item_list.xml"
line="59"
column="9"/>
</issue>
</issues> </issues>

View File

@ -31,7 +31,6 @@ import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;

View File

@ -75,7 +75,7 @@ class StatusListActivity : BottomSheetActivity() {
val title = when (kind) { val title = when (kind) {
Kind.FAVOURITES -> getString(R.string.title_favourites) Kind.FAVOURITES -> getString(R.string.title_favourites)
Kind.BOOKMARKS -> getString(R.string.title_bookmarks) 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) Kind.PUBLIC_TRENDING_STATUSES -> getString(R.string.title_public_trending_statuses)
else -> intent.getStringExtra(EXTRA_LIST_TITLE) else -> intent.getStringExtra(EXTRA_LIST_TITLE)
} }

View File

@ -118,7 +118,7 @@ fun createTabDataFromId(id: String, arguments: List<String> = emptyList()): TabD
arguments = arguments, arguments = arguments,
title = { context -> title = { context ->
arguments.joinToString(separator = " ") { arguments.joinToString(separator = " ") {
context.getString(R.string.title_tag, it) context.getString(R.string.hashtag_format, it)
} }
} }
) )

View File

@ -18,7 +18,6 @@ import androidx.recyclerview.widget.RecyclerView
import com.keylesspalace.tusky.databinding.ItemStatusPlaceholderBinding import com.keylesspalace.tusky.databinding.ItemStatusPlaceholderBinding
import com.keylesspalace.tusky.interfaces.StatusActionListener import com.keylesspalace.tusky.interfaces.StatusActionListener
import com.keylesspalace.tusky.util.hide import com.keylesspalace.tusky.util.hide
import com.keylesspalace.tusky.util.show
import com.keylesspalace.tusky.util.visible import com.keylesspalace.tusky.util.visible
/** /**

View File

@ -57,9 +57,9 @@ class ComposeAutoCompleteAdapter(
override fun convertResultToString(resultValue: Any): CharSequence { override fun convertResultToString(resultValue: Any): CharSequence {
return when (resultValue) { return when (resultValue) {
is AutocompleteResult.AccountResult -> formatUsername(resultValue) is AutocompleteResult.AccountResult -> "@${resultValue.account.username}"
is AutocompleteResult.HashtagResult -> formatHashtag(resultValue) is AutocompleteResult.HashtagResult -> "#${resultValue.hashtag}"
is AutocompleteResult.EmojiResult -> formatEmoji(resultValue) is AutocompleteResult.EmojiResult -> ":${resultValue.emoji.shortcode}:"
else -> "" else -> ""
} }
} }
@ -122,7 +122,7 @@ class ComposeAutoCompleteAdapter(
} }
is ItemAutocompleteHashtagBinding -> { is ItemAutocompleteHashtagBinding -> {
val result = getItem(position) as AutocompleteResult.HashtagResult 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 -> { is ItemAutocompleteEmojiBinding -> {
val emojiResult = getItem(position) as AutocompleteResult.EmojiResult val emojiResult = getItem(position) as AutocompleteResult.EmojiResult
@ -162,17 +162,5 @@ class ComposeAutoCompleteAdapter(
private const val ACCOUNT_VIEW_TYPE = 0 private const val ACCOUNT_VIEW_TYPE = 0
private const val HASHTAG_VIEW_TYPE = 1 private const val HASHTAG_VIEW_TYPE = 1
private const val EMOJI_VIEW_TYPE = 2 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)
}
} }
} }

View File

@ -265,12 +265,8 @@ class MediaUploader @Inject constructor(
} }
val map = MimeTypeMap.getSingleton() val map = MimeTypeMap.getSingleton()
val fileExtension = map.getExtensionFromMimeType(mimeType) val fileExtension = map.getExtensionFromMimeType(mimeType)
val filename = "%s_%d_%s.%s".format( val filename =
context.getString(R.string.app_name), "${context.getString(R.string.app_name)}_${System.currentTimeMillis()}_${randomAlphanumericString(10)}.$fileExtension"
System.currentTimeMillis(),
randomAlphanumericString(10),
fileExtension
)
if (mimeType == null) mimeType = "multipart/form-data" if (mimeType == null) mimeType = "multipart/form-data"

View File

@ -14,6 +14,7 @@
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
package com.keylesspalace.tusky.components.compose.view package com.keylesspalace.tusky.components.compose.view
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.LayoutInflater import android.view.LayoutInflater
@ -80,11 +81,8 @@ class ComposeScheduleView
} }
val scheduled = scheduleDateTimeUtc!!.time val scheduled = scheduleDateTimeUtc!!.time
binding.scheduledDateTime.text = String.format( @SuppressLint("SetTextI18n")
"%s %s", binding.scheduledDateTime.text = "${dateFormat.format(scheduled)} ${timeFormat.format(scheduled)}"
dateFormat.format(scheduled),
timeFormat.format(scheduled)
)
verifyScheduledTime(scheduled) verifyScheduledTime(scheduled)
} }

View File

@ -178,7 +178,7 @@ class DraftHelper @Inject constructor(
map.getExtensionFromMimeType(mimeType) 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) val file = File(folder, filename)
if (scheme == "https") { if (scheme == "https") {

View File

@ -257,7 +257,7 @@ class LoginActivity : BaseActivity() {
getString(R.string.error_authorization_unknown) getString(R.string.error_authorization_unknown)
} else { } else {
// Use error returned by the server or fall back to the generic message // 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) } error.ifBlank { getString(R.string.error_authorization_denied) }
} }
} }

View File

@ -19,6 +19,7 @@ import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.paging.PagingDataAdapter import androidx.paging.PagingDataAdapter
import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.DiffUtil
import com.keylesspalace.tusky.R
import com.keylesspalace.tusky.databinding.ItemHashtagBinding import com.keylesspalace.tusky.databinding.ItemHashtagBinding
import com.keylesspalace.tusky.entity.HashTag import com.keylesspalace.tusky.entity.HashTag
import com.keylesspalace.tusky.interfaces.LinkListener import com.keylesspalace.tusky.interfaces.LinkListener
@ -37,7 +38,7 @@ class SearchHashtagsAdapter(private val linkListener: LinkListener) :
override fun onBindViewHolder(holder: BindingHolder<ItemHashtagBinding>, position: Int) { override fun onBindViewHolder(holder: BindingHolder<ItemHashtagBinding>, position: Int) {
getItem(position)?.let { (name) -> 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) } holder.binding.root.setOnClickListener { linkListener.onViewTag(name) }
} }
} }

View File

@ -162,7 +162,7 @@ class NotificationFetcher @Inject constructor(
* than the marker. * than the marker.
*/ */
private suspend fun fetchNewNotifications(account: AccountEntity): List<Notification> { private suspend fun fetchNewNotifications(account: AccountEntity): List<Notification> {
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: // Figure out where to read from. Choose the most recent notification ID from:
// //

View File

@ -604,13 +604,6 @@ class TimelineFragment :
viewModel.removeStatusWithId(status.id) 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 private var talkBackWasEnabled = false
override fun onPause() { override fun onPause() {

View File

@ -70,7 +70,6 @@ class CachedTimelineViewModel @Inject constructor(
private val db: AppDatabase private val db: AppDatabase
) : TimelineViewModel( ) : TimelineViewModel(
timelineCases, timelineCases,
api,
eventHub, eventHub,
accountManager, accountManager,
sharedPreferences, sharedPreferences,

View File

@ -72,7 +72,6 @@ class NetworkTimelineViewModel @Inject constructor(
filterModel: FilterModel filterModel: FilterModel
) : TimelineViewModel( ) : TimelineViewModel(
timelineCases, timelineCases,
api,
eventHub, eventHub,
accountManager, accountManager,
sharedPreferences, sharedPreferences,

View File

@ -31,7 +31,6 @@ import com.keylesspalace.tusky.db.AccountManager
import com.keylesspalace.tusky.entity.Filter import com.keylesspalace.tusky.entity.Filter
import com.keylesspalace.tusky.entity.Poll import com.keylesspalace.tusky.entity.Poll
import com.keylesspalace.tusky.network.FilterModel import com.keylesspalace.tusky.network.FilterModel
import com.keylesspalace.tusky.network.MastodonApi
import com.keylesspalace.tusky.settings.PrefKeys import com.keylesspalace.tusky.settings.PrefKeys
import com.keylesspalace.tusky.usecase.TimelineCases import com.keylesspalace.tusky.usecase.TimelineCases
import com.keylesspalace.tusky.viewdata.StatusViewData import com.keylesspalace.tusky.viewdata.StatusViewData
@ -41,7 +40,6 @@ import kotlinx.coroutines.launch
abstract class TimelineViewModel( abstract class TimelineViewModel(
protected val timelineCases: TimelineCases, protected val timelineCases: TimelineCases,
private val api: MastodonApi,
private val eventHub: EventHub, private val eventHub: EventHub,
protected val accountManager: AccountManager, protected val accountManager: AccountManager,
private val sharedPreferences: SharedPreferences, private val sharedPreferences: SharedPreferences,

View File

@ -20,13 +20,16 @@ import com.keylesspalace.tusky.R
import com.keylesspalace.tusky.databinding.ItemTrendingCellBinding import com.keylesspalace.tusky.databinding.ItemTrendingCellBinding
import com.keylesspalace.tusky.util.formatNumber import com.keylesspalace.tusky.util.formatNumber
import com.keylesspalace.tusky.viewdata.TrendingViewData import com.keylesspalace.tusky.viewdata.TrendingViewData
import java.text.NumberFormat
class TrendingTagViewHolder( class TrendingTagViewHolder(
private val binding: ItemTrendingCellBinding private val binding: ItemTrendingCellBinding
) : RecyclerView.ViewHolder(binding.root) { ) : RecyclerView.ViewHolder(binding.root) {
private val numberFormat: NumberFormat = NumberFormat.getNumberInstance()
fun setup(tagViewData: TrendingViewData.Tag, onViewTag: (String) -> Unit) { 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.maxTrendingValue = tagViewData.maxTrendingValue
binding.graph.primaryLineData = tagViewData.usage binding.graph.primaryLineData = tagViewData.usage
@ -37,8 +40,8 @@ class TrendingTagViewHolder(
val totalAccounts = tagViewData.accounts.sum() val totalAccounts = tagViewData.accounts.sum()
binding.totalAccounts.text = formatNumber(totalAccounts, 1000) binding.totalAccounts.text = formatNumber(totalAccounts, 1000)
binding.currentUsage.text = tagViewData.usage.last().toString() binding.currentUsage.text = numberFormat.format(tagViewData.usage.last())
binding.currentAccounts.text = tagViewData.usage.last().toString() binding.currentAccounts.text = numberFormat.format(tagViewData.usage.last())
itemView.setOnClickListener { itemView.setOnClickListener {
onViewTag(tagViewData.name) onViewTag(tagViewData.name)

View File

@ -37,7 +37,6 @@ import com.keylesspalace.tusky.R
import com.keylesspalace.tusky.databinding.FragmentViewImageBinding import com.keylesspalace.tusky.databinding.FragmentViewImageBinding
import com.keylesspalace.tusky.entity.Attachment import com.keylesspalace.tusky.entity.Attachment
import com.keylesspalace.tusky.util.getParcelableCompat import com.keylesspalace.tusky.util.getParcelableCompat
import com.keylesspalace.tusky.util.hide
import com.keylesspalace.tusky.util.viewBinding import com.keylesspalace.tusky.util.viewBinding
import com.keylesspalace.tusky.util.visible import com.keylesspalace.tusky.util.visible
import com.ortiz.touchview.OnTouchCoordinatesListener import com.ortiz.touchview.OnTouchCoordinatesListener

View File

@ -53,7 +53,6 @@ import com.keylesspalace.tusky.ViewMediaActivity
import com.keylesspalace.tusky.databinding.FragmentViewVideoBinding import com.keylesspalace.tusky.databinding.FragmentViewVideoBinding
import com.keylesspalace.tusky.entity.Attachment import com.keylesspalace.tusky.entity.Attachment
import com.keylesspalace.tusky.util.getParcelableCompat import com.keylesspalace.tusky.util.getParcelableCompat
import com.keylesspalace.tusky.util.hide
import com.keylesspalace.tusky.util.unsafeLazy import com.keylesspalace.tusky.util.unsafeLazy
import com.keylesspalace.tusky.util.viewBinding import com.keylesspalace.tusky.util.viewBinding
import com.keylesspalace.tusky.util.visible import com.keylesspalace.tusky.util.visible

View File

@ -104,7 +104,7 @@ class FilterModel @Inject constructor(
val phrase = filter.phrase val phrase = filter.phrase
val quotedPhrase = Pattern.quote(phrase) val quotedPhrase = Pattern.quote(phrase)
return if (filter.wholeWord && ALPHANUMERIC.matcher(phrase).matches()) { return if (filter.wholeWord && ALPHANUMERIC.matcher(phrase).matches()) {
String.format("(^|\\W)%s($|\\W)", quotedPhrase) "(^|\\W)$quotedPhrase($|\\W)"
} else { } else {
quotedPhrase quotedPhrase
} }

View File

@ -3,6 +3,7 @@
package com.keylesspalace.tusky.util package com.keylesspalace.tusky.util
import java.text.NumberFormat import java.text.NumberFormat
import java.util.Locale
import kotlin.math.abs import kotlin.math.abs
import kotlin.math.ln import kotlin.math.ln
import kotlin.math.pow import kotlin.math.pow
@ -24,5 +25,10 @@ fun formatNumber(num: Long, min: Int = 100000): String {
val exp = (ln(absNum.toDouble()) / ln_1k).toInt() val exp = (ln(absNum.toDouble()) / ln_1k).toInt()
// Suffixes here are locale-agnostic // 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]
)
} }

View File

@ -237,7 +237,7 @@ class StatusViewHelper(private val itemView: View) {
var labelText = getLabelTypeText(context, attachments[0].type) var labelText = getLabelTypeText(context, attachments[0].type)
if (sensitive) { if (sensitive) {
val sensitiveText = context.getString(R.string.post_sensitive_media_title) val sensitiveText = context.getString(R.string.post_sensitive_media_title)
labelText += String.format(" (%s)", sensitiveText) labelText += " ($sensitiveText)"
} }
mediaLabel.text = labelText mediaLabel.text = labelText

View File

@ -501,7 +501,7 @@
<string name="action_delete_conversation">Beszélgetés törlése</string> <string name="action_delete_conversation">Beszélgetés törlése</string>
<string name="action_unbookmark">Könyvjelző törlése</string> <string name="action_unbookmark">Könyvjelző törlése</string>
<string name="pref_title_confirm_favourites">Jóváhagyás megjelenítése kedvencnek jelölés előtt</string> <string name="pref_title_confirm_favourites">Jóváhagyás megjelenítése kedvencnek jelölés előtt</string>
<string name="notification_update_format">%1$d szerkesztette a bejegyzését</string> <string name="notification_update_format">%1$s szerkesztette a bejegyzését</string>
<string name="pref_title_notification_filter_updates">szerkesztették a bejegyzést, mellyel dolgod volt</string> <string name="pref_title_notification_filter_updates">szerkesztették a bejegyzést, mellyel dolgod volt</string>
<string name="notification_sign_up_format">%1$s regisztrált</string> <string name="notification_sign_up_format">%1$s regisztrált</string>
<string name="pref_title_notification_filter_sign_ups">valaki regisztrált</string> <string name="pref_title_notification_filter_sign_ups">valaki regisztrált</string>
@ -710,4 +710,4 @@
<string name="pref_title_show_self_boosts">Önmegtolások megjelenítése</string> <string name="pref_title_show_self_boosts">Önmegtolások megjelenítése</string>
<string name="pref_title_show_self_boosts_description">Valaki a saját bejegyzését tolja meg</string> <string name="pref_title_show_self_boosts_description">Valaki a saját bejegyzését tolja meg</string>
<string name="pref_title_show_notifications_filter">Értesítésszűrő megjelenítése</string> <string name="pref_title_show_notifications_filter">Értesítésszűrő megjelenítése</string>
</resources> </resources>

View File

@ -8,7 +8,7 @@
<string name="at_symbol" translatable="false">\@</string> <string name="at_symbol" translatable="false">\@</string>
<string name="hash_symbol" translatable="false">#</string> <string name="hash_symbol" translatable="false">#</string>
<string name="title_tag" translatable="false">#%1$s</string> <string name="hashtag_format" translatable="false">#%1$s</string>
<string name="emoji_shortcode_format" translatable="false">:%1$s:</string> <string name="emoji_shortcode_format" translatable="false">:%1$s:</string>
<string name="post_timestamp_with_edited_indicator" translatable="false">%1$s *</string> <string name="post_timestamp_with_edited_indicator" translatable="false">%1$s *</string>