Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rvandermeulen committed Oct 21, 2022
1 parent f7f4a03 commit 1e6b0af
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 45 deletions.
8 changes: 3 additions & 5 deletions app/src/main/java/org/mozilla/focus/activity/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ open class MainActivity : LocaleAwareAppCompatActivity() {
// Checks if Activity is currently in PiP mode if launched from external intents, then exits it
checkAndExitPiP()

if (!isTaskRoot) {
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN == intent.action) {
finish()
return
}
if (!isTaskRoot && intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN == intent.action) {
finish()
return
}

@Suppress("DEPRECATION") // https://github.com/mozilla-mobile/focus-android/issues/5016
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ open class AutocompleteListFragment : BaseSettingsLikeFragment(), CoroutineScope
return true
}

override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {}
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int)

override fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int {
if (viewHolder is AddActionViewHolder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.mozilla.focus.ext.hide
import org.mozilla.focus.ext.showAsFixed
import org.mozilla.focus.utils.Settings

@Suppress("LongParameterList")
class FullScreenIntegration(
val activity: Activity,
val store: BrowserStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ open class ExceptionsListFragment : BaseSettingsLikeFragment(), CoroutineScope {
return true
}

override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {}
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int)

override fun onSelectedChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) {
super.onSelectedChanged(viewHolder, actionState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CrashReporterFragment : Fragment(R.layout.fragment_crash_reporter) {
}

companion object {
val FRAGMENT_TAG = "crash-reporter"
const val FRAGMENT_TAG = "crash-reporter"

fun create() = CrashReporterFragment()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ class FirstrunFragment : Fragment(), View.OnClickListener {
position: Int,
positionOffset: Float,
positionOffsetPixels: Int,
) {}
)

override fun onPageScrollStateChanged(state: Int) {}
override fun onPageScrollStateChanged(state: Int)
},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,10 +482,8 @@ class UrlInputFragment :
.setListener(
object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
if (reverse) {
if (isOverlay) {
dismiss()
}
if (reverse && isOverlay) {
dismiss()
}

isAnimating = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,19 @@ class ManualAddSearchEnginePreference(context: Context, attrs: AttributeSet) :

private fun buildTextWatcherForErrorLayout(errorLayout: TextInputLayout): TextWatcher {
return object : TextWatcher {
override fun beforeTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {}
override fun beforeTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int)

override fun onTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {
errorLayout.error = null
}

override fun afterTextChanged(editable: Editable) {}
override fun afterTextChanged(editable: Editable)
}
}

companion object {
private val SUPER_STATE_KEY = "super-state"
private val SEARCH_ENGINE_NAME_KEY = "search-engine-name"
private val SEARCH_QUERY_KEY = "search-query"
private const val SUPER_STATE_KEY = "super-state"
private const val SEARCH_ENGINE_NAME_KEY = "search-engine-name"
private const val SEARCH_QUERY_KEY = "search-query"
}
}
4 changes: 2 additions & 2 deletions app/src/main/java/org/mozilla/focus/shortcut/IconGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import org.mozilla.focus.utils.UrlUtils
class IconGenerator {

companion object {
private val TEXT_SIZE_DP = 36f
private val DEFAULT_ICON_CHAR = '?'
private const val TEXT_SIZE_DP = 36f
private const val DEFAULT_ICON_CHAR = '?'

/**
* See [generateAdaptiveLauncherIcon] for more details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import mozilla.components.browser.state.action.DownloadAction
import mozilla.components.browser.state.action.TabListAction
import mozilla.components.browser.state.selector.findTab
import mozilla.components.browser.state.state.BrowserState
import mozilla.components.browser.state.state.CustomTabConfig
import mozilla.components.browser.state.state.SessionState
import mozilla.components.browser.state.state.TabSessionState
import mozilla.components.browser.state.state.content.DownloadState
Expand Down Expand Up @@ -119,29 +118,6 @@ class TelemetryMiddleware : Middleware<BrowserState, BrowserAction> {
}
}

/**
* This method creates a list of options used to share with Telemetry and was migrated from A-C.
*
* @param customTabConfig The customTabConfig to use
* @return A list of strings representing the customTabConfig
*/
@Suppress("ComplexMethod")
private fun generateOptions(customTabConfig: CustomTabConfig): List<String> {
val options = mutableListOf<String>()

if (customTabConfig.toolbarColor != null) options.add(TOOLBAR_COLOR_OPTION)
if (customTabConfig.closeButtonIcon != null) options.add(CLOSE_BUTTON_OPTION)
if (customTabConfig.enableUrlbarHiding) options.add(DISABLE_URLBAR_HIDING_OPTION)
if (customTabConfig.actionButtonConfig != null) options.add(ACTION_BUTTON_OPTION)
if (customTabConfig.showShareMenuItem) options.add(SHARE_MENU_ITEM_OPTION)
if (customTabConfig.menuItems.isNotEmpty()) options.add(CUSTOMIZED_MENU_OPTION)
if (customTabConfig.actionButtonConfig?.tint == true) options.add(ACTION_BUTTON_TINT_OPTION)
if (customTabConfig.exitAnimations != null) options.add(EXIT_ANIMATION_OPTION)
if (customTabConfig.titleVisible) options.add(PAGE_TITLE_OPTION)

return options
}

companion object {
internal const val TOOLBAR_COLOR_OPTION = "hasToolbarColor"
internal const val CLOSE_BUTTON_OPTION = "hasCloseButton"
Expand Down

0 comments on commit 1e6b0af

Please sign in to comment.