use of com.rey.material.app.Dialog in project caronae-android by caronae.
the class RideFilterFrag method showOtherNeighborhoodDialog.
public void showOtherNeighborhoodDialog() {
Dialog.Builder builder = new SimpleDialog.Builder(R.style.SimpleDialogLight) {
@Override
protected void onBuildDone(Dialog dialog) {
dialog.layoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
EditText neighborhood_et = (EditText) fragment.getDialog().findViewById(R.id.neighborhood_et);
String neighborhood = neighborhood_et.getText().toString();
if (!neighborhood.isEmpty()) {
location_et.setText(neighborhood);
location = neighborhood;
resumeLocation = neighborhood;
}
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
super.onNegativeActionClicked(fragment);
}
};
builder.title(getActivity().getString(R.string.frag_ridesearch_typeNeighborhood)).positiveAction(getString(R.string.ok)).negativeAction(getString(R.string.cancel)).contentView(R.layout.other_neighborhood);
DialogFragment fragment2 = DialogFragment.newInstance(builder);
fragment2.show(getActivity().getSupportFragmentManager(), null);
}
use of com.rey.material.app.Dialog in project caronae-android by caronae.
the class RideOfferFrag method time_et.
@OnClick(R.id.time_et)
public void time_et() {
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.Dialog in project caronae-android by caronae.
the class RideOfferFrag method showOtherNeighborhoodDialog.
public void showOtherNeighborhoodDialog() {
Dialog.Builder builder = new SimpleDialog.Builder(R.style.SimpleDialogLight) {
@Override
protected void onBuildDone(Dialog dialog) {
dialog.layoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
EditText neighborhood_et2 = (EditText) fragment.getDialog().findViewById(R.id.neighborhood_et);
String neighborhood = neighborhood_et2.getText().toString();
if (!neighborhood.isEmpty()) {
neighborhood_et.setText(neighborhood);
}
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
super.onNegativeActionClicked(fragment);
}
};
builder.title(getActivity().getString(R.string.frag_ridesearch_typeNeighborhood)).positiveAction(getString(R.string.ok)).negativeAction(getString(R.string.cancel)).contentView(R.layout.other_neighborhood);
DialogFragment fragment2 = DialogFragment.newInstance(builder);
fragment2.show(getActivity().getSupportFragmentManager(), null);
}
use of com.rey.material.app.Dialog in project caronae-android by caronae.
the class RideSearchFrag method showOtherNeighborhoodDialog.
public void showOtherNeighborhoodDialog() {
Dialog.Builder builder = new SimpleDialog.Builder(R.style.SimpleDialogLight) {
@Override
protected void onBuildDone(Dialog dialog) {
dialog.layoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
EditText neighborhood_et = (EditText) fragment.getDialog().findViewById(R.id.neighborhood_et);
String neighborhood = neighborhood_et.getText().toString();
if (!neighborhood.isEmpty()) {
location_et.setText(neighborhood);
}
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
super.onNegativeActionClicked(fragment);
}
};
builder.title(getActivity().getString(R.string.frag_ridesearch_typeNeighborhood)).positiveAction(getString(R.string.ok)).negativeAction(getString(R.string.cancel)).contentView(R.layout.other_neighborhood);
DialogFragment fragment2 = DialogFragment.newInstance(builder);
fragment2.show(getActivity().getSupportFragmentManager(), null);
}
use of com.rey.material.app.Dialog in project caronae-android by caronae.
the class ProfileAct method reportBt.
@OnClick(R.id.report_bt)
public void reportBt() {
Dialog.Builder builder = new SimpleDialog.Builder(R.style.SimpleDialogLight) {
@Override
protected void onBuildDone(Dialog dialog) {
dialog.layoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
@Override
public void onPositiveActionClicked(DialogFragment fragment) {
EditText msg_et = (EditText) fragment.getDialog().findViewById(R.id.msg_et);
String msg = msg_et.getText().toString();
if (msg.isEmpty()) {
Util.toast(getString(R.string.frag_falae_msgblank));
return;
}
msg = msg + "\n\n--------------------------------\n" + "Device: " + android.os.Build.MODEL + " (Android " + android.os.Build.VERSION.RELEASE + ")\n" + "Versão do app: " + Util.getAppVersionName(getBaseContext());
CaronaeAPI.service(getApplicationContext()).falaeSendMessage(new FalaeMsgForJson(getString(R.string.frag_falae_reportRb) + user.getName() + " - ID:" + user.getDbId(), msg)).enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
if (response.isSuccessful()) {
Util.toast(getString(R.string.act_profile_reportOk));
Log.i("falaeSendMessage", "falae message sent succesfully");
} else {
Util.treatResponseFromServer(response);
Util.toast(getString(R.string.frag_falae_errorSent));
Log.e("falaeSendMessage", response.message());
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
Util.toast(getString(R.string.frag_falae_errorSent));
Log.e("falaeSendMessage", t.getMessage());
}
});
super.onPositiveActionClicked(fragment);
}
@Override
public void onNegativeActionClicked(DialogFragment fragment) {
super.onNegativeActionClicked(fragment);
}
};
String name = user.getName().split(" ")[0];
builder.title("Reportar " + name).positiveAction(getString(R.string.send_bt)).negativeAction(getString(R.string.cancel)).contentView(R.layout.report_dialog);
DialogFragment fragment = DialogFragment.newInstance(builder);
fragment.show(getSupportFragmentManager(), null);
}
Aggregations