List of usage examples for android.app Dialog setContentView
public void setContentView(@NonNull View view)
From source file:com.example.android.indoornavigation.activities.MainActivity.java
public void createCustomDialog() { // custom dialog final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.navigation_dialog); Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); // if button is clicked, close the custom dialog dialogButton.setOnClickListener(new View.OnClickListener() { @Override//w w w.j a v a 2 s. c om public void onClick(View v) { dialog.dismiss(); mMyWebView = (MyWebView) findViewById(R.id.map); mMyWebView.setDrawPath(1); mMyWebView.draw(new Canvas()); selectItem(0); } }); dialog.show(); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Change the order of the favorite rows. * //from www . j a v a 2s. co m * @param context */ public static void displayChangeRowOrder(final Launcher context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.row_list); final ListView listView = (ListView) dialog.findViewById(R.id.rowList); ArrayList<RowInfo> persistedRows = RowsTable.getRows(context); final ArrayList<RowInfo> rows = new ArrayList<RowInfo>(); // Add in reverse order to match favorite rows order for (RowInfo rowInfo : persistedRows) { rows.add(0, rowInfo); } final RowAdapter rowAdapter = new RowAdapter(context, rows); listView.setAdapter(rowAdapter); listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { RowInfo rowInfo = (RowInfo) parent.getAdapter().getItem(position); if (rowInfo.isSelected()) { rowInfo.setSelected(false); // Persist the new row order try { int counter = 0; for (int i = rowAdapter.getCount() - 1; i >= 0; i--) { RowInfo currentRowInfo = (RowInfo) parent.getAdapter().getItem(i); RowsTable.updateRow(context, currentRowInfo.getId(), currentRowInfo.getTitle(), counter, currentRowInfo.getType()); counter++; } } catch (Exception e) { Log.e(LOG_TAG, "displayChangeRowOrder", e); } Analytics.logEvent(Analytics.CHANGE_ROW_ORDER); } else { rowInfo.setSelected(true); } rowAdapter.notifyDataSetChanged(); } }); listView.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { // Swap the selected item in the list int selectedRowIndex = -1; for (int i = 0; i < rows.size(); i++) { RowInfo rowInfo = rows.get(i); if (rowInfo.isSelected()) { selectedRowIndex = i; break; } } if (selectedRowIndex != -1) { try { Collections.swap(rows, position, selectedRowIndex); rowAdapter.notifyDataSetChanged(); } catch (Exception e) { Log.e(LOG_TAG, "displayChangeRowOrder", e); } } } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); listView.setDrawingCacheEnabled(true); listView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); context.reloadAllGalleries(); } }); Button okButton = (Button) dialog.findViewById(R.id.okButton); okButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { context.showCover(false); dialog.dismiss(); context.reloadAllGalleries(); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_CHANGE_ROW_ORDER); }
From source file:net.margaritov.preference.colorpicker.dialog.ColorPickerDialogFragment.java
@NonNull @Override/*from w ww . j ava2 s .c om*/ public Dialog onCreateDialog(Bundle savedInstanceState) { if (getActivity() != null) { final Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_DeviceDefault_Light_Dialog); dialog.getWindow().setFormat(PixelFormat.RGBA_8888); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); dialog.setContentView(R.layout.view_color_picker_dialog); colorPicker = (ColorPickerView) dialog.findViewById(R.id.color_picker_view); oldColor = (ColorPanelView) dialog.findViewById(R.id.color_panel_old); newColor = (ColorPanelView) dialog.findViewById(R.id.color_panel_new); ((LinearLayout) oldColor.getParent()).setPadding(Math.round(colorPicker.getDrawingOffset()), 0, Math.round(colorPicker.getDrawingOffset()), 0); colorPicker.setOnColorChangedListener(this); oldColor.setColor(initialColor); if (savedInstanceState == null) { colorPicker.setColor(initialColor, true); } buttonNegative = (Button) dialog.findViewById(R.id.dialog_button_negative); buttonPositive = (Button) dialog.findViewById(R.id.dialog_button_positive); buttonNegative.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (onDialogButtonClickedListener != null) { onDialogButtonClickedListener.onNegativeButtonClicked(ColorPickerDialogFragment.this); } dismiss(); } }); buttonPositive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (onDialogButtonClickedListener != null) { onDialogButtonClickedListener.onPositiveButtonClicked(ColorPickerDialogFragment.this); } dismiss(); } }); return dialog; } else { return super.onCreateDialog(savedInstanceState); } }
From source file:com.tingtingapps.securesms.ConversationListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { final View view = inflater.inflate(R.layout.conversation_list_fragment, container, false); reminderView = (ReminderView) view.findViewById(R.id.reminder); list = (RecyclerView) view.findViewById(R.id.list); fab = (FloatingActionButton) view.findViewById(R.id.fab); list.setHasFixedSize(true);//from w w w.ja v a 2s.c o m list.setLayoutManager(new LinearLayoutManager(getActivity())); Calendar calendar = Calendar.getInstance(); int day = calendar.get(Calendar.DAY_OF_WEEK); int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); SharedPreferences sp1 = getActivity().getSharedPreferences("myPrefs", Activity.MODE_PRIVATE); int dayShowPopup = sp1.getInt("dayShowPopup", 0); /* //test data day = 7; dayShowPopup = 15; dayOfMonth = 26;*/ if (day == 7 && dayOfMonth != dayShowPopup) { SharedPreferences sp2 = getActivity().getSharedPreferences("myPrefs", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = sp2.edit(); editor.putInt("dayShowPopup", dayOfMonth); editor.commit(); final Dialog dialogRating = new Dialog(getActivity()); dialogRating.requestWindowFeature(Window.FEATURE_NO_TITLE); dialogRating.setContentView(R.layout.dlg_rating_sharing_donating); int height = 850; dialogRating.getWindow().setLayout(LinearLayout.LayoutParams.FILL_PARENT, height); dialogRating.setCancelable(true); dialogRating.show(); Button btnRate = (Button) dialogRating.findViewById(R.id.btn_rate); btnRate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Context context = getActivity().getApplicationContext(); String packageName = context.getPackageName(); Intent intentRateApp = new Intent(Intent.ACTION_VIEW); intentRateApp.setData(Uri.parse("market://details?id=" + packageName)); startActivity(intentRateApp); } }); /*Button btnRemoveAds = (Button) dialogRating.findViewById(R.id.btn_remove_ads); btnRemoveAds.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intentInAppBilling = new Intent(getActivity(), InAppBillingActivity.class); startActivity(intentInAppBilling); } });*/ Button btnShare = (Button) dialogRating.findViewById(R.id.btn_share); btnShare.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = getString(R.string.socail_share_body); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.socail_share_title)); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, getString(R.string.socail_share_via))); } }); Button btnClose = (Button) dialogRating.findViewById(R.id.btn_close); btnClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogRating.dismiss(); } }); } return view; }
From source file:com.example.android.navigationdrawer.QRCode.java
public void onQR(View v) { switch (v.getId()) { case R.id.button1: String qrInputText = MidiFile.readString; //Find screen size WindowManager manager = (WindowManager) getSystemService(WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); Point point = new Point(); display.getSize(point);/*from www. j av a 2 s . co m*/ int width = point.x; int height = point.y; int smallerDimension = width < height ? width : height; smallerDimension = smallerDimension * 3 / 4; //Encode with a QR Code image QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrInputText, null, Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), smallerDimension); try { Bitmap bitmap = qrCodeEncoder.encodeAsBitmap(); ImageView myImage = (ImageView) findViewById(R.id.imageView1); myImage.setImageBitmap(bitmap); // Get screen size Display display1 = this.getWindowManager().getDefaultDisplay(); Point size = new Point(); display1.getSize(size); int screenWidth = size.x; int screenHeight = size.y; // Get target image size Bitmap bitmap1 = qrCodeEncoder.encodeAsBitmap(); int bitmapHeight = bitmap1.getHeight(); int bitmapWidth = bitmap1.getWidth(); // Scale the image down to fit perfectly into the screen // The value (250 in this case) must be adjusted for phone/tables displays while (bitmapHeight > (screenHeight - 250) || bitmapWidth > (screenWidth - 250)) { bitmapHeight = bitmapHeight / 2; bitmapWidth = bitmapWidth / 2; } // Create resized bitmap image BitmapDrawable resizedBitmap = new BitmapDrawable(this.getResources(), Bitmap.createScaledBitmap(bitmap, bitmapWidth, bitmapHeight, false)); // Create dialog Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.thumbnail); ImageView image = (ImageView) dialog.findViewById(R.id.imageview); // !!! Do here setBackground() instead of setImageDrawable() !!! // image.setBackground(resizedBitmap); // Without this line there is a very small border around the image (1px) // In my opinion it looks much better without it, so the choice is up to you. dialog.getWindow().setBackgroundDrawable(null); dialog.show(); } catch (WriterException e) { e.printStackTrace(); } break; } }
From source file:com.pericstudio.drawit.activities.DashboardMainActivity.java
/** * Sets up the toolbar and the FAB./* ww w . jav a 2s. c o m*/ */ private void setUpToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { TextView tvName; TextView tvDes; @Override public void onClick(View view) { final Dialog testDialog = new Dialog(DashboardMainActivity.this); testDialog.setTitle("TEST TITLE!"); testDialog.setContentView(R.layout.dialog_test); tvName = (TextView) testDialog.findViewById(R.id.et_dialog_name); tvDes = (TextView) testDialog.findViewById(R.id.et_dialog_desciption); Button button = (Button) testDialog.findViewById(R.id.dialog_button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String tvNameContent = tvName.getText().toString().trim(); final String tvDesContent = tvDes.getText().toString().trim(); final Drawing drawing = new Drawing(tvNameContent, tvDesContent); drawing.save(getApplicationContext(), new Response.Listener<ObjectModificationResponse>() { @Override public void onResponse(ObjectModificationResponse modificationResponse) { //code List<String> idList = modificationResponse.getCreatedObjectIds(); final String drawingID = idList.get(0); LocallySavableCMObject.searchObjects(getApplicationContext(), SearchQuery.filter("ownerID").equal(MyApplication.userID).searchQuery(), new Response.Listener<CMObjectResponse>() { @Override public void onResponse(CMObjectResponse response) { List<CMObject> userObject = response.getObjects(); UserObjectIDs ids = (UserObjectIDs) userObject.get(0); ids.addInProgress(drawingID); MyApplication.setUserDataObject(ids); ids.save(); T.showShortDebug(getApplicationContext(), "Refresh for update"); testDialog.dismiss(); } }); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { //code } }); } }); testDialog.show(); } }); }
From source file:com.kircherelectronics.accelerationexplorer.activity.NoiseActivity.java
private void showHelpDialog() { Dialog helpDialog = new Dialog(this); helpDialog.setCancelable(true);/*from w w w.j av a2 s . c om*/ helpDialog.setCanceledOnTouchOutside(true); helpDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); View view = getLayoutInflater().inflate(R.layout.layout_help_noise, null); helpDialog.setContentView(view); helpDialog.show(); }
From source file:com.digium.respoke.GroupListActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_join) { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dialog_join_group); dialog.setTitle("Join a group"); Button dialogButton = (Button) dialog.findViewById(R.id.button1); TextView errorText = (TextView) dialog.findViewById(R.id.errorText); errorText.setText(""); // if button is clicked, close the custom dialog dialogButton.setOnClickListener(new View.OnClickListener() { @Override//from ww w . j a v a2 s.c o m public void onClick(View v) { Button connectButton = (Button) dialog.findViewById(R.id.button1); ProgressBar progressCircle = (ProgressBar) dialog.findViewById(R.id.progress_circle); EditText userInput = (EditText) dialog.findViewById(R.id.editTextDialogUserInput); String groupID = userInput.getText().toString(); if (groupID.length() > 0) { TextView errorText = (TextView) dialog.findViewById(R.id.errorText); errorText.setText(""); connectButton.setText(""); progressCircle.setVisibility(View.VISIBLE); ContactManager.sharedInstance().joinGroup(groupID, new Respoke.TaskCompletionListener() { @Override public void onSuccess() { dialog.dismiss(); } @Override public void onError(final String errorMessage) { Button connectButton = (Button) dialog.findViewById(R.id.button1); ProgressBar progressCircle = (ProgressBar) dialog .findViewById(R.id.progress_circle); TextView errorText = (TextView) dialog.findViewById(R.id.errorText); errorText.setText(errorMessage); connectButton.setText("Connect"); progressCircle.setVisibility(View.INVISIBLE); } }); } else { TextView errorText = (TextView) dialog.findViewById(R.id.errorText); errorText.setText("Group name may not be blank"); } } }); dialog.show(); return true; } return super.onOptionsItemSelected(item); }
From source file:org.anurag.compress.ExtractTarFile.java
public ExtractTarFile(final Context ctx, final Item zFile, final int width, String extractDir, final File file, final int mode) { // TODO Auto-generated constructor stub running = false;/*from w w w .j ava2 s. c o m*/ errors = false; prog = 0; read = 0; final Dialog dialog = new Dialog(ctx, Constants.DIALOG_STYLE); dialog.setCancelable(true); dialog.setContentView(R.layout.extract_file); dialog.getWindow().getAttributes().width = width; DEST = extractDir; final ProgressBar progress = (ProgressBar) dialog.findViewById(R.id.zipProgressBar); final TextView to = (TextView) dialog.findViewById(R.id.zipFileName); final TextView from = (TextView) dialog.findViewById(R.id.zipLoc); final TextView cfile = (TextView) dialog.findViewById(R.id.zipSize); final TextView zsize = (TextView) dialog.findViewById(R.id.zipNoOfFiles); final TextView status = (TextView) dialog.findViewById(R.id.zipFileLocation); if (extractDir == null) to.setText(ctx.getString(R.string.extractingto) + " Cache directory"); else to.setText(ctx.getString(R.string.extractingto) + " " + DEST); from.setText(ctx.getString(R.string.extractingfrom) + " " + file.getName()); if (mode == 2) { //TAR ENTRY HAS TO BE SHARED VIA BLUETOOTH,ETC... TextView t = null;//= (TextView)dialog.findViewById(R.id.preparing); t.setText(ctx.getString(R.string.preparingtoshare)); } try { if (file.getName().endsWith(".tar.gz")) tar = new TarArchiveInputStream(new GZIPInputStream(new FileInputStream(file))); else tar = new TarArchiveInputStream(new BufferedInputStream(new FileInputStream(file))); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); tar = null; } final Handler handle = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case 0: progress.setProgress(0); cfile.setText(ctx.getString(R.string.extractingfile) + " " + name); break; case 1: status.setText(name); progress.setProgress((int) prog); break; case 2: try { tar.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (running) { dialog.dismiss(); if (mode == 0) { //after extracting file ,it has to be opened.... new OpenFileDialog(ctx, Uri.parse(dest)); } else if (mode == 2) { //FILE HAS TO BE SHARED.... new BluetoothChooser(ctx, new File(dest).getAbsolutePath(), null); } else { if (errors) Toast.makeText(ctx, ctx.getString(R.string.errorinext), Toast.LENGTH_SHORT).show(); Toast.makeText(ctx, ctx.getString(R.string.fileextracted), Toast.LENGTH_SHORT).show(); } } break; case 3: zsize.setText(size); progress.setMax((int) max); break; case 4: status.setText(ctx.getString(R.string.preparing)); break; case 5: running = false; Toast.makeText(ctx, ctx.getString(R.string.extaborted), Toast.LENGTH_SHORT).show(); } } }; final Thread thread = new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub if (running) { if (DEST == null) { DEST = Environment.getExternalStorageDirectory() + "/Android/data/org.anurag.file.quest"; new File(DEST).mkdirs(); } TarArchiveEntry ze; try { while ((ze = tar.getNextTarEntry()) != null) { if (ze.isDirectory()) continue; handle.sendEmptyMessage(4); if (!zFile.isDirectory()) { //EXTRACTING A SINGLE FILE FROM AN ARCHIVE.... if (ze.getName().equalsIgnoreCase(zFile.t_getEntryName())) { try { //SENDING CURRENT FILE NAME.... try { name = zFile.getName(); } catch (Exception e) { name = zFile.t_getEntryName(); } handle.sendEmptyMessage(0); dest = DEST; dest = dest + "/" + name; FileOutputStream out = new FileOutputStream((dest)); max = ze.getSize(); size = AppBackup.size(max, ctx); handle.sendEmptyMessage(3); InputStream fin = tar; while ((read = fin.read(data)) != -1 && running) { out.write(data, 0, read); prog += read; name = AppBackup.status(prog, ctx); handle.sendEmptyMessage(1); } out.flush(); out.close(); fin.close(); break; } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); //errors = true; } catch (IOException e) { errors = true; } } } else { //EXTRACTING A DIRECTORY FROM TAR ARCHIVE.... String p = zFile.getPath(); if (p.startsWith("/")) p = p.substring(1, p.length()); if (ze.getName().startsWith(p)) { prog = 0; dest = DEST; name = ze.getName(); String path = name; name = name.substring(name.lastIndexOf("/") + 1, name.length()); handle.sendEmptyMessage(0); String foname = zFile.getPath(); if (!foname.startsWith("/")) foname = "/" + foname; if (!path.startsWith("/")) path = "/" + path; path = path.substring(foname.lastIndexOf("/"), path.lastIndexOf("/")); if (!path.startsWith("/")) path = "/" + path; dest = dest + path; new File(dest).mkdirs(); dest = dest + "/" + name; FileOutputStream out; try { max = ze.getSize(); out = new FileOutputStream((dest)); size = AppBackup.size(max, ctx); handle.sendEmptyMessage(3); // InputStream fin = tar; while ((read = tar.read(data)) != -1 && running) { out.write(data, 0, read); prog += read; name = AppBackup.status(prog, ctx); handle.sendEmptyMessage(1); } out.flush(); out.close(); //fin.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); // errors = true; } catch (IOException e) { errors = true; } catch (Exception e) { //errors = true; } } } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); errors = true; } handle.sendEmptyMessage(2); } } }); /* Button cancel = (Button)dialog.findViewById(R.id.calcelButton); cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub dialog.dismiss(); handle.sendEmptyMessage(5); } }); Button st = (Button)dialog.findViewById(R.id.extractButton); st.setVisibility(View.GONE);*/ dialog.show(); running = true; thread.start(); dialog.setCancelable(false); progress.setVisibility(View.VISIBLE); }
From source file:it.andreale.mdatetimepicker.date.DatePickerDialog.java
@NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { // restore old state if not null if (savedInstanceState != null) { mHeaderColor = savedInstanceState.getInt(SAVED_HEADER_COLOR, DEFAULT_ACCENT_COLOR); mSelectionColor = savedInstanceState.getInt(SAVED_SELECTION_COLOR, DEFAULT_ACCENT_COLOR); mPositiveColor = savedInstanceState.getInt(SAVED_POSITIVE_COLOR, DEFAULT_ACCENT_COLOR); mNegativeColor = savedInstanceState.getInt(SAVED_NEGATIVE_COLOR, DEFAULT_ACCENT_COLOR); mTodayColor = savedInstanceState.getInt(SAVED_TODAY_COLOR, DEFAULT_ACCENT_COLOR); mDarkTheme = savedInstanceState.getBoolean(SAVED_DARK_MODE, false); mDefaultPickerMode = savedInstanceState.getInt(SAVED_DEFAULT_MODE, DEFAULT_PICKER_MODE); mYearStart = savedInstanceState.getInt(SAVED_START_YEAR, DEFAULT_START_YEAR); mYearEnd = savedInstanceState.getInt(SAVED_END_YEAR, DEFAULT_END_YEAR); mCalendar = (Calendar) savedInstanceState.getSerializable(SAVED_CALENDAR); mHeaderDateFormat = savedInstanceState.getString(SAVED_HEADER_DATE_FORMAT, DEFAULT_HEADER_DATE_FORMAT); mPositiveText = savedInstanceState.getString(SAVED_POSITIVE_TEXT, getString(android.R.string.ok)); mNegativeText = savedInstanceState.getString(SAVED_NEGATIVE_TEXT, getString(android.R.string.cancel)); mBuilderFlag = true;// w w w . j av a 2 s .co m if (mCalendar != null) { mFirstDayOfWeek = mCalendar.getFirstDayOfWeek(); } else { mFirstDayOfWeek = DEFAULT_FIRST_DAY_OF_WEEK; } } else { mDefaultPickerMode = DEFAULT_PICKER_MODE; mCalendar.setFirstDayOfWeek(mFirstDayOfWeek); // check builder flag if (!mBuilderFlag) { throw new IllegalStateException("You must initialize DatePickerDialog throw Builder class"); } } // inflate view View view = inflatePickerView(savedInstanceState); // style views mHeaderView.setBackgroundColor(mHeaderColor); view.setBackgroundColor(mDarkTheme ? BACKGROUND_DARK : BACKGROUND_LIGHT); // create dialog Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(view); return dialog; }