Convert the flavor specific Java classes to Kotlin. https://redmine.stoutner.com...
authorSoren Stoutner <soren@stoutner.com>
Mon, 31 May 2021 19:22:56 +0000 (12:22 -0700)
committerSoren Stoutner <soren@stoutner.com>
Mon, 31 May 2021 19:22:56 +0000 (12:22 -0700)
37 files changed:
app/src/free/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.java [deleted file]
app/src/free/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.kt [new file with mode: 0644]
app/src/free/java/com/stoutner/privacybrowser/helpers/AdConsentDatabaseHelper.java [deleted file]
app/src/free/java/com/stoutner/privacybrowser/helpers/AdConsentDatabaseHelper.kt [new file with mode: 0644]
app/src/free/java/com/stoutner/privacybrowser/helpers/AdHelper.java [deleted file]
app/src/free/java/com/stoutner/privacybrowser/helpers/AdHelper.kt [new file with mode: 0644]
app/src/main/assets/de/about_changelog.html
app/src/main/assets/en/about_changelog.html
app/src/main/assets/es/about_changelog.html
app/src/main/assets/fr/about_changelog.html
app/src/main/assets/it/about_changelog.html
app/src/main/assets/pt-rBR/about_changelog.html
app/src/main/assets/pt-rBR/about_contributors.html
app/src/main/assets/pt-rBR/about_licenses.html
app/src/main/assets/pt-rBR/about_links.html
app/src/main/assets/pt-rBR/about_permissions.html
app/src/main/assets/pt-rBR/about_privacy_policy.html
app/src/main/assets/ru/about_changelog.html
app/src/main/assets/tr/about_changelog.html
app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.kt
app/src/main/java/com/stoutner/privacybrowser/dialogs/OpenDialog.kt
app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedMismatchDialog.kt
app/src/main/java/com/stoutner/privacybrowser/dialogs/ProxyNotInstalledDialog.kt
app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveDialog.kt
app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveWebpageDialog.kt
app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.kt
app/src/main/res/values-night-v23/styles.xml
app/src/main/res/values-night-v27/styles.xml
app/src/main/res/values-night/styles.xml
app/src/main/res/values-v23/styles.xml
app/src/main/res/values-v27/styles.xml
app/src/main/res/values/attrs.xml
app/src/main/res/values/styles.xml
app/src/standard/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.java [deleted file]
app/src/standard/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.kt [new file with mode: 0644]
app/src/standard/java/com/stoutner/privacybrowser/helpers/AdHelper.java [deleted file]
app/src/standard/java/com/stoutner/privacybrowser/helpers/AdHelper.kt [new file with mode: 0644]

diff --git a/app/src/free/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.java b/app/src/free/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.java
deleted file mode 100644 (file)
index d8d81e3..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright © 2018-2020 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.app.Dialog;
-import android.content.DialogInterface;
-import android.content.SharedPreferences;
-import android.content.res.Configuration;
-import android.os.Build;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.view.WindowManager;
-
-import androidx.annotation.NonNull;
-import androidx.appcompat.app.AlertDialog;
-import androidx.fragment.app.DialogFragment;
-
-import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.helpers.AdConsentDatabaseHelper;
-import com.stoutner.privacybrowser.helpers.AdHelper;
-
-public class AdConsentDialog extends DialogFragment {
-    @NonNull
-    @Override
-    public Dialog onCreateDialog(Bundle savedInstanceState) {
-        // Use a builder to create the alert dialog.
-        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog);
-
-        // Get the current theme status.
-        int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
-
-        // Set the icon according to the theme.
-        if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
-            dialogBuilder.setIcon(R.drawable.block_ads_enabled_night);
-        } else {
-            dialogBuilder.setIcon(R.drawable.block_ads_enabled_day);
-        }
-
-        // Remove the incorrect lint warning below that `getApplicationContext()` might be null.
-        assert getActivity() != null;
-
-        // Initialize the bookmarks database helper.  The `0` specifies a database version, but that is ignored and set instead using a constant in `AdConsentDatabaseHelper`.
-        // `getContext()` can be used instead of `getActivity.getApplicationContext()` when the minimum API >= 23.
-        AdConsentDatabaseHelper adConsentDatabaseHelper = new AdConsentDatabaseHelper(getActivity().getApplicationContext(), null, null, 0);
-
-        // Set the title.
-        dialogBuilder.setTitle(R.string.ad_consent);
-
-        // Set the text.
-        dialogBuilder.setMessage(R.string.ad_consent_text);
-
-        // Configure the close button.
-        dialogBuilder.setNegativeButton(R.string.close_browser, (DialogInterface dialog, int which) -> {
-            // Update the ad consent database.
-            adConsentDatabaseHelper.updateAdConsent(false);
-
-            // Close the browser.  `finishAndRemoveTask` also removes Privacy Browser from the recent app list.
-            if (Build.VERSION.SDK_INT >= 21) {
-                getActivity().finishAndRemoveTask();
-            } else {
-                getActivity().finish();
-            }
-
-            // Remove the terminated program from RAM.  The status code is `0`.
-            System.exit(0);
-        });
-
-        // Configure the accept button.
-        dialogBuilder.setPositiveButton(R.string.accept_ads, (DialogInterface dialog, int which) -> {
-            // Update the ad consent database.
-            adConsentDatabaseHelper.updateAdConsent(true);
-
-            // Load an ad.  `getContext()` can be used instead of `getActivity.getApplicationContext()` once the minimum API >= 23.
-            AdHelper.loadAd(getActivity().findViewById(R.id.adview), getActivity().getApplicationContext(), getActivity(), getString(R.string.ad_unit_id));
-        });
-
-        // Create an alert dialog from the alert dialog builder.
-        AlertDialog alertDialog = dialogBuilder.create();
-
-        // Get a handle for the shared preferences.
-        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
-
-        // Get the screenshot preference.
-        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
-
-        // Disable screenshots if not allowed.
-        if (!allowScreenshots) {
-            // Remove the warning below that `getWindow()` might be null.
-            assert alertDialog.getWindow() != null;
-
-            // Disable screenshots.
-            alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
-        }
-
-        // Return the alert dialog.
-        return alertDialog;
-    }
-
-    // Close Privacy Browser Free if the dialog is cancelled without selecting a button (by tapping on the background).
-    @Override
-    public void onCancel(@NonNull DialogInterface dialogInterface) {
-        // Remove the incorrect lint warning below that `getApplicationContext()` might be null.
-        assert getActivity() != null;
-
-        // Initialize the bookmarks database helper.  The `0` specifies a database version, but that is ignored and set instead using a constant in `AdConsentDatabaseHelper`.
-        // `getContext()` can be used instead of `getActivity.getApplicationContext()` when the minimum API >= 23.
-        AdConsentDatabaseHelper adConsentDatabaseHelper = new AdConsentDatabaseHelper(getActivity().getApplicationContext(), null, null, 0);
-
-        // Update the ad consent database.
-        adConsentDatabaseHelper.updateAdConsent(false);
-
-        // Close the browser.  `finishAndRemoveTask()` also removes Privacy Browser from the recent app list.
-        if (Build.VERSION.SDK_INT >= 21) {
-            getActivity().finishAndRemoveTask();
-        } else {
-            getActivity().finish();
-        }
-
-        // Remove the terminated program from RAM.  The status code is `0`.
-        System.exit(0);
-    }
-}
\ No newline at end of file
diff --git a/app/src/free/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.kt b/app/src/free/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.kt
new file mode 100644 (file)
index 0000000..f22367c
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright © 2018-2021 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.app.Dialog
+import android.content.DialogInterface
+import android.os.Build
+import android.os.Bundle
+import android.view.WindowManager
+
+import androidx.appcompat.app.AlertDialog
+import androidx.fragment.app.DialogFragment
+import androidx.preference.PreferenceManager
+
+import com.stoutner.privacybrowser.R
+import com.stoutner.privacybrowser.helpers.AdConsentDatabaseHelper
+import com.stoutner.privacybrowser.helpers.AdHelper
+import kotlin.system.exitProcess
+
+class AdConsentDialog : DialogFragment() {
+    // Declare the class variables.
+    private lateinit var adConsentDatabaseHelper: AdConsentDatabaseHelper
+
+    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
+        // Use a builder to create the alert dialog.
+        val dialogBuilder = AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog)
+
+        // Set the icon according to the theme.
+        dialogBuilder.setIconAttribute(R.attr.blockAdsBlueIcon)
+
+        // Initialize the bookmarks database helper.
+        adConsentDatabaseHelper = AdConsentDatabaseHelper(requireContext())
+
+        // Set the title.
+        dialogBuilder.setTitle(R.string.ad_consent)
+
+        // Set the text.
+        dialogBuilder.setMessage(R.string.ad_consent_text)
+
+        // Set the close browser button.
+        dialogBuilder.setNegativeButton(R.string.close_browser) { _: DialogInterface?, _: Int ->
+            // Update the ad consent database.
+            adConsentDatabaseHelper.updateAdConsent(false)
+
+            // Close the browser.  `finishAndRemoveTask` also removes Privacy Browser from the recent app list.
+            if (Build.VERSION.SDK_INT >= 21) {
+                requireActivity().finishAndRemoveTask()
+            } else {
+                requireActivity().finish()
+            }
+
+            // Remove the terminated program from RAM.  The status code is `0`.
+            exitProcess(0)
+        }
+
+        // Set the accept ads button.
+        dialogBuilder.setPositiveButton(R.string.accept_ads) { _: DialogInterface?, _: Int ->
+            // Update the ad consent database.
+            adConsentDatabaseHelper.updateAdConsent(true)
+
+            // Load an ad.
+            AdHelper.loadAd(requireActivity().findViewById(R.id.adview), requireContext(), requireActivity(), getString(R.string.ad_unit_id))
+        }
+
+        // Create an alert dialog from the alert dialog builder.
+        val alertDialog = dialogBuilder.create()
+
+        // Get a handle for the shared preferences.
+        val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
+
+        // Get the screenshot preference.
+        val allowScreenshots = sharedPreferences.getBoolean(getString(R.string.allow_screenshots_key), false)
+
+        // Disable screenshots if not allowed.
+        if (!allowScreenshots) {
+            // Disable screenshots.
+            alertDialog.window!!.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
+        }
+
+        // Return the alert dialog.
+        return alertDialog
+    }
+
+    // Close Privacy Browser Free if the dialog is cancelled without selecting a button (by tapping on the background).
+    override fun onCancel(dialogInterface: DialogInterface) {
+        // Update the ad consent database.
+        adConsentDatabaseHelper.updateAdConsent(false)
+
+        // Close the browser.  `finishAndRemoveTask()` also removes Privacy Browser from the recent app list.
+        if (Build.VERSION.SDK_INT >= 21) {
+            requireActivity().finishAndRemoveTask()
+        } else {
+            requireActivity().finish()
+        }
+
+        // Remove the terminated program from RAM.  The status code is `0`.
+        exitProcess(0)
+    }
+}
\ No newline at end of file
diff --git a/app/src/free/java/com/stoutner/privacybrowser/helpers/AdConsentDatabaseHelper.java b/app/src/free/java/com/stoutner/privacybrowser/helpers/AdConsentDatabaseHelper.java
deleted file mode 100644 (file)
index bbe480c..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright © 2018 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.helpers;
-
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteOpenHelper;
-
-public class AdConsentDatabaseHelper extends SQLiteOpenHelper {
-    private static final int SCHEMA_VERSION = 1;
-    private static final String AD_CONSENT_DATABASE = "ad_consent.db";
-    private static final String AD_CONSENT_TABLE = "ad_consent";
-
-    private static final String _ID = "_id";
-    private static final String AD_CONSENT = "ad_consent";
-
-    private static final String CREATE_AD_CONSENT_TABLE = "CREATE TABLE " + AD_CONSENT_TABLE + " (" +
-            _ID + " INTEGER PRIMARY KEY, " +
-            AD_CONSENT + " BOOLEAN)";
-
-    // Initialize the database.  The lint warnings for the unused parameters are suppressed.
-    public AdConsentDatabaseHelper(Context context, @SuppressWarnings("UnusedParameters") String name, SQLiteDatabase.CursorFactory cursorFactory, @SuppressWarnings("UnusedParameters") int version) {
-        super(context, AD_CONSENT_DATABASE, cursorFactory, SCHEMA_VERSION);
-    }
-
-    @Override
-    public void onCreate(SQLiteDatabase adConsentDatabase) {
-        // Create the ad consent database.
-        adConsentDatabase.execSQL(CREATE_AD_CONSENT_TABLE);
-
-        // Create an ad consent ContentValues.
-        ContentValues adConsentContentValues = new ContentValues();
-
-        // Populate the ad consent content values.
-        adConsentContentValues.put(AD_CONSENT, false);
-
-        // Insert a new row.  The second argument is `null`, which makes it so that a completely null row cannot be created.
-        adConsentDatabase.insert(AD_CONSENT_TABLE, null, adConsentContentValues);
-    }
-
-    @Override
-    public void onUpgrade(SQLiteDatabase adConsentDatabase, int oldVersion, int newVersion) {
-        // Code for upgrading the database will be added here if the schema version ever increases above 1.
-    }
-
-    // Check to see if ad consent has been granted.
-    public boolean isGranted() {
-        // Get a readable database handle.
-        SQLiteDatabase adConsentDatabase = this.getReadableDatabase();
-
-        // Get the ad consent cursor.
-        Cursor adConsentCursor = adConsentDatabase.rawQuery("SELECT * FROM " + AD_CONSENT_TABLE, null);
-
-        // Move to the first entry.
-        adConsentCursor.moveToFirst();
-
-        // Get the ad consent boolean.
-        boolean adConsent = (adConsentCursor.getInt(adConsentCursor.getColumnIndex(AD_CONSENT)) == 1);
-
-        // Close the cursor.
-        adConsentCursor.close();
-
-        // Close the database.
-        adConsentDatabase.close();
-
-        // Return the ad consent boolean.
-        return adConsent;
-    }
-
-    // Update the ad consent.
-    public void updateAdConsent(boolean adConsent) {
-        // Get a writable database handle.
-        SQLiteDatabase adConsentDatabase = this.getWritableDatabase();
-
-        // Create an ad consent integer.
-        int adConsentInt;
-
-        // Set the ad consent integer according to the boolean.
-        if (adConsent) {
-            adConsentInt = 1;
-        } else {
-            adConsentInt = 0;
-        }
-
-        // Update the ad consent in the database.
-        adConsentDatabase.execSQL("UPDATE " + AD_CONSENT_TABLE + " SET " + AD_CONSENT + " = " + adConsentInt);
-
-        // Close the database.
-        adConsentDatabase.close();
-    }
-}
\ No newline at end of file
diff --git a/app/src/free/java/com/stoutner/privacybrowser/helpers/AdConsentDatabaseHelper.kt b/app/src/free/java/com/stoutner/privacybrowser/helpers/AdConsentDatabaseHelper.kt
new file mode 100644 (file)
index 0000000..8499d55
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright © 2018,2021 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.helpers
+
+import android.content.ContentValues
+import android.content.Context
+import android.database.sqlite.SQLiteDatabase
+import android.database.sqlite.SQLiteOpenHelper
+
+// Define the class constants.
+private const val SCHEMA_VERSION = 1
+private const val AD_CONSENT_DATABASE = "ad_consent.db"
+private const val AD_CONSENT_TABLE = "ad_consent"
+private const val ID = "_id"
+private const val AD_CONSENT = "ad_consent"
+private const val CREATE_AD_CONSENT_TABLE = "CREATE TABLE $AD_CONSENT_TABLE ($ID INTEGER PRIMARY KEY, $AD_CONSENT BOOLEAN)"
+
+class AdConsentDatabaseHelper (context: Context) : SQLiteOpenHelper(context, AD_CONSENT_DATABASE, null, SCHEMA_VERSION) {
+    override fun onCreate(adConsentDatabase: SQLiteDatabase) {
+        // Create the ad consent table.
+        adConsentDatabase.execSQL(CREATE_AD_CONSENT_TABLE)
+
+        // Create an ad consent content values.
+        val adConsentContentValues = ContentValues()
+
+        // Populate the ad consent content values with the default data.
+        adConsentContentValues.put(AD_CONSENT, false)
+
+        // Insert a new row.  The second argument is `null`, which makes it so that a completely null row cannot be created.
+        adConsentDatabase.insert(AD_CONSENT_TABLE, null, adConsentContentValues)
+    }
+
+    override fun onUpgrade(adConsentDatabase: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
+        // Code for upgrading the database will be added here if the schema version ever increases above 1.
+    }
+
+    // Check to see if ad consent has been granted.
+    val isGranted: Boolean get() {
+        // Get a readable database handle.
+        val adConsentDatabase = this.readableDatabase
+
+        // Get the ad consent cursor.
+        val adConsentCursor = adConsentDatabase.rawQuery("SELECT * FROM $AD_CONSENT_TABLE", null)
+
+        // Move the cursor to the first entry.
+        adConsentCursor.moveToFirst()
+
+        // Get the ad consent boolean.
+        val adConsent = adConsentCursor.getInt(adConsentCursor.getColumnIndex(AD_CONSENT)) == 1
+
+        // Close the cursor.
+        adConsentCursor.close()
+
+        // Close the database.
+        adConsentDatabase.close()
+
+        // Return the ad consent boolean.
+        return adConsent
+    }
+
+    // Update the ad consent.
+    fun updateAdConsent(adConsent: Boolean) {
+        // Get a writable database handle.
+        val adConsentDatabase = this.writableDatabase
+
+        // Set the ad consent integer according to the boolean.
+        val adConsentInt = if (adConsent) 1 else 0
+
+        // Update the ad consent in the database.
+        adConsentDatabase.execSQL("UPDATE $AD_CONSENT_TABLE SET $AD_CONSENT = $adConsentInt")
+
+        // Close the database.
+        adConsentDatabase.close()
+    }
+}
\ No newline at end of file
diff --git a/app/src/free/java/com/stoutner/privacybrowser/helpers/AdHelper.java b/app/src/free/java/com/stoutner/privacybrowser/helpers/AdHelper.java
deleted file mode 100644 (file)
index 4d4575d..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright © 2016-2020 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.helpers;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.util.DisplayMetrics;
-import android.view.Display;
-import android.view.View;
-import android.widget.RelativeLayout;
-
-import androidx.fragment.app.DialogFragment;
-import androidx.fragment.app.FragmentManager;
-
-import com.google.ads.mediation.admob.AdMobAdapter;
-import com.google.android.gms.ads.AdRequest;
-import com.google.android.gms.ads.AdSize;
-import com.google.android.gms.ads.AdView;
-import com.google.android.gms.ads.MobileAds;
-
-import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.dialogs.AdConsentDialog;
-
-public class AdHelper {
-    private static boolean initialized;
-
-    public static void initializeAds(View view, Context applicationContext, Activity activity, FragmentManager fragmentManager, String adUnitId) {
-        if (!initialized) {  // This is the first run.
-            // Initialize mobile ads.
-            MobileAds.initialize(applicationContext);
-
-            // Initialize the bookmarks database helper.  The `0` specifies a database version, but that is ignored and set instead using a constant in `AdConsentDatabaseHelper`.
-            AdConsentDatabaseHelper adConsentDatabaseHelper = new AdConsentDatabaseHelper(applicationContext, null, null, 0);
-
-            // Check to see if consent has been granted.
-            boolean adConsentGranted = adConsentDatabaseHelper.isGranted();
-
-            // Display the ad consent dialog if needed.
-            if (!adConsentGranted) {  // Ad consent has not been granted.
-                // Instantiate the ad consent dialog.
-                DialogFragment adConsentDialogFragment = new AdConsentDialog();
-
-                // Display the ad consent dialog.
-                adConsentDialogFragment.show(fragmentManager, "Ad Consent");
-            } else {  // Ad consent has been granted.
-                // Load an ad.
-                loadAd(view, applicationContext, activity, adUnitId);
-            }
-
-            // Set the initialized variable to true so this section doesn't run again.
-            initialized = true;
-        } else {  // Ads have previously been initialized.
-            // Load an ad.
-            loadAd(view, applicationContext, activity, adUnitId);
-        }
-    }
-
-    public static void loadAd(View view, Context applicationContext, Activity activity, String adUnitId) {
-        // Cast the generic view to an AdView.
-        AdView adView = (AdView) view;
-
-        // Save the layout parameters.  They are used when programatically recreating the ad below.
-        RelativeLayout.LayoutParams adViewLayoutParameters = (RelativeLayout.LayoutParams) adView.getLayoutParams();
-
-        // Get a handle for the ad view parent.
-        RelativeLayout adViewParentLayout = (RelativeLayout) adView.getParent();
-
-        // Remove the AdView.
-        adViewParentLayout.removeView(adView);
-
-        // Create a new AdView.  This is necessary because the size can change when the device is rotated.
-        adView = new AdView(applicationContext);
-
-        // Set the ad unit ID.
-        adView.setAdUnitId(adUnitId);
-
-        //  Set the view ID.
-        adView.setId(R.id.adview);
-
-        // Set the layout parameters.
-        adView.setLayoutParams(adViewLayoutParameters);
-
-        // Add the new ad view to the parent layout.
-        adViewParentLayout.addView(adView);
-
-        // Get a handle for the display.
-        Display display = activity.getWindowManager().getDefaultDisplay();
-
-        // Initialize a display metrics.
-        DisplayMetrics displayMetrics = new DisplayMetrics();
-
-        // Get the display metrics from the display.
-        display.getMetrics(displayMetrics);
-
-        // Get the width pixels and the density.
-        float widthPixels = displayMetrics.widthPixels;
-        float density = displayMetrics.density;
-
-        // Calculate the ad width.
-        int adWidth = (int) (widthPixels / density);
-
-        // Get the ad size.  This line should be enabled once Firebase Ads is updated to 20.0.0.
-        AdSize adSize = AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(applicationContext, adWidth);
-
-        // Set the ad size on the adView.
-        adView.setAdSize(adSize);
-
-        // Create an ad settings bundle.
-        Bundle adSettingsBundle = new Bundle();
-
-        // Only request non-personalized ads.  https://developers.google.com/ad-manager/mobile-ads-sdk/android/eu-consent#forward_consent_to_the_google_mobile_ads_sdk
-        adSettingsBundle.putString("npa", "1");
-
-        // Build the ad request.
-        AdRequest adRequest = new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class, adSettingsBundle).build();
-
-        // Make it so.
-        adView.loadAd(adRequest);
-    }
-
-    // This method exists here for the sake of consistency with the following two methods.
-    public static void hideAd(View view) {
-        // Cast the generic view to an AdView.
-        AdView adView = (AdView) view;
-
-        // Hide the ad.
-        adView.setVisibility(View.GONE);
-    }
-
-    // This method exists here so that the main WebView activity doesn't need to import `com.google.android.gms.ads.AdView`.
-    public static void pauseAd(View view) {
-        // Cast The generic view to an AdView.
-        AdView adView = (AdView) view;
-
-        // Pause the AdView.
-        adView.pause();
-    }
-
-    // This method exists here so that the main WebView activity doesn't need to import `com.google.android.gms.ads.AdView`.
-    public static void resumeAd(View view) {
-        // Cast the generic view to an AdView.
-        AdView adView = (AdView) view;
-
-        // Resume the AdView.
-        adView.resume();
-    }
-}
\ No newline at end of file
diff --git a/app/src/free/java/com/stoutner/privacybrowser/helpers/AdHelper.kt b/app/src/free/java/com/stoutner/privacybrowser/helpers/AdHelper.kt
new file mode 100644 (file)
index 0000000..a572e93
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright © 2016-2021 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.helpers
+
+import android.app.Activity
+import android.content.Context
+import android.os.Bundle
+import android.util.DisplayMetrics
+import android.view.View
+import android.widget.RelativeLayout
+
+import androidx.fragment.app.FragmentManager
+
+import com.google.ads.mediation.admob.AdMobAdapter
+import com.google.android.gms.ads.AdRequest
+import com.google.android.gms.ads.AdSize
+import com.google.android.gms.ads.AdView
+import com.google.android.gms.ads.MobileAds
+
+import com.stoutner.privacybrowser.R
+import com.stoutner.privacybrowser.dialogs.AdConsentDialog
+
+object AdHelper {
+    // Define the class variables.
+    private var initialized = false
+
+    // The `@JvmStatic` notation can be removed once all the code has migrated to Kotlin.
+    @JvmStatic
+    fun initializeAds(view: View, context: Context, activity: Activity, fragmentManager: FragmentManager, adUnitId: String) {
+        // Check to see if the ads have been initialized.
+        if (!initialized) {  // This is the first run; the ads have not yet been initialized.
+            // Initialize mobile ads.
+            MobileAds.initialize(context)
+
+            // Initialize the bookmarks database helper.
+            val adConsentDatabaseHelper = AdConsentDatabaseHelper(context)
+
+            // Check to see if consent has been granted.
+            val adConsentGranted = adConsentDatabaseHelper.isGranted
+
+            // Display the ad consent dialog if needed.
+            if (!adConsentGranted) {  // Ad consent has not been granted.
+                // Instantiate the ad consent dialog.
+                val adConsentDialogFragment = AdConsentDialog()
+
+                // Display the ad consent dialog.
+                adConsentDialogFragment.show(fragmentManager,"Ad Consent")
+            } else {  // Ad consent has already been granted.
+                // Load an ad.
+                loadAd(view, context, activity, adUnitId)
+            }
+
+            // Set the initialized variable to true so this section doesn't run again.
+            initialized = true
+        } else {  // Ads have previously been initialized.
+            // Load an ad.
+            loadAd(view, context, activity, adUnitId)
+        }
+    }
+
+    // The `@JvmStatic` notation can be removed once all the code has migrated to Kotlin.
+    @JvmStatic
+    fun loadAd(view: View, context: Context, activity: Activity, adUnitId: String) {
+        // Cast the generic view to an AdView.
+        var adView = view as AdView
+
+        // Save the layout parameters.  They are used when programatically recreating the ad below.
+        val adViewLayoutParameters = adView.layoutParams as RelativeLayout.LayoutParams
+
+        // Get a handle for the ad view parent.
+        val adViewParentLayout = adView.parent as RelativeLayout
+
+        // Remove the AdView.
+        adViewParentLayout.removeView(adView)
+
+        // Create a new AdView.  This is necessary because the size can change when the device is rotated.
+        adView = AdView(context)
+
+        // Set the ad unit ID.
+        adView.adUnitId = adUnitId
+
+        //  Set the view ID.
+        adView.id = R.id.adview
+
+        // Set the layout parameters.
+        adView.layoutParams = adViewLayoutParameters
+
+        // Add the new ad view to the parent layout.
+        adViewParentLayout.addView(adView)
+
+        // Get a handle for the display.  Once the minimum API >= 30, this should be changed to `context.getDisplay()`.
+        @Suppress("DEPRECATION") val display = activity.windowManager.defaultDisplay
+
+        // Initialize a display metrics.
+        val displayMetrics = DisplayMetrics()
+
+        // Get the display metrics from the display.  Once the minimum APO >= 30, this should be replaced with `WindowMetrics.getBounds()` and `Configuration.densityDpi`.
+        @Suppress("DEPRECATION")
+        display.getMetrics(displayMetrics)
+
+        // Get the width pixels and the density.
+        val widthPixels = displayMetrics.widthPixels.toFloat()
+        val density = displayMetrics.density
+
+        // Calculate the ad width.
+        val adWidth = (widthPixels / density).toInt()
+
+        // Get the ad size.
+        val adSize = AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(context, adWidth)
+
+        // Set the ad size on the adView.
+        adView.adSize = adSize
+
+        // Create an ad settings bundle.
+        val adSettingsBundle = Bundle()
+
+        // Only request non-personalized ads.  <https://developers.google.com/ad-manager/mobile-ads-sdk/android/eu-consent#forward_consent_to_the_google_mobile_ads_sdk>
+        adSettingsBundle.putString("npa", "1")
+
+        // Build the ad request.
+        val adRequest = AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter::class.java, adSettingsBundle).build()
+
+        // Make it so.
+        adView.loadAd(adRequest)
+    }
+
+    // The `@JvmStatic` notation can be removed once all the code has migrated to Kotlin.
+    // This method exists here for the sake of consistency with the following two methods.
+    @JvmStatic
+    fun hideAd(view: View) {
+        // Cast the generic view to an AdView.
+        val adView = view as AdView
+
+        // Hide the ad.
+        adView.visibility = View.GONE
+    }
+
+    // The `@JvmStatic` notation can be removed once all the code has migrated to Kotlin.
+    // This method exists here so that the main WebView activity doesn't need to import `com.google.android.gms.ads.AdView`.
+    @JvmStatic
+    fun pauseAd(view: View) {
+        // Cast The generic view to an AdView.
+        val adView = view as AdView
+
+        // Pause the AdView.
+        adView.pause()
+    }
+
+    // The `@JvmStatic` notation can be removed once all the code has migrated to Kotlin.
+    // This method exists here so that the main WebView activity doesn't need to import `com.google.android.gms.ads.AdView`.
+    @JvmStatic
+    fun resumeAd(view: View) {
+        // Cast the generic view to an AdView.
+        val adView = view as AdView
+
+        // Resume the AdView.
+        adView.resume()
+    }
+}
\ No newline at end of file
index 74d4feff0d035366e83b25acdb4b2ebe048db0f2..5e0754c643e768234c0d9ce82f6a25a8fca68971 100644 (file)
@@ -34,7 +34,7 @@
 
     <body>
         <h3><a href="https://www.stoutner.com/privacy-browser-3-8/">3.8</a> (version code 55)</h3>
-        <p>24. Mai 2021 - Mindest-API 19, Ziel-API 30</p>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=1650cd6eff9ef807a84263328cb73e755250e3af">24. Mai 2021</a> - Mindest-API 19, Ziel-API 30</p>
         <ul>
             <li>Option hinzugefügt, um die <a href="https://redmine.stoutner.com/issues/143">App-Leiste unten anzuzeigen</a>.</li>
             <li>Option zum <a href="https://redmine.stoutner.com/issues/677">Speichern von Web-Archiven</a> wieder integriert.</li>
index 0da332c04b30bd10ab44811fe3884723cef63505..b4e2865b7bfa9fd9871a1d649c4a4767ab7f65ba 100644 (file)
@@ -28,7 +28,7 @@
 
     <body>
         <h3><a href="https://www.stoutner.com/privacy-browser-3-8/">3.8</a> (version code 55)</h3>
-        <p>24 May 2021 - minimum API 19, target API 30</p>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=1650cd6eff9ef807a84263328cb73e755250e3af">24 May 2021</a> - minimum API 19, target API 30</p>
         <ul>
             <li>Add an option to <a href="https://redmine.stoutner.com/issues/143">move the app bar to the bottom</a>.</li>
             <li>Reimplement the <a href="https://redmine.stoutner.com/issues/677">saving of web archives</a>.</li>
index 9e341f3356ca33a7290e1add4030b2ad010d86a8..e476e7cf60d2ddd0c409d03d5a50b962fd40e527 100644 (file)
@@ -30,7 +30,7 @@
 
     <body>
         <h3><a href="https://www.stoutner.com/privacy-browser-3-8/">3.8</a> (código de versión 55)</h3>
-        <p>24 de mayo de 2021 - API mínimo 19, API dirigido 30</p>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=1650cd6eff9ef807a84263328cb73e755250e3af">24 de mayo de 2021</a> - API mínimo 19, API dirigido 30</p>
         <ul>
             <li>Añadir una opción para <a href="https://redmine.stoutner.com/issues/143">mover la barra de aplicaciones a la parte inferior</a>.</li>
             <li>Reimplementar el <a href="https://redmine.stoutner.com/issues/677">guardar archivos web</a>.</li>
index c3b3dfb30098b118dd7c27ecdb8f534f6da5a39b..ab3249eaf6655ee4699e65a92b52011ef8e36cfe 100644 (file)
@@ -30,7 +30,7 @@
 
     <body>
         <h3><a href="https://www.stoutner.com/privacy-browser-3-8/">3.8</a> (version du code 55)</h3>
-        <p>24 Mai 2021 - API minimale : 19, API optimale : 30</p>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=1650cd6eff9ef807a84263328cb73e755250e3af">24 Mai 2021</a> - API minimale : 19, API optimale : 30</p>
         <ul>
             <li>Add an option to <a href="https://redmine.stoutner.com/issues/143">move the app bar to the bottom</a>.</li>
             <li>Reimplement the <a href="https://redmine.stoutner.com/issues/677">saving of web archives</a>.</li>
index 56fcfff45ec95a39172642c42ae1e9d68b4f7ace..879dc94dbae17b5cc7a44993e616dbf60d461338 100644 (file)
@@ -30,7 +30,7 @@
 
     <body>
         <h3><a href="https://www.stoutner.com/privacy-browser-3-8/">3.8</a> (versione codice 55)</h3>
-        <p>24 Maggio 2021 - minima API 19, target API 30</p>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=1650cd6eff9ef807a84263328cb73e755250e3af">24 Maggio 2021</a> - minima API 19, target API 30</p>
         <ul>
             <li>Aggiunta l'opzione per <a href="https://redmine.stoutner.com/issues/143">spostare in basso la barra dell'app</a>.</li>
             <li>Nuova implementazione del <a href="https://redmine.stoutner.com/issues/677">salvataggio degli archivi web</a>.</li>
index 09a3c48afc3f8da86f88a56d9d08863c7d336731..a6c8c9dedce32a6b06667252aa238f9090c3ad49 100644 (file)
@@ -30,7 +30,7 @@
 
     <body>
         <h3><a href="https://www.stoutner.com/privacy-browser-3-8/">3.8</a> (código da versão 55)</h3>
-        <p>24 May 2021 - minimum API 19, target API 30</p>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=1650cd6eff9ef807a84263328cb73e755250e3af">24 May 2021</a> - minimum API 19, target API 30</p>
         <ul>
             <li>Adicionado uma opção para <a href="https://redmine.stoutner.com/issues/143">mover a barra de aplicativos para a parte inferior</a>.</li>
             <li>Reimplementado o <a href="https://redmine.stoutner.com/issues/677">salvamento de arquivos da web</a>.</li>
index 910456adea707ab0bf95c0daa0e2c5f44a33ad20..8b99a0f88dcaa8b2d6c70018fb40b1fb20d5f93a 100644 (file)
@@ -1,6 +1,8 @@
 <!--
   Copyright © 2016-2021 Soren Stoutner <soren@stoutner.com>.
 
+  Translation 2021 Thiago Nazareno Conceição Silva de Jesus <mochileiro2006-trilhas@yahoo.com.br>.  Copyright assigned to 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
index 10ef8059ef42732a841e94db999037decf79d7b0..5a834246fab9c648e3f5739fd3840b03b707b07d 100644 (file)
@@ -1,6 +1,8 @@
 <!--
   Copyright © 2016-2021 Soren Stoutner <soren@stoutner.com>.
 
+  Translation 2021 Thiago Nazareno Conceição Silva de Jesus <mochileiro2006-trilhas@yahoo.com.br>.  Copyright assigned to 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
index 2ae0b10ce601919f91c843b1cd2ef8f6956b9166..4e6f9bdc29184588686a68a2dc810c46bba54e08 100644 (file)
@@ -1,6 +1,8 @@
 <!--
   Copyright © 2016-2018,2020-2021 Soren Stoutner <soren@stoutner.com>.
 
+  Translation 2021 Thiago Nazareno Conceição Silva de Jesus <mochileiro2006-trilhas@yahoo.com.br>.  Copyright assigned to 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
index d673636d52449b3411874be2c7e24686aecb3912..bb281fe85689fd41647757744fae2994a2c096ad 100644 (file)
@@ -1,6 +1,8 @@
 <!--
   Copyright © 2016-2018,2020-2021 Soren Stoutner <soren@stoutner.com>.
 
+  Translation 2021 Thiago Nazareno Conceição Silva de Jesus <mochileiro2006-trilhas@yahoo.com.br>.  Copyright assigned to 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
index f9828196dce99ba03744ca202096f68a83f41386..1227ff57cf3fe3d95195b23982090d4ba89ca882 100644 (file)
@@ -1,6 +1,8 @@
 <!--
   Copyright © 2016-2018,2020 Soren Stoutner <soren@stoutner.com>.
 
+  Translation 2021 Thiago Nazareno Conceição Silva de Jesus <mochileiro2006-trilhas@yahoo.com.br>.  Copyright assigned to 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
index 483f1d1bd5278e9967c21763d59d8f0b26124b24..687dd2eac51d9c44494fd7c5d7ec40950b722379 100644 (file)
@@ -28,7 +28,7 @@
 
     <body>
         <h3><a href="https://www.stoutner.com/privacy-browser-3-8/">3.8</a> (код версии 55)</h3>
-        <p>24 мая 2021 года - минимальный API 19, целевой API 30</p>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=1650cd6eff9ef807a84263328cb73e755250e3af">24 мая 2021 года</a> - минимальный API 19, целевой API 30</p>
         <ul>
             <li>Добавлена возможность перемещения <a href="https://redmine.stoutner.com/issues/143">панели приложения в нижнюю часть</a>.</li>
             <li>Реализовано <a href="https://redmine.stoutner.com/issues/677">сохранение веб-архивов</a>.</li>
index 1cb2aabbfdb70bbb1dda32d52291619d5727c574..b77fc7adb607830c5eb7a83ef302f48f64d28d39 100644 (file)
@@ -28,7 +28,7 @@
 
     <body>
         <h3><a href="https://www.stoutner.com/privacy-browser-3-8/">3.8</a> (version code 55)</h3>
-        <p>24 Mayıs 2021 - minimum API 19, target API 30</p>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=1650cd6eff9ef807a84263328cb73e755250e3af">24 Mayıs 2021</a> - minimum API 19, target API 30</p>
         <ul>
             <li>Add an option to <a href="https://redmine.stoutner.com/issues/143">move the app bar to the bottom</a>.</li>
             <li>Reimplement the <a href="https://redmine.stoutner.com/issues/677">saving of web archives</a>.</li>
index c7e7494e471dfe4755bacacedaa5a57d89d23baf..8661af0a99f256ee3d84bd3642b55311a5c97d77 100644 (file)
@@ -115,11 +115,7 @@ class MoveToFolderDialog : DialogFragment() {
         val currentThemeStatus = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
 
         // Set the icon according to the theme.
-        if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-            dialogBuilder.setIcon(R.drawable.move_to_folder_blue_day)
-        } else {
-            dialogBuilder.setIcon(R.drawable.move_to_folder_blue_night)
-        }
+        dialogBuilder.setIconAttribute(R.attr.moveToFolderBlueIcon)
 
         // Set the title.
         dialogBuilder.setTitle(R.string.move_to_folder)
index 15e3be0945b3300910b5a558123a0ccdb183d626..c8c869f386d96c877eb738a1e3a364c187611134 100644 (file)
@@ -75,11 +75,7 @@ class OpenDialog : DialogFragment() {
         val currentThemeStatus = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
 
         // Set the icon according to the theme.
-        if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-            dialogBuilder.setIcon(R.drawable.proxy_enabled_day)
-        } else {
-            dialogBuilder.setIcon(R.drawable.proxy_enabled_night)
-        }
+        dialogBuilder.setIconAttribute(R.attr.proxyBlueIcon)
 
         // Set the title.
         dialogBuilder.setTitle(R.string.open)
index c3a5c7fed3034a741b36014982cf270aaa9fed18..20370be074a02ff30d5c001913e6ebe0b6d882ba 100644 (file)
@@ -123,11 +123,7 @@ class PinnedMismatchDialog : DialogFragment() {
             val currentThemeStatus = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
 
             // Set the icon according to the theme.
-            if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-                dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_day)
-            } else {
-                dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_night)
-            }
+            dialogBuilder.setIconAttribute(R.attr.sslCertificateBlueIcon)
         } else {  // There is a favorite icon.
             // Create a drawable version of the favorite icon.
             val favoriteIconDrawable: Drawable = BitmapDrawable(resources, favoriteIconBitmap)
index ee22df72b2b84e8cd5925e6064a5033e0eb76433..d43f958c362ffb43687ddc643b0fd94cc258b7a9 100644 (file)
@@ -67,11 +67,7 @@ class ProxyNotInstalledDialog : DialogFragment() {
         val currentThemeStatus = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
 
         // Set the icon according to the theme.
-        if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-            dialogBuilder.setIcon(R.drawable.proxy_enabled_day)
-        } else {
-            dialogBuilder.setIcon(R.drawable.proxy_enabled_night)
-        }
+        dialogBuilder.setIconAttribute(R.attr.proxyBlueIcon)
 
         // Set the title and the message according to the proxy mode.
         when (proxyMode) {
index 312ebd05936fa52f50124f7fc075ae58cb3017a8..317e05b8c3ef67977bf5cab692a6ec16cfa13e1c 100644 (file)
@@ -104,11 +104,7 @@ class SaveDialog : DialogFragment() {
                 dialogBuilder.setTitle(R.string.save_logcat)
 
                 // Set the icon according to the theme.
-                if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-                    dialogBuilder.setIcon(R.drawable.save_dialog_day)
-                } else {
-                    dialogBuilder.setIcon(R.drawable.save_dialog_night)
-                }
+                dialogBuilder.setIconAttribute(R.attr.saveBlueIcon)
             }
 
             SAVE_ABOUT_VERSION_TEXT -> {
@@ -116,11 +112,7 @@ class SaveDialog : DialogFragment() {
                 dialogBuilder.setTitle(R.string.save_text)
 
                 // Set the icon according to the theme.
-                if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-                    dialogBuilder.setIcon(R.drawable.save_text_blue_day)
-                } else {
-                    dialogBuilder.setIcon(R.drawable.save_text_blue_night)
-                }
+                dialogBuilder.setIconAttribute(R.attr.saveTextBlueIcon)
             }
 
             SAVE_ABOUT_VERSION_IMAGE -> {
@@ -128,11 +120,7 @@ class SaveDialog : DialogFragment() {
                 dialogBuilder.setTitle(R.string.save_image)
 
                 // Set the icon according to the theme.
-                if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-                    dialogBuilder.setIcon(R.drawable.images_enabled_day)
-                } else {
-                    dialogBuilder.setIcon(R.drawable.images_enabled_night)
-                }
+                dialogBuilder.setIconAttribute(R.attr.imagesBlueIcon)
             }
         }
 
index d3420f3072432c4bf41fffc607135eb9c038cdd3..15b9c85e0fc9e2b21552f3ab5d92c842baa58bc2 100644 (file)
@@ -130,11 +130,7 @@ class SaveWebpageDialog : DialogFragment() {
                 dialogBuilder.setTitle(R.string.save_url)
 
                 // Set the icon according to the theme.
-                if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-                    dialogBuilder.setIcon(R.drawable.copy_enabled_day)
-                } else {
-                    dialogBuilder.setIcon(R.drawable.copy_enabled_night)
-                }
+                dialogBuilder.setIconAttribute(R.attr.copyBlueIcon)
             }
 
             SAVE_ARCHIVE -> {
@@ -142,11 +138,7 @@ class SaveWebpageDialog : DialogFragment() {
                 dialogBuilder.setTitle(R.string.save_archive)
 
                 // Set the icon according to the theme.
-                if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-                    dialogBuilder.setIcon(R.drawable.dom_storage_cleared_day)
-                } else {
-                    dialogBuilder.setIcon(R.drawable.dom_storage_cleared_night)
-                }
+                dialogBuilder.setIconAttribute(R.attr.domStorageBlueIcon)
 
                 // Convert the URL to a URI.
                 val uri = Uri.parse(originalUrlString)
@@ -160,11 +152,7 @@ class SaveWebpageDialog : DialogFragment() {
                 dialogBuilder.setTitle(R.string.save_image)
 
                 // Set the icon according to the theme.
-                if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-                    dialogBuilder.setIcon(R.drawable.images_enabled_day)
-                } else {
-                    dialogBuilder.setIcon(R.drawable.images_enabled_night)
-                }
+                dialogBuilder.setIconAttribute(R.attr.imagesBlueIcon)
 
                 // Convert the URL to a URI.
                 val uri = Uri.parse(originalUrlString)
index 2b7e345b99bf5179cf14b598e63bc4ce1d9301a4..0d63f54444086243b7860f9497079052880d0ede 100644 (file)
@@ -100,11 +100,7 @@ class ViewRequestDialog : DialogFragment() {
         val currentThemeStatus = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
 
         // Set the icon according to the theme.
-        if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-            dialogBuilder.setIcon(R.drawable.block_ads_enabled_day)
-        } else {
-            dialogBuilder.setIcon(R.drawable.block_ads_enabled_night)
-        }
+        dialogBuilder.setIconAttribute(R.attr.blockAdsBlueIcon)
 
         // Set the title.
         dialogBuilder.setTitle(resources.getString(R.string.request_details) + " - " + id)
index 2e487e596af84c0798b59a93d94c09f2e0902c19..f92a1b80e14953de2df4f0b8932198760b447c72 100644 (file)
         <item name="selectAllIcon">@drawable/select_all_night</item>
         <item name="shareIcon">@drawable/share_night</item>
         <item name="sortIcon">@drawable/sort_night</item>
-
-        <!-- Dialog Icons. -->
-        <item name="aboutBlueIcon">@drawable/about_blue_night</item>
-        <item name="domainsBlueIcon">@drawable/domains_night</item>
-        <item name="fontSizeBlueIcon">@drawable/font_size_night</item>
-        <item name="lockBlueIcon">@drawable/lock_night</item>
-        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_night</item>
     </style>
 
     <style name="PrivacyBrowserAppBar" parent="ThemeOverlay.AppCompat.DayNight.ActionBar" >
     </style>
 
     <style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
+        <!-- Colors. -->
         <item name="colorAccent">@color/violet_500</item>
+
+        <!-- Dialog Icons. -->
+        <item name="aboutBlueIcon">@drawable/about_blue_night</item>
+        <item name="blockAdsBlueIcon">@drawable/block_ads_enabled_night</item>
+        <item name="copyBlueIcon">@drawable/copy_enabled_night</item>
+        <item name="domainsBlueIcon">@drawable/domains_night</item>
+        <item name="domStorageBlueIcon">@drawable/dom_storage_cleared_night</item>
+        <item name="fontSizeBlueIcon">@drawable/font_size_night</item>
+        <item name="imagesBlueIcon">@drawable/images_enabled_night</item>
+        <item name="lockBlueIcon">@drawable/lock_night</item>
+        <item name="moveToFolderBlueIcon">@drawable/move_to_folder_blue_night</item>
+        <item name="proxyBlueIcon">@drawable/proxy_enabled_night</item>
+        <item name="saveBlueIcon">@drawable/save_dialog_night</item>
+        <item name="saveTextBlueIcon">@drawable/save_text_blue_night</item>
+        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_night</item>
     </style>
 </resources>
\ No newline at end of file
index a11d63716345719c9ab38d5b68211ca8a9e3ef5f..1f147492c85cfde7e58ae7c85752f81e9384a37f 100644 (file)
         <item name="selectAllIcon">@drawable/select_all_night</item>
         <item name="shareIcon">@drawable/share_night</item>
         <item name="sortIcon">@drawable/sort_night</item>
-
-        <!-- Dialog Icons. -->
-        <item name="aboutBlueIcon">@drawable/about_blue_night</item>
-        <item name="domainsBlueIcon">@drawable/domains_night</item>
-        <item name="fontSizeBlueIcon">@drawable/font_size_night</item>
-        <item name="lockBlueIcon">@drawable/lock_night</item>
-        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_night</item>
     </style>
 
     <style name="PrivacyBrowserAppBar" parent="ThemeOverlay.AppCompat.DayNight.ActionBar" >
     </style>
 
     <style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
+        <!-- Colors. -->
         <item name="colorAccent">@color/violet_500</item>
+
+        <!-- Dialog Icons. -->
+        <item name="aboutBlueIcon">@drawable/about_blue_night</item>
+        <item name="blockAdsBlueIcon">@drawable/block_ads_enabled_night</item>
+        <item name="copyBlueIcon">@drawable/copy_enabled_night</item>
+        <item name="domainsBlueIcon">@drawable/domains_night</item>
+        <item name="domStorageBlueIcon">@drawable/dom_storage_cleared_night</item>
+        <item name="fontSizeBlueIcon">@drawable/font_size_night</item>
+        <item name="imagesBlueIcon">@drawable/images_enabled_night</item>
+        <item name="lockBlueIcon">@drawable/lock_night</item>
+        <item name="moveToFolderBlueIcon">@drawable/move_to_folder_blue_night</item>
+        <item name="proxyBlueIcon">@drawable/proxy_enabled_night</item>
+        <item name="saveBlueIcon">@drawable/save_dialog_night</item>
+        <item name="saveTextBlueIcon">@drawable/save_text_blue_night</item>
+        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_night</item>
     </style>
 </resources>
\ No newline at end of file
index d940112db531616a5070f3c5154e323735990d7c..51a456e83da17d5eab9b103ffd1d1d66e16ab85f 100644 (file)
         <item name="selectAllIcon">@drawable/select_all_night</item>
         <item name="shareIcon">@drawable/share_night</item>
         <item name="sortIcon">@drawable/sort_night</item>
-
-        <!-- Dialog Icons. -->
-        <item name="aboutBlueIcon">@drawable/about_blue_night</item>
-        <item name="domainsBlueIcon">@drawable/domains_night</item>
-        <item name="fontSizeBlueIcon">@drawable/font_size_night</item>
-        <item name="lockBlueIcon">@drawable/lock_night</item>
-        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_night</item>
     </style>
 
     <style name="PrivacyBrowserAppBar" parent="ThemeOverlay.AppCompat.DayNight.ActionBar" >
     </style>
 
     <style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
+        <!-- Colors. -->
         <item name="colorAccent">@color/violet_500</item>
+
+        <!-- Dialog Icons. -->
+        <item name="aboutBlueIcon">@drawable/about_blue_night</item>
+        <item name="blockAdsBlueIcon">@drawable/block_ads_enabled_night</item>
+        <item name="copyBlueIcon">@drawable/copy_enabled_night</item>
+        <item name="domainsBlueIcon">@drawable/domains_night</item>
+        <item name="domStorageBlueIcon">@drawable/dom_storage_cleared_night</item>
+        <item name="fontSizeBlueIcon">@drawable/font_size_night</item>
+        <item name="imagesBlueIcon">@drawable/images_enabled_night</item>
+        <item name="lockBlueIcon">@drawable/lock_night</item>
+        <item name="moveToFolderBlueIcon">@drawable/move_to_folder_blue_night</item>
+        <item name="proxyBlueIcon">@drawable/proxy_enabled_night</item>
+        <item name="saveBlueIcon">@drawable/save_dialog_night</item>
+        <item name="saveTextBlueIcon">@drawable/save_text_blue_night</item>
+        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_night</item>
     </style>
 </resources>
\ No newline at end of file
index 94734222e558aae08e8f32bd9caf2bf36ad6042d..266d5b7a2e5448e9ae88a896012da3a46f79a759 100644 (file)
         <item name="selectAllIcon">@drawable/select_all_day</item>
         <item name="shareIcon">@drawable/share_day</item>
         <item name="sortIcon">@drawable/sort_day</item>
-
-        <!-- Dialog Icons. -->
-        <item name="aboutBlueIcon">@drawable/about_blue_day</item>
-        <item name="domainsBlueIcon">@drawable/domains_day</item>
-        <item name="fontSizeBlueIcon">@drawable/font_size_day</item>
-        <item name="lockBlueIcon">@drawable/lock_day</item>
-        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_day</item>
     </style>
 
     <style name="PrivacyBrowserAppBar" parent="ThemeOverlay.AppCompat.DayNight.ActionBar" >
     </style>
 
     <style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
+        <!-- Colors. -->
         <item name="colorAccent">@color/blue_700</item>
+
+        <!-- Dialog Icons. -->
+        <item name="aboutBlueIcon">@drawable/about_blue_day</item>
+        <item name="blockAdsBlueIcon">@drawable/block_ads_enabled_day</item>
+        <item name="copyBlueIcon">@drawable/copy_enabled_day</item>
+        <item name="domainsBlueIcon">@drawable/domains_day</item>
+        <item name="domStorageBlueIcon">@drawable/dom_storage_cleared_day</item>
+        <item name="fontSizeBlueIcon">@drawable/font_size_day</item>
+        <item name="imagesBlueIcon">@drawable/images_enabled_day</item>
+        <item name="lockBlueIcon">@drawable/lock_day</item>
+        <item name="moveToFolderBlueIcon">@drawable/move_to_folder_blue_day</item>
+        <item name="proxyBlueIcon">@drawable/proxy_enabled_day</item>
+        <item name="saveBlueIcon">@drawable/save_dialog_day</item>
+        <item name="saveTextBlueIcon">@drawable/save_text_blue_day</item>
+        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_day</item>
     </style>
 </resources>
\ No newline at end of file
index 34da5360b39eb091cc42fbfe6087a4c1261fe31c..2cfe87ee9869394f2612d6b82dea9452e27584cd 100644 (file)
         <item name="selectAllIcon">@drawable/select_all_day</item>
         <item name="shareIcon">@drawable/share_day</item>
         <item name="sortIcon">@drawable/sort_day</item>
-
-        <!-- Dialog Icons. -->
-        <item name="aboutBlueIcon">@drawable/about_blue_day</item>
-        <item name="domainsBlueIcon">@drawable/domains_day</item>
-        <item name="fontSizeBlueIcon">@drawable/font_size_day</item>
-        <item name="lockBlueIcon">@drawable/lock_day</item>
-        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_day</item>
     </style>
 
     <style name="PrivacyBrowserAppBar" parent="ThemeOverlay.AppCompat.DayNight.ActionBar" >
     </style>
 
     <style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
+        <!-- Colors. -->
         <item name="colorAccent">@color/blue_700</item>
+
+        <!-- Dialog Icons. -->
+        <item name="aboutBlueIcon">@drawable/about_blue_day</item>
+        <item name="blockAdsBlueIcon">@drawable/block_ads_enabled_day</item>
+        <item name="copyBlueIcon">@drawable/copy_enabled_day</item>
+        <item name="domainsBlueIcon">@drawable/domains_day</item>
+        <item name="domStorageBlueIcon">@drawable/dom_storage_cleared_day</item>
+        <item name="fontSizeBlueIcon">@drawable/font_size_day</item>
+        <item name="imagesBlueIcon">@drawable/images_enabled_day</item>
+        <item name="lockBlueIcon">@drawable/lock_day</item>
+        <item name="moveToFolderBlueIcon">@drawable/move_to_folder_blue_day</item>
+        <item name="proxyBlueIcon">@drawable/proxy_enabled_day</item>
+        <item name="saveBlueIcon">@drawable/save_dialog_day</item>
+        <item name="saveTextBlueIcon">@drawable/save_text_blue_day</item>
+        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_day</item>
     </style>
 </resources>
\ No newline at end of file
index 920e3bcd1a85cad2714c09c2f6c1f32b72282cc1..02e1b5060a1fc14daa1acb8f1b40ec50553192a6 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
-  Copyright © 2017-2020 Soren Stoutner <soren@stoutner.com>.
+  Copyright © 2017-2021 Soren Stoutner <soren@stoutner.com>.
 
   This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
 
 
     <!-- Dialog Icons. -->
     <attr name="aboutBlueIcon" format="reference" />
+    <attr name="blockAdsBlueIcon" format="reference" />
+    <attr name="copyBlueIcon" format="reference" />
     <attr name="domainsBlueIcon" format="reference" />
+    <attr name="domStorageBlueIcon" format="reference" />
     <attr name="fontSizeBlueIcon" format="reference" />
+    <attr name="imagesBlueIcon" format="reference" />
     <attr name="lockBlueIcon" format="reference" />
+    <attr name="moveToFolderBlueIcon" format="reference" />
+    <attr name="proxyBlueIcon" format="reference" />
+    <attr name="saveBlueIcon" format="reference" />
+    <attr name="saveTextBlueIcon" format="reference" />
     <attr name="sslCertificateBlueIcon" format="reference" />
 </resources>
\ No newline at end of file
index 28ab21d24a7d865519ec2f3d3072cdd340774a16..4f5e9a2e6dc24f0a4987f82d3048755ce2f4027e 100644 (file)
         <item name="selectAllIcon">@drawable/select_all_day</item>
         <item name="shareIcon">@drawable/share_day</item>
         <item name="sortIcon">@drawable/sort_day</item>
-
-        <!-- Dialog Icons. -->
-        <item name="aboutBlueIcon">@drawable/about_blue_day</item>
-        <item name="domainsBlueIcon">@drawable/domains_day</item>
-        <item name="fontSizeBlueIcon">@drawable/font_size_day</item>
-        <item name="lockBlueIcon">@drawable/lock_day</item>
-        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_day</item>
     </style>
 
     <style name="PrivacyBrowserAppBar" parent="ThemeOverlay.AppCompat.DayNight.ActionBar" >
     </style>
 
     <style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
+        <!-- Colors. -->
         <item name="colorAccent">@color/blue_700</item>
+
+        <!-- Dialog Icons. -->
+        <item name="aboutBlueIcon">@drawable/about_blue_day</item>
+        <item name="blockAdsBlueIcon">@drawable/block_ads_enabled_day</item>
+        <item name="copyBlueIcon">@drawable/copy_enabled_day</item>
+        <item name="domainsBlueIcon">@drawable/domains_day</item>
+        <item name="domStorageBlueIcon">@drawable/dom_storage_cleared_day</item>
+        <item name="fontSizeBlueIcon">@drawable/font_size_day</item>
+        <item name="imagesBlueIcon">@drawable/images_enabled_day</item>
+        <item name="lockBlueIcon">@drawable/lock_day</item>
+        <item name="moveToFolderBlueIcon">@drawable/move_to_folder_blue_day</item>
+        <item name="proxyBlueIcon">@drawable/proxy_enabled_day</item>
+        <item name="saveBlueIcon">@drawable/save_dialog_day</item>
+        <item name="saveTextBlueIcon">@drawable/save_text_blue_day</item>
+        <item name="sslCertificateBlueIcon">@drawable/ssl_certificate_enabled_day</item>
     </style>
 </resources>
\ No newline at end of file
diff --git a/app/src/standard/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.java b/app/src/standard/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.java
deleted file mode 100644 (file)
index 8223899..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright © 2018-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;
-
-// The AndroidX dialog fragment must be used or an error is produced on API <=22.
-import androidx.fragment.app.DialogFragment;
-
-public class AdConsentDialog extends DialogFragment {
-    // Do nothing because this is the standard flavor.
-}
\ No newline at end of file
diff --git a/app/src/standard/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.kt b/app/src/standard/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.kt
new file mode 100644 (file)
index 0000000..03a2765
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright © 2018-2019,2021 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 androidx.fragment.app.DialogFragment
+
+class AdConsentDialog : DialogFragment() {
+    // Do nothing because this is the standard flavor.
+}
\ No newline at end of file
diff --git a/app/src/standard/java/com/stoutner/privacybrowser/helpers/AdHelper.java b/app/src/standard/java/com/stoutner/privacybrowser/helpers/AdHelper.java
deleted file mode 100644 (file)
index d60bf09..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright © 2016-2018,2020 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.helpers;
-import android.app.Activity;
-import android.content.Context;
-import android.view.View;
-
-import androidx.fragment.app.FragmentManager;
-
-@SuppressWarnings("unused")
-public class AdHelper {
-    public static void initializeAds(View view, Context applicationContext, Activity activity, FragmentManager fragmentManager, String adUnitId) {
-        // Do nothing because this is the standard flavor.
-    }
-
-    public static void loadAd(View view, Context applicationContext, Activity activity, String adUnitId) {
-        // Do nothing because this is the standard flavor.
-    }
-
-    public static void hideAd(View view) {
-        // Do nothing because this is the standard flavor.
-    }
-
-    public static void pauseAd(View view) {
-        // Do nothing because this is the standard flavor.
-    }
-
-    public static void resumeAd(View view) {
-        // Do nothing because this is the standard flavor.
-    }
-}
\ No newline at end of file
diff --git a/app/src/standard/java/com/stoutner/privacybrowser/helpers/AdHelper.kt b/app/src/standard/java/com/stoutner/privacybrowser/helpers/AdHelper.kt
new file mode 100644 (file)
index 0000000..50d1db2
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2016-2018,2020-2021 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.helpers
+
+import android.app.Activity
+import android.content.Context
+import android.view.View
+
+import androidx.fragment.app.FragmentManager
+
+// The `@JvmStatic` notation can be removed once all the code has migrated to Kotlin.
+@Suppress("UNUSED_PARAMETER")
+object AdHelper {
+    @JvmStatic
+    fun initializeAds(view: View, context: Context, activity: Activity, fragmentManager: FragmentManager, adUnitId: String) {
+        // Do nothing because this is the standard flavor.
+    }
+
+    @JvmStatic
+    fun loadAd(view: View, context: Context, activity: Activity, adUnitId: String) {
+        // Do nothing because this is the standard flavor.
+    }
+
+    @JvmStatic
+    fun hideAd(view: View) {
+        // Do nothing because this is the standard flavor.
+    }
+
+    @JvmStatic
+    fun pauseAd(view: View) {
+        // Do nothing because this is the standard flavor.
+    }
+
+    @JvmStatic
+    fun resumeAd(view: View) {
+        // Do nothing because this is the standard flavor.
+    }
+}
\ No newline at end of file