diff options
Diffstat (limited to 'src/org/cyanogenmod/themes/provider/util/ProviderUtils.java')
-rw-r--r-- | src/org/cyanogenmod/themes/provider/util/ProviderUtils.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/org/cyanogenmod/themes/provider/util/ProviderUtils.java b/src/org/cyanogenmod/themes/provider/util/ProviderUtils.java index a07d0ba..2feeb07 100644 --- a/src/org/cyanogenmod/themes/provider/util/ProviderUtils.java +++ b/src/org/cyanogenmod/themes/provider/util/ProviderUtils.java @@ -20,9 +20,12 @@ 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.ThemesColumns; +import org.cyanogenmod.themes.provider.ThemesOpenHelper; public class ProviderUtils { /** @@ -81,6 +84,26 @@ public class ProviderUtils { return state; } + public static String getCurrentThemeForComponent(Context context, String selection, + String[] selectionArgs) { + if (context == null || selection == null || selectionArgs == null) { + return null; + } + + String[] projection = new String[] {MixnMatchColumns.COL_VALUE}; + Cursor c = context.getContentResolver().query(MixnMatchColumns.CONTENT_URI, + projection, selection, selectionArgs, null); + + String themePkgName = null; + if (c != null) { + if (c.moveToFirst()) { + themePkgName = c.getString(c.getColumnIndex(MixnMatchColumns.COL_VALUE)); + } + c.close(); + } + return themePkgName; + } + /** * Sends the {@link android.provider.ThemesContract.Intent#ACTION_THEME_INSTALLED} action * @param context |