From 5e3a37d0e80d84949eed73bcfca59566d442059e Mon Sep 17 00:00:00 2001 From: IvanaE Date: Fri, 9 Nov 2018 23:32:40 -0500 Subject: [PATCH] final ui changes --- .../olympusservices/EditServiceDialogFragment.java | 2 +- .../olympusservices/NewServiceDialogFragment.java | 4 ++-- .../uottawa/olympus/olympusservices/ServicesList.java | 2 +- .../app/src/main/res/layout/activity_services_list.xml | 5 ++++- .../app/src/main/res/layout/activity_sign_up.xml | 9 +++++++++ .../app/src/main/res/layout/activity_users_list.xml | 2 +- OlympusServices/app/src/main/res/layout/list_item.xml | 3 ++- OlympusServices/app/src/main/res/values/styles.xml | 2 +- 8 files changed, 21 insertions(+), 8 deletions(-) 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 75a40d6..722a410 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 @@ -61,7 +61,7 @@ public class EditServiceDialogFragment extends DialogFragment{ Bundle args = new Bundle(); args.putString("name", (String)getArguments().get("name")); EditText rateInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.RateInput); - if(rateInput.getText().toString().length()>0){ + if(rateInput.getText().toString().length()>0 && !rateInput.getText().toString().equals(".")){ Double rate = Double.parseDouble(rateInput.getText().toString()); args.putDouble("rate", rate); 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 99e2dc3..c7f63cd 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 @@ -79,7 +79,7 @@ public class NewServiceDialogFragment extends DialogFragment { EditText rateInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.RateInput); String name = nameInput.getText().toString(); DBHelper dbHelper = new DBHelper(getContext()); - if (rateInput.getText().toString().length()>0 && name.length()>0 && name.matches("[a-zA-Z]*")&& dbHelper.findService(name)==null){ + if (rateInput.getText().toString().length()>0 && !rateInput.getText().toString().equals(".") && name.length()>0 && name.matches("[a-zA-Z]*")&& dbHelper.findService(name)==null){ Double rate = Double.parseDouble(rateInput.getText().toString()); Bundle args = new Bundle(); args.putString("name", name); @@ -87,7 +87,7 @@ public class NewServiceDialogFragment extends DialogFragment { NewServiceDialogFragment.this.setArguments(args); mListener.onDialogNew(NewServiceDialogFragment.this); } - else if(!(rateInput.getText().toString().length()>0) || !(name.length()>0)|| !name.matches("[a-zA-Z]*")){ + else if(!(rateInput.getText().toString().length()>0) || !(name.length()>0)|| !name.matches("[a-zA-Z]*") || !rateInput.getText().toString().equals(".")){ Toast.makeText(getContext(), "Service must have an alphanumeric name and a rate", Toast.LENGTH_LONG).show(); } else{ 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 c391380..247d81b 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 @@ -176,7 +176,7 @@ public class ServicesList extends AppCompatActivity implements NewServiceDialogF public void onBindViewHolder(ServicesHolder holder, int position) { Service service = services[position]; holder.name.setText(service.getName()); - holder.rate.setText(""+service.getRate()); + holder.rate.setText(String.format("$%,.2f", service.getRate())); 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 d15722a..d0060b7 100644 --- a/OlympusServices/app/src/main/res/layout/activity_services_list.xml +++ b/OlympusServices/app/src/main/res/layout/activity_services_list.xml @@ -23,6 +23,7 @@ android:id="@+id/Title1" android:layout_width="300dp" android:layout_height="wrap_content" + android:paddingLeft="10dp" android:layout_marginBottom="5dp" android:layout_marginTop="10dp" android:layout_weight="1" @@ -38,7 +39,9 @@ android:layout_marginBottom="5dp" android:layout_marginTop="10dp" android:layout_weight="1" - android:text="Hourly Rate($)" + android:text="Hourly Rate" + android:gravity="end" + android:paddingRight="10dp" android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textColor="@android:color/white" android:textSize="15sp" /> diff --git a/OlympusServices/app/src/main/res/layout/activity_sign_up.xml b/OlympusServices/app/src/main/res/layout/activity_sign_up.xml index a17be8f..5282efe 100644 --- a/OlympusServices/app/src/main/res/layout/activity_sign_up.xml +++ b/OlympusServices/app/src/main/res/layout/activity_sign_up.xml @@ -12,6 +12,13 @@ android:paddingTop="@dimen/activity_vertical_margin" android:background="@drawable/background" tools:context=".SignUp"> + + + + \ No newline at end of file diff --git a/OlympusServices/app/src/main/res/layout/activity_users_list.xml b/OlympusServices/app/src/main/res/layout/activity_users_list.xml index bc8b2fb..02964ab 100644 --- a/OlympusServices/app/src/main/res/layout/activity_users_list.xml +++ b/OlympusServices/app/src/main/res/layout/activity_users_list.xml @@ -58,7 +58,7 @@ android:numColumns="2" android:textColor="@android:color/white" android:textSize="15sp" - + /> diff --git a/OlympusServices/app/src/main/res/layout/list_item.xml b/OlympusServices/app/src/main/res/layout/list_item.xml index 639148a..5cf7dd8 100644 --- a/OlympusServices/app/src/main/res/layout/list_item.xml +++ b/OlympusServices/app/src/main/res/layout/list_item.xml @@ -23,6 +23,7 @@ + android:gravity="end"/> diff --git a/OlympusServices/app/src/main/res/values/styles.xml b/OlympusServices/app/src/main/res/values/styles.xml index 0158fb3..3b46a0f 100644 --- a/OlympusServices/app/src/main/res/values/styles.xml +++ b/OlympusServices/app/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ -