android.app.Dialog Java Examples

The following examples show how to use android.app.Dialog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DialogCreator.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Dialog createDelConversationDialog(Context context,
                                                 View.OnClickListener listener, boolean isTop) {
    Dialog dialog = new Dialog(context, IdHelper.getStyle(context, "jmui_default_dialog_style"));
    View v = LayoutInflater.from(context).inflate(
            IdHelper.getLayout(context, "jmui_dialog_delete_conv"), null);
    dialog.setContentView(v);
    final LinearLayout deleteLl = (LinearLayout) v.findViewById(IdHelper
            .getViewID(context, "jmui_delete_conv_ll"));
    final LinearLayout top = (LinearLayout) v.findViewById(IdHelper
            .getViewID(context, "jmui_top_conv_ll"));
    TextView tv_top = (TextView) v.findViewById(IdHelper.getViewID(context, "tv_conv_top"));
    if (isTop) {
        tv_top.setText("会话置顶");
    } else {
        tv_top.setText("取消置顶");
    }

    deleteLl.setOnClickListener(listener);
    top.setOnClickListener(listener);
    dialog.setCancelable(true);
    dialog.setCanceledOnTouchOutside(true);
    return dialog;
}
 
Example #2
Source File: BrowserActivity.java    From EFRConnect-android with Apache License 2.0 6 votes vote down vote up
private void initLicenseDialog() {
    dialogLicense = new Dialog(this);
    dialogLicense.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialogLicense.setContentView(R.layout.dialog_about_silicon_labs_blue_gecko);
    WebView view = dialogLicense.findViewById(R.id.menu_item_license);
    Button closeButton = dialogLicense.findViewById(R.id.close_about_btn);

    closeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialogLicense.dismiss();
        }
    });

    view.loadUrl(ABOUT_DIALOG_HTML_ASSET_FILE_PATH);
}
 
Example #3
Source File: ControlledAppDialogFragment.java    From PodEmu with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
    //PackageManager pm = super.getPackageManager();
    Vector<String> appNames = new Vector<String>();
    for (ApplicationInfo appInfo : applicationInfos)
    {
        appNames.add(new String(appInfo.name));
    }

    // converting Vector appNames to String[] appNamesStr
    String [] appNamesStr=appNames.toArray(new String[appNames.size()]);

    // Use the Builder class for convenient dialog construction
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.dialog_select_controlled_app)
            .setItems(appNamesStr, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    // The 'which' argument contains the index position
                    // of the selected item
                    mListener.onCtrlAppSelected(dialog, which);
                }
            });
    // Create the AlertDialog object and return it
    return builder.create();
}
 
Example #4
Source File: WifiAlertFragment.java    From Helepolis with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
	return new AlertDialog.Builder(getActivity())
			// Set Dialog Icon
			.setIcon(R.drawable.compatibility)
					// Set Dialog Title
			.setTitle("Wifi problem")
					// Set Dialog Message
			.setMessage("Active wifi connection not detected.")

					// Positive button
			.setPositiveButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					// Do something else
				}
			}).create();

			/*		// Negative Button
			.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog,	int which) {
					// Do something else
				}
			}).create();*/
}
 
Example #5
Source File: PrivacySettingsFragment.java    From Xndroid with GNU General Public License v3.0 6 votes vote down vote up
private void clearHistoryDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
    builder.setTitle(getResources().getString(R.string.title_clear_history));
    Dialog dialog = builder.setMessage(getResources().getString(R.string.dialog_history))
        .setPositiveButton(getResources().getString(R.string.action_yes),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface arg0, int arg1) {
                    clearHistory()
                        .subscribeOn(Schedulers.io())
                        .observeOn(Schedulers.main())
                        .subscribe(new CompletableOnSubscribe() {
                            @Override
                            public void onComplete() {
                                Utils.showSnackbar(getActivity(), R.string.message_clear_history);
                            }
                        });
                }
            })
        .setNegativeButton(getResources().getString(R.string.action_no), null).show();
    BrowserDialog.setDialogSize(mActivity, dialog);
}
 
Example #6
Source File: FragmentAmountEdit.java    From fingen with Apache License 2.0 6 votes vote down vote up
@Override
public void onStart() {
    super.onStart();
    mAmountEditor.requestFocus();
    AlertDialog d = (AlertDialog) getDialog();
    if (d != null) {
        Button positiveButton = d.getButton(Dialog.BUTTON_POSITIVE);
        positiveButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mAmountEditor.getCabbage().getID() < 0) {
                    //show error
                    mAmountEditor.showCabbageError();
                } else {
                    mOnComplete.onComplete(mAmountEditor.getAmount().multiply(new BigDecimal((mAmountEditor.getType() > 0) ? 1 : -1)), mAmountEditor.getCabbage());
                    dismiss();
                }
            }
        });
    }
}
 
Example #7
Source File: LocationInfo.java    From Androzic with GNU General Public License v3.0 6 votes vote down vote up
@SuppressLint("InflateParams")
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
	AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
	builder.setTitle(getString(R.string.information_name));
	View view = getActivity().getLayoutInflater().inflate(R.layout.dlg_location_info, null);
	builder.setView(view);
	builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
		public void onClick(DialogInterface dialog, int whichButton)
		{
			LocationInfo.this.dismiss();
		}
	});
	updateLocationInfo(view);
	return builder.create();
}
 
Example #8
Source File: OcrCaptureActivity.java    From android-vision with Apache License 2.0 6 votes vote down vote up
/**
 * Starts or restarts the camera source, if it exists.  If the camera source doesn't exist yet
 * (e.g., because onResume was called before the camera source was created), this will be called
 * again when the camera source is created.
 */
private void startCameraSource() throws SecurityException {
    // check that the device has play services available.
    int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
            getApplicationContext());
    if (code != ConnectionResult.SUCCESS) {
        Dialog dlg =
                GoogleApiAvailability.getInstance().getErrorDialog(this, code, RC_HANDLE_GMS);
        dlg.show();
    }

    if (cameraSource != null) {
        try {
            preview.start(cameraSource, graphicOverlay);
        } catch (IOException e) {
            Log.e(TAG, "Unable to start camera source.", e);
            cameraSource.release();
            cameraSource = null;
        }
    }
}
 
Example #9
Source File: SupportActivityTest.java    From SimpleAlertDialog-for-Android with Apache License 2.0 6 votes vote down vote up
public void testButtons() throws Throwable {
    runTestOnUiThread(new Runnable() {
        @Override
        public void run() {
            activity.findViewById(R.id.btn_buttons).performClick();
            activity.getSupportFragmentManager().executePendingTransactions();
        }
    });
    getInstrumentation().waitForIdleSync();
    Fragment f = getActivity().getSupportFragmentManager().findFragmentByTag("dialog");
    assertNotNull(f);
    Dialog d = ((SimpleAlertDialogSupportFragment) f).getDialog();
    assertNotNull(d);
    View positive = d.findViewById(R.id.button_positive);
    assertNotNull(positive);
    final View negative = d.findViewById(R.id.button_negative);
    assertNotNull(negative);
    runTestOnUiThread(new Runnable() {
        @Override
        public void run() {
            negative.performClick();
        }
    });
    getInstrumentation().waitForIdleSync();
}
 
Example #10
Source File: HelpDialog.java    From Focus with GNU General Public License v3.0 6 votes vote down vote up
@SuppressLint("InflateParams")
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final View customView;
        try {
            customView = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_help_view, null);
        } catch (InflateException e) {
            throw new IllegalStateException("This device does not support Web Views.");
        }
        MaterialDialog dialog =
                new MaterialDialog.Builder(getActivity())
                        .theme(getArguments().getBoolean("dark_theme") ? Theme.DARK : Theme.LIGHT)
                        .title("帮助信息")
                        .customView(customView, false)
                        .positiveText(android.R.string.ok)
                        .build();

        final WebView webView = customView.findViewById(R.id.webview);
//        webView.loadData(this.content, "text/html", "UTF-8");
        WebViewUtil.LoadHtmlIntoWebView(webView,this.content,getActivity(),"");
        return dialog;
    }
 
Example #11
Source File: DlgChangeLatency.java    From drmips with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
	super.onCreateDialog(savedInstanceState);

	Bundle args = getArguments();
	DrMIPSActivity activity = (DrMIPSActivity)getActivity();
	Component component = activity.getCPU().getComponent(args.getString("id", ""));
	txtLatency = new EditText(getActivity());
	txtLatency.setHint(R.string.latency);
	txtLatency.setInputType(InputType.TYPE_CLASS_NUMBER);
	if(savedInstanceState != null && savedInstanceState.containsKey("latency")) {
		txtLatency.setText(savedInstanceState.getString("latency"));
	}
	else {
		if(component != null) txtLatency.setText("" + component.getLatency());
	}

	return new AlertDialog.Builder(getActivity())
		.setTitle(getResources().getString(R.string.latency_of_x).replace("#1", args.getString("id", "")))
		.setView(txtLatency)
		.setPositiveButton(android.R.string.ok, this)
		.setNegativeButton(android.R.string.cancel, this)
		.create();
}
 
Example #12
Source File: PickOrTakeImageActivity.java    From AlbumImageSelect with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
     * 点击完成按钮之后将图片的地址返回到上一个页面
     */
    private void returnDataAndClose(){
        AlbumBitmapCacheHelper.getInstance().clearCache();
        if (currentPicNums == 0){
            Toast.makeText(this, getString(R.string.not_choose_any_pick), Toast.LENGTH_SHORT).show();
            return;
        }
        StringBuilder sb = new StringBuilder();
        for (String model : picklist){
            sb.append(model+"\n");
        }
        TextView textview = new TextView(this);
        textview.setText(sb);
        Dialog dialog = new Dialog(this);
        dialog.setTitle("结果");
        dialog.setContentView(textview);
        dialog.show();
        if (picNums == 1)
            picklist.clear();
//        Intent data = new Intent();
//        data.putExtra("data", list);
//        setResult(RESULT_OK, data);
//        finish();
    }
 
Example #13
Source File: CaptureActivity.java    From PacketCaptureTool with Eclipse Public License 1.0 6 votes vote down vote up
public void showCapturingDialog()
{
	/* 创建新的对话框显示抓包状态 */
	dlgCapturing = new Dialog(CaptureActivity.this.getActivity());
	dlgCapturing.setContentView(R.layout.capture_dialog);
	dlgCapturing.setTitle(R.string.capturing);
	dlgCapturing.setCancelable(false);
    
    btnStopCapture = (Button)dlgCapturing.findViewById(R.id.btnStopCapture);
    btnStopCapture.setText(R.string.stop_capture);
    btnStopCapture.setOnClickListener(new OnBtnStopCaptureClickListener());
    
    txtvwCaptureAmount = (TextView)dlgCapturing.findViewById(R.id.txtvwCaptureAmount);
    
    /* 启动统计线程 */
    enCaptureStatus = CaptureStatus.STATUS_CAPTURING;
    new Thread(new StatisticThread()).start();
    
    dlgCapturing.show();
}
 
Example #14
Source File: SignOutDialogFragment.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    mGaiaServiceType = AccountManagementScreenHelper.GAIA_SERVICE_TYPE_NONE;
    if (getArguments() != null) {
        mGaiaServiceType = getArguments().getInt(
                SHOW_GAIA_SERVICE_TYPE_EXTRA, mGaiaServiceType);
    }

    String managementDomain = SigninManager.get(getActivity()).getManagementDomain();
    String message;
    if (managementDomain == null) {
        message = getActivity().getResources().getString(R.string.signout_message);
    } else {
        message = getActivity().getResources().getString(
                R.string.signout_managed_account_message, managementDomain);
    }

    return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setTitle(R.string.signout_title)
            .setPositiveButton(R.string.signout_dialog_positive_button, this)
            .setNegativeButton(R.string.cancel, this)
            .setMessage(message)
            .create();
}
 
Example #15
Source File: ErrorDialogFragment.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    Bundle args = getArguments();
    if (args == null) {
        dismiss();
    }

    String title = args.getString(EXTRA_TITLE);
    if (title == null) {
        title = getString(R.string.dconnect_error_default_title);
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(title);
    builder.setMessage(args.getString(EXTRA_MESSAGE));
    builder.setPositiveButton(R.string.activity_settings_close, (dialog, which) -> {
        dialog.dismiss();
    });
    return builder.create();
}
 
Example #16
Source File: BaseGameUtils.java    From android with Apache License 2.0 6 votes vote down vote up
/**
 * Resolve a connection failure from {@link GoogleApiClient.OnConnectionFailedListener#onConnectionFailed(ConnectionResult)}
 *
 * @param activity             the Activity trying to resolve the connection failure.
 * @param client               the GoogleAPIClient instance of the Activity.
 * @param result               the ConnectionResult received by the Activity.
 * @param requestCode          a request code which the calling Activity can use to identify the
 *                             result of this resolution in onActivityResult.
 * @param fallbackErrorMessage a generic error message to display if the failure cannot be
 *                             resolved.
 * @return true if the connection failure is resolved, false otherwise.
 */
public static boolean resolveConnectionFailure(Activity activity, GoogleApiClient client,
    ConnectionResult result, int requestCode, String fallbackErrorMessage) {
  if (result.hasResolution()) {
    try {
      result.startResolutionForResult(activity, requestCode);
      return true;
    } catch (IntentSender.SendIntentException e) {
      // The intent was canceled before it was sent.  Return to the default
      // state and attempt to connect to get an updated ConnectionResult.
      client.connect();
      return false;
    }
  } else {
    // not resolvable... so show an error message
    int errorCode = result.getErrorCode();
    Dialog dialog = GooglePlayServicesUtil.getErrorDialog(errorCode, activity, requestCode);
    if (dialog != null) {
      dialog.show();
    } else {
      // no built-in dialog: show the fallback error message
      showAlert(activity, fallbackErrorMessage);
    }
    return false;
  }
}
 
Example #17
Source File: SubsonicFragmentActivity.java    From Popeens-DSub with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPostCreate(Bundle bundle) {
	super.onPostCreate(bundle);

	showInfoDialog();
	checkUpdates();

	ChangeLog changeLog = new ChangeLog(this, Util.getPreferences(this));
	if(changeLog.isFirstRun()) {
		if(changeLog.isFirstRunEver()) {
			changeLog.updateVersionInPreferences();
		} else {
			Dialog log = changeLog.getLogDialog();
			if (log != null) {
				//log.show(); //For now we don't want to show changelog on first start after update, most users don't care about this. If they want to see it they can do that from the top right menu. Might change it back later depending on feedback.
			}
		}
	}
}
 
Example #18
Source File: ColorPreference.java    From KAM with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
    View rootView = layoutInflater.inflate(R.layout.dash_dialog_colors, null);

    mColorGrid = (GridView) rootView.findViewById(R.id.color_grid);

    mColorGrid.setNumColumns(mPreference.mNumColumns);

    mColorGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> listView, View view,
                                int position, long itemId) {
            mPreference.setValue(mAdapter.getItem(position));
            selector.onColorSelected(mAdapter.getItem(position));
            dismiss();
        }
    });

    tryBindLists();

    return new AlertDialog.Builder(getActivity())
            .setView(rootView)
            .create();
}
 
Example #19
Source File: DialogManager.java    From Gizwits-SmartSocket_Android with MIT License 6 votes vote down vote up
/**
 * 删除对话框.
 *
 * @param ctx the ctx
 * @param r            右按钮监听器
 * @return the unbind dialog
 */
public static Dialog getUnbindDialog(final Activity ctx, OnClickListener r) {
	final Dialog dialog = new Dialog(ctx, R.style.noBackgroundDialog) {
	};
	LayoutInflater layoutInflater = LayoutInflater.from(ctx);
	View v = layoutInflater.inflate(R.layout.dialog_unbind, null);
	Button leftBtn = (Button) v.findViewById(R.id.left_btn);
	Button rightBtn = (Button) v.findViewById(R.id.right_btn);
	leftBtn.setOnClickListener(new View.OnClickListener() {

		@Override
		public void onClick(View arg0) {
			dismissDialog(ctx, dialog);
		}
	});
	rightBtn.setOnClickListener(r);

	dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
	dialog.setCanceledOnTouchOutside(false);
	dialog.setCancelable(false);
	dialog.setContentView(v);
	return dialog;
}
 
Example #20
Source File: PassphraseCreationDialogFragment.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    super.onCreateDialog(savedInstanceState);
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.sync_custom_passphrase, null);
    mEnterPassphrase = (EditText) view.findViewById(R.id.passphrase);
    mConfirmPassphrase = (EditText) view.findViewById(R.id.confirm_passphrase);

    mConfirmPassphrase.setOnEditorActionListener(new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                tryToSubmitPassphrase();
            }
            return false;
        }
    });

    TextView instructionsView =
            (TextView) view.findViewById(R.id.custom_passphrase_instructions);
    instructionsView.setMovementMethod(LinkMovementMethod.getInstance());
    instructionsView.setText(getInstructionsText());

    AlertDialog dialog = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setView(view)
            .setTitle(R.string.sync_passphrase_type_custom_dialog_title)
            .setPositiveButton(R.string.save, null)
            .setNegativeButton(R.string.cancel, null)
            .create();
    dialog.getDelegate().setHandleNativeActionModesEnabled(false);
    return dialog;
}
 
Example #21
Source File: ProgressFragment.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog dialog = new ProgressDialog(getActivity());
    String msg = null;
    if (getArguments() != null) {
        msg = getArguments().getString(Utils.EXTRA_MSG);
    }
    if (msg == null) {
        msg = getString(R.string.check_url_dialog_msg);
    }
    dialog.setMessage(msg);
    dialog.setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    return dialog;
}
 
Example #22
Source File: AlertDialogFragment.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 5 votes vote down vote up
@Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        LayoutInflater layoutInflater = getActivity().getLayoutInflater();
        final View view = layoutInflater.inflate(R.layout.dialog_default, null);
        final AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
        alert.setView(view);
        final String title = this.getArguments().getString("title");
        if (title != null)
            alert.setTitle(title);
        else
            alert.setTitle(R.string.warn);
        final String text = this.getArguments().getString("text");
        TextView v = (TextView) view.findViewById(R.id.defaultdialog_name);
        v.setText(text);
        v.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);

        alert.setPositiveButton(android.R.string.ok, okLintener);
        alert.setNegativeButton(android.R.string.cancel, cancleLintener);


        final AlertDialog dialog = alert.create();
//		dialog.setOnDismissListener(new AlertDialog.OnDismissListener() {
//
//			@Override
//			public void onDismiss(DialogInterface arg0) {
//				// TODO Auto-generated method stub
//				dialog.dismiss();
//				if (PhoneConfiguration.getInstance().fullscreen) {
//					ActivityUtil.getInstance().setFullScreen(view);
//				}
//			}
//
//		});
        return dialog;

    }
 
Example #23
Source File: MainSettingsActivity.java    From an2linuxclient with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AlertDialogCustom);
    builder.setMessage(R.string.main_dialog_ask_background_location_access)
            .setPositiveButton(android.R.string.ok, (dialog, id) -> ActivityCompat.requestPermissions(getActivity(),
                    new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION},
                    UNIQUE_BACKGROUND_LOCATION_ID))
            .setNegativeButton(android.R.string.cancel, (dialog, id) -> {
            });
    return builder.create();
}
 
Example #24
Source File: SearchPrinterDialog.java    From esc-pos-android with Apache License 2.0 5 votes vote down vote up
public SearchPrinterDialog(Activity activity, BTService service) {
  this.activity = activity;
  this.service = service;
  deviceItems = new HashMap<>();

  @SuppressLint("InflateParams")
  View view = LayoutInflater.from(activity).inflate(R.layout.serach_dialog_layout, null, false);

  insets = dpToPx(16);
  activity.registerReceiver(receiver, new IntentFilter(BluetoothDevice.ACTION_FOUND));
  activity.registerReceiver(receiver, new IntentFilter(BluetoothDevice.ACTION_CLASS_CHANGED));
  activity.registerReceiver(receiver, new IntentFilter(BluetoothDevice.ACTION_NAME_CHANGED));
  activity.registerReceiver(receiver, new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED));

  Set<BluetoothDevice> pairedDevices = service.getBondedDevices();

  availableDevicesContainer = (LinearLayout) view.findViewById(R.id.available_devices_container);
  progress = view.findViewById(R.id.search_devices_progress);
  if (pairedDevices.size() > 0) {
    fillPairedDevices(pairedDevices, (LinearLayout) view.findViewById(R.id.paired_devices_container));
  } else {
    view.findViewById(R.id.paired_devices).setVisibility(View.GONE);
  }

  service.startDiscovery();

  dialog = new Dialog(activity);
  dialog.setCancelable(true);
  dialog.setContentView(view);
  dialog.setTitle(R.string.pos_title_choose_printer);
  dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
    @Override
    public void onCancel(DialogInterface dialogInterface) {
      SearchPrinterDialog.this.onCancel();
    }
  });
  dialog.show();
}
 
Example #25
Source File: DialogCreator.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Dialog createSetAvatarDialog(Context context, View.OnClickListener listener) {
    Dialog dialog = new Dialog(context, IdHelper.getStyle(context, "jmui_default_dialog_style"));
    final LayoutInflater inflater = LayoutInflater.from(context);
    View view = inflater.inflate(IdHelper.getLayout(context, "jmui_dialog_set_avatar"), null);
    dialog.setContentView(view);
    Button takePhotoBtn = (Button) view.findViewById(IdHelper.getViewID(context, "jmui_take_photo_btn"));
    Button pickPictureBtn = (Button) view.findViewById(IdHelper.getViewID(context, "jmui_pick_picture_btn"));
    takePhotoBtn.setOnClickListener(listener);
    pickPictureBtn.setOnClickListener(listener);
    dialog.setCancelable(true);
    dialog.setCanceledOnTouchOutside(true);
    return dialog;
}
 
Example #26
Source File: ColorPickerDialog.java    From Tweetin with Apache License 2.0 5 votes vote down vote up
public Dialog onCreateDialog(Bundle bundle) {
	View view = LayoutInflater.from(getActivity()).inflate(R.layout.color_picker_dialog, null);
	this.mProgress = ((ProgressBar) view.findViewById(android.R.id.progress));
	this.mPalette = ((ColorPickerPalette) view.findViewById(R.id.color_picker));
	this.mPalette.init(this.mSize, this.mColumns, this);
	if (this.mColors != null)
		showPaletteView();
	this.mAlertDialog = new AlertDialog.Builder(getActivity()).setTitle(this.mTitleResId).setView(view).create();
	return this.mAlertDialog;
}
 
Example #27
Source File: AlertDialog.java    From KUtils with Apache License 2.0 5 votes vote down vote up
public AlertDialog builder() {
	// 获取Dialog布局
	View view = LayoutInflater.from(context).inflate(
			R.layout.view_alertdialog, null);

	// 获取自定义Dialog布局中的控件
	lLayout_bg = (LinearLayout) view.findViewById(R.id.lLayout_bg);
	txt_title = (TextView) view.findViewById(R.id.txt_title);
	txt_title.setVisibility(View.GONE);
	txt_msg = (TextView) view.findViewById(R.id.txt_msg);
	txt_msg.setVisibility(View.GONE);
	btn_neg = (Button) view.findViewById(R.id.btn_neg);
	btn_neg.setVisibility(View.GONE);
	btn_pos = (Button) view.findViewById(R.id.btn_pos);
	btn_pos.setVisibility(View.GONE);
	img_line = (ImageView) view.findViewById(R.id.img_line);
	img_line.setVisibility(View.GONE);

	// 定义Dialog布局和参数
	dialog = new Dialog(context, R.style.AlertDialogStyle);
	dialog.setContentView(view);

	// 调整dialog背景大小
	lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
			.getWidth() * 0.85), LayoutParams.WRAP_CONTENT));

	return this;
}
 
Example #28
Source File: UIsUtils.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, String message, OnClickListener yes) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(R.string.dialog_default_title).setIcon(R.drawable.dialog_icon).setMessage(message).setPositiveButton(R.string.dialog_default_ok, yes).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
 
Example #29
Source File: SaveConfirmDialog.java    From fanfouapp-opensource with Apache License 2.0 5 votes vote down vote up
public SaveConfirmDialog(final Context context, final String title,
        final String text) {
    super(context, R.style.Dialog);
    this.mContext = context;
    this.mTitle = title;
    this.mText = text;
}
 
Example #30
Source File: DetailsFragment.java    From CSCI4669-Fall15-Android with Apache License 2.0 5 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle bundle)
{
   // create a new AlertDialog Builder
   AlertDialog.Builder builder = 
      new AlertDialog.Builder(getActivity());
      
   builder.setTitle(R.string.confirm_title); 
   builder.setMessage(R.string.confirm_message);
      
   // provide an OK button that simply dismisses the dialog
   builder.setPositiveButton(R.string.button_delete,
      new DialogInterface.OnClickListener()
      {
         @Override
         public void onClick(
            DialogInterface dialog, int button)
         {

            new Delete().from(Contact.class).where("id = ?", String.valueOf(rowID)).query();

            listener.onContactDeleted();
         } // end method onClick
      } // end anonymous inner class
   ); // end call to method setPositiveButton
   
   builder.setNegativeButton(R.string.button_cancel, null);
   return builder.create(); // return the AlertDialog
}