private void setDialog() { dialogUpload = new Dialog(Main.this); dialogUpload.requestWindowFeature(Window.FEATURE_NO_TITLE); dialogUpload.setContentView(R.layout.upload); dialogVideoInfo = new Dialog(Main.this); dialogVideoInfo.requestWindowFeature(Window.FEATURE_NO_TITLE); dialogVideoInfo.setContentView(R.layout.video_info); dialogUploadSuccess = new Dialog(Main.this); dialogUploadSuccess.requestWindowFeature(Window.FEATURE_NO_TITLE); dialogUploadSuccess.setContentView(R.layout.succsess_upload); }
private void showUnitSpinner(final String[] data) { final Dialog a = new Dialog(this); Window w = a.getWindow(); a.requestWindowFeature(Window.FEATURE_NO_TITLE); a.setContentView(R.layout.spinner); w.setBackgroundDrawableResource(android.R.color.transparent); TextView lblselect = (TextView) w.findViewById(R.id.dialogtitle); lblselect.setTypeface(Utils.getBold(getActivity())); lblselect.setText(R.string.unit_selection); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, data); ListView lv = (ListView) w.findViewById(R.id.lvSpinner); lv.setAdapter(adapter); lv.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterview, View view, int position, long l) { a.dismiss(); Utils.setPref(getActivity(), Constant.SELECTED_UNIT_STORAGE, data[position]); mAdapter.addAll(converter.getFavUnit()); tvUnitSelVal.setText(data[position]); } }); a.show(); }
private void openDialog() { final Dialog dialog = new Dialog(ActivityBrightness.this, android.R.style.Theme_Translucent); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_menu); dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation; Button ButtonInfo = (Button) dialog.getWindow().findViewById(R.id.button1); Button ButtonMenuCancel = (Button) dialog.getWindow().findViewById(R.id.ButtonMenuCancel); Button ButtonMenuSettings = (Button) dialog.getWindow().findViewById(R.id.ButtonMenuSettings); ButtonMenuSettings.setTypeface(typefaceRoman); ButtonMenuCancel.setTypeface(typefaceMedium); ButtonInfo.setTypeface(typefaceRoman); ButtonInfo.setText(R.string.menu_info_main); ButtonMenuCancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); ButtonMenuSettings.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { launchIntent(); } }); dialog.show(); }
public void openDialog() { final Dialog dialog = new Dialog(CreateChannelActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.custom_dialog_for_upload_photo); TextView gallery, camera; gallery = (TextView) dialog.findViewById(R.id.gallery); camera = (TextView) dialog.findViewById(R.id.camera); gallery.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { chooseImage(); } }); camera.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { takePicture(); } }); dialog.show(); }
public static void showSuccess(Context context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.success_dialog); TextView title = (TextView) dialog.findViewById(R.id.title); TextView msg = (TextView) dialog.findViewById(R.id.msg); title.setText(Globals.getTranslation("SUCCESS")); msg.setText(Globals.getTranslation("SUCCESS_MESSAGE")); TextView tv = (TextView) dialog.findViewById(R.id.dialogText); tv.setText(Globals.getTranslation("OK")); LinearLayout dialogButton = (LinearLayout) dialog.findViewById(R.id.okbtn); // if button is clicked, close the custom dialog dialogButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Log.d("SUCCESS OK", "OK"); dialog.hide(); dialog.dismiss(); // dialog = null; } }); dialog.show(); }
public void showDialog(String id, String name) { this.arName = name; this.arId = id; myDialog = new Dialog(getParent()); myDialog .getWindow() .setFlags( WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND); myDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); myDialog.setContentView(R.layout.artist_options_dialog); TextView tv = (TextView) myDialog.findViewById(R.id.txtName); tv.setText(name); Button button = (Button) myDialog.findViewById(R.id.btnBio); button.setOnClickListener( new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub // showBio(arId,arName); } }); Button button1 = (Button) myDialog.findViewById(R.id.btnEvents); button1.setOnClickListener( new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub showEvents(arId, arName); } }); myDialog.show(); }
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); return dialog; }
public static Dialog createLoadingDialog( Context context, String msg, int be_downloaded_byte, int total_byte, boolean cancelable) { LayoutInflater inflater = LayoutInflater.from(context); // load dialog layout View view = inflater.inflate(R.layout.loading_dialog, null); // load layout linear LinearLayout layout = (LinearLayout) view.findViewById(R.id.download_dialog); if (be_downloaded_byte != NON_DOWNLOAD_TAG) { ImageView running = (ImageView) view.findViewById(R.id.loading_image); running.setImageResource(R.drawable.taipower_boy1_running1); TextView loading_percent = (TextView) view.findViewById(R.id.loading_data_progress); loading_percent.setText( String.valueOf(be_downloaded_byte) + "/" + String.valueOf(total_byte)); } else { // load layout ImageView ImageView cycle_image_view = (ImageView) view.findViewById(R.id.loading_image); // mount animation Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(context, R.anim.loading_animation); // ImageView to animation cycle_image_view.startAnimation(hyperspaceJumpAnimation); } TextView loading_text = (TextView) view.findViewById(R.id.loading_text); loading_text.setText(msg); // new dialog Dialog loadingDialog = new Dialog(context, R.style.loading_style); // Dialog loadingDialog = new Dialog(context); loadingDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); loadingDialog.setCancelable(false); loadingDialog.setContentView( view, new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); if (cancelable) { loadingDialog.setOnKeyListener( new DialogInterface.OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK) dialog.dismiss(); return false; } }); } loadingDialog.show(); return loadingDialog; }
private Dialog listTypeDialog() { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_list_type); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); final EditText name = (EditText) dialog.findViewById(R.id.name); final Button list = (Button) dialog.findViewById(R.id.button); Button note = (Button) dialog.findViewById(R.id.button2); list.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { handleListCreating(name.getText().toString().trim(), true); dialog.dismiss(); } }); note.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { handleListCreating(name.getText().toString().trim(), false); dialog.dismiss(); } }); return dialog; }
/** Binds the android versions to the dropdrown pop up view */ private void bindAndroidVersions() { hideToolTip(); final Dialog dialog = new Dialog(AddDeviceActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.pop_up_android_versions); final ListView list = (ListView) dialog.findViewById(R.id.list); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); final List<AndroidHistory> androidVersionList = mDbHelper.getAndroidVersions(" ASC "); AndroidVersionsAdapter adapter = new AndroidVersionsAdapter( ShowCaseApp.getAppContext(), R.layout.individual_row_android_versions, androidVersionList); list.setAdapter(adapter); list.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { list.setPressed(true); dialog.dismiss(); mAndroidVersionId = androidVersionList.get(position).getAndroidId(); mEtAndroidVersion.setText(androidVersionList.get(position).getName()); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); } }); dialog.setCancelable(true); dialog.show(); }
private void showAppDialog() { // TODO Auto-generated method stub dDialog = new Dialog(this); dDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dDialog.setContentView(R.layout.dialog_sidebar_app); dProgressBar = (ProgressBar) dDialog.findViewById(R.id.progressBar1); dListView = (ListView) dDialog.findViewById(R.id.dialog_sidebar_id); dSearch = (EditText) dDialog.findViewById(R.id.searchText); dButton = (ImageButton) dDialog.findViewById(R.id.searchButton); dAdapter = new AppAdapter(this, dProgressBar); dListView.setAdapter(dAdapter); dListView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> v, View arg1, int pos, long arg3) { AppItem info = (AppItem) v.getItemAtPosition(pos); addApp(info.packageName); dDialog.dismiss(); } }); dButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dAdapter.getFilter().filter(dSearch.getText().toString()); } }); dAdapter.update(); }
@Override public void onBackPressed() { if (show) { TaskManager.getInstance().removeTaskEventListener(this); startActivity( new Intent( getApplicationContext(), com.indago.helpme.gui.dashboard.HelpERControlcenterActivity.class)); finish(); } else { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_call_dismiss); TextView text; String string; Button button; text = (TextView) dialog.findViewById(R.id.dialog_title); string = getResources().getString(R.string.dialog_call_dismiss_title); text.setText(Html.fromHtml(string)); text = (TextView) dialog.findViewById(R.id.dialog_text); string = getResources().getString(R.string.dialog_call_dismiss_text); text.setText(Html.fromHtml(string)); button = (Button) dialog.findViewById(R.id.dialog_button_no); button.setText("No"); button.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); button = (Button) dialog.findViewById(R.id.dialog_button_yes); button.setText("Yes"); button.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { TaskManager.getInstance().getTask().setFailed(); TaskManager.getInstance().stopTask(); startActivity( new Intent( getApplicationContext(), com.indago.helpme.gui.dashboard.HelpERControlcenterActivity.class)); finish(); } }); dialog.show(); } }
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Get the layout inflater Bundle args = getArguments(); LayoutInflater inflater = getActivity().getLayoutInflater(); Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.popup_window_tag); TextView title = (TextView) dialog.findViewById(R.id.tag_title); TextView description = (TextView) dialog.findViewById(R.id.tag_description); ImageView searchIcon = (ImageView) dialog.findViewById(R.id.search_tag_icon); TextView searchTV = (TextView) dialog.findViewById(R.id.search_tag); ImageView followIcon = (ImageView) dialog.findViewById(R.id.follow_tag_icon); TextView followTV = (TextView) dialog.findViewById(R.id.follow_tag); title.setText(args.getString("tagName")); description.setText(args.getString("tagDesc")); boolean isFollowed = args.getBoolean("isFollowed"); if (isFollowed) followTV.setText("Unfollow"); else followTV.setText("Follow"); searchIcon.setOnClickListener(DIALOG_TAG_CLICK_LISTENER); searchTV.setOnClickListener(DIALOG_TAG_CLICK_LISTENER); followIcon.setOnClickListener(DIALOG_TAG_CLICK_LISTENER); followTV.setOnClickListener(DIALOG_TAG_CLICK_LISTENER); return dialog; }
/** Handles the confirmation/canceling of clearing */ public void handleClear() { final Dialog dialog = new Dialog(cont, R.style.RoundCornersFull); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.clear_popup); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(dialog.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.MATCH_PARENT; dialog.getWindow().setAttributes(lp); dialog.show(); Button cancel = (Button) dialog.findViewById(R.id.clear_cancel); cancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); Button confirm = (Button) dialog.findViewById(R.id.clear_confirm); confirm.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); stats.clearData(); fillDataEmpty(); } }); }
// 录音时显示Dialog void showVoiceDialog(int flag) { if (mRecordDialog == null) { mRecordDialog = new Dialog(ChatActivity.this, R.style.DialogStyle); mRecordDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mRecordDialog .getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); mRecordDialog.setContentView(R.layout.record_dialog); mIvRecVolume = (ImageView) mRecordDialog.findViewById(R.id.record_dialog_img); mTvRecordDialogTxt = (TextView) mRecordDialog.findViewById(R.id.record_dialog_txt); } switch (flag) { case 1: mIvRecVolume.setImageResource(R.mipmap.record_cancel); mTvRecordDialogTxt.setText("松开手指可取消录音"); break; default: mIvRecVolume.setImageResource(R.mipmap.record_animate_01); mTvRecordDialogTxt.setText("向下滑动可取消录音"); break; } mTvRecordDialogTxt.setTextSize(14); mRecordDialog.show(); }
private Dialog removeDialog(final boolean isPrivate) { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_delete); TextView textView = (TextView) dialog.findViewById(R.id.textView); Button no = (Button) dialog.findViewById(R.id.nie); Button yes = (Button) dialog.findViewById(R.id.tak); textView.setText("Usunąć kupione artykuły?"); no.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); yes.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { handleItemsRemoving(isPrivate); dialog.dismiss(); } }); return dialog; }
public static Dialog getTwoBtnDialog(Activity activity, String title, String msg) { final Dialog dialog = new Dialog(activity, android.R.style.Theme_Translucent_NoTitleBar); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.r_okcanceldialogview); ((TextView) dialog.findViewById(R.id.dialog_title)).setText(title); ((TextView) dialog.findViewById(R.id.dialog_message)).setText(msg); ((Button) dialog.findViewById(R.id.ok)).setText(android.R.string.ok); ((Button) dialog.findViewById(R.id.cancel)).setText(android.R.string.cancel); ((Button) dialog.findViewById(R.id.cancel)) .setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // write your code to do things after users clicks // CANCEL dialog.dismiss(); } }); return dialog; // ((Button) dialog.findViewById(R.id.ok)) // .setOnClickListener(new OnClickListener() { // // @Override // public void onClick(View v) { // // write your code to do things after users clicks OK // // dialog.dismiss(); // } // }); // dialog.show(); }
private Dialog deleteDialog() { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_delete); Button no = (Button) dialog.findViewById(R.id.nie); Button yes = (Button) dialog.findViewById(R.id.tak); no.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); yes.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { removeNote = true; lists.remove(listId); dialog.dismiss(); onBackPressed(); } }); return dialog; }
private void showDialog() { final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true); dialog.setContentView(R.layout.dialog_version); TextView textView = (TextView) dialog.findViewById(R.id.dialog_text); textView.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { dialog.dismiss(); } }); StringBuilder sb = new StringBuilder(); sb.append(PhoneUtils.getApplicationName(getActivity())) .append("<br/>") .append("Version:") .append(PhoneUtils.getPackageInfo(getActivity()).versionName) .append("<br/>") .append("by <a href='") .append(Constants.GITHUB_NAME) .append("'>@Cundong</a>"); CharSequence charSequence = Html.fromHtml(sb.toString()); textView.setText(charSequence); textView.setMovementMethod(LinkMovementMethod.getInstance()); dialog.show(); }
private Dialog renameDialog(final Fragment currentFragment) { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_change_name); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); Button cancel = (Button) dialog.findViewById(R.id.anuluj); Button confirm = (Button) dialog.findViewById(R.id.zatwierdz); final EditText newName = (EditText) dialog.findViewById(R.id.name); cancel.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(MainActivity.this, "Anulowano", Toast.LENGTH_SHORT).show(); dialog.dismiss(); } }); confirm.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { if (!Utils.isEmpty(MainActivity.this, newName)) { handleNameChange(currentFragment, newName.getText().toString().trim()); dialog.dismiss(); } } }); return dialog; }
/** [Give the description for method]. */ public void showDialog() { mDialog = new Dialog(context); mDialog.setTitle(""); mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.setContentView(R.layout.dialog_gps); mDialog.setCancelable(true); LinearLayout chat = (LinearLayout) mDialog.findViewById(R.id.line_dialog_gps_chat); LinearLayout info = (LinearLayout) mDialog.findViewById(R.id.line_dialog_gps_info); chat.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(context, ChatActivity.class); context.startActivity(i); } }); info.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(context, ChatActivity.class); context.startActivity(i); } }); mDialog.show(); }
public static void showFailCheck(Context context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.success_dialog); ImageView iv = (ImageView) dialog.findViewById(R.id.image); iv.setImageDrawable(context.getResources().getDrawable(R.drawable.fail)); LinearLayout dialogButton = (LinearLayout) dialog.findViewById(R.id.okbtn); TextView tv = (TextView) dialog.findViewById(R.id.dialogText); tv.setText(Globals.getTranslation("OK")); TextView title = (TextView) dialog.findViewById(R.id.title); TextView msg = (TextView) dialog.findViewById(R.id.msg); title.setText(Globals.getTranslation("FAIL")); msg.setText(Globals.getTranslation("ERROR_MESSAGE")); // if button is clicked, close the custom dialog dialogButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Log.d("FAIL OK", "OK"); dialog.hide(); dialog.dismiss(); // dialog = null; } }); dialog.show(); }
public static Dialog showProgressDialog(Context mContext, String text, boolean cancelable) { Dialog mDialog = new Dialog(mContext, R.style.ProgressBarTheme); mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); LayoutInflater mInflater = LayoutInflater.from(mContext); mDialog .getWindow() .setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); View layout = mInflater.inflate(R.layout.custom_progressbar, null); mDialog.setContentView(layout); TextView tvProgressMessage = (TextView) layout.findViewById(R.id.tvProgressMessage); if (text.equals("")) tvProgressMessage.setVisibility(View.GONE); else tvProgressMessage.setText(text); mDialog.setCancelable(cancelable); mDialog.setCanceledOnTouchOutside(false); /* * mDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND * ); */ mDialog.show(); return mDialog; }
public Dialog createParticipantsDialog( final MainActivity activity, final BusHandler busHandler, String groupName) { Log.i(TAG, "createParticipantsDialog()"); final Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.peersdialog); ArrayAdapter<String> peersListAdapter = new ArrayAdapter<String>(activity, android.R.layout.test_list_item); final ListView peersList = (ListView) dialog.findViewById(R.id.peerList); peersList.setAdapter(peersListAdapter); // Call getParticipants List<String> peers = busHandler.getParticipants(groupName); for (String peer : peers) { peersListAdapter.add(peer); } peersListAdapter.notifyDataSetChanged(); Button ok = (Button) dialog.findViewById(R.id.closeButton); ok.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { activity.removeDialog(MainActivity.DIALOG_GET_PEERS_ID); } }); return dialog; }
public void onClickImg(View v) { // open popupwindow here final Dialog myDialog = new Dialog(this); myDialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); View view = LayoutInflater.from(this).inflate(R.layout.popup, null); final RadioGroup radio = (RadioGroup) view.findViewById(R.id.radioGroup1); final RadioButton r1 = (RadioButton) view.findViewById(R.id.radio0); final RadioButton r2 = (RadioButton) view.findViewById(R.id.radio1); final RadioButton r3 = (RadioButton) view.findViewById(R.id.radio2); Button exit = (Button) view.findViewById(R.id.button1); exit.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { int selectedID = radio.getCheckedRadioButtonId(); if (selectedID == r1.getId()) sortBy = "relevance"; if (selectedID == r2.getId()) sortBy = "ranking"; if (selectedID == r3.getId()) sortBy = "recent"; myDialog.dismiss(); } }); myDialog.setContentView(view); myDialog.setTitle("settings"); myDialog.show(); myDialog.getWindow().setLayout(580, 540); // Controlling width and // height. }
/** * Creates an wheelView (Dialog) so the user can set the date and time. Requires wheel_src library * project. * * @param Context to show in * @param Time to show in milliseconds * @return Dialog */ public Dialog showDateDialog(Context in, long timeinms) { Dialog timeDialog = new Dialog(in); timeDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); timeDialog.setContentView(R.layout.time2_layout); LayoutParams params = timeDialog.getWindow().getAttributes(); params.width = LayoutParams.FILL_PARENT; timeDialog.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); boolean tf = false; tf = sp.getBoolean("prefs_time_24", true); int nhours = 23; int startH = 0; if (tf) { nhours = 23; startH = 0; } else { startH = 1; nhours = 12; } final WheelView hours = (WheelView) timeDialog.findViewById(R.id.hour); NumericWheelAdapter hourAdapter = new NumericWheelAdapter(TimeClock.this, startH, nhours); hourAdapter.setItemResource(R.layout.wheel_text_item); hourAdapter.setItemTextResource(R.id.text); hours.setViewAdapter(hourAdapter); final WheelView mins = (WheelView) timeDialog.findViewById(R.id.mins); NumericWheelAdapter minAdapter = new NumericWheelAdapter(TimeClock.this, 0, 59, "%02d"); minAdapter.setItemResource(R.layout.wheel_text_item); minAdapter.setItemTextResource(R.id.text); mins.setViewAdapter(minAdapter); mins.setCyclic(true); final WheelView ampm = (WheelView) timeDialog.findViewById(R.id.ampm); ArrayWheelAdapter<String> ampmAdapter = new ArrayWheelAdapter<String>(TimeClock.this, new String[] {"AM", "PM"}); ampmAdapter.setItemResource(R.layout.wheel_text_item); ampmAdapter.setItemTextResource(R.id.text); ampm.setViewAdapter(ampmAdapter); // set current time Calendar calendar = Calendar.getInstance(Locale.US); calendar.setTimeInMillis(timeinms); mins.setCurrentItem(calendar.get(Calendar.MINUTE)); ampm.setCurrentItem(calendar.get(Calendar.AM_PM)); if (tf) { hours.setCurrentItem(calendar.get(Calendar.HOUR_OF_DAY)); ampm.setVisibility(View.GONE); } else { hours.setCurrentItem(calendar.get(Calendar.HOUR) - 1); ampm.setVisibility(View.VISIBLE); } final WheelView day = (WheelView) timeDialog.findViewById(R.id.day); day.setViewAdapter(new DayArrayAdapter(TimeClock.this, calendar)); day.setCurrentItem(20); return timeDialog; }
/** * Show dialog with available (authenticated) network (cloud) accounts for certain cloud type. * * @param networkType selected cloud type */ private void showSelectAccountDialog(final NetworkEnum networkType, final MainPanel panel) { if (panel == null || panel.getActivity() == null) { // very weired situation; try to avoid crash. return; } final Dialog dialog = new Dialog(panel.getActivity(), R.style.Action_Dialog); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); View dialogView = View.inflate(App.sInstance.getApplicationContext(), R.layout.network_type_chooser, null); ((TextView) dialogView.findViewById(R.id.network_dialog_title)) .setText(App.sInstance.getString(R.string.action_select_account)); final ListView networks = (ListView) dialogView.findViewById(R.id.network_types); NetworkApi api = App.sInstance.getNetworkApi(networkType); final BaseAdapter adapter = new NetworkAccountChooserAdapter( api, new NetworkAccountChooserAdapter.OnDeleteItemListener() { @Override public void onAccountDelete(NetworkAccount account) { NetworkAccountDbAdapter.delete(account.getId()); ((NetworkAccountChooserAdapter) networks.getAdapter()).dataSetChanged(); } }); networks.setAdapter(adapter); dialogView .findViewById(R.id.cancel) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); networks.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { openNetworkAccount((NetworkAccount) view.getTag(), null, panel); if (dialog.isShowing()) { dialog.dismiss(); } } }); dialog.setContentView(dialogView); dialog.show(); adjustDialogSize(dialog, panel); }
void showAlertWithDeleteMessage(String message, Context context, final DBNoteItems dbNoteItems) { final Dialog dialog = new Dialog(context); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // inflate your activity layout here! View contentView = inflater.inflate(R.layout.alert_view, null, false); TextView textViewTitleAlert = (TextView) contentView.findViewById(R.id.textViewTitleAlert); textViewTitleAlert.setText("" + dbNoteItems.getNote_Title()); textViewTitleAlert.setTextColor(Color.WHITE); TextView textViewTitleAlertMessage = (TextView) contentView.findViewById(R.id.textViewTitleAlertMessage); textViewTitleAlertMessage.setText(message); Button buttonAlertCancel = (Button) contentView.findViewById(R.id.buttonAlertCancel); Button buttonAlertOk = (Button) contentView.findViewById(R.id.buttonAlertOk); buttonAlertCancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub dialog.dismiss(); } }); buttonAlertOk.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub boolean status = androidOpenDbHelperObj.deleteNote(dbNoteItems.getNote_Id()); if (status == true) { Toast.makeText( FolderNoteListMainActivity.this, "Note deleted successfully", Toast.LENGTH_SHORT) .show(); getallNotes(); } else { Toast.makeText( FolderNoteListMainActivity.this, "Note deleted unsuccessfully", Toast.LENGTH_SHORT) .show(); } dialog.dismiss(); } }); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(false); dialog.setContentView(contentView); dialog.show(); }
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog d = new Dialog(getActivity(), android.R.style.Theme); d.getWindow().setBackgroundDrawable(new ColorDrawable(android.R.color.transparent)); d.requestWindowFeature(Window.FEATURE_NO_TITLE); return d; }
// Metodo que despliega un DatePicker para seleccionar la fecha del filtro. public void abrirDialogoFecha() { // Se crea una ventana de dialogo tomando en cuenta un layout que contiene un DatePicker y tres // botones (Aceptar, Reset y Cancelar). final Dialog dialogoFecha = new Dialog(this); LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); final RelativeLayout vistaDialogoFecha = (RelativeLayout) inflater.inflate(R.layout.fecha, null); final Button boton1 = (Button) vistaDialogoFecha.findViewById(R.id.Aceptar); final Button boton2 = (Button) vistaDialogoFecha.findViewById(R.id.Reset); final Button boton3 = (Button) vistaDialogoFecha.findViewById(R.id.Cancelar); final DatePicker datePicker = (DatePicker) vistaDialogoFecha.findViewById(R.id.DatePicker); // Para el boton "Aceptar", se toma la fecha establecida por el usuario a partir del DatePicker // y // Se guarda el valor de la fecha en la variable fecha. boton1.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { datePicker.clearFocus(); annio = datePicker.getYear(); mes = datePicker.getMonth() + 1; dia = datePicker.getDayOfMonth(); dialogoFecha.dismiss(); Toast.makeText( getBaseContext(), "Fecha: " + reacomodar(annio) + "-" + reacomodar(mes) + "-" + reacomodar(dia), Toast.LENGTH_SHORT) .show(); fecha = reacomodar(annio) + "-" + reacomodar(mes) + "-" + reacomodar(dia); } }); // Para el boton "Reset", se reestablecen los valores del DatePicker. boton2.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { final Calendar c = Calendar.getInstance(); datePicker.updateDate( c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)); } }); // Para el boton "Cancelar", se desaparece la ventana de Dialogo. boton3.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { dialogoFecha.cancel(); } }); // Se establece la vista para la ventana y se muestra. dialogoFecha.requestWindowFeature(Window.FEATURE_NO_TITLE); dialogoFecha.setContentView(vistaDialogoFecha); dialogoFecha.show(); }