本文整理汇总了Java中com.vk.sdk.util.VKUtil类的典型用法代码示例。如果您正苦于以下问题:Java VKUtil类的具体用法?Java VKUtil怎么用?Java VKUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VKUtil类属于com.vk.sdk.util包,在下文中一共展示了VKUtil类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processUrl
import com.vk.sdk.util.VKUtil; //导入依赖的package包/类
boolean processUrl(String url) {
if (url.startsWith(REDIRECT_URL)) {
Intent data = new Intent(VK_RESULT_INTENT_NAME);
String extraData = url.substring(url.indexOf('#') + 1);
data.putExtra(VK_EXTRA_TOKEN_DATA, extraData);
Map<String, String> resultParams = VKUtil.explodeQueryString(extraData);
if (vkOpenAuthDialog.mVkError != null) {
data.putExtra(VK_EXTRA_VALIDATION_REQUEST, vkOpenAuthDialog.mVkError.request.registerObject());
}
if (resultParams != null && (resultParams.containsKey(ERROR) || resultParams.containsKey(CANCEL))) {
vkOpenAuthDialog.setResult(Activity.RESULT_CANCELED, data);
} else {
vkOpenAuthDialog.setResult(Activity.RESULT_OK, data);
}
vkOpenAuthDialog.finish();
return true;
}
return false;
}
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:21,代码来源:VKOpenAuthDialog.java
示例2: getSaveRequest
import com.vk.sdk.util.VKUtil; //导入依赖的package包/类
@Override
protected VKRequest getSaveRequest(JSONObject response) {
VKRequest saveRequest;
try {
saveRequest = VKApi.docs().save(new VKParameters(VKJsonHelper.toMap(response)));
} catch (JSONException e) {
return null;
}
if (mGroupId != 0)
saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.GROUP_ID, mGroupId));
return saveRequest;
}
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:13,代码来源:VKUploadWallDocRequest.java
示例3: generateSig
import com.vk.sdk.util.VKUtil; //导入依赖的package包/类
private String generateSig(VKAccessToken token) {
//Read description here https://vk.com/dev/api_nohttps
//At first, we need key-value pairs in order of request
String queryString = VKStringJoiner.joinParams(mPreparedParameters);
//Then we generate "request string" /method/{METHOD_NAME}?{GET_PARAMS}{POST_PARAMS}
queryString = String.format(Locale.US, "/method/%s?%s", methodName, queryString);
return VKUtil.md5(queryString + token.secret);
}
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:10,代码来源:VKRequest.java
示例4: getSaveRequest
import com.vk.sdk.util.VKUtil; //导入依赖的package包/类
@Override
protected VKRequest getSaveRequest(JSONObject response) {
VKRequest saveRequest;
try {
saveRequest = VKApi.photos().saveWallPhoto(new VKParameters(VKJsonHelper.toMap(response)));
} catch (JSONException e) {
return null;
}
if (mUserId != 0)
saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.USER_ID, mUserId));
if (mGroupId != 0)
saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.GROUP_ID, mGroupId));
return saveRequest;
}
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:15,代码来源:VKUploadWallPhotoRequest.java
示例5: getSaveRequest
import com.vk.sdk.util.VKUtil; //导入依赖的package包/类
@Override
protected VKRequest getSaveRequest(JSONObject response) {
VKRequest saveRequest;
try {
saveRequest = VKApi.photos().save(new VKParameters(VKJsonHelper.toMap(response)));
} catch (JSONException e) {
return null;
}
if (mAlbumId != 0)
saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.ALBUM_ID, mAlbumId));
if (mGroupId != 0)
saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.GROUP_ID, mGroupId));
return saveRequest;
}
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:16,代码来源:VKUploadAlbumPhotoRequest.java
示例6: tokenFromUrlString
import com.vk.sdk.util.VKUtil; //导入依赖的package包/类
/**
* Retrieve token from key-value query string
*
* @param urlString string that contains URL-query part with token. E.g. access_token=eee&expires_in=0...
* @return parsed token
*/
public static VKAccessToken tokenFromUrlString(String urlString) {
if (urlString == null)
return null;
Map<String, String> parameters = VKUtil.explodeQueryString(urlString);
return tokenFromParameters(parameters);
}
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:14,代码来源:VKAccessToken.java
示例7: tokenFromFile
import com.vk.sdk.util.VKUtil; //导入依赖的package包/类
/**
* Retrieve token from file. Token must be saved into file with saveTokenToFile method
*
* @param filePath path to file with saved token
* @return Previously saved token or null
*/
public static VKAccessToken tokenFromFile(String filePath) {
try {
String data = VKUtil.fileToString(filePath);
return tokenFromUrlString(data);
} catch (Exception e) {
return null;
}
}
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:15,代码来源:VKAccessToken.java
示例8: getClient
import com.vk.sdk.util.VKUtil; //导入依赖的package包/类
/**
* Creates the http client (if need). Returns reusing client
*
* @return Prepared client used for API requests loading
*/
public static VKHttpClient getClient() {
if (sInstance == null) {
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http",
PlainSocketFactory.getSocketFactory(), 80));
schemeRegistry.register(new Scheme("https",
SSLSocketFactory.getSocketFactory(), 443));
HttpParams params = new BasicHttpParams();
Context ctx = VKUIHelper.getTopActivity();
try {
if (ctx != null)
{
PackageManager packageManager = ctx.getPackageManager();
if (packageManager != null) {
PackageInfo info = packageManager.getPackageInfo(ctx.getPackageName(), 0);
params.setParameter(CoreProtocolPNames.USER_AGENT,
String.format(Locale.US,
"%s/%s (%s; Android %d; Scale/%.2f; VK SDK %s; %s)",
VKUtil.getApplicationName(ctx), info.versionName,
Build.MODEL, Build.VERSION.SDK_INT,
ctx.getResources().getDisplayMetrics().density,
VKSdkVersion.SDK_VERSION,
info.packageName));
}
}
} catch (Exception ignored) {
}
sInstance = new VKHttpClient(new ThreadSafeClientConnManager(params, schemeRegistry),
params);
}
return sInstance;
}
开发者ID:DementorAl,项目名称:VkAdmin,代码行数:39,代码来源:VKHttpClient.java
注:本文中的com.vk.sdk.util.VKUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论