diff options
| author | Matthew Wong <wongma@protonmail.ch> | 2015-12-31 05:14:37 -0500 |
|---|---|---|
| committer | Matthew Wong <wongma@protonmail.ch> | 2015-12-31 05:14:37 -0500 |
| commit | a782c3f83e6f40ad24f6ffbb3fa5b0d5b4f409f5 (patch) | |
| tree | e251224ccd90d2b9bc4bbbe867ab17659e00d878 /app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java | |
| parent | 1d9e3b50a5e186e1f2b068739dfd66c3c3f8c8aa (diff) | |
| download | HardenedPass-a782c3f83e6f40ad24f6ffbb3fa5b0d5b4f409f5.tar.gz HardenedPass-a782c3f83e6f40ad24f6ffbb3fa5b0d5b4f409f5.zip | |
Add 'pick password' option that shows only when no other items are available (+travis)
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java index 6d11936b..0f184bb7 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java @@ -7,16 +7,19 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; +import com.zeapo.pwdstore.PasswordStore; + // blank activity started by service for calling startIntentSenderForResult public class AutofillActivity extends AppCompatActivity { public static final int REQUEST_CODE_DECRYPT_AND_VERIFY = 9913; + public static final int REQUEST_CODE_MATCH_WITH = 777; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); - if (extras != null) { + if (extras != null && extras.containsKey("pending_intent")) { try { PendingIntent pi = extras.getParcelable("pending_intent"); if (pi == null) { @@ -27,14 +30,26 @@ public class AutofillActivity extends AppCompatActivity { } catch (IntentSender.SendIntentException e) { Log.e(AutofillService.Constants.TAG, "SendIntentException", e); } + } else if (extras != null && extras.containsKey("matchWith")) { + Intent intent = new Intent(getApplicationContext(), PasswordStore.class); + intent.putExtra("matchWith", true); + startActivityForResult(intent, REQUEST_CODE_MATCH_WITH); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { finish(); // go back to the password field app - if (resultCode == RESULT_OK) { - AutofillService.setResultData(data); // report the result to service + switch (requestCode) { + case REQUEST_CODE_DECRYPT_AND_VERIFY: + if (resultCode == RESULT_OK) { + AutofillService.getInstance().setResultData(data); // report the result to service + } + break; + case REQUEST_CODE_MATCH_WITH: + if (resultCode == RESULT_OK) { + AutofillService.getInstance().setPickedPassword(data.getStringExtra("path")); + } } } } |
