Removed some unnecessary static call

This commit is contained in:
PeratX 2017-05-23 18:34:21 +08:00
parent f75f78da83
commit 39d199a69d
3 changed files with 26 additions and 26 deletions

View File

@ -96,8 +96,8 @@ public class Daedalus extends Application {
private static String configPath = null;
private static Daedalus instance = null;
private static SharedPreferences prefs;
private static Thread mHostsResolver;
private SharedPreferences prefs;
private Thread mHostsResolver;
@Override
public void onCreate() {
@ -159,8 +159,9 @@ public class Daedalus extends Application {
}
}
}
public static SharedPreferences getPrefs() {
return prefs;
return getInstance().prefs;
}
@Override

View File

@ -207,29 +207,28 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
updateMainButton(R.string.button_text_activate);
}
int fragment = intent.getIntExtra(LAUNCH_FRAGMENT, FRAGMENT_NONE);
switch (fragment) {
case FRAGMENT_ABOUT:
switchFragment(new AboutFragment());
break;
case FRAGMENT_DNS_SERVERS:
switchFragment(new DnsServersFragment());
break;
case FRAGMENT_DNS_TEST:
switchFragment(new DnsTestFragment());
break;
case FRAGMENT_MAIN:
switchFragment(new MainFragment());
break;
case FRAGMENT_RULES:
switchFragment(new RulesFragment());
break;
case FRAGMENT_SETTINGS:
switchFragment(new SettingsFragment());
}
if (currentFragment == null) {
switchFragment(new MainFragment());
} else {
int fragment = intent.getIntExtra(LAUNCH_FRAGMENT, FRAGMENT_NONE);
switch (fragment) {
case FRAGMENT_ABOUT:
switchFragment(new AboutFragment());
break;
case FRAGMENT_DNS_SERVERS:
switchFragment(new DnsServersFragment());
break;
case FRAGMENT_DNS_TEST:
switchFragment(new DnsTestFragment());
break;
case FRAGMENT_MAIN:
switchFragment(new MainFragment());
break;
case FRAGMENT_RULES:
switchFragment(new RulesFragment());
break;
case FRAGMENT_SETTINGS:
switchFragment(new SettingsFragment());
}
}
}

View File

@ -47,7 +47,7 @@ public class DaedalusVpnService extends VpnService implements Runnable {
public static String primaryServer;
public static String secondaryServer;
private static NotificationCompat.Builder notification = null;
private NotificationCompat.Builder notification = null;
private boolean running = false;
private long lastUpdate = 0;
@ -97,7 +97,7 @@ public class DaedalusVpnService extends VpnService implements Runnable {
manager.notify(NOTIFICATION_ACTIVATED, notification);
DaedalusVpnService.notification = builder;
this.notification = builder;
}
Daedalus.initHostsResolver();