diff --git a/app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java b/app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java index 0400eca..66a32cc 100644 --- a/app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java +++ b/app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java @@ -1284,7 +1284,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements Log.d(TAG, "onPause"); mTabsManager.pauseAll(); try { - BrowserApp.get(this).unregisterReceiver(mNetworkReceiver); + getApplication().unregisterReceiver(mNetworkReceiver); } catch (IllegalArgumentException e) { Log.e(TAG, "Receiver was not registered", e); } @@ -1349,7 +1349,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements IntentFilter filter = new IntentFilter(); filter.addAction(NETWORK_BROADCAST_ACTION); - BrowserApp.get(this).registerReceiver(mNetworkReceiver, filter); + getApplication().registerReceiver(mNetworkReceiver, filter); mEventBus.register(mBusEventListener); diff --git a/app/src/main/java/acr/browser/lightning/app/BrowserApp.java b/app/src/main/java/acr/browser/lightning/app/BrowserApp.java index c09f688..8b66e75 100644 --- a/app/src/main/java/acr/browser/lightning/app/BrowserApp.java +++ b/app/src/main/java/acr/browser/lightning/app/BrowserApp.java @@ -93,11 +93,6 @@ public class BrowserApp extends Application { }); } - @NonNull - public static BrowserApp get(@NonNull Context context) { - return (BrowserApp) context.getApplicationContext(); - } - @NonNull public static AppComponent getAppComponent() { Preconditions.checkNonNull(sAppComponent); diff --git a/app/src/main/java/acr/browser/lightning/utils/ProxyUtils.java b/app/src/main/java/acr/browser/lightning/utils/ProxyUtils.java index 4bdc5f3..85acd54 100644 --- a/app/src/main/java/acr/browser/lightning/utils/ProxyUtils.java +++ b/app/src/main/java/acr/browser/lightning/utils/ProxyUtils.java @@ -202,9 +202,8 @@ public class ProxyUtils { Utils.showSnackbar(activity, R.string.install_orbot); } break; - case Constants.PROXY_I2P: - I2PAndroidHelper ih = new I2PAndroidHelper(BrowserApp.get(activity)); + I2PAndroidHelper ih = new I2PAndroidHelper(activity.getApplication()); if (!ih.isI2PAndroidInstalled()) { choice = Constants.NO_PROXY; ih.promptToInstall(activity);