Java 类android.support.v7.app.AppCompatDialog 实例源码
项目:GitHub
文件:DialogUIUtils.java
/**
* 关闭弹出框
*/
public static void dismiss(DialogInterface... dialogs) {
if (dialogs != null && dialogs.length > 0) {
for (DialogInterface dialog : dialogs) {
if (dialog instanceof Dialog) {
Dialog dialog1 = (Dialog) dialog;
if (dialog1.isShowing()) {
dialog1.dismiss();
}
} else if (dialog instanceof AppCompatDialog) {
AppCompatDialog dialog2 = (AppCompatDialog) dialog;
if (dialog2.isShowing()) {
dialog2.dismiss();
}
}
}
}
}
项目:KUtils
文件:DialogUIUtils.java
/**
* 关闭弹出框
*/
public static void dismiss(DialogInterface... dialogs) {
if (dialogs != null && dialogs.length > 0) {
for (DialogInterface dialog : dialogs) {
if (dialog instanceof Dialog) {
Dialog dialog1 = (Dialog) dialog;
if (dialog1.isShowing()) {
dialog1.dismiss();
}
} else if (dialog instanceof AppCompatDialog) {
AppCompatDialog dialog2 = (AppCompatDialog) dialog;
if (dialog2.isShowing()) {
dialog2.dismiss();
}
}
}
}
}
项目:FastEc
文件:LatteLoader.java
public static void showLoading(Context context, String type) {
final AppCompatDialog dialog = new AppCompatDialog(context, R.style.dialog);
final AVLoadingIndicatorView avLoadingIndicatorView = LoaderCreator.create(context, type);
dialog.setContentView(avLoadingIndicatorView);
int deviceWidth = DimenUtil.getScreenWidth();
int deviceHeight = DimenUtil.getScreenHeight();
final Window dialogWindow = dialog.getWindow();
if (dialog != null) {
final WindowManager.LayoutParams lp = dialogWindow.getAttributes();
lp.width = deviceWidth / LOADER_SIZE_SCALE;
lp.height = deviceHeight / LOADER_SIZE_SCALE;
lp.height = lp.height + deviceHeight / LOADER_OFFSET_SCALE;
lp.gravity = Gravity.CENTER;
}
LOADERS.add(dialog);
dialog.show();
}
项目:dynamic-dialogs
文件:DynamicAlertController.java
public DynamicAlertController(Context context, AppCompatDialog di, Window window) {
mContext = context;
mDialog = di;
mWindow = window;
mHandler = new DynamicAlertController.ButtonHandler(di);
final TypedArray a = context.obtainStyledAttributes(null, android.support.v7.appcompat.R.styleable.AlertDialog,
android.support.v7.appcompat.R.attr.alertDialogStyle, 0);
mAlertDialogLayout = a.getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_android_layout, 0);
mButtonPanelSideLayout = a.getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_buttonPanelSideLayout, 0);
mListLayout = a.getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_listLayout, 0);
mMultiChoiceItemLayout = a.getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_multiChoiceItemLayout, 0);
mSingleChoiceItemLayout = a
.getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_singleChoiceItemLayout, 0);
mListItemLayout = a.getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_listItemLayout, 0);
mShowTitle = a.getBoolean(android.support.v7.appcompat.R.styleable.AlertDialog_showTitle, true);
a.recycle();
/* We use a custom title so never request a window title */
di.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
}
项目:KUtils-master
文件:DialogUIUtils.java
/**
* 关闭弹出框
*/
public static void dismiss(DialogInterface... dialogs) {
if (dialogs != null && dialogs.length > 0) {
for (DialogInterface dialog : dialogs) {
if (dialog instanceof Dialog) {
Dialog dialog1 = (Dialog) dialog;
if (dialog1.isShowing()) {
dialog1.dismiss();
}
} else if (dialog instanceof AppCompatDialog) {
AppCompatDialog dialog2 = (AppCompatDialog) dialog;
if (dialog2.isShowing()) {
dialog2.dismiss();
}
}
}
}
}
项目:wzyx-android-user
文件:WzyxLoader.java
private static void showLoading(Context context, String type) {
final AppCompatDialog dialog = new AppCompatDialog(context, R.style.dialog);
final AVLoadingIndicatorView avLoadingIndicatorView = LoaderCreator.create(type, context);
dialog.setContentView(avLoadingIndicatorView);
int deviceWidth = DimenUtil.getScreenWidth();
int deviceHeight = DimenUtil.getScreenHeight();
final Window dialogWindow = dialog.getWindow();
if (dialogWindow != null) {
final WindowManager.LayoutParams lp = dialogWindow.getAttributes();
lp.width = deviceWidth / LOADER_SIZE_SCALE;
lp.height = deviceHeight / LOADER_SIZE_SCALE;
lp.height = lp.height + deviceHeight / LOADER_OFFSET_SCALE;
lp.gravity = Gravity.CENTER;
}
LOADERS.add(dialog);
dialog.show();
}
项目:Puff-Android
文件:ResUtil.java
public AppCompatDialog showProgressbar(Activity activity, long timeout, boolean cancelable) {
final AppCompatDialog dialog = new AppCompatDialog(activity);
dialog.setContentView(R.layout.dialog_progress);
dialog.setCancelable(cancelable);
dialog.setTitle("Progressing...");
ProgressBar progressBar = (ProgressBar) dialog.findViewById(R.id.progress);
if (timeout > 0) {
Handler handler = new Handler(activity.getMainLooper());
handler.postDelayed(new Runnable() {
@Override
public void run() {
dialog.cancel();
dialog.dismiss();
}
}, timeout);
dialog.show();
} else {
dialog.show();
}
return dialog;
}
项目:Snapmatic-Life
文件:ProHelper.java
private static AppCompatDialog setupDialog(final Activity activity, String message, final Runnable upgradeCallback)
{
String title = activity.getString(R.string.pro_proFeatureDialog_title);
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setIcon(R.drawable.ic_launcher);
builder.setTitle(title);
builder.setMessage(message);
builder.setPositiveButton(R.string.pro_proFeatureDialog_okBtn, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which)
{
upgradeCallback.run();
}
});
builder.setNegativeButton(R.string.pro_proFeatureDialog_cancelBtn,null);
return (AppCompatDialog) builder.create();
}
项目:networkScanner
文件:Scan.java
private void rescan(){
ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (mWifi.isConnected() && mWifi.isAvailable()){
AppCompatDialog dialog = new AppCompatDialog(this);
dialog.setTitle(R.string.scanning);
dialog.setCancelable(false);
dialog.show();
AsyncScan scan = new AsyncScan(dialog, getString(R.string.scanning_your_network));
scan.execute(adapter);
}else {
Toast.makeText(this, getString(R.string.not_connected_error), Toast.LENGTH_LONG).show();
}
}
项目:COCOFramework
文件:CocoQuery.java
private AppCompatDialog create(String mLicensesText, CharSequence str) {
//Get resources
final WebView webView = new WebView(getContext());
webView.loadDataWithBaseURL(null, mLicensesText, "text/html", "utf-8", null);
final AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
.setView(webView).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
if (str != null)
builder.setTitle(str);
return builder.create();
}
项目:FastEc
文件:LatteLoader.java
public static void stopLoading() {
for (AppCompatDialog dialog :
LOADERS) {
if (dialog != null) {
if (dialog.isShowing()) {
dialog.cancel();
}
}
}
}
项目:TreebolicLib
文件:Tip.java
@NonNull
@Override
public AppCompatDialog onCreateDialog(final Bundle savedInstanceState)
{
// use the Builder class for convenient dialog construction
final Activity activity = getActivity();
assert activity != null;
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
// get the layout inflater
final LayoutInflater inflater = activity.getLayoutInflater();
// inflate layout for the dialog
final FrameLayout frameLayout = activity.findViewById(android.R.id.custom);
final View view = inflater.inflate(R.layout.tip_layout, frameLayout, false);
// data
final WebView webView = view.findViewById(R.id.text);
webView.loadData(this.text, "text/html; charset=UTF-8", "utf-8");
// set the layout for the dialog
builder.setView(view) //
// .setMessage(R.string.treebolic) //
// .setNegativeButton(R.string.action_dismiss, new DialogInterface.OnClickListener()
// {
// @Override
// public void onClick(DialogInterface dialog, int id)
// {
// // user cancelled the dialog
// }
// })
;
// create the dialog and return it
final AppCompatDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(true);
return dialog;
}
项目:wzyx-android-user
文件:WzyxLoader.java
public static void stopLoading() {
for (AppCompatDialog dialog : LOADERS) {
if (dialog != null) {
if (dialog.isShowing()) {
dialog.cancel();
}
}
}
}
项目:Dromi
文件:MainActivity.java
/**
* Show a custom action menu
*
* @param view menu called from this view
*/
public void showPopupMenu(View view) {
final Context context = this;
PopupMenu popup = new PopupMenu(this, view);
popup.inflate(R.menu.menu_main);
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_save:
saveImageToExternalStorage();
return true;
case R.id.action_share:
shareDrawing();
return true;
case R.id.action_about:
final AppCompatDialog dialog = new AppCompatDialog(context);
dialog.setContentView(R.layout.dialog_about);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.show();
return true;
default: // User's action was not recognized
return false;
}
}
});
popup.show();
}
项目:DialogUtils
文件:MainActivity.java
private void showDialog() {
// AlertDialog dialog = new AlertDialog(this);
AppCompatDialog dialog = new AppCompatDialog(this);
dialog.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);//key code to remove title
Window window = dialog.getWindow();
window.setGravity(Gravity.BOTTOM);
window.setWindowAnimations(R.style.mystyle);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));//round corner
// window.setBackgroundDrawableResource(R.drawable.bg_ios_roundcorner);
// window.requestFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_ios_alert_bottom);
// AlertDialog.Builder builder = new AlertDialog.Builder(this);
// 可以在此设置显示动画
WindowManager.LayoutParams wl = window.getAttributes();
/* wl.x = 0;
wl.y = getWindowManager().getDefaultDisplay().getHeight();*/
// 以下这两句是为了保证按钮可以水平满屏
int width = getWindowManager().getDefaultDisplay().getWidth();
// wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
wl.width = (int) (width * 0.85); // todo keycode gap
wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;
//wl.horizontalMargin= 0.2f;
// 设置显示位置
// wl.gravity = Gravity.CENTER_HORIZONTAL;
dialog.onWindowAttributesChanged(wl);
dialog.show();
}
项目:stately
文件:ProgressDialog.java
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AppCompatDialog dialog = new AppCompatDialog(getActivity(), RaraHelper.getThemeMaterialDialog(getContext()));
dialog.setCanceledOnTouchOutside(false);
dialog.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
return dialog;
}
项目:ExhibitionCenter
文件:QRCodeDialogFragment.java
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AppCompatDialog dialog = new AppCompatDialog(attachActivity);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
root = View.inflate(attachActivity, R.layout.dialog_discover_qrcode, null);
dialog.setContentView(root);
initViewAndData();
return dialog;
}
项目:Snapmatic-Life
文件:ProHelper.java
public static void showProMessage(Activity ctx, int msgResId, Runnable upgradeCallback)
{
String msg = ctx.getResources().getString(msgResId);
AppCompatDialog dialog = setupDialog(ctx, msg, upgradeCallback);
dialog.show();
}
项目:OpeningHoursFragment
文件:TestFragment.java
@NonNull
@SuppressLint("InflateParams")
@Override
public AppCompatDialog onCreateDialog(Bundle savedInstanceState)
{
Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("test fragment mode");
oh = getArguments().getString(KEY_OH);
builder.setPositiveButton(android.R.string.ok, null);
return builder.create();
}
项目:SwipeAwayDialog
文件:ExampleDialogFragment.java
@Override
public @NonNull Dialog create(Context context, ExampleDialogFragment fragment) {
String[] urls = context.getResources().getStringArray(R.array.octocat_urls);
AppCompatDialog dialog = new AppCompatDialog(context);
dialog.setContentView(R.layout.dialog_custom);
Glide.with(fragment)
.load(urls[sRandom.nextInt(urls.length)])
.into((ImageView) dialog.findViewById(R.id.customdialog_image));
return dialog;
}
项目:SystemAppMover
文件:MoverActivity.java
/**
* Shows the initial warning dialog
*/
void showWarningDialog() {
final AppCompatDialog d = new AppCompatDialog(this);
d.setTitle("Warning");
d.setCancelable(false);
d.setContentView(R.layout.warningdialog);
final CheckBox c = (CheckBox) d.findViewById(R.id.c);
final Button b = (Button) d.findViewById(R.id.b);
c.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
b.setText(checked ? android.R.string.ok : android.R.string.cancel);
}
});
b.setText(android.R.string.cancel);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (c.isChecked()) {
getSharedPreferences("settings", MODE_PRIVATE).edit()
.putBoolean("warningRead", true).commit();
d.dismiss();
} else {
d.dismiss();
finish();
}
}
});
d.show();
}
项目:SawimNE
文件:ChatsDialogFragment.java
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Context context = getActivity();
View dialogView = LayoutInflater.from(context).inflate(R.layout.chats_dialog, null);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
dialogBuilder.setView(dialogView);
MyListView lv = (MyListView) dialogView.findViewById(R.id.listView);
chatsSpinnerAdapter = new RosterAdapter();
chatsSpinnerAdapter.setType(RosterHelper.ACTIVE_CONTACTS);
lv.setAdapter(chatsSpinnerAdapter);
//lv.setFastScrollEnabled(true);
lv.setOnItemClickListener(new MyListView.OnItemClickListener() {
@Override
public void onItemClick(View childView, int position) {
TreeNode treeNode = chatsSpinnerAdapter.getItem(position);
if (treeNode.getType() == TreeNode.CONTACT) {
if (forceGoToChatListener != null) {
forceGoToChatListener.onForceGoToChat(ChatHistory.instance.getChat((Contact) treeNode));
}
dismiss();
}
}
});
chatsSpinnerAdapter.refreshList();
AppCompatDialog dialog = dialogBuilder.create();
dialog.setCanceledOnTouchOutside(true);
return dialog;
}
项目:GitHub
文件:StatisticsDialog.java
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) {
AppCompatDialog dialog = new AppCompatDialog(getActivity(), getTheme());
dialog.setTitle(R.string.menu_statistics);
return dialog;
}
项目:GitHub
文件:StatisticsDialog.java
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) {
AppCompatDialog dialog = new AppCompatDialog(getActivity(), getTheme());
dialog.setTitle(R.string.menu_statistics);
return dialog;
}
项目:mobile-store
文件:AppCompatListPreference.java
@Override
public AppCompatDialog getDialog() {
return appCompatDialog;
}
项目:CanDialog
文件:CanBaseDialog.java
public AppCompatDialog getCompatDialog() {
return compatDialog;
}
项目:DialogUtils
文件:StytledDialog.java
public static void dismiss(AppCompatDialog dialog){
if (dialog != null && dialog.isShowing()){
dialog.dismiss();
}
}
项目:Puff-Android
文件:ResUtil.java
public AppCompatDialog showProgressbar(Activity activity, long timeout) {
return showProgressbar(activity, timeout, true);
}
项目:Puff-Android
文件:ResUtil.java
public AppCompatDialog showProgressbar(Activity activity) {
return showProgressbar(activity, 0, false);
}
项目:vlc_android_win
文件:SavePlaylistDialog.java
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AppCompatDialog(getActivity(), getTheme());
}
项目:mosby
文件:StatisticsDialog.java
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) {
AppCompatDialog dialog = new AppCompatDialog(getActivity(), getTheme());
dialog.setTitle(R.string.menu_statistics);
return dialog;
}
项目:Snapmatic-Life
文件:ProHelper.java
public static AppCompatDialog getProFeatureMsgDialog(Activity ctx, int msgResId, Runnable upgradeCallback )
{
String msg = ctx.getResources().getString(msgResId);
return setupDialog(ctx, msg, upgradeCallback);
}
项目:Snapmatic-Life
文件:MsgDialog.java
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
final Context ctx = getActivity();
AlertDialog.Builder builder = new AlertDialog.Builder(ctx)
.setTitle(mTitle)
.setMessage(mMessage)
.setNegativeButton(android.R.string.ok,null);
AppCompatDialog dialog = (AppCompatDialog) builder.create();
return dialog;
}
项目:VCL-Android
文件:SavePlaylistDialog.java
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AppCompatDialog(getActivity(), getTheme());
}
项目:ocara
文件:OcaraListPreference.java
@Override
public AppCompatDialog getDialog() {
return mDialog;
}
项目:vlc-android
文件:SavePlaylistDialog.java
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AppCompatDialog(getActivity(), getTheme());
}
项目:android-support-learn
文件:DialogUsage.java
private void showSimpleDialog() {
Dialog dialog = new AppCompatDialog(this);
dialog.setTitle(R.string.dialog_title);
dialog.setContentView(R.layout.dialog_content);
dialog.show();
}
项目:android-support-learn
文件:DialogUsage.java
private void showButtonBarDialog() {
Dialog dialog = new AppCompatDialog(this);
dialog.setTitle(R.string.dialog_title);
dialog.setContentView(R.layout.dialog_content_buttons);
dialog.show();
}
项目:OpeningHoursFragment
文件:RangePicker.java
@NonNull
@SuppressLint("InflateParams")
@Override
public AppCompatDialog onCreateDialog(Bundle savedInstanceState) {
int title = getArguments().getInt(TITLE);
final int min = getArguments().getInt(MIN);
final int max = getArguments().getInt(MAX);
int startCurrent = getArguments().getInt(START_CURRENT);
int endCurrent = getArguments().getInt(END_CURRENT);
final SetRangeListener listener = (SetRangeListener) getParentFragment();
// Preferences prefs= new Preferences(getActivity());
Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(title);
final LayoutInflater inflater = getActivity().getLayoutInflater(); // ThemeUtils.getLayoutInflater(getActivity());
// DoNothingListener doNothingListener = new DoNothingListener();
View layout = inflater.inflate(R.layout.rangepicker, null);
builder.setView(layout);
String[] startValues = new String[max - min + 1];
for (int i = min; i <= max; i++) {
startValues[i - min] = Integer.toString(i);
}
final NumberPickerView npvStart = (NumberPickerView) layout.findViewById(R.id.start);
npvStart.setDisplayedValues(startValues);
npvStart.setMinValue(min);
npvStart.setMaxValue(max);
npvStart.setValue(startCurrent);
String[] endValues = new String[max - min + 2];
endValues[0] = "-";
for (int i = min; i <= max; i++) {
endValues[i - min + 1] = Integer.toString(i);
}
final NumberPickerView npvEnd = (NumberPickerView) layout.findViewById(R.id.end);
npvEnd.setDisplayedValues(endValues);
npvEnd.setMinValue(min - 1);
npvEnd.setMaxValue(max);
if (endCurrent == NOTHING_SELECTED) {
endCurrent = min - 1;
}
npvEnd.setValue(endCurrent);
builder.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
int endValue = npvEnd.getValue();
if (endValue == min - 1) {
endValue = NOTHING_SELECTED;
}
listener.setRange(npvStart.getValue(), endValue);
}
});
builder.setNeutralButton(android.R.string.cancel, null);
return builder.create();
}
项目:OpeningHoursFragment
文件:TimeRangePicker.java
@NonNull
@SuppressLint("InflateParams")
@Override
public AppCompatDialog onCreateDialog(Bundle savedInstanceState) {
int title = getArguments().getInt(TITLE);
int startHour = getArguments().getInt(START_HOUR);
int startMinute = getArguments().getInt(START_MINUTE);
int endHour = getArguments().getInt(END_HOUR);
int endMinute = getArguments().getInt(END_MINUTE);
boolean startOnly = getArguments().getBoolean(START_ONLY);
final SetTimeRangeListener listener = (SetTimeRangeListener) getParentFragment();
// Preferences prefs= new Preferences(getActivity());
Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(title);
final LayoutInflater inflater = getActivity().getLayoutInflater(); // ThemeUtils.getLayoutInflater(getActivity());
// DoNothingListener doNothingListener = new DoNothingListener();
View layout = inflater.inflate(R.layout.timerangepicker, null);
builder.setView(layout);
String[] hourValues = new String[48];
for (int i = 0; i < 48; i++) {
hourValues[i] = String.format("%02d", i);
}
final NumberPickerView npvStartHour = (NumberPickerView) layout.findViewById(R.id.startHour);
npvStartHour.setDisplayedValues(hourValues);
npvStartHour.setMinValue(0);
npvStartHour.setMaxValue(23);
npvStartHour.setValue(startHour);
String[] minValues = new String[60];
for (int i = 0; i < 60; i++) {
minValues[i] = String.format("%02d", i);
}
final NumberPickerView npvStartMinute = (NumberPickerView) layout.findViewById(R.id.startMinute);
npvStartMinute.setDisplayedValues(minValues);
npvStartMinute.setMinValue(0);
npvStartMinute.setMaxValue(59);
npvStartMinute.setValue(startMinute);
final NumberPickerView npvEndHour = (NumberPickerView) layout.findViewById(R.id.endHour);
final NumberPickerView npvEndMinute = (NumberPickerView) layout.findViewById(R.id.endMinute);
if (startOnly) {
npvEndHour.setVisibility(View.GONE);
npvEndMinute.setVisibility(View.GONE);
} else {
npvEndHour.setVisibility(View.VISIBLE);
npvEndMinute.setVisibility(View.VISIBLE);
npvEndHour.setDisplayedValues(hourValues);
npvEndHour.setMinValue(0);
npvEndHour.setMaxValue(47);
npvEndHour.setValue(endHour);
npvEndMinute.setDisplayedValues(minValues);
npvEndMinute.setMinValue(0);
npvEndMinute.setMaxValue(59);
npvEndMinute.setValue(endMinute);
}
builder.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
int startHourValue = npvStartHour.getValue();
int startMinuteValue = npvStartMinute.getValue();
int endHourValue = npvEndHour.getValue();
int endMinuteValue = npvEndMinute.getValue();
listener.setTimeRange(startHourValue, startMinuteValue, endHourValue, endMinuteValue);
}
});
builder.setNeutralButton(android.R.string.cancel, null);
return builder.create();
}