18
18
import static android .content .DialogInterface .BUTTON_POSITIVE ;
19
19
import static android .content .Intent .ACTION_VIEW ;
20
20
import static android .content .Intent .CATEGORY_BROWSABLE ;
21
+ import static org .eclipse .egit .github .core .client .IGitHubConstants .HOST_GISTS ;
21
22
import android .app .AlertDialog ;
22
23
import android .content .DialogInterface ;
23
24
import android .content .DialogInterface .OnCancelListener ;
30
31
import com .github .mobile .R .string ;
31
32
import com .github .mobile .core .commit .CommitMatch ;
32
33
import com .github .mobile .core .commit .CommitUriMatcher ;
34
+ import com .github .mobile .core .gist .GistUriMatcher ;
33
35
import com .github .mobile .core .issue .IssueUriMatcher ;
34
36
import com .github .mobile .core .repo .RepositoryUriMatcher ;
35
37
import com .github .mobile .core .user .UserUriMatcher ;
36
38
import com .github .mobile .ui .LightAlertDialog ;
37
39
import com .github .mobile .ui .commit .CommitViewActivity ;
40
+ import com .github .mobile .ui .gist .GistsViewActivity ;
38
41
import com .github .mobile .ui .issue .IssuesViewActivity ;
39
42
import com .github .mobile .ui .repo .RepositoryViewActivity ;
40
43
41
44
import java .net .URI ;
42
45
import java .text .MessageFormat ;
43
46
47
+ import org .eclipse .egit .github .core .Gist ;
44
48
import org .eclipse .egit .github .core .Repository ;
45
49
import org .eclipse .egit .github .core .RepositoryIssue ;
46
50
import org .eclipse .egit .github .core .User ;
@@ -56,35 +60,43 @@ protected void onCreate(Bundle savedInstanceState) {
56
60
57
61
final Intent intent = getIntent ();
58
62
final Uri data = intent .getData ();
63
+ if (HOST_GISTS .equals (data .getHost ())) {
64
+ Gist gist = GistUriMatcher .getGist (data );
65
+ if (gist != null ) {
66
+ startActivity (GistsViewActivity .createIntent (gist ));
67
+ finish ();
68
+ return ;
69
+ }
70
+ } else {
71
+ RepositoryIssue issue = IssueUriMatcher .getIssue (data );
72
+ if (issue != null ) {
73
+ startActivity (IssuesViewActivity .createIntent (issue ,
74
+ issue .getRepository ()));
75
+ finish ();
76
+ return ;
77
+ }
59
78
60
- RepositoryIssue issue = IssueUriMatcher .getIssue (data );
61
- if (issue != null ) {
62
- startActivity (IssuesViewActivity .createIntent (issue ,
63
- issue .getRepository ()));
64
- finish ();
65
- return ;
66
- }
67
-
68
- Repository repository = RepositoryUriMatcher .getRepository (data );
69
- if (repository != null ) {
70
- startActivity (RepositoryViewActivity .createIntent (repository ));
71
- finish ();
72
- return ;
73
- }
79
+ Repository repository = RepositoryUriMatcher .getRepository (data );
80
+ if (repository != null ) {
81
+ startActivity (RepositoryViewActivity .createIntent (repository ));
82
+ finish ();
83
+ return ;
84
+ }
74
85
75
- User user = UserUriMatcher .getUser (data );
76
- if (user != null ) {
77
- startActivity (UserViewActivity .createIntent (user ));
78
- finish ();
79
- return ;
80
- }
86
+ User user = UserUriMatcher .getUser (data );
87
+ if (user != null ) {
88
+ startActivity (UserViewActivity .createIntent (user ));
89
+ finish ();
90
+ return ;
91
+ }
81
92
82
- CommitMatch commit = CommitUriMatcher .getCommit (data );
83
- if (commit != null ) {
84
- startActivity (CommitViewActivity .createIntent (commit .repository ,
85
- commit .commit ));
86
- finish ();
87
- return ;
93
+ CommitMatch commit = CommitUriMatcher .getCommit (data );
94
+ if (commit != null ) {
95
+ startActivity (CommitViewActivity .createIntent (
96
+ commit .repository , commit .commit ));
97
+ finish ();
98
+ return ;
99
+ }
88
100
}
89
101
90
102
if (!intent .hasCategory (CATEGORY_BROWSABLE )) {
0 commit comments