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


Java DialogPreference类代码示例

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


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

示例1: onBindDialogView

import android.support.v7.preference.DialogPreference; //导入依赖的package包/类
@Override
protected void onBindDialogView(View view) {
	super.onBindDialogView(view);

	mVolumeBar = (SeekBar) view.findViewById(R.id.volume_bar);

	Integer volumeLevel = null;
	DialogPreference preference = getPreference();
	if (preference instanceof VolumePreference) {
		volumeLevel = ((VolumePreference) preference).getVolume();
	}

	if (volumeLevel != null) {
		mVolumeBar.setProgress(volumeLevel);
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:VolumePreferenceFragment.java

示例2: onPreferenceDisplayDialog

import android.support.v7.preference.DialogPreference; //导入依赖的package包/类
@Override
public boolean onPreferenceDisplayDialog(PreferenceFragmentCompat caller, Preference pref) {
    // check if dialog is already showing
    if (getFragmentManager().findFragmentByTag(DIALOG_FRAGMENT_TAG) != null) {
        return true;
    }

    if (pref instanceof DialogPreference) {
        String key = pref.getKey();
        final DialogFragment f;
        if (KEY_RELEASE_NOTE.equals(key)) {
            f = ReleaseNoteDialogFragment.newInstance(key);
        } else if (KEY_LICENSE.equals(key)) {
            f = LicenseDialogFragmentProvider.newFragment(getActivity());
        } else {
            return false;
        }
        f.setTargetFragment(this, 0);
        f.show(getFragmentManager(), DIALOG_FRAGMENT_TAG);
        return true;
    }
    return false;
}
 
开发者ID:ChaosLeong,项目名称:FxcnBeta,代码行数:24,代码来源:PreferencesFragment.java

示例3: onBindDialogView

import android.support.v7.preference.DialogPreference; //导入依赖的package包/类
@Override
protected void onBindDialogView(View view) {
    super.onBindDialogView(view);
    mColorPickerView = (ColorPickerView) view.findViewById(R.id.color_picker_view);
    ColorPanelView preColorPanelView = (ColorPanelView) view.findViewById(R.id.color_panel_old);
    mNewColorPanelView = (ColorPanelView) view.findViewById(R.id.color_panel_new);
    if (null == mColorPickerView || null == preColorPanelView || null == mNewColorPanelView) {
        throw new IllegalStateException("Dialog view must contain a ColorPickerView or ColorPanelView");
    }
    mColorPickerView.setOnColorChangedListener(onColorChangedListener);

    boolean isFontColor = getString(R.string.font_color_key).equals(getArguments().getString(ARG_KEY));
    mColorPickerView.setAlphaSliderVisible(!isFontColor);
    int color = -1;
    DialogPreference preference = getPreference();
    if (preference instanceof ColorPickerPreference) {
        color = ((ColorPickerPreference) preference).getColor();
    }
    if (color == 0) color = getDefaultColor(isFontColor);
    mColorPickerView.setColor(color, true);
    preColorPanelView.setColor(color);
}
 
开发者ID:xiongwei-git,项目名称:OneNote,代码行数:23,代码来源:ColorPickerPreDlgFragCompat.java

示例4: onDialogClosed

import android.support.v7.preference.DialogPreference; //导入依赖的package包/类
@Override
public void onDialogClosed(boolean positiveResult) {
	if (positiveResult) {
		int volumeLevel = mVolumeBar.getProgress();

		DialogPreference preference = getPreference();
		if (preference instanceof VolumePreference) {
			VolumePreference volumePreference = (VolumePreference) preference;
			if (volumePreference.callChangeListener(volumeLevel)) {
				volumePreference.setVolume(volumeLevel);
			}
		}
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:VolumePreferenceFragment.java

示例5: onDialogClosed

import android.support.v7.preference.DialogPreference; //导入依赖的package包/类
@Override
public void onDialogClosed(boolean positiveResult) {
    if (positiveResult) {
        int color = mColorPickerView.getColor();
        DialogPreference preference = getPreference();
        if (preference instanceof ColorPickerPreference) {
            ((ColorPickerPreference) preference).setColor(color);
        }
    }
}
 
开发者ID:xiongwei-git,项目名称:OneNote,代码行数:11,代码来源:ColorPickerPreDlgFragCompat.java


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