From: Soren Stoutner Date: Fri, 22 Nov 2019 23:54:03 +0000 (-0700) Subject: Allow specifying any font size. https://redmine.stoutner.com/issues/504 X-Git-Tag: v3.3~5 X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff_plain;h=ca7516a7edb9e06d0f9fe9186513986cd82be716 Allow specifying any font size. https://redmine.stoutner.com/issues/504 --- diff --git a/.idea/dictionaries/soren.xml b/.idea/dictionaries/soren.xml index b3e3c4df..05389849 100644 --- a/.idea/dictionaries/soren.xml +++ b/.idea/dictionaries/soren.xml @@ -41,6 +41,7 @@ daeef databaseview deeplinks + dereferenced didn displayimages displayorder diff --git a/app/build.gradle b/app/build.gradle index 15b6d700..a7d278bb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,12 +20,12 @@ 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" } @@ -74,6 +74,7 @@ dependencies { 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' @@ -81,5 +82,5 @@ dependencies { 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 diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java index 037ed592..81727aac 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java @@ -41,6 +41,7 @@ import android.widget.Spinner; 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. @@ -560,7 +561,7 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo } @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. @@ -645,8 +646,13 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo 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`. @@ -693,6 +699,7 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo 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); @@ -716,8 +723,8 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo 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(); @@ -729,7 +736,7 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo 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); @@ -745,11 +752,17 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo 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, diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/LogcatActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/LogcatActivity.java index f270cd24..754874d8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/LogcatActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/LogcatActivity.java @@ -28,6 +28,7 @@ import android.content.Intent; 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; @@ -200,8 +201,14 @@ public class LogcatActivity extends AppCompatActivity implements SaveLogcatDialo @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(); @@ -312,6 +319,9 @@ public class LogcatActivity extends AppCompatActivity implements SaveLogcatDialo // 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. @@ -322,17 +332,26 @@ public class LogcatActivity extends AppCompatActivity implements SaveLogcatDialo // 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); + } } } } diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index f4c51bb6..25260921 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -129,6 +129,7 @@ import com.stoutner.privacybrowser.dialogs.DownloadImageDialog; 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; @@ -161,12 +162,13 @@ import java.util.HashMap; 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()`. @@ -815,14 +817,16 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook 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. @@ -872,62 +876,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook 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); @@ -1506,58 +1456,12 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // 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; @@ -3105,6 +3009,31 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook 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. @@ -3370,7 +3299,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook 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; @@ -4043,10 +3972,16 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } // 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. @@ -4182,9 +4117,17 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook 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) { diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java index 8409912b..7119b0f7 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java @@ -55,6 +55,6 @@ public class SettingsActivity extends AppCompatActivity { 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 diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java index 39a92c67..87c336df 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java @@ -53,7 +53,7 @@ public class AddDomainDialog extends DialogFragment { private AddDomainListener addDomainListener; @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.java index 69ab1ecc..4da0f14e 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.java @@ -52,7 +52,7 @@ public class CreateBookmarkDialog extends DialogFragment { // 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); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java index b198a888..2b012683 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java @@ -34,6 +34,7 @@ import android.text.Editable; 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; @@ -56,7 +57,7 @@ public class CreateBookmarkFolderDialog extends DialogFragment { // `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. @@ -150,14 +151,20 @@ public class CreateBookmarkFolderDialog extends DialogFragment { // 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(); @@ -197,14 +204,16 @@ public class CreateBookmarkFolderDialog extends DialogFragment { } }); - // 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. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java index eb2b0ebf..6ce84771 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java @@ -51,7 +51,7 @@ public class DownloadFileDialog extends DialogFragment { } @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java index f200d95a..9c1afe67 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java @@ -49,7 +49,7 @@ public class DownloadImageDialog extends DialogFragment { // 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); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadLocationPermissionDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadLocationPermissionDialog.java index de9dd77f..a8ebd73e 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadLocationPermissionDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadLocationPermissionDialog.java @@ -47,7 +47,7 @@ public class DownloadLocationPermissionDialog extends DialogFragment { } @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.java index 656e0d57..b19c2063 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.java @@ -70,7 +70,7 @@ public class EditBookmarkDatabaseViewDialog extends DialogFragment { } @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java index 0b6cd716..adf6d44e 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java @@ -58,7 +58,7 @@ public class EditBookmarkDialog extends DialogFragment { 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); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java index 1b7c3d70..6f481a08 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java @@ -71,7 +71,7 @@ public class EditBookmarkFolderDatabaseViewDialog extends DialogFragment { 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); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java index 19f9db90..230abd34 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java @@ -58,7 +58,7 @@ public class EditBookmarkFolderDialog extends DialogFragment { 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); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/FontSizeDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/FontSizeDialog.java new file mode 100644 index 00000000..2349189c --- /dev/null +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/FontSizeDialog.java @@ -0,0 +1,182 @@ +/* + * Copyright © 2019 Soren Stoutner . + * + * This file is part of 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 . + */ + +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; + } +} diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java index 7ee7dd01..4b681089 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java @@ -32,6 +32,7 @@ import android.text.style.ForegroundColorSpan; 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; @@ -161,16 +162,19 @@ public class HttpAuthenticationDialog extends DialogFragment{ // 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(); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java index 55f29d63..cf944c04 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java @@ -66,7 +66,7 @@ public class MoveToFolderDialog extends DialogFragment { void onMoveToFolder(DialogFragment dialogFragment); } - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedMismatchDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedMismatchDialog.java index 9694c0ac..675f1e8a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedMismatchDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedMismatchDialog.java @@ -77,7 +77,7 @@ public class PinnedMismatchDialog extends DialogFragment { private Date currentSslEndDate; @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveLogcatDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveLogcatDialog.java index 8178a8f2..b49958eb 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveLogcatDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveLogcatDialog.java @@ -58,7 +58,7 @@ public class SaveLogcatDialog extends DialogFragment { } @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveWebpageImageDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveWebpageImageDialog.java index 11127d92..a9277d9c 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveWebpageImageDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveWebpageImageDialog.java @@ -32,7 +32,6 @@ import android.content.pm.PackageManager; 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; @@ -45,6 +44,7 @@ import android.widget.TextView; 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; @@ -59,7 +59,7 @@ public class SaveWebpageImageDialog extends DialogFragment { } @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); @@ -72,8 +72,16 @@ public class SaveWebpageImageDialog extends DialogFragment { @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); @@ -82,36 +90,23 @@ public class SaveWebpageImageDialog extends DialogFragment { // 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) -> { @@ -122,7 +117,7 @@ public class SaveWebpageImageDialog extends DialogFragment { // 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. @@ -142,12 +137,6 @@ public class SaveWebpageImageDialog extends DialogFragment { // 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. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/StoragePermissionDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/StoragePermissionDialog.java index e7440130..198eb509 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/StoragePermissionDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/StoragePermissionDialog.java @@ -43,7 +43,7 @@ public class StoragePermissionDialog extends DialogFragment { } @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java index 8aba719b..298da3b9 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java @@ -61,7 +61,7 @@ public class UrlHistoryDialog extends DialogFragment{ private NavigateHistoryListener navigateHistoryListener; @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java index e4c2bbc7..5b7566f6 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java @@ -46,10 +46,10 @@ public class ViewRequestDialog extends DialogFragment { 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); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java index a24dedd1..b88ef766 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java @@ -20,15 +20,16 @@ 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; @@ -39,6 +40,7 @@ import android.widget.TextView; 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; @@ -69,18 +71,24 @@ public class ViewSslCertificateDialog extends DialogFragment { 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. @@ -98,11 +106,12 @@ public class ViewSslCertificateDialog extends DialogFragment { // 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); @@ -110,9 +119,9 @@ public class ViewSslCertificateDialog extends DialogFragment { // 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. @@ -121,7 +130,7 @@ public class ViewSslCertificateDialog extends DialogFragment { // 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. @@ -222,17 +231,15 @@ public class ViewSslCertificateDialog extends DialogFragment { 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)); } diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java index 4007dbf0..8517b6f6 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java @@ -136,7 +136,8 @@ public class DomainSettingsFragment extends Fragment { 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); @@ -244,8 +245,7 @@ public class DomainSettingsFragment extends Fragment { // Create array adapters for the spinners. ArrayAdapter translatedUserAgentArrayAdapter = ArrayAdapter.createFromResource(context, R.array.translated_domain_settings_user_agent_names, R.layout.spinner_item); - ArrayAdapter fontSizeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_font_size_entries, R.layout.spinner_item); - ArrayAdapter fontSizeEntryValuesArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_font_size_entry_values, R.layout.spinner_item); + ArrayAdapter fontSizeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.font_size_array, R.layout.spinner_item); ArrayAdapter swipeToRefreshArrayAdapter = ArrayAdapter.createFromResource(context, R.array.swipe_to_refresh_array, R.layout.spinner_item); ArrayAdapter nightModeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.night_mode_array, R.layout.spinner_item); ArrayAdapter wideViewportArrayAdapter = ArrayAdapter.createFromResource(context, R.array.wide_viewport_array, R.layout.spinner_item); @@ -761,23 +761,41 @@ public class DomainSettingsFragment extends Fragment { 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(); }); @@ -1662,11 +1680,19 @@ public class DomainSettingsFragment extends Fragment { 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); } } diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java index 1746f718..2ffcd187 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java @@ -20,37 +20,43 @@ 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(); @@ -101,6 +107,52 @@ public class SettingsFragment extends PreferenceFragment { 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"); @@ -131,8 +183,12 @@ public class SettingsFragment extends PreferenceFragment { // 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); @@ -229,7 +285,7 @@ public class SettingsFragment extends PreferenceFragment { 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); @@ -1574,7 +1630,7 @@ public class SettingsFragment extends PreferenceFragment { 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": diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.java index 413910dc..91866a3e 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.java @@ -47,7 +47,7 @@ public class WebViewTabFragment extends Fragment { private NewTabListener newTabListener; @Override - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); diff --git a/app/src/main/res/layout/create_bookmark_dialog.xml b/app/src/main/res/layout/create_bookmark_dialog.xml index 84dad7ec..0ac593e6 100644 --- a/app/src/main/res/layout/create_bookmark_dialog.xml +++ b/app/src/main/res/layout/create_bookmark_dialog.xml @@ -64,7 +64,8 @@ android:layout_width="match_parent" android:hint="@string/bookmark_url" android:imeOptions="actionGo" - android:inputType="textUri" /> + android:inputType="textUri" + android:selectAllOnFocus="true" /> \ No newline at end of file diff --git a/app/src/main/res/layout/domain_settings_fragment.xml b/app/src/main/res/layout/domain_settings_fragment.xml index 8c28398c..30cbf066 100644 --- a/app/src/main/res/layout/domain_settings_fragment.xml +++ b/app/src/main/res/layout/domain_settings_fragment.xml @@ -451,8 +451,7 @@ android:layout_marginEnd="60dp" android:inputType="textUri" android:hint="@string/custom_user_agent" - android:importantForAutofill="no" - tools:targetApi="26" /> + android:importantForAutofill="no" /> @@ -485,13 +484,22 @@ + diff --git a/app/src/main/res/layout/font_size_dialog.xml b/app/src/main/res/layout/font_size_dialog.xml new file mode 100644 index 00000000..2063e192 --- /dev/null +++ b/app/src/main/res/layout/font_size_dialog.xml @@ -0,0 +1,38 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/http_authentication_dialog.xml b/app/src/main/res/layout/http_authentication_dialog.xml index 52e543d1..be1d8788 100644 --- a/app/src/main/res/layout/http_authentication_dialog.xml +++ b/app/src/main/res/layout/http_authentication_dialog.xml @@ -36,7 +36,7 @@ android:layout_width="wrap_content" android:layout_marginTop="12dp" android:layout_gravity="center_horizontal" - android:textSize="24sp" + android:textSize="26sp" android:textStyle="bold" /> + android:layout_marginEnd="4dp" + android:textSize="16sp" + android:textColor="?android:textColorPrimary" /> - - - - - - - - - - - - - - - - - - - - - - - + + + Internet Explorer auf Windows Safari auf macOS Eigener - Schriftgröße - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% Herunterziehen zum aktualisieren Breiter Anzeigebereich Bilder anzeigen Nacht-Modus + Schriftgröße Auf Seite finden Drucken Privacy Browser-Website @@ -195,6 +187,7 @@ In neuem Tab öffnen + Im Hintergrund öffnen Grafik in neuem Tab öffnen URL kopieren Download URL @@ -325,6 +318,10 @@ Domainname Domain gelöscht *. kann als Wildcard-Subdomain verwendet werden (z.B. *.stoutner.com) + + Standardeinstellung + Custom font size + Standardeinstellung Herunterziehen zum aktualisieren aktiviert @@ -367,7 +364,7 @@ Datei-Ordner durchsuchen exportieren - importieren + importieren entschlüsseln Export erfolgreich. Export fehlgeschlagen: @@ -379,7 +376,7 @@ Dieser Ordner kann nicht genutzt werden, da die Speicher-Berechtigung nicht erteilt wurde. - kopieren + kopieren Logcat kopiert. leeren Logcat speichern @@ -564,27 +561,6 @@ Allgemein Startseite Schriftgröße - - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - - - Standardeinstellung - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - Intents in neuem Tab öffnen Intents sind Links, die von anderen Apps übergeben werden. Herunterziehen zum Aktualisieren diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index d22da9e0..c45b2477 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -164,24 +164,16 @@ Internet Explorer en Windows Safari en macOS Personalizado - Tamaño de fuente - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% Deslizar para actualizar Vista amplia Mostrar imágenes + Modo noche + Tamaño de fuente + Buscar en página Imprimir Página web de Navegador Privado Guardar como imagen Añadir a la ventana de inicio - Modo noche - Buscar en página Ver la fuente Compartir Compartir URL @@ -192,6 +184,7 @@ Abrir en nueva pestaña + Abrir en segundo plano Abrir imagen en nueva pestaña Copiar URL Descargar URL @@ -323,6 +316,10 @@ Nombre de dominio Dominio borrado *. puede ser añadido a un dominio para incluir todos los subdominios (p.ej. *.stoutner.com) + + Por defecto del sistema + Custom font size + Por defecto del sistema Deslizar para actualizar habilitado @@ -365,7 +362,7 @@ Ubicación del archivo Navegar Exportar - Importar + Importar Descifrar Exportación exitosa. Exportación fallida: @@ -378,7 +375,7 @@ Esta ubicación no se puede utilizar porque no se ha concedido el permiso de almacenamiento. - Copiar + Copiar Logcat copiado. Borrar Guardar logcat @@ -563,27 +560,6 @@ General Página de inicio Tamaño de fuente - - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - - - Por defecto del sistema - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - Abrir contenido en nueva pestaña Los contenidos son enlaces enviados desde otras apps. Deslizar para actualizar diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index d100a56b..bfae370c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -165,19 +165,11 @@ Internet Explorer sous Windows Safari sous macOS Personnalisé - Police - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% Glisser pour actualiser Fenêtre large Afficher les images Mode nuit + Police Chercher sur la page Imprimer Site Web de Privacy Browser @@ -193,6 +185,7 @@ Ouvrir dans un nouvel onglet + Ouvrir en arrière-plan Ouvrir l\'image dans un nouvel onglet Copier l\'URL Télécharger la cible @@ -323,6 +316,10 @@ Nom de demaine Domaine supprimé Faire précéder par *. pour inclure l\'ensemble des sous-domaines (ex. *.stoutner.com) + + Réglages systèmes + Custom font size + Réglages systèmes Glisser pour actualiser activé @@ -365,7 +362,7 @@ Emplacement du fichier Parcourir Exporter - Importer + Importer Déchiffrer Export effectué. L\'export a échoué : @@ -378,7 +375,7 @@ Ce dossier ne peut pas être utilisé car les droits d\'accès au stockage n\'ont pas été autorisés. - Copie + Copie Journal système copié. Vider Sauvegarder le journal système @@ -564,27 +561,6 @@ General Page d\'accueil Zoom - - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - - - Par défaut - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - Intentions dans un nouvel onglet Les intentions sont des liens envoyés à partir d\'autres applications. Glisser pour rafraîchir diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 6aea732c..a07d6f31 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -164,19 +164,11 @@ Internet Explorer su Windows Safari su macOS Personalizzato - Dimensione font - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% Swipe per aggiornare Finestra grande Mostra immagini Modalità Notte + Dimensione font Cerca nella pagina Stampa Pagina web di Privacy Browser @@ -192,6 +184,7 @@ Apri in una nuova Scheda + Apri in Background Apri l\'immagine in una nuova scheda Copia URL Scarica URL @@ -322,6 +315,10 @@ Nome del Dominio Dominio Eliminato è possibile anteporre *. a un dominio per includere tutti i sottodomini (es. *.stoutner.com) + + Impostazioni di default + Custom font size + Impostazioni di default Swipe per aggiornare abilitato @@ -364,7 +361,7 @@ Posizione del File Sfoglia Esporta - Importa + Importa Decripta Esportazione riuscita Esportazione fallita: @@ -377,7 +374,7 @@ Questa posizione non può essere utilizzata perché non è stato concesso il permesso di scrittura in memoria. - Copia + Copia Logcat copiato. Cancella Salva il log @@ -562,27 +559,6 @@ Generale Homepage Dimensione font - - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - - - Impostazioni di default - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - Apri gli intenti in una nuova scheda Gli intenti sono link inviati da altre app. Swipe per aggiornare diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 810e6475..018a3c7f 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -161,19 +161,11 @@ Internet Explorer на Windows Safari на macOS Настраиваемый - Размер шрифта - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% Потянуть для обновления Широкий вид просмотра Показывать изображения Ночной режим + Размер шрифта Найти на странице Печать Privacy Browser веб-страница @@ -189,6 +181,7 @@ Открыть в новой вкладке + Открыть в фоне Открыть изображение в новой вкладке Копировать URL Загрузить URL @@ -319,6 +312,10 @@ Имя домена Домен удален добавьте *. для включения всех поддоменов (напр. *.stoutner.com) + + Настройки по умолчанию + Custom font size + Настройки по умолчанию Потянуть для обновления - включено @@ -361,7 +358,7 @@ Расположение файла Обзор Экспорт - Импорт + Импорт Расшифровать Экспорт выполнен. Сбой при экспорте: @@ -372,7 +369,7 @@ Это расположение использовано быть не может, поскольку разрешение на хранение предоставлено не было. - Копировать + Копировать Logcat скопирован. Очистить Сохранить logcat @@ -556,27 +553,6 @@ Общее Домашняя страница Размер шрифта - - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - - - Настройки по умолчанию - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - Открывать цели в новой вкладке Цели - это ссылки, отправленные из других приложений. Потянуть для обновления diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 50b76562..21806ca1 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -162,19 +162,11 @@ İnternet Explorer - Windows Safari - macOS Özel - Yazı Tipi Boyutu - %25 - %50 - %75 - %100 - %125 - %150 - %175 - %200 Yenilemek için kaydır Geniş ekran Resimleri göster Gece modu + Yazı Tipi Boyutu Sayfada bul Yazdır Privacy Browser Web Sayfası @@ -319,6 +311,10 @@ Domain adı Domain silinmiş *. tüm altdomainleri içeren bir domainin başına getirilebilir (örn. *.stoutner.com) + + Sistem varsayılanı + Custom font size + Sistem varsayılanı Yenilemek için kaydır etkin @@ -361,7 +357,7 @@ Dosya Konumu Gözat Dışarı aktar - İçeri aktar + İçeri aktar Şifre çöz (Decrypt) Dışa aktarım başarılı Dışa aktarım başarısız: @@ -372,7 +368,7 @@ Depolama izni verilmediği için bu konum kullanılamaz. - Kopyala + Kopyala Logcat kopyalandı. Temizle Logcat kaydet @@ -558,27 +554,6 @@ Genel Ana Sayfa Yazı tipi boyutu - - %25 - %50 - %75 - %100 - %125 - %150 - %175 - %200 - - - Sistem varsayılanı - %25 - %50 - %75 - %100 - %125 - %150 - %175 - %200 - Intent\'leri yeni sekmede aç Intent\'ler diğer uygulamalardan gönderilen linklerdir. Yenilemek için kaydır diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 744a5a4a..58ebf52c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -57,6 +57,7 @@ New tab Loading… Error: + Apply Loading EasyList @@ -168,19 +169,11 @@ Internet Explorer on Windows Safari on macOS Custom - Font Size - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% Swipe to Refresh Wide Viewport Display Images Night Mode + Font Size Find on Page Print Privacy Browser Web Page @@ -328,6 +321,10 @@ Domain name Domain deleted *. may be prepended to a domain to include all subdomains (eg. *.stoutner.com) + + System default + Custom font size + System default Swipe to refresh enabled @@ -370,7 +367,7 @@ File Location Browse Export - Import + Import Decrypt Export successful. Export failed: @@ -381,7 +378,7 @@ This location cannot be used because the storage permission has not been granted. - Copy + Copy Logcat copied. Clear Save logcat @@ -615,48 +612,6 @@ General Homepage Font size - - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - - - 25 - 50 - 75 - 100 - 125 - 150 - 175 - 200 - - - System default - 25% - 50% - 75% - 100% - 125% - 150% - 175% - 200% - - - 0 - 25 - 50 - 75 - 100 - 125 - 150 - 175 - 200 - Open intents in new tab Intents are links sent from other apps. Swipe to refresh diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 4c266c27..500fcb86 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -181,6 +181,7 @@ android:entryValues="@array/tor_search_entry_values" android:defaultValue="@string/tor_search_default_value" /> + - +