Java Code Examples for android.content.Context#MODE_PRIVATE
The following examples show how to use
android.content.Context#MODE_PRIVATE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
/** * 保存基本配置 * @param context * @return */ public static ClanConfig getConfig(Context context) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_PREFERENCES, Context.MODE_PRIVATE); ClanConfig clanConfig = new ClanConfig(); clanConfig.setApiUrl(sharedPreferencesUtils.loadStringSharedPreference(Key.CLAN_CONFIG_DOMAIN)); clanConfig.setApiUrlBase(sharedPreferencesUtils.loadStringSharedPreference(Key.CLAN_CONFIG_BASE)); clanConfig.setApiUrlRealBase(sharedPreferencesUtils.loadStringSharedPreference(Key.CLAN_CONFIG_REAL_BASE)); clanConfig.setAppId(sharedPreferencesUtils.loadStringSharedPreference(Key.CLAN_CONFIG_APP_ID)); clanConfig.setAppKey(sharedPreferencesUtils.loadStringSharedPreference(Key.CLAN_CONFIG_APP_KEY)); AdUrl adUrl = new AdUrl(); adUrl.setUrlSplashAd(sharedPreferencesUtils.loadStringSharedPreference(Key.CLAN_CONFIG_AD_SPLASH)); adUrl.setUrlListAd(sharedPreferencesUtils.loadStringSharedPreference(Key.CLAN_CONFIG_AD_LIST)); adUrl.setUrlLogAd(sharedPreferencesUtils.loadStringSharedPreference(Key.CLAN_CONFIG_AD_LOG)); clanConfig.setAd(adUrl); LoginInfo loginInfo = new LoginInfo(); loginInfo.setLoginMod(sharedPreferencesUtils.loadIntSharedPreference(Key.APP_CONFIG_LOGIN_MODE)); loginInfo.setLoginUrl(sharedPreferencesUtils.loadStringSharedPreference(Key.APP_CONFIG_LOGIN_URL)); loginInfo.setRegMod(sharedPreferencesUtils.loadIntSharedPreference(Key.APP_CONFIG_REG_MODE)); loginInfo.setRegUrl(sharedPreferencesUtils.loadStringSharedPreference(Key.APP_CONFIG_REG_URL)); loginInfo.setRegSwitch(sharedPreferencesUtils.loadIntSharedPreference(Key.APP_CONFIG_REG_SWITCH)); loginInfo.setAllowAvatarChange(sharedPreferencesUtils.loadStringSharedPreference(Key.APP_CONFIG_ALLOW_AVATAR_CHANGE)); clanConfig.setLoginInfo(loginInfo); clanConfig.setAppStyle(sharedPreferencesUtils.loadIntSharedPreference(Key.APP_CONFIG_APP_STYLE)); return clanConfig; }
Example 2
Source File: AppSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
public static void saveContentConfig(Context context, ContentConfig clanConfig) { if (clanConfig == null) return; SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_PREFERENCES, Context.MODE_PRIVATE); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_CONFIG_FORUM_DISPLAY_STYLE, clanConfig.getDisplayStyle()); if (clanConfig.getPlatformLogin() == null) { clanConfig.setPlatformLogin(new PlatformLogin()); } sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_CONFIG_QQ_LOGIN, clanConfig.getPlatformLogin().getQQLogin()); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_CONFIG_QQ_LOGIN_END, clanConfig.getPlatformLogin().getQQloginEnd()); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_CONFIG_WECHAT_LOGIN, clanConfig.getPlatformLogin().getWechatLogin()); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_CONFIG_WEIBO_LOGIN, clanConfig.getPlatformLogin().getWeiboLogin()); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_CONFIG_CHECKINENABLED, clanConfig.getCheckinEnabled()); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_CONFIG_IYZVERSOIN, clanConfig.getIyzversion()); if (clanConfig.getSmileyInfo() != null) { sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_SIMILY_INFO_ZIP_LAST_MD5, getContentConfig(context).getSmileyInfo().getMD5()); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_SIMILY_INFO_ZIP_MD5, clanConfig.getSmileyInfo().getMD5()); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_SIMILY_INFO_ZIP_URL, clanConfig.getSmileyInfo().getZipUrl()); } else { sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_SIMILY_INFO_ZIP_LAST_MD5, ""); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_SIMILY_INFO_ZIP_MD5, ""); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_SIMILY_INFO_ZIP_URL, ""); } if (clanConfig.getSearchSetting() != null) { sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_SEARCH_SETTING, JsonUtils.toJSONString(clanConfig.getSearchSetting())); } if (clanConfig.getThreadConfig() != null) { sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_THREAD_SETTING, JsonUtils.toJSONString(clanConfig.getThreadConfig())); } if (clanConfig.getPortalconfig() != null) { sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_PORTAIL_SETTING, JsonUtils.toJSONString(clanConfig.getPortalconfig())); } sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_APP_DESC, clanConfig.getAppDesc()); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_PUSH_ENABLED, clanConfig.getPushEnabled()); }
Example 3
Source File: YTutils.java From YTPlayer with GNU General Public License v3.0 | 5 votes |
private Uri getApkUri(String path) { // Before N, a MODE_WORLD_READABLE file could be passed via the ACTION_INSTALL_PACKAGE // Intent. Since N, MODE_WORLD_READABLE files are forbidden, and a FileProvider is // recommended. boolean useFileProvider = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N; // String tempFilename = "tmp.apk"; // byte[] buffer = new byte[16384]; int fileMode = useFileProvider ? Context.MODE_PRIVATE : Context.MODE_WORLD_READABLE; /* try (InputStream is = new FileInputStream(new File(path)); FileOutputStream fout = context.openFileOutput(tempFilename, fileMode)) { int n; while ((n = is.read(buffer)) >= 0) { fout.write(buffer, 0, n); } } catch (IOException e) { Log.i(TAG + ":getApkUri", "Failed to write temporary APK file", e); }*/ if (useFileProvider) { // File toInstall = new File(context.getFilesDir(), tempFilename); File toInstall = new File(path); return FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID+".provider", toInstall); } else { return Uri.fromFile(new File(path)); } }
Example 4
Source File: PreferenceManager.java From ticdesign with Apache License 2.0 | 4 votes |
private static int getDefaultSharedPreferencesMode() { return Context.MODE_PRIVATE; }
Example 5
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static void saveEnableScrollViewPager(Context context, boolean b) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); sharedPreferencesUtils.saveSharedPreferences("is_enable_scroll_viewpager", b); }
Example 6
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static void saveZhaoMode(Context context, boolean b) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); sharedPreferencesUtils.saveSharedPreferences("ZHAO_MODE", b); }
Example 7
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static boolean isUShowGroupAndRegisterDate(Context context) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); return sharedPreferencesUtils.loadBooleanSharedPreference(Key.KEY_U_SHOW_GROUP_AND_REGISTER_DATE, false); }
Example 8
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static void savePicSize(Context context, boolean b) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); sharedPreferencesUtils.saveSharedPreferences("IS_PIC_SIZE", b); }
Example 9
Source File: AppSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static void saveHomePageConfigJson(Context context, String clanHomePagerConfigJson) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_PREFERENCES, Context.MODE_PRIVATE); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_HOME_PAGE_CONFIG, clanHomePagerConfigJson); }
Example 10
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static boolean isPicSize(Context context) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); return sharedPreferencesUtils.loadBooleanSharedPreference("IS_PIC_SIZE", false); }
Example 11
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static boolean isZhaoMode(Context context) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); return sharedPreferencesUtils.loadBooleanSharedPreference("ZHAO_MODE", false); }
Example 12
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static boolean isLookPicSize(Context context) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); return sharedPreferencesUtils.loadBooleanSharedPreference("IS_LOOK_PIC_SIZE", false); }
Example 13
Source File: PreferenceManager.java From droidel with Apache License 2.0 | 4 votes |
private static int getDefaultSharedPreferencesMode() { return Context.MODE_PRIVATE; }
Example 14
Source File: AppSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static void saveSmileyLastMD5(Context context, String lastMD5) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_PREFERENCES, Context.MODE_PRIVATE); sharedPreferencesUtils.saveSharedPreferences(Key.CLAN_CONTENT_SIMILY_INFO_ZIP_LAST_MD5, lastMD5); }
Example 15
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static void saveUShowDigetstInTitle(Context context, boolean isUJpush) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); sharedPreferencesUtils.saveSharedPreferences(Key.KEY_U_SHOW_DIGETST_IN_TITLE, isUJpush); }
Example 16
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static int getUThemeColor(Context context) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); return sharedPreferencesUtils.loadIntSharedPreference(Key.KEY_U_THEME_COLOR, 0); }
Example 17
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static boolean isTail(Context context) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); return sharedPreferencesUtils.loadBooleanSharedPreference("IS_TAIL", false); }
Example 18
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static void saveUShowBadge(Context context, boolean isUJpush) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); sharedPreferencesUtils.saveSharedPreferences(Key.KEY_U_SHOW_BADGE, isUJpush); }
Example 19
Source File: AppUSPUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public static void saveUMainStyle(Context context, int style) { SharedPreferencesUtils sharedPreferencesUtils = new SharedPreferencesUtils(context, Key.FILE_USER_PREFERENCES, Context.MODE_PRIVATE); sharedPreferencesUtils.saveSharedPreferences(Key.KEY_U_MAIN_STYLE, style); }
Example 20
Source File: PreferenceManager.java From PreferenceFragment with Apache License 2.0 | 4 votes |
private static int getDefaultSharedPreferencesMode() { return Context.MODE_PRIVATE; }