aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java22
-rw-r--r--src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java26
2 files changed, 30 insertions, 18 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
index d4f9c2385..545be67d1 100644
--- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
@@ -55,9 +55,6 @@ import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
-import com.google.zxing.integration.android.IntentIntegrator;
-import com.google.zxing.integration.android.IntentResult;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -645,7 +642,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
showCreateConferenceDialog();
return true;
case R.id.action_scan_qr_code:
- new IntentIntegrator(this).initiateScan(Arrays.asList("AZTEC", "QR_CODE"));
+ Intent intent = new Intent(this, UriHandlerActivity.class);
+ intent.setAction(UriHandlerActivity.ACTION_SCAN_QR_CODE);
+ startActivity(intent);
return true;
case R.id.action_hide_offline:
mHideOfflineContacts = !item.isChecked();
@@ -683,20 +682,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
- if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
- IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
- if (scanResult != null && scanResult.getFormatName() != null) {
- String data = scanResult.getContents();
- Invite invite = new Invite(data);
- if (xmppConnectionServiceBound) {
- invite.invite();
- } else if (invite.getJid() != null) {
- this.mPendingInvite = invite;
- } else {
- this.mPendingInvite = null;
- }
- }
- } else if (resultCode == RESULT_OK) {
+ if (resultCode == RESULT_OK) {
if (xmppConnectionServiceBound) {
this.mPostponedActivityResult = null;
if (requestCode == REQUEST_CREATE_CONFERENCE) {
diff --git a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java
index 43d2d6db7..e43e1ccd7 100644
--- a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java
@@ -4,11 +4,17 @@ import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
+import com.google.zxing.integration.android.IntentIntegrator;
+import com.google.zxing.integration.android.IntentResult;
+
+import java.util.Arrays;
+
import de.pixart.messenger.persistance.DatabaseBackend;
import de.pixart.messenger.utils.XmppUri;
import de.pixart.messenger.xmpp.jid.Jid;
public class UriHandlerActivity extends Activity {
+ public static final String ACTION_SCAN_QR_CODE = "scan_qr_code";
@Override
public void onStart() {
@@ -66,8 +72,28 @@ public class UriHandlerActivity extends Activity {
case Intent.ACTION_VIEW:
case Intent.ACTION_SENDTO:
handleUri(data.getData());
+ break;
+ case ACTION_SCAN_QR_CODE:
+ new IntentIntegrator(this).initiateScan(Arrays.asList("AZTEC", "QR_CODE"));
+ return;
+ }
+
+ finish();
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
+ IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode,
+ intent);
+
+ if (scanResult != null && scanResult.getFormatName() != null) {
+ String data = scanResult.getContents();
+ handleUri(Uri.parse(data));
+ }
}
finish();
+ super.onActivityResult(requestCode, requestCode, intent);
}
} \ No newline at end of file