Skip to content

Commit

Permalink
fix new warnings, regenerate lint-baseline.xml (#4684)
Browse files Browse the repository at this point in the history
Mostly "StringFormatTrivial" which I think is new, but it makes totally
sense to fix
  • Loading branch information
connyduck committed Sep 16, 2024
1 parent a981541 commit c887c82
Show file tree
Hide file tree
Showing 24 changed files with 68 additions and 124 deletions.
101 changes: 34 additions & 67 deletions app/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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
id="GestureBackNavigation"
Expand All @@ -8,7 +8,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt"
line="1314"
line="1288"
column="28"/>
</issue>

Expand All @@ -19,7 +19,7 @@
errorLine2=" ~~~~~~~~~~~">
<location
file="src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java"
line="104"
line="101"
column="32"/>
</issue>

Expand Down Expand Up @@ -53,14 +53,14 @@

<issue
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
file="src/main/res/layout/exo_player_control_view.xml"/>
</issue>

<issue
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;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -71,7 +71,7 @@

<issue
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;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -82,7 +82,7 @@

<issue
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; />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -93,7 +93,7 @@

<issue
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; />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -104,7 +104,7 @@

<issue
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;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -115,7 +115,7 @@

<issue
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;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -126,7 +126,7 @@

<issue
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;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -137,7 +137,7 @@

<issue
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;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -148,7 +148,7 @@

<issue
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;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -159,7 +159,7 @@

<issue
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;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -170,7 +170,7 @@

<issue
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;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -181,7 +181,7 @@

<issue
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;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -192,7 +192,7 @@

<issue
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;/>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -203,7 +203,7 @@

<issue
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;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
Expand All @@ -215,22 +215,22 @@
<issue
id="PluralsCandidate"
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>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
errorLine1=" &lt;string name=&quot;notification_summary_report_format&quot;>%1$s · %2$d posts attached&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/strings.xml"
line="109"
line="111"
column="5"/>
</issue>

<issue
id="PluralsCandidate"
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>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
errorLine1=" &lt;string name=&quot;pref_title_http_proxy_port_message&quot;>Port should be between %1$d and %2$d&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/strings.xml"
line="331"
line="336"
column="5"/>
</issue>

Expand All @@ -241,7 +241,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/strings.xml"
line="389"
line="398"
column="5"/>
</issue>

Expand All @@ -252,7 +252,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/strings.xml"
line="570"
line="579"
column="5"/>
</issue>

Expand All @@ -263,7 +263,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/strings.xml"
line="790"
line="801"
column="5"/>
</issue>

Expand Down Expand Up @@ -384,7 +384,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt"
line="532"
line="478"
column="9"/>
</issue>

Expand Down Expand Up @@ -428,7 +428,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/keylesspalace/tusky/components/announcements/AnnouncementAdapter.kt"
line="157"
line="175"
column="9"/>
</issue>

Expand Down Expand Up @@ -545,11 +545,11 @@
<issue
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"
errorLine1=" ShortcutManagerCompat.addDynamicShortcuts(context, listOf(shortcutInfo))"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
errorLine1=" ShortcutManagerCompat.setDynamicShortcuts(context, shortcuts)"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/keylesspalace/tusky/util/ShareShortcutHelper.kt"
line="96"
line="101"
column="13"/>
</issue>

Expand Down Expand Up @@ -725,7 +725,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/layout/activity_edit_profile.xml"
line="129"
line="128"
column="21"/>
</issue>

Expand Down Expand Up @@ -758,7 +758,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/layout/item_report_notification.xml"
line="23"
line="22"
column="9"/>
</issue>

Expand Down Expand Up @@ -850,37 +850,4 @@
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="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>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/keylesspalace/tusky/TabData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ fun createTabDataFromId(id: String, arguments: List<String> = emptyList()): TabD
arguments = arguments,
title = { context ->
arguments.joinToString(separator = " ") {
context.getString(R.string.title_tag, it)
context.getString(R.string.hashtag_format, it)
}
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

Expand Down
Loading

0 comments on commit c887c82

Please sign in to comment.