diff --git a/OlympusServices/.idea/caches/build_file_checksums.ser b/OlympusServices/.idea/caches/build_file_checksums.ser
index 3825acd..7c3c27a 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/src/main/AndroidManifest.xml b/OlympusServices/app/src/main/AndroidManifest.xml
index a42982d..37d14c4 100644
--- a/OlympusServices/app/src/main/AndroidManifest.xml
+++ b/OlympusServices/app/src/main/AndroidManifest.xml
@@ -57,7 +57,7 @@
android:label="Welcome"
android:screenOrientation="portrait" />
@@ -73,7 +73,8 @@
-
+
+
\ No newline at end of file
diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/HomeOwnerEditProfile.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/HomeOwnerEditProfile.java
new file mode 100644
index 0000000..2819c18
--- /dev/null
+++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/HomeOwnerEditProfile.java
@@ -0,0 +1,82 @@
+package com.uottawa.olympus.olympusservices;
+
+import android.content.Intent;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class HomeOwnerEditProfile extends AppCompatActivity {
+ String username;
+ DBHelper dbHelper;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_home_owner_edit_profile);
+
+ Bundle bundle = getIntent().getExtras();
+ username = bundle.getString("username");
+ dbHelper = new DBHelper(this);
+ UserType user;
+ user = dbHelper.findUserByUsername(username);
+ TextView firstname = findViewById(R.id.FirstNameInput);
+ TextView lastname = findViewById(R.id.LastNameInput);
+ TextView password = findViewById(R.id.PasswordInput);
+
+
+ firstname.setText(user.getFirstname());
+ lastname.setText(user.getLastname());
+ password.setText(user.getPassword());
+
+ }
+ /**
+ * Override so that previous screen refreshes when pressing the
+ * back button on this activity of the app.
+ *
+ */
+ @Override
+ public void onBackPressed(){
+ Intent intent = new Intent(getApplicationContext(),ServiceProviderWelcome.class);
+ intent.putExtra("username", username);
+ startActivity(intent);
+ finish();
+ }
+
+
+ /**
+ * Saves updated user information to the database
+ * @param view
+ */
+ public void Save(View view){
+ TextView firstname = findViewById(R.id.FirstNameInput);
+ TextView lastname = findViewById(R.id.LastNameInput);
+ TextView password = findViewById(R.id.PasswordInput);
+
+ //Checks for the fields
+ if(password.getText().toString().length()>=5 && firstname.getText().toString().length()>0
+ && lastname.getText().toString().length()>0
+ && password.getText().toString().matches("[a-zA-Z0-9]*")
+ && firstname.getText().toString().matches("[a-zA-Z]*")
+ && lastname.getText().toString().matches("[a-zA-Z]*")
+ ) {
+
+ if(dbHelper.updateUserInfo(username, password.getText().toString(), firstname.getText().toString(), lastname.getText().toString()
+ )){
+ //add comment method here
+ Toast.makeText(this, "Profile has been updated", Toast.LENGTH_LONG).show();
+ }
+ else{
+ Toast.makeText(this, "Could not update profile ", Toast.LENGTH_LONG).show();
+
+ }
+
+ }
+ else{
+ Toast.makeText(this, "Fields cannot be empty and must be formatted correctly", Toast.LENGTH_LONG).show();
+ }
+ }
+
+}
diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditProfile.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderEditProfile.java
similarity index 93%
rename from OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditProfile.java
rename to OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderEditProfile.java
index 57ebfe9..cf3dc49 100644
--- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditProfile.java
+++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderEditProfile.java
@@ -8,7 +8,7 @@ import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;
-public class EditProfile extends AppCompatActivity {
+public class ServiceProviderEditProfile extends AppCompatActivity {
String username;
DBHelper dbHelper;
@@ -19,7 +19,7 @@ public class EditProfile extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_edit_profile);
+ setContentView(R.layout.activity_service_provider_edit_profile);
Bundle bundle = getIntent().getExtras();
username = bundle.getString("username");
dbHelper = new DBHelper(this);
@@ -100,7 +100,7 @@ public class EditProfile extends AppCompatActivity {
}
else{
- Toast.makeText(this, "Fields cannot be empty and must be formatted correctly", Toast.LENGTH_LONG).show();
+ Toast.makeText(this, "Fields cannot be empty (other than description) and must be formatted correctly", Toast.LENGTH_LONG).show();
}
}
diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderWelcome.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderWelcome.java
index 448c1d9..73a3e8a 100644
--- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderWelcome.java
+++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderWelcome.java
@@ -60,7 +60,7 @@ public class ServiceProviderWelcome extends AppCompatActivity {
}
public void EditProfile(View view){
- Intent intent = new Intent(getApplicationContext(),EditProfile.class);
+ Intent intent = new Intent(getApplicationContext(),ServiceProviderEditProfile.class);
intent.putExtra("username", username);
startActivity(intent);
finish();
diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Welcome.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Welcome.java
index a054142..ffe91bb 100644
--- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Welcome.java
+++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Welcome.java
@@ -32,7 +32,7 @@ public class Welcome extends AppCompatActivity {
UserType user;
user = dbHelper.findUserByUsername(username);
TextView welcome = findViewById(R.id.Welcome);
- welcome.setText("Welcome "+user.getFirstname()+ " you are logged in as a Service Provider");
+ welcome.setText("Welcome "+user.getFirstname()+ " you are logged in as a Home Owner");
@@ -73,6 +73,11 @@ public class Welcome extends AppCompatActivity {
startActivity(intent);
finish();
}
-
+ public void EditProfile(View view){
+ Intent intent = new Intent(getApplicationContext(),HomeOwnerEditProfile.class);
+ intent.putExtra("username", username);
+ startActivity(intent);
+ finish();
+ }
}
diff --git a/OlympusServices/app/src/main/res/layout/activity_find_service_provider.xml b/OlympusServices/app/src/main/res/layout/activity_find_service_provider.xml
index c2c4916..9bd9a8d 100644
--- a/OlympusServices/app/src/main/res/layout/activity_find_service_provider.xml
+++ b/OlympusServices/app/src/main/res/layout/activity_find_service_provider.xml
@@ -108,11 +108,13 @@
android:onClick="Search"
android:layout_marginRight="10dp"
/>
+
+ android:layout_height="250dp"
+ android:layout_marginTop="15dp"/>
diff --git a/OlympusServices/app/src/main/res/layout/activity_home_owner_edit_profile.xml b/OlympusServices/app/src/main/res/layout/activity_home_owner_edit_profile.xml
new file mode 100644
index 0000000..b572235
--- /dev/null
+++ b/OlympusServices/app/src/main/res/layout/activity_home_owner_edit_profile.xml
@@ -0,0 +1,71 @@
+
+
+
+ //component used from https://github.com/rengwuxian/MaterialEditText
+
+
+
+ //component used from https://github.com/rengwuxian/MaterialEditText
+
+
+
+ //component used from https://github.com/rengwuxian/MaterialEditText
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OlympusServices/app/src/main/res/layout/activity_make_booking.xml b/OlympusServices/app/src/main/res/layout/activity_make_booking.xml
index 79c7e1e..b9ba0ad 100644
--- a/OlympusServices/app/src/main/res/layout/activity_make_booking.xml
+++ b/OlympusServices/app/src/main/res/layout/activity_make_booking.xml
@@ -25,11 +25,13 @@
android:text="Home Owner:"
android:paddingRight="5dp"
android:paddingLeft="10dp"
+ android:paddingBottom="5dp"
+ android:paddingTop="5dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/black"
- android:textSize="20sp"
+ android:textSize="15sp"
android:layout_gravity="start"/>
@@ -103,7 +108,7 @@
diff --git a/OlympusServices/app/src/main/res/layout/activity_edit_profile.xml b/OlympusServices/app/src/main/res/layout/activity_service_provider_edit_profile.xml
similarity index 98%
rename from OlympusServices/app/src/main/res/layout/activity_edit_profile.xml
rename to OlympusServices/app/src/main/res/layout/activity_service_provider_edit_profile.xml
index 1ba8447..f234577 100644
--- a/OlympusServices/app/src/main/res/layout/activity_edit_profile.xml
+++ b/OlympusServices/app/src/main/res/layout/activity_service_provider_edit_profile.xml
@@ -11,7 +11,7 @@
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/background"
- tools:context=".EditProfile">
+ tools:context=".ServiceProviderEditProfile">
@@ -136,7 +136,7 @@
android:textCursorDrawable="@color/colorWhite"/>