From fd00266ed5c72fcceac18c90f5c87608089b9e1e Mon Sep 17 00:00:00 2001 From: Rohan Maity Date: Fri, 10 Sep 2021 23:08:20 +0530 Subject: [PATCH] For #20634: remove some lint issues from baseline --- app/lint-baseline.xml | 286 ++++-------------- app/src/debug/AndroidManifest.xml | 6 +- app/src/main/AndroidManifest.xml | 6 +- .../org/mozilla/fenix/components/FxaServer.kt | 1 + .../providers/MasterPasswordTipProvider.kt | 4 + .../org/mozilla/fenix/home/HomeFragment.kt | 1 + .../SessionControlController.kt | 2 + .../settings/DefaultBrowserPreference.kt | 6 +- .../fenix/settings/SettingsFragment.kt | 1 + .../search/AddSearchEngineFragment.kt | 3 + .../mozilla/fenix/utils/OnWifiChanged.java | 4 + app/src/main/res/layout/activity_home.xml | 3 +- .../layout/mozac_browser_menu_item_switch.xml | 2 +- .../res/layout/preference_default_browser.xml | 2 +- .../fenix/perf/PerformanceInflaterTest.kt | 7 +- 15 files changed, 94 insertions(+), 240 deletions(-) diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml index fd364452b673..e16a5ce59fba 100644 --- a/app/lint-baseline.xml +++ b/app/lint-baseline.xml @@ -8,28 +8,6 @@ file="app"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -6054,7 +5878,7 @@ errorLine2=" ~~~~~~~~~~~~~~"> @@ -6065,7 +5889,7 @@ errorLine2=" ~~~~~~~~"> @@ -6076,7 +5900,7 @@ errorLine2=" ~~~~~~~"> @@ -6087,7 +5911,7 @@ errorLine2=" ~~~~~~~~"> @@ -7491,7 +7315,7 @@ @@ -9772,7 +9596,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -9783,7 +9607,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -9794,7 +9618,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -9816,7 +9640,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -9827,7 +9651,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -9836,28 +9660,6 @@ message="The resource `R.string.preferences_passwords_saved_logins_enter_pin` appears to be unused" errorLine1=" <string name="preferences_passwords_saved_logins_enter_pin">Re-enter your PIN</string>" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> - - - - - - - - + message="The resource `R.string.preferences_passwords_saved_logins_enter_pin_description` appears to be unused" + errorLine1=" <string name="preferences_passwords_saved_logins_enter_pin_description">Unlock to view your saved logins</string>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + message="The resource `R.string.logins_insecure_connection_warning` appears to be unused" + errorLine1=" <string name="logins_insecure_connection_warning">This connection is not secure. Logins entered here could be compromised.</string>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + message="The resource `R.string.logins_insecure_connection_warning_learn_more` appears to be unused" + errorLine1=" <string name="logins_insecure_connection_warning_learn_more">Learn more</string>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + message="The resource `R.string.logins_doorhanger_save` appears to be unused" + errorLine1=" <string name="logins_doorhanger_save">Do you want %s to save this login?</string>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + + + + + + + + @@ -9981,7 +9805,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -9992,7 +9816,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -10003,7 +9827,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -10014,7 +9838,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -10025,7 +9849,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -10036,7 +9860,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -10047,7 +9871,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~"> @@ -10218,7 +10042,7 @@ + message="The following images appear both as density independent `.xml` files and as bitmap files: /home/rotbolt/StudioProjects/fenix/app/src/main/res/drawable-hdpi/ic_logo_wordmark_normal.png, /home/rotbolt/StudioProjects/fenix/app/src/main/res/drawable-night/ic_logo_wordmark_normal.xml"> - + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ca1a4216d57c..fc9cbd06fd72 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,7 +6,11 @@ - + diff --git a/app/src/main/java/org/mozilla/fenix/components/FxaServer.kt b/app/src/main/java/org/mozilla/fenix/components/FxaServer.kt index b6f66cc7b47d..3347dc2a7e58 100644 --- a/app/src/main/java/org/mozilla/fenix/components/FxaServer.kt +++ b/app/src/main/java/org/mozilla/fenix/components/FxaServer.kt @@ -1,6 +1,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + package org.mozilla.fenix.components import android.content.Context diff --git a/app/src/main/java/org/mozilla/fenix/components/tips/providers/MasterPasswordTipProvider.kt b/app/src/main/java/org/mozilla/fenix/components/tips/providers/MasterPasswordTipProvider.kt index 95e582962c73..baf13f2b89df 100644 --- a/app/src/main/java/org/mozilla/fenix/components/tips/providers/MasterPasswordTipProvider.kt +++ b/app/src/main/java/org/mozilla/fenix/components/tips/providers/MasterPasswordTipProvider.kt @@ -4,6 +4,7 @@ package org.mozilla.fenix.components.tips.providers +import android.annotation.SuppressLint import android.content.Context import android.text.Editable import android.text.TextWatcher @@ -73,6 +74,7 @@ class MasterPasswordTipProvider( titleDrawable = AppCompatResources.getDrawable(context, R.drawable.ic_login) ) + @SuppressLint("InflateParams") private fun showMasterPasswordMigration() { val dialogView = LayoutInflater.from(context).inflate(R.layout.mp_migration_dialog, null) @@ -161,6 +163,7 @@ class MasterPasswordTipProvider( } } + @SuppressLint("InflateParams") private fun showFailureDialog() { val dialogView = LayoutInflater.from(context).inflate(R.layout.mp_migration_done_dialog, null) @@ -221,6 +224,7 @@ class MasterPasswordTipProvider( } } + @SuppressLint("InflateParams") private fun showSuccessDialog() { dismissMPTip() diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index 5081e27a8cdc..18d1a28d4ea0 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -751,6 +751,7 @@ class HomeFragment : Fragment() { } } + @SuppressLint("InflateParams") private fun recommendPrivateBrowsingShortcut() { context?.let { context -> val layout = LayoutInflater.from(context) diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt index 44e4e90284a4..1b2269165f16 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt @@ -4,6 +4,7 @@ package org.mozilla.fenix.home.sessioncontrol +import android.annotation.SuppressLint import android.view.LayoutInflater import android.widget.EditText import androidx.annotation.VisibleForTesting @@ -316,6 +317,7 @@ class DefaultSessionControlController( ) } + @SuppressLint("InflateParams") override fun handleRenameTopSiteClicked(topSite: TopSite) { activity.let { val customLayout = diff --git a/app/src/main/java/org/mozilla/fenix/settings/DefaultBrowserPreference.kt b/app/src/main/java/org/mozilla/fenix/settings/DefaultBrowserPreference.kt index c2ef16ebb98f..9f54cd78c720 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/DefaultBrowserPreference.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/DefaultBrowserPreference.kt @@ -6,9 +6,9 @@ package org.mozilla.fenix.settings import android.content.Context import android.util.AttributeSet -import android.widget.Switch import androidx.preference.Preference import androidx.preference.PreferenceViewHolder +import com.google.android.material.switchmaterial.SwitchMaterial import org.mozilla.fenix.R import org.mozilla.fenix.utils.BrowsersCache @@ -17,7 +17,7 @@ class DefaultBrowserPreference @JvmOverloads constructor( attrs: AttributeSet? = null ) : Preference(context, attrs) { - private var switchView: Switch? = null + private var switchView: SwitchMaterial? = null init { widgetLayoutResource = R.layout.preference_default_browser @@ -25,7 +25,7 @@ class DefaultBrowserPreference @JvmOverloads constructor( override fun onBindViewHolder(holder: PreferenceViewHolder) { super.onBindViewHolder(holder) - switchView = holder.findViewById(R.id.switch_widget) as Switch + switchView = holder.findViewById(R.id.switch_widget) as SwitchMaterial updateSwitch() } diff --git a/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt b/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt index 659549a15db5..545b4c3f387d 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt @@ -229,6 +229,7 @@ class SettingsFragment : PreferenceFragmentCompat() { updateMakeDefaultBrowserPreference() } + @SuppressLint("InflateParams") @Suppress("ComplexMethod", "LongMethod") override fun onPreferenceTreeClick(preference: Preference): Boolean { // Hide the scrollbar so the animation looks smoother diff --git a/app/src/main/java/org/mozilla/fenix/settings/search/AddSearchEngineFragment.kt b/app/src/main/java/org/mozilla/fenix/settings/search/AddSearchEngineFragment.kt index e890b8fe0f25..8a1d21cb317a 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/search/AddSearchEngineFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/search/AddSearchEngineFragment.kt @@ -4,6 +4,7 @@ package org.mozilla.fenix.settings.search +import android.annotation.SuppressLint import android.content.res.Resources import android.graphics.drawable.BitmapDrawable import android.os.Bundle @@ -238,6 +239,7 @@ class AddSearchEngineFragment : toggleCustomForm(selectedIndex == -1) } + @SuppressLint("InflateParams") private fun makeCustomButton(layoutInflater: LayoutInflater): CustomSearchEngineRadioButtonBinding { val wrapper = layoutInflater .inflate(R.layout.custom_search_engine_radio_button, null) as ConstraintLayout @@ -254,6 +256,7 @@ class AddSearchEngineFragment : customSearchEngine.customSearchEnginesLearnMore.isEnabled = isEnabled } + @SuppressLint("InflateParams") private fun makeButtonFromSearchEngine( engine: SearchEngine, layoutInflater: LayoutInflater, diff --git a/app/src/main/java/org/mozilla/fenix/utils/OnWifiChanged.java b/app/src/main/java/org/mozilla/fenix/utils/OnWifiChanged.java index 208b37f69f14..4c8a384f25f4 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/OnWifiChanged.java +++ b/app/src/main/java/org/mozilla/fenix/utils/OnWifiChanged.java @@ -1,3 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + package org.mozilla.fenix.utils; /** diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml index 5dc4bdefa973..aeaccc99d9ab 100644 --- a/app/src/main/res/layout/activity_home.xml +++ b/app/src/main/res/layout/activity_home.xml @@ -17,7 +17,8 @@ android:layout_width="match_parent" android:layout_height="56dp" /> - + - -