Java Code Examples for android.app.AlertDialog#setContentView()

The following examples show how to use android.app.AlertDialog#setContentView() . 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: PhotoPagerAdapter.java    From PhotoPicker with Apache License 2.0 6 votes vote down vote up
private void OnLongDialog(Context context, final String path) {
        final AlertDialog albumDialog = new AlertDialog.Builder(context).create();
        albumDialog.setCanceledOnTouchOutside(true);
        albumDialog.setCancelable(true);
        View v = LayoutInflater.from(context).inflate(
                R.layout.__picker_dialog_photo_pager, null);
        albumDialog.show();
//        ViewGroup.LayoutParams layoutParams = new LinearLayout.LayoutParams(280, ViewGroup.LayoutParams.MATCH_PARENT);
        albumDialog.setContentView(v);
        albumDialog.getWindow().setGravity(Gravity.CENTER);
        albumDialog.getWindow().setBackgroundDrawableResource(R.drawable.__picker_bg_dialog);
        ListView dialog_lv = (ListView) v.findViewById(R.id.dialog_lv);

        PhotoDialogAdapter photoDialogAdapter = new PhotoDialogAdapter(context, longData);
        dialog_lv.setAdapter(photoDialogAdapter);
        dialog_lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                albumDialog.dismiss();
                PhotoOnLongClickManager photoOnLongClickManager = PhotoOnLongClickManager.getInstance();
                photoOnLongClickManager.setOnLongClick(i, path);
            }
        });
    }
 
Example 2
Source File: PhotoPagerAdapter.java    From PhotoPicker with Apache License 2.0 6 votes vote down vote up
private void OnLongDialog(Context context, final String path) {
        final AlertDialog albumDialog = new AlertDialog.Builder(context).create();
        albumDialog.setCanceledOnTouchOutside(true);
        albumDialog.setCancelable(true);
        View v = LayoutInflater.from(context).inflate(
                R.layout.__picker_dialog_photo_pager, null);
        albumDialog.show();
//        ViewGroup.LayoutParams layoutParams = new LinearLayout.LayoutParams(280, ViewGroup.LayoutParams.MATCH_PARENT);
        albumDialog.setContentView(v);
        albumDialog.getWindow().setGravity(Gravity.CENTER);
        albumDialog.getWindow().setBackgroundDrawableResource(R.drawable.__picker_bg_dialog);
        ListView dialog_lv = (ListView) v.findViewById(R.id.dialog_lv);

        PhotoDialogAdapter photoDialogAdapter = new PhotoDialogAdapter(context, longData);
        dialog_lv.setAdapter(photoDialogAdapter);
        dialog_lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                albumDialog.dismiss();
                PhotoOnLongClickManager photoOnLongClickManager = PhotoOnLongClickManager.getInstance();
                photoOnLongClickManager.setOnLongClick(i, path);
            }
        });
    }
 
Example 3
Source File: AlertDialogFactory.java    From Common with Apache License 2.0 5 votes vote down vote up
/**
 * LoadingDialog
 */
public Dialog getLoadingDialog(String text) {
    final AlertDialog dlg = new AlertDialog
            .Builder(new ContextThemeWrapper(mContext, R.style.lib_pub_dialog_style))
            .create();
    if (mContext instanceof Activity && !((Activity) mContext).isFinishing()) {
        dlg.show();
    }
    dlg.setContentView(R.layout.lib_pub_dialog_loading);
    TextView tips = (TextView) dlg.findViewById(R.id.tv_tips);
    if (text != null) {
        tips.setText(text);
    }
    return dlg;
}
 
Example 4
Source File: DialogUtils.java    From letv with Apache License 2.0 5 votes vote down vote up
public static AlertDialog buildBottomDialog(Activity activity, View contentView) {
    AlertDialog dialog = new Builder(activity).create();
    dialog.setCanceledOnTouchOutside(true);
    dialog.show();
    dialog.setContentView(contentView);
    Window dialogWindow = dialog.getWindow();
    Display d = activity.getWindowManager().getDefaultDisplay();
    LayoutParams p = dialogWindow.getAttributes();
    p.width = d.getWidth();
    dialogWindow.setAttributes(p);
    dialogWindow.setGravity(80);
    return dialog;
}
 
Example 5
Source File: AlertDialogFactory.java    From DMusic with Apache License 2.0 5 votes vote down vote up
/**
 * LoadingDialog
 */
public AlertDialog getLoadingDialog(String text) {
    final AlertDialog dlg = new AlertDialog
            .Builder(new ContextThemeWrapper(mContext, R.style.lib_pub_dialog_style))
            .create();
    if (mContext instanceof Activity && !((Activity) mContext).isFinishing()) {
        dlg.show();
    }
    dlg.setContentView(R.layout.lib_pub_dialog_loading);
    TextView tips = (TextView) dlg.findViewById(R.id.tv_tips);
    if (text != null) {
        tips.setText(text);
    }
    return dlg;
}