From 43532deae99d7a95af98d053c65af5bdf98b2a41 Mon Sep 17 00:00:00 2001 From: d34d Date: Tue, 23 Feb 2016 13:52:57 -0800 Subject: Themes: Refactor themes to CMSDK [4/6] Change-Id: Ie078b20539e982cd124163da8816fb106c52b927 TICKET: CYNGNOS-2126 --- AndroidManifest.xml | 2 +- .../themes/provider/PreviewGenerationService.java | 6 ++-- .../themes/provider/ThemePackageHelper.java | 21 +++++------ .../themes/provider/ThemesOpenHelper.java | 12 ++++--- .../themes/provider/ThemesProvider.java | 20 +++++------ .../themes/provider/util/ProviderUtils.java | 41 +++++++++++----------- .../provider/util/WallpaperPreviewGenerator.java | 6 ++-- 7 files changed, 56 insertions(+), 52 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 0a106e2..eaf0007 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -5,7 +5,7 @@ android:versionCode="2" android:versionName="2.0" > - + 0) { - ThemeManager mService = (ThemeManager) getContext().getSystemService( - Context.THEME_SERVICE); + ThemeManager mService = ThemeManager.getInstance(); mService.requestThemeChange(request, false); } diff --git a/src/org/cyanogenmod/themes/provider/util/ProviderUtils.java b/src/org/cyanogenmod/themes/provider/util/ProviderUtils.java index 59b3d2e..d5771f3 100644 --- a/src/org/cyanogenmod/themes/provider/util/ProviderUtils.java +++ b/src/org/cyanogenmod/themes/provider/util/ProviderUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 The CyanogenMod Project + * Copyright (C) 2015-2016 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,19 +15,18 @@ */ package org.cyanogenmod.themes.provider.util; -import android.Manifest; import android.content.Context; import android.content.Intent; -import android.content.res.ThemeManager; import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; import android.net.Uri; -import android.provider.ThemesContract; -import android.provider.ThemesContract.MixnMatchColumns; -import android.provider.ThemesContract.PreviewColumns; -import android.provider.ThemesContract.ThemesColumns; import android.text.TextUtils; -import org.cyanogenmod.themes.provider.ThemesOpenHelper; + +import cyanogenmod.platform.Manifest; +import cyanogenmod.providers.ThemesContract; +import cyanogenmod.providers.ThemesContract.MixnMatchColumns; +import cyanogenmod.providers.ThemesContract.PreviewColumns; +import cyanogenmod.providers.ThemesContract.ThemesColumns; +import cyanogenmod.themes.ThemeManager; import java.util.ArrayList; import java.util.Arrays; @@ -58,14 +57,14 @@ public class ProviderUtils { } /** - * Queries the {@link android.content.res.ThemeManager} to check if the theme is currently - * being processed by {@link com.android.server.ThemeService} + * Queries the {@link ThemeManager} to check if the theme is currently + * being processed by {@link org.cyanogenmod.platform.internal.ThemeManagerService} * @param context * @param pkgName * @return True if the theme is being processed or queued up for processing */ public static boolean isThemeBeingProcessed(Context context, String pkgName) { - ThemeManager tm = (ThemeManager) context.getSystemService(Context.THEME_SERVICE); + ThemeManager tm = ThemeManager.getInstance(); return tm.isThemeBeingProcessed(pkgName); } @@ -209,35 +208,35 @@ public class ProviderUtils { } /** - * Sends the {@link android.provider.ThemesContract.Intent#ACTION_THEME_INSTALLED} action + * Sends the {@link cyanogenmod.content.Intent#ACTION_THEME_INSTALLED} action * @param context * @param pkgName */ public static void sendThemeInstalledBroadcast(Context context, String pkgName) { - Intent intent = new Intent(ThemesContract.Intent.ACTION_THEME_INSTALLED, - Uri.fromParts(ThemesContract.Intent.URI_SCHEME_PACKAGE, pkgName, null)); + Intent intent = new Intent(cyanogenmod.content.Intent.ACTION_THEME_INSTALLED, + Uri.fromParts(cyanogenmod.content.Intent.URI_SCHEME_PACKAGE, pkgName, null)); context.sendBroadcast(intent, Manifest.permission.READ_THEMES); } /** - * Sends the {@link android.provider.ThemesContract.Intent#ACTION_THEME_UPDATED} action + * Sends the {@link cyanogenmod.content.Intent#ACTION_THEME_UPDATED} action * @param context * @param pkgName */ public static void sendThemeUpdatedBroadcast(Context context, String pkgName) { - Intent intent = new Intent(ThemesContract.Intent.ACTION_THEME_UPDATED, - Uri.fromParts(ThemesContract.Intent.URI_SCHEME_PACKAGE, pkgName, null)); + Intent intent = new Intent(cyanogenmod.content.Intent.ACTION_THEME_UPDATED, + Uri.fromParts(cyanogenmod.content.Intent.URI_SCHEME_PACKAGE, pkgName, null)); context.sendBroadcast(intent, Manifest.permission.READ_THEMES); } /** - * Sends the {@link android.provider.ThemesContract.Intent#ACTION_THEME_REMOVED} action + * Sends the {@link cyanogenmod.content.Intent#ACTION_THEME_REMOVED} action * @param context * @param pkgName */ public static void sendThemeRemovedBroadcast(Context context, String pkgName) { - Intent intent = new Intent(ThemesContract.Intent.ACTION_THEME_REMOVED, - Uri.fromParts(ThemesContract.Intent.URI_SCHEME_PACKAGE, pkgName, null)); + Intent intent = new Intent(cyanogenmod.content.Intent.ACTION_THEME_REMOVED, + Uri.fromParts(cyanogenmod.content.Intent.URI_SCHEME_PACKAGE, pkgName, null)); context.sendBroadcast(intent, Manifest.permission.READ_THEMES); } } diff --git a/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java b/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java index f1a040c..6b87d0b 100644 --- a/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java +++ b/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java @@ -18,17 +18,17 @@ package org.cyanogenmod.themes.provider.util; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; -import android.content.pm.ThemeUtils; import android.content.res.AssetManager; import android.content.res.Resources; import android.content.res.ThemeConfig; import android.graphics.Bitmap; -import android.provider.ThemesContract.PreviewColumns; import android.text.TextUtils; +import cyanogenmod.providers.ThemesContract.PreviewColumns; + +import org.cyanogenmod.internal.util.ThemeUtils; import org.cyanogenmod.themes.provider.R; -import java.io.File; import java.io.IOException; import java.util.LinkedList; import java.util.List; -- cgit v1.2.3