aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/AndroidManifest.xml32
-rw-r--r--src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java38
2 files changed, 59 insertions, 11 deletions
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index e64e97f50..be2be7da6 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -84,18 +84,11 @@
android:minHeight="300dp"
android:windowSoftInputMode="stateHidden"></activity>
<activity
- android:name=".ui.StartConversationActivity"
- android:configChanges="orientation|screenSize"
+ android:name=".ui.UriHandlerActivity"
android:label="@string/title_activity_start_conversation"
+ android:theme="@android:style/Theme.NoDisplay"
android:launchMode="singleTop">
<intent-filter>
- <action android:name="android.intent.action.SENDTO" />
- <category android:name="android.intent.category.DEFAULT" />
-
- <data android:scheme="imto" />
- <data android:host="jabber" />
- </intent-filter>
- <intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
@@ -104,9 +97,11 @@
<data android:scheme="xmpp" />
</intent-filter>
<intent-filter>
- <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+ <action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
- <data android:scheme="xmpp" />
+
+ <data android:scheme="imto" />
+ <data android:host="jabber" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
@@ -121,6 +116,21 @@
</intent-filter>
</activity>
<activity
+ android:name=".ui.StartConversationActivity"
+ android:label="@string/title_activity_start_conversation"
+ android:configChanges="orientation|screenSize"
+ android:launchMode="singleTop">
+ <intent-filter>
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+
+ <data android:scheme="imto" />
+ <data android:host="jabber" />
+ </intent-filter>
+
+ </activity>
+ <activity
android:name=".ui.WelcomeActivity"
android:label="@string/app_name"
android:launchMode="singleTask" />
diff --git a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java
new file mode 100644
index 000000000..1229aae2e
--- /dev/null
+++ b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java
@@ -0,0 +1,38 @@
+package de.pixart.messenger.ui;
+
+import android.app.Activity;
+import android.content.Intent;
+
+public class UriHandlerActivity extends Activity {
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ handleIntent(getIntent());
+ }
+
+ @Override
+ public void onNewIntent(Intent intent) {
+ handleIntent(intent);
+ }
+
+ private void handleIntent(Intent data) {
+ if (data == null) {
+ finish();
+ return;
+ }
+
+ switch (data.getAction()) {
+ case Intent.ACTION_VIEW:
+ case Intent.ACTION_SENDTO:
+ final Intent intent = new Intent(getApplicationContext(),
+ StartConversationActivity.class);
+ intent.setAction(data.getAction());
+ intent.setData(data.getData());
+ intent.setAction(data.getAction());
+ startActivity(intent);
+ }
+
+ finish();
+ }
+} \ No newline at end of file