twitter.com/#!/ link will be handled.

This commit is contained in:
Mariotaku Lee 2015-04-26 00:25:06 +08:00
parent 134cbeb916
commit b249439e10
1 changed files with 11 additions and 1 deletions

View File

@ -105,7 +105,7 @@ public class TwitterLinkHandlerActivity extends Activity implements Constants {
finish();
return;
}
final Uri uri = data.buildUpon().authority(AUTHORITY_TWITTER_COM).build();
final Uri uri = regulateTwitterUri(data);
final Intent handledIntent = getHandledIntent(uri);
if (handledIntent != null) {
startActivity(handledIntent);
@ -126,6 +126,16 @@ public class TwitterLinkHandlerActivity extends Activity implements Constants {
finish();
}
private static Uri regulateTwitterUri(Uri data) {
final String encodedFragment = data.getEncodedFragment();
if (encodedFragment != null && encodedFragment.startsWith("!/")) {
return regulateTwitterUri(Uri.parse("https://twitter.com" + encodedFragment.substring(1)));
}
final Uri.Builder builder = data.buildUpon();
builder.authority(AUTHORITY_TWITTER_COM);
return builder.build();
}
private Intent getHandledIntent(final Uri uri) {
final List<String> pathSegments = uri.getPathSegments();
switch (URI_MATCHER.match(uri)) {