broken code will be fixed soon :(
This commit is contained in:
parent
18715dc5fb
commit
3e555f0b41
7 changed files with 187 additions and 21 deletions
Binary file not shown.
|
@ -47,28 +47,28 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".UsersList"
|
android:name=".UsersList"
|
||||||
android:label="List of Users"
|
android:label="List of Users"
|
||||||
android:screenOrientation="portrait"/>
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".AdminServicesList"
|
android:name=".AdminServicesList"
|
||||||
android:label="List of Services"
|
android:label="List of Services"
|
||||||
android:screenOrientation="portrait"/>
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ServiceProviderWelcome"
|
android:name=".ServiceProviderWelcome"
|
||||||
android:label="Welcome"
|
android:label="Welcome"
|
||||||
android:screenOrientation="portrait"/>
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".EditProfile"
|
android:name=".EditProfile"
|
||||||
android:label="Edit Profile"
|
android:label="Edit Profile"
|
||||||
android:screenOrientation="portrait"/>
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ServiceProviderServicesList"
|
android:name=".ServiceProviderServicesList"
|
||||||
android:label="List of Services"
|
android:label="List of Services"
|
||||||
android:screenOrientation="portrait"/>
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ServiceProviderAvailabilities"
|
android:name=".ServiceProviderAvailabilities"
|
||||||
android:label="Availabilities"
|
android:label="Availabilities"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="portrait"></activity>
|
||||||
</activity>
|
<activity android:name=".SignUpPart2"></activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -31,6 +31,8 @@ public class ServiceProvider extends UserType {
|
||||||
private boolean licensed;
|
private boolean licensed;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the service object which takes the parameters to
|
* Constructor for the service object which takes the parameters to
|
||||||
* fill out the service providers field.
|
* fill out the service providers field.
|
||||||
|
@ -40,10 +42,15 @@ public class ServiceProvider extends UserType {
|
||||||
* @param firstname String of the firstname.
|
* @param firstname String of the firstname.
|
||||||
* @param lastname String of the lastname.
|
* @param lastname String of the lastname.
|
||||||
*/
|
*/
|
||||||
ServiceProvider(String username, String password, String firstname, String lastname){
|
ServiceProvider(String username, String password, String firstname, String lastname, String address,
|
||||||
|
String phonenumber, String companyname, boolean licensed){
|
||||||
super(username, password, firstname, lastname);
|
super(username, password, firstname, lastname);
|
||||||
services = new ArrayList<>();
|
services = new ArrayList<>();
|
||||||
availabilities = new int[7][4];
|
availabilities = new int[7][4];
|
||||||
|
this.address = address;
|
||||||
|
this.phonenumber = phonenumber;
|
||||||
|
this.companyname = companyname;
|
||||||
|
this.licensed = licensed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,9 +82,7 @@ public class ServiceProvider extends UserType {
|
||||||
*
|
*
|
||||||
* @return arrayList of Services
|
* @return arrayList of Services
|
||||||
*/
|
*/
|
||||||
public List<Service> getServices(){
|
|
||||||
return services;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setAvailabilities(int day, int startHour, int startMin, int endHour, int endMin){
|
public void setAvailabilities(int day, int startHour, int startMin, int endHour, int endMin){
|
||||||
|
@ -91,6 +96,17 @@ public class ServiceProvider extends UserType {
|
||||||
return availabilities;
|
return availabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAvailabilities(int[][] availabilities) {
|
||||||
|
this.availabilities = availabilities;
|
||||||
|
}
|
||||||
|
public void setServices(List<Service> services) {
|
||||||
|
this.services = services;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Service> getServices(){
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,27 +56,45 @@ public class SignUp extends AppCompatActivity {
|
||||||
|
|
||||||
if(username.length()>=5 && password.length()>5 && firstname.length()>0 && lastname.length()>0 && username.matches("[a-zA-Z0-9]*") && password.matches("[a-zA-Z0-9]*")
|
if(username.length()>=5 && password.length()>5 && firstname.length()>0 && lastname.length()>0 && username.matches("[a-zA-Z0-9]*") && password.matches("[a-zA-Z0-9]*")
|
||||||
&& firstname.matches("[a-zA-Z]*") && lastname.matches("[a-zA-Z]*")){
|
&& firstname.matches("[a-zA-Z]*") && lastname.matches("[a-zA-Z]*")){
|
||||||
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
|
Intent intent = new Intent(getApplicationContext(),LogIn.class);
|
||||||
switch(spinner.getText().toString()){
|
switch(spinner.getText().toString()){
|
||||||
case "Home Owner":
|
case "Home Owner":
|
||||||
newUser = new HomeOwner(username,password,firstname,lastname);
|
newUser = new HomeOwner(username,password,firstname,lastname);
|
||||||
|
if(dbHelper.addUser(newUser)){
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}else{
|
||||||
|
Toast.makeText(this,"Username is taken",Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "Service Provider":
|
case "Service Provider":
|
||||||
newUser = new ServiceProvider(username,password,firstname,lastname);
|
if(dbHelper.findUserByUsername(username)==null) {
|
||||||
|
Intent intent2 = new Intent(getApplicationContext(), SignUpPart2.class);
|
||||||
|
intent2.putExtra("firstname", firstname);
|
||||||
|
intent2.putExtra("lastname", lastname);
|
||||||
|
intent2.putExtra("username", username);
|
||||||
|
intent2.putExtra("password", password);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}else{
|
||||||
|
Toast.makeText(this,"Username is taken",Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
newUser = new HomeOwner(username,password,firstname,lastname); //if nothing is enter then defaults to user role.
|
newUser = new HomeOwner(username,password,firstname,lastname); //if nothing is enter then defaults to user role.
|
||||||
|
|
||||||
|
if(dbHelper.addUser(newUser)){
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}else{
|
||||||
|
Toast.makeText(this,"Username is taken",Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DBHelper dbHelper = new DBHelper(this);
|
|
||||||
Intent intent = new Intent(getApplicationContext(),LogIn.class);
|
|
||||||
if(dbHelper.addUser(newUser)){
|
|
||||||
startActivity(intent);
|
|
||||||
finish();
|
|
||||||
}else{
|
|
||||||
Toast.makeText(this,"Username is taken",Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(firstname.length()==0 || lastname.length()==0 || username.length()==0 || password.length()==0){
|
else if(firstname.length()==0 || lastname.length()==0 || username.length()==0 || password.length()==0){
|
||||||
Toast.makeText(this, "Fields cannot be empty", Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "Fields cannot be empty", Toast.LENGTH_LONG).show();
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
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.EditText;
|
||||||
|
|
||||||
|
public class SignUpPart2 extends AppCompatActivity {
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String firstname;
|
||||||
|
private String lastname;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_sign_up_part2);
|
||||||
|
Bundle bundle = getIntent().getExtras();
|
||||||
|
username = bundle.getString("username");
|
||||||
|
password = bundle.getString("password");
|
||||||
|
firstname = bundle.getString("firstname");
|
||||||
|
lastname = bundle.getString("lastname");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SignUp(View view){
|
||||||
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
|
Intent intent = new Intent(getApplicationContext(),LogIn.class);
|
||||||
|
String companyname = ((EditText) findViewById(R.id.CompanyNameInput)).getText().toString();
|
||||||
|
String phonenumber = ((EditText) findViewById(R.id.PhoneNumberInput)).getText().toString();
|
||||||
|
String address = ((EditText) findViewById(R.id.AddressInput)).getText().toString();
|
||||||
|
boolean licensed = ((CheckBox) findViewById(R.id.LicensedInput)).isChecked();
|
||||||
|
|
||||||
|
ServiceProvider serviceProvider = new ServiceProvider(username, password, firstname, lastname,
|
||||||
|
address, phonenumber, companyname, licensed);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
android:background="@drawable/background"
|
||||||
|
tools:context=".SignUpPart2">
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||||
|
|
||||||
|
|
||||||
|
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText
|
||||||
|
android:id="@+id/CompanyNameInput"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:background="@drawable/customborder"
|
||||||
|
android:hint="Company Name"
|
||||||
|
android:textSize="15sp"
|
||||||
|
app:met_baseColor="@android:color/white"
|
||||||
|
app:met_floatingLabel="highlight"
|
||||||
|
app:met_primaryColor="@color/colorWhite"
|
||||||
|
app:met_singleLineEllipsis="true"
|
||||||
|
android:textCursorDrawable="@color/colorWhite"
|
||||||
|
android:layout_marginTop="20dp"/>
|
||||||
|
|
||||||
|
|
||||||
|
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText
|
||||||
|
android:id="@+id/PhoneNumberInput"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:background="@drawable/customborder"
|
||||||
|
android:hint="Phone Number"
|
||||||
|
android:textSize="15sp"
|
||||||
|
app:met_baseColor="@android:color/white"
|
||||||
|
app:met_floatingLabel="highlight"
|
||||||
|
app:met_primaryColor="@color/colorWhite"
|
||||||
|
app:met_singleLineEllipsis="true"
|
||||||
|
android:inputType="phone"
|
||||||
|
android:textCursorDrawable="@color/colorWhite"/>
|
||||||
|
|
||||||
|
|
||||||
|
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText
|
||||||
|
android:id="@+id/AddressInput"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:background="@drawable/customborder"
|
||||||
|
android:hint="Address"
|
||||||
|
android:textSize="15sp"
|
||||||
|
app:met_baseColor="@android:color/white"
|
||||||
|
app:met_floatingLabel="highlight"
|
||||||
|
app:met_primaryColor="@color/colorWhite"
|
||||||
|
app:met_singleLineEllipsis="true"
|
||||||
|
android:textCursorDrawable="@color/colorWhite"/>
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/LicensedInput"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Licensed"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:textColor="@color/colorWhite"
|
||||||
|
android:buttonTint="@color/colorWhite"
|
||||||
|
android:layout_marginBottom="15dp"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/SignUp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Sign Up"
|
||||||
|
android:onClick="SignUp"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -5,7 +5,7 @@
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorWhite</item>
|
<item name="colorPrimaryDark">@color/colorWhite</item>
|
||||||
<item name="colorAccent">@color/colorWhite</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.Button" parent="Widget.AppCompat.Button.Colored">
|
<style name="AppTheme.Button" parent="Widget.AppCompat.Button.Colored">
|
||||||
|
|
Loading…
Reference in a new issue