summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2022-08-08 00:02:48 +0200
committercyBerta <cyberta@riseup.net>2022-08-08 00:02:48 +0200
commitcdcc1e3d7b57fdddcbc0c9b9595c80719d38dc98 (patch)
treee079b63a0bf39209390c3da4233138d849a1f253 /app/src/main/java
parentb1cb49a2f78c80db0b3fa037a0b4e3c1c9c7dd61 (diff)
update gradle plugin to version 7.2.2, compile and target sdk to API 31, androidx libraries and leakcanary to latest versions
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/BitmaskApp.java46
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java30
2 files changed, 25 insertions, 51 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/BitmaskApp.java b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskApp.java
index 3f73e49d..828ef27d 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/BitmaskApp.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskApp.java
@@ -17,6 +17,15 @@
package se.leap.bitmaskclient.base;
+import static android.content.Intent.CATEGORY_DEFAULT;
+import static se.leap.bitmaskclient.appUpdate.DownloadBroadcastReceiver.ACTION_DOWNLOAD;
+import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.CHECK_VERSION_FILE;
+import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.DOWNLOAD_UPDATE;
+import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_DOWNLOAD_SERVICE_EVENT;
+import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
+import static se.leap.bitmaskclient.base.utils.ConfigHelper.isCalyxOSWithTetheringSupport;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSavedProviderFromSharedPreferences;
+
import android.content.Context;
import android.content.IntentFilter;
import android.content.SharedPreferences;
@@ -25,27 +34,14 @@ import androidx.appcompat.app.AppCompatDelegate;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.multidex.MultiDexApplication;
-import com.squareup.leakcanary.LeakCanary;
-import com.squareup.leakcanary.RefWatcher;
-
import se.leap.bitmaskclient.BuildConfig;
import se.leap.bitmaskclient.appUpdate.DownloadBroadcastReceiver;
-import se.leap.bitmaskclient.eip.EipSetupObserver;
import se.leap.bitmaskclient.base.models.ProviderObservable;
-import se.leap.bitmaskclient.tethering.TetheringStateManager;
import se.leap.bitmaskclient.base.utils.PRNGFixes;
-import se.leap.bitmaskclient.tor.TorNotificationManager;
+import se.leap.bitmaskclient.eip.EipSetupObserver;
+import se.leap.bitmaskclient.tethering.TetheringStateManager;
import se.leap.bitmaskclient.tor.TorStatusObservable;
-import static android.content.Intent.CATEGORY_DEFAULT;
-import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_DOWNLOAD_SERVICE_EVENT;
-import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
-import static se.leap.bitmaskclient.appUpdate.DownloadBroadcastReceiver.ACTION_DOWNLOAD;
-import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.CHECK_VERSION_FILE;
-import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.DOWNLOAD_UPDATE;
-import static se.leap.bitmaskclient.base.utils.ConfigHelper.isCalyxOSWithTetheringSupport;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSavedProviderFromSharedPreferences;
-
/**
* Created by cyberta on 24.10.17.
*/
@@ -53,7 +49,6 @@ import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSavedProvider
public class BitmaskApp extends MultiDexApplication {
private final static String TAG = BitmaskApp.class.getSimpleName();
- private RefWatcher refWatcher;
private ProviderObservable providerObservable;
private DownloadBroadcastReceiver downloadBroadcastReceiver;
private TorStatusObservable torStatusObservable;
@@ -62,12 +57,6 @@ public class BitmaskApp extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
- if (LeakCanary.isInAnalyzerProcess(this)) {
- // This process is dedicated to LeakCanary for heap analysis.
- // You should not init your app in this process.
- return;
- }
- refWatcher = LeakCanary.install(this);
// Normal app init code...*/
PRNGFixes.apply();
SharedPreferences preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE);
@@ -89,17 +78,4 @@ public class BitmaskApp extends MultiDexApplication {
LocalBroadcastManager.getInstance(this.getApplicationContext()).registerReceiver(downloadBroadcastReceiver, intentFilter);
}
}
-
- /**
- * Use this method to get a RefWatcher object that checks for memory leaks in the given context.
- * Call refWatcher.watch(this) to check if all references get garbage collected.
- * @param context
- * @return the RefWatcher object
- */
- public static RefWatcher getRefWatcher(Context context) {
- BitmaskApp application = (BitmaskApp) context.getApplicationContext();
- return application.refWatcher;
- }
-
-
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java
index c5593bf7..cdfee7b2 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java
@@ -17,6 +17,20 @@
package se.leap.bitmaskclient.base.fragments;
+import static android.content.Context.MODE_PRIVATE;
+import static android.view.View.GONE;
+import static android.view.View.VISIBLE;
+import static se.leap.bitmaskclient.base.models.Constants.DONATION_URL;
+import static se.leap.bitmaskclient.base.models.Constants.ENABLE_DONATION;
+import static se.leap.bitmaskclient.base.models.Constants.PREFERRED_CITY;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY;
+import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_SWITCH_PROVIDER;
+import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
+import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSaveBattery;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.saveBattery;
+
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -56,21 +70,6 @@ import se.leap.bitmaskclient.eip.EipStatus;
import se.leap.bitmaskclient.providersetup.ProviderListActivity;
import se.leap.bitmaskclient.tethering.TetheringObservable;
-import static android.content.Context.MODE_PRIVATE;
-import static android.view.View.GONE;
-import static android.view.View.VISIBLE;
-import static se.leap.bitmaskclient.base.BitmaskApp.getRefWatcher;
-import static se.leap.bitmaskclient.base.models.Constants.DONATION_URL;
-import static se.leap.bitmaskclient.base.models.Constants.ENABLE_DONATION;
-import static se.leap.bitmaskclient.base.models.Constants.PREFERRED_CITY;
-import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY;
-import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_SWITCH_PROVIDER;
-import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
-import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSaveBattery;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.saveBattery;
-
/**
* Fragment used for managing interactions for and presentation of a navigation drawer.
* See the <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction">
@@ -433,7 +432,6 @@ public class NavigationDrawerFragment extends Fragment implements SharedPreferen
@Override
public void onDestroy() {
super.onDestroy();
- getRefWatcher(getActivity()).watch(this);
preferences.unregisterOnSharedPreferenceChangeListener(this);
}