本文整理汇总了Java中android.net.Uri.getQueryParameter方法的典型用法代码示例。如果您正苦于以下问题:Java Uri.getQueryParameter方法的具体用法?Java Uri.getQueryParameter怎么用?Java Uri.getQueryParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.net.Uri
的用法示例。
在下文中一共展示了Uri.getQueryParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTableDataAndGetResponse
import android.net.Uri; //导入方法依赖的package包/类
private String addTableDataAndGetResponse(String route) {
UpdateRowResponse response;
try {
Uri uri = Uri.parse(URLDecoder.decode(route, "UTF-8"));
String tableName = uri.getQueryParameter("tableName");
String updatedData = uri.getQueryParameter("addData");
List<RowDataRequest> rowDataRequests = mGson.fromJson(updatedData, new TypeToken<List<RowDataRequest>>() {
}.getType());
response = DatabaseHelper.addRow(null, tableName, rowDataRequests);
return mGson.toJson(response);
} catch (Exception e) {
e.printStackTrace();
response = new UpdateRowResponse();
response.isSuccessful = false;
return mGson.toJson(response);
}
}
示例2: shouldOverrideUrlLoading
import android.net.Uri; //导入方法依赖的package包/类
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
Log.d("pref", url);
String urldecode = null;
try {
urldecode = URLDecoder.decode(url, "UTF-8");
} catch (UnsupportedEncodingException e) {
}
Uri uri=Uri.parse(urldecode);
if (!"localhost".equals(uri.getHost())||! urldecode.contains("code="))
return false;
mdata.code=uri.getQueryParameter("code");
OAuthDialog.this.dismiss();
mListener.onFinished(mdata);
return true;
}
示例3: handleLoginCallback
import android.net.Uri; //导入方法依赖的package包/类
public void handleLoginCallback(Uri uri) {
//Use the parameter your API exposes for the code (mostly it's "code")
String code = uri.getQueryParameter(BuildConfig.RESPONSE_TYPE);
if(code != null) {
TokenReference tokenReference = new TokenReference(mActivity);
if(tokenReference.AuthorizeNewToken(code)) {
getAppPrefs().setUserAuthenticated();
ServiceGenerator.authStateChange(mActivity);
reference = new Authorize();
reference.execute();
}
else
createSuperToast(mActivity, mActivity.getString(R.string.text_error_capture_login), R.drawable.ic_info_outline_white_18dp,
Style.TYPE_STANDARD, Style.DURATION_VERY_LONG,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_AMBER));
} else if ((code = uri.getQueryParameter("error")) != null)
createSuperToast(mActivity, code, R.drawable.ic_info_outline_white_18dp,
Style.TYPE_STANDARD, Style.DURATION_VERY_LONG,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_RED));
else
createSuperToast(mActivity, mActivity.getString(R.string.text_error_auth_login), R.drawable.ic_info_outline_white_18dp,
Style.TYPE_STANDARD, Style.DURATION_VERY_LONG,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_AMBER));
}
示例4: onResume
import android.net.Uri; //导入方法依赖的package包/类
@Override protected void onResume() {
super.onResume();
if (this.getIntent().getDataString() == null) {
return;
}
Uri appLinkUri = Uri.parse(this.getIntent().getDataString());
String responseCode = appLinkUri.getQueryParameter("responseCode");
if (responseCode.equals("0")) {
toast("PDV ativado com sucesso =)");
finish();
} else {
String reason = appLinkUri.getQueryParameter("reason");
toast(reason);
finish();
}
}
示例5: getOhaEnergyUseDaysCursor
import android.net.Uri; //导入方法依赖的package包/类
/**
* Recuperar um cursor {@link OhaEnergyUseDaysCursor} com a utilização de energia por dia.
*/
private Cursor getOhaEnergyUseDaysCursor(SQLiteDatabase sqLiteDatabase, Uri uri) {
String strEndDate = uri.getQueryParameter(PATH_DAYS_PARAM_END_DATE);
Date endDate = OhaHelper.getDateEnd(strEndDate == null ? new Date() : new Date(Long.parseLong(strEndDate)), false);
Cursor cursor = sqLiteDatabase.query(
EnergyUseLogEntry.TABLE_NAME,
EnergyUseLogEntry.COLUMNS_CALC_PERIOD,
String.format("%s <= ?", EnergyUseLogEntry._ID),
new String[]{Long.toString(endDate.getTime())},
null,
null,
null);
int count = 1;
if (cursor.moveToFirst()) {
count = (int) OhaHelper.getAmountDays(
cursor.getLong(EnergyUseLogEntry.INDEX_COLUMNS_CALC_PERIOD_BEGIN),
cursor.getLong(EnergyUseLogEntry.INDEX_COLUMNS_CALC_PERIOD_END)
);
}
return new OhaEnergyUseDaysCursor(sqLiteDatabase, endDate, count, this);
}
示例6: onInitializationSuccess
import android.net.Uri; //导入方法依赖的package包/类
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider,
YouTubePlayer youTubePlayer, boolean wasRestored) {
if (!wasRestored) {
if (LOG) {
Log.v(TAG, "trailerData " + trailerData);
}
if (trailerData != null && !trailerData.isEmpty()) {
Uri uri = trailerData.get(0).getTrailerUri();
if (LOG) {
Log.v(TAG, "trailerData " + trailerData.size());
}
String trailerCode = uri.getQueryParameter("v");
if (trailerCode != null) {
this.youTubePlayer = youTubePlayer;
youTubePlayer.cueVideo(trailerCode);
}
} else {
getFragmentManager().beginTransaction().remove(youTubePlayerFragment).commit();
}
}
}
示例7: onCreate
import android.net.Uri; //导入方法依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
setContentView(R.layout.activity_result);
Uri appLinkUri = Uri.parse(getIntent().getDataString());
String responseCode = appLinkUri.getQueryParameter("responseCode");
if (responseCode.equals("0")) {
this.showReceipts(appLinkUri);
addListener(R.id.button_back);
} else {
String reason = appLinkUri.getQueryParameter("reason");
toast(reason);
finish();
}
} catch (Exception e) {
toast(e.getMessage());
this.finish();
}
}
示例8: getQueryParameter
import android.net.Uri; //导入方法依赖的package包/类
/**
* Uri#getQueryParameter(String) has the following warning:
*
* > Prior to Ice Cream Sandwich, this decoded the '+' character as '+' rather than ' '.
*/
public static String getQueryParameter(Uri uri, String key) {
String value = uri.getQueryParameter(key);
if (value != null && Build.VERSION.SDK_INT < 14) {
value = value.replaceAll("\\+", " ");
}
return value;
}
示例9: getUrl
import android.net.Uri; //导入方法依赖的package包/类
private String getUrl(Uri uri) {
String url = uri.toString();
String scheme = uri.getScheme();
if (uri.isHierarchical()) {
if (TextUtils.equals(scheme, "http") || TextUtils.equals(scheme, "https")) {
String weexTpl = uri.getQueryParameter(Constants.WEEX_TPL_KEY);
if (!TextUtils.isEmpty(weexTpl)) {
url = weexTpl;
}
}
}
return url;
}
示例10: insert
import android.net.Uri; //导入方法依赖的package包/类
@Override
public Uri insert(Uri uri, ContentValues contentValues) {
String targetAuthority = uri.getQueryParameter(Env.EXTRA_TARGET_AUTHORITY);
if (!TextUtils.isEmpty(targetAuthority) && !TextUtils.equals(targetAuthority, uri.getAuthority())) {
ContentProviderClient client = getContentProviderClient(targetAuthority);
try {
return client.insert(buildNewUri(uri, targetAuthority), contentValues);
} catch (RemoteException e) {
handleExpcetion(e);
}
}
return null;
}
示例11: matchUri
import android.net.Uri; //导入方法依赖的package包/类
private static int matchUri(final Uri uri) {
int protocolVersion = 1;
final String protocolVersionArg = uri.getQueryParameter(QUERY_PARAMETER_PROTOCOL_VERSION);
if ("2".equals(protocolVersionArg)) protocolVersion = 2;
switch (protocolVersion) {
case 1: return sUriMatcherV1.match(uri);
case 2: return sUriMatcherV2.match(uri);
default: return NO_MATCH;
}
}
示例12: getType
import android.net.Uri; //导入方法依赖的package包/类
public String getType(Uri uri) {
String targetAuthority = uri.getQueryParameter(ApkConstant.EXTRA_TARGET_AUTHORITY);
if (!(TextUtils.isEmpty(targetAuthority) || TextUtils.equals(targetAuthority, uri.getAuthority()))) {
try {
return getContentProviderClient(targetAuthority).getType(buildNewUri(uri, targetAuthority));
} catch (RemoteException e) {
handleExpcetion(e);
}
}
return null;
}
示例13: insert
import android.net.Uri; //导入方法依赖的package包/类
@Override
public Uri insert(@NonNull Uri uri, ContentValues initialValues) {
createDbIfNotExists();
SqlArguments args = new SqlArguments(uri);
// In very limited cases, we support system|signature permission apps to modify the db.
if (Binder.getCallingPid() != Process.myPid()) {
if (!initializeExternalAdd(initialValues)) {
return null;
}
}
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
addModifiedTime(initialValues);
final long rowId = dbInsertAndCheck(mOpenHelper, db, args.table, null, initialValues);
if (rowId < 0) return null;
uri = ContentUris.withAppendedId(uri, rowId);
notifyListeners();
if (AndroidVersion.isAtLeastMarshmallow) {
reloadLauncherIfExternal();
} else {
// Deprecated behavior to support legacy devices which rely on provider callbacks.
LauncherAppState app = LauncherAppState.getInstanceNoCreate();
if (app != null && "true".equals(uri.getQueryParameter("isExternalAdd"))) {
app.getModel().forceReload();
}
String notify = uri.getQueryParameter("notify");
if (notify == null || "true".equals(notify)) {
getContext().getContentResolver().notifyChange(uri, null);
}
}
return uri;
}
示例14: openNewWindow
import android.net.Uri; //导入方法依赖的package包/类
public void openNewWindow(Uri uri, int i, String str, String str2) {
String queryParameter = uri.getQueryParameter("url");
try {
Intent intent = new Intent(this.b, AppbarActivity.class);
intent.putExtra("url", queryParameter);
this.b.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
示例15: handleDecodeInternally
import android.net.Uri; //导入方法依赖的package包/类
private void handleDecodeInternally(String code) {
if (!TextUtils.isEmpty(code)) {
Uri uri = Uri.parse(code);
if (uri.getQueryParameterNames().contains("bundle")) {
WXEnvironment.sDynamicMode = uri.getBooleanQueryParameter("debug", false);
WXEnvironment.sDynamicUrl = uri.getQueryParameter("bundle");
String tip = WXEnvironment.sDynamicMode ? "Has switched to Dynamic Mode" : "Has switched to Normal Mode";
Toast.makeText(this, tip, Toast.LENGTH_SHORT).show();
finish();
return;
} else if (uri.getQueryParameterNames().contains("_wx_devtool")) {
WXEnvironment.sRemoteDebugProxyUrl = uri.getQueryParameter("_wx_devtool");
WXEnvironment.sDebugServerConnectable = true;
WXSDKEngine.reload();
Toast.makeText(this, "devtool", Toast.LENGTH_SHORT).show();
return;
} else if (code.contains("_wx_debug")) {
uri = Uri.parse(code);
String debug_url = uri.getQueryParameter("_wx_debug");
WXSDKEngine.switchDebugModel(true, debug_url);
finish();
} else {
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Constants.ACTION_OPEN_URL);
intent.setPackage(getPackageName());
intent.setData(Uri.parse(code));
startActivity(intent);
}
}
}