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

Java MaterialListPreference类代码示例

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

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



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

示例1: updateSpecialPreferences

import com.afollestad.materialdialogs.prefs.MaterialListPreference; //导入依赖的package包/类
private void updateSpecialPreferences() {
    if (shouldEnableNotificationsAlerts && checkNotificationsPermission(context, false)) {
        ((TwoStatePreference) findPreference("notifications_alerts")).setChecked(true);
    }
    if (((MaterialListPreference) findPreference("stop_delay")).getValue().equals("0"))
        findPreference("stop_delay").setSummary(R.string.settings_stop_delay_desc);
    else
        findPreference("stop_delay").setSummary("%s");
    findPreference("watchface_clock").setSummary(context.getResources().getStringArray(R.array.customize_clock)[prefs.clockStyle]);
    findPreference("watchface_date").setSummary(context.getResources().getStringArray(R.array.customize_date)[prefs.dateStyle]);
    findPreference("greenify_enabled").setSummary(isPackageInstalled("com.oasisfeng.greenify") ? context.getString(R.string.settings_greenify_integration_desc) : context.getString(R.string.settings_greenify_integration_desc_not_found));
    if (!isPackageInstalled("com.oasisfeng.greenify")) {
        ((SwitchPreference) findPreference("greenify_enabled")).setChecked(false);
    }
}
 
开发者ID:rosenpin,项目名称:AlwaysOnDisplayAmoled,代码行数:16,代码来源:SettingsFragment.java


示例2: onCreate

import com.afollestad.materialdialogs.prefs.MaterialListPreference; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);
    context = getActivity().getApplicationContext();
    mAdminName = new ComponentName(context, DAReceiver.class);
    prefs = new Prefs(context);
    prefs.apply();
    findPreference("enabled").setOnPreferenceChangeListener(this);
    findPreference("persistent_notification").setOnPreferenceChangeListener(this);
    findPreference("raise_to_wake").setOnPreferenceChangeListener(this);
    findPreference("greenify_enabled").setOnPreferenceChangeListener(this);
    findPreference("proximity_to_lock").setOnPreferenceChangeListener(this);
    findPreference("startafterlock").setOnPreferenceChangeListener(this);
    findPreference("notifications_alerts").setOnPreferenceChangeListener(this);
    findPreference("doze_mode").setOnPreferenceChangeListener(this);
    findPreference("google_now_shortcut").setOnPreferenceChangeListener(this);
    findPreference("camera_shortcut").setOnPreferenceChangeListener(this);
    findPreference("stop_delay").setOnPreferenceChangeListener(this);
    findPreference("battery_saver").setOnPreferenceChangeListener(this);
    findPreference("watchface_clock").setOnPreferenceClickListener(this);
    findPreference("watchface_date").setOnPreferenceClickListener(this);
    findPreference("textcolor").setOnPreferenceClickListener(this);
    findPreference("uninstall").setOnPreferenceClickListener(this);
    findPreference("font").setOnPreferenceClickListener(this);
    ((SeekBarPreference) findPreference("font_size")).setMin(20);
    PreferenceManager.getDefaultSharedPreferences(context).registerOnSharedPreferenceChangeListener(this);
    String[] gesturePreferencesList = {DOUBLE_TAP, SWIPE_UP, SWIPE_DOWN, VOLUME_KEYS, BACK_BUTTON};
    for (String preference : gesturePreferencesList) {
        findPreference(preference).setOnPreferenceChangeListener((preference1, o) -> {
            switch (Integer.parseInt((String) o)) {
                case DISABLED:
                    return true;
                case ACTION_UNLOCK:
                    return true;
                case ACTION_SPEAK:
                    if (isSupporter()) {
                        if (!isPackageInstalled("com.google.android.tts"))
                            Utils.openURL(getActivity(), "https://play.google.com/store/apps/details?id=com.google.android.tts");
                        return true;
                    } else {
                        DonateActivity.quicklyPromptToSupport(getActivity(), rootView);
                        return false;
                    }
                case ACTION_FLASHLIGHT:
                    if (isSupporter()) {
                        if (ActivityCompat.checkSelfPermission(context, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
                            ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.CAMERA}, CAMERA_PERMISSION_REQUEST_CODE);
                            return false;
                        }
                        return true;
                    } else {
                        DonateActivity.quicklyPromptToSupport(getActivity(), rootView);
                        return false;
                    }
            }
            return true;
        });
    }
    checkNotificationsPermission(context, false);
    starterService = new Intent(getActivity().getApplicationContext(), StarterService.class);
    Utils.logDebug(String.valueOf(((MaterialListPreference) findPreference("rules")).getValue()), " Selected");
}
 
开发者ID:rosenpin,项目名称:AlwaysOnDisplayAmoled,代码行数:64,代码来源:SettingsFragment.java


示例3: onCreate

import com.afollestad.materialdialogs.prefs.MaterialListPreference; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstance) {
	super.onCreate(savedInstance);
	addPreferencesFromResource(R.xml.pref_main);

	mSets = Settings.getInstance(getActivity().getApplicationContext());

	getActivity().setTitle(R.string.title_settings);

	pref_version = findPreference("application_version");
	pref_weibo = findPreference("sina_weibo");
	pref_os_license = findPreference("open_source_license");
	pref_api_provider = findPreference("api_provider");
	pref_github = findPreference("github_repo");
	pref_token_choose = (MaterialListPreference) findPreference("api_token_choose");
	pref_token_custom = findPreference("api_token_custom");
	pref_swipe_back = (SwitchPreference) findPreference("swipe_back");
	pref_notification_interval = (MaterialListPreference) findPreference("notification_interval");
	pref_do_not_disturb = (SwitchPreference) findPreference("do_not_disturb");
	pref_disable_animation = (SwitchPreference) findPreference("disable_animation");
	pref_navigation_tint = (SwitchPreference) findPreference("navigation_tint");

	String version = "Unknown";
	try {
		version = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName;
		version += " (" + getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionCode + ")";
	} catch (Exception e) {
		// Keep the default value
	}
	pref_version.setSummary(version);
	pref_swipe_back.setChecked(mSets.getBoolean(Settings.KEY_SWIPE_BACK, true));
	pref_token_custom.setDefaultValue(mSets.getInt(Settings.KEY_TOKEN_CHOOSE, 0));
	pref_token_custom.setEnabled(mSets.getInt(Settings.KEY_TOKEN_CHOOSE, 0) == 2);
	pref_do_not_disturb.setChecked(mSets.getBoolean(Settings.KEY_NOTIFICATION_DO_NOT_DISTURB, true));
	pref_disable_animation.setChecked(mSets.getBoolean(Settings.KEY_DISABLE_ANIMATION, false));
	if (Build.VERSION.SDK_INT < 21) {
		pref_navigation_tint.setEnabled(false);
		pref_navigation_tint.setChecked(false);
	} else {
		pref_navigation_tint.setChecked(mSets.getBoolean(Settings.KEY_NAVIGATION_TINT, true));
	}

	String[] values = getResources().getStringArray(R.array.item_token_list_values);
	int index, target = mSets.getInt(Settings.KEY_TOKEN_CHOOSE, 0);
	for (index = 0; index < values.length; index++) {
		if (values[index].equals(String.valueOf(target))) break;
	}
	pref_token_choose.setSummary(
			getResources().getStringArray(R.array.item_token_list)
			[index]
	);
	String[] values1 = getResources().getStringArray(R.array.notification_interval_item);
	int index1, target1 = mSets.getInt(Settings.KEY_NOTIFICATION_INTERVAL, 0);
	for (index1 = 0; index1 < values.length; index1++) {
		if (values1[index1].equals(String.valueOf(target1))) break;
	}
	pref_notification_interval.setSummary(
			getResources().getStringArray(R.array.notification_interval)
					[index1]
	);

	pref_weibo.setOnPreferenceClickListener(this);
	pref_os_license.setOnPreferenceClickListener(this);
	pref_api_provider.setOnPreferenceClickListener(this);
	pref_github.setOnPreferenceClickListener(this);
	pref_token_custom.setOnPreferenceClickListener(this);
	pref_token_choose.setOnPreferenceChangeListener(this);
	pref_swipe_back.setOnPreferenceChangeListener(this);
	pref_notification_interval.setOnPreferenceChangeListener(this);
	pref_do_not_disturb.setOnPreferenceChangeListener(this);
	pref_disable_animation.setOnPreferenceChangeListener(this);
	pref_navigation_tint.setOnPreferenceChangeListener(this);
}
 
开发者ID:fython,项目名称:ExpressHelper,代码行数:74,代码来源:SettingsMain.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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