Fixed shortcut
This commit is contained in:
parent
6a0d7c0f3c
commit
acc9c725f0
@ -241,7 +241,7 @@ public class Daedalus extends Application {
|
|||||||
.setShortLabel(notice)
|
.setShortLabel(notice)
|
||||||
.setIcon(Icon.createWithResource(context, R.mipmap.ic_launcher))
|
.setIcon(Icon.createWithResource(context, R.mipmap.ic_launcher))
|
||||||
.setIntent(new Intent(context, MainActivity.class).setAction(Intent.ACTION_VIEW)
|
.setIntent(new Intent(context, MainActivity.class).setAction(Intent.ACTION_VIEW)
|
||||||
.putExtra(MainActivity.LAUNCH_ACTION, activate ? MainActivity.LAUNCH_ACTION_ACTIVATE : MainActivity.LAUNCH_ACTION_DEACTIVATE))
|
.putExtra(MainActivity.LAUNCH_ACTION, activate ? MainActivity.LAUNCH_ACTION_DEACTIVATE : MainActivity.LAUNCH_ACTION_ACTIVATE))
|
||||||
.build();
|
.build();
|
||||||
ShortcutManager shortcutManager = (ShortcutManager) context.getSystemService(SHORTCUT_SERVICE);
|
ShortcutManager shortcutManager = (ShortcutManager) context.getSystemService(SHORTCUT_SERVICE);
|
||||||
shortcutManager.addDynamicShortcuts(Collections.singletonList(info));
|
shortcutManager.addDynamicShortcuts(Collections.singletonList(info));
|
||||||
|
@ -180,7 +180,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||||||
DaedalusVpnService.secondaryServer = DNSServerHelper.getAddressById(DNSServerHelper.getSecondary());
|
DaedalusVpnService.secondaryServer = DNSServerHelper.getAddressById(DNSServerHelper.getSecondary());
|
||||||
Daedalus.getInstance().startService(Daedalus.getServiceIntent(getApplicationContext()).setAction(DaedalusVpnService.ACTION_ACTIVATE));
|
Daedalus.getInstance().startService(Daedalus.getServiceIntent(getApplicationContext()).setAction(DaedalusVpnService.ACTION_ACTIVATE));
|
||||||
updateMainButton(R.string.button_text_deactivate);
|
updateMainButton(R.string.button_text_deactivate);
|
||||||
Daedalus.updateShortcut(Daedalus.getInstance());
|
Daedalus.updateShortcut(getApplicationContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,14 +192,14 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateUserInterface(Intent intent) {
|
private void updateUserInterface(Intent intent) {
|
||||||
Log.d(TAG, "Updating user interface");
|
|
||||||
int launchAction = intent.getIntExtra(LAUNCH_ACTION, LAUNCH_ACTION_NONE);
|
int launchAction = intent.getIntExtra(LAUNCH_ACTION, LAUNCH_ACTION_NONE);
|
||||||
|
Log.d(TAG, "Updating user interface with Launch Action " + String.valueOf(launchAction));
|
||||||
if (launchAction == LAUNCH_ACTION_ACTIVATE) {
|
if (launchAction == LAUNCH_ACTION_ACTIVATE) {
|
||||||
this.activateService();
|
this.activateService();
|
||||||
} else if (launchAction == LAUNCH_ACTION_DEACTIVATE) {
|
} else if (launchAction == LAUNCH_ACTION_DEACTIVATE) {
|
||||||
Daedalus.deactivateService(getApplicationContext());
|
Daedalus.deactivateService(getApplicationContext());
|
||||||
} else if (launchAction == LAUNCH_ACTION_SERVICE_DONE) {
|
} else if (launchAction == LAUNCH_ACTION_SERVICE_DONE) {
|
||||||
Daedalus.updateShortcut(this.getApplicationContext());
|
Daedalus.updateShortcut(getApplicationContext());
|
||||||
if (DaedalusVpnService.isActivated()) {
|
if (DaedalusVpnService.isActivated()) {
|
||||||
updateMainButton(R.string.button_text_deactivate);
|
updateMainButton(R.string.button_text_deactivate);
|
||||||
} else {
|
} else {
|
||||||
|
@ -119,7 +119,7 @@ public class DaedalusVpnService extends VpnService implements Runnable {
|
|||||||
this.running = true;
|
this.running = true;
|
||||||
this.mThread.start();
|
this.mThread.start();
|
||||||
}
|
}
|
||||||
Daedalus.updateShortcut(this.getApplicationContext());
|
Daedalus.updateShortcut(getApplicationContext());
|
||||||
if (MainActivity.getInstance() != null) {
|
if (MainActivity.getInstance() != null) {
|
||||||
MainActivity.getInstance().startActivity(new Intent(getApplicationContext(), MainActivity.class)
|
MainActivity.getInstance().startActivity(new Intent(getApplicationContext(), MainActivity.class)
|
||||||
.putExtra(MainActivity.LAUNCH_ACTION, MainActivity.LAUNCH_ACTION_SERVICE_DONE));
|
.putExtra(MainActivity.LAUNCH_ACTION, MainActivity.LAUNCH_ACTION_SERVICE_DONE));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user