本文整理汇总了Java中android.app.Dialog类的典型用法代码示例。如果您正苦于以下问题:Java Dialog类的具体用法?Java Dialog怎么用?Java Dialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dialog类属于android.app包,在下文中一共展示了Dialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: destroyDialog
import android.app.Dialog; //导入依赖的package包/类
@Test
public void destroyDialog() {
screen.showDialog(new DialogCreator() {
@Override
public Dialog createDialog(Activity activity) {
return dialog;
}
});
screen.destroyDialog();
verify(dialog).setOnDismissListener(null);
verify(dialog).dismiss();
}
示例2: 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();
}
示例3: onCreateDialog
import android.app.Dialog; //导入依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
ArrayList<DonateBean> dataList = (ArrayList<DonateBean>) getArguments().getSerializable("data");
return new AlertDialog.Builder(getActivity())
.setTitle(R.string.preference_support_title_sponsors)
.setItems(parseData(dataList), null)
.setPositiveButton(R.string.dlg_bt_donate_too, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (onDonateListener != null) {
onDonateListener.onDonate();
}
}
})
.create();
}
示例4: onCreateDialog
import android.app.Dialog; //导入依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Bundle args = getArguments();
final AspectRatio[] ratios = (AspectRatio[]) args.getParcelableArray(ARG_ASPECT_RATIOS);
if (ratios == null) {
throw new RuntimeException("No ratios");
}
Arrays.sort(ratios);
final AspectRatio current = args.getParcelable(ARG_CURRENT_ASPECT_RATIO);
final AspectRatioAdapter adapter = new AspectRatioAdapter(ratios, current);
return new AlertDialog.Builder(getActivity())
.setAdapter(adapter, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int position) {
mListener.onAspectRatioSelected(ratios[position]);
}
})
.create();
}
示例5: showRecoveryDialog
import android.app.Dialog; //导入依赖的package包/类
private void showRecoveryDialog(int statusCode) {
Activity activity = getActivity("showRecoveryDialog()");
if (activity == null) {
return;
}
if (sCanShowAuthUi) {
sCanShowAuthUi = false;
LOGD(TAG, "Showing recovery dialog for status code " + statusCode);
final Dialog d = GooglePlayServicesUtil.getErrorDialog(
statusCode, activity, REQUEST_RECOVER_FROM_PLAY_SERVICES_ERROR);
d.show();
} else {
LOGD(TAG, "Not showing Play Services recovery dialog because sCanShowSignInUi==false.");
reportAuthFailure();
}
}
示例6: setupDialog
import android.app.Dialog; //导入依赖的package包/类
@Override
public void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
View view = View.inflate(getActivity(), R.layout.bottom_sheet_attachments, null);
mRecyclerView = view.findViewById(R.id.recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
mEmptyView = view.findViewById(R.id.empty_root);
view.findViewById(R.id.button_send).setOnClickListener(v -> {
getTargetFragment().onActivityResult(getTargetRequestCode(), Activity.RESULT_OK, null);
getDialog().dismiss();
});
view.findViewById(R.id.button_hide).setOnClickListener(v -> getDialog().dismiss());
view.findViewById(R.id.button_video).setOnClickListener(v -> getPresenter().fireButtonVideoClick());
view.findViewById(R.id.button_doc).setOnClickListener(v -> getPresenter().fireButtonDocClick());
view.findViewById(R.id.button_camera).setOnClickListener(v -> getPresenter().fireButtonCameraClick());
dialog.setContentView(view);
fireViewCreated();
}
示例7: setCodeDialogContentView
import android.app.Dialog; //导入依赖的package包/类
private static Dialog setCodeDialogContentView(Context context){
switch (Adaptation.proportion){
case Adaptation.SCREEN_9_16:
String model = Build.MODEL;
if (model.contains("M1") || model.contains("m1")) {
return getDialog(context, R.layout.dialog_code_9_16_m1);
}else {
return getDialog(context, R.layout.dialog_code_9_16);
}
case Adaptation.SCREEN_3_4:
return getDialog(context, R.layout.dialog_code_9_16);
case Adaptation.SCREEN_4_3:
return getDialog(context, R.layout.dialog_code_16_9);
case Adaptation.SCREEN_16_9:
return getDialog(context, R.layout.dialog_code_16_9);
default:
return getDialog(context, R.layout.dialog_code_9_16);
}
}
示例8: onCreateDialog
import android.app.Dialog; //导入依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View v = getActivity().getLayoutInflater().inflate(R.layout.create_share_dialog, null);
pathEdit = (EditText) v.findViewById(R.id.edit_sharepath);
pathEdit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
Dialog dialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.manually_create_share)
.setView(v)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.yes, this).create();
// Put the cursor at the end of "smb://"
// This must be done after the dialog is created, else it does not work
pathEdit.setSelection(pathEdit.getText().length());
return dialog;
}
示例9: onCreateDialog
import android.app.Dialog; //导入依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
@SuppressLint("InflateParams") View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_board_contributors, null, false);
unbinder = ButterKnife.bind(this, view);
if (null == getActivity()) {
return new AlertDialog.Builder(getActivity())
.setTitle(R.string.contributors)
.setView(view)
.setNegativeButton(R.string.closed, null)
.create();
} else {
return new android.support.v7.app.AlertDialog.Builder(getActivity())
.setTitle(R.string.contributors)
.setView(view)
.setNegativeButton(R.string.closed, null)
.create();
}
}
示例10: onCreateDialog
import android.app.Dialog; //导入依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final RelativeLayout root = new RelativeLayout(getActivity());
root.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
// creating the fullscreen dialog
final Dialog dialog = new Dialog(getContext());
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(root);
if (dialog.getWindow() != null) {
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.getWindow().setLayout(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
dialog.setCanceledOnTouchOutside(false);
return dialog;
}
示例11: openHelpDialog
import android.app.Dialog; //导入依赖的package包/类
/**
* @brief Show the dialog with the help message
* @return The new dialog
* @details Show the dialog with the help message
*/
private Dialog openHelpDialog()
{
final TextView text = new TextView(this);
text.setText(R.string.help_message);
return new AlertDialog.Builder(this)
.setTitle(R.string.help_title)
.setView(text)
.setPositiveButton(R.string.help_ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}
)
.show();
}
示例12: onCreateDialog
import android.app.Dialog; //导入依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final List<Playlist> playlists = PlaylistLoader.getPlaylists(getActivity(), false);
CharSequence[] chars = new CharSequence[playlists.size() + 1];
chars[0] = "Create new playlist";
for (int i = 0; i < playlists.size(); i++) {
chars[i + 1] = playlists.get(i).name;
}
return new MaterialDialog.Builder(getActivity()).title("Add to playlist").items(chars).itemsCallback(new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
long[] songs = getArguments().getLongArray("songs");
if (which == 0) {
CreatePlaylistDialog.newInstance(songs).show(getActivity().getSupportFragmentManager(), "CREATE_PLAYLIST");
return;
}
MusicPlayer.addToPlaylist(getActivity(), songs, playlists.get(which - 1).id);
dialog.dismiss();
}
}).build();
}
示例13: onCreateDialog
import android.app.Dialog; //导入依赖的package包/类
@NonNull
@SuppressLint("InflateParams")
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
if (savedInstanceState != null) {
mBio = savedInstanceState.getString("bio", mBio);
}
builder.setView(inflater.inflate(R.layout.dialog_update_profile_info, null))
.setTitle(R.string.update_title)
.setPositiveButton(R.string.update, null)
.setNegativeButton(R.string.cancel, null);
return builder.create();
}
示例14: onImageGoodsMenuClicked
import android.app.Dialog; //导入依赖的package包/类
private void onImageGoodsMenuClicked(Dialog d, int position) {
switch (position) {
case 0:
shareImagePublic(currentClickImageUrl);
break;
case 1:
shareImageCircle(currentClickImageUrl);
break;
case 2:
shareImageGoods(currentClickImageUrl);
break;
case 3:
saveImage(currentClickImageUrl);
break;
case 4:
openImageMenuMore();
break;
}
}
示例15: onCreateDialog
import android.app.Dialog; //导入依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// the content
final RelativeLayout root = new RelativeLayout(getActivity());
root.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
// creating the fullscreen dialog
final Dialog dialog = new Dialog(getContext());
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(root);
if (dialog.getWindow() != null) {
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.getWindow().setLayout(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
dialog.setCanceledOnTouchOutside(false);
return dialog;
}