1818import static android .content .DialogInterface .BUTTON_POSITIVE ;
1919import static android .content .Intent .ACTION_VIEW ;
2020import static android .content .Intent .CATEGORY_BROWSABLE ;
21+ import static org .eclipse .egit .github .core .client .IGitHubConstants .HOST_GISTS ;
2122import android .app .AlertDialog ;
2223import android .content .DialogInterface ;
2324import android .content .DialogInterface .OnCancelListener ;
3031import com .github .mobile .R .string ;
3132import com .github .mobile .core .commit .CommitMatch ;
3233import com .github .mobile .core .commit .CommitUriMatcher ;
34+ import com .github .mobile .core .gist .GistUriMatcher ;
3335import com .github .mobile .core .issue .IssueUriMatcher ;
3436import com .github .mobile .core .repo .RepositoryUriMatcher ;
3537import com .github .mobile .core .user .UserUriMatcher ;
3638import com .github .mobile .ui .LightAlertDialog ;
3739import com .github .mobile .ui .commit .CommitViewActivity ;
40+ import com .github .mobile .ui .gist .GistsViewActivity ;
3841import com .github .mobile .ui .issue .IssuesViewActivity ;
3942import com .github .mobile .ui .repo .RepositoryViewActivity ;
4043
4144import java .net .URI ;
4245import java .text .MessageFormat ;
4346
47+ import org .eclipse .egit .github .core .Gist ;
4448import org .eclipse .egit .github .core .Repository ;
4549import org .eclipse .egit .github .core .RepositoryIssue ;
4650import org .eclipse .egit .github .core .User ;
@@ -56,35 +60,43 @@ protected void onCreate(Bundle savedInstanceState) {
5660
5761 final Intent intent = getIntent ();
5862 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+ }
5978
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+ }
7485
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+ }
8192
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+ }
88100 }
89101
90102 if (!intent .hasCategory (CATEGORY_BROWSABLE )) {
0 commit comments