diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-02-01 16:17:33 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-02-01 16:17:33 +0100 |
commit | 5359205b5081134b31656696d426f8ed9a522679 (patch) | |
tree | 8df89db3971010e6d988bc9fbfa68b5495c81ee1 /OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java | |
parent | 4c8809042fcdf1a69ecd303e32ed66783eaae39c (diff) | |
download | open-keychain-5359205b5081134b31656696d426f8ed9a522679.tar.gz open-keychain-5359205b5081134b31656696d426f8ed9a522679.tar.bz2 open-keychain-5359205b5081134b31656696d426f8ed9a522679.zip |
Fix layout, add API notes to README, register fingerprint URIs, some reformatting (sry)
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java')
-rw-r--r-- | OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java index 3ede641d3..9d7d16a42 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java @@ -26,6 +26,7 @@ import org.sufficientlysecure.keychain.util.IntentIntegratorSupportV4; import org.sufficientlysecure.keychain.util.Log; import android.content.Intent; +import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; @@ -101,8 +102,8 @@ public class ImportKeysQrCodeFragment extends Fragment { Log.d(Constants.TAG, "scanResult content: " + scanResult.getContents()); // look if it's fingerprint only - if (scanResult.getContents().toLowerCase(Locale.ENGLISH).startsWith("openpgp4fpr")) { - importFingerprint(scanResult.getContents().toLowerCase(Locale.ENGLISH)); + if (scanResult.getContents().toLowerCase(Locale.ENGLISH).startsWith(ImportKeysActivity.FINGERPRINT_SCHEME)) { + importFingerprint(Uri.parse(scanResult.getContents())); return; } @@ -128,21 +129,8 @@ public class ImportKeysQrCodeFragment extends Fragment { } } - private void importFingerprint(String uri) { - String fingerprint = uri.split(":")[1]; - - Log.d(Constants.TAG, "fingerprint: " + fingerprint); - - if (fingerprint.length() < 16) { - Toast.makeText(getActivity(), R.string.import_qr_code_too_short_fingerprint, - Toast.LENGTH_LONG).show(); - return; - } - - Intent queryIntent = new Intent(getActivity(), KeyServerQueryActivity.class); - queryIntent.setAction(KeyServerQueryActivity.ACTION_LOOK_UP_KEY_ID); - queryIntent.putExtra(KeyServerQueryActivity.EXTRA_FINGERPRINT, fingerprint); - startActivity(queryIntent); + public void importFingerprint(Uri dataUri) { + mImportActivity.loadFromFingerprintUri(dataUri); } private void importParts(String[] parts) { |