<commit_before>/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
 * 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.activity;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.view.View;

import org.mozilla.focus.R;
import org.mozilla.focus.fragment.InfoFragment;
import org.mozilla.focus.locale.Locales;
import org.mozilla.focus.utils.SupportUtils;
import org.mozilla.focus.web.IWebView;
import org.mozilla.focus.web.WebViewProvider;

/**
 * A generic activity that supports showing additional information in a WebView. This is useful
 * for showing any web based content, including About/Help/Rights, and also SUMO pages.
 */
public class InfoActivity extends AppCompatActivity {
    private static final String PRIVACY_NOTICE_URL = "https://www.mozilla.org/privacy/firefox-focus/";

    private static final String EXTRA_URL = "extra_url";
    private static final String EXTRA_TITLE = "extra_title";

    public static final Intent getIntentFor(final Context context, final String url, final String title) {
        final Intent intent = new Intent(context, InfoActivity.class);

        intent.putExtra(EXTRA_URL, url);
        intent.putExtra(EXTRA_TITLE, title);

        return intent;
    }

    public static final Intent getAboutIntent(final Context context) {
        final Resources resources = Locales.getLocalizedResources(context);

        // We can't use "about:" because webview silently swallows about: pages, hence we use
        // a custom scheme.
        return getIntentFor(context, "focusabout:", resources.getString(R.string.menu_about));
    }

    public static final Intent getRightsIntent(final Context context) {
        final Resources resources = Locales.getLocalizedResources(context);
        return getIntentFor(context, "file:///android_asset/rights-focus.html", resources.getString(R.string.menu_rights));
    }

    public static final Intent getHelpIntent(final Context context) {
        final Resources resources = Locales.getLocalizedResources(context);
        return getIntentFor(context, SupportUtils.HELP_URL, resources.getString(R.string.menu_help));
    }

    public static final Intent getPrivacyNoticeIntent(final Context context) {
        final Resources resources = Locales.getLocalizedResources(context);
        return getIntentFor(context, PRIVACY_NOTICE_URL, resources.getString(R.string.preference_privacy_notice));
    }

    public static final Intent getTrackerHelpIntent(final Context context) {<commit_msg>Use separate "privacy notice" link for Klar. (#1173)<commit_after>/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
 * 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.activity;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.view.View;

import org.mozilla.focus.R;
import org.mozilla.focus.fragment.InfoFragment;
import org.mozilla.focus.locale.Locales;
import org.mozilla.focus.utils.AppConstants;
import org.mozilla.focus.utils.SupportUtils;
import org.mozilla.focus.web.IWebView;
import org.mozilla.focus.web.WebViewProvider;

/**
 * A generic activity that supports showing additional information in a WebView. This is useful
 * for showing any web based content, including About/Help/Rights, and also SUMO pages.
 */
public class InfoActivity extends AppCompatActivity {
    private static final String PRIVACY_NOTICE_URL = "https://www.mozilla.org/privacy/firefox-focus/";
    private static final String PRIVACY_NOTICE_KLAR_URL = "https://www.mozilla.org/de/privacy/firefox-klar/";

    private static final String EXTRA_URL = "extra_url";
    private static final String EXTRA_TITLE = "extra_title";

    public static final Intent getIntentFor(final Context context, final String url, final String title) {
        final Intent intent = new Intent(context, InfoActivity.class);

        intent.putExtra(EXTRA_URL, url);
        intent.putExtra(EXTRA_TITLE, title);

        return intent;
    }

    public static final Intent getAboutIntent(final Context context) {
        final Resources resources = Locales.getLocalizedResources(context);

        // We can't use "about:" because webview silently swallows about: pages, hence we use
        // a custom scheme.
        return getIntentFor(context, "focusabout:", resources.getString(R.string.menu_about));
    }

    public static final Intent getRightsIntent(final Context context) {
        final Resources resources = Locales.getLocalizedResources(context);
        return getIntentFor(context, "file:///android_asset/rights-focus.html", resources.getString(R.string.menu_rights));
    }

    public static final Intent getHelpIntent(final Context context) {
        final Resources resources = Locales.getLocalizedResources(context);
        return getIntentFor(context, SupportUtils.HELP_URL, resources.getString(R.string.menu_help));
    }

    public static final Intent getPrivacyNoticeIntent(final Context context) {
        final Resources resources = Locales.getLocalizedResources(context);
        return getIntentFor(context, AppConstants.isKlarBuild() ? PRIVACY_NOTICE_KLAR_URL : PRIVACY_NOTICE_URL, resources.getString(R.string.preference_privacy_notice));
    }

    public static final Intent getTrackerHelpIntent(final Context context) {
{'fraction_non_alphanumeric': 0.09287925696594428, 'fraction_numerical': 0.0032589212970506763, 'mean_word_length': 4.219387755102041, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 3, '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': '4938789', 'n_tokens_mistral': 1724, 'n_tokens_neox': 1657, 'n_words': 481}