当前位置: 首页>>代码示例>>Java>>正文


Java Inventory类代码示例

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


Inventory类属于com.example.android.trivialdrivesample.util包,在下文中一共展示了Inventory类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onQueryInventoryFinished

import com.example.android.trivialdrivesample.util.Inventory; //导入依赖的package包/类
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
    Log.d(TAG, "Query inventory finished.");

    // Have we been disposed of in the meantime? If so, quit.
    if (mHelper == null) return;

    // Is it a failure?
    if (result.isFailure()) {
        complain("Failed to query inventory: " + result);
        return;
    }

    Log.d(TAG, "Query inventory was successful.");

    /*
     * Check for items we own. Notice that for each purchase, we check
     * the developer payload to see if it's correct! See
     * verifyDeveloperPayload().
     */

    // Check for gas delivery -- if we own gas, we should fill up the tank immediately
    Purchase gasPurchase = inventory.getPurchase(SKU_TEST_SUCCEEDED);
    if (gasPurchase != null) {
        Log.d(TAG, "We have gas. Consuming it.");
        mHelper.consumeAsync(inventory.getPurchase(SKU_TEST_SUCCEEDED), mConsumeFinishedListener);
        return;
    }

    updateUi();
    setWaitScreen(false);
    Log.d(TAG, "Initial inventory query finished; enabling main UI.");
}
 
开发者ID:huewu,项目名称:IapHouseAdSample,代码行数:33,代码来源:MainActivity.java

示例2: onInventory

import com.example.android.trivialdrivesample.util.Inventory; //导入依赖的package包/类
private void onInventory(Inventory inventory) {
    mInventory = inventory;
    binding.buttonsContainer.setVisibility(View.VISIBLE);
    binding.buttonsContainer.setEnabled(false);
    binding.progressBar.setVisibility(GONE);

    updateButtons();
}
 
开发者ID:HearthSim,项目名称:arcane_tracker,代码行数:9,代码来源:DonateActivity.java

示例3: onQueryInventoryFinished

import com.example.android.trivialdrivesample.util.Inventory; //导入依赖的package包/类
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
    Log.d(TAG, "Query inventory finished.");

    // Have we been disposed of in the meantime? If so, quit.
    if (mHelper == null) return;

    // Is it a failure?
    if (result.isFailure()) {
        complain("Failed to query inventory: " + result);
        return;
    }

    Log.d(TAG, "Query inventory was successful.");

    /*
     * Check for items we own. Notice that for each purchase, we check
     * the developer payload to see if it's correct! See
     * verifyDeveloperPayload().
     */

    // Do we have the premium upgrade?
    Purchase premiumPurchase = inventory.getPurchase(SKU_PREMIUM);
    mIsPremium = (premiumPurchase != null && verifyDeveloperPayload(premiumPurchase));
    Log.d(TAG, "User is " + (mIsPremium ? "PREMIUM" : "NOT PREMIUM"));

    // First find out which subscription is auto renewing
    Purchase gasMonthly = inventory.getPurchase(SKU_INFINITE_GAS_MONTHLY);
    Purchase gasYearly = inventory.getPurchase(SKU_INFINITE_GAS_YEARLY);
    if (gasMonthly != null && gasMonthly.isAutoRenewing()) {
        mInfiniteGasSku = SKU_INFINITE_GAS_MONTHLY;
        mAutoRenewEnabled = true;
    } else if (gasYearly != null && gasYearly.isAutoRenewing()) {
        mInfiniteGasSku = SKU_INFINITE_GAS_YEARLY;
        mAutoRenewEnabled = true;
    } else {
        mInfiniteGasSku = "";
        mAutoRenewEnabled = false;
    }

    // The user is subscribed if either subscription exists, even if neither is auto
    // renewing
    mSubscribedToInfiniteGas = (gasMonthly != null && verifyDeveloperPayload(gasMonthly))
            || (gasYearly != null && verifyDeveloperPayload(gasYearly));
    Log.d(TAG, "User " + (mSubscribedToInfiniteGas ? "HAS" : "DOES NOT HAVE")
            + " infinite gas subscription.");
    if (mSubscribedToInfiniteGas) mTank = TANK_MAX;

    // Check for gas delivery -- if we own gas, we should fill up the tank immediately
    Purchase gasPurchase = inventory.getPurchase(SKU_GAS);
    if (gasPurchase != null && verifyDeveloperPayload(gasPurchase)) {
        Log.d(TAG, "We have gas. Consuming it.");
        try {
            mHelper.consumeAsync(inventory.getPurchase(SKU_GAS), mConsumeFinishedListener);
        } catch (IabAsyncInProgressException e) {
            complain("Error consuming gas. Another async operation in progress.");
        }
        return;
    }

    updateUi();
    setWaitScreen(false);
    Log.d(TAG, "Initial inventory query finished; enabling main UI.");
}
 
开发者ID:googlesamples,项目名称:android-play-billing,代码行数:64,代码来源:MainActivity.java

示例4: onQueryInventoryFinished

import com.example.android.trivialdrivesample.util.Inventory; //导入依赖的package包/类
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
    Log.d(TAG, "Query inventory finished.");

    // Have we been disposed of in the meantime? If so, quit.
    if (mHelper == null) return;

    // Is it a failure?
    if (result.isFailure()) {
        complain("Failed to query inventory: " + result);
        return;
    }

    Log.d(TAG, "Query inventory was successful.");

    /*
     * Check for items we own. Notice that for each purchase, we check
     * the developer payload to see if it's correct! See
     * verifyDeveloperPayload().
     */

    // Do we have the premium upgrade?
    Purchase premiumPurchase = inventory.getPurchase(SKU_PREMIUM);
    mIsPremium = (premiumPurchase != null && verifyDeveloperPayload(premiumPurchase));
    Log.d(TAG, "User is " + (mIsPremium ? "PREMIUM" : "NOT PREMIUM"));

    // Do we have the infinite gas plan?
    Purchase infiniteGasPurchase = inventory.getPurchase(SKU_INFINITE_GAS);
    mSubscribedToInfiniteGas = (infiniteGasPurchase != null &&
            verifyDeveloperPayload(infiniteGasPurchase));
    Log.d(TAG, "User " + (mSubscribedToInfiniteGas ? "HAS" : "DOES NOT HAVE")
                + " infinite gas subscription.");
    if (mSubscribedToInfiniteGas) mTank = TANK_MAX;

    // Check for gas delivery -- if we own gas, we should fill up the tank immediately
    Purchase gasPurchase = inventory.getPurchase(SKU_GAS);
    if (gasPurchase != null && verifyDeveloperPayload(gasPurchase)) {
        Log.d(TAG, "We have gas. Consuming it.");
        mHelper.consumeAsync(inventory.getPurchase(SKU_GAS), mConsumeFinishedListener);
        return;
    }

    updateUi();
    setWaitScreen(false);
    Log.d(TAG, "Initial inventory query finished; enabling main UI.");
}
 
开发者ID:cafebazaar,项目名称:TrivialDrive,代码行数:46,代码来源:MainActivity.java

示例5: getInventory

import com.example.android.trivialdrivesample.util.Inventory; //导入依赖的package包/类
public Single<Inventory> getInventory() {
    return mCache;
}
 
开发者ID:HearthSim,项目名称:arcane_tracker,代码行数:4,代码来源:InAppBilling.java


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