• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java VKUIHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vk.sdk.VKUIHelper的典型用法代码示例。如果您正苦于以下问题:Java VKUIHelper类的具体用法?Java VKUIHelper怎么用?Java VKUIHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VKUIHelper类属于com.vk.sdk包,在下文中一共展示了VKUIHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:31,代码来源:VKRequest.java


示例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;
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:24,代码来源:VKUploadImage.java


示例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;
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:32,代码来源:VKIInAppBillingService.java


示例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);
    }
}
 
开发者ID:PhilipPavo,项目名称:VK-Files,代码行数:24,代码来源:MainActivity.java


示例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;
}
 
开发者ID:DementorAl,项目名称:VkAdmin,代码行数:24,代码来源:VKRequest.java


示例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;
}
 
开发者ID:DementorAl,项目名称:VkAdmin,代码行数:24,代码来源:VKUploadImage.java


示例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;
}
 
开发者ID:LizaAlert-HotLine,项目名称:AndroidMobileWorkplace,代码行数:23,代码来源:VKRequest.java


示例8: onResume

import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();

    if (getService() != null)
        getService().setActivityStarted(true);

    VKUIHelper.onResume(this);
}
 
开发者ID:dmllr,项目名称:IdealMedia,代码行数:10,代码来源:NavigationActivity.java


示例9: onDestroy

import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
public void onDestroy() {
    // Unbind Service
    unbindService(mConnection);

    super.onDestroy();

    VKUIHelper.onDestroy(this);
}
 
开发者ID:dmllr,项目名称:IdealMedia,代码行数:10,代码来源:NavigationActivity.java


示例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);
    }
}
 
开发者ID:dmllr,项目名称:IdealMedia,代码行数:11,代码来源:NavigationActivity.java


示例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();
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:16,代码来源:VKShareDialogDelegate.java


示例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;
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:8,代码来源:VKPaymentsServerSender.java


示例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();
    }
}
 
开发者ID:PhilipPavo,项目名称:VK-Files,代码行数:11,代码来源:MainActivity.java


示例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();
}
 
开发者ID:CheDream-Android,项目名称:CheDream,代码行数:10,代码来源:BaseSocialActivity.java


示例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();
    }
}
 
开发者ID:CheDream-Android,项目名称:CheDream,代码行数:10,代码来源:BaseSocialActivity.java


示例16: getClient

import com.vk.sdk.VKUIHelper; //导入依赖的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


示例17: onResume

import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    VKUIHelper.onResume(getActivity());
    vkManager = VkManager.getInstance(getActivity());
    vkManager.initVk();
}
 
开发者ID:LizaAlert-HotLine,项目名称:AndroidMobileWorkplace,代码行数:8,代码来源:InputFormFragment.java


示例18: onCreate

import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    VKUIHelper.onCreate(this);
    if (getFragmentManager().findFragmentByTag(SettingsFragment.class.getSimpleName()) != null) //this is important ot prevent multiple activities to be attached to single activity
        return;

    getFragmentManager().beginTransaction()
            .replace(android.R.id.content, new SettingsFragment(), SettingsFragment.class.getSimpleName())
            .commit();
}
 
开发者ID:LizaAlert-HotLine,项目名称:AndroidMobileWorkplace,代码行数:12,代码来源:SettingsActivity.java


示例19: createConnection

import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
HttpURLConnection createConnection() throws IOException {
    URL url = this.methodUrl;
    this.connection = (HttpURLConnection) url.openConnection();

    this.connection.setReadTimeout(this.timeout);
    this.connection.setConnectTimeout(this.timeout + 5000);
    this.connection.setRequestMethod("POST");
    this.connection.setUseCaches(false);
    this.connection.setDoInput(true);
    this.connection.setDoOutput(true);

    try {
        Context ctx = VKUIHelper.getApplicationContext();
        if (ctx != null) {
            PackageManager packageManager = ctx.getPackageManager();
            if (packageManager != null) {
                PackageInfo info = packageManager.getPackageInfo(ctx.getPackageName(), 0);
                this.connection.setRequestProperty("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) {
    }

    this.connection.setRequestProperty("Connection", "Keep-Alive");
    if (this.headers != null) {
        for (Map.Entry<String, String> entry : this.headers.entrySet()) {
            this.connection.addRequestProperty(entry.getKey(), entry.getValue());
        }
    }

    if (this.entity != null) {
        this.connection.addRequestProperty("Content-length", this.entity.getContentLength() + "");
        Pair<String, String> contentType = this.entity.getContentType();
        this.connection.addRequestProperty(contentType.first, contentType.second);
    }

    OutputStream os = this.connection.getOutputStream();
    this.writeParams(os);
    os.close();

    this.connection.connect();

    return this.connection;
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:52,代码来源:VKHttpClient.java


示例20: onVKAccessTokenChanged

import com.vk.sdk.VKUIHelper; //导入依赖的package包/类
@Override
public void onVKAccessTokenChanged(@Nullable VKAccessToken oldToken, @Nullable VKAccessToken newToken) {
    checkUserInstall(VKUIHelper.getApplicationContext(), false);
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:5,代码来源:VKPaymentsReceiver.java



注:本文中的com.vk.sdk.VKUIHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BMSClient类代码示例发布时间:2022-05-22
下一篇:
Java ICODecoder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap