From daf7e4133a4ba53b92a7b0d47fd43d6f4aff28d9 Mon Sep 17 00:00:00 2001 From: IvanaE Date: Fri, 16 Nov 2018 14:37:35 -0500 Subject: [PATCH] added general description to front end --- .../olympus/olympusservices/EditProfile.java | 6 ++++++ .../olympus/olympusservices/ServiceProvider.java | 6 ++++++ .../src/main/res/layout/activity_edit_profile.xml | 14 ++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditProfile.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditProfile.java index ebc3d41..3fd358d 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditProfile.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditProfile.java @@ -27,6 +27,7 @@ public class EditProfile extends AppCompatActivity { TextView companyname = findViewById(R.id.CompanyNameInput); TextView address = findViewById(R.id.AddressInput); TextView phonenumber = findViewById(R.id.PhoneNumberInput); + TextView description = findViewById(R.id.DescriptionInput); CheckBox licensed = findViewById(R.id.LicensedInput); @@ -36,9 +37,11 @@ public class EditProfile extends AppCompatActivity { companyname.setText(user.getCompanyname()); address.setText(user.getAddress()); phonenumber.setText(user.getPhonenumber()); + description.setText(user.getDescription()); licensed.setChecked(user.isLicensed()); + } /** @@ -60,6 +63,7 @@ public class EditProfile extends AppCompatActivity { TextView companyname = findViewById(R.id.CompanyNameInput); TextView address = findViewById(R.id.AddressInput); TextView phonenumber = findViewById(R.id.PhoneNumberInput); + TextView description = findViewById(R.id.DescriptionInput); CheckBox licensed = findViewById(R.id.LicensedInput); if(password.getText().toString().length()>=5 && firstname.getText().toString().length()>0 @@ -70,11 +74,13 @@ public class EditProfile extends AppCompatActivity { && lastname.getText().toString().matches("[a-zA-Z]*") && companyname.getText().toString().matches("^[a-zA-Z0-9_ ]*$") && address.getText().toString().matches("^[a-zA-Z0-9_ ]*$") + && description.getText().toString().matches("^[a-zA-Z0-9_ ]*$") && phonenumber.getText().toString().matches("^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}$") && address.getText().toString().replaceAll("\\s+","").length()>0) { if(dbHelper.updateUserInfo(username, password.getText().toString(), firstname.getText().toString(), lastname.getText().toString(), address.getText().toString(), phonenumber.getText().toString(), companyname.getText().toString(), licensed.isChecked())){ + //add comment method here Toast.makeText(this, "Profile has been updated", Toast.LENGTH_LONG).show(); } else{ diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProvider.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProvider.java index c9dd250..1575015 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProvider.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProvider.java @@ -29,6 +29,7 @@ public class ServiceProvider extends UserType { private String phonenumber; private String companyname; private boolean licensed; + private String description; @@ -139,4 +140,9 @@ public class ServiceProvider extends UserType { public void setLicensed(boolean licensed) { this.licensed = licensed; } + + + public String getDescription() {return description; } + + public void setDescription(String description) { this.description = description; } } \ No newline at end of file diff --git a/OlympusServices/app/src/main/res/layout/activity_edit_profile.xml b/OlympusServices/app/src/main/res/layout/activity_edit_profile.xml index e9a8800..1ba8447 100644 --- a/OlympusServices/app/src/main/res/layout/activity_edit_profile.xml +++ b/OlympusServices/app/src/main/res/layout/activity_edit_profile.xml @@ -105,6 +105,20 @@ android:buttonTint="@color/colorWhite" android:layout_marginBottom="15dp"/> + //component used from https://github.com/rengwuxian/MaterialEditText + + //component used from https://github.com/rengwuxian/MaterialEditText