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


Java PreferenceCategory.findPreference方法代码示例

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


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

示例1: initIncreasingRing

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void initIncreasingRing(PreferenceCategory root) {
    mIncreasingRing = (TwoStatePreference)
            root.findPreference(CMSettings.System.INCREASING_RING);
    mIncreasingRingVolume = (IncreasingRingVolumePreference)
            root.findPreference(KEY_INCREASING_RING_VOLUME);

    if (!mVoiceCapable) {
        if (mIncreasingRing != null) {
            root.removePreference(mIncreasingRing);
            mIncreasingRing = null;
        }
        if (mIncreasingRingVolume != null) {
            root.removePreference(mIncreasingRingVolume);
            mIncreasingRingVolume = null;
        }
    } else {
        if (mIncreasingRingVolume != null) {
            mIncreasingRingVolume.setCallback(mIncreasingRingVolumeCallback);
        }
    }
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:22,代码来源:SoundSettings.java

示例2: initVibrateWhenRinging

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void initVibrateWhenRinging(PreferenceCategory root) {
    mVibrateWhenRinging = (TwoStatePreference) root.findPreference(KEY_VIBRATE_WHEN_RINGING);
    if (mVibrateWhenRinging == null) {
        Log.i(TAG, "Preference not found: " + KEY_VIBRATE_WHEN_RINGING);
        return;
    }
    if (!mVoiceCapable || !Utils.isUserOwner()) {
        root.removePreference(mVibrateWhenRinging);
        mVibrateWhenRinging = null;
        return;
    }
    mVibrateWhenRinging.setPersistent(false);
    updateVibrateWhenRinging();
    mVibrateWhenRinging.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            final boolean val = (Boolean) newValue;
            return Settings.System.putInt(getContentResolver(),
                    Settings.System.VIBRATE_WHEN_RINGING,
                    val ? 1 : 0);
        }
    });
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:24,代码来源:SoundSettings.java

示例3: updatePreferenceScreen

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
void updatePreferenceScreen() {
    PreferenceCategory preferenceCategory = (PreferenceCategory) findPreference("dataSourceType");
    PhoneSensorDataSource phoneSensorDataSource;
    for (int i = 0; i < phoneSensorDataSources.getPhoneSensorDataSources().size(); i++) {
        phoneSensorDataSource = phoneSensorDataSources.getPhoneSensorDataSources().get(i);
        SwitchPreference switchPreference = (SwitchPreference) preferenceCategory.findPreference(phoneSensorDataSource.getDataSourceType());
        switchPreference.setChecked(phoneSensorDataSource.isEnabled());
        if (!isSensorSupported(phoneSensorDataSource.getDataSourceType()))
            switchPreference.setSummary("Not Supported");
        else {
            try {
                switchPreference.setSummary(phoneSensorDataSource.getFrequency() + " Hz");
            } catch (NumberFormatException nfe) {
                switchPreference.setSummary(phoneSensorDataSource.getFrequency());
            }
        }
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-PhoneSensor,代码行数:19,代码来源:PrefsFragmentSettings.java

示例4: fillDualSimList

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
private void fillDualSimList(PreferenceScreen preferenceScreen) {
    PreferenceCategory category = (PreferenceCategory) preferenceScreen.findPreference("sms_category");
    ListPreference preference = (ListPreference) category.findPreference(Preferences.DUALSIM_SIM);
    List<String> simIds = new ArrayList<>();
    List<String> simNames = new ArrayList<>();
    simIds.add(String.valueOf(Preferences.VALUE_DEFAULT_SIM));
    simNames.add(getString(R.string.sim_default));
    SubscriptionManager subscriptionManager = SubscriptionManager.from(getActivity());
    for (SubscriptionInfo subscriptionInfo : subscriptionManager.getActiveSubscriptionInfoList()) {
        simIds.add(String.valueOf(subscriptionInfo.getSubscriptionId()));
        simNames.add(getString(R.string.sim_name, subscriptionInfo.getSimSlotIndex() + 1, subscriptionInfo
            .getDisplayName()));
    }
    preference.setEntries(simNames.toArray(new String[simNames.size()]));
    preference.setEntryValues(simIds.toArray(new String[simIds.size()]));
    preference.setDefaultValue(String.valueOf(Preferences.VALUE_DEFAULT_SIM));
    preference.setSummary(preference.getEntry());
}
 
开发者ID:avast,项目名称:sms-ticket,代码行数:20,代码来源:SettingsFragment.java

示例5: initRingtones

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void initRingtones(PreferenceCategory root) {
    DefaultRingtonePreference phoneRingtonePreference =
            (DefaultRingtonePreference) root.findPreference(KEY_PHONE_RINGTONE);
    if (mPhoneRingtonePreferences != null && !mVoiceCapable || !Utils.isUserOwner()) {
        root.removePreference(phoneRingtonePreference);
        mPhoneRingtonePreferences = null;
    } else {
        mPhoneRingtonePreferences = new ArrayList<DefaultRingtonePreference>();
        TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(
                Context.TELEPHONY_SERVICE);
        if (telephonyManager.isMultiSimEnabled()){
            root.removePreference(phoneRingtonePreference);
            PreferenceCategory soundCategory = (PreferenceCategory) findPreference(KEY_SOUND);
            for (int i = 0; i < TelephonyManager.getDefault().getSimCount(); i++) {
                DefaultRingtonePreference ringtonePreference =
                        new DefaultRingtonePreference(mContext, null);
                String title = getString(R.string.sim_ringtone_title, i + 1);
                ringtonePreference.setTitle(title);
                ringtonePreference.setSubId(i);
                ringtonePreference.setOrder(0);
                ringtonePreference.setRingtoneType(RingtoneManager.TYPE_RINGTONE);
                soundCategory.addPreference(ringtonePreference);
                mPhoneRingtonePreferences.add(ringtonePreference);
            }
        } else {
            mPhoneRingtonePreferences.add(phoneRingtonePreference);
        }
    }
    mNotificationRingtonePreference = root.findPreference(KEY_NOTIFICATION_RINGTONE);
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:31,代码来源:SoundSettings.java

示例6: onCreate

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	if(Logger.DEBUG) Logger.debug(TAG, "onCreate");

       setPrefDefaults();
	addPreferencesFromResource(xml.settings);
       addCustomPreferecences();
       mAdvancedSettings = new AdvancedSettings(this);

    	mPrefCategoryService = (PreferenceCategory)findPreference(getString(string.pref_service_settings_key));
	mPrefCategoryNmea = (PreferenceCategory)findPreference(getString(string.pref_nmea_settings_key));
       mPrefCategorySync = (PreferenceCategory)findPreference(getString(string.pref_locatrack_settings_key));

       if(GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) != ConnectionResult.SUCCESS) {
           Preference gmspref = mPrefCategoryService.findPreference(getString(R.string.pref_use_gms_if_available_key));
           if(gmspref != null) {
               mPrefCategoryService.removePreference(gmspref);
           }
       }

       if(getString(R.string.action_sync_settings).equals(getIntent().getAction())) {
           getPreferenceScreen().removePreference(mPrefCategoryService);
           getPreferenceScreen().removePreference(mPrefCategoryNmea);
       } else {
           hideAdvancedPreferences(getPreferenceScreen());
       }
       bindPreferencesSummaryToValue(getPreferenceScreen());
}
 
开发者ID:hmrs-cr,项目名称:android-nmea-logger,代码行数:31,代码来源:SettingsActivity.java

示例7: onCreate

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

    // Set preferences to use device-protected storage.
    if (BuildCompat.isAtLeastN()) {
        getPreferenceManager().setStorageDeviceProtected();
    }

    mKeymap = getArguments().getString(BUNDLE_KEYMAP);
    addPreferencesFromResource(getPreferenceResourceId(mKeymap));

    PreferenceScreen resetKeymapPreferenceScreen =
            (PreferenceScreen) findPreference(getString(R.string.pref_reset_keymap_key));
    resetKeymapPreferenceScreen.setOnPreferenceClickListener(
            mResetKeymapPreferenceClickListener);

    // Hide select keymap preference in Arc if current keymap is already set to default
    // keymap.
    if (IS_IN_ARC &&
            getKeyComboManager().getKeyComboModel() instanceof DefaultKeyComboModel) {
        PreferenceCategory keymapPreferenceCategory = (PreferenceCategory)
                getPreferenceScreen().findPreference(getString(
                        R.string.pref_keymap_category_key));
        ListPreference keymapListPreference = (ListPreference)
                keymapPreferenceCategory.findPreference(getString(
                        R.string.pref_select_keymap_key));
        keymapPreferenceCategory.removePreference(keymapListPreference);
    }

    int[] hiddenShortcutKeyIds = IS_IN_ARC ? HIDDEN_SHORTCUT_KEY_IDS_IN_ARC :
            HIDDEN_SHORTCUT_KEY_IDS_IN_NON_ARC;
    Set<String> hiddenShortcutKeys = new HashSet<>();
    for (int id : hiddenShortcutKeyIds) {
        hiddenShortcutKeys.add(getString(id));
    }

    initPreferenceUIs(getPreferenceScreen(), hiddenShortcutKeys);
}
 
开发者ID:google,项目名称:talkback,代码行数:40,代码来源:TalkBackKeyboardShortcutPreferencesActivity.java

示例8: configureAccountPreferences

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void configureAccountPreferences() {
    loginSharedPreferences = LoginSharedPreferences.newInstance();
    if (loginSharedPreferences.isLoggedIn()) {
        addPreferencesFromResource(R.xml.account_settings);
        PreferenceCategory accountCategory = (PreferenceCategory) findPreference(getString(R.string.settings_category_key_account));
        Preference logoutNotification = accountCategory.findPreference(getString(R.string.settings_key_logout));
        logoutNotification.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                listener.onShowLogoutDialog();
                return true;
            }
        });
    }
}
 
开发者ID:malmstein,项目名称:yahnac,代码行数:16,代码来源:SettingsFragment.java

示例9: addPreferenceClickListenerForCommunity

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void addPreferenceClickListenerForCommunity() {
    PreferenceCategory communityCategory = (PreferenceCategory) findPreference(getString(R.string.settings_category_key_community));
    Preference communityPreference = communityCategory.findPreference(getString(R.string.settings_key_community));
    communityPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/communities/108233780766400792163"));
            startActivity(browserIntent);
            return true;
        }

    });
}
 
开发者ID:malmstein,项目名称:yahnac,代码行数:15,代码来源:SettingsFragment.java

示例10: addPreferenceClickListenerForAppInvite

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void addPreferenceClickListenerForAppInvite() {
    PreferenceCategory communityCategory = (PreferenceCategory) findPreference(getString(R.string.settings_category_key_community));
    Preference invitePreference = communityCategory.findPreference(getString(R.string.settings_key_invite));
    invitePreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            listener.onAppInviteRequested();
            return true;
        }

    });
}
 
开发者ID:malmstein,项目名称:yahnac,代码行数:14,代码来源:SettingsFragment.java


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