<w>daeef</w>
<w>databaseview</w>
<w>deeplinks</w>
+ <w>dereferenced</w>
<w>didn</w>
<w>displayimages</w>
<w>displayorder</w>
apply plugin: 'com.android.application'
android {
- compileSdkVersion 28
- buildToolsVersion '28.0.3'
+ compileSdkVersion 29
+ buildToolsVersion '29.0.2'
defaultConfig {
minSdkVersion 19
- targetSdkVersion 28
+ targetSdkVersion 29
versionCode 46
versionName "3.2"
}
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.0.0'
implementation 'androidx.drawerlayout:drawerlayout:1.0.0'
+ implementation 'androidx.preference:preference:1.1.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
// Only compile Firebase ads for the free flavor.
- freeImplementation 'com.google.firebase:firebase-ads:18.2.0'
+ freeImplementation 'com.google.firebase:firebase-ads:18.3.0'
}
\ No newline at end of file
import android.widget.Switch;
import android.widget.TextView;
+import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; // The AndroidX toolbar must be used until the minimum API is >= 21.
}
@Override
- protected void onSaveInstanceState(Bundle outState) {
+ protected void onSaveInstanceState(@NonNull Bundle outState) {
// Store the current `DomainSettingsFragment` state in `outState`.
if (findViewById(R.id.domain_settings_scrollview) != null) { // `DomainSettingsFragment` is displayed.
// Save any changes that have been made to the domain settings.
undoDeleteSnackbar.dismiss();
}
- // Get the new domain name String from the dialog fragment.
+ // Remove the incorrect lint warning below that the dialog might be null.
+ assert dialogFragment.getDialog() != null;
+
+ // Get a handle for the domain name edit text.
EditText domainNameEditText = dialogFragment.getDialog().findViewById(R.id.domain_name_edittext);
+
+ // Get the domain name string.
String domainNameString = domainNameEditText.getText().toString();
// Create the domain and store the database ID in `currentDomainDatabaseId`.
Spinner userAgentSpinner = view.findViewById(R.id.user_agent_spinner);
EditText customUserAgentEditText = view.findViewById(R.id.custom_user_agent_edittext);
Spinner fontSizeSpinner = view.findViewById(R.id.font_size_spinner);
+ EditText customFontSizeEditText = view.findViewById(R.id.custom_font_size_edittext);
Spinner swipeToRefreshSpinner = view.findViewById(R.id.swipe_to_refresh_spinner);
Spinner nightModeSpinner = view.findViewById(R.id.night_mode_spinner);
Spinner wideViewportSpinner = view.findViewById(R.id.wide_viewport_spinner);
boolean ultraList = ultraListSwitch.isChecked();
boolean ultraPrivacy = ultraPrivacySwitch.isChecked();
boolean blockAllThirdPartyRequests = blockAllThirdPartyRequestsSwitch.isChecked();
- int userAgentPosition = userAgentSpinner.getSelectedItemPosition();
- int fontSizePosition = fontSizeSpinner.getSelectedItemPosition();
+ int userAgentSwitchPosition = userAgentSpinner.getSelectedItemPosition();
+ int fontSizeSwitchPosition = fontSizeSpinner.getSelectedItemPosition();
int swipeToRefreshInt = swipeToRefreshSpinner.getSelectedItemPosition();
int nightModeInt = nightModeSpinner.getSelectedItemPosition();
int wideViewportInt = wideViewportSpinner.getSelectedItemPosition();
String userAgentName;
// Set the user agent name.
- switch (userAgentPosition) {
+ switch (userAgentSwitchPosition) {
case MainWebViewActivity.DOMAINS_SYSTEM_DEFAULT_USER_AGENT:
// Set the user agent name to be `System default user agent`.
userAgentName = resources.getString(R.string.system_default_user_agent);
String[] userAgentNameArray = resources.getStringArray(R.array.user_agent_names);
// Set the user agent name from the array. The domain spinner has one more entry than the name array, so the position must be decremented.
- userAgentName = userAgentNameArray[userAgentPosition - 1];
+ userAgentName = userAgentNameArray[userAgentSwitchPosition - 1];
}
- // Get the font size integer.
- int fontSizeInt = Integer.parseInt(resources.getStringArray(R.array.domain_settings_font_size_entry_values)[fontSizePosition]);
+ // Initialize the font size integer. `0` indicates the system default font size.
+ int fontSizeInt = 0;
+
+ // Use a custom font size if it is selected.
+ if (fontSizeSwitchPosition == 1) { // A custom font size is specified.
+ // Get the custom font size from the edit text.
+ fontSizeInt = Integer.parseInt(customFontSizeEditText.getText().toString());
+ }
// Save the domain settings.
domainsDatabaseHelper.updateDomain(DomainsActivity.currentDomainDatabaseId, domainNameString, javaScript, firstPartyCookies, thirdPartyCookies, domStorage, formData, easyList, easyPrivacy,
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.media.MediaScannerConnection;
+import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
@Override
public void onSaveLogcat(DialogFragment dialogFragment) {
+ // Get a handle for the dialog fragment.
+ Dialog dialog = dialogFragment.getDialog();
+
+ // Remove the lint warning below that the dialog fragment might be null.
+ assert dialog != null;
+
// Get a handle for the file name edit text.
- EditText fileNameEditText = dialogFragment.getDialog().findViewById(R.id.file_name_edittext);
+ EditText fileNameEditText = dialog.findViewById(R.id.file_name_edittext);
// Get the file path string.
filePathString = fileNameEditText.getText().toString();
// The activity result is called after browsing for a file in the save alert dialog.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ // Run the default commands.
+ super.onActivityResult(requestCode, resultCode, data);
+
// Don't do anything if the user pressed back from the file picker.
if (resultCode == Activity.RESULT_OK) {
// Get a handle for the save dialog fragment.
// Get a handle for the save dialog.
Dialog saveDialog = saveDialogFragment.getDialog();
+ // Remove the lint warning below that the save dialog might be null.
+ assert saveDialog != null;
+
// Get a handle for the file name edit text.
EditText fileNameEditText = saveDialog.findViewById(R.id.file_name_edittext);
// Instantiate the file name helper.
FileNameHelper fileNameHelper = new FileNameHelper();
- // Convert the file name URI to a file name path.
- String fileNamePath = fileNameHelper.convertUriToFileNamePath(data.getData());
+ // Get the file name URI from the intent.
+ Uri fileNameUri= data.getData();
+
+ // Process the file name URI if it is not null.
+ if (fileNameUri != null) {
+ // Convert the file name URI to a file name path.
+ String fileNamePath = fileNameHelper.convertUriToFileNamePath(fileNameUri);
- // Set the file name path as the text of the file name edit text.
- fileNameEditText.setText(fileNamePath);
+ // Set the file name path as the text of the file name edit text.
+ fileNameEditText.setText(fileNamePath);
+ }
}
}
}
import com.stoutner.privacybrowser.dialogs.DownloadLocationPermissionDialog;
import com.stoutner.privacybrowser.dialogs.EditBookmarkDialog;
import com.stoutner.privacybrowser.dialogs.EditBookmarkFolderDialog;
+import com.stoutner.privacybrowser.dialogs.FontSizeDialog;
import com.stoutner.privacybrowser.dialogs.HttpAuthenticationDialog;
import com.stoutner.privacybrowser.dialogs.PinnedMismatchDialog;
import com.stoutner.privacybrowser.dialogs.SaveWebpageImageDialog;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
// AppCompatActivity from android.support.v7.app.AppCompatActivity must be used to have access to the SupportActionBar until the minimum API is >= 21.
public class MainWebViewActivity extends AppCompatActivity implements CreateBookmarkDialog.CreateBookmarkListener, CreateBookmarkFolderDialog.CreateBookmarkFolderListener,
DownloadFileDialog.DownloadFileListener, DownloadImageDialog.DownloadImageListener, DownloadLocationPermissionDialog.DownloadLocationPermissionDialogListener, EditBookmarkDialog.EditBookmarkListener,
- EditBookmarkFolderDialog.EditBookmarkFolderListener, NavigationView.OnNavigationItemSelectedListener, PinnedMismatchDialog.PinnedMismatchListener, PopulateBlocklists.PopulateBlocklistsListener, SaveWebpageImageDialog.SaveWebpageImageListener,
+ EditBookmarkFolderDialog.EditBookmarkFolderListener, FontSizeDialog.UpdateFontSizeListener, NavigationView.OnNavigationItemSelectedListener, PinnedMismatchDialog.PinnedMismatchListener, PopulateBlocklists.PopulateBlocklistsListener, SaveWebpageImageDialog.SaveWebpageImageListener,
StoragePermissionDialog.StoragePermissionDialogListener, UrlHistoryDialog.NavigateHistoryListener, WebViewTabFragment.NewTabListener {
// `orbotStatus` is public static so it can be accessed from `OrbotProxyHelper`. It is also used in `onCreate()`, `onResume()`, and `applyProxyThroughOrbot()`.
File localStorageDirectory = new File (privateDataDirectoryString + "/app_webview/Local Storage/");
int localStorageDirectoryNumberOfFiles = 0;
if (localStorageDirectory.exists()) {
- localStorageDirectoryNumberOfFiles = localStorageDirectory.list().length;
+ // `Objects.requireNonNull` removes a lint warning that `localStorageDirectory.list` might produce a null pointed exception if it is dereferenced.
+ localStorageDirectoryNumberOfFiles = Objects.requireNonNull(localStorageDirectory.list()).length;
}
// Get a count of the number of files in the IndexedDB directory.
File indexedDBDirectory = new File (privateDataDirectoryString + "/app_webview/IndexedDB");
int indexedDBDirectoryNumberOfFiles = 0;
if (indexedDBDirectory.exists()) {
- indexedDBDirectoryNumberOfFiles = indexedDBDirectory.list().length;
+ // `Objects.requireNonNull` removes a lint warning that `indexedDBDirectory.list` might produce a null pointed exception if it is dereferenced.
+ indexedDBDirectoryNumberOfFiles = Objects.requireNonNull(indexedDBDirectory.list()).length;
}
// Enable Clear DOM Storage if there is any.
menu.findItem(R.id.user_agent_custom).setChecked(true);
}
- // Instantiate the font size title and the selected font size menu item.
- String fontSizeTitle;
- MenuItem selectedFontSizeMenuItem;
-
- // Prepare the font size title and current size menu item.
- //noinspection DuplicateBranchesInSwitch
- switch (fontSize) {
- case 25:
- fontSizeTitle = getString(R.string.font_size) + " - " + getString(R.string.twenty_five_percent);
- selectedFontSizeMenuItem = menu.findItem(R.id.font_size_twenty_five_percent);
- break;
-
- case 50:
- fontSizeTitle = getString(R.string.font_size) + " - " + getString(R.string.fifty_percent);
- selectedFontSizeMenuItem = menu.findItem(R.id.font_size_fifty_percent);
- break;
-
- case 75:
- fontSizeTitle = getString(R.string.font_size) + " - " + getString(R.string.seventy_five_percent);
- selectedFontSizeMenuItem = menu.findItem(R.id.font_size_seventy_five_percent);
- break;
-
- case 100:
- fontSizeTitle = getString(R.string.font_size) + " - " + getString(R.string.one_hundred_percent);
- selectedFontSizeMenuItem = menu.findItem(R.id.font_size_one_hundred_percent);
- break;
-
- case 125:
- fontSizeTitle = getString(R.string.font_size) + " - " + getString(R.string.one_hundred_twenty_five_percent);
- selectedFontSizeMenuItem = menu.findItem(R.id.font_size_one_hundred_twenty_five_percent);
- break;
-
- case 150:
- fontSizeTitle = getString(R.string.font_size) + " - " + getString(R.string.one_hundred_fifty_percent);
- selectedFontSizeMenuItem = menu.findItem(R.id.font_size_one_hundred_fifty_percent);
- break;
-
- case 175:
- fontSizeTitle = getString(R.string.font_size) + " - " + getString(R.string.one_hundred_seventy_five_percent);
- selectedFontSizeMenuItem = menu.findItem(R.id.font_size_one_hundred_seventy_five_percent);
- break;
-
- case 200:
- fontSizeTitle = getString(R.string.font_size) + " - " + getString(R.string.two_hundred_percent);
- selectedFontSizeMenuItem = menu.findItem(R.id.font_size_two_hundred_percent);
- break;
-
- default:
- fontSizeTitle = getString(R.string.font_size) + " - " + getString(R.string.one_hundred_percent);
- selectedFontSizeMenuItem = menu.findItem(R.id.font_size_one_hundred_percent);
- break;
- }
-
- // Set the font size title and select the current size menu item.
- fontSizeMenuItem.setTitle(fontSizeTitle);
- selectedFontSizeMenuItem.setChecked(true);
+ // Set the font size title.
+ fontSizeMenuItem.setTitle(getString(R.string.font_size) + " - " + fontSize + "%");
// Run all the other default commands.
super.onPrepareOptionsMenu(menu);
// Consume the event.
return true;
- case R.id.font_size_twenty_five_percent:
- // Set the font size.
- currentWebView.getSettings().setTextZoom(25);
-
- // Consume the event.
- return true;
-
- case R.id.font_size_fifty_percent:
- // Set the font size.
- currentWebView.getSettings().setTextZoom(50);
-
- // Consume the event.
- return true;
-
- case R.id.font_size_seventy_five_percent:
- // Set the font size.
- currentWebView.getSettings().setTextZoom(75);
-
- // Consume the event.
- return true;
-
- case R.id.font_size_one_hundred_percent:
- // Set the font size.
- currentWebView.getSettings().setTextZoom(100);
+ case R.id.font_size:
+ // Instantiate the font size dialog.
+ DialogFragment fontSizeDialogFragment = FontSizeDialog.displayDialog(currentWebView.getSettings().getTextZoom());
- // Consume the event.
- return true;
-
- case R.id.font_size_one_hundred_twenty_five_percent:
- // Set the font size.
- currentWebView.getSettings().setTextZoom(125);
-
- // Consume the event.
- return true;
-
- case R.id.font_size_one_hundred_fifty_percent:
- // Set the font size.
- currentWebView.getSettings().setTextZoom(150);
-
- // Consume the event.
- return true;
-
- case R.id.font_size_one_hundred_seventy_five_percent:
- // Set the font size.
- currentWebView.getSettings().setTextZoom(175);
-
- // Consume the event.
- return true;
-
- case R.id.font_size_two_hundred_percent:
- // Set the font size.
- currentWebView.getSettings().setTextZoom(200);
+ // Show the font size dialog.
+ fontSizeDialogFragment.show(getSupportFragmentManager(), getString(R.string.font_size));
// Consume the event.
return true;
inputMethodManager.hideSoftInputFromWindow(toolbar.getWindowToken(), 0);
}
+ @Override
+ public void onApplyNewFontSize(DialogFragment dialogFragment) {
+ // Get the dialog.
+ Dialog dialog = dialogFragment.getDialog();
+
+ // Remove the incorrect lint warning below tha the dialog might be null.
+ assert dialog != null;
+
+ // Get a handle for the font size edit text.
+ EditText fontSizeEditText = dialog.findViewById(R.id.font_size_edittext);
+
+ // Initialize the new font size variable with the current font size.
+ int newFontSize = currentWebView.getSettings().getTextZoom();
+
+ // Get the font size from the edit text.
+ try {
+ newFontSize = Integer.valueOf(fontSizeEditText.getText().toString());
+ } catch (Exception exception) {
+ // If the edit text does not contain a valid font size do nothing.
+ }
+
+ // Apply the new font size.
+ currentWebView.getSettings().setTextZoom(newFontSize);
+ }
+
@Override
public void onSaveWebpageImage(DialogFragment dialogFragment) {
// Get the dialog.
orbotStatus = intent.getStringExtra("org.torproject.android.intent.extra.STATUS");
// If Privacy Browser is waiting on Orbot, load the website now that Orbot is connected.
- if (orbotStatus.equals("ON") && waitingForOrbot) {
+ if ((orbotStatus != null) && orbotStatus.equals("ON") && waitingForOrbot) {
// Reset the waiting for Orbot status.
waitingForOrbot = false;
}
// Apply the font size.
- if (fontSize == 0) { // Apply the default font size.
- nestedScrollWebView.getSettings().setTextZoom(Integer.valueOf(defaultFontSizeString));
- } else { // Apply the specified font size.
- nestedScrollWebView.getSettings().setTextZoom(fontSize);
+ try { // Try the specified font size to see if it is valid.
+ if (fontSize == 0) { // Apply the default font size.
+ // Try to set the font size from the value in the app settings.
+ nestedScrollWebView.getSettings().setTextZoom(Integer.valueOf(defaultFontSizeString));
+ } else { // Apply the font size from domain settings.
+ nestedScrollWebView.getSettings().setTextZoom(fontSize);
+ }
+ } catch (Exception exception) { // The specified font size is invalid
+ // Set the font size to be 100%
+ nestedScrollWebView.getSettings().setTextZoom(100);
}
// Set the user agent.
nestedScrollWebView.getSettings().setJavaScriptEnabled(defaultJavaScriptEnabled);
}
- // Apply the default settings.
+ // Apply the default first-party cookie setting.
cookieManager.setAcceptCookie(nestedScrollWebView.getAcceptFirstPartyCookies());
- nestedScrollWebView.getSettings().setTextZoom(Integer.valueOf(defaultFontSizeString));
+
+ // Apply the default font size setting.
+ try {
+ // Try to set the font size from the value in the app settings.
+ nestedScrollWebView.getSettings().setTextZoom(Integer.valueOf(defaultFontSizeString));
+ } catch (Exception exception) {
+ // If the app settings value is invalid, set the font size to 100%.
+ nestedScrollWebView.getSettings().setTextZoom(100);
+ }
// Apply the form data setting if the API < 26.
if (Build.VERSION.SDK_INT < 26) {
super.onCreate(savedInstanceState);
// Display the settings fragment.
- getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
+ getSupportFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
}
}
\ No newline at end of file
private AddDomainListener addDomainListener;
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
// The create bookmark listener is initialized in `onAttach()` and used in `onCreateDialog()`.
private CreateBookmarkListener createBookmarkListener;
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
+import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
// `createBookmarkFolderListener` is used in `onAttach()` and `onCreateDialog`.
private CreateBookmarkFolderListener createBookmarkFolderListener;
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
super.onAttach(context);
// Get a handle for `createBookmarkFolderListener` from the launching context.
// Create an alert dialog from the `AlertDialog.Builder`.
final AlertDialog alertDialog = dialogBuilder.create();
- // Remove the warning below that `getWindow()` might be null.
- assert alertDialog.getWindow() != null;
+ // Get the alert dialog window.
+ Window dialogWindow = alertDialog.getWindow();
+
+ // Remove the incorrect lint warning below that the dialog window might be null.
+ assert dialogWindow != null;
// Disable screenshots if not allowed.
if (!allowScreenshots) {
alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
+ // Display the keyboard.
+ dialogWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
+
// The alert dialog must be shown before items in the alert dialog can be modified.
alertDialog.show();
}
});
- // Allow the enter key on the keyboard to create the folder from `create_folder_name_edittext`.
- folderNameEditText.setOnKeyListener((View v, int keyCode, KeyEvent event) -> {
- // If the event is a key-down on the `enter` key, select the `PositiveButton` `Create`.
- if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER) && createButton.isEnabled()) { // The enter key was pressed and the create button is enabled.
- // Trigger `createBookmarkFolderListener` and return the `DialogFragment` to the parent activity.
+ // Set the enter key on the keyboard to create the folder from the edit text.
+ folderNameEditText.setOnKeyListener((View view, int keyCode, KeyEvent keyEvent) -> {
+ // If the key event is a key-down on the `enter` key create the bookmark folder.
+ if ((keyEvent.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER) && createButton.isEnabled()) { // The enter key was pressed and the create button is enabled.
+ // Trigger the create bookmark folder listener and return the dialog fragment to the parent activity.
createBookmarkFolderListener.onCreateBookmarkFolder(this, favoriteIconBitmap);
- // Manually dismiss the `AlertDialog`.
+
+ // Manually dismiss the alert dialog.
alertDialog.dismiss();
+
// Consume the event.
return true;
} else { // If any other key was pressed, or if the create button is currently disabled, do not consume the event.
}
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
// Check to make sure tha the parent activity implements the listener.
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
}
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
}
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
void onSaveBookmark(DialogFragment dialogFragment, int selectedBookmarkDatabaseId, Bitmap favoriteIconBitmap);
}
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
void onSaveBookmarkFolder(DialogFragment dialogFragment, int selectedFolderDatabaseId, Bitmap favoriteIconBitmap);
}
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
void onSaveBookmarkFolder(DialogFragment dialogFragment, int selectedFolderDatabaseId, Bitmap favoriteIconBitmap);
}
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
--- /dev/null
+/*
+ * Copyright © 2019 Soren Stoutner <soren@stoutner.com>.
+ *
+ * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+ *
+ * Privacy Browser is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Privacy Browser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Privacy Browser. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.stoutner.privacybrowser.dialogs;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.EditText;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.DialogFragment;
+import androidx.preference.PreferenceManager;
+
+import com.stoutner.privacybrowser.R;
+
+public class FontSizeDialog extends DialogFragment {
+ // Define the update font size listener.
+ private UpdateFontSizeListener updateFontSizeListener;
+
+ // The public interface is used to send information back to the parent activity.
+ public interface UpdateFontSizeListener {
+ void onApplyNewFontSize(DialogFragment dialogFragment);
+ }
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ // Run the default commands.
+ super.onAttach(context);
+
+ // Get a handle for the update font size listener from the launching context.
+ updateFontSizeListener = (UpdateFontSizeListener) context;
+ }
+
+ public static FontSizeDialog displayDialog(int fontSize) {
+ // Create an arguments bundle.
+ Bundle argumentsBundle = new Bundle();
+
+ // Store the font size in the bundle.
+ argumentsBundle.putInt("font_size", fontSize);
+
+ // Create a new instance of the dialog.
+ FontSizeDialog fontSizeDialog = new FontSizeDialog();
+
+ // Add the bundle to the dialog.
+ fontSizeDialog.setArguments(argumentsBundle);
+
+ // Return the new dialog.
+ return fontSizeDialog;
+ }
+
+ // `@SuppressLing("InflateParams")` removes the warning about using null as the parent view group when inflating the alert dialog.
+ @SuppressLint("InflateParams")
+ @Override
+ @NonNull
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ // Get a handle for the activity and the context.
+ Activity activity = getActivity();
+ Context context = getContext();
+
+ // Remove the incorrect lint warnings below that the activity and context might be null.
+ assert activity != null;
+ assert context != null;
+
+ // Use a builder to create the alert dialog.
+ AlertDialog.Builder dialogBuilder;
+
+ // Get the arguments.
+ Bundle arguments = getArguments();
+
+ // Remove the incorrect lint warning below that `getInt()` might be null.
+ assert arguments != null;
+
+ // Get the current font size.
+ int currentFontSize = arguments.getInt("font_size");
+
+ // Get a handle for the shared preferences.
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
+
+ // Get the screenshot and theme preferences.
+ boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+ boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
+ // Set the style and icon according to the theme.
+ if (darkTheme) {
+ dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogDark);
+ dialogBuilder.setIcon(R.drawable.font_size_dark);
+ } else {
+ dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogLight);
+ dialogBuilder.setIcon(R.drawable.font_size_light);
+ }
+
+ // Set the title.
+ dialogBuilder.setTitle(R.string.font_size);
+
+ // Set the view. The parent view is null because it will be assigned by the alert dialog.
+ dialogBuilder.setView(activity.getLayoutInflater().inflate(R.layout.font_size_dialog, null));
+
+ // Set the close button listener. Using `null` as the listener closes the dialog without doing anything else.
+ dialogBuilder.setNegativeButton(R.string.close, null);
+
+ // Set the apply button listener.
+ dialogBuilder.setPositiveButton(R.string.apply, (DialogInterface dialog, int which) -> {
+ // Return the dialog fragment to the parent activity.
+ updateFontSizeListener.onApplyNewFontSize(this);
+ });
+
+ // Create an alert dialog from the builder.
+ AlertDialog alertDialog = dialogBuilder.create();
+
+ // Get the alert dialog window.
+ Window dialogWindow = alertDialog.getWindow();
+
+ // Remove the incorrect lint warning below that the dialog window might be null.
+ assert dialogWindow != null;
+
+ // Disable screenshots if not allowed.
+ if (!allowScreenshots) {
+ dialogWindow.addFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ }
+
+ // Display the keyboard.
+ dialogWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
+
+ // The alert dialog must be shown before items in the layout can be modified.
+ alertDialog.show();
+
+ // Get a handle for the font size edit text.
+ EditText fontSizeEditText = alertDialog.findViewById(R.id.font_size_edittext);
+
+ // Display the current font size.
+ fontSizeEditText.setText(String.valueOf(currentFontSize));
+
+ // Request focus on the font size edit text.
+ fontSizeEditText.requestFocus();
+
+ // Set the enter key on the keyboard to update the font size.
+ fontSizeEditText.setOnKeyListener((View view, int keyCode, KeyEvent keyEvent) -> {
+ // If the key event is a key-down on the `enter` key apply the new font size.
+ if ((keyEvent.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // The enter key was pressed.
+ // Trigger the update font size listener and return the dialog fragment to the parent activity.
+ updateFontSizeListener.onApplyNewFontSize((this));
+
+ // Manually dismiss the alert dialog.
+ alertDialog.dismiss();
+
+ //Consume the event.
+ return true;
+ } else { // If any other key was pressed do not consume the event.
+ return false;
+ }
+ });
+
+ // Return the alert dialog.
+ return alertDialog;
+ }
+}
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.Window;
import android.view.WindowManager;
import android.webkit.HttpAuthHandler;
import android.widget.EditText;
// Create an alert dialog from the alert dialog builder.
final AlertDialog alertDialog = dialogBuilder.create();
- // Remove the warning below that `getWindow()` might be null.
- assert alertDialog.getWindow() != null;
+ // Get the alert dialog window.
+ Window dialogWindow = alertDialog.getWindow();
+
+ // Remove the incorrect lint warning below that the dialog window might be null.
+ assert dialogWindow != null;
// Disable screenshots if not allowed.
if (!allowScreenshots) {
alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
- // Show the keyboard when the alert dialog is displayed on the screen.
- alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+ // Display the keyboard.
+ dialogWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
// The alert dialog needs to be shown before the contents can be modified.
alertDialog.show();
void onMoveToFolder(DialogFragment dialogFragment);
}
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
private Date currentSslEndDate;
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
}
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
-import android.preference.PreferenceManager;
import android.provider.DocumentsContract;
import android.text.Editable;
import android.text.TextWatcher;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
+import androidx.preference.PreferenceManager;
import com.stoutner.privacybrowser.R;
import com.stoutner.privacybrowser.activities.MainWebViewActivity;
}
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
@Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
+ // Get a handle for the activity and the context.
+ Activity activity = getActivity();
+ Context context = getContext();
+
+ // Remove the incorrect lint warnings below that the activity and context might be null.
+ assert activity != null;
+ assert context != null;
+
// Get a handle for the shared preferences.
- SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
// Get the screenshot and theme preferences.
boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
// Use an alert dialog builder to create the alert dialog.
AlertDialog.Builder dialogBuilder;
- // Get a handle for the activity.
- Activity activity = getActivity();
-
- // Remove the incorrect lint warning below that the activity might be null.
- assert activity != null;
-
- // Set the style according to the theme.
+ // Set the style and icon according to the theme.
if (darkTheme) {
dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogDark);
+ dialogBuilder.setIcon(R.drawable.images_enabled_dark);
} else {
dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogLight);
+ dialogBuilder.setIcon(R.drawable.images_enabled_light);
}
// Set the title.
dialogBuilder.setTitle(R.string.save_image);
- // Set the icon according to the theme.
- if (darkTheme) {
- dialogBuilder.setIcon(R.drawable.images_enabled_dark);
- } else {
- dialogBuilder.setIcon(R.drawable.images_enabled_light);
- }
-
// Set the view. The parent view is null because it will be assigned by the alert dialog.
dialogBuilder.setView(activity.getLayoutInflater().inflate(R.layout.save_dialog, null));
- // Set the cancel button listener.
- dialogBuilder.setNegativeButton(R.string.cancel, (DialogInterface dialog, int which) -> {
- // Do nothing. The alert dialog will close automatically.
- });
+ // Set the cancel button listener. Using `null` as the listener closes the dialog without doing anything else.
+ dialogBuilder.setNegativeButton(R.string.cancel, null);
// Set the save button listener.
dialogBuilder.setPositiveButton(R.string.save, (DialogInterface dialog, int which) -> {
// Create an alert dialog from the builder.
AlertDialog alertDialog = dialogBuilder.create();
- // Remove the incorrect lint warning below that `getWindows()` might be null.
+ // Remove the incorrect lint warning below that `getWindow()` might be null.
assert alertDialog.getWindow() != null;
// Disable screenshots if not allowed.
// Create a string for the default file path.
String defaultFilePath;
- // Get a handle for the context.
- Context context = getContext();
-
- // Remove the incorrect lint warning that context might be null.
- assert context != null;
-
// Set the default file path according to the storage permission state.
if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { // The storage permission has been granted.
// Set the default file path to use the external public directory.
}
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
private NavigateHistoryListener navigateHistoryListener;
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
void onNext(int id);
}
- // `viewRequestListener` is used in `onAttach()` and `onCreateDialog()`.
+ // The view request listener is used in `onAttach()` and `onCreateDialog()`.
private ViewRequestListener viewRequestListener;
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
package com.stoutner.privacybrowser.dialogs;
import android.annotation.SuppressLint;
+import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
+import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.net.http.SslCertificate;
import android.os.Bundle;
-import android.preference.PreferenceManager;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <=22.
+import androidx.preference.PreferenceManager;
import com.stoutner.privacybrowser.activities.MainWebViewActivity;
import com.stoutner.privacybrowser.R;
return viewSslCertificateDialog;
}
+ @Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
- // Remove the incorrect lint warning below that the activity might be null.
- assert getActivity() != null;
+ // Get a handle for the activity and the context.
+ Activity activity = getActivity();
+ Context context = getContext();
+
+ // Remove the incorrect lint warnings below that the activity and context might be null.
+ assert activity != null;
+ assert context != null;
// Get the activity's layout inflater.
- LayoutInflater layoutInflater = getActivity().getLayoutInflater();
+ LayoutInflater layoutInflater = activity.getLayoutInflater();
// Get the arguments.
Bundle arguments = getArguments();
- // Remove the incorrect lint warning below that `getArguments().getLong()` might be null.
+ // Remove the incorrect lint warning below that `getLong()` might be null.
assert arguments != null;
// Get the current position of this WebView fragment.
// Get a handle for the current WebView.
NestedScrollWebView nestedScrollWebView = fragmentView.findViewById(R.id.nestedscroll_webview);
+
// Use a builder to create the alert dialog.
AlertDialog.Builder dialogBuilder;
// Get a handle for the shared preferences.
- SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
// Get the screenshot and theme preferences.
boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
// Set the style according to the theme.
if (darkTheme) {
- dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
+ dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogDark);
} else {
- dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
+ dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogLight);
}
// Create a drawable version of the favorite icon.
// Set the icon.
dialogBuilder.setIcon(favoriteIconDrawable);
- // Set a listener on the negative button. Using `null` as the listener closes the dialog without doing anything else.
+ // Set the close button listener. Using `null` as the listener closes the dialog without doing anything else.
dialogBuilder.setNegativeButton(R.string.close, null);
// Get the SSL certificate.
SpannableStringBuilder endDateStringBuilder = new SpannableStringBuilder(endDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(endDate));
// Create a red foreground color span. The deprecated `getColor` must be used until the minimum API >= 23.
- @SuppressWarnings("deprecation") ForegroundColorSpan redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_a700));
+ ForegroundColorSpan redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_a700));
// Create a blue foreground color span.
ForegroundColorSpan blueColorSpan;
// Set the blue color span according to the theme. The deprecated `getColor()` must be used until the minimum API >= 23.
if (darkTheme) {
- //noinspection deprecation
blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400));
} else {
- //noinspection deprecation
blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_700));
}
TextView userAgentTextView = domainSettingsView.findViewById(R.id.user_agent_textview);
EditText customUserAgentEditText = domainSettingsView.findViewById(R.id.custom_user_agent_edittext);
Spinner fontSizeSpinner = domainSettingsView.findViewById(R.id.font_size_spinner);
- TextView fontSizeTextView = domainSettingsView.findViewById(R.id.font_size_textview);
+ TextView defaultFontSizeTextView = domainSettingsView.findViewById(R.id.default_font_size_textview);
+ EditText customFontSizeEditText = domainSettingsView.findViewById(R.id.custom_font_size_edittext);
ImageView swipeToRefreshImageView = domainSettingsView.findViewById(R.id.swipe_to_refresh_imageview);
Spinner swipeToRefreshSpinner = domainSettingsView.findViewById(R.id.swipe_to_refresh_spinner);
TextView swipeToRefreshTextView = domainSettingsView.findViewById(R.id.swipe_to_refresh_textview);
// Create array adapters for the spinners.
ArrayAdapter<CharSequence> translatedUserAgentArrayAdapter = ArrayAdapter.createFromResource(context, R.array.translated_domain_settings_user_agent_names, R.layout.spinner_item);
- ArrayAdapter<CharSequence> fontSizeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_font_size_entries, R.layout.spinner_item);
- ArrayAdapter<CharSequence> fontSizeEntryValuesArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_font_size_entry_values, R.layout.spinner_item);
+ ArrayAdapter<CharSequence> fontSizeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.font_size_array, R.layout.spinner_item);
ArrayAdapter<CharSequence> swipeToRefreshArrayAdapter = ArrayAdapter.createFromResource(context, R.array.swipe_to_refresh_array, R.layout.spinner_item);
ArrayAdapter<CharSequence> nightModeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.night_mode_array, R.layout.spinner_item);
ArrayAdapter<CharSequence> wideViewportArrayAdapter = ArrayAdapter.createFromResource(context, R.array.wide_viewport_array, R.layout.spinner_item);
userAgentSpinner.performClick();
});
- // Set the selected font size.
- int fontSizeArrayPosition = fontSizeEntryValuesArrayAdapter.getPosition(String.valueOf(fontSizeInt));
- fontSizeSpinner.setSelection(fontSizeArrayPosition);
+ // Display the font size settings.
+ if (fontSizeInt == 0) { // `0` is the code for system default font size.
+ // Set the font size to the system default
+ fontSizeSpinner.setSelection(0);
- // Set the default font size text.
- int defaultFontSizeArrayPosition = fontSizeEntryValuesArrayAdapter.getPosition(defaultFontSizeString);
- fontSizeTextView.setText(fontSizeArrayAdapter.getItem(defaultFontSizeArrayPosition));
+ // Show the default font size text view.
+ defaultFontSizeTextView.setVisibility(View.VISIBLE);
- // Set the display options for the font size TextView.
- if (fontSizeArrayPosition == 0) { // System default font size is selected. Display `fontSizeTextView`.
- fontSizeTextView.setVisibility(View.VISIBLE);
- } else { // A custom font size is specified. Hide `fontSizeTextView`.
- fontSizeTextView.setVisibility(View.GONE);
+ // Hide the custom font size edit text.
+ customFontSizeEditText.setVisibility(View.GONE);
+
+ // Set the default font size as the text of the custom font size edit text. This way, if the user switches to custom it will already be populated.
+ customFontSizeEditText.setText(defaultFontSizeString);
+ } else { // A custom font size is selected.
+ // Set the spinner to the custom font size.
+ fontSizeSpinner.setSelection(1);
+
+ // Hide the default font size text view.
+ defaultFontSizeTextView.setVisibility(View.GONE);
+
+ // Show the custom font size edit text.
+ customFontSizeEditText.setVisibility(View.GONE);
+
+ // Set the custom font size.
+ customFontSizeEditText.setText(String.valueOf(fontSizeInt));
}
- // Open the font size spinner when the TextView is clicked.
- fontSizeTextView.setOnClickListener((View v) -> {
+ // Initialize the default font size percentage string.
+ String defaultFontSizePercentageString = defaultFontSizeString + "%";
+
+ // Set the default font size text in the text view.
+ defaultFontSizeTextView.setText(defaultFontSizePercentageString);
+
+ // Open the font size spinner when the text view is clicked.
+ defaultFontSizeTextView.setOnClickListener((View v) -> {
// Open the user agent spinner.
fontSizeSpinner.performClick();
});
fontSizeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- // Update the display options for `fontSizeTextView`.
- if (position == 0) { // System default font size has been selected. Display `fontSizeTextView`.
- fontSizeTextView.setVisibility(View.VISIBLE);
- } else { // A custom font size has been selected. Hide `fontSizeTextView`.
- fontSizeTextView.setVisibility(View.GONE);
+ // Update the font size display options.
+ if (position == 0) { // The system default font size has been selected.
+ // Show the default font size text view.
+ defaultFontSizeTextView.setVisibility(View.VISIBLE);
+
+ // Hide the custom font size edit text.
+ customFontSizeEditText.setVisibility(View.GONE);
+ } else { // A custom font size has been selected.
+ // Hide the default font size text view.
+ defaultFontSizeTextView.setVisibility(View.GONE);
+
+ // Show the custom font size edit text.
+ customFontSizeEditText.setVisibility(View.VISIBLE);
}
}
package com.stoutner.privacybrowser.fragments;
import android.annotation.SuppressLint;
+import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.webkit.WebView;
import android.widget.ArrayAdapter;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceFragmentCompat;
+
import com.stoutner.privacybrowser.R;
import com.stoutner.privacybrowser.activities.MainWebViewActivity;
-public class SettingsFragment extends PreferenceFragment {
+public class SettingsFragment extends PreferenceFragmentCompat {
+ // Define the class variables.
private SharedPreferences.OnSharedPreferenceChangeListener preferencesListener;
private SharedPreferences savedPreferences;
@Override
- public void onCreate(Bundle savedInstanceState) {
- // Run the default commands.
- super.onCreate(savedInstanceState);
-
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
// Load the preferences from the XML file.
- addPreferencesFromResource(R.xml.preferences);
+ setPreferencesFromResource(R.xml.preferences, rootKey);
+
+ // Get a handle for the activity.
+ Activity activity = getActivity();
+
+ // Remove the lint warning below that `getApplicationContext()` might produce a null pointer exception.
+ assert activity != null;
// Get a handle for the context.
- Context context = getActivity().getApplicationContext();
+ Context context = activity.getApplicationContext();
// Initialize savedPreferences.
savedPreferences = getPreferenceScreen().getSharedPreferences();
Preference wideViewportPreference = findPreference("wide_viewport");
Preference displayWebpageImagesPreference = findPreference("display_webpage_images");
+ // Remove the lint warnings below that the preferences might be null.
+ assert javaScriptPreference != null;
+ assert firstPartyCookiesPreference != null;
+ assert thirdPartyCookiesPreference != null;
+ assert domStoragePreference != null;
+ assert formDataPreference != null;
+ assert userAgentPreference != null;
+ assert customUserAgentPreference != null;
+ assert incognitoModePreference != null;
+ assert doNotTrackPreference != null;
+ assert allowScreenshotsPreference != null;
+ assert easyListPreference != null;
+ assert easyPrivacyPreference != null;
+ assert fanboyAnnoyanceListPreference != null;
+ assert fanboySocialBlockingListPreference != null;
+ assert ultraListPreference != null;
+ assert ultraPrivacyPreference != null;
+ assert blockAllThirdPartyRequestsPreference != null;
+ assert googleAnalyticsPreference != null;
+ assert facebookClickIdsPreference != null;
+ assert twitterAmpRedirectsPreference != null;
+ assert proxyThroughOrbotPreference != null;
+ assert torHomepagePreference != null;
+ assert torSearchPreference != null;
+ assert torSearchCustomURLPreference != null;
+ assert searchPreference != null;
+ assert searchCustomURLPreference != null;
+ assert fullScreenBrowsingModePreference != null;
+ assert hideAppBarPreference != null;
+ assert clearEverythingPreference != null;
+ assert clearCookiesPreference != null;
+ assert clearDomStoragePreference != null;
+ assert clearFormDataPreference != null;
+ assert clearCachePreference != null;
+ assert homepagePreference != null;
+ assert fontSizePreference != null;
+ assert openIntentsInNewTabPreference != null;
+ assert swipeToRefreshPreference != null;
+ assert scrollAppBarPreference != null;
+ assert displayAdditionalAppBarIconsPreference != null;
+ assert downloadWithExternalAppPreference != null;
+ assert darkThemePreference != null;
+ assert nightModePreference != null;
+ assert wideViewportPreference != null;
+ assert displayWebpageImagesPreference != null;
+
// Set dependencies.
torHomepagePreference.setDependency("proxy_through_orbot");
torSearchPreference.setDependency("proxy_through_orbot");
// Remove the form data preferences if the API is >= 26 as they no longer do anything.
if (Build.VERSION.SDK_INT >= 26) {
// Get the categories.
- PreferenceCategory privacyCategory = (PreferenceCategory) findPreference("privacy");
- PreferenceCategory clearAndExitCategory = (PreferenceCategory) findPreference("clear_and_exit");
+ PreferenceCategory privacyCategory = findPreference("privacy");
+ PreferenceCategory clearAndExitCategory = findPreference("clear_and_exit");
+
+ // Remove the lint warnings below that the preference categories might be null.
+ assert privacyCategory != null;
+ assert clearAndExitCategory != null;
// Remove the form data preferences.
privacyCategory.removePreference(formDataPreference);
homepagePreference.setSummary(savedPreferences.getString("homepage", getString(R.string.homepage_default_value)));
// Set the font size as the summary text for the preference.
- fontSizePreference.setSummary(savedPreferences.getString("font_size", getString(R.string.font_size_default_value)) + "%%");
+ fontSizePreference.setSummary(savedPreferences.getString("font_size", getString(R.string.font_size_default_value)) + "%");
// Disable the JavaScript preference if Night Mode is enabled. JavaScript will be enabled for all web pages.
javaScriptPreference.setEnabled(!nightMode);
case "font_size":
// Update the font size summary text.
- fontSizePreference.setSummary(sharedPreferences.getString("font_size", getString(R.string.font_size_default_value)) + "%%");
+ fontSizePreference.setSummary(sharedPreferences.getString("font_size", getString(R.string.font_size_default_value)) + "%");
break;
case "open_intents_in_new_tab":
private NewTabListener newTabListener;
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
// Run the default commands.
super.onAttach(context);
android:layout_width="match_parent"
android:hint="@string/bookmark_url"
android:imeOptions="actionGo"
- android:inputType="textUri" />
+ android:inputType="textUri"
+ android:selectAllOnFocus="true" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
android:layout_marginEnd="60dp"
android:inputType="textUri"
android:hint="@string/custom_user_agent"
- android:importantForAutofill="no"
- tools:targetApi="26" />
+ android:importantForAutofill="no" />
</LinearLayout>
<!-- Font Size. -->
</LinearLayout>
<TextView
- android:id="@+id/font_size_textview"
+ android:id="@+id/default_font_size_textview"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_marginStart="45dp"
android:layout_marginEnd="36dp"
android:textSize="13sp" />
+ <EditText
+ android:id="@+id/custom_font_size_edittext"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_marginStart="40dp"
+ android:layout_marginEnd="60dp"
+ android:inputType="number"
+ android:hint="@string/font_size"
+ android:importantForAutofill="no" />
</LinearLayout>
<!-- Swipe to Refresh. -->
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ Copyright © 2019 Soren Stoutner <soren@stoutner.com>.
+
+ This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+
+ Privacy Browser is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Privacy Browser is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Privacy Browser. If not, see <http://www.gnu.org/licenses/>. -->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:orientation="horizontal" >
+
+ <EditText
+ android:id="@+id/font_size_edittext"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_marginStart="10dp"
+ android:layout_marginEnd="10dp"
+ android:hint="@string/font_size"
+ android:importantForAutofill="no"
+ android:inputType="number"
+ android:selectAllOnFocus="true" >
+ </EditText>
+</LinearLayout>
\ No newline at end of file
android:layout_width="wrap_content"
android:layout_marginTop="12dp"
android:layout_gravity="center_horizontal"
- android:textSize="24sp"
+ android:textSize="26sp"
android:textStyle="bold" />
<TextView
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:layout_marginStart="4dp"
- android:layout_marginEnd="4dp" />
+ android:layout_marginEnd="4dp"
+ android:textSize="16sp"
+ android:textColor="?android:textColorPrimary" />
<!-- The `TextInputLayout` makes the `android:hint` float above the `EditText`. -->
<com.google.android.material.textfield.TextInputLayout
</menu>
</item>
- <item
- android:id="@+id/font_size"
- android:title="@string/font_size"
- android:orderInCategory="930"
- app:showAsAction="never" >
-
- <menu>
- <group android:checkableBehavior="single">
- <item
- android:id="@+id/font_size_twenty_five_percent"
- android:title="@string/twenty_five_percent"
- android:orderInCategory="931"
- app:showAsAction="never" />
-
- <item
- android:id="@+id/font_size_fifty_percent"
- android:title="@string/fifty_percent"
- android:orderInCategory="932"
- app:showAsAction="never" />
-
- <item
- android:id="@+id/font_size_seventy_five_percent"
- android:title="@string/seventy_five_percent"
- android:orderInCategory="933"
- app:showAsAction="never" />
-
- <item
- android:id="@+id/font_size_one_hundred_percent"
- android:title="@string/one_hundred_percent"
- android:orderInCategory="934"
- app:showAsAction="never" />
-
- <item
- android:id="@+id/font_size_one_hundred_twenty_five_percent"
- android:title="@string/one_hundred_twenty_five_percent"
- android:orderInCategory="935"
- app:showAsAction="never" />
-
- <item
- android:id="@+id/font_size_one_hundred_fifty_percent"
- android:title="@string/one_hundred_fifty_percent"
- android:orderInCategory="936"
- app:showAsAction="never" />
-
- <item
- android:id="@+id/font_size_one_hundred_seventy_five_percent"
- android:title="@string/one_hundred_seventy_five_percent"
- android:orderInCategory="937"
- app:showAsAction="never" />
-
- <item
- android:id="@+id/font_size_two_hundred_percent"
- android:title="@string/two_hundred_percent"
- android:orderInCategory="938"
- app:showAsAction="never" />
- </group>
- </menu>
- </item>
-
<item
android:id="@+id/swipe_to_refresh"
android:title="@string/swipe_to_refresh_options_menu"
- android:orderInCategory="940"
+ android:orderInCategory="930"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/wide_viewport"
android:title="@string/wide_viewport"
- android:orderInCategory="950"
+ android:orderInCategory="940"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/display_images"
android:title="@string/display_images"
- android:orderInCategory="960"
+ android:orderInCategory="950"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/night_mode"
android:title="@string/options_night_mode"
- android:orderInCategory="970"
+ android:orderInCategory="960"
android:checkable="true"
app:showAsAction="never" />
+ <item
+ android:id="@+id/font_size"
+ android:title="@string/font_size"
+ android:orderInCategory="970"
+ app:showAsAction="never" >
+ </item>
+
<item
android:id="@+id/find_on_page"
android:title="@string/find_on_page"
<string name="user_agent_internet_explorer_on_windows">Internet Explorer auf Windows</string>
<string name="user_agent_safari_on_macos">Safari auf macOS</string>
<string name="user_agent_custom">Eigener</string>
- <string name="font_size">Schriftgröße</string>
- <string name="twenty_five_percent">25%</string>
- <string name="fifty_percent">50%</string>
- <string name="seventy_five_percent">75%</string>
- <string name="one_hundred_percent">100%</string>
- <string name="one_hundred_twenty_five_percent">125%</string>
- <string name="one_hundred_fifty_percent">150%</string>
- <string name="one_hundred_seventy_five_percent">175%</string>
- <string name="two_hundred_percent">200%</string>
<string name="swipe_to_refresh_options_menu">Herunterziehen zum aktualisieren</string>
<string name="wide_viewport">Breiter Anzeigebereich</string>
<string name="display_images">Bilder anzeigen</string>
<string name="options_night_mode">Nacht-Modus</string>
+ <string name="font_size">Schriftgröße</string>
<string name="find_on_page">Auf Seite finden</string>
<string name="print">Drucken</string>
<string name="privacy_browser_web_page">Privacy Browser-Website</string>
<!-- Context Menus. -->
<string name="open_in_new_tab">In neuem Tab öffnen</string>
+ <string name="open_in_background">Im Hintergrund öffnen</string>
<string name="open_image_in_new_tab">Grafik in neuem Tab öffnen</string>
<string name="copy_url">URL kopieren</string>
<string name="download_url">Download URL</string>
<string name="domain_name">Domainname</string>
<string name="domain_deleted">Domain gelöscht</string>
<string name="domain_name_instructions">*. kann als Wildcard-Subdomain verwendet werden (z.B. *.stoutner.com)</string>
+ <string-array name="font_size_array">
+ <item>Standardeinstellung</item>
+ <item>Custom font size</item>
+ </string-array>
<string-array name="swipe_to_refresh_array">
<item>Standardeinstellung</item>
<item>Herunterziehen zum aktualisieren aktiviert</item>
<string name="file_location">Datei-Ordner</string>
<string name="browse">durchsuchen</string>
<string name="export">exportieren</string>
- <string name="import_button">importieren</string> <!-- `import` is a reserved word and cannot be used as the name -->
+ <string name="import_button">importieren</string> <!-- `import` is a reserved word and cannot be used as the name. -->
<string name="decrypt">entschlüsseln</string>
<string name="export_successful">Export erfolgreich.</string>
<string name="export_failed">Export fehlgeschlagen:</string>
<string name="cannot_use_location">Dieser Ordner kann nicht genutzt werden, da die Speicher-Berechtigung nicht erteilt wurde.</string>
<!-- Logcat. -->
- <string name="copy">kopieren</string>
+ <string name="copy_string">kopieren</string> <!-- `copy` is a reserved word and should not be used as the name. -->
<string name="logcat_copied">Logcat kopiert.</string>
<string name="clear">leeren</string>
<string name="save_logcat">Logcat speichern</string>
<string name="general">Allgemein</string>
<string name="homepage">Startseite</string>
<string name="font_size_preference">Schriftgröße</string>
- <string-array name="font_size_entries">
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
- <string-array name="domain_settings_font_size_entries">
- <item>Standardeinstellung</item>
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
<string name="open_intents_in_new_tab">Intents in neuem Tab öffnen</string>
<string name="open_intents_in_new_tab_summary">Intents sind Links, die von anderen Apps übergeben werden.</string>
<string name="swipe_to_refresh">Herunterziehen zum Aktualisieren</string>
<string name="user_agent_internet_explorer_on_windows">Internet Explorer en Windows</string>
<string name="user_agent_safari_on_macos">Safari en macOS</string>
<string name="user_agent_custom">Personalizado</string>
- <string name="font_size">Tamaño de fuente</string>
- <string name="twenty_five_percent">25%</string>
- <string name="fifty_percent">50%</string>
- <string name="seventy_five_percent">75%</string>
- <string name="one_hundred_percent">100%</string>
- <string name="one_hundred_twenty_five_percent">125%</string>
- <string name="one_hundred_fifty_percent">150%</string>
- <string name="one_hundred_seventy_five_percent">175%</string>
- <string name="two_hundred_percent">200%</string>
<string name="swipe_to_refresh_options_menu">Deslizar para actualizar</string>
<string name="wide_viewport">Vista amplia</string>
<string name="display_images">Mostrar imágenes</string>
+ <string name="options_night_mode">Modo noche</string>
+ <string name="font_size">Tamaño de fuente</string>
+ <string name="find_on_page">Buscar en página</string>
<string name="print">Imprimir</string>
<string name="privacy_browser_web_page">Página web de Navegador Privado</string>
<string name="save_as_image">Guardar como imagen</string>
<string name="add_to_home_screen">Añadir a la ventana de inicio</string>
- <string name="options_night_mode">Modo noche</string>
- <string name="find_on_page">Buscar en página</string>
<string name="view_source">Ver la fuente</string>
<string name="share">Compartir</string>
<string name="share_url">Compartir URL</string>
<!-- Context Menus. -->
<string name="open_in_new_tab">Abrir en nueva pestaña</string>
+ <string name="open_in_background">Abrir en segundo plano</string>
<string name="open_image_in_new_tab">Abrir imagen en nueva pestaña</string>
<string name="copy_url">Copiar URL</string>
<string name="download_url">Descargar URL</string>
<string name="domain_name">Nombre de dominio</string>
<string name="domain_deleted">Dominio borrado</string>
<string name="domain_name_instructions">*. puede ser añadido a un dominio para incluir todos los subdominios (p.ej. *.stoutner.com)</string>
+ <string-array name="font_size_array">
+ <item>Por defecto del sistema</item>
+ <item>Custom font size</item>
+ </string-array>
<string-array name="swipe_to_refresh_array">
<item>Por defecto del sistema</item>
<item>Deslizar para actualizar habilitado</item>
<string name="file_location">Ubicación del archivo</string>
<string name="browse">Navegar</string>
<string name="export">Exportar</string>
- <string name="import_button">Importar</string> <!-- `import` is a reserved word and cannot be used as the name -->
+ <string name="import_button">Importar</string> <!-- `import` is a reserved word and cannot be used as the name. -->
<string name="decrypt">Descifrar</string>
<string name="export_successful">Exportación exitosa.</string>
<string name="export_failed">Exportación fallida:</string>
<string name="cannot_use_location">Esta ubicación no se puede utilizar porque no se ha concedido el permiso de almacenamiento.</string>
<!-- Logcat. -->
- <string name="copy">Copiar</string>
+ <string name="copy_string">Copiar</string> <!-- `copy` is a reserved word and should not be used as the name. -->
<string name="logcat_copied">Logcat copiado.</string>
<string name="clear">Borrar</string>
<string name="save_logcat">Guardar logcat</string>
<string name="general">General</string>
<string name="homepage">Página de inicio</string>
<string name="font_size_preference">Tamaño de fuente</string>
- <string-array name="font_size_entries">
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
- <string-array name="domain_settings_font_size_entries">
- <item>Por defecto del sistema</item>
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
<string name="open_intents_in_new_tab">Abrir contenido en nueva pestaña</string>
<string name="open_intents_in_new_tab_summary">Los contenidos son enlaces enviados desde otras apps.</string>
<string name="swipe_to_refresh">Deslizar para actualizar</string>
<string name="user_agent_internet_explorer_on_windows">Internet Explorer sous Windows</string>
<string name="user_agent_safari_on_macos">Safari sous macOS</string>
<string name="user_agent_custom">Personnalisé</string>
- <string name="font_size">Police</string>
- <string name="twenty_five_percent">25%</string>
- <string name="fifty_percent">50%</string>
- <string name="seventy_five_percent">75%</string>
- <string name="one_hundred_percent">100%</string>
- <string name="one_hundred_twenty_five_percent">125%</string>
- <string name="one_hundred_fifty_percent">150%</string>
- <string name="one_hundred_seventy_five_percent">175%</string>
- <string name="two_hundred_percent">200%</string>
<string name="swipe_to_refresh_options_menu">Glisser pour actualiser</string>
<string name="wide_viewport">Fenêtre large</string>
<string name="display_images">Afficher les images</string>
<string name="options_night_mode">Mode nuit</string>
+ <string name="font_size">Police</string>
<string name="find_on_page">Chercher sur la page</string>
<string name="print">Imprimer</string>
<string name="privacy_browser_web_page">Site Web de Privacy Browser</string>
<!-- Context Menus. -->
<string name="open_in_new_tab">Ouvrir dans un nouvel onglet</string>
+ <string name="open_in_background">Ouvrir en arrière-plan</string>
<string name="open_image_in_new_tab">Ouvrir l\'image dans un nouvel onglet</string>
<string name="copy_url">Copier l\'URL</string>
<string name="download_url">Télécharger la cible</string>
<string name="domain_name">Nom de demaine</string>
<string name="domain_deleted">Domaine supprimé</string>
<string name="domain_name_instructions">Faire précéder par *. pour inclure l\'ensemble des sous-domaines (ex. *.stoutner.com)</string>
+ <string-array name="font_size_array">
+ <item>Réglages systèmes</item>
+ <item>Custom font size</item>
+ </string-array>
<string-array name="swipe_to_refresh_array">
<item>Réglages systèmes</item>
<item>Glisser pour actualiser activé</item>
<string name="file_location">Emplacement du fichier</string>
<string name="browse">Parcourir</string>
<string name="export">Exporter</string>
- <string name="import_button">Importer</string> <!-- `import` is a reserved word and cannot be used as the name -->
+ <string name="import_button">Importer</string> <!-- `import` is a reserved word and cannot be used as the name. -->
<string name="decrypt">Déchiffrer</string>
<string name="export_successful">Export effectué.</string>
<string name="export_failed">L\'export a échoué :</string>
<string name="cannot_use_location">Ce dossier ne peut pas être utilisé car les droits d\'accès au stockage n\'ont pas été autorisés.</string>
<!-- Logcat. -->
- <string name="copy">Copie</string>
+ <string name="copy_string">Copie</string> <!-- `copy` is a reserved word and should not be used as the name. -->
<string name="logcat_copied">Journal système copié.</string>
<string name="clear">Vider</string>
<string name="save_logcat">Sauvegarder le journal système</string>
<string name="general">General</string>
<string name="homepage">Page d\'accueil</string>
<string name="font_size_preference">Zoom</string>
- <string-array name="font_size_entries">
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
- <string-array name="domain_settings_font_size_entries">
- <item>Par défaut</item>
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
<string name="open_intents_in_new_tab">Intentions dans un nouvel onglet</string>
<string name="open_intents_in_new_tab_summary">Les intentions sont des liens envoyés à partir d\'autres applications.</string>
<string name="swipe_to_refresh">Glisser pour rafraîchir</string>
<string name="user_agent_internet_explorer_on_windows">Internet Explorer su Windows</string>
<string name="user_agent_safari_on_macos">Safari su macOS</string>
<string name="user_agent_custom">Personalizzato</string>
- <string name="font_size">Dimensione font</string>
- <string name="twenty_five_percent">25%</string>
- <string name="fifty_percent">50%</string>
- <string name="seventy_five_percent">75%</string>
- <string name="one_hundred_percent">100%</string>
- <string name="one_hundred_twenty_five_percent">125%</string>
- <string name="one_hundred_fifty_percent">150%</string>
- <string name="one_hundred_seventy_five_percent">175%</string>
- <string name="two_hundred_percent">200%</string>
<string name="swipe_to_refresh_options_menu">Swipe per aggiornare</string>
<string name="wide_viewport">Finestra grande</string>
<string name="display_images">Mostra immagini</string>
<string name="options_night_mode">Modalità Notte</string>
+ <string name="font_size">Dimensione font</string>
<string name="find_on_page">Cerca nella pagina</string>
<string name="print">Stampa</string>
<string name="privacy_browser_web_page">Pagina web di Privacy Browser</string>
<!-- Context Menus. -->
<string name="open_in_new_tab">Apri in una nuova Scheda</string>
+ <string name="open_in_background">Apri in Background</string>
<string name="open_image_in_new_tab">Apri l\'immagine in una nuova scheda</string>
<string name="copy_url">Copia URL</string>
<string name="download_url">Scarica URL</string>
<string name="domain_name">Nome del Dominio</string>
<string name="domain_deleted">Dominio Eliminato</string>
<string name="domain_name_instructions">è possibile anteporre *. a un dominio per includere tutti i sottodomini (es. *.stoutner.com)</string>
+ <string-array name="font_size_array">
+ <item>Impostazioni di default</item>
+ <item>Custom font size</item>
+ </string-array>
<string-array name="swipe_to_refresh_array">
<item>Impostazioni di default</item>
<item>Swipe per aggiornare abilitato</item>
<string name="file_location">Posizione del File</string>
<string name="browse">Sfoglia</string>
<string name="export">Esporta</string>
- <string name="import_button">Importa</string> <!-- `import` is a reserved word and cannot be used as the name -->
+ <string name="import_button">Importa</string> <!-- `import` is a reserved word and cannot be used as the name. -->
<string name="decrypt">Decripta</string>
<string name="export_successful">Esportazione riuscita</string>
<string name="export_failed">Esportazione fallita:</string>
<string name="cannot_use_location">Questa posizione non può essere utilizzata perché non è stato concesso il permesso di scrittura in memoria.</string>
<!-- Logcat. -->
- <string name="copy">Copia</string>
+ <string name="copy_string">Copia</string> <!-- `copy` is a reserved word and should not be used as the name. -->
<string name="logcat_copied">Logcat copiato.</string>
<string name="clear">Cancella</string>
<string name="save_logcat">Salva il log</string>
<string name="general">Generale</string>
<string name="homepage">Homepage</string>
<string name="font_size_preference">Dimensione font</string>
- <string-array name="font_size_entries">
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
- <string-array name="domain_settings_font_size_entries">
- <item>Impostazioni di default</item>
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
<string name="open_intents_in_new_tab">Apri gli intenti in una nuova scheda</string>
<string name="open_intents_in_new_tab_summary">Gli intenti sono link inviati da altre app.</string>
<string name="swipe_to_refresh">Swipe per aggiornare</string>
<string name="user_agent_internet_explorer_on_windows">Internet Explorer на Windows</string>
<string name="user_agent_safari_on_macos">Safari на macOS</string>
<string name="user_agent_custom">Настраиваемый</string>
- <string name="font_size">Размер шрифта</string>
- <string name="twenty_five_percent">25%</string>
- <string name="fifty_percent">50%</string>
- <string name="seventy_five_percent">75%</string>
- <string name="one_hundred_percent">100%</string>
- <string name="one_hundred_twenty_five_percent">125%</string>
- <string name="one_hundred_fifty_percent">150%</string>
- <string name="one_hundred_seventy_five_percent">175%</string>
- <string name="two_hundred_percent">200%</string>
<string name="swipe_to_refresh_options_menu">Потянуть для обновления</string>
<string name="wide_viewport">Широкий вид просмотра</string>
<string name="display_images">Показывать изображения</string>
<string name="options_night_mode">Ночной режим</string>
+ <string name="font_size">Размер шрифта</string>
<string name="find_on_page">Найти на странице</string>
<string name="print">Печать</string>
<string name="privacy_browser_web_page">Privacy Browser веб-страница</string>
<!-- Context Menus. -->
<string name="open_in_new_tab">Открыть в новой вкладке</string>
+ <string name="open_in_background">Открыть в фоне</string>
<string name="open_image_in_new_tab">Открыть изображение в новой вкладке</string>
<string name="copy_url">Копировать URL</string>
<string name="download_url">Загрузить URL</string>
<string name="domain_name">Имя домена</string>
<string name="domain_deleted">Домен удален</string>
<string name="domain_name_instructions">добавьте *. для включения всех поддоменов (напр. *.stoutner.com)</string>
+ <string-array name="font_size_array">
+ <item>Настройки по умолчанию</item>
+ <item>Custom font size</item>
+ </string-array>
<string-array name="swipe_to_refresh_array">
<item>Настройки по умолчанию</item>
<item>Потянуть для обновления - включено</item>
<string name="file_location">Расположение файла</string>
<string name="browse">Обзор</string>
<string name="export">Экспорт</string>
- <string name="import_button">Импорт</string> <!-- `import` is a reserved word and cannot be used as the name -->
+ <string name="import_button">Импорт</string> <!-- `import` is a reserved word and cannot be used as the name. -->
<string name="decrypt">Расшифровать</string>
<string name="export_successful">Экспорт выполнен.</string>
<string name="export_failed">Сбой при экспорте:</string>
<string name="cannot_use_location">Это расположение использовано быть не может, поскольку разрешение на хранение предоставлено не было.</string>
<!-- Logcat. -->
- <string name="copy">Копировать</string>
+ <string name="copy_string">Копировать</string> <!-- `copy` is a reserved word and should not be used as the name. -->
<string name="logcat_copied">Logcat скопирован.</string>
<string name="clear">Очистить</string>
<string name="save_logcat">Сохранить logcat</string>
<string name="general">Общее</string>
<string name="homepage">Домашняя страница</string>
<string name="font_size_preference">Размер шрифта</string>
- <string-array name="font_size_entries">
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
- <string-array name="domain_settings_font_size_entries">
- <item>Настройки по умолчанию</item>
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
<string name="open_intents_in_new_tab">Открывать цели в новой вкладке</string>
<string name="open_intents_in_new_tab_summary">Цели - это ссылки, отправленные из других приложений.</string>
<string name="swipe_to_refresh">Потянуть для обновления</string>
<string name="user_agent_internet_explorer_on_windows">İnternet Explorer - Windows</string>
<string name="user_agent_safari_on_macos">Safari - macOS</string>
<string name="user_agent_custom">Özel</string>
- <string name="font_size">Yazı Tipi Boyutu</string>
- <string name="twenty_five_percent">%25</string>
- <string name="fifty_percent">%50</string>
- <string name="seventy_five_percent">%75</string>
- <string name="one_hundred_percent">%100</string>
- <string name="one_hundred_twenty_five_percent">%125</string>
- <string name="one_hundred_fifty_percent">%150</string>
- <string name="one_hundred_seventy_five_percent">%175</string>
- <string name="two_hundred_percent">%200</string>
<string name="swipe_to_refresh_options_menu">Yenilemek için kaydır</string>
<string name="wide_viewport">Geniş ekran</string>
<string name="display_images">Resimleri göster</string>
<string name="options_night_mode">Gece modu</string>
+ <string name="font_size">Yazı Tipi Boyutu</string>
<string name="find_on_page">Sayfada bul</string>
<string name="print">Yazdır</string>
<string name="privacy_browser_web_page">Privacy Browser Web Sayfası</string>
<string name="domain_name">Domain adı</string>
<string name="domain_deleted">Domain silinmiş</string>
<string name="domain_name_instructions">*. tüm altdomainleri içeren bir domainin başına getirilebilir (örn. *.stoutner.com)</string>
+ <string-array name="font_size_array">
+ <item>Sistem varsayılanı</item>
+ <item>Custom font size</item>
+ </string-array>
<string-array name="swipe_to_refresh_array">
<item>Sistem varsayılanı</item>
<item>Yenilemek için kaydır etkin</item>
<string name="file_location">Dosya Konumu</string>
<string name="browse">Gözat</string>
<string name="export">Dışarı aktar</string>
- <string name="import_button">İçeri aktar</string> <!-- `import` is a reserved word and cannot be used as the name -->
+ <string name="import_button">İçeri aktar</string> <!-- `import` is a reserved word and cannot be used as the name. -->
<string name="decrypt">Şifre çöz (Decrypt)</string>
<string name="export_successful">Dışa aktarım başarılı</string>
<string name="export_failed">Dışa aktarım başarısız:</string>
<string name="cannot_use_location">Depolama izni verilmediği için bu konum kullanılamaz.</string>
<!-- Logcat. -->
- <string name="copy">Kopyala</string>
+ <string name="copy_string">Kopyala</string> <!-- `copy` is a reserved word and should not be used as the name. -->
<string name="logcat_copied">Logcat kopyalandı.</string>
<string name="clear">Temizle</string>
<string name="save_logcat">Logcat kaydet</string>
<string name="general">Genel</string>
<string name="homepage">Ana Sayfa</string>
<string name="font_size_preference">Yazı tipi boyutu</string>
- <string-array name="font_size_entries">
- <item>%25</item>
- <item>%50</item>
- <item>%75</item>
- <item>%100</item>
- <item>%125</item>
- <item>%150</item>
- <item>%175</item>
- <item>%200</item>
- </string-array>
- <string-array name="domain_settings_font_size_entries">
- <item>Sistem varsayılanı</item>
- <item>%25</item>
- <item>%50</item>
- <item>%75</item>
- <item>%100</item>
- <item>%125</item>
- <item>%150</item>
- <item>%175</item>
- <item>%200</item>
- </string-array>
<string name="open_intents_in_new_tab">Intent\'leri yeni sekmede aç</string>
<string name="open_intents_in_new_tab_summary">Intent\'ler diğer uygulamalardan gönderilen linklerdir.</string>
<string name="swipe_to_refresh">Yenilemek için kaydır</string>
<string name="new_tab">New tab</string>
<string name="loading">Loading…</string>
<string name="error">Error:</string>
+ <string name="apply">Apply</string>
<!-- Loading Blocklists. -->
<string name="loading_easylist">Loading EasyList</string>
<string name="user_agent_internet_explorer_on_windows">Internet Explorer on Windows</string>
<string name="user_agent_safari_on_macos">Safari on macOS</string>
<string name="user_agent_custom">Custom</string>
- <string name="font_size">Font Size</string>
- <string name="twenty_five_percent">25%</string>
- <string name="fifty_percent">50%</string>
- <string name="seventy_five_percent">75%</string>
- <string name="one_hundred_percent">100%</string>
- <string name="one_hundred_twenty_five_percent">125%</string>
- <string name="one_hundred_fifty_percent">150%</string>
- <string name="one_hundred_seventy_five_percent">175%</string>
- <string name="two_hundred_percent">200%</string>
<string name="swipe_to_refresh_options_menu">Swipe to Refresh</string>
<string name="wide_viewport">Wide Viewport</string>
<string name="display_images">Display Images</string>
<string name="options_night_mode">Night Mode</string>
+ <string name="font_size">Font Size</string>
<string name="find_on_page">Find on Page</string>
<string name="print">Print</string>
<string name="privacy_browser_web_page">Privacy Browser Web Page</string>
<string name="domain_name">Domain name</string>
<string name="domain_deleted">Domain deleted</string>
<string name="domain_name_instructions">*. may be prepended to a domain to include all subdomains (eg. *.stoutner.com)</string>
+ <string-array name="font_size_array">
+ <item>System default</item>
+ <item>Custom font size</item>
+ </string-array>
<string-array name="swipe_to_refresh_array">
<item>System default</item>
<item>Swipe to refresh enabled</item>
<string name="file_location">File Location</string>
<string name="browse">Browse</string>
<string name="export">Export</string>
- <string name="import_button">Import</string> <!-- `import` is a reserved word and cannot be used as the name -->
+ <string name="import_button">Import</string> <!-- `import` is a reserved word and cannot be used as the name. -->
<string name="decrypt">Decrypt</string>
<string name="export_successful">Export successful.</string>
<string name="export_failed">Export failed:</string>
<string name="cannot_use_location">This location cannot be used because the storage permission has not been granted.</string>
<!-- Logcat. -->
- <string name="copy">Copy</string>
+ <string name="copy_string">Copy</string> <!-- `copy` is a reserved word and should not be used as the name. -->
<string name="logcat_copied">Logcat copied.</string>
<string name="clear">Clear</string>
<string name="save_logcat">Save logcat</string>
<string name="general">General</string>
<string name="homepage">Homepage</string>
<string name="font_size_preference">Font size</string>
- <string-array name="font_size_entries">
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
- <string-array name="font_size_entry_values" translatable="false"> <!-- None of the items in this `string-array` should be translated. -->
- <item>25</item>
- <item>50</item>
- <item>75</item>
- <item>100</item>
- <item>125</item>
- <item>150</item>
- <item>175</item>
- <item>200</item>
- </string-array>
- <string-array name="domain_settings_font_size_entries">
- <item>System default</item>
- <item>25%</item>
- <item>50%</item>
- <item>75%</item>
- <item>100%</item>
- <item>125%</item>
- <item>150%</item>
- <item>175%</item>
- <item>200%</item>
- </string-array>
- <string-array name="domain_settings_font_size_entry_values" translatable="false"> <!-- None of the items in this `string-array` should be translated. -->
- <item>0</item>
- <item>25</item>
- <item>50</item>
- <item>75</item>
- <item>100</item>
- <item>125</item>
- <item>150</item>
- <item>175</item>
- <item>200</item>
- </string-array>
<string name="open_intents_in_new_tab">Open intents in new tab</string>
<string name="open_intents_in_new_tab_summary">Intents are links sent from other apps.</string>
<string name="swipe_to_refresh">Swipe to refresh</string>
android:entryValues="@array/tor_search_entry_values"
android:defaultValue="@string/tor_search_default_value" />
+ <!-- `android:inputType` currently doesn't work with AndroidX. -->
<EditTextPreference
android:key="tor_search_custom_url"
android:title="@string/tor_search_custom_url"
android:inputType="textUri"
android:icon="?attr/homepageIcon" />
- <ListPreference
+ <!-- `android:inputType="number"` currently doesn't work with AndroidX. -->
+ <EditTextPreference
android:key="font_size"
android:title="@string/font_size_preference"
- android:entries="@array/font_size_entries"
- android:entryValues="@array/font_size_entry_values"
android:defaultValue="@string/font_size_default_value"
+ android:inputType="number"
android:icon="?attr/fontSizeIcon" />
<SwitchPreference
google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.5.1'
+ classpath 'com.android.tools.build:gradle:3.5.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files