Java Code Examples for android.net.Uri.Builder#build()

The following examples show how to use android.net.Uri.Builder#build() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractContentProviderStub.java    From letv with Apache License 2.0 6 votes vote down vote up
private Uri buildNewUri(Uri uri, String targetAuthority) {
    Builder b = new Builder();
    b.scheme(uri.getScheme());
    b.authority(targetAuthority);
    b.path(uri.getPath());
    if (VERSION.SDK_INT >= 11) {
        Set<String> names = uri.getQueryParameterNames();
        if (names != null && names.size() > 0) {
            for (String name : names) {
                if (!TextUtils.equals(name, ApkConstant.EXTRA_TARGET_AUTHORITY)) {
                    b.appendQueryParameter(name, uri.getQueryParameter(name));
                }
            }
        }
    } else {
        b.query(uri.getQuery());
    }
    b.fragment(uri.getFragment());
    return b.build();
}
 
Example 2
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public PostAgent buildCheckTKT(String openid, String access_token, String appId) {
    Builder ub = getBuilder("uac/m/oauth2/authenticate");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "openid", openid);
    append(hb, "access_token", access_token);
    append(hb, "appid", appId);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 3
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildForwardPhoneGetActivateCode(String phone, String appId) {
    Builder ub = getBuilder("uac/m/forward/phone/get_activate_code");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "phone", phone);
    append(hb, "appid", appId);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 4
Source File: Imps.java    From Zom-Android-XMPP with GNU General Public License v3.0 5 votes vote down vote up
public static boolean isUnlocked(Context context)
{
    try {
        Cursor cursor = null;

        Uri uri = Imps.Provider.CONTENT_URI_WITH_ACCOUNT;

        Builder builder = uri.buildUpon();
        builder = builder.appendQueryParameter(ImApp.NO_CREATE_KEY, "1");

        uri = builder.build();

        cursor = context.getContentResolver().query(
                uri, null, null, null,
                null);

        if (cursor != null)
        {
            cursor.close();
            return true;
        }
        else
        {
            return false;
        }

    } catch (Exception e) {
        // Only complain if we thought this password should succeed

         Log.e(ImApp.LOG_TAG, e.getMessage(), e);

        // needs to be unlocked
        return false;
    }
}
 
Example 5
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildUnBindThird(String appid, String uid, String tkt, String tappname, String tappid) {
    Builder ub = getBuilder("uac/m/third", "method", "unbindthird");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "appid", appid);
    append(hb, "uid", uid);
    append(hb, "tkt", tkt);
    append(hb, "tappname", tappname);
    append(hb, "tappid", tappid);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 6
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildGetBindInfo(String appid, String uid, String tkt) {
    Builder ub = getBuilder("uac/m/third", "method", "getbindinfo");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "appid", "");
    append(hb, "uid", uid);
    append(hb, "tkt", tkt);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 7
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildGetAuthCode(String uid, String tkt, String appId, String scope) {
    Builder ub = getBuilder("uac/m/oauth2/authorize");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "response_type", "code");
    append(hb, "uid", uid);
    append(hb, "tkt", tkt);
    append(hb, "appid", appId);
    append(hb, "redirect_uri", "http://auther.coolyun.com");
    append(hb, "scope", scope);
    append(hb, "display", "mobile");
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 8
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildBindPhone(String phone, String tkt, String activateCode, String uid, String password, String appId) {
    Builder ub = getBuilder("uac/m/bind/phone/bind");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "phone", phone);
    append(hb, "activate_code", activateCode);
    append(hb, "uid", uid);
    append(hb, "pwd", password);
    append(hb, "tkt", tkt);
    append(hb, "appid", appId);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 9
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildGetBindDevice(String appid, String uid, String tkt, String version) {
    Builder ub = getBuilder("uac/m/device/get_device_list");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "appid", appid);
    append(hb, "uid", uid);
    append(hb, "tkt", tkt);
    append(hb, "version", version);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 10
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public PostAgent buildLogout(String uid, String tkt, String password, String appId) {
    Builder ub = getBuilder("uac/m/logout");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "uid", uid);
    append(hb, "tkt", tkt);
    append(hb, "pwd", password);
    append(hb, "appid", appId);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 11
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildBindPhoneGetActivateCodeSafe(String phone, String appId, String captchakey, String captchacode) {
    Builder ub = getBuilder("uac/m/bind/phone/get_activate_code_safe");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "phone", phone);
    append(hb, "appid", appId);
    append(hb, "captchakey", captchakey);
    append(hb, "captchacode", captchacode);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 12
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public PostAgent buildCheckPassword(String uid, String account, String password, String appId) {
    Builder ub = getBuilder("uac/m/check_pwd");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "uid", uid);
    append(hb, "account", account);
    append(hb, "pwd", password);
    append(hb, "appid", appId);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 13
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildGetCaptchaImg(String appid, String captchakey, String width, String height, String length) {
    Builder ub = getBuilder("uac/m/authcode/getcaptcha");
    append(ub, "appid", appid);
    append(ub, "captchakey", captchakey);
    append(ub, SettingsJsonConstants.ICON_WIDTH_KEY, width);
    append(ub, SettingsJsonConstants.ICON_HEIGHT_KEY, height);
    append(ub, DownloadVideoTable.COLUMN_LENGTH, length);
    append(ub, "checkkey", EncryptUtils.getMD5String("YL31815!@#" + captchakey));
    return new ImageAgent(ub.build(), Passport.getHosts());
}
 
Example 14
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildGetExchangeRate(String uid, String tkt, String appId) {
    Builder ub = getBuilder("uac/m/score/get_exchange_rate");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "uid", uid);
    append(hb, "tkt", tkt);
    append(hb, "appid", appId);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 15
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildFindpwdPhoneSetPwd(String phone, String activateCode, String password, String appId) {
    Builder ub = getBuilder("uac/m/findpwd/phone/set_pwd");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "phone", phone);
    append(hb, "activate_code", activateCode);
    append(hb, "pwd", password);
    append(hb, "appid", appId);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 16
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildUnBindDevice(String appid, String uid, String tkt, String devlist, String version) {
    Builder ub = getBuilder("uac/m/device/unbind_device");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "appid", appid);
    append(hb, "uid", uid);
    append(hb, "tkt", tkt);
    append(hb, "devlist", devlist);
    append(hb, "version", version);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 17
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildChangeNickname(String appid, String uid, String tkt, String nickname) {
    Builder ub = getBuilder("uac/m/change/nickname");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "appid", appid);
    append(hb, "uid", uid);
    append(hb, "tkt", tkt);
    append(hb, "nickname", nickname);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 18
Source File: RequestBuilder.java    From letv with Apache License 2.0 5 votes vote down vote up
public HTTPAgent buildloginAndBindQihoo(String appid, String account, String pwd, String tappname, String tappid, String tuserinfo) {
    Builder ub = getBuilder("uac/m/third", "method", "bindandlogin4qihoo");
    HTTPAgent.Builder hb = new HTTPAgent.Builder();
    append(hb, "appid", appid);
    append(hb, "account", account);
    append(hb, "pwd", pwd);
    append(hb, "tuserinfo", tuserinfo);
    append(hb, "tappname", tappname);
    append(hb, "tappid", tappid);
    return new PostAgent(ub.build(), Passport.getHosts(), hb.buildJSON());
}
 
Example 19
Source File: RouterActivity.java    From zom-android-matrix with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
private boolean cursorUnlocked() {
    try {
        Uri uri = Imps.Provider.CONTENT_URI_WITH_ACCOUNT;

        Builder builder = uri.buildUpon();
        /**
        if (pKey != null)
            builder.appendQueryParameter(ImApp.CACHEWORD_PASSWORD_KEY, pKey);
        if (!allowCreate)
            builder = builder.appendQueryParameter(ImApp.NO_CREATE_KEY, "1");
         */
        uri = builder.build();

        mProviderCursor = managedQuery(uri,
                PROVIDER_PROJECTION, Imps.Provider.CATEGORY + "=?" /* selection */,
                new String[] { IMPS_CATEGORY } /* selection args */,
                Imps.Provider.DEFAULT_SORT_ORDER);

        if (mProviderCursor != null)
        {
            ImPluginHelper.getInstance(this).loadAvailablePlugins();

            mProviderCursor.moveToFirst();

            return true;
        }
        else
        {
            return false;
        }

    } catch (Exception e) {
        // Only complain if we thought this password should succeed

            Log.e(LOG_TAG, e.getMessage(), e);

            Toast.makeText(this, getString(info.guardianproject.keanu.core.R.string.error_welcome_database), Toast.LENGTH_LONG).show();
            finish();


        // needs to be unlocked
        return false;
    }
}
 
Example 20
Source File: RouterActivity.java    From Zom-Android-XMPP with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
private boolean cursorUnlocked() {
    try {
        Uri uri = Imps.Provider.CONTENT_URI_WITH_ACCOUNT;

        Builder builder = uri.buildUpon();
        /**
        if (pKey != null)
            builder.appendQueryParameter(ImApp.CACHEWORD_PASSWORD_KEY, pKey);
        if (!allowCreate)
            builder = builder.appendQueryParameter(ImApp.NO_CREATE_KEY, "1");
         */
        uri = builder.build();

        mProviderCursor = managedQuery(uri,
                PROVIDER_PROJECTION, Imps.Provider.CATEGORY + "=?" /* selection */,
                new String[] { ImApp.IMPS_CATEGORY } /* selection args */,
                Imps.Provider.DEFAULT_SORT_ORDER);

        if (mProviderCursor != null)
        {
            ImPluginHelper.getInstance(this).loadAvailablePlugins();

            mProviderCursor.moveToFirst();

            return true;
        }
        else
        {
            return false;
        }

    } catch (Exception e) {
        // Only complain if we thought this password should succeed

            Log.e(ImApp.LOG_TAG, e.getMessage(), e);

            Toast.makeText(this, getString(R.string.error_welcome_database), Toast.LENGTH_LONG).show();
            finish();


        // needs to be unlocked
        return false;
    }
}