public static String getDownloadedFilePath(Context context, DownloadInfo info) { if (WallpaperUtils.isWallpaper(info)) { return WallpaperUtils.getWallPaperPath(info.product_id); } String id = null == info ? null : info.product_id; if (TextUtils.isEmpty(id)) { return context.getFilesDir() + File.separator + "downloaded_resource"; } else { return context.getFilesDir() + File.separator + "downloaded_resource" + File.separator + id; } }
public static void attachApplication(Context context) { PKG_CURRENT_NAME = context.getPackageName(); PKG_DATA_PATH = "/data/data/" + PKG_CURRENT_NAME; PKG_FILES_PATH = PKG_DATA_PATH + "/files"; PKG_LIB_PATH = PKG_DATA_PATH + "/app_lib"; testDebugFlags(); testStrictMode(); // final int exportVersion = SettingsActivity.getExportVersion(context); // SettingsActivity.setExportVersion(context, EXPORT_VERSION); final int exportVersion = EXPORT_VERSION; WallpaperUtils.setApplicationRootPath(SDCARD_PATH, exportVersion); DataConvertUtils.scanBuildingFromParentPath(WallpaperUtils.getWallpaperFolder(SDCARD_PATH)); }
/// 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); } } }