Example usage for android.net Uri getQueryParameter

List of usage examples for android.net Uri getQueryParameter

Introduction

In this page you can find the example usage for android.net Uri getQueryParameter.

Prototype

@Nullable
public String getQueryParameter(String key) 

Source Link

Document

Searches the query string for the first value with the given key.

Usage

From source file:com.mapia.asne.twitter.TwitterSocialNetwork.java

/**
 * Overrided for Twitter support//from  w  w w .j  a  v a 2  s  .com
 * @param requestCode The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from.
 * @param resultCode The integer result code returned by the child activity through its setResult().
 * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
 */
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    int sanitizedRequestCode = requestCode % 0x10000;
    if (sanitizedRequestCode != REQUEST_AUTH)
        return;
    super.onActivityResult(requestCode, resultCode, data);

    Uri uri = data != null ? data.getData() : null;

    if (uri != null && uri.toString().startsWith(fRedirectURL)) {
        String verifier = uri.getQueryParameter(URL_TWITTER_OAUTH_VERIFIER);

        RequestLogin2AsyncTask requestLogin2AsyncTask = new RequestLogin2AsyncTask();
        mRequests.put(REQUEST_LOGIN2, requestLogin2AsyncTask);
        Bundle args = new Bundle();
        args.putString(RequestLogin2AsyncTask.PARAM_VERIFIER, verifier);
        requestLogin2AsyncTask.execute(args);
    } else {
        if (mLocalListeners.get(REQUEST_LOGIN) != null) {
            mLocalListeners.get(REQUEST_LOGIN).onError(getID(), REQUEST_LOGIN, "incorrect URI returned: " + uri,
                    null);
            mLocalListeners.remove(REQUEST_LOGIN);
        }
        /*
        *
        * No authentication challenges found
        * Relevant discussions can be found on the Internet at:
        * http://www.google.co.jp/search?q=8e063946 or
        * http://www.google.co.jp/search?q=ef59cf9f
        *
        * */
        initTwitterClient();
    }
}

From source file:com.zhongsou.souyue.activity.SplashActivity.java

private void wrapGalleryNews(String str) {
    GalleryNewsHomeBean item = new GalleryNewsHomeBean();
    Uri uri = Uri.parse(str);
    if (uri != null) {
        String srpId = uri.getQueryParameter("srpid");
        String title = uri.getQueryParameter("title");
        String url = uri.getQueryParameter("url");
        String images = uri.getQueryParameter("img");
        String source = uri.getQueryParameter("source");
        String keyword = uri.getQueryParameter("keyword");
        String pubTime = uri.getQueryParameter("newstime");
        try {/*  w  w w  .j a v  a 2s  .c o m*/
            item.setSrpId(srpId);
            item.setTitle(title);
            item.setUrl(url);
            if (!StringUtils.isEmpty(images)) {
                List<String> imgList = new ArrayList<String>();
                String[] imgs = images.split(",");
                for (String img : imgs) {
                    imgList.add(img);
                }
                item.setImage(imgList);
            }
            item.setSource(source);
            item.setKeyword(keyword);
            item.setPubTime(pubTime);
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
        pushInfo.setGalleryNews(item);
    }
}

From source file:net.wequick.small.webkit.WebView.java

private void initSettings() {
    WebSettings webSettings = this.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setUserAgentString(webSettings.getUserAgentString() + " Native");
    this.addJavascriptInterface(new SmallJsBridge(), "_Small");

    this.setWebChromeClient(new WebChromeClient() {
        @Override//  ww  w.j  a  va2  s.  c  o  m
        public void onReceivedTitle(android.webkit.WebView view, String title) {
            // Call if html title is set
            super.onReceivedTitle(view, title);
            mTitle = title;
            WebActivity activity = (WebActivity) WebViewPool.getContext(view);
            if (activity != null) {
                activity.setTitle(title);
            }
            // May receive head meta at the same time
            initMetas();
        }

        @Override
        public boolean onJsAlert(android.webkit.WebView view, String url, String message,
                final android.webkit.JsResult result) {
            Context context = WebViewPool.getContext(view);
            if (context == null)
                return false;

            AlertDialog.Builder dlg = new AlertDialog.Builder(context);
            dlg.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    mConfirmed = true;
                    result.confirm();
                }
            });
            dlg.setMessage(message);
            AlertDialog alert = dlg.create();
            alert.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
                    if (!mConfirmed) {
                        result.cancel();
                    }
                }
            });
            mConfirmed = false;
            alert.show();
            return true;
        }

        @Override
        public boolean onJsConfirm(android.webkit.WebView view, String url, String message,
                final android.webkit.JsResult result) {
            Context context = WebViewPool.getContext(view);
            AlertDialog.Builder dlg = new AlertDialog.Builder(context);
            dlg.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    mConfirmed = true;
                    result.confirm();
                }
            });
            dlg.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    mConfirmed = true;
                    result.cancel();
                }
            });
            dlg.setMessage(message);
            AlertDialog alert = dlg.create();
            alert.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
                    if (!mConfirmed) {
                        result.cancel();
                    }
                }
            });
            mConfirmed = false;
            alert.show();
            return true;
        }

        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            String msg = consoleMessage.message();
            if (msg == null)
                return false;
            Uri uri = Uri.parse(msg);
            if (uri != null && null != uri.getScheme() && uri.getScheme().equals(SMALL_SCHEME)) {
                String host = uri.getHost();
                String ret = uri.getQueryParameter(SMALL_QUERY_KEY_RET);
                if (host.equals(SMALL_HOST_POP)) {
                    WebActivity activity = (WebActivity) WebViewPool.getContext(WebView.this);
                    activity.finish(ret);
                } else if (host.equals(SMALL_HOST_EXEC)) {
                    if (mOnResultListener != null) {
                        mOnResultListener.onResult(ret);
                    }
                }
                return true;
            }
            Log.d(consoleMessage.sourceId(),
                    "line" + consoleMessage.lineNumber() + ": " + consoleMessage.message());
            return true;
        }

        @Override
        public void onCloseWindow(android.webkit.WebView window) {
            super.onCloseWindow(window);
            close(new OnResultListener() {
                @Override
                public void onResult(String ret) {
                    if (ret.equals("false"))
                        return;

                    WebActivity activity = (WebActivity) WebViewPool.getContext(WebView.this);
                    activity.finish(ret);
                }
            });
        }
    });

    this.setWebViewClient(new android.webkit.WebViewClient() {

        private final String ANCHOR_SCHEME = "anchor";

        @Override
        public boolean shouldOverrideUrlLoading(android.webkit.WebView view, String url) {
            if (mLoadingUrl != null && mLoadingUrl.equals(url)) {
                // reload by window.location.reload or something
                return super.shouldOverrideUrlLoading(view, url);
            }

            Boolean hasStarted = mHasStartedUrl.get(url);
            if (hasStarted != null && hasStarted) {
                // location redirected before page finished
                return super.shouldOverrideUrlLoading(view, url);
            }

            HitTestResult hit = view.getHitTestResult();
            if (hit != null) {
                Uri uri = Uri.parse(url);
                if (uri.getScheme().equals(ANCHOR_SCHEME)) {
                    // Scroll to anchor
                    int anchorY = Integer.parseInt(uri.getHost());
                    view.scrollTo(0, anchorY);
                } else {
                    Small.openUri(uri, WebViewPool.getContext(view));
                }
                return true;
            }
            return super.shouldOverrideUrlLoading(view, url);
        }

        @Override
        public void onPageStarted(android.webkit.WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            mHasStartedUrl.put(url, true);

            if (mLoadingUrl != null && mLoadingUrl.equals(url)) {
                // reload by window.location.reload or something
                mInjected = false;
            }
            if (sWebViewClient != null && url.equals(mLoadingUrl)) {
                sWebViewClient.onPageStarted(WebViewPool.getContext(view), (WebView) view, url, favicon);
            }
        }

        @Override
        public void onPageFinished(android.webkit.WebView view, String url) {
            super.onPageFinished(view, url);
            mHasStartedUrl.remove(url);

            HitTestResult hit = view.getHitTestResult();
            if (hit != null && hit.getType() == HitTestResult.SRC_ANCHOR_TYPE) {
                // Triggered by user clicked
                Uri uri = Uri.parse(url);
                String anchor = uri.getFragment();
                if (anchor != null) {
                    // If is an anchor, calculate the content offset by DOM
                    // and call native to adjust WebView's offset
                    view.loadUrl(JS_PREFIX + "var y=document.body.scrollTop;"
                            + "var e=document.getElementsByName('" + anchor + "')[0];" + "while(e){"
                            + "y+=e.offsetTop-e.scrollTop+e.clientTop;e=e.offsetParent;}" + "location='"
                            + ANCHOR_SCHEME + "://'+y;");
                }
            }

            if (!mInjected) {
                // Re-inject Small Js
                loadJs(SMALL_INJECT_JS);
                initMetas();
                mInjected = true;
            }

            if (sWebViewClient != null && url.equals(mLoadingUrl)) {
                sWebViewClient.onPageFinished(WebViewPool.getContext(view), (WebView) view, url);
            }
        }

        @Override
        public void onReceivedError(android.webkit.WebView view, int errorCode, String description,
                String failingUrl) {
            super.onReceivedError(view, errorCode, description, failingUrl);
            Log.e("Web", "error: " + description);
            if (sWebViewClient != null && failingUrl.equals(mLoadingUrl)) {
                sWebViewClient.onReceivedError(WebViewPool.getContext(view), (WebView) view, errorCode,
                        description, failingUrl);
            }
        }
    });
}

From source file:org.mariotaku.twidere.provider.TweetStoreProvider.java

@Override
public Uri insert(final Uri uri, final ContentValues values) {
    final String table = getTableNameForContentUri(uri);
    if (table == null)
        return null;
    if (TABLE_DIRECT_MESSAGES_CONVERSATION.equals(table))
        return null;
    else if (TABLE_DIRECT_MESSAGES.equals(table))
        return null;
    else if (TABLE_DIRECT_MESSAGES_CONVERSATIONS_ENTRY.equals(table))
        return null;
    final long row_id = mDatabase.insert(table, null, values);
    if (!"false".equals(uri.getQueryParameter(QUERY_PARAM_NOTIFY))) {
        switch (getTableId(uri)) {
        case URI_STATUSES: {
            mNewStatusesCount++;/*from ww w  .j  a v  a 2  s  . co  m*/
            break;
        }
        case URI_MENTIONS: {
            mNewMentionsCount++;
            break;
        }
        case URI_DIRECT_MESSAGES_INBOX: {
            mNewMessagesCount++;
            break;
        }
        default:
        }
    }
    onDatabaseUpdated(uri);
    onNewItemsInserted(uri, 1, values);
    return Uri.withAppendedPath(uri, String.valueOf(row_id));
}

From source file:im.ene.lab.attiq.ui.activities.ItemDetailActivity.java

private void trySetupCommentView() {
    mCommentsView.setVerticalScrollBarEnabled(true);
    mCommentsView.setHorizontalScrollBarEnabled(false);
    mCommentsView.setWebViewClient(new WebViewClient() {
        @Override/*from w ww  .  j a v  a2  s  . co m*/
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url != null && url.startsWith(getString(R.string.uri_prefix_item_comments))) {
                Uri uri = Uri.parse(url);
                String commentId = uri.getQueryParameter("id");
                if ("patch".equals(uri.getLastPathSegment())) {
                    patchComment(commentId);
                } else if ("delete".equals(uri.getLastPathSegment())) {
                    deleteComment(commentId);
                }
                return true;
            }

            return super.shouldOverrideUrlLoading(view, url);
        }
    });
}

From source file:com.github.gorbin.asne.twitter.TwitterSocialNetwork.java

/**
 * Overrided for Twitter support//from  www. j  ava 2  s  . co  m
 * @param requestCode The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from.
 * @param resultCode The integer result code returned by the child activity through its setResult().
 * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
 */
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    int sanitizedRequestCode = requestCode & 0xFFFF;
    if (sanitizedRequestCode != REQUEST_AUTH)
        return;
    super.onActivityResult(requestCode, resultCode, data);

    Uri uri = data != null ? data.getData() : null;

    if (uri != null && uri.toString().startsWith(mRedirectURL)) {
        String verifier = uri.getQueryParameter(URL_TWITTER_OAUTH_VERIFIER);

        RequestLogin2AsyncTask requestLogin2AsyncTask = new RequestLogin2AsyncTask();
        mRequests.put(REQUEST_LOGIN2, requestLogin2AsyncTask);
        Bundle args = new Bundle();
        args.putString(RequestLogin2AsyncTask.PARAM_VERIFIER, verifier);
        requestLogin2AsyncTask.execute(args);
    } else {
        if (mLocalListeners.get(REQUEST_LOGIN) != null) {
            mLocalListeners.get(REQUEST_LOGIN).onError(getID(), REQUEST_LOGIN, "incorrect URI returned: " + uri,
                    null);
            mLocalListeners.remove(REQUEST_LOGIN);
        }
        /*
        *
        * No authentication challenges found
        * Relevant discussions can be found on the Internet at:
        * http://www.google.co.jp/search?q=8e063946 or
        * http://www.google.co.jp/search?q=ef59cf9f
        *
        * */
        initTwitterClient();
    }
}

From source file:net.sf.xfd.provider.PublicProvider.java

final void verifyMac(Uri path, String grantMode, String requested) throws FileNotFoundException {
    if (Process.myUid() == Binder.getCallingUid()) {
        return;//from   www. j a  v a  2 s  . co  m
    }

    final int requestedMode = ParcelFileDescriptor.parseMode(requested);

    final String cookie = path.getQueryParameter(URI_ARG_COOKIE);
    final String expiry = path.getQueryParameter(URI_ARG_EXPIRY);

    if (TextUtils.isEmpty(cookie) || TextUtils.isEmpty(expiry)) {
        throw new FileNotFoundException("Invalid uri: MAC and expiry date are missing");
    }

    final long l;
    try {
        l = Long.parseLong(expiry);
    } catch (NumberFormatException nfe) {
        throw new FileNotFoundException("Invalid uri: unable to parse expiry date");
    }

    final Key key = getSalt(getContext());
    if (key == null) {
        throw new FileNotFoundException("Unable to verify hash: failed to produce key");
    }

    final int modeInt = ParcelFileDescriptor.parseMode(grantMode);

    if ((requestedMode & modeInt) != requestedMode) {
        throw new FileNotFoundException("Requested mode " + requested + " but limited to " + grantMode);
    }

    final byte[] encoded;
    final Mac hash;
    try {
        hash = Mac.getInstance("HmacSHA1");
        hash.init(key);

        final byte[] modeBits = new byte[] { (byte) (modeInt >> 24), (byte) (modeInt >> 16),
                (byte) (modeInt >> 8), (byte) modeInt, };
        hash.update(modeBits);

        final byte[] expiryDate = new byte[] { (byte) (l >> 56), (byte) (l >> 48), (byte) (l >> 40),
                (byte) (l >> 32), (byte) (l >> 24), (byte) (l >> 16), (byte) (l >> 8), (byte) l, };
        hash.update(expiryDate);

        encoded = hash.doFinal(path.getPath().getBytes());

        final String sample = Base64.encodeToString(encoded, URL_SAFE | NO_WRAP | NO_PADDING);

        if (!cookie.equals(sample)) {
            throw new FileNotFoundException("Expired uri");
        }
    } catch (NoSuchAlgorithmException e) {
        throw new FileNotFoundException("Unable to verify hash: missing HmacSHA1");
    } catch (InvalidKeyException e) {
        throw new FileNotFoundException("Unable to verify hash: corrupted key?!");
    }
}

From source file:org.changhong.sync.web.SnowySyncService.java

public void remoteAuthComplete(final Uri uri, final Handler handler) {

    execInThread(new Runnable() {

        public void run() {

            try {
                // TODO: might be intelligent to show something like a
                // progress dialog
                // else the user might try to sync before the authorization
                // process
                // is complete
                OAuthConnection auth = getAuthConnection();
                boolean result = auth.getAccess(uri.getQueryParameter("oauth_verifier"));

                if (result) {
                    TLog.i(TAG, "The authorization process is complete.");
                    handler.sendEmptyMessage(AUTH_COMPLETE);
                    return;
                    //sync(true);
                } else {
                    TLog.e(TAG, "Something went wrong during the authorization process.");
                    sendMessage(AUTH_FAILED);
                }/*from   w w  w . ja  v  a  2 s.c  o m*/
            } catch (UnknownHostException e) {
                TLog.e(TAG, "Internet connection not available");
                sendMessage(NO_INTERNET);
            }

            // We don't care what we send, just remove the dialog
            handler.sendEmptyMessage(0);
        }
    });
}

From source file:com.aniruddhc.acemusic.player.LauncherActivity.LauncherActivity.java

/** Given a URI, returns a map of campaign data that can be sent with
 * any GA hit.//from w w w.j  a va 2 s  .  c o m
 *
 * @param uri A hierarchical URI that may or may not have campaign data
 *     stored in query parameters.
 *
 * @return A map that may contain campaign or referrer
 *     that may be sent with any Google Analytics hit.
    */
private Map<String, String> getReferrerMapFromUri(Uri uri) {
    MapBuilder paramMap = new MapBuilder();

    //If no URI, return an empty Map.
    if (uri == null) {
        return paramMap.build();
    }

    /* Source is the only required campaign field. No need to continue if not
     * present. */
    if (uri.getQueryParameter(CAMPAIGN_SOURCE_PARAM) != null) {

        /* MapBuilder.setCampaignParamsFromUrl parses Google Analytics campaign
         * ("UTM") parameters from a string URL into a Map that can be set on
         * the Tracker. */
        paramMap.setCampaignParamsFromUrl(uri.toString());

        /* If no source parameter, set authority to source and medium to
         * "referral". */
    } else if (uri.getAuthority() != null) {
        paramMap.set(Fields.CAMPAIGN_MEDIUM, "referral");
        paramMap.set(Fields.CAMPAIGN_SOURCE, uri.getAuthority());
    }

    return paramMap.build();
}

From source file:org.mariotaku.twidere.activity.LinkHandlerActivity.java

private boolean setFragment(final Uri uri) {
    final Bundle extras = getIntent().getExtras();
    Fragment fragment = null;/*from  www .j ava  2 s.c  o m*/
    if (uri != null) {
        final Bundle bundle = new Bundle();
        if (extras != null) {
            bundle.putAll(extras);
        }
        switch (matchLinkId(uri)) {
        case LINK_ID_STATUS: {
            setTitle(R.string.view_status);
            fragment = new StatusFragment();
            final String param_status_id = uri.getQueryParameter(QUERY_PARAM_STATUS_ID);
            bundle.putLong(INTENT_KEY_STATUS_ID, parseLong(param_status_id));
            break;
        }
        case LINK_ID_USER: {
            setTitle(R.string.view_user_profile);
            fragment = new UserProfileFragment();
            final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME);
            final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID);
            if (!isEmpty(param_screen_name)) {
                bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            }
            if (!isEmpty(param_user_id)) {
                bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id));
            }
            break;
        }
        case LINK_ID_USER_TIMELINE: {
            setTitle(R.string.tweets);
            fragment = new UserTimelineFragment();
            final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME);
            final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID);
            if (!isEmpty(param_screen_name)) {
                bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            }
            if (!isEmpty(param_user_id)) {
                bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id));
            }
            break;
        }
        case LINK_ID_USER_FAVORITES: {
            setTitle(R.string.favorites);
            fragment = new UserFavoritesFragment();
            final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME);
            final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID);
            if (!isEmpty(param_screen_name)) {
                bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            }
            if (!isEmpty(param_user_id)) {
                bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id));
            }
            break;
        }
        case LINK_ID_USER_FOLLOWERS: {
            setTitle(R.string.followers);
            fragment = new UserFollowersFragment();
            final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME);
            final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID);
            if (!isEmpty(param_screen_name)) {
                bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            }
            if (!isEmpty(param_user_id)) {
                bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id));
            }
            break;
        }
        case LINK_ID_USER_FRIENDS: {
            setTitle(R.string.following);
            fragment = new UserFriendsFragment();
            final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME);
            final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID);
            if (!isEmpty(param_screen_name)) {
                bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            }
            if (!isEmpty(param_user_id)) {
                bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id));
            }
            break;
        }
        case LINK_ID_USER_BLOCKS: {
            setTitle(R.string.blocked_users);
            fragment = new UserBlocksListFragment();
            break;
        }
        case LINK_ID_DIRECT_MESSAGES_CONVERSATION: {
            setTitle(R.string.direct_messages);
            fragment = new DirectMessagesConversationFragment();
            final String param_conversation_id = uri.getQueryParameter(QUERY_PARAM_CONVERSATION_ID);
            final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME);
            final long conversation_id = parseLong(param_conversation_id);
            if (conversation_id > 0) {
                bundle.putLong(INTENT_KEY_CONVERSATION_ID, conversation_id);
            } else if (param_screen_name != null) {
                bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            }
            break;
        }
        case LINK_ID_LIST_DETAILS: {
            setTitle(R.string.user_list);
            fragment = new UserListDetailsFragment();
            final String param_screen_name = 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 param_list_name = uri.getQueryParameter(QUERY_PARAM_LIST_NAME);
            if (isEmpty(param_list_id)
                    && (isEmpty(param_list_name) || isEmpty(param_screen_name) && isEmpty(param_user_id))) {
                finish();
                return false;
            }
            bundle.putInt(INTENT_KEY_LIST_ID, parseInt(param_list_id));
            bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id));
            bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            bundle.putString(INTENT_KEY_LIST_NAME, param_list_name);
            break;
        }
        case LINK_ID_LISTS: {
            setTitle(R.string.user_list);
            fragment = new UserListsListFragment();
            final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME);
            final String param_user_id = uri.getQueryParameter(QUERY_PARAM_USER_ID);
            if (isEmpty(param_screen_name) && isEmpty(param_user_id)) {
                finish();
                return false;
            }
            bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id));
            bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            break;
        }
        case LINK_ID_LIST_TIMELINE: {
            setTitle(R.string.list_timeline);
            fragment = new UserListTimelineFragment();
            final String param_screen_name = 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 param_list_name = uri.getQueryParameter(QUERY_PARAM_LIST_NAME);
            if (isEmpty(param_list_id)
                    && (isEmpty(param_list_name) || isEmpty(param_screen_name) && isEmpty(param_user_id))) {
                finish();
                return false;
            }
            bundle.putInt(INTENT_KEY_LIST_ID, parseInt(param_list_id));
            bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id));
            bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            bundle.putString(INTENT_KEY_LIST_NAME, param_list_name);
            break;
        }
        case LINK_ID_LIST_MEMBERS: {
            setTitle(R.string.list_members);
            fragment = new UserListMembersFragment();
            final String param_screen_name = 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 param_list_name = uri.getQueryParameter(QUERY_PARAM_LIST_NAME);
            if (isEmpty(param_list_id)
                    && (isEmpty(param_list_name) || isEmpty(param_screen_name) && isEmpty(param_user_id))) {
                finish();
                return false;
            }
            bundle.putInt(INTENT_KEY_LIST_ID, parseInt(param_list_id));
            bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id));
            bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            bundle.putString(INTENT_KEY_LIST_NAME, param_list_name);
            break;
        }
        case LINK_ID_LIST_SUBSCRIBERS: {
            setTitle(R.string.list_subscribers);
            fragment = new UserListSubscribersFragment();
            final String param_screen_name = 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 param_list_name = uri.getQueryParameter(QUERY_PARAM_LIST_NAME);
            if (isEmpty(param_list_id)
                    && (isEmpty(param_list_name) || isEmpty(param_screen_name) && isEmpty(param_user_id))) {
                finish();
                return false;
            }
            bundle.putInt(INTENT_KEY_LIST_ID, parseInt(param_list_id));
            bundle.putLong(INTENT_KEY_USER_ID, parseLong(param_user_id));
            bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            bundle.putString(INTENT_KEY_LIST_NAME, param_list_name);
            break;
        }
        case LINK_ID_SAVED_SEARCHES: {
            setTitle(R.string.saved_searches);
            fragment = new SavedSearchesListFragment();
            break;
        }
        case LINK_ID_USER_MENTIONS: {
            setTitle(R.string.user_mentions);
            fragment = new UserMentionsFragment();
            final String param_screen_name = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME);
            if (!isEmpty(param_screen_name)) {
                bundle.putString(INTENT_KEY_SCREEN_NAME, param_screen_name);
            } else {
                finish();
                return false;
            }
            break;
        }
        case LINK_ID_INCOMING_FRIENDSHIPS: {
            setTitle(R.string.incoming_friendships);
            fragment = new IncomingFriendshipsFragment();
            break;
        }
        default: {
            break;
        }
        }
        final String param_account_id = uri.getQueryParameter(QUERY_PARAM_ACCOUNT_ID);
        if (param_account_id != null) {
            bundle.putLong(INTENT_KEY_ACCOUNT_ID, parseLong(param_account_id));
        } else {
            final String param_account_name = uri.getQueryParameter(QUERY_PARAM_ACCOUNT_NAME);
            if (param_account_name != null) {
                bundle.putLong(INTENT_KEY_ACCOUNT_ID, getAccountId(this, param_account_name));
            } else {
                final long account_id = getDefaultAccountId(this);
                if (isMyAccount(this, account_id)) {
                    bundle.putLong(INTENT_KEY_ACCOUNT_ID, account_id);
                } else {
                    finish();
                    return false;
                }
            }
        }
        if (fragment != null) {
            fragment.setArguments(bundle);
        }
    }
    mFragment = fragment;
    return true;
}