本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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);
}
}
}
}
示例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);
}
}
}