<!-- Activities. -->
<string name="privacy_browser">Privacy Browser Free</string>
- <!-- Ad Control. -->
- <string name="google_app_id" translatable="false">ca-app-pub-5962503714887045~2738552414</string>
- <string name="ad_unit_id" translatable="false">ca-app-pub-5962503714887045/2738552414</string>
-
- <!-- Test Ad Control.
- <string name="google_app_id" translatable="false">ca-app-pub-3940256099942544~3347511713</string>
- <string name="ad_unit_id" translatable="false">ca-app-pub-3940256099942544/6300978111</string> -->
+ <!-- Create Home Screen Shortcut Alert Dialog. -->
+ <string name="open_with_privacy_browser">Open with Privacy Browser Free.</string>
<!-- Ad Consent. -->
<string name="ad_consent_text">Privacy Browser Free displays a banner ad on the bottom of the screen.
\n\nThe standard version of Privacy Browser does not contain app ads.</string>
<string name="close_browser">Close Browser</string>
<string name="accept_ads">Accept Ads</string>
+
+ <!-- Ad Control. -->
+ <string name="google_app_id" translatable="false">ca-app-pub-5962503714887045~2738552414</string>
+ <string name="ad_unit_id" translatable="false">ca-app-pub-5962503714887045/2738552414</string>
+
+ <!-- Test Ad Control.
+ <string name="google_app_id" translatable="false">ca-app-pub-3940256099942544~3347511713</string>
+ <string name="ad_unit_id" translatable="false">ca-app-pub-3940256099942544/6300978111</string> -->
</resources>
\ No newline at end of file
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
+import android.widget.RadioButton;
import androidx.annotation.NonNull;
-// `ShortcutInfoCompat`, `ShortcutManagerCompat`, and `IconCompat` can be switched to the non-compat versions once API >= 26.
+// `ShortcutInfoCompat`, `ShortcutManagerCompat`, and `IconCompat` can be switched to the non-compat versions once the minimum API >= 26.
import androidx.core.content.pm.ShortcutInfoCompat;
import androidx.core.content.pm.ShortcutManagerCompat;
import androidx.core.graphics.drawable.IconCompat;
import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <=22.
+import com.stoutner.privacybrowser.BuildConfig;
import com.stoutner.privacybrowser.activities.MainWebViewActivity;
import com.stoutner.privacybrowser.R;
private Bitmap favoriteIconBitmap;
private EditText shortcutNameEditText;
private EditText urlEditText;
+ private RadioButton openWithPrivacyBrowserRadioButton;
private Button createButton;
public static CreateHomeScreenShortcutDialog createDialog(String shortcutName, String urlString, Bitmap favoriteIconBitmap) {
// The alert dialog must be shown before the contents may be edited.
alertDialog.show();
- // Get a handle for the edit texts.
+ // Get handles for the views.
shortcutNameEditText = alertDialog.findViewById(R.id.shortcut_name_edittext);
urlEditText = alertDialog.findViewById(R.id.url_edittext);
+ openWithPrivacyBrowserRadioButton = alertDialog.findViewById(R.id.open_with_privacy_browser_radiobutton);
+ createButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
// Populate the edit texts.
shortcutNameEditText.setText(initialShortcutName);
urlEditText.setText(initialUrlString);
- // Get a handle for the create button.
- createButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
-
// Add a text change listener to the shortcut name edit text.
shortcutNameEditText.addTextChangedListener(new TextWatcher() {
@Override
// Convert the favorite icon bitmap to an icon. `IconCompat` must be used until the minimum API >= 26.
IconCompat favoriteIcon = IconCompat.createWithBitmap(favoriteIconBitmap);
- // Setup the shortcut intent.
+ // Create a shortcut intent.
Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
+
+ // Check to see if the shortcut should open up Privacy Browser explicitly.
+ if (openWithPrivacyBrowserRadioButton.isChecked()) {
+ // Set the current application ID as the target package.
+ shortcutIntent.setPackage(BuildConfig.APPLICATION_ID);
+ }
+
+ // Add the URL to the intent.
shortcutIntent.setData(Uri.parse(urlString));
// Create a shortcut info builder. The shortcut name becomes the shortcut ID.
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginTop="16dp"
- android:layout_marginBottom="5dp"
+ android:layout_marginBottom="4dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp" >
<com.google.android.material.textfield.TextInputLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
- android:layout_marginTop="5dp"
- android:layout_marginBottom="10dp"
+ android:layout_marginTop="4dp"
+ android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp" >
android:inputType="textUri"
android:selectAllOnFocus="true" />
</com.google.android.material.textfield.TextInputLayout>
+
+ <RadioGroup
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_marginBottom="2dp"
+ android:layout_marginStart="6dp"
+ android:layout_marginEnd="6dp"
+ android:checkedButton="@+id/open_with_default_browser_radiobutton" >
+
+ <RadioButton
+ android:id="@id/open_with_default_browser_radiobutton"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_marginBottom="4dp"
+ android:text="@string/open_with_default_browser"
+ android:textSize="18sp"
+ android:textColor="?android:textColorPrimary" />
+
+ <RadioButton
+ android:id="@+id/open_with_privacy_browser_radiobutton"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_marginTop="4dp"
+ android:text="@string/open_with_privacy_browser"
+ android:textSize="18sp"
+ android:textColor="?android:textColorPrimary" />
+ </RadioGroup>
</LinearLayout>
</ScrollView>
\ No newline at end of file
<string name="full_screen">Schermo intero</string>
<string name="full_screen_browsing_mode">Navigazione a schermo intero</string>
<string name="full_screen_browsing_mode_summary">Toccare due volte per avviare la navigazione a schermo intero.</string>
+ <string name="hide_app_bar">Nascondi la barra dell\'applicazione</string>
+ <string name="hide_app_bar_summary">Nasconde la barra che contiene l\'URL.</string>
<string name="clear_everything">Elimina tutto</string>
<string name="clear_everything_summary">Cancella i cookies, il DOM storage, i dati dei moduli e la cache di WebView. Cancella completamente le cartelle “app_webview” e “cache”.</string>
<string name="clear_cookies_preference">Elimina i cookie</string>
</string-array>
<string name="swipe_to_refresh">Swipe per aggiornare</string>
<string name="swipe_to_refresh_summary">Alcuni siti non funzionano correttamente se questa opzione è abilitata.</string>
+ <string name="scroll_app_bar">Permetti lo scrolling della barra dell\'applicazione</string>
+ <string name="scroll_app_bar_summary">Permette lo scorrere della barra dell\'applicazione dalla parte alta dello schermo quando si effettua lo scrolling.</string>
<string name="display_additional_app_bar_icons">Mostra icone addizionali nella barra dell\'applicazione</string>
<string name="display_additional_app_bar_icons_summary">Mostra nella barra dell\'applicazione le icone per l\'aggiornamento di WebView e, se lo spazio è sufficiente,
per l\'attivazione dei cookie e del DOM storage.</string>
<!-- Create Home Screen Shortcut Alert Dialog. -->
<string name="create_shortcut">Create Shortcut</string>
<string name="shortcut_name">Shortcut name</string>
+ <string name="open_with_default_browser">Open with default browser.</string>
+ <string name="open_with_privacy_browser">Open with Privacy Browser.</string>
<string name="cancel">Cancel</string>
<string name="create">Create</string>
<string name="display_webpage_images">Display webpage images</string>
<string name="display_webpage_images_summary">Disable to conserve bandwidth.</string>
- <!-- Non-translatable preference items. -->
+ <!-- Non-translatable preference default values. -->
<string name="user_agent_default_value" translatable="false">Privacy Browser</string>
<string name="custom_user_agent_default_value" translatable="false">PrivacyBrowser/1.0</string>
<string name="tor_homepage_default_value" translatable="false">http://ulrn6sryqaifefld.onion/</string>