当前位置: 首页>>代码示例>>Java>>正文


Java PreferenceManager.setSharedPreferencesName方法代码示例

本文整理汇总了Java中android.preference.PreferenceManager.setSharedPreferencesName方法的典型用法代码示例。如果您正苦于以下问题:Java PreferenceManager.setSharedPreferencesName方法的具体用法?Java PreferenceManager.setSharedPreferencesName怎么用?Java PreferenceManager.setSharedPreferencesName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.preference.PreferenceManager的用法示例。


在下文中一共展示了PreferenceManager.setSharedPreferencesName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.preference.PreferenceManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrefStore.setLocale(this);

    PreferenceManager prefMgr = getPreferenceManager();
    prefMgr.setSharedPreferencesName(PrefStore.getSettingsSharedName());

    // Restore from conf file
    PrefStore.restoreSettings(this);

    addPreferencesFromResource(R.xml.settings);

    initSummaries(getPreferenceScreen());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:SettingsActivity.java

示例2: setDriveIdFromOffice

import android.preference.PreferenceManager; //导入方法依赖的package包/类
public void setDriveIdFromOffice(String office){
    PreferenceManager prefMgr = getPreferenceManager();
    String spf = prefMgr.getSharedPreferencesName();
    prefMgr.setSharedPreferencesName(SyncToDriveService.PREFERENCES_NAME);

    String officeDriveIDkey =  SyncToDriveService.PREF_DRIVE_ID + ":" + office;
    String sDriveID = prefMgr.getSharedPreferences().getString(officeDriveIDkey, "");

    prefMgr.getSharedPreferences().edit()
            .putString(SyncToDriveService.PREF_DRIVE_ID, sDriveID)
            .apply();

    prefMgr.setSharedPreferencesName(spf);

}
 
开发者ID:etsy,项目名称:divertsy-client,代码行数:16,代码来源:SettingsActivity.java

示例3: onCreate

import android.preference.PreferenceManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //Make sure to call this since we're using a different
    PreferenceManager prefMgr = getPreferenceManager();
    prefMgr.setSharedPreferencesName(SyncToDriveService.PREFERENCES_NAME);
    addPreferencesFromResource(R.xml.pref_sync);
    setHasOptionsMenu(true);
    SetDriveStringDetails();

    Preference disconButton = findPreference("clear_drive_data");
    if(disconButton != null){
        disconButton.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
            @Override
            public boolean onPreferenceClick(Preference p){
                Log.v("SETTING", "Clear Google Login");

                ClearDriveID();

                // Need to call service
                Intent i = new Intent(getActivity(), SyncToDriveService.class).putExtra("clear_drive_data", true);
                getActivity().startService(i);

                return true;
            }
        });
    }

}
 
开发者ID:etsy,项目名称:divertsy-client,代码行数:31,代码来源:SettingsActivity.java

示例4: SetDriveStringDetails

import android.preference.PreferenceManager; //导入方法依赖的package包/类
private void SetDriveStringDetails(){
    PreferenceManager prefMgr = getPreferenceManager();
    prefMgr.setSharedPreferencesName(SyncToDriveService.PREFERENCES_NAME);

    findPreference(SyncToDriveService.PREF_DRIVE_ID).setSummary(
            prefMgr.getSharedPreferences().getString(SyncToDriveService.PREF_DRIVE_ID, "none"));
    findPreference(SyncToDriveService.PREF_DRIVE_ID_LAST_SAVE_TIME).setSummary(
            prefMgr.getSharedPreferences().getString(SyncToDriveService.PREF_DRIVE_ID_LAST_SAVE_TIME, "never"));

    if (prefMgr.getSharedPreferences().getString(SyncToDriveService.PREF_DRIVE_ID, "").length() < 1){
        findPreference("clear_drive_data").setEnabled(false);
    }
}
 
开发者ID:etsy,项目名称:divertsy-client,代码行数:14,代码来源:SettingsActivity.java

示例5: getCurrentOfficeSaveIDPref

import android.preference.PreferenceManager; //导入方法依赖的package包/类
public String getCurrentOfficeSaveIDPref(){
    PreferenceManager prefMgr = getPreferenceManager();
    String spf = prefMgr.getSharedPreferencesName();
    prefMgr.setSharedPreferencesName(WeightRecorder.PREFERENCES_NAME);
    String sOffice = prefMgr.getSharedPreferences().getString(WeightRecorder.PREF_OFFICE, WeightRecorder.DEFAULT_OFFICE);
    prefMgr.setSharedPreferencesName(spf);
    return SyncToDriveService.PREF_DRIVE_ID + ":" + sOffice;
}
 
开发者ID:etsy,项目名称:divertsy-client,代码行数:9,代码来源:SettingsActivity.java

示例6: ClearDriveID

import android.preference.PreferenceManager; //导入方法依赖的package包/类
public void ClearDriveID(){
    Log.v("SETTINGS", "Clearing Drive ID");

    PreferenceManager prefMgr = getPreferenceManager();
    prefMgr.setSharedPreferencesName(SyncToDriveService.PREFERENCES_NAME);
    SharedPreferences mSharedPreferences = prefMgr.getSharedPreferences();
    mSharedPreferences.edit()
            .putBoolean(SyncToDriveService.PREF_USE_GOOGLE_DRIVE, false)
            .apply();

    mSharedPreferences.edit()
            .putString(SyncToDriveService.PREF_DRIVE_ID, "")
            .apply();



    mSharedPreferences.edit()
            .putString(getCurrentOfficeSaveIDPref(), "")
            .apply();

    // Commit here so that we make sure these items are changed before
    // we read the strings again and update the settings page

    mSharedPreferences.edit()
            .putString(SyncToDriveService.PREF_DRIVE_ID_LAST_SAVE_TIME, "")
            .commit();

    SetDriveStringDetails();

}
 
开发者ID:etsy,项目名称:divertsy-client,代码行数:31,代码来源:SettingsActivity.java

示例7: onCreate

import android.preference.PreferenceManager; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	PreferenceManager manager = getPreferenceManager();
	manager.setSharedPreferencesName(PREFS_COMMON); // configure preferences
	addPreferencesFromResource(R.layout.prefs_brightness);
	
	CheckBoxPreference checkbox = (CheckBoxPreference) findPreference(PREF_LIGHT_SENSOR);
	checkbox.setOnPreferenceClickListener(this);
	
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:12,代码来源:BrightnessPrefs.java

示例8: onCreate

import android.preference.PreferenceManager; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	PreferenceManager manager = getPreferenceManager();
	manager.setSharedPreferencesName(PREFS_COMMON);
	addPreferencesFromResource(mLayoutResource);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:8,代码来源:BasePrefs.java

示例9: getSharedPreferences

import android.preference.PreferenceManager; //导入方法依赖的package包/类
public static SharedPreferences getSharedPreferences(PreferenceManager preferenceManager, String prefName) {
    if (!TextUtils.isEmpty(prefName)) {
        preferenceManager.setSharedPreferencesName(prefName);
    }
    preferenceManager.setSharedPreferencesMode(Context.MODE_WORLD_READABLE);
    return preferenceManager.getSharedPreferences();
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:8,代码来源:SharedPreferencesUtils.java

示例10: onCreate

import android.preference.PreferenceManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrefStore.setLocale(this);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    PreferenceManager prefMgr = getPreferenceManager();
    prefMgr.setSharedPreferencesName(PrefStore.getPropertiesSharedName());

    // Restore from conf file if open from main activity
    if (getIntent().getBooleanExtra("restore", false)) {
        PrefStore.restoreProperties(this);
    }

    Bundle b = getIntent().getExtras();
    int pref = 0;
    if (b != null)
        pref = b.getInt("pref");
    switch (pref) {
        case 1:
            addPreferencesFromResource(R.xml.properties_ssh);
            break;
        case 2:
            addPreferencesFromResource(R.xml.properties_vnc);
            break;
        case 3:
            addPreferencesFromResource(R.xml.properties_x11);
            break;
        case 4:
            addPreferencesFromResource(R.xml.properties_fb);
            break;
        case 5:
            addPreferencesFromResource(R.xml.properties_run_parts);
            break;
        case 6:
            addPreferencesFromResource(R.xml.properties_sysv);
            break;
        default:
            addPreferencesFromResource(R.xml.properties);
    }

    initSummaries(getPreferenceScreen());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:45,代码来源:PropertiesActivity.java

示例11: setupPreferenceManager

import android.preference.PreferenceManager; //导入方法依赖的package包/类
/**
 * Setup {@code pm} to use global unique filename and global access mode.
 * You must use this method if you let the user change preferences via UI
 * (such as {@link PreferenceActivity}, {@link PreferenceFragment}...).
 * 
 * @param pm
 *            {@link PreferenceManager}.
 * @since v4.9 beta
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void setupPreferenceManager(PreferenceManager pm) {
    pm.setSharedPreferencesMode(Context.MODE_MULTI_PROCESS);
    pm.setSharedPreferencesName(genPreferenceFilename());
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:15,代码来源:Prefs.java


注:本文中的android.preference.PreferenceManager.setSharedPreferencesName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。