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 ecdd495..3998964 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 @@ -45,7 +45,7 @@ public interface NoticeDialogListener { 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", "hey"); + args.putString("name", (String)getArguments().get("name")); args.putDouble("rate", 2.5); // EditServiceDialogFragment.this.setArguments(args); @@ -56,12 +56,13 @@ public interface NoticeDialogListener { 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", "hey"); + args.putString("name", (String)getArguments().get("name")); // EditServiceDialogFragment.this.setArguments(args); mListener.onDialogDelete(EditServiceDialogFragment.this); } - }); + }) + .setTitle((String)getArguments().get("name")); return builder.create(); } } diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServicesList.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServicesList.java index 67b9d7b..db0cd9e 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServicesList.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServicesList.java @@ -53,9 +53,12 @@ public class ServicesList extends AppCompatActivity implements NewServiceDialogF DialogFragment newFragment = new NewServiceDialogFragment(); newFragment.show(getSupportFragmentManager(), "addService"); } - public void editService(View view) { + public void editService(View view, String name) { DialogFragment newFragment = new EditServiceDialogFragment(); newFragment.show(getSupportFragmentManager(), "editService"); + Bundle args = new Bundle(); + args.putString("name", name); + newFragment.setArguments(args); } //add new service @Override @@ -146,7 +149,9 @@ public class ServicesList extends AppCompatActivity implements NewServiceDialogF } @Override public void onClick(View view) { - editService(view); + TextView nameview = (TextView)view.findViewById(R.id.Name); + String name = nameview.getText().toString(); + editService(view, name); } diff --git a/OlympusServices/app/src/main/res/layout/activity_services_list.xml b/OlympusServices/app/src/main/res/layout/activity_services_list.xml index 0b8de40..03bbcf4 100644 --- a/OlympusServices/app/src/main/res/layout/activity_services_list.xml +++ b/OlympusServices/app/src/main/res/layout/activity_services_list.xml @@ -50,7 +50,7 @@ android:layout_marginBottom="5dp" android:layout_marginTop="10dp" android:layout_weight="1" - android:text="Rate" + android:text="Hourly Rate" android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textColor="@android:color/white" android:textSize="15sp" /> diff --git a/OlympusServices/app/src/main/res/layout/dialog_service_edit.xml b/OlympusServices/app/src/main/res/layout/dialog_service_edit.xml index 9ef5359..0252681 100644 --- a/OlympusServices/app/src/main/res/layout/dialog_service_edit.xml +++ b/OlympusServices/app/src/main/res/layout/dialog_service_edit.xml @@ -5,21 +5,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"> - //component used from https://github.com/rengwuxian/MaterialEditText - //component used from https://github.com/rengwuxian/MaterialEditText