diff options
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java | 38 |
1 files changed, 38 insertions, 0 deletions
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 |