• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EditTextPreference类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.takisoft.fix.support.v7.preference.EditTextPreference的典型用法代码示例。如果您正苦于以下问题:Java EditTextPreference类的具体用法?Java EditTextPreference怎么用?Java EditTextPreference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EditTextPreference类属于com.takisoft.fix.support.v7.preference包,在下文中一共展示了EditTextPreference类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updatePrefDefaultValue

import com.takisoft.fix.support.v7.preference.EditTextPreference; //导入依赖的package包/类
private static void updatePrefDefaultValue(Preference pref) {
    String realPrefKey = pref.getKey();
    pref.setPersistent(false);
    if (pref instanceof CheckBoxPreference) {
        pref.setKey("tmpKeyBool");
        CheckBoxPreference checkBoxPref = (CheckBoxPreference) pref;
        checkBoxPref.setChecked(PrefsManager.getBool(realPrefKey));
    } else if (pref instanceof SwitchPreferenceCompat) {
        pref.setKey("tmpKeyBool");
        SwitchPreferenceCompat switchPref = (SwitchPreferenceCompat) pref;
        switchPref.setChecked(PrefsManager.getBool(realPrefKey));
    } else if (pref instanceof EditTextPreference) {
        pref.setKey("tmpKeyString");
        EditTextPreference editTextPref = (EditTextPreference) pref;
        editTextPref.setText(PrefsManager.getString(realPrefKey));
    } else if (pref instanceof ListPreference) {
        pref.setKey("tmpKeyString");
        ListPreference listPref = (ListPreference) pref;
        listPref.setValue(PrefsManager.getString(realPrefKey));
    }
    pref.setPersistent(true);
    pref.setKey(realPrefKey);
}
 
开发者ID:FranckRJ,项目名称:RespawnIRC-Android,代码行数:24,代码来源:SettingsFragment.java


示例2: enableOrDisablePreferences

import com.takisoft.fix.support.v7.preference.EditTextPreference; //导入依赖的package包/类
private void enableOrDisablePreferences(boolean enable)
{
    String keyAddress = getString(R.string.pref_key_proxy_address);
    EditTextPreference address = (EditTextPreference) findPreference(keyAddress);
    address.setEnabled(enable);

    String keyPort = getString(R.string.pref_key_proxy_port);
    EditTextPreference port = (EditTextPreference) findPreference(keyPort);
    port.setEnabled(enable);

    String keyProxyPeersToo = getString(R.string.pref_key_proxy_peers_too);
    SwitchPreferenceCompat proxyPeersToo = (SwitchPreferenceCompat) findPreference(keyProxyPeersToo);
    proxyPeersToo.setEnabled(enable);

    String keyForceProxy = getString(R.string.pref_key_force_proxy);
    SwitchPreferenceCompat forceProxy = (SwitchPreferenceCompat) findPreference(keyForceProxy);
    forceProxy.setEnabled(enable);

    String keyRequiresAuth = getString(R.string.pref_key_proxy_requires_auth);
    SwitchPreferenceCompat requiresAuth = (SwitchPreferenceCompat) findPreference(keyRequiresAuth);
    requiresAuth.setEnabled(enable);
}
 
开发者ID:proninyaroslav,项目名称:libretorrent,代码行数:23,代码来源:ProxySettingsFragment.java


示例3: onCreatePreferencesFix

import com.takisoft.fix.support.v7.preference.EditTextPreference; //导入依赖的package包/类
@Override
public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) {
    setPreferencesFromResource(R.xml.settings, rootKey);

    testDynamicPrefs();

    EditTextPreference etPref = (EditTextPreference) findPreference("edit_text_test");
    if (etPref != null) {
        int inputType = etPref.getEditText().getInputType();
    }

    findPreference("pref_empty_check").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            if (!(Boolean) newValue) {
                findPreference("pref_empty_categ").setTitle(null);
            } else {
                findPreference("pref_empty_categ").setTitle("Now you see me");
            }

            return true;
        }
    });
}
 
开发者ID:Gericop,项目名称:Android-Support-Preference-V7-Fix,代码行数:25,代码来源:MyPreferenceFragment.java


示例4: initFilterIfNeeded

import com.takisoft.fix.support.v7.preference.EditTextPreference; //导入依赖的package包/类
private void initFilterIfNeeded(Preference pref) {
    if (pref instanceof EditTextPreference) {
        PrefsManager.StringPref currentPrefsInfos = PrefsManager.getStringInfos(pref.getKey());
        if (currentPrefsInfos.isInt) {
            listOfMinMaxInfos.put(pref.getKey(), new MinMaxInfos(currentPrefsInfos.minVal, currentPrefsInfos.maxVal));
        }
    }
}
 
开发者ID:FranckRJ,项目名称:RespawnIRC-Android,代码行数:9,代码来源:SettingsFragment.java


示例5: updatePrefSummary

import com.takisoft.fix.support.v7.preference.EditTextPreference; //导入依赖的package包/类
private void updatePrefSummary(Preference pref) {
    if (pref instanceof EditTextPreference) {
        EditTextPreference editTextPref = (EditTextPreference) pref;
        MinMaxInfos prefMinMax = listOfMinMaxInfos.get(editTextPref.getKey());
        if (prefMinMax != null) {
            editTextPref.setSummary("Entre " + String.valueOf(prefMinMax.min) + " et " + String.valueOf(prefMinMax.max) + " : " + editTextPref.getText());
        }
    }
}
 
开发者ID:FranckRJ,项目名称:RespawnIRC-Android,代码行数:10,代码来源:SettingsFragment.java


示例6: onSharedPreferenceChanged

import com.takisoft.fix.support.v7.preference.EditTextPreference; //导入依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    Preference pref = findPreference(key);

    if (pref instanceof EditTextPreference) {
        EditTextPreference editTextPref = (EditTextPreference) pref;
        MinMaxInfos prefMinMax = listOfMinMaxInfos.get(editTextPref.getKey());
        if (prefMinMax != null) {
            int prefValue = 0;
            if (!editTextPref.getText().isEmpty()) {
                try {
                    prefValue = Integer.parseInt(editTextPref.getText());
                } catch (Exception e) {
                    prefValue = 999999999;
                }
            }
            if (prefValue < prefMinMax.min) {
                prefValue = prefMinMax.min;
            } else if (prefValue > prefMinMax.max) {
                prefValue = prefMinMax.max;
            }
            editTextPref.setText(String.valueOf(prefValue));
        }
    } else if (key.equals(getString(R.string.settingsThemeUsed))) {
        ThemeManager.updateThemeUsed();

        if (getActivity() != null) {
            getActivity().recreate();
        }
    } else if (key.equals(getString(R.string.settingsInvertToolbarTextColor))) {
        ThemeManager.updateToolbarTextColor();

        if (getActivity() != null) {
            getActivity().recreate();
        }
    } else if (key.equals(getString(R.string.settingsPrimaryColorOfLightTheme)) ||
               key.equals(getString(R.string.settingsTopicNameAndLinkColorOfLightTheme))) {
        if (getActivity() != null) {
            ThemeManager.updateColorsUsed(getResources());
            getActivity().recreate();
        }
    } else if (key.startsWith("settings.customColor.")) {
        if (getActivity() != null) {
            ThemeManager.updateColorsUsed(getResources());
        }
    }

    updatePrefSummary(pref);
}
 
开发者ID:FranckRJ,项目名称:RespawnIRC-Android,代码行数:50,代码来源:SettingsFragment.java


示例7: onCreate

import com.takisoft.fix.support.v7.preference.EditTextPreference; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    SettingsManager pref = new SettingsManager(getActivity().getApplicationContext());

    boolean enableAdvancedSettings;

    String keyProxyType = getString(R.string.pref_key_proxy_type);
    ListPreference proxyType = (ListPreference) findPreference(keyProxyType);
    int type = pref.getInt(keyProxyType, SettingsManager.Default.proxyType);
    proxyType.setValueIndex(type);
    String typesName[] = getResources().getStringArray(R.array.pref_proxy_type_entries);
    proxyType.setSummary(typesName[type]);
    enableAdvancedSettings = type != Integer.parseInt(getString(R.string.pref_proxy_type_none_value));
    bindOnPreferenceChangeListener(proxyType);

    String keyAddress = getString(R.string.pref_key_proxy_address);
    EditTextPreference address = (EditTextPreference) findPreference(keyAddress);
    address.setEnabled(enableAdvancedSettings);
    String addressValue = pref.getString(keyAddress, SettingsManager.Default.proxyAddress);
    address.setText(addressValue);
    address.setSummary(addressValue);
    bindOnPreferenceChangeListener(address);

    String keyPort = getString(R.string.pref_key_proxy_port);
    EditTextPreference port = (EditTextPreference) findPreference(keyPort);
    port.setEnabled(enableAdvancedSettings);
    InputFilter[] portFilter =
            new InputFilter[]{new InputFilterMinMax(0, 10000)};
    int portNumber = pref.getInt(keyPort, SettingsManager.Default.proxyPort);
    String portValue = Integer.toString(portNumber);
    port.getEditText().setFilters(portFilter);
    port.setSummary(portValue);
    port.setText(portValue);
    bindOnPreferenceChangeListener(port);

    String keyProxyPeersToo = getString(R.string.pref_key_proxy_peers_too);
    SwitchPreferenceCompat proxyPeersToo = (SwitchPreferenceCompat) findPreference(keyProxyPeersToo);
    proxyPeersToo.setEnabled(enableAdvancedSettings);
    proxyPeersToo.setChecked(pref.getBoolean(keyProxyPeersToo, SettingsManager.Default.proxyPeersToo));
    bindOnPreferenceChangeListener(proxyPeersToo);

    String keyForceProxy = getString(R.string.pref_key_force_proxy);
    SwitchPreferenceCompat forceProxy = (SwitchPreferenceCompat) findPreference(keyForceProxy);
    forceProxy.setEnabled(enableAdvancedSettings);
    forceProxy.setChecked(pref.getBoolean(keyForceProxy, SettingsManager.Default.forceProxy));
    bindOnPreferenceChangeListener(forceProxy);

    String keyRequiresAuth = getString(R.string.pref_key_proxy_requires_auth);
    SwitchPreferenceCompat requiresAuth = (SwitchPreferenceCompat) findPreference(keyRequiresAuth);
    requiresAuth.setEnabled(enableAdvancedSettings);
    requiresAuth.setChecked(pref.getBoolean(keyRequiresAuth, SettingsManager.Default.proxyRequiresAuth));
    bindOnPreferenceChangeListener(requiresAuth);

    String keyLogin = getString(R.string.pref_key_proxy_login);
    EditTextPreference login = (EditTextPreference) findPreference(keyLogin);
    String loginValue = pref.getString(keyLogin, SettingsManager.Default.proxyLogin);
    login.setText(loginValue);
    login.setSummary(loginValue);
    bindOnPreferenceChangeListener(login);

    String keyPassword = getString(R.string.pref_key_proxy_password);
    EditTextPreference password = (EditTextPreference) findPreference(keyPassword);
    String passwordValue = pref.getString(keyPassword, SettingsManager.Default.proxyPassword);
    password.setText(passwordValue);
    EditText edit = password.getEditText();
    password.setSummary(edit.getTransformationMethod().getTransformation(passwordValue, edit).toString());
    bindOnPreferenceChangeListener(password);
}
 
开发者ID:proninyaroslav,项目名称:libretorrent,代码行数:72,代码来源:ProxySettingsFragment.java


示例8: onPreferenceChange

import com.takisoft.fix.support.v7.preference.EditTextPreference; //导入依赖的package包/类
@Override
public boolean onPreferenceChange(Preference preference, Object newValue)
{
    SettingsManager pref = new SettingsManager(getActivity().getApplicationContext());

    if (preference.getKey().equals(getString(R.string.pref_key_proxy_type))) {
        int type = Integer.parseInt((String) newValue);
        pref.put(preference.getKey(), type);
        String typesName[] = getResources().getStringArray(R.array.pref_proxy_type_entries);
        preference.setSummary(typesName[type]);

        boolean enableAdvancedSettings = type != Integer.parseInt(getString(R.string.pref_proxy_type_none_value));
        enableOrDisablePreferences(enableAdvancedSettings);

    } else if (preference.getKey().equals(getString(R.string.pref_key_proxy_port))) {
        int value = SettingsManager.Default.proxyPort;
        if (!TextUtils.isEmpty((String) newValue))
            value = Integer.parseInt((String) newValue);

        pref.put(preference.getKey(), value);
        preference.setSummary(Integer.toString(value));

    } else if (preference.getKey().equals(getString(R.string.pref_key_proxy_address)) ||
            preference.getKey().equals(getString(R.string.pref_key_proxy_login))) {
        pref.put(preference.getKey(), (String) newValue);
        preference.setSummary((String) newValue);

    } else if (preference.getKey().equals(getString(R.string.pref_key_proxy_password))) {
        pref.put(preference.getKey(), (String) newValue);
        EditText edit = ((EditTextPreference) preference).getEditText();
        String passwordValue = edit.getTransformationMethod().getTransformation((String) newValue, edit).toString();
        preference.setSummary(passwordValue);

    } else if (preference instanceof SwitchPreferenceCompat) {
        pref.put(preference.getKey(), (boolean) newValue);
    }

    if (!proxyChanged) {
        proxyChanged = true;
        pref.put(getString(R.string.pref_key_proxy_changed), true);
    }

    return true;
}
 
开发者ID:proninyaroslav,项目名称:libretorrent,代码行数:45,代码来源:ProxySettingsFragment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Person类代码示例发布时间:2022-05-23
下一篇:
Java DebugProcess类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap