@SuppressLint("InflateParams") protected MaterialDialog(Builder builder) { super(builder.context, DialogInit.getTheme(builder)); mHandler = new Handler(); mBuilder = builder; final LayoutInflater inflater = LayoutInflater.from(builder.context); view = (MDRootLayout) inflater.inflate(DialogInit.getInflateLayout(builder), null); DialogInit.init(this); // Set up width if on tablet if (builder.context.getResources().getBoolean(R.bool.md_is_tablet)) { WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(getWindow().getAttributes()); lp.width = builder.context.getResources().getDimensionPixelSize(R.dimen.md_default_dialog_width); getWindow().setAttributes(lp); } }
@SuppressLint("InflateParams") protected MaterialDialog(Builder builder) { super(builder.context, DialogInit.getTheme(builder)); handler = new Handler(); this.builder = builder; final LayoutInflater inflater = LayoutInflater.from(builder.context); view = (MDRootLayout) inflater.inflate(DialogInit.getInflateLayout(builder), null); DialogInit.init(this); }
@SuppressLint("InflateParams") protected MaterialDialog(Builder builder) { super(builder.context, DialogInit.getTheme(builder)); handler = new Handler(); this.builder = builder; final LayoutInflater inflater = LayoutInflater.from(getContext()); view = (MDRootLayout) inflater.inflate(DialogInit.getInflateLayout(builder), null); DialogInit.init(this); // Don't keep a Context reference in the Builder after this point builder.context = null; }