本文整理汇总了Java中com.rey.material.app.DialogFragment类的典型用法代码示例。如果您正苦于以下问题:Java DialogFragment类的具体用法?Java DialogFragment怎么用?Java DialogFragment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DialogFragment类属于com.rey.material.app包,在下文中一共展示了DialogFragment类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onPreferenceTreeClick
import com.rey.material.app.DialogFragment; //导入依赖的package包/类
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, final Preference preference) {
switch (preference.getKey()) {
case "download_path":
Dialog.Builder builder = null;
builder = new SimpleDialog.Builder() {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
PreferenceActivity activity = (PreferenceActivity) getActivity();
activity.checkPermission(PreferenceActivity.OPEN_DIALOG);
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
super.onNegativeActionClicked(fragment);
}
};
((SimpleDialog.Builder) builder).message("在Android4.4及以后的版本中,无法把数据写入外置SD卡,除非你进行了root操作。" +
"不过<SDcard>/Android/data/org.huxizhijian.hhcomicviewer2 这个路径比较特殊,是可以写入的。" +
"但是使用此文件夹卸载了程序之后所有下载文件都会删除。")
.title("注意")
.positiveAction("继续");
DialogFragment fragment = DialogFragment.newInstance(builder);
fragment.show(((PreferenceActivity) getActivity()).getSupportFragmentManager(), null);
return true;
case "allow_media":
CheckBoxPreference checkBoxPreference = (CheckBoxPreference) preference;
SharedPreferencesManager manager = new SharedPreferencesManager(getActivity());
manager.putBoolean("allow_media", checkBoxPreference.isChecked());
PreferenceActivity activity = (PreferenceActivity) getActivity();
activity.checkPermission(PreferenceActivity.MAKE_NO_MEDIA);
return true;
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
开发者ID:huxizhijian,项目名称:HHComicViewer,代码行数:38,代码来源:DownloadSettingFragment.java
示例2: pickDate
import com.rey.material.app.DialogFragment; //导入依赖的package包/类
/**
* 选择日期查看某天的日报
*/
private void pickDate() {
DatePickerDialog.Builder builder = new DatePickerDialog.Builder() {
@Override
public void onDateChanged(int oldDay, int oldMonth, int oldYear, int newDay, int newMonth, int newYear) {
super.onDateChanged(oldDay, oldMonth, oldYear, newDay, newMonth, newYear);
final DatePickerDialog dialog = (DatePickerDialog) getDialog();
if (dialog.getDate() > System.currentTimeMillis()) {
Toast.makeText(getActivity(), "只能查看今天之前的日报", Toast.LENGTH_SHORT).show();
return;
}
final String date = newYear + "年" + newMonth + "月" + newDay + "日";
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
PickerActivity.startBy(getActivity(), date, dialog.getDate());
dialog.dismiss();
}
}, 300);
}
};
DialogFragment dialogFragment = DialogFragment.newInstance(builder);
dialogFragment.show(getActivity().getSupportFragmentManager(), null);
}
开发者ID:zhanjiashu,项目名称:ZhihuDialyM,代码行数:31,代码来源:HomeFragment.java
注:本文中的com.rey.material.app.DialogFragment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论