From 18216adfae80dc3693a0aa96fc14c4a2d10c7d60 Mon Sep 17 00:00:00 2001 From: IvanaE Date: Sat, 17 Nov 2018 14:29:46 -0500 Subject: [PATCH 01/10] finished adding description --- .../uottawa/olympus/olympusservices/DBHelper.java | 2 +- .../olympus/olympusservices/SignUpPart2.java | 4 ++-- .../main/res/layout/activity_sign_up_part2.xml | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java index 6d0e729..e48f01f 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java @@ -353,7 +353,7 @@ public class DBHelper extends SQLiteOpenHelper { if (phonenumber != null && !phonenumber.equals(""))values.put(COLUMN_PHONE, phonenumber); if (companyname != null && !companyname.equals(""))values.put(COLUMN_COMPANY, companyname); if (licensed != null) values.put(COLUMN_LICENSED, String.valueOf(licensed)); - if (description != null && !description.equals(""))values.put(COLUMN_DESCRIPTION, description); + if (description != null )values.put(COLUMN_DESCRIPTION, description); return writeDB.update(TABLE_LOGIN, values, COLUMN_USERNAME+" = ?", diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/SignUpPart2.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/SignUpPart2.java index 1fd1ab0..7eb5913 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/SignUpPart2.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/SignUpPart2.java @@ -37,12 +37,12 @@ public class SignUpPart2 extends AppCompatActivity { if(companyname.length()>0 && address.length()>0 && phonenumber.length()>0 && companyname.matches("^[a-zA-Z0-9_ ]*$") && address.matches("^[a-zA-Z0-9_ ]*$") && phonenumber.matches("^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}$") + && description.matches("^[a-zA-Z0-9_ ]*$") && companyname.replaceAll("\\s+","").length()>0 && address.replaceAll("\\s+","").length()>0) { ServiceProvider serviceProvider = new ServiceProvider(username, password, firstname, lastname, - address, phonenumber, companyname, licensed); - serviceProvider.setDescription(description); + address, phonenumber, companyname, licensed, description); if(dbHelper.addUser(serviceProvider)){ startActivity(intent); finish(); diff --git a/OlympusServices/app/src/main/res/layout/activity_sign_up_part2.xml b/OlympusServices/app/src/main/res/layout/activity_sign_up_part2.xml index 71f0f3e..e44fdfb 100644 --- a/OlympusServices/app/src/main/res/layout/activity_sign_up_part2.xml +++ b/OlympusServices/app/src/main/res/layout/activity_sign_up_part2.xml @@ -80,6 +80,21 @@ android:buttonTint="@color/colorWhite" android:layout_marginBottom="15dp"/> + //component used from https://github.com/rengwuxian/MaterialEditText + +