1package eu.siacs.conversations.ui;
2
3import android.app.Activity;
4import android.content.Intent;
5
6public class UriHandlerActivity extends Activity {
7
8 @Override
9 public void onStart() {
10 super.onStart();
11 handleIntent(getIntent());
12 }
13
14 @Override
15 public void onNewIntent(Intent intent) {
16 handleIntent(intent);
17 }
18
19 private void handleIntent(Intent data) {
20 if (data == null) {
21 finish();
22 return;
23 }
24
25 switch (data.getAction()) {
26 case Intent.ACTION_VIEW:
27 case Intent.ACTION_SENDTO:
28 final Intent intent = new Intent(getApplicationContext(),
29 StartConversationActivity.class);
30 intent.setAction(data.getAction());
31 intent.setData(data.getData());
32 intent.setAction(data.getAction());
33 startActivity(intent);
34 }
35
36 finish();
37 }
38}