Skip to content

Commit

Permalink
For mozilla-mobile#20634: remove some lint issues from baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
RotBolt committed Sep 17, 2021
1 parent 6ac10d5 commit fd00266
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 240 deletions.
286 changes: 55 additions & 231 deletions app/lint-baseline.xml

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
<uses-permission android:name="android.permission.WAKE_LOCK"/>

<!-- Allows for storing and retrieving screenshots -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28"
tools:ignore="ScopedStorage"
/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<!-- Allows changing locales -->
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28"
tools:ignore="ScopedStorage"
/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -161,6 +163,7 @@ class MasterPasswordTipProvider(
}
}

@SuppressLint("InflateParams")
private fun showFailureDialog() {
val dialogView =
LayoutInflater.from(context).inflate(R.layout.mp_migration_done_dialog, null)
Expand Down Expand Up @@ -221,6 +224,7 @@ class MasterPasswordTipProvider(
}
}

@SuppressLint("InflateParams")
private fun showSuccessDialog() {
dismissMPTip()

Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,7 @@ class HomeFragment : Fragment() {
}
}

@SuppressLint("InflateParams")
private fun recommendPrivateBrowsingShortcut() {
context?.let { context ->
val layout = LayoutInflater.from(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -316,6 +317,7 @@ class DefaultSessionControlController(
)
}

@SuppressLint("InflateParams")
override fun handleRenameTopSiteClicked(topSite: TopSite) {
activity.let {
val customLayout =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -17,15 +17,15 @@ 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
}

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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -254,6 +256,7 @@ class AddSearchEngineFragment :
customSearchEngine.customSearchEnginesLearnMore.isEnabled = isEnabled
}

@SuppressLint("InflateParams")
private fun makeButtonFromSearchEngine(
engine: SearchEngine,
layoutInflater: LayoutInflater,
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/org/mozilla/fenix/utils/OnWifiChanged.java
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
android:layout_width="match_parent"
android:layout_height="56dp" />

<fragment
<!--The navGraph is set dynamically in NavGraphProvider -->
<androidx.fragment.app.FragmentContainerView
android:id="@+id/container"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/mozac_browser_menu_item_switch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,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/. -->
<Switch xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.switchmaterial.SwitchMaterial xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Mozac.Browser.Menu.Item.Text"
android:layout_width="match_parent"
android:layout_height="@dimen/mozac_browser_menu_item_container_layout_height"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/preference_default_browser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- 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/. -->

<Switch xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.switchmaterial.SwitchMaterial xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/switch_widget"
android:layout_width="wrap_content"
android:layout_height="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ class PerformanceInflaterTest {
private val layoutsNotToTest = setOf(
"fragment_browser",
"fragment_add_on_internal_settings",
"activity_privacy_content_display"
"activity_privacy_content_display",
/**
* activity_home.xml contains FragmentContainerView which needs to be
* put inside FragmentActivity in order to get inflated
*/
"activity_home"
)

@Before
Expand Down

0 comments on commit fd00266

Please sign in to comment.