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

Java SoomlaUtils类代码示例

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

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



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

示例1: startIabHelper

import com.soomla.SoomlaUtils; //导入依赖的package包/类
/**
 * Create a new IAB helper and set it up.
 *
 * @param onIabSetupFinishedListener is a callback that lets users to add their own implementation for when the Iab is started
 */
private synchronized void startIabHelper(OnIabSetupFinishedListener onIabSetupFinishedListener) {
    if (isIabServiceInitialized())
    {
        SoomlaUtils.LogDebug(TAG, "The helper is started. Just running the post start function.");

        if (onIabSetupFinishedListener != null && onIabSetupFinishedListener.getIabInitListener() != null) {
            onIabSetupFinishedListener.getIabInitListener().success(true);
        }
        return;
    }

    SoomlaUtils.LogDebug(TAG, "Creating IAB helper.");
    mHelper = new TapClashIabHelper();

    SoomlaUtils.LogDebug(TAG, "IAB helper Starting setup.");
    mHelper.startSetup(onIabSetupFinishedListener);
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:23,代码来源:TapClashIabService.java


示例2: onRestorePurchasessFinished

import com.soomla.SoomlaUtils; //导入依赖的package包/类
@Override
public void onRestorePurchasessFinished(IabResult result, IabInventory inventory) {
    SoomlaUtils.LogDebug(TAG, "Restore Purchases succeeded");
    if (result.getResponse() == IabResult.BILLING_RESPONSE_RESULT_OK && mRestorePurchasesListener != null) {
        // fetching owned items
        List<String> itemSkus = inventory.getAllOwnedSkus(IabHelper.ITEM_TYPE_INAPP);
        List<IabPurchase> purchases = new ArrayList<IabPurchase>();
        for (String sku : itemSkus) {
            IabPurchase purchase = inventory.getPurchase(sku);
            purchases.add(purchase);
        }

        this.mRestorePurchasesListener.success(purchases);
    } else {
        SoomlaUtils.LogError(TAG, "Wither mRestorePurchasesListener==null OR Restore purchases error: " + result.getMessage());
        if (this.mRestorePurchasesListener != null) this.mRestorePurchasesListener.fail(result.getMessage());
    }

    stopIabHelper(null);
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:21,代码来源:TapClashIabService.java


示例3: onFetchSkusDetailsFinished

import com.soomla.SoomlaUtils; //导入依赖的package包/类
@Override
public void onFetchSkusDetailsFinished(IabResult result, IabInventory inventory) {
    SoomlaUtils.LogDebug(TAG, "Restore Purchases succeeded");
    if (result.getResponse() == IabResult.BILLING_RESPONSE_RESULT_OK && mFetchSkusDetailsListener != null) {

        // @lassic (May 1st): actually, here (query finished) it only makes sense to get the details
        // of the SKUs we already queried for
        List<String> skuList = inventory.getAllQueriedSkus(false);
        List<IabSkuDetails> skuDetails = new ArrayList<IabSkuDetails>();
        for (String sku : skuList) {
            IabSkuDetails skuDetail = inventory.getSkuDetails(sku);
            if (skuDetail != null) {
                skuDetails.add(skuDetail);
            }
        }

        this.mFetchSkusDetailsListener.success(skuDetails);
    } else {
        SoomlaUtils.LogError(TAG, "Wither mFetchSkusDetailsListener==null OR Fetching details error: " + result.getMessage());
        if (this.mFetchSkusDetailsListener != null) this.mFetchSkusDetailsListener.fail(result.getMessage());
    }

    stopIabHelper(null);
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:25,代码来源:TapClashIabService.java


示例4: onIabPurchaseFinished

import com.soomla.SoomlaUtils; //导入依赖的package包/类
@Override
public void onIabPurchaseFinished(IabResult result, IabPurchase purchase) {
    /**
     * Wait to see if the purchase succeeded, then start the consumption process.
     */
    SoomlaUtils.LogDebug(TAG, "IabPurchase finished: " + result + ", purchase: " + purchase);

    TapClashIabService.getInstance().mWaitingServiceResponse = false;

    if (result.getResponse() == IabResult.BILLING_RESPONSE_RESULT_OK) {

        TapClashIabService.getInstance().mSavedOnPurchaseListener.success(purchase);
    } else if (result.getResponse() == IabResult.BILLING_RESPONSE_RESULT_USER_CANCELED) {

        TapClashIabService.getInstance().mSavedOnPurchaseListener.cancelled(purchase);
    } else if (result.getResponse() == IabResult.BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED) {

        TapClashIabService.getInstance().mSavedOnPurchaseListener.alreadyOwned(purchase);
    } else {

        TapClashIabService.getInstance().mSavedOnPurchaseListener.fail(result.getMessage());
    }
    TapClashIabService.getInstance().mSavedOnPurchaseListener = null;

    TapClashIabService.getInstance().stopIabHelper(null);
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:27,代码来源:TapClashIabService.java


示例5: onStart

import com.soomla.SoomlaUtils; //导入依赖的package包/类
@Override
protected void onStart() {
    SoomlaUtils.LogDebug(TAG, "onStart 1");
    super.onStart();

    if (!firstTime && SoomlaApp.getAppContext() instanceof Activity) {
        SoomlaUtils.LogDebug(TAG, "onStart 2");
        onActivityResult(10001, Activity.RESULT_CANCELED, null);

        Intent tabIntent = new Intent(this, ((Activity) SoomlaApp.getAppContext()).getClass());
        tabIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        SoomlaUtils.LogDebug(TAG, "onStart 3");
        startActivity(tabIntent);
    }
    SoomlaUtils.LogDebug(TAG, "onStart 4");
}
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:17,代码来源:TapClashIabService.java


示例6: onDestroy

import com.soomla.SoomlaUtils; //导入依赖的package包/类
@Override
        protected void onDestroy() {
            SoomlaUtils.LogDebug(TAG, "onDestroy 1");
            if (!mInProgressDestroy && TapClashIabService.getInstance().mWaitingServiceResponse)
            {
                SoomlaUtils.LogDebug(TAG, "onDestroy 2");
                TapClashIabService.getInstance().mWaitingServiceResponse = false;
                String err = "IabActivity is destroyed during purchase.";
                SoomlaUtils.LogError(TAG, err);

                // we're letting the helper take care of closing so there won't be any async process stuck in it.
                onActivityResult(10001, Activity.RESULT_CANCELED, null);

//                if (TapClashIabService.getInstance().mSavedOnPurchaseListener != null) {
//                    SoomlaUtils.LogDebug(TAG, "onDestroy 3");
//                    TapClashIabService.getInstance().mSavedOnPurchaseListener.fail(err);
//                    TapClashIabService.getInstance().mSavedOnPurchaseListener = null;
//                }
            }
            SoomlaUtils.LogDebug(TAG, "onDestroy 4");
            super.onDestroy();
        }
 
开发者ID:App47,项目名称:soomla-android-store-tapclash,代码行数:23,代码来源:TapClashIabService.java


示例7: getRewardsState

import com.soomla.SoomlaUtils; //导入依赖的package包/类
public static JSONObject getRewardsState() {
    List<String> rewardIds = getRewardIds();
    JSONObject rewardsStateJSON = new JSONObject();

    for (String rewardId : rewardIds) {
        JSONObject rewardValuesJSON = new JSONObject();
        try {
            int timesGiven = RewardStorage.getTimesGiven(rewardId);
            rewardValuesJSON.put("timesGiven", timesGiven);

            long lastGiven = RewardStorage.getLastGivenTimeMillis(rewardId);
            rewardValuesJSON.put("lastGiven", lastGiven);

            //TODO: add LastSeqIdxGiven when sequence reward is fixed

            rewardsStateJSON.put(rewardId, rewardValuesJSON);
        }
        catch (JSONException e) {
            SoomlaUtils.LogDebug(TAG, "Unable to set reward " + rewardId + " state. error: " + e.getLocalizedMessage());
        }
    }

    return rewardsStateJSON;
}
 
开发者ID:soomla,项目名称:soomla-android-core,代码行数:25,代码来源:RewardStorage.java


示例8: SequenceReward

import com.soomla.SoomlaUtils; //导入依赖的package包/类
/**
 * Constructor.
 * Generates an instance of <code>SequenceReward</code> from the given <code>JSONObject</code>.
 *
 * @param jsonObject A JSONObject representation of the wanted <code>SequenceReward</code>.
 * @throws JSONException
 */
public SequenceReward(JSONObject jsonObject) throws JSONException {
    super(jsonObject);

    mRewards = new ArrayList<Reward>();
    JSONArray rewardsArr = jsonObject.optJSONArray(com.soomla.data.JSONConsts.SOOM_REWARDS);
    if (rewardsArr == null) {
        SoomlaUtils.LogWarning(TAG, "reward has no meaning without children");
        rewardsArr = new JSONArray();
    }

    for(int i=0; i<rewardsArr.length(); i++) {
        JSONObject rewardJSON = rewardsArr.getJSONObject(i);
        Reward reward = fromJSONObject(rewardJSON);
        if (reward != null) {
            mRewards.add(reward);
        }
    }
}
 
开发者ID:soomla,项目名称:soomla-android-core,代码行数:26,代码来源:SequenceReward.java


示例9: RandomReward

import com.soomla.SoomlaUtils; //导入依赖的package包/类
/**
 * Constructor.
 * Generates an instance of <code>RandomReward</code> from the given <code>JSONObject</code>.
 *
 * @param jsonObject A JSONObject representation of the wanted <code>RandomReward</code>.
 * @throws JSONException
 */
public RandomReward(JSONObject jsonObject) throws JSONException {
    super(jsonObject);

    mRewards = new ArrayList<Reward>();
    JSONArray rewardsArr = jsonObject.optJSONArray(com.soomla.data.JSONConsts.SOOM_REWARDS);
    if (rewardsArr == null) {
        SoomlaUtils.LogWarning(TAG, "reward has no meaning without children");
        rewardsArr = new JSONArray();
    }

    // Iterate over all rewards in the JSON array and for each one create
    // an instance according to the reward type
    for (int i = 0; i < rewardsArr.length(); i++) {
        JSONObject rewardJSON = rewardsArr.getJSONObject(i);
        Reward reward = Reward.fromJSONObject(rewardJSON);
        if (reward != null) {
            mRewards.add(reward);
        }
    }
}
 
开发者ID:soomla,项目名称:soomla-android-core,代码行数:28,代码来源:RandomReward.java


示例10: toJSONObject

import com.soomla.SoomlaUtils; //导入依赖的package包/类
/**
 * Converts the current <code>RandomReward</code> to a JSONObject.
 *
 * @return A <code>JSONObject</code> representation of the current <code>RandomReward</code>.
 */
@Override
public JSONObject toJSONObject(){
    JSONObject jsonObject = super.toJSONObject();
    try {
        JSONArray rewardsArr = new JSONArray();
        for (Reward reward : mRewards) {
            rewardsArr.put(reward.toJSONObject());
        }
        jsonObject.put(com.soomla.data.JSONConsts.SOOM_REWARDS, rewardsArr);
    } catch (JSONException e) {
        SoomlaUtils.LogError(TAG, "An error occurred while generating JSON object.");
    }

    return jsonObject;
}
 
开发者ID:soomla,项目名称:soomla-android-core,代码行数:21,代码来源:RandomReward.java


示例11: giveInner

import com.soomla.SoomlaUtils; //导入依赖的package包/类
/**
 * Gives a random reward from the list of rewards.
 *
 * @return <code>true</code>
 */
@Override
protected boolean giveInner() {
    List<Reward> canBeGivenRewards = new ArrayList<Reward>();
    for (Reward reward : this.mRewards) {
        if (reward.canGive()) {
            canBeGivenRewards.add(reward);
        }
    }

    if (canBeGivenRewards.isEmpty()) {
        SoomlaUtils.LogDebug(TAG, "No more rewards to give in this Random Reward: " + this.mID);
        return false;
    }

    Random rand = new Random();
    int n = rand.nextInt(canBeGivenRewards.size());
    final Reward randomReward = canBeGivenRewards.get(n);
    randomReward.give();
    mLastGivenReward = randomReward;

    return true;
}
 
开发者ID:soomla,项目名称:soomla-android-core,代码行数:28,代码来源:RandomReward.java


示例12: resetStateFromJSON

import com.soomla.SoomlaUtils; //导入依赖的package包/类
private static boolean resetStateFromJSON(JSONObject state, String targetListName, IItemStateApplier stateApplier) {
    if (!state.has(targetListName)) {
        return true;
    }

    SoomlaUtils.LogDebug(TAG, "Resetting state for " + targetListName);

    try {
        JSONObject itemsJSON = state.getJSONObject(targetListName);
        Iterator keysIter = itemsJSON.keys();
        while (keysIter.hasNext()) {
            String itemId = (String) keysIter.next();
            JSONObject itemValuesJSON = itemsJSON.getJSONObject(itemId);
            if (!stateApplier.applyState(itemId, itemValuesJSON)) {
                return false;
            }
        }
    }
    catch (JSONException e) {
        SoomlaUtils.LogError(TAG, "Unable to set state for " + targetListName + ". error: " + e.getLocalizedMessage());
        return false;
    }

    return true;
}
 
开发者ID:soomla,项目名称:android-levelup,代码行数:26,代码来源:LevelUp.java


示例13: onGoodBalanceChanged

import com.soomla.SoomlaUtils; //导入依赖的package包/类
/**
 * Receives the given <code>goodBalanceChangedEvent</code>. Upon notification, fetches the
 * good associated with the given <code>goodBalanceChangedEvent</code> and displays its price
 * and the balance.
 *
 * @param goodBalanceChangedEvent the event received
 */
@Subscribe
public void onGoodBalanceChanged(GoodBalanceChangedEvent goodBalanceChangedEvent) {
    VirtualGood good = null;
    try {
        good = (VirtualGood) StoreInfo.getVirtualItem(goodBalanceChangedEvent.getGoodItemId());
        int id = 0;
        for(int i=0; i<StoreInfo.getGoods().size(); i++) {
            if (StoreInfo.getGoods().get(i).getItemId().equals(good.getItemId())) {
                id = i;
                break;
            }
        }
        ListView list = (ListView) findViewById(R.id.list);
        TextView info = (TextView)list.getChildAt(id).findViewById(R.id.item_info);
        PurchaseWithVirtualItem pwvi = (PurchaseWithVirtualItem) good.getPurchaseType();
        info.setText("price: " + pwvi.getAmount() +
                " balance: " + goodBalanceChangedEvent.getBalance());
    } catch (VirtualItemNotFoundException e) {
        SoomlaUtils.LogDebug("StoreGoodsActivity", e.getMessage());
    }
}
 
开发者ID:soomla,项目名称:android-profile,代码行数:29,代码来源:StoreGoodsActivity.java


示例14: onDestroy

import com.soomla.SoomlaUtils; //导入依赖的package包/类
@Override
protected void onDestroy() {

    if (NokiaStoreIabService.getInstance().mWaitingServiceResponse)
    {
        NokiaStoreIabService.getInstance().mWaitingServiceResponse = false;
        String err = "IabActivity is destroyed during purchase.";
        SoomlaUtils.LogError(TAG, err);
        if (NokiaStoreIabService.getInstance().mSavedOnPurchaseListener != null) {
            NokiaStoreIabService.getInstance().mSavedOnPurchaseListener.fail(err);
            NokiaStoreIabService.getInstance().mSavedOnPurchaseListener = null;
        }
    }

    super.onDestroy();
}
 
开发者ID:Marneus68,项目名称:android-store-nokia-store,代码行数:17,代码来源:NokiaStoreIabService.java


示例15: getUserProfile

import com.soomla.SoomlaUtils; //导入依赖的package包/类
/**
 * Fetches the user profile stored for the given provider
 *
 * @param provider the provider which will be used to fetch the user profile
 * @return a user profile
 */
public static UserProfile getUserProfile(IProvider.Provider provider) {
    String userProfileJSON = KeyValueStorage.getValue(keyUserProfile(provider));
    if (TextUtils.isEmpty(userProfileJSON)) {
        return null;
    }

    try {
        JSONObject upJSON = new JSONObject(userProfileJSON);
        return new UserProfile(upJSON);
    } catch (JSONException e) {
        SoomlaUtils.LogError(TAG, "Couldn't create UserProfile from json: " + userProfileJSON);
    }

    return null;
}
 
开发者ID:soomla,项目名称:android-profile,代码行数:22,代码来源:UserProfileStorage.java


示例16: ProviderManager

import com.soomla.SoomlaUtils; //导入依赖的package包/类
public ProviderManager(Map<IProvider.Provider, ? extends Map<String, String>> profileParams, String... providerNames) {
    List<Class<? extends IProvider>> providerClass = tryFetchProviders(providerNames);
    if (providerClass == null || providerClass.size() == 0) {
        SoomlaUtils.LogWarning(TAG, "No attached providers found! Most of Profile functionality fill be unavaliable.");
    }

    mProviders = new HashMap<>();
    for (Class<? extends IProvider> aClass : providerClass) {
        try {
            IProvider provider = aClass.newInstance();
            IProvider.Provider targetProvider = provider.getProvider();
            if (profileParams != null) {
                Map<String, String> providerParams = profileParams.get(targetProvider);
                provider.configure(providerParams);
            }
            mProviders.put(targetProvider, provider);
        } catch (Exception e) {
            String err = "Couldn't instantiate provider class. Something's totally wrong here. " + e.getLocalizedMessage();
            SoomlaUtils.LogError(TAG, err);
        }
    }
}
 
开发者ID:soomla,项目名称:android-profile,代码行数:23,代码来源:ProviderManager.java


示例17: resetMissionsStateFromJSON

import com.soomla.SoomlaUtils; //导入依赖的package包/类
private static boolean resetMissionsStateFromJSON(JSONObject state) {
    return resetStateFromJSON(state, "missions", new IItemStateApplier() {
        @Override
        public boolean applyState(String itemId, JSONObject itemValuesJSON) {
            try {
                if (itemValuesJSON.has("timesCompleted")) {
                    int timesCompleted = itemValuesJSON.getInt("timesCompleted");
                    MissionStorage.setTimesCompleted(itemId, timesCompleted);
                }
            } catch (JSONException e) {
                SoomlaUtils.LogError(TAG, "Unable to set state for level " + itemId + ". error: " + e.getLocalizedMessage());
                return false;
            }

            return true;
        }
    });
}
 
开发者ID:soomla,项目名称:android-levelup,代码行数:19,代码来源:LevelUp.java


示例18: gotOAuthAccessToken

import com.soomla.SoomlaUtils; //导入依赖的package包/类
/**
 * Called when OAuth authentication has been finalized and an Access
 * Token and Access Token Secret have been provided
 *
 * @param accessToken The access token to use to do REST calls
 */
@Override
public void gotOAuthAccessToken(AccessToken accessToken) {
    SoomlaUtils.LogDebug(TAG, "login/onComplete");

    twitter.setOAuthAccessToken(accessToken);

    // Keep in storage for logging in without web-authentication
    KeyValueStorage.setValue(getTwitterStorageKey(TWITTER_OAUTH_TOKEN), accessToken.getToken());
    KeyValueStorage.setValue(getTwitterStorageKey(TWITTER_OAUTH_SECRET), accessToken.getTokenSecret());

    // Keep screen name since Twitter4J does not have it when
    // logging in using authenticated tokens
    KeyValueStorage.setValue(getTwitterStorageKey(TWITTER_SCREEN_NAME), accessToken.getScreenName());

    twitterScreenName = accessToken.getScreenName();

    RefLoginListener.success(RefProvider);

    clearListener(ACTION_LOGIN);
}
 
开发者ID:soomla,项目名称:android-profile,代码行数:27,代码来源:SoomlaTwitter.java


示例19: gotUserTimeline

import com.soomla.SoomlaUtils; //导入依赖的package包/类
/**
 * Called when the user's timeline has arrived
 *
 * @param statuses The user's latest statuses
 */
@Override
public void gotUserTimeline(ResponseList<Status> statuses) {
    SoomlaUtils.LogDebug(TAG, "getFeed/onComplete");


    List<String> feeds = new ArrayList<String>();
    for (Status post : statuses) {
        feeds.add(post.getText());
    }

    boolean hasMore;
    if (feeds.size() >= PAGE_SIZE) {
        lastFeedCursor ++;
        hasMore = true;
    } else {
        lastFeedCursor = 1;
        hasMore = false;
    }
    RefFeedListener.success(feeds, hasMore);
    clearListener(ACTION_GET_FEED);
}
 
开发者ID:soomla,项目名称:android-profile,代码行数:27,代码来源:SoomlaTwitter.java


示例20: completeVerify

import com.soomla.SoomlaUtils; //导入依赖的package包/类
private void completeVerify(Uri uri) {
    SoomlaUtils.LogDebug(TAG, "Verification complete");
    /**
     * Handle OAuth Callback
     */
    if (uri != null && uri.toString().startsWith(oauthCallbackURL)) {
        String verifier = uri.getQueryParameter(OAUTH_VERIFIER);
        if (!TextUtils.isEmpty(verifier)) {
            twitter.getOAuthAccessTokenAsync(mainRequestToken, verifier);
        }
        else {
            // Without a verifier an Access Token cannot be received
            // happens when a user clicks "cancel"
            cancelLogin();
        }
    }

    webView.hide();
    finish();

    mFinishedVerifying = true;
}
 
开发者ID:soomla,项目名称:android-profile,代码行数:23,代码来源:SoomlaTwitter.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Out类代码示例发布时间:1970-01-01
下一篇:
Java PropertyAccessor类代码示例发布时间:1970-01-01
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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