List of usage examples for android.content Intent setExtrasClassLoader
public void setExtrasClassLoader(@Nullable ClassLoader loader)
From source file:de.vanita5.twittnuker.util.Utils.java
public static void openUserListDetails(final Activity activity, final ParcelableUserList userList) { if (activity == null || userList == null) return;/*from w w w. ja v a 2 s .c om*/ final long accountId = userList.account_id, userId = userList.user_id; final long listId = userList.id; final Bundle extras = new Bundle(); extras.putParcelable(EXTRA_USER_LIST, userList); final Uri.Builder builder = new Uri.Builder(); builder.scheme(SCHEME_TWITTNUKER); builder.authority(AUTHORITY_USER_LIST); builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(accountId)); builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(userId)); builder.appendQueryParameter(QUERY_PARAM_LIST_ID, String.valueOf(listId)); final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build()); intent.setExtrasClassLoader(activity.getClassLoader()); intent.putExtras(extras); SwipebackActivityUtils.startSwipebackActivity(activity, intent); }
From source file:de.vanita5.twittnuker.util.Utils.java
public static void openUserProfile(final Activity activity, final ParcelableUser user) { if (activity == null || user == null) return;/*from w w w .ja v a 2s . co m*/ final Bundle extras = new Bundle(); extras.putParcelable(EXTRA_USER, user); final Uri.Builder builder = new Uri.Builder(); builder.scheme(SCHEME_TWITTNUKER); builder.authority(AUTHORITY_USER); builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(user.account_id)); if (user.id > 0) { builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user.id)); } if (user.screen_name != null) { builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, user.screen_name); } final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build()); intent.setExtrasClassLoader(activity.getClassLoader()); intent.putExtras(extras); SwipebackActivityUtils.startSwipebackActivity(activity, intent); }
From source file:de.vanita5.twittnuker.util.Utils.java
public static Fragment createFragmentForIntent(final Context context, final Intent intent) { final long start = System.currentTimeMillis(); intent.setExtrasClassLoader(context.getClassLoader()); final Bundle extras = intent.getExtras(); final Uri uri = intent.getData(); final Fragment fragment; if (uri == null) return null; final Bundle args = new Bundle(); if (extras != null) { args.putAll(extras);//ww w . ja va 2 s. co m } switch (matchLinkId(uri)) { case LINK_ID_STATUS: { fragment = new StatusFragment(); if (!args.containsKey(EXTRA_STATUS_ID)) { final String param_status_id = uri.getQueryParameter(QUERY_PARAM_STATUS_ID); args.putLong(EXTRA_STATUS_ID, ParseUtils.parseLong(param_status_id)); } break; } case LINK_ID_USER: { fragment = new UserProfileFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); } break; } case LINK_ID_USER_LIST_MEMBERSHIPS: { fragment = new UserListMembershipsListFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); } break; } case LINK_ID_USER_TIMELINE: { fragment = new UserTimelineFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); } if (isEmpty(paramScreenName) && isEmpty(param_user_id)) return null; break; } case LINK_ID_USER_FAVORITES: { fragment = new UserFavoritesFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String paramUserId = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(paramUserId)); } if (!args.containsKey(EXTRA_SCREEN_NAME) && !args.containsKey(EXTRA_USER_ID)) return null; break; } case LINK_ID_USER_FOLLOWERS: { fragment = new UserFollowersFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); } if (isEmpty(paramScreenName) && isEmpty(param_user_id)) return null; break; } case LINK_ID_USER_FRIENDS: { fragment = new UserFriendsFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); } if (isEmpty(paramScreenName) && isEmpty(param_user_id)) return null; break; } case LINK_ID_USER_BLOCKS: { fragment = new UserBlocksListFragment(); break; } case LINK_ID_MUTES_USERS: { fragment = new MutesUsersListFragment(); break; } case LINK_ID_DIRECT_MESSAGES_CONVERSATION: { fragment = new DirectMessagesConversationFragment(); final String paramRecipientId = uri.getQueryParameter(QUERY_PARAM_RECIPIENT_ID); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final long conversationId = ParseUtils.parseLong(paramRecipientId); if (conversationId > 0) { args.putLong(EXTRA_RECIPIENT_ID, conversationId); } else if (paramScreenName != null) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } break; } case LINK_ID_USER_LIST: { fragment = new UserListDetailsFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String param_list_id = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String paramListName = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isEmpty(param_list_id) && (isEmpty(paramListName) || isEmpty(paramScreenName) && isEmpty(param_user_id))) return null; args.putInt(EXTRA_LIST_ID, ParseUtils.parseInt(param_list_id)); args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); args.putString(EXTRA_SCREEN_NAME, paramScreenName); args.putString(EXTRA_LIST_NAME, paramListName); break; } case LINK_ID_USER_LISTS: { fragment = new UserListsListFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); } if (isEmpty(paramScreenName) && isEmpty(param_user_id)) return null; break; } case LINK_ID_USER_LIST_TIMELINE: { fragment = new UserListTimelineFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String param_list_id = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String paramListName = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isEmpty(param_list_id) && (isEmpty(paramListName) || isEmpty(paramScreenName) && isEmpty(param_user_id))) return null; args.putInt(EXTRA_LIST_ID, ParseUtils.parseInt(param_list_id)); args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); args.putString(EXTRA_SCREEN_NAME, paramScreenName); args.putString(EXTRA_LIST_NAME, paramListName); break; } case LINK_ID_USER_LIST_MEMBERS: { fragment = new UserListMembersFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String param_list_id = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String paramListName = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isEmpty(param_list_id) && (isEmpty(paramListName) || isEmpty(paramScreenName) && isEmpty(param_user_id))) return null; args.putInt(EXTRA_LIST_ID, ParseUtils.parseInt(param_list_id)); args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); args.putString(EXTRA_SCREEN_NAME, paramScreenName); args.putString(EXTRA_LIST_NAME, paramListName); break; } case LINK_ID_USER_LIST_SUBSCRIBERS: { fragment = new UserListSubscribersFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String param_list_id = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String paramListName = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isEmpty(param_list_id) && (isEmpty(paramListName) || isEmpty(paramScreenName) && isEmpty(param_user_id))) return null; args.putInt(EXTRA_LIST_ID, ParseUtils.parseInt(param_list_id)); args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); args.putString(EXTRA_SCREEN_NAME, paramScreenName); args.putString(EXTRA_LIST_NAME, paramListName); break; } case LINK_ID_SAVED_SEARCHES: { fragment = new SavedSearchesListFragment(); break; } case LINK_ID_USER_MENTIONS: { fragment = new UserMentionsFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); if (!args.containsKey(EXTRA_SCREEN_NAME) && !isEmpty(paramScreenName)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (isEmpty(args.getString(EXTRA_SCREEN_NAME))) return null; break; } case LINK_ID_INCOMING_FRIENDSHIPS: { fragment = new IncomingFriendshipsFragment(); break; } case LINK_ID_USERS: { fragment = new UsersListFragment(); break; } case LINK_ID_STATUSES: { fragment = new StatusesListFragment(); break; } case LINK_ID_STATUS_RETWEETERS: { fragment = new StatusRetweetersListFragment(); if (!args.containsKey(EXTRA_STATUS_ID)) { final String param_status_id = uri.getQueryParameter(QUERY_PARAM_STATUS_ID); args.putLong(EXTRA_STATUS_ID, ParseUtils.parseLong(param_status_id)); } break; } case LINK_ID_STATUS_FAVORITERS: { fragment = new StatusFavoritersListFragment(); if (!args.containsKey(EXTRA_STATUS_ID)) { final String param_status_id = uri.getQueryParameter(QUERY_PARAM_STATUS_ID); args.putLong(EXTRA_STATUS_ID, ParseUtils.parseLong(param_status_id)); } break; } case LINK_ID_STATUS_REPLIES: { fragment = new StatusRepliesListFragment(); if (!args.containsKey(EXTRA_STATUS_ID)) { final String paramStatusId = uri.getQueryParameter(QUERY_PARAM_STATUS_ID); args.putLong(EXTRA_STATUS_ID, ParseUtils.parseLong(paramStatusId)); } if (!args.containsKey(EXTRA_SCREEN_NAME)) { final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); args.putString(EXTRA_SCREEN_NAME, paramScreenName); } break; } case LINK_ID_SEARCH: { final String param_query = uri.getQueryParameter(QUERY_PARAM_QUERY); if (isEmpty(param_query)) return null; args.putString(EXTRA_QUERY, param_query); fragment = new SearchFragment(); break; } default: { return null; } } final String param_account_id = uri.getQueryParameter(QUERY_PARAM_ACCOUNT_ID); if (param_account_id != null) { args.putLong(EXTRA_ACCOUNT_ID, ParseUtils.parseLong(param_account_id)); } else { final String param_account_name = uri.getQueryParameter(QUERY_PARAM_ACCOUNT_NAME); if (param_account_name != null) { args.putLong(EXTRA_ACCOUNT_ID, getAccountId(context, param_account_name)); } else { final long account_id = getDefaultAccountId(context); if (isMyAccount(context, account_id)) { args.putLong(EXTRA_ACCOUNT_ID, account_id); } } } fragment.setArguments(args); if (isDebugBuild()) { Log.d(LOGTAG, String.format("createFragmentForIntent used %d ms", System.currentTimeMillis() - start)); } return fragment; }
From source file:org.getlantern.firetweet.util.Utils.java
public static void openUserListDetails(final Activity activity, final ParcelableUserList userList) { if (activity == null || userList == null) return;//from w w w. j ava 2 s .c o m final long accountId = userList.account_id, userId = userList.user_id; final long listId = userList.id; final Bundle extras = new Bundle(); extras.putParcelable(EXTRA_USER_LIST, userList); final Uri.Builder builder = new Uri.Builder(); builder.scheme(SCHEME_FIRETWEET); builder.authority(AUTHORITY_USER_LIST); builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(accountId)); builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(userId)); builder.appendQueryParameter(QUERY_PARAM_LIST_ID, String.valueOf(listId)); final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build()); intent.setExtrasClassLoader(activity.getClassLoader()); intent.putExtras(extras); activity.startActivity(intent); }
From source file:org.getlantern.firetweet.util.Utils.java
public static void addIntentToMenuForExtension(final Context context, final Menu menu, final int groupId, final String action, final String parelableKey, final String parelableJSONKey, final FiretweetParcelable parcelable) { if (context == null || menu == null || action == null || parelableKey == null || parcelable == null) return;//from w ww.j a v a 2s . com final PackageManager pm = context.getPackageManager(); final Resources res = context.getResources(); final float density = res.getDisplayMetrics().density; final int padding = Math.round(density * 4); final Intent queryIntent = new Intent(action); queryIntent.setExtrasClassLoader(context.getClassLoader()); final List<ResolveInfo> activities = pm.queryIntentActivities(queryIntent, PackageManager.GET_META_DATA); for (final ResolveInfo info : activities) { final Intent intent = new Intent(queryIntent); if (isExtensionUseJSON(info)) { intent.putExtra(parelableJSONKey, JSONSerializer.toJSONObjectString(parcelable)); } else { intent.putExtra(parelableKey, parcelable); } intent.setClassName(info.activityInfo.packageName, info.activityInfo.name); final MenuItem item = menu.add(groupId, Menu.NONE, Menu.NONE, info.loadLabel(pm)); item.setIntent(intent); final Drawable metaDataDrawable = getMetadataDrawable(pm, info.activityInfo, METADATA_KEY_EXTENSION_ICON); final int actionIconColor = ThemeUtils.getThemeForegroundColor(context); if (metaDataDrawable != null) { metaDataDrawable.mutate(); metaDataDrawable.setColorFilter(actionIconColor, Mode.SRC_ATOP); item.setIcon(metaDataDrawable); } else { final Drawable icon = info.loadIcon(pm); final int iw = icon.getIntrinsicWidth(), ih = icon.getIntrinsicHeight(); if (iw > 0 && ih > 0) { final Drawable iconWithPadding = new PaddingDrawable(icon, padding); iconWithPadding.setBounds(0, 0, iw, ih); item.setIcon(iconWithPadding); } else { item.setIcon(icon); } } } }
From source file:org.getlantern.firetweet.util.Utils.java
public static void openStatus(final Context context, final ParcelableStatus status, Bundle activityOptions) { if (context == null || status == null) return;// ww w .j av a 2 s .c om final long account_id = status.account_id, status_id = status.id; final Bundle extras = new Bundle(); extras.putParcelable(EXTRA_STATUS, status); final Uri.Builder builder = new Uri.Builder(); builder.scheme(SCHEME_FIRETWEET); builder.authority(AUTHORITY_STATUS); builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id)); builder.appendQueryParameter(QUERY_PARAM_STATUS_ID, String.valueOf(status_id)); final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build()); intent.setExtrasClassLoader(context.getClassLoader()); intent.putExtras(extras); if (context instanceof Activity) { ActivityCompat.startActivity((Activity) context, intent, activityOptions); } else { context.startActivity(intent); } }
From source file:org.getlantern.firetweet.util.Utils.java
public static void openUserProfile(final Context context, final ParcelableUser user, final Bundle activityOptions) { if (context == null || user == null) return;/*from ww w .j av a2s . c o m*/ final Bundle extras = new Bundle(); extras.putParcelable(EXTRA_USER, user); final Uri.Builder builder = new Uri.Builder(); builder.scheme(SCHEME_FIRETWEET); builder.authority(AUTHORITY_USER); builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(user.account_id)); if (user.id > 0) { builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user.id)); } if (user.screen_name != null) { builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, user.screen_name); } final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build()); intent.setExtrasClassLoader(context.getClassLoader()); intent.putExtras(extras); if (context instanceof Activity) { ActivityCompat.startActivity((Activity) context, intent, activityOptions); } else { context.startActivity(intent); } }
From source file:org.getlantern.firetweet.util.Utils.java
public static Fragment createFragmentForIntent(final Context context, final int linkId, final Intent intent) { intent.setExtrasClassLoader(context.getClassLoader()); final Bundle extras = intent.getExtras(); final Uri uri = intent.getData(); final Fragment fragment; if (uri == null) return null; final Bundle args = new Bundle(); if (extras != null) { args.putAll(extras);//from w ww . j av a2 s.c o m } switch (linkId) { case LINK_ID_STATUS: { fragment = new StatusFragment(); if (!args.containsKey(EXTRA_STATUS_ID)) { final String param_status_id = uri.getQueryParameter(QUERY_PARAM_STATUS_ID); args.putLong(EXTRA_STATUS_ID, ParseUtils.parseLong(param_status_id)); } break; } case LINK_ID_USER: { fragment = new UserFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); } break; } case LINK_ID_USER_LIST_MEMBERSHIPS: { fragment = new UserListMembershipsListFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String paramUserId = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(paramUserId)); } break; } case LINK_ID_USER_TIMELINE: { fragment = new UserTimelineFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String paramUserId = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(paramUserId)); } if (isEmpty(paramScreenName) && isEmpty(paramUserId)) return null; break; } case LINK_ID_USER_MEDIA_TIMELINE: { fragment = new UserMediaTimelineFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String paramUserId = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(paramUserId)); } if (isEmpty(paramScreenName) && isEmpty(paramUserId)) return null; break; } case LINK_ID_USER_FAVORITES: { fragment = new UserFavoritesFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String paramUserId = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(paramUserId)); } if (!args.containsKey(EXTRA_SCREEN_NAME) && !args.containsKey(EXTRA_USER_ID)) return null; break; } case LINK_ID_USER_FOLLOWERS: { fragment = new UserFollowersFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); } if (isEmpty(paramScreenName) && isEmpty(param_user_id)) return null; break; } case LINK_ID_USER_FRIENDS: { fragment = new UserFriendsFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(param_user_id)); } if (isEmpty(paramScreenName) && isEmpty(param_user_id)) return null; break; } case LINK_ID_USER_BLOCKS: { fragment = new UserBlocksListFragment(); break; } case LINK_ID_MUTES_USERS: { fragment = new MutesUsersListFragment(); break; } case LINK_ID_DIRECT_MESSAGES_CONVERSATION: { fragment = new MessagesConversationFragment(); final String paramRecipientId = uri.getQueryParameter(QUERY_PARAM_RECIPIENT_ID); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final long conversationId = ParseUtils.parseLong(paramRecipientId); if (conversationId > 0) { args.putLong(EXTRA_RECIPIENT_ID, conversationId); } else if (paramScreenName != null) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } break; } case LINK_ID_USER_LIST: { fragment = new UserListFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String paramUserId = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String paramListId = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String paramListName = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isEmpty(paramListId) && (isEmpty(paramListName) || isEmpty(paramScreenName) && isEmpty(paramUserId))) return null; args.putLong(EXTRA_LIST_ID, ParseUtils.parseLong(paramListId)); args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(paramUserId)); args.putString(EXTRA_SCREEN_NAME, paramScreenName); args.putString(EXTRA_LIST_NAME, paramListName); break; } case LINK_ID_USER_LISTS: { fragment = new UserListsFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String paramUserId = uri.getQueryParameter(QUERY_PARAM_USER_ID); if (!args.containsKey(EXTRA_SCREEN_NAME)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (!args.containsKey(EXTRA_USER_ID)) { args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(paramUserId)); } if (isEmpty(paramScreenName) && isEmpty(paramUserId)) return null; break; } case LINK_ID_USER_LIST_TIMELINE: { fragment = new UserListTimelineFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String paramUserId = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String paramListId = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String paramListName = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isEmpty(paramListId) && (isEmpty(paramListName) || isEmpty(paramScreenName) && isEmpty(paramUserId))) return null; args.putLong(EXTRA_LIST_ID, ParseUtils.parseLong(paramListId)); args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(paramUserId)); args.putString(EXTRA_SCREEN_NAME, paramScreenName); args.putString(EXTRA_LIST_NAME, paramListName); break; } case LINK_ID_USER_LIST_MEMBERS: { fragment = new UserListMembersFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String paramUserId = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String paramListId = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String paramListName = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isEmpty(paramListId) && (isEmpty(paramListName) || isEmpty(paramScreenName) && isEmpty(paramUserId))) return null; args.putLong(EXTRA_LIST_ID, ParseUtils.parseLong(paramListId)); args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(paramUserId)); args.putString(EXTRA_SCREEN_NAME, paramScreenName); args.putString(EXTRA_LIST_NAME, paramListName); break; } case LINK_ID_USER_LIST_SUBSCRIBERS: { fragment = new UserListSubscribersFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); final String paramUserId = uri.getQueryParameter(QUERY_PARAM_USER_ID); final String paramListId = uri.getQueryParameter(QUERY_PARAM_LIST_ID); final String paramListName = uri.getQueryParameter(QUERY_PARAM_LIST_NAME); if (isEmpty(paramListId) && (isEmpty(paramListName) || isEmpty(paramScreenName) && isEmpty(paramUserId))) return null; args.putLong(EXTRA_LIST_ID, ParseUtils.parseLong(paramListId)); args.putLong(EXTRA_USER_ID, ParseUtils.parseLong(paramUserId)); args.putString(EXTRA_SCREEN_NAME, paramScreenName); args.putString(EXTRA_LIST_NAME, paramListName); break; } case LINK_ID_SAVED_SEARCHES: { fragment = new SavedSearchesListFragment(); break; } case LINK_ID_USER_MENTIONS: { fragment = new UserMentionsFragment(); final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); if (!args.containsKey(EXTRA_SCREEN_NAME) && !isEmpty(paramScreenName)) { args.putString(EXTRA_SCREEN_NAME, paramScreenName); } if (isEmpty(args.getString(EXTRA_SCREEN_NAME))) return null; break; } case LINK_ID_INCOMING_FRIENDSHIPS: { fragment = new IncomingFriendshipsFragment(); break; } case LINK_ID_USERS: { fragment = new UsersListFragment(); break; } case LINK_ID_STATUSES: { fragment = new StatusesListFragment(); break; } case LINK_ID_STATUS_RETWEETERS: { fragment = new StatusRetweetersListFragment(); if (!args.containsKey(EXTRA_STATUS_ID)) { final String paramStatusId = uri.getQueryParameter(QUERY_PARAM_STATUS_ID); args.putLong(EXTRA_STATUS_ID, ParseUtils.parseLong(paramStatusId)); } break; } case LINK_ID_STATUS_FAVORITERS: { fragment = new StatusFavoritersListFragment(); if (!args.containsKey(EXTRA_STATUS_ID)) { final String paramStatusId = uri.getQueryParameter(QUERY_PARAM_STATUS_ID); args.putLong(EXTRA_STATUS_ID, ParseUtils.parseLong(paramStatusId)); } break; } case LINK_ID_STATUS_REPLIES: { fragment = new StatusRepliesListFragment(); if (!args.containsKey(EXTRA_STATUS_ID)) { final String paramStatusId = uri.getQueryParameter(QUERY_PARAM_STATUS_ID); args.putLong(EXTRA_STATUS_ID, ParseUtils.parseLong(paramStatusId)); } if (!args.containsKey(EXTRA_SCREEN_NAME)) { final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME); args.putString(EXTRA_SCREEN_NAME, paramScreenName); } break; } case LINK_ID_SEARCH: { final String param_query = uri.getQueryParameter(QUERY_PARAM_QUERY); if (isEmpty(param_query)) return null; args.putString(EXTRA_QUERY, param_query); fragment = new SearchFragment(); break; } default: { return null; } } final String paramAccountId = uri.getQueryParameter(QUERY_PARAM_ACCOUNT_ID); if (paramAccountId != null) { args.putLong(EXTRA_ACCOUNT_ID, ParseUtils.parseLong(paramAccountId)); } else { final String paramAccountName = uri.getQueryParameter(QUERY_PARAM_ACCOUNT_NAME); if (paramAccountName != null) { args.putLong(EXTRA_ACCOUNT_ID, getAccountId(context, paramAccountName)); } else { final long accountId = getDefaultAccountId(context); if (isMyAccount(context, accountId)) { args.putLong(EXTRA_ACCOUNT_ID, accountId); } } } fragment.setArguments(args); return fragment; }