Ejemplo n.º 1
0
 @Override
 protected void onResume() {
   super.onResume();
   DailyTipsApp.setContext(this);
   lifecycleHelper.onResume();
   RewardUtils.getRewards(
       this,
       new RewardUtils.Callback() {
         @Override
         public void onSuccess(boolean cooking, boolean home, boolean life, boolean work) {
           SharedPreferences.Editor editor =
               getApplicationContext()
                   .getSharedPreferences(DailyTipsApp.PREFERENCES_NAME, MODE_PRIVATE)
                   .edit();
           Map<String, Boolean> purchases = DailyTipsApp.getPurchases();
           editor
               .putBoolean(
                   DailyTipsApp.SKU_COOKING, cooking || purchases.get(DailyTipsApp.SKU_COOKING))
               .putBoolean(DailyTipsApp.SKU_HOME, home || purchases.get(DailyTipsApp.SKU_HOME))
               .putBoolean(
                   DailyTipsApp.SKU_LIFESTYLE, life || purchases.get(DailyTipsApp.SKU_LIFESTYLE))
               .putBoolean(DailyTipsApp.SKU_WORK, work || purchases.get(DailyTipsApp.SKU_WORK))
               .commit();
           bindUIbyPurchasese();
         }
       });
 }
Ejemplo n.º 2
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == BillingUtils.RC_BUY) {
     DailyTipsApp.getBillingUtils().handleActivityResult(requestCode, resultCode, data);
   }
   super.onActivityResult(requestCode, resultCode, data);
   lifecycleHelper.onActivityResult(requestCode, resultCode, data);
 }
Ejemplo n.º 3
0
 private void bindUIbyPurchasese() {
   Map<String, Boolean> purchases = DailyTipsApp.getPurchases();
   if (purchases.get(DailyTipsApp.SKU_TOTAL)) {
     buyTotal.setEnabled(false);
     buyCooking.setEnabled(false);
     buyHome.setEnabled(false);
     buyWork.setEnabled(false);
     buyLifestyle.setEnabled(false);
   }
   if (purchases.get(DailyTipsApp.SKU_HOME)) {
     buyHome.setEnabled(false);
   }
   if (purchases.get(DailyTipsApp.SKU_COOKING)) {
     buyCooking.setEnabled(false);
   }
   if (purchases.get(DailyTipsApp.SKU_WORK)) {
     buyWork.setEnabled(false);
   }
   if (purchases.get(DailyTipsApp.SKU_LIFESTYLE)) {
     buyLifestyle.setEnabled(false);
   }
 }