Browse Source

Use instanceOf instead of getClass

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
master
Jason A. Donenfeld 6 years ago
parent
commit
d50e0f5fb9
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      app/src/main/java/com/wireguard/android/BootShutdownReceiver.java
  2. +1
    -1
      app/src/main/java/com/wireguard/android/activity/BaseActivity.java
  3. +1
    -1
      app/src/main/java/com/wireguard/android/activity/SettingsActivity.java

+ 1
- 1
app/src/main/java/com/wireguard/android/BootShutdownReceiver.java View File

@@ -21,7 +21,7 @@ public class BootShutdownReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(final Context context, final Intent intent) { public void onReceive(final Context context, final Intent intent) {
Application.onHaveBackend(backend -> { Application.onHaveBackend(backend -> {
if (backend.getClass() != WgQuickBackend.class)
if (!(backend instanceof WgQuickBackend))
return; return;
final String action = intent.getAction(); final String action = intent.getAction();
if (action == null) if (action == null)


+ 1
- 1
app/src/main/java/com/wireguard/android/activity/BaseActivity.java View File

@@ -54,7 +54,7 @@ public abstract class BaseActivity extends ThemeChangeAwareActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);


Application.onHaveBackend(backend -> { Application.onHaveBackend(backend -> {
if (backend.getClass() == GoBackend.class) {
if (backend instanceof GoBackend) {
final Intent intent = GoBackend.VpnService.prepare(this); final Intent intent = GoBackend.VpnService.prepare(this);
if (intent != null) if (intent != null)
startActivityForResult(intent, 0); startActivityForResult(intent, 0);


+ 1
- 1
app/src/main/java/com/wireguard/android/activity/SettingsActivity.java View File

@@ -102,7 +102,7 @@ public class SettingsActivity extends ThemeChangeAwareActivity {
final PreferenceScreen screen = getPreferenceScreen(); final PreferenceScreen screen = getPreferenceScreen();
Application.onHaveBackend(backend -> { Application.onHaveBackend(backend -> {
for (final Preference pref : wgQuickOnlyPrefs) { for (final Preference pref : wgQuickOnlyPrefs) {
if (backend.getClass() == WgQuickBackend.class)
if (backend instanceof WgQuickBackend)
pref.setVisible(true); pref.setVisible(true);
else else
screen.removePreference(pref); screen.removePreference(pref);


Loading…
Cancel
Save