Browse Source

Getting rid of BrowserApp.get method

master
anthony restaino 8 years ago
parent
commit
5af0f5f0c1
  1. 4
      app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java
  2. 5
      app/src/main/java/acr/browser/lightning/app/BrowserApp.java
  3. 3
      app/src/main/java/acr/browser/lightning/utils/ProxyUtils.java

4
app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java

@ -1284,7 +1284,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements @@ -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 @@ -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);

5
app/src/main/java/acr/browser/lightning/app/BrowserApp.java

@ -93,11 +93,6 @@ public class BrowserApp extends Application { @@ -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);

3
app/src/main/java/acr/browser/lightning/utils/ProxyUtils.java

@ -202,9 +202,8 @@ public class ProxyUtils { @@ -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);

Loading…
Cancel
Save