本文整理匯總了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);
}