Merge pull request #255 from shanempope/dev

Fixing issue where Search opens new task instead of using same task.
This commit is contained in:
bpellin
2018-01-02 22:26:35 -06:00
committed by GitHub

View File

@@ -21,6 +21,7 @@ package com.keepassdroid;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
@@ -278,6 +279,22 @@ public abstract class GroupBaseActivity extends LockCloseListActivity {
}
}
}
@Override
public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
/*
* ACTION_SEARCH automatically forces a new task. This occurs when you open a kdb file in
* another app such as Files or GoogleDrive and then Search for an entry. Here we remove the
* FLAG_ACTIVITY_NEW_TASK flag bit allowing search to open it's activity in the current task.
*/
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
int flags = intent.getFlags();
flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK;
intent.setFlags(flags);
}
super.startActivityForResult(intent, requestCode, options);
}
public class AfterDeleteGroup extends OnFinish {
public AfterDeleteGroup(Handler handler) {