mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
Actually fix app shortcuts
This commit is contained in:
parent
456069fbc7
commit
89c61eab3e
2 changed files with 22 additions and 16 deletions
|
@ -19,7 +19,7 @@
|
|||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.Default.NoActionBar"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:relinquishTaskIdentity="false">
|
||||
android:launchMode="singleTask">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
|
|
|
@ -53,7 +53,6 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
|||
private DatabaseManager _db;
|
||||
private KeyProfileView _keyProfileView;
|
||||
|
||||
private String _pendingAction = null;
|
||||
private boolean _nightMode = false;
|
||||
private Menu _menu;
|
||||
|
||||
|
@ -68,9 +67,8 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
|||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
// init the app shortcuts and execute any pending actions
|
||||
// init the app shortcuts
|
||||
initializeAppShortcuts();
|
||||
doShortcutActions();
|
||||
|
||||
// set up the key profile view
|
||||
_keyProfileView = (KeyProfileView) getSupportFragmentManager().findFragmentById(R.id.key_profiles);
|
||||
|
@ -115,6 +113,16 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
|
||||
if (!doShortcutActions()) {
|
||||
startAuthActivity();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPreferredTheme(boolean nightMode) {
|
||||
if (nightMode) {
|
||||
|
@ -127,6 +135,10 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
|||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (requestCode) {
|
||||
case CODE_GET_KEYINFO:
|
||||
onGetKeyInfoResult(resultCode, data);
|
||||
|
@ -373,20 +385,11 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
|||
startActivityForResult(scannerActivity, CODE_GET_KEYINFO);
|
||||
}
|
||||
|
||||
private void doShortcutActions() {
|
||||
private boolean doShortcutActions() {
|
||||
Intent intent = getIntent();
|
||||
String action = intent.getStringExtra("action");
|
||||
intent.removeExtra("action");
|
||||
if (action == null) {
|
||||
if (_pendingAction == null) {
|
||||
return;
|
||||
} else {
|
||||
action = _pendingAction;
|
||||
}
|
||||
}
|
||||
if (_db.isLocked()) {
|
||||
_pendingAction = action;
|
||||
return;
|
||||
if (action == null || _db.isLocked()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
|
@ -394,6 +397,9 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
|||
startScanActivity();
|
||||
break;
|
||||
}
|
||||
|
||||
intent.removeExtra("action");
|
||||
return true;
|
||||
}
|
||||
|
||||
public void startActivityForResult(Intent intent, int requestCode) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue