本文整理汇总了Java中android.app.Dialog.show方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.show方法的具体用法?Java Dialog.show怎么用?Java Dialog.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.Dialog
的用法示例。
在下文中一共展示了Dialog.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showDialog
import android.app.Dialog; //导入方法依赖的package包/类
/**
* 统一显示
* 解决badtoken问题,一劳永逸
*
* @param dialog
*/
public static void showDialog(Dialog dialog) {
try {
if (dialog != null) {
dialog.show();
}
} catch (Exception e) {
}
}
示例2: setPin
import android.app.Dialog; //导入方法依赖的package包/类
private void setPin() {
final Dialog d = new Dialog(getActivity(), R.style.Theme_Document_DailogPIN);
d.getWindow().setWindowAnimations(R.style.DialogExitNoAnimation);
View view = new PinViewHelper((LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE), null, null) {
public void onEnter(String password) {
super.onEnter(password);
confirmPin(password);
d.dismiss();
}
public void onCancel() {
super.onCancel();
d.dismiss();
}
}.getView();
view.findViewById(R.id.logo).setVisibility(View.GONE);
d.setContentView(view);
d.show();
}
示例3: handleDeleteSongForever
import android.app.Dialog; //导入方法依赖的package包/类
public void handleDeleteSongForever(final OnCompleteListener<Void> complete, final int sheetID, final List<Song> songs) {
DialogProvider manager = new DialogProvider(activity);
final Dialog dialog = manager.createPromptDialog(
activity.getString(R.string.warning),
activity.getString(R.string.info_delete_select_confirm),
new DialogProvider.OnClickListener() {
@Override
public void onClick(View view) {
deleteSongFromDiskAndLibraryForever(complete, sheetID, songs);
}
},
null,
true
);
dialog.show();
}
示例4: startCameraSource
import android.app.Dialog; //导入方法依赖的package包/类
/**
* 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 (mCameraSource != null) {
try {
mPreview.start(mCameraSource, mGraphicOverlay);
} catch (IOException e) {
Log.e(TAG, "Unable to start camera source.", e);
mCameraSource.release();
mCameraSource = null;
}
}
}
示例5: optionLegend
import android.app.Dialog; //导入方法依赖的package包/类
private void optionLegend() {
// Show help
Dialog dialog = new Dialog(ActivityApp.this);
dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
dialog.setTitle(R.string.menu_legend);
dialog.setContentView(R.layout.legend);
dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));
((ImageView) dialog.findViewById(R.id.imgHelpHalf)).setImageBitmap(getHalfCheckBox());
((ImageView) dialog.findViewById(R.id.imgHelpOnDemand)).setImageBitmap(getOnDemandCheckBox());
for (View child : Util.getViewsByTag((ViewGroup) dialog.findViewById(android.R.id.content), "main"))
child.setVisibility(View.GONE);
((LinearLayout) dialog.findViewById(R.id.llUnsafe)).setVisibility(PrivacyManager.cVersion3 ? View.VISIBLE
: View.GONE);
dialog.setCancelable(true);
dialog.show();
}
示例6: onPreExecute
import android.app.Dialog; //导入方法依赖的package包/类
@Override
protected void onPreExecute() {
isFinalizing = true;
recordFinish = true;
runAudioThread = false;
//创建处理进度条
creatingProgress = new Dialog(FFmpegRecorderActivity.this, R.style.Dialog_loading_noDim);
Window dialogWindow = creatingProgress.getWindow();
WindowManager.LayoutParams lp = dialogWindow.getAttributes();
lp.width = (int) (getResources().getDisplayMetrics().density * 240);
lp.height = (int) (getResources().getDisplayMetrics().density * 80);
lp.gravity = Gravity.CENTER;
dialogWindow.setAttributes(lp);
creatingProgress.setCanceledOnTouchOutside(false);
creatingProgress.setContentView(R.layout.activity_recorder_progress);
progress = (TextView) creatingProgress.findViewById(R.id.recorder_progress_progresstext);
bar = (ProgressBar) creatingProgress.findViewById(R.id.recorder_progress_progressbar);
creatingProgress.show();
//txtTimer.setVisibility(View.INVISIBLE);
//handler.removeCallbacks(mUpdateTimeTask);
super.onPreExecute();
}
示例7: call
import android.app.Dialog; //导入方法依赖的package包/类
public static void call(Context context, Activity activity, int messageId, int yes, int no, OnClickListener yesListener, OnClickListener noListener) {
if (activity != null) {
String title = context.getString(2131100003);
String msg = context.getString(messageId);
String y = context.getString(yes);
Dialog dialog = new Builder(activity).setTitle(title).setMessage(msg).setPositiveButton(y, yesListener).setNegativeButton(context.getString(no), noListener).create();
if (!activity.isFinishing() && !activity.isRestricted()) {
try {
dialog.show();
} catch (Exception e) {
}
}
}
}
示例8: showConfirmDialog
import android.app.Dialog; //导入方法依赖的package包/类
public static Dialog showConfirmDialog(Activity activity, boolean cancelable, String title, String message,
final CustomAlertOnClickListener backHandler) {
Dialog dialog = new Dialog(activity, R.style.CustomDialog);
dialog.setContentView(R.layout.confirm_dialog);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.setCancelable(cancelable);
TextView tvTitle = (TextView) dialog.findViewById(R.id.tv_title);
TextView tvContent = (TextView) dialog.findViewById(R.id.tv_content);
Button btnBack = (Button) dialog.findViewById(R.id.btn_confirm);
if (!TextUtils.isEmpty(title)) {
tvTitle.setText(title);
}
tvContent.setText(message);
dialog.show();
final Dialog inDialog = dialog;
btnBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (backHandler != null) {
backHandler.onClick(inDialog, v);
}
}
});
return dialog;
}
示例9: showSupportersDialog
import android.app.Dialog; //导入方法依赖的package包/类
private void showSupportersDialog() {
final Dialog fullscreenDialog = new Dialog(this, R.style.DialogFullscreen);
fullscreenDialog.setContentView(R.layout.dialog_supporters);
Button logoutB = fullscreenDialog.findViewById(R.id.logout_b);
ImageView img_dialog_fullscreen_close = fullscreenDialog.findViewById(R.id.close_iv);
TextView collaborationTV = fullscreenDialog.findViewById(R.id.info_collaboration_tv);
collaborationTV.setText(Html.fromHtml(getString(R.string.collaboration)));
img_dialog_fullscreen_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fullscreenDialog.dismiss();
}
});
logoutB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
saveToken(context, "HOME", null);
Intent intent = new Intent(context, ActivitySplash.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK |
Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
});
fullscreenDialog.show();
}
示例10: call
import android.app.Dialog; //导入方法依赖的package包/类
public static void call(Activity activity, String messageId, OnClickListener yes, OnClickListener no) {
if (activity != null) {
Dialog dialog = new Builder(activity).setIcon(R.drawable.dialog_icon).setMessage(messageId).setPositiveButton(R.string.dialog_default_ok, yes).setNegativeButton(R.string.dialog_default_no, no).create();
if (!activity.isFinishing() && !activity.isRestricted()) {
try {
dialog.show();
} catch (Exception e) {
}
}
}
}
示例11: resolveConnectionFailure
import android.app.Dialog; //导入方法依赖的package包/类
/**
* Resolve a connection failure from
* {@link com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener#onConnectionFailed(com.google.android.gms.common.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,
int 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, activity.getString(fallbackErrorMessage));
}
return false;
}
}
示例12: showDialog
import android.app.Dialog; //导入方法依赖的package包/类
private void showDialog(Dialog dlg) {
if (dlg != null) {
if (dlg.isShowing()) {
dlg.cancel();
} else {
dlg.show();
}
}
}
示例13: confirmPin
import android.app.Dialog; //导入方法依赖的package包/类
private void confirmPin(final String pin) {
final Dialog d = new Dialog(getActivity(), R.style.Theme_Document_DailogPIN);
d.getWindow().setWindowAnimations(R.style.DialogEnterNoAnimation);
PinViewHelper pinViewHelper = new PinViewHelper((LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE), null, null) {
public void onEnter(String password) {
super.onEnter(password);
if (pin.equals(password)) {
SettingsActivity.setPin(getActivity(), password);
pin_set_preference.setSummary(SettingsActivity.isPinProtected(getActivity()) ? R.string.pin_set : R.string.pin_disabled);
if (password != null && password.length() > 0){
showMsg(R.string.pin_set);
setInstruction(R.string.pin_set);
}
d.dismiss();
return;
}
showError(R.string.pin_mismatch);
setInstruction(R.string.pin_mismatch);
}
public void onCancel() {
super.onCancel();
d.dismiss();
}
};
View view = pinViewHelper.getView();
view.findViewById(R.id.logo).setVisibility(View.GONE);
pinViewHelper.setInstruction(R.string.confirm_pin);
d.setContentView(view);
d.show();
}
示例14: a
import android.app.Dialog; //导入方法依赖的package包/类
public static Dialog a(Context context, String str, String str2, String str3, OnClickListener onClickListener, String str4, OnClickListener onClickListener2) {
Builder builder = new Builder(context);
if (a) {
if (!(TextUtils.isEmpty(str4) || onClickListener2 == null)) {
builder.setPositiveButton(str4, onClickListener2);
}
if (!(TextUtils.isEmpty(str3) || onClickListener == null)) {
builder.setNegativeButton(str3, onClickListener);
}
} else {
if (!(TextUtils.isEmpty(str3) || onClickListener == null)) {
builder.setPositiveButton(str3, onClickListener);
}
if (!(TextUtils.isEmpty(str4) || onClickListener2 == null)) {
builder.setNegativeButton(str4, onClickListener2);
}
}
builder.setTitle(str);
builder.setMessage(str2);
Dialog create = builder.create();
create.setCanceledOnTouchOutside(false);
create.setOnKeyListener(new e());
try {
create.show();
} catch (Throwable th) {
}
return create;
}
示例15: showActivityResultError
import android.app.Dialog; //导入方法依赖的package包/类
/**
* Show a {@link android.app.Dialog} with the correct message for a connection error.
* @param activity the Activity in which the Dialog should be displayed.
* @param requestCode the request code from onActivityResult.
* @param actResp the response code from onActivityResult.
* @param errorDescription the resource id of a String for a generic error message.
*/
public static void showActivityResultError(Activity activity, int requestCode, int actResp, int errorDescription) {
if (activity == null) {
Log.e("BaseGameUtils", "*** No Activity. Can't show failure dialog!");
return;
}
Dialog errorDialog;
switch (actResp) {
case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
errorDialog = makeSimpleDialog(activity,
activity.getString(R.string.app_misconfigured));
break;
case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
errorDialog = makeSimpleDialog(activity,
activity.getString(R.string.sign_in_failed));
break;
case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
errorDialog = makeSimpleDialog(activity,
activity.getString(R.string.license_failed));
break;
default:
// No meaningful Activity response code, so generate default Google
// Play services dialog
final int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
activity, requestCode, null);
if (errorDialog == null) {
// get fallback dialog
Log.e("BaseGamesUtils",
"No standard error dialog available. Making fallback dialog.");
errorDialog = makeSimpleDialog(activity, activity.getString(errorDescription));
}
}
errorDialog.show();
}