本文整理汇总了Java中com.vk.sdk.VKUIHelper类的典型用法代码示例。如果您正苦于以下问题:Java VKUIHelper类的具体用法?Java VKUIHelper怎么用?Java VKUIHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VKUIHelper类属于com.vk.sdk包,在下文中一共展示了VKUIHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VKRequest
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
/**
* Creates new request with parameters. See documentation for methods here https://vk.com/dev/methods
*
* @param method API-method name, e.g. audio.get
* @param parameters method parameters
* @param modelClass class for automatic parse
*/
public VKRequest(String method, VKParameters parameters, Class<? extends VKApiModel> modelClass) {
this.context = VKUIHelper.getApplicationContext();
this.methodName = method;
if (parameters == null) {
parameters = new VKParameters();
}
this.mMethodParameters = new VKParameters(parameters);
this.mAttemptsUsed = 0;
this.secure = true;
//By default there is 1 attempt for loading.
this.attempts = 1;
//If system language is not supported, we use english
this.mPreferredLang = "en";
//By default we use system language.
this.useSystemLanguage = true;
this.shouldInterruptUI = true;
setModelClass(modelClass);
}
示例2: getTmpFile
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
public File getTmpFile() {
Context ctx = VKUIHelper.getApplicationContext();
File outputDir = null;
if (ctx != null) {
outputDir = ctx.getExternalCacheDir();
if (outputDir == null || !outputDir.canWrite())
outputDir = ctx.getCacheDir();
}
File tmpFile = null;
try {
tmpFile = File.createTempFile("tmpImg", String.format(".%s", mParameters.fileExtension()), outputDir);
FileOutputStream fos = new FileOutputStream(tmpFile);
if (mParameters.mImageType == VKImageParameters.VKImageType.Png)
mImageData.compress(Bitmap.CompressFormat.PNG, 100, fos);
else
mImageData.compress(Bitmap.CompressFormat.JPEG, (int) (mParameters.mJpegQuality * 100), fos);
fos.close();
} catch (IOException ignored) {
if (VKSdk.DEBUG)
ignored.printStackTrace();
}
return tmpFile;
}
示例3: consumePurchase
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
/**
* Consume the last purchase of the given SKU. This will result in this item being removed
* from all subsequent responses to getPurchases() and allow re-purchase of this item.
*
* @param apiVersion billing API version that the app is using
* @param packageName package name of the calling app
* @param purchaseToken token in the purchase information JSON that identifies the purchase
* to be consumed
* @return 0 if consumption succeeded. Appropriate error values for failures.
*/
public int consumePurchase(final int apiVersion,
@NonNull final String packageName,
@NonNull final String purchaseToken) throws android.os.RemoteException {
String purchaseData = !VKPaymentsServerSender.isNotVkUser() //
? getPurchaseData(mIInAppBillingService, apiVersion, packageName, purchaseToken) //
: null;
int result;
try {
result = (Integer) sMethodConsumePurchase.invoke(mIInAppBillingService, apiVersion, packageName, purchaseToken);
} catch (Exception e) {
throw new RuntimeException(e);
}
final Context ctx = VKUIHelper.getApplicationContext();
if (!TextUtils.isEmpty(purchaseData) && ctx != null) {
VKPaymentsServerSender.getInstance(ctx).saveTransaction(purchaseData);
}
return result;
}
示例4: onCreate
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
VKUIHelper.onCreate(this);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
setContentView(R.layout.activity_main);
app_bar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(app_bar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
drawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);
drawerFragment.init((DrawerLayout) findViewById(R.id.drawer_layout), this, app_bar);
// VK INITIALIZATION
VKSdk.initialize(listener, Config.APP_ID, null);
// VK Authorize User
if(VKSdk.wakeUpSession() && user.authed()){
}else{
selectSection(-1);
}
}
示例5: processCommonError
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
private boolean processCommonError(VKError error) {
if (error.errorCode == VKError.VK_API_ERROR) {
if (error.apiError.errorCode == 14) {
error.apiError.request = this;
this.mLoadingOperation = null;
VKSdk.instance().sdkListener().onCaptchaError(error.apiError);
return true;
} else if (error.apiError.errorCode == 16) {
VKAccessToken token = VKSdk.getAccessToken();
token.httpsRequired = true;
repeat();
return true;
} else if (error.apiError.errorCode == 17) {
Intent i = new Intent(VKUIHelper.getTopActivity(), VKOpenAuthActivity.class);
i.putExtra(VKOpenAuthActivity.VK_EXTRA_VALIDATION_URL, error.apiError.redirectUri);
i.putExtra(VKOpenAuthActivity.VK_EXTRA_VALIDATION_REQUEST, this.registerObject());
VKUIHelper.getTopActivity().startActivityForResult(i, VKSdk.VK_SDK_REQUEST_CODE);
return true;
}
}
return false;
}
示例6: getTmpFile
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
public File getTmpFile() {
Context ctx = VKUIHelper.getTopActivity();
File outputDir = null;
if (ctx != null) {
outputDir = ctx.getExternalCacheDir();
if (outputDir == null)
outputDir = ctx.getCacheDir();
}
File tmpFile = null;
try {
tmpFile = File.createTempFile("tmpImg", String.format(".%s", mParameters.fileExtension()), outputDir);
FileOutputStream fos = new FileOutputStream(tmpFile);
if (mParameters.mImageType == VKImageParameters.VKImageType.Png)
mImageData.compress(Bitmap.CompressFormat.PNG, 100, fos);
else
mImageData.compress(Bitmap.CompressFormat.JPEG, (int) (mParameters.mJpegQuality * 100), fos);
fos.close();
} catch (IOException ignored) {
if (VKSdk.DEBUG)
ignored.printStackTrace();
}
return tmpFile;
}
示例7: processCommonError
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
private boolean processCommonError(VKError error) {
if (error.errorCode == VKError.VK_API_ERROR) {
if (error.apiError.errorCode == 14) {
error.apiError.request = this;
this.mLoadingOperation = null;
VKSdk.instance().sdkListener().onCaptchaError(error.apiError);
return true;
} else if (error.apiError.errorCode == 16) {
VKAccessToken token = VKSdk.getAccessToken();
token.httpsRequired = true;
repeat();
return true;
} else if (error.apiError.errorCode == 17) {
Intent i = new Intent(VKUIHelper.getTopActivity(), VKOpenAuthActivity.class);
i.putExtra(VKOpenAuthActivity.VK_EXTRA_VALIDATION_URL, error.apiError.redirectUri);
VKUIHelper.getTopActivity().startActivityForResult(i, VKSdk.VK_SDK_REQUEST_CODE);
return true;
}
}
return false;
}
示例8: onResume
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (getService() != null)
getService().setActivityStarted(true);
VKUIHelper.onResume(this);
}
示例9: onDestroy
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
public void onDestroy() {
// Unbind Service
unbindService(mConnection);
super.onDestroy();
VKUIHelper.onDestroy(this);
}
示例10: onActivityResult
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (iabHelper == null)
return;
if (!iabHelper.handleActivityResult(requestCode, resultCode, data)) {
super.onActivityResult(requestCode, resultCode, data);
VKUIHelper.onActivityResult(this, requestCode, resultCode, data);
}
}
示例11: addBitmapToPreview
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
private void addBitmapToPreview(Bitmap sourceBitmap) {
if (dialogFragmentI.getActivity() == null) return;
Bitmap b = VKUIHelper.getRoundedCornerBitmap(sourceBitmap, SHARE_PHOTO_HEIGHT, SHARE_PHOTO_CORNER_RADIUS);
if (b == null) return;
ImageView iv = new ImageView(dialogFragmentI.getActivity());
iv.setImageBitmap(b);
iv.setAdjustViewBounds(true);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(mPhotoLayout.getChildCount() > 0 ? SHARE_PHOTO_MARGIN_LEFT : 0, 0, 0, 0);
mPhotoLayout.addView(iv, params);
mPhotoLayout.invalidate();
mPhotoScroll.invalidate();
}
示例12: isNotVkUser
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
public static boolean isNotVkUser() {
if (!VKSdk.isIsPaymentsEnable()) {
return true;
}
final Context ctx = VKUIHelper.getApplicationContext();
return ctx != null && VKPaymentsServerSender.getInstance(ctx).mCheckUserInstallAnswer == CHECK_USER_INSTALL_ANSWER_NOT_VK;
}
示例13: onResume
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
VKUIHelper.onResume(this);
if (user.authed()) {
user.init();
} else {
// user.auth();
}
}
示例14: onCreate
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
VKUIHelper.onCreate(this);
mFbCallbackManager = CallbackManager.Factory.create();
}
示例15: onActivityResult
import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mFbCallbackManager.onActivityResult(requestCode, resultCode, data);
VKUIHelper.onActivityResult(this, requestCode, resultCode, data);
if (requestCode == Const.SocialNetworks.GPLUS_REQUEST_CODE_RESOLVE_ERR && resultCode == RESULT_OK) {
getGoogleApiClient().connect();
}
}