Use instanceOf instead of getClass

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-07-08 23:59:25 +02:00
parent c696e9f275
commit d50e0f5fb9
3 changed files with 3 additions and 3 deletions

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)

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);

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);