<commit_before>/* 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.focus.autocomplete

import android.content.Context
import android.preference.Preference
import android.util.AttributeSet
import android.view.View
import android.widget.TextView
import org.mozilla.focus.R
import org.mozilla.focus.utils.Settings

/**
 * Autocomplete preference that will show a sub screen to configure the autocomplete behavior.
 */
class AutocompletePreference(context: Context?, attrs: AttributeSet?) : Preference(context, attrs) {
    var summaryView: TextView? = null

    override fun onBindView(view: View?) {
        super.onBindView(view)

        val settings = Settings.getInstance(context)

        summaryView = view?.findViewById(android.R.id.summary)
        summaryView?.setText(
                if (settings.shouldAutocompleteFromShippedDomainList() || settings.shouldAutocompleteFromCustomDomainList())
                    R.string.preference_state_on
                else
                    R.string.preference_state_off)
    }
}<commit_msg>Issue #2488: Fix line length error.<commit_after>/* 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.focus.autocomplete

import android.content.Context
import android.preference.Preference
import android.util.AttributeSet
import android.view.View
import android.widget.TextView
import org.mozilla.focus.R
import org.mozilla.focus.utils.Settings

/**
 * Autocomplete preference that will show a sub screen to configure the autocomplete behavior.
 */
class AutocompletePreference(context: Context?, attrs: AttributeSet?) : Preference(context, attrs) {
    var summaryView: TextView? = null

    override fun onBindView(view: View?) {
        super.onBindView(view)

        val settings = Settings.getInstance(context)

        summaryView = view?.findViewById(android.R.id.summary)
        summaryView?.setText(
                if (settings.shouldAutocompleteFromShippedDomainList() ||
                    settings.shouldAutocompleteFromCustomDomainList())
                    R.string.preference_state_on
                else
                    R.string.preference_state_off)
    }
}
{'fraction_non_alphanumeric': 0.08609539207760711, 'fraction_numerical': 0.004850444624090542, 'mean_word_length': 3.2020373514431237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3752943', 'n_tokens_mistral': 681, 'n_tokens_neox': 637, 'n_words': 189}