Use instanceOf instead of getClass
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
c696e9f275
commit
d50e0f5fb9
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user