本文整理汇总了Java中android.support.v7.preference.PreferenceManager.setDefaultValues方法的典型用法代码示例。如果您正苦于以下问题:Java PreferenceManager.setDefaultValues方法的具体用法?Java PreferenceManager.setDefaultValues怎么用?Java PreferenceManager.setDefaultValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.preference.PreferenceManager
的用法示例。
在下文中一共展示了PreferenceManager.setDefaultValues方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.v7.preference.PreferenceManager; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
instance = this;
mSetting = new Setting(instance);
DateTimeHelper.resetCalendar(instance);
PreferenceManager.setDefaultValues(instance, R.xml.pref_setting, false);
switch (mSetting.getTheme()) {
case Constant.THEME_LIGHT:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
break;
case Constant.THEME_DARK:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
break;
case Constant.THEME_AUTO:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO);
break;
default:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO);
mSetting.setTheme(Constant.THEME_AUTO);
break;
}
}
示例2: onCreate
import android.support.v7.preference.PreferenceManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
Intent intent = getIntent();
if (intent.getBooleanExtra(SettingsActivity.KEY_KILL_APP, false)) {
finish();
System.exit(0);
}
PreferenceManager.setDefaultValues(this, R.xml.pref_general, false);
((IslamicLibraryApplication) getApplication()).refreshLocale(this, false);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
mProgressBar = findViewById(R.id.progressBar1);
mTextView = findViewById(R.id.progressTextView);
checkStorage();
}
示例3: setupPreference
import android.support.v7.preference.PreferenceManager; //导入方法依赖的package包/类
private void setupPreference() {
PreferenceManager.setDefaultValues(this, R.xml.fasthub_settings, false);
PreferenceManager.setDefaultValues(this, R.xml.about_settings, false);
PreferenceManager.setDefaultValues(this, R.xml.behaviour_settings, false);
PreferenceManager.setDefaultValues(this, R.xml.customization_settings, false);
PreferenceManager.setDefaultValues(this, R.xml.language_settings, false);
PreferenceManager.setDefaultValues(this, R.xml.notification_settings, false);
}
示例4: onCreate
import android.support.v7.preference.PreferenceManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Set up toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Create adapter which returns the fragments
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
// Set up the TabLayout with the view pager
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
// Check for WRITE_SECURE_SETTINGS permission
mSecureSettingsState = ImmersiveModeUtils.hasSecureSettingsPermission(this);
// Initialize default preferences
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
// Ensure that the notification is created if applicable
ToggleNotification.ensureShown(this);
}
示例5: CustomThemeModel
import android.support.v7.preference.PreferenceManager; //导入方法依赖的package包/类
private CustomThemeModel(Context context) {
PreferenceManager.setDefaultValues(context, R.xml.preferences, false);
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
}
示例6: resetToDefaults
import android.support.v7.preference.PreferenceManager; //导入方法依赖的package包/类
public void resetToDefaults(Context context) {
sharedPrefs.edit().clear().apply();
PreferenceManager.setDefaultValues(context, R.xml.preferences, true);
}