mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 05:52:52 +00:00
Merge pull request #688 from jhenninger/feature/receive-shared-image
Add support for creating entries from shared images
This commit is contained in:
commit
085e8e51dc
2 changed files with 29 additions and 1 deletions
|
@ -48,6 +48,13 @@
|
|||
|
||||
<data android:scheme="otpauth" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:mimeType="image/*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.ScannerActivity"
|
||||
|
|
|
@ -300,7 +300,10 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
}
|
||||
|
||||
private void onScanImageResult(Intent intent) {
|
||||
Uri inputFile = (intent.getData());
|
||||
decodeQrCodeImage(intent.getData());
|
||||
}
|
||||
|
||||
private void decodeQrCodeImage(Uri inputFile) {
|
||||
Bitmap bitmap;
|
||||
|
||||
try {
|
||||
|
@ -431,6 +434,23 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
}
|
||||
}
|
||||
|
||||
private void handleSharedImage() {
|
||||
if (_app.isVaultLocked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = getIntent();
|
||||
String action = intent.getAction();
|
||||
Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
|
||||
if (Intent.ACTION_SEND.equals(action) && uri != null) {
|
||||
intent.setAction(null);
|
||||
intent.removeExtra(Intent.EXTRA_STREAM);
|
||||
|
||||
decodeQrCodeImage(uri);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
@ -475,6 +495,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
}
|
||||
|
||||
handleDeeplink();
|
||||
handleSharedImage();
|
||||
updateLockIcon();
|
||||
doShortcutActions();
|
||||
updateBackupErrorBar();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue