diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-08 23:59:25 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-08 23:59:25 +0200 |
commit | d50e0f5fb9d60992d65a818a8af1cc20e878e312 (patch) | |
tree | 51770336860a381739173e754123bd4c111e8cd6 /app | |
parent | c696e9f2755e236afffffd1135e01c51cc25682b (diff) |
Use instanceOf instead of getClass
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app')
3 files changed, 3 insertions, 3 deletions
diff --git a/app/src/main/java/com/wireguard/android/BootShutdownReceiver.java b/app/src/main/java/com/wireguard/android/BootShutdownReceiver.java index 1a8c96a0..3b9f852d 100644 --- a/app/src/main/java/com/wireguard/android/BootShutdownReceiver.java +++ b/app/src/main/java/com/wireguard/android/BootShutdownReceiver.java @@ -21,7 +21,7 @@ public class BootShutdownReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, final Intent intent) { Application.onHaveBackend(backend -> { - if (backend.getClass() != WgQuickBackend.class) + if (!(backend instanceof WgQuickBackend)) return; final String action = intent.getAction(); if (action == null) diff --git a/app/src/main/java/com/wireguard/android/activity/BaseActivity.java b/app/src/main/java/com/wireguard/android/activity/BaseActivity.java index b7aee1e3..e5aaadf2 100644 --- a/app/src/main/java/com/wireguard/android/activity/BaseActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/BaseActivity.java @@ -54,7 +54,7 @@ public abstract class BaseActivity extends ThemeChangeAwareActivity { super.onCreate(savedInstanceState); Application.onHaveBackend(backend -> { - if (backend.getClass() == GoBackend.class) { + if (backend instanceof GoBackend) { final Intent intent = GoBackend.VpnService.prepare(this); if (intent != null) startActivityForResult(intent, 0); diff --git a/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java b/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java index a8d58e6e..ed2da4dc 100644 --- a/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java @@ -102,7 +102,7 @@ public class SettingsActivity extends ThemeChangeAwareActivity { final PreferenceScreen screen = getPreferenceScreen(); Application.onHaveBackend(backend -> { for (final Preference pref : wgQuickOnlyPrefs) { - if (backend.getClass() == WgQuickBackend.class) + if (backend instanceof WgQuickBackend) pref.setVisible(true); else screen.removePreference(pref); |