From 759194a625b7ebc5f41145c2be7ac3e5226fc5f4 Mon Sep 17 00:00:00 2001 From: Gabriel Luong Date: Thu, 7 Oct 2021 13:50:49 -0400 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/21776 - Class member can have 'private' visibility --- .../java/org/mozilla/fenix/components/FxaServer.kt | 2 +- .../helpers/idlingresource/AddonsInstallingIdlingResource.kt | 2 +- app/src/main/java/org/mozilla/fenix/HomeActivity.kt | 2 +- .../main/java/org/mozilla/fenix/components/FenixSnackbar.kt | 2 +- app/src/main/java/org/mozilla/fenix/gecko/GeckoProvider.kt | 4 ++-- .../fenix/home/sessioncontrol/SwipeToDeleteCallback.kt | 2 +- .../java/org/mozilla/fenix/library/downloads/DownloadView.kt | 4 ++-- .../mozilla/fenix/settings/search/AddSearchEngineFragment.kt | 2 +- .../fenix/settings/search/RadioSearchEngineListPreference.kt | 2 +- .../org/mozilla/fenix/tabstray/browser/TabGroupViewHolder.kt | 2 +- .../main/java/org/mozilla/fenix/utils/ManufacturerCodes.kt | 4 ++-- app/src/main/java/org/mozilla/fenix/utils/Settings.kt | 2 +- .../org/mozilla/fenix/wifi/SitePermissionsWifiIntegration.kt | 4 ++-- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/components/FxaServer.kt b/app/src/androidTest/java/org/mozilla/fenix/components/FxaServer.kt index 71f150c17d..f67d862b41 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/components/FxaServer.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/components/FxaServer.kt @@ -14,7 +14,7 @@ import mozilla.components.service.fxa.ServerConfig object FxaServer { private const val CLIENT_ID = "a2270f727f45f648" - const val REDIRECT_URL = "urn:ietf:wg:oauth:2.0:oob:oauth-redirect-webchannel" + private const val REDIRECT_URL = "urn:ietf:wg:oauth:2.0:oob:oauth-redirect-webchannel" @Suppress("UNUSED_PARAMETER") fun config(context: Context): ServerConfig { diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsInstallingIdlingResource.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsInstallingIdlingResource.kt index a10fc21c85..3ee8b460cb 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsInstallingIdlingResource.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsInstallingIdlingResource.kt @@ -6,7 +6,7 @@ import androidx.test.espresso.IdlingResource import mozilla.components.feature.addons.ui.AddonInstallationDialogFragment class AddonsInstallingIdlingResource( - val fragmentManager: FragmentManager + private val fragmentManager: FragmentManager ) : IdlingResource { private var resourceCallback: IdlingResource.ResourceCallback? = null diff --git a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt index 2cb8bd3c24..058e989d06 100644 --- a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt @@ -916,7 +916,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { } } - fun updateSecureWindowFlags(mode: BrowsingMode = browsingModeManager.mode) { + private fun updateSecureWindowFlags(mode: BrowsingMode = browsingModeManager.mode) { if (mode == BrowsingMode.Private && !settings().allowScreenshotsInPrivateMode) { window.addFlags(FLAG_SECURE) } else { diff --git a/app/src/main/java/org/mozilla/fenix/components/FenixSnackbar.kt b/app/src/main/java/org/mozilla/fenix/components/FenixSnackbar.kt index 68244c7723..4b84424586 100644 --- a/app/src/main/java/org/mozilla/fenix/components/FenixSnackbar.kt +++ b/app/src/main/java/org/mozilla/fenix/components/FenixSnackbar.kt @@ -78,7 +78,7 @@ class FenixSnackbar private constructor( companion object { const val LENGTH_LONG = Snackbar.LENGTH_LONG const val LENGTH_SHORT = Snackbar.LENGTH_SHORT - const val LENGTH_ACCESSIBLE = 15000 /* 15 seconds in ms */ + private const val LENGTH_ACCESSIBLE = 15000 /* 15 seconds in ms */ const val LENGTH_INDEFINITE = Snackbar.LENGTH_INDEFINITE private const val minTextSize = 12 diff --git a/app/src/main/java/org/mozilla/fenix/gecko/GeckoProvider.kt b/app/src/main/java/org/mozilla/fenix/gecko/GeckoProvider.kt index 0a41dc63ba..2a91270bb8 100644 --- a/app/src/main/java/org/mozilla/fenix/gecko/GeckoProvider.kt +++ b/app/src/main/java/org/mozilla/fenix/gecko/GeckoProvider.kt @@ -24,9 +24,9 @@ import org.mozilla.geckoview.GeckoRuntimeSettings object GeckoProvider { private var runtime: GeckoRuntime? = null - const val CN_UPDATE_URL = + private const val CN_UPDATE_URL = "https://sb.firefox.com.cn/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2" - const val CN_GET_HASH_URL = + private const val CN_GET_HASH_URL = "https://sb.firefox.com.cn/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2" @Synchronized diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SwipeToDeleteCallback.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SwipeToDeleteCallback.kt index 8c488cfd67..862e319841 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SwipeToDeleteCallback.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SwipeToDeleteCallback.kt @@ -115,7 +115,7 @@ class SwipeToDeleteCallback( companion object { const val BACKGROUND_CORNER_OFFSET = 40 const val MARGIN = 32 - const val DENSITY_CONVERSION = 160f + private const val DENSITY_CONVERSION = 160f private fun draw( background: Drawable, diff --git a/app/src/main/java/org/mozilla/fenix/library/downloads/DownloadView.kt b/app/src/main/java/org/mozilla/fenix/library/downloads/DownloadView.kt index 6b669c6bde..9898afc872 100644 --- a/app/src/main/java/org/mozilla/fenix/library/downloads/DownloadView.kt +++ b/app/src/main/java/org/mozilla/fenix/library/downloads/DownloadView.kt @@ -55,7 +55,7 @@ class DownloadView( var mode: DownloadFragmentState.Mode = DownloadFragmentState.Mode.Normal private set - val downloadAdapter = DownloadAdapter(interactor) + private val downloadAdapter = DownloadAdapter(interactor) private val layoutManager = LinearLayoutManager(container.context) init { @@ -104,7 +104,7 @@ class DownloadView( } } - fun updateEmptyState(userHasDownloads: Boolean) { + private fun updateEmptyState(userHasDownloads: Boolean) { binding.downloadList.isVisible = userHasDownloads binding.downloadEmptyView.isVisible = !userHasDownloads if (!userHasDownloads) { 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 e890b8fe0f..b721d93af7 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 @@ -198,7 +198,7 @@ class AddSearchEngineFragment : } } - fun checkForErrors(name: String, searchString: String): Boolean { + private fun checkForErrors(name: String, searchString: String): Boolean { return when { name.isEmpty() -> { customSearchEngine.customSearchEngineNameField.error = resources diff --git a/app/src/main/java/org/mozilla/fenix/settings/search/RadioSearchEngineListPreference.kt b/app/src/main/java/org/mozilla/fenix/settings/search/RadioSearchEngineListPreference.kt index 46717f8fe4..4cb8999010 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/search/RadioSearchEngineListPreference.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/search/RadioSearchEngineListPreference.kt @@ -42,7 +42,7 @@ class RadioSearchEngineListPreference @JvmOverloads constructor( attrs: AttributeSet? = null, defStyleAttr: Int = android.R.attr.preferenceStyle ) : Preference(context, attrs, defStyleAttr), CompoundButton.OnCheckedChangeListener { - val itemResId: Int + private val itemResId: Int get() = R.layout.search_engine_radio_button init { diff --git a/app/src/main/java/org/mozilla/fenix/tabstray/browser/TabGroupViewHolder.kt b/app/src/main/java/org/mozilla/fenix/tabstray/browser/TabGroupViewHolder.kt index 82b14b5d3c..c57f1056ee 100644 --- a/app/src/main/java/org/mozilla/fenix/tabstray/browser/TabGroupViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/tabstray/browser/TabGroupViewHolder.kt @@ -34,7 +34,7 @@ class TabGroupViewHolder( ) : RecyclerView.ViewHolder(itemView) { private val binding = TabGroupItemBinding.bind(itemView) - lateinit var groupListAdapter: TabGroupListAdapter + private lateinit var groupListAdapter: TabGroupListAdapter fun bind( group: TabGroup, diff --git a/app/src/main/java/org/mozilla/fenix/utils/ManufacturerCodes.kt b/app/src/main/java/org/mozilla/fenix/utils/ManufacturerCodes.kt index 7915bcf4fd..f41f53b8e7 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/ManufacturerCodes.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/ManufacturerCodes.kt @@ -13,9 +13,9 @@ import android.os.Build */ object ManufacturerCodes { const val HUAWEI: String = "HUAWEI" - const val LG = "LGE" + private const val LG = "LGE" const val ONE_PLUS: String = "OnePlus" - const val SAMSUNG = "samsung" + private const val SAMSUNG = "samsung" val isLG get() = Build.MANUFACTURER.equals(LG, ignoreCase = true) val isSamsung get() = Build.MANUFACTURER.equals(SAMSUNG, ignoreCase = true) diff --git a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt index 527d0b7ac0..74114ad6b3 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt @@ -1180,7 +1180,7 @@ class Settings(private val appContext: Context) : PreferencesHolder { featureFlag = FeatureFlags.addressesFeature ) - var isHistoryMetadataEnabled by booleanPreference( + private var isHistoryMetadataEnabled by booleanPreference( appContext.getPreferenceKey(R.string.pref_key_history_metadata_feature), default = false ) diff --git a/app/src/main/java/org/mozilla/fenix/wifi/SitePermissionsWifiIntegration.kt b/app/src/main/java/org/mozilla/fenix/wifi/SitePermissionsWifiIntegration.kt index 603c76bdc5..bb44b67031 100644 --- a/app/src/main/java/org/mozilla/fenix/wifi/SitePermissionsWifiIntegration.kt +++ b/app/src/main/java/org/mozilla/fenix/wifi/SitePermissionsWifiIntegration.kt @@ -45,11 +45,11 @@ class SitePermissionsWifiIntegration( } } - fun addWifiConnectedListener() { + private fun addWifiConnectedListener() { wifiConnectionMonitor.addOnWifiConnectedChangedListener(wifiConnectedListener) } - fun removeWifiConnectedListener() { + private fun removeWifiConnectedListener() { wifiConnectionMonitor.removeOnWifiConnectedChangedListener(wifiConnectedListener) }