public static String getWallpaper(Context context, String name) { ContentResolver resolver = context.getContentResolver(); Uri uri; if (com.coco.theme.themebox.util.FunctionConfig.isNetVersion()) uri = Uri.parse("content://" + TURBO_LAUNCHER_PROVIDER_AUTHOR + "/" + "wallpaper"); else uri = Uri.parse("content://" + "com.iLoong.launcher.pub.provider" + "/" + "wallpaper"); String[] projection = null; String selection = null; String[] selectionArgs = null; String sortOrder = null; String theme = "default"; try { selection = " propertyName=? "; selectionArgs = new String[] {name}; Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder); if (cursor != null) { if (cursor.moveToFirst()) { theme = cursor.getString(cursor.getColumnIndex("propertyValue")); } cursor.close(); } else { theme = null; } } catch (Exception e) { e.printStackTrace(); } if (theme == null || theme.trim().length() == 0) { theme = null; } return theme; }
private static void initAssets(Context context) { mContext = context; String serialno = ""; String domain = ""; String app_id = ""; String template_id = ""; String channel_id = ""; ContentResolver resolver = context.getContentResolver(); Uri uri; if (com.coco.theme.themebox.util.FunctionConfig.isNetVersion()) uri = Uri.parse("content://" + TURBO_LAUNCHER_PROVIDER_AUTHOR + "/" + "config"); else uri = Uri.parse("content://" + "com.iLoong.launcher.pub.provider" + "/" + "config"); String[] projection = null; String selection = null; String[] selectionArgs = null; String sortOrder = null; config = new JSONObject(); try { selection = " propertyName=? "; selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_DOMAIN}; Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder); if (cursor != null) { if (cursor.moveToFirst()) { domain = cursor.getString(cursor.getColumnIndex("propertyValue")); } cursor.close(); } else { domain = ""; } config.put(PREFERENCE_KEY_CONFIG_DOMAIN, domain); } catch (Exception e) { e.printStackTrace(); } try { selection = " propertyName=? "; selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_SERIALNO}; Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder); if (cursor != null) { if (cursor.moveToFirst()) { serialno = cursor.getString(cursor.getColumnIndex("propertyValue")); } cursor.close(); } else { serialno = ""; } config.put(PREFERENCE_KEY_CONFIG_SERIALNO, serialno); } catch (Exception e) { e.printStackTrace(); } try { selection = " propertyName=? "; selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_APPID}; Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder); if (cursor != null) { if (cursor.moveToFirst()) { app_id = cursor.getString(cursor.getColumnIndex("propertyValue")); } cursor.close(); } else { app_id = ""; } config.put(PREFERENCE_KEY_CONFIG_APPID, app_id); } catch (Exception e) { e.printStackTrace(); } try { selection = " propertyName=? "; selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_TEMPLATEID}; Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder); if (cursor != null) { if (cursor.moveToFirst()) { template_id = cursor.getString(cursor.getColumnIndex("propertyValue")); } cursor.close(); } else { template_id = ""; } config.put(PREFERENCE_KEY_CONFIG_TEMPLATEID, template_id); } catch (Exception e) { e.printStackTrace(); } try { selection = " propertyName=? "; selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_CHANNELID}; Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder); if (cursor != null) { if (cursor.moveToFirst()) { channel_id = cursor.getString(cursor.getColumnIndex("propertyValue")); } cursor.close(); } else { channel_id = ""; } config.put(PREFERENCE_KEY_CONFIG_CHANNELID, channel_id); } catch (Exception e) { e.printStackTrace(); } try { Log.v( "theme", "assets " + PREFERENCE_KEY_CONFIG_DOMAIN + ":" + config.getString(PREFERENCE_KEY_CONFIG_DOMAIN)); Log.v( "theme", "assets " + PREFERENCE_KEY_CONFIG_SERIALNO + ":" + config.getString(PREFERENCE_KEY_CONFIG_SERIALNO)); Log.v( "theme", "assets " + PREFERENCE_KEY_CONFIG_APPID + ":" + config.getString(PREFERENCE_KEY_CONFIG_APPID)); Log.v( "theme", "assets " + PREFERENCE_KEY_CONFIG_TEMPLATEID + ":" + config.getString(PREFERENCE_KEY_CONFIG_TEMPLATEID)); Log.v( "theme", "assets " + PREFERENCE_KEY_CONFIG_CHANNELID + ":" + config.getString(PREFERENCE_KEY_CONFIG_CHANNELID)); } catch (Exception ex) { } }