Esempio n. 1
0
 /// 1. set applying paper id
 /// 2. save using paper id for current theme, which restore while
 /// come back to the theme later, see to: markThemeAsApply()
 public static void markPaperAsApply(Context context, String productId) {
   MarketUtils.updatePlugIn(context, productId, true, MarketUtils.CATEGORY_WALLPAPER);
   ThemeInfo themeInfo = HomeManager.getInstance().getCurrentThemeInfo();
   if (null != themeInfo) {
     SettingsActivity.setWallpaperId(context, themeInfo.mProductID, productId);
   }
 }
  private void purchase() {
    if (isLoading) {
      BLog.v(TAG, "is Loading ...");
      return;
    }

    if (!MarketUtils.hasSDcard()) {
      Toast.makeText(mActivity, R.string.msg_no_sdcard, Toast.LENGTH_SHORT).show();
      return;
    }

    if (!DataConnectionUtils.testValidConnection(mActivity)) {
      Toast.makeText(mActivity, R.string.dlg_msg_no_active_connectivity, Toast.LENGTH_SHORT).show();
      //            showLoadMessage(R.string.dlg_msg_no_active_connectivity);
      return;
    }
    if (!AccountSession.isLogin() && !mData.isFree) {
      BasicActivity bac = (BasicActivity) getActivity();
      bac.login();
      return;
    }
    synchronized (mLocked) {
      isLoading = true;
    }

    if (mData.isFree || mData.purchased) {
      onPayed(null);
    } else {
      doPaying();
    }
  }
Esempio n. 3
0
  /// 1. clear current possible applied theme id
  /// 2. set new applying theme id
  /// 3. set last used paper id for new theme
  public static void markThemeAsApply(Context context, String productId) {
    String where = ThemeColumns.IS_APPLY + "=" + 1;
    ContentValues values = new ContentValues();
    values.put(ThemeColumns.IS_APPLY, 0);
    context.getContentResolver().update(ThemeColumns.CONTENT_URI, values, where, null);

    values = new ContentValues();
    where = ThemeColumns.PRODUCT_ID + "='" + productId + "'";
    int status = 1;
    values.put(ThemeColumns.IS_APPLY, status);
    context.getContentResolver().update(ThemeColumns.CONTENT_URI, values, where, null);
    if (productId != null) {
      MarketUtils.updatePlugIn(context, productId, true, MarketUtils.CATEGORY_THEME);
      WallpaperUtils.clearAppliedFlag(context);
      String themePaperId = SettingsActivity.getWallpaperId(context, productId);
      if (!TextUtils.isEmpty(themePaperId)) {
        MarketUtils.updatePlugIn(context, themePaperId, true, MarketUtils.CATEGORY_WALLPAPER);
      }
    }
  }