diff --git a/OlympusServices/.idea/caches/build_file_checksums.ser b/OlympusServices/.idea/caches/build_file_checksums.ser index 6f6e6b3..4c7ae2c 100644 Binary files a/OlympusServices/.idea/caches/build_file_checksums.ser and b/OlympusServices/.idea/caches/build_file_checksums.ser differ diff --git a/OlympusServices/app/build.gradle b/OlympusServices/app/build.gradle index de13111..313fb68 100644 --- a/OlympusServices/app/build.gradle +++ b/OlympusServices/app/build.gradle @@ -24,7 +24,7 @@ android { } dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditServiceDialogFragment.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditServiceDialogFragment.java index 3998964..2b06dc4 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditServiceDialogFragment.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditServiceDialogFragment.java @@ -7,6 +7,7 @@ import android.content.DialogInterface; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.LayoutInflater; +import android.widget.EditText; public class EditServiceDialogFragment extends DialogFragment{ @@ -44,10 +45,11 @@ public interface NoticeDialogListener { @Override public void onClick(DialogInterface dialog, int id) { Bundle args = new Bundle(); - //@anshu: get the name and rate to come from the dialog_service_new dialog args.putString("name", (String)getArguments().get("name")); - args.putDouble("rate", 2.5); - // + EditText rateInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.RateInput); + double rate = Double.parseDouble(rateInput.getText().toString()); + args.putDouble("rate", rate); + EditServiceDialogFragment.this.setArguments(args); mListener.onDialogEdit(EditServiceDialogFragment.this); } @@ -55,9 +57,8 @@ public interface NoticeDialogListener { .setNegativeButton(R.string.delete, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Bundle args = new Bundle(); - //@anshu: get the name and rate to come from the dialog_service_new dialog args.putString("name", (String)getArguments().get("name")); - // + EditServiceDialogFragment.this.setArguments(args); mListener.onDialogDelete(EditServiceDialogFragment.this); } diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/NewServiceDialogFragment.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/NewServiceDialogFragment.java index 7f0496e..a5240f5 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/NewServiceDialogFragment.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/NewServiceDialogFragment.java @@ -8,8 +8,19 @@ import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.LayoutInflater; +import android.content.res.Resources; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.view.ViewGroup; +import android.widget.EditText; +import android.view.View; + +import com.rengwuxian.materialedittext.MaterialEditText; + public class NewServiceDialogFragment extends DialogFragment { + public interface NoticeDialogListener { public void onDialogNew(DialogFragment dialog); public void onDialogNevermind(DialogFragment dialog); @@ -30,26 +41,35 @@ public class NewServiceDialogFragment extends DialogFragment { + " must implement NoticeDialogListener"); } } + + //String name = ((EditText) view.findViewById(R.id.NameInput)).getText().toString(); + //int rate = Integer.parseInt(((EditText) view.findViewById(R.id.RateInput)).getText().toString()) @Override public Dialog onCreateDialog(Bundle savedInstanceState) { + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); + View view = inflater.inflate(R.layout.dialog_service_new, null); + // Inflate and set the layout for the dialog // Pass null as the parent view because its going in the dialog layout - builder.setView(inflater.inflate(R.layout.dialog_service_new, null)) + builder.setView(view) // Add action buttons .setPositiveButton(R.string.add, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { + EditText nameInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.NameInput); + EditText rateInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.RateInput); + String name = nameInput.getText().toString(); + double rate = Double.parseDouble(rateInput.getText().toString()); Bundle args = new Bundle(); - //@anshu: get the name and rate to come from the dialog_service_new dialog - args.putString("name", "test2"); - args.putDouble("rate", 2.5); - /// + args.putString("name", name); + args.putDouble("rate", rate); NewServiceDialogFragment.this.setArguments(args); mListener.onDialogNew(NewServiceDialogFragment.this); + } }) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {