use of com.rey.material.app.DialogFragment in project caronae-android by caronae.
the class RideSearchFrag method locationEt.
@OnClick(R.id.location_et)
public void locationEt() {
SimpleDialog.Builder builder = new SimpleDialog.Builder(R.style.SimpleDialogLight) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
String selectedZone = getSelectedValue().toString();
location_et.setText(selectedZone);
if (selectedZone.equals("Outros")) {
showOtherNeighborhoodDialog();
} else {
locationEt2(selectedZone);
}
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
super.onNegativeActionClicked(fragment);
}
};
builder.items(Util.getZones(), 0).title(getContext().getString(R.string.frag_rideSearch_pickZones)).positiveAction(getContext().getString(R.string.ok)).negativeAction(getContext().getString(R.string.cancel));
DialogFragment fragment = DialogFragment.newInstance(builder);
fragment.show(getFragmentManager(), null);
}
use of com.rey.material.app.DialogFragment in project caronae-android by caronae.
the class RideSearchFrag method timeEt.
@OnClick(R.id.time_et)
public void timeEt() {
Dialog.Builder builder = new TimePickerDialog.Builder(R.style.Material_App_Dialog_TimePicker_Light, 24, 0) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
TimePickerDialog dialog = (TimePickerDialog) fragment.getDialog();
time_et.setText(dialog.getFormattedTime(new SimpleDateFormat("HH:mm", Locale.US)));
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
super.onNegativeActionClicked(fragment);
}
};
builder.positiveAction(getContext().getString(R.string.ok)).negativeAction(getContext().getString(R.string.cancel));
DialogFragment fragment = DialogFragment.newInstance(builder);
fragment.show(getFragmentManager(), null);
}
use of com.rey.material.app.DialogFragment in project caronae-android by caronae.
the class RideSearchFrag method dateEt.
@OnClick(R.id.date_et)
public void dateEt() {
Dialog.Builder builder = new DatePickerDialog.Builder(R.style.Material_App_Dialog_DatePicker_Light) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
DatePickerDialog dialog = (DatePickerDialog) fragment.getDialog();
date_et.setText(dialog.getFormattedDate(new SimpleDateFormat("dd/MM/yyyy", Locale.US)));
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
super.onNegativeActionClicked(fragment);
}
};
builder.positiveAction(getContext().getString(R.string.ok)).negativeAction(getContext().getString(R.string.cancel));
DialogFragment fragment = DialogFragment.newInstance(builder);
fragment.show(getFragmentManager(), null);
}
use of com.rey.material.app.DialogFragment in project material by rey5137.
the class DialogsFragment method onClick.
@Override
public void onClick(View v) {
Dialog.Builder builder = null;
boolean isLightTheme = ThemeManager.getInstance().getCurrentTheme() == 0;
switch(v.getId()) {
case R.id.dialog_bt_title_only:
builder = new SimpleDialog.Builder(isLightTheme ? R.style.SimpleDialogLight : R.style.SimpleDialog) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "Discarded", Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "Canceled", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
builder.title("Discard draft?").positiveAction("DISCARD").negativeAction("CANCEL");
break;
case R.id.dialog_bt_msg_only:
builder = new SimpleDialog.Builder(isLightTheme ? R.style.SimpleDialogLight : R.style.SimpleDialog) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "Deleted", Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "Cancelled", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
((SimpleDialog.Builder) builder).message("Delete this conversation?").positiveAction("DELETE").negativeAction("CANCEL");
break;
case R.id.dialog_bt_title_msg:
builder = new SimpleDialog.Builder(isLightTheme ? R.style.SimpleDialogLight : R.style.SimpleDialog) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "Agreed", Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "Disagreed", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
((SimpleDialog.Builder) builder).message("Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running.").title("Use Google's location service?").positiveAction("AGREE").negativeAction("DISAGREE");
break;
case R.id.dialog_bt_custom:
builder = new SimpleDialog.Builder(isLightTheme ? R.style.SimpleDialogLight : R.style.SimpleDialog) {
@Override
protected void onBuildDone(Dialog dialog) {
dialog.layoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
EditText et_pass = (EditText) fragment.getDialog().findViewById(R.id.custom_et_password);
Toast.makeText(mActivity, "Connected. pass=" + et_pass.getText().toString(), Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "Cancelled", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
builder.title("Google Wi-Fi").positiveAction("CONNECT").negativeAction("CANCEL").contentView(R.layout.layout_dialog_custom);
break;
case R.id.dialog_bt_choice:
builder = new SimpleDialog.Builder(isLightTheme ? R.style.SimpleDialogLight : R.style.SimpleDialog) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "You have selected " + getSelectedValue() + " as phone ringtone.", Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "Cancelled", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
((SimpleDialog.Builder) builder).items(new String[] { "None", "Callisto", "Dione", "Ganymede", "Hangouts Call", "Luna", "Oberon", "Phobos" }, 0).title("Phone Ringtone").positiveAction("OK").negativeAction("CANCEL");
break;
case R.id.dialog_bt_multi_choice:
builder = new SimpleDialog.Builder(isLightTheme ? R.style.SimpleDialogLight : R.style.SimpleDialog) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
CharSequence[] values = getSelectedValues();
if (values == null)
Toast.makeText(mActivity, "You have selected nothing.", Toast.LENGTH_SHORT).show();
else {
StringBuffer sb = new StringBuffer();
sb.append("You have selected ");
for (int i = 0; i < values.length; i++) sb.append(values[i]).append(i == values.length - 1 ? "." : ", ");
Toast.makeText(mActivity, sb.toString(), Toast.LENGTH_SHORT).show();
}
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "Cancelled", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
((SimpleDialog.Builder) builder).multiChoiceItems(new String[] { "Soup", "Pizza", "Hotdogs", "Hamburguer", "Coffee", "Juice", "Milk", "Water" }, 2, 5).title("Food Order").positiveAction("OK").negativeAction("CANCEL");
break;
case R.id.dialog_bt_time:
builder = new TimePickerDialog.Builder(isLightTheme ? R.style.Material_App_Dialog_TimePicker_Light : R.style.Material_App_Dialog_TimePicker, 24, 00) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
TimePickerDialog dialog = (TimePickerDialog) fragment.getDialog();
Toast.makeText(mActivity, "Time is " + dialog.getFormattedTime(SimpleDateFormat.getTimeInstance()), Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "Cancelled", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
builder.positiveAction("OK").negativeAction("CANCEL");
break;
case R.id.dialog_bt_date:
builder = new DatePickerDialog.Builder(isLightTheme ? R.style.Material_App_Dialog_DatePicker_Light : R.style.Material_App_Dialog_DatePicker) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
DatePickerDialog dialog = (DatePickerDialog) fragment.getDialog();
String date = dialog.getFormattedDate(SimpleDateFormat.getDateInstance());
Toast.makeText(mActivity, "Date is " + date, Toast.LENGTH_SHORT).show();
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
Toast.makeText(mActivity, "Cancelled", Toast.LENGTH_SHORT).show();
super.onNegativeActionClicked(fragment);
}
};
builder.positiveAction("OK").negativeAction("CANCEL");
break;
}
DialogFragment fragment = DialogFragment.newInstance(builder);
fragment.show(getFragmentManager(), null);
}
use of com.rey.material.app.DialogFragment in project caronae-android by caronae.
the class MyProfileFrag method locationEt2.
public void locationEt2(String zone) {
SimpleDialog.Builder builder = new SimpleDialog.Builder(R.style.SimpleDialogLight) {
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
location_et.setText(getSelectedValue());
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
super.onNegativeActionClicked(fragment);
}
};
builder.items(Util.getNeighborhoods(zone), 0).title("Escolha seu bairro").positiveAction(getString(R.string.ok)).negativeAction(getString(R.string.cancel));
DialogFragment fragment = DialogFragment.newInstance(builder);
fragment.show(getFragmentManager(), null);
}
Aggregations