-
Notifications
You must be signed in to change notification settings - Fork 921
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
226 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
android/java/org/chromium/chrome/browser/preferences/BraveLicensePreferences.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* Copyright (c) 2020 The Brave Authors. All rights reserved. | ||
* 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.chromium.chrome.browser.preferences; | ||
|
||
import android.os.Bundle; | ||
|
||
import org.chromium.base.Log; | ||
import org.chromium.chrome.R; | ||
import org.chromium.chrome.browser.BraveRewardsHelper; | ||
import org.chromium.chrome.browser.preferences.BravePreferenceFragment; | ||
import org.chromium.chrome.browser.preferences.TextMessagePreference; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Scanner; | ||
|
||
/** | ||
* Fragment to display Brave license information. | ||
*/ | ||
public class BraveLicensePreferences extends BravePreferenceFragment { | ||
private static final String TAG = "BraveLicense"; | ||
|
||
private static final String PREF_BRAVE_LICENSE_TEXT = "brave_license_text"; | ||
private static final String ASSET_BRAVE_LICENSE = "LICENSE.html"; | ||
|
||
@Override | ||
public void onCreatePreferences(Bundle savedInstanceState, String s) { | ||
PreferenceUtils.addPreferencesFromResource(this, R.xml.brave_license_preferences); | ||
getActivity().setTitle(R.string.brave_license_text); | ||
TextMessagePreference licenseText = | ||
(TextMessagePreference) findPreference(PREF_BRAVE_LICENSE_TEXT); | ||
try { | ||
InputStream in = getActivity().getAssets().open(ASSET_BRAVE_LICENSE); | ||
Scanner scanner = new Scanner(in).useDelimiter("\\A"); | ||
String summary = scanner.hasNext() ? scanner.next() : ""; | ||
in.close(); | ||
licenseText.setSummary(BraveRewardsHelper.spannedFromHtmlString(summary)); | ||
} catch (IOException e) { | ||
Log.e(TAG, "Could not load license text: " + e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright (c) 2020 The Brave Authors. All rights reserved. | ||
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/. | ||
--> | ||
|
||
<PreferenceScreen | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
<org.chromium.chrome.browser.preferences.TextMessagePreference | ||
android:key="brave_license_text" /> | ||
</PreferenceScreen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2014 The Chromium Authors. All rights reserved. | ||
Use of this source code is governed by a BSD-style license that can be | ||
found in the LICENSE file. --> | ||
|
||
<PreferenceScreen | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
<org.chromium.chrome.browser.preferences.HyperlinkPreference | ||
android:key="open_source_license" | ||
android:title="@string/open_source_license_title" | ||
app:url="@string/open_source_license_url" /> | ||
<org.chromium.chrome.browser.preferences.HyperlinkPreference | ||
android:key="terms_of_service" | ||
android:title="@string/terms_of_service_title" | ||
app:url="@string/brave_terms_of_service_url" /> | ||
<org.chromium.chrome.browser.preferences.HyperlinkPreference | ||
android:key="privacy_notice" | ||
android:title="@string/privacy_notice_title" | ||
app:url="@string/brave_privacy_notice_url" /> | ||
<Preference | ||
android:fragment="org.chromium.chrome.browser.preferences.BraveLicensePreferences" | ||
android:key="brave_license" | ||
android:title="@string/brave_license_text" /> | ||
</PreferenceScreen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters