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

View File

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

View File

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