Search in sources :

Example 6 with Dialog

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);
}
Also used : EditText(android.widget.EditText) AlertDialog(android.support.v7.app.AlertDialog) SimpleDialog(com.rey.material.app.SimpleDialog) Dialog(com.rey.material.app.Dialog) DialogFragment(com.rey.material.app.DialogFragment)

Example 7 with Dialog

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);
}
Also used : TimePickerDialog(com.rey.material.app.TimePickerDialog) ProgressDialog(android.app.ProgressDialog) AlertDialog(android.support.v7.app.AlertDialog) DatePickerDialog(com.rey.material.app.DatePickerDialog) SimpleDialog(com.rey.material.app.SimpleDialog) Dialog(com.rey.material.app.Dialog) DialogFragment(com.rey.material.app.DialogFragment) TimePickerDialog(com.rey.material.app.TimePickerDialog) SimpleDateFormat(java.text.SimpleDateFormat) OnClick(butterknife.OnClick)

Example 8 with Dialog

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);
}
Also used : EditText(android.widget.EditText) TimePickerDialog(com.rey.material.app.TimePickerDialog) ProgressDialog(android.app.ProgressDialog) AlertDialog(android.support.v7.app.AlertDialog) DatePickerDialog(com.rey.material.app.DatePickerDialog) SimpleDialog(com.rey.material.app.SimpleDialog) Dialog(com.rey.material.app.Dialog) DialogFragment(com.rey.material.app.DialogFragment)

Example 9 with Dialog

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);
}
Also used : EditText(android.widget.EditText) TimePickerDialog(com.rey.material.app.TimePickerDialog) ProgressDialog(android.app.ProgressDialog) AlertDialog(android.support.v7.app.AlertDialog) DatePickerDialog(com.rey.material.app.DatePickerDialog) SimpleDialog(com.rey.material.app.SimpleDialog) Dialog(com.rey.material.app.Dialog) DialogFragment(com.rey.material.app.DialogFragment)

Example 10 with Dialog

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);
}
Also used : EditText(android.widget.EditText) DialogFragment(com.rey.material.app.DialogFragment) FalaeMsgForJson(br.ufrj.caronae.models.modelsforjson.FalaeMsgForJson) ResponseBody(okhttp3.ResponseBody) AlertDialog(android.support.v7.app.AlertDialog) SimpleDialog(com.rey.material.app.SimpleDialog) Dialog(com.rey.material.app.Dialog) OnClick(butterknife.OnClick)

Aggregations

Dialog (com.rey.material.app.Dialog)12 DialogFragment (com.rey.material.app.DialogFragment)12 SimpleDialog (com.rey.material.app.SimpleDialog)12 AlertDialog (android.support.v7.app.AlertDialog)10 ProgressDialog (android.app.ProgressDialog)8 DatePickerDialog (com.rey.material.app.DatePickerDialog)7 TimePickerDialog (com.rey.material.app.TimePickerDialog)7 OnClick (butterknife.OnClick)5 EditText (android.widget.EditText)4 SimpleDateFormat (java.text.SimpleDateFormat)4 Intent (android.content.Intent)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 RadioGroup (android.widget.RadioGroup)1 TextView (android.widget.TextView)1 Ride (br.ufrj.caronae.models.Ride)1 RideRequestReceived (br.ufrj.caronae.models.RideRequestReceived)1 User (br.ufrj.caronae.models.User)1 FalaeMsgForJson (br.ufrj.caronae.models.modelsforjson.FalaeMsgForJson)1