merging with master
This commit is contained in:
commit
6495b19d9e
57 changed files with 3014 additions and 277 deletions
32
.circleci/config.yml
Normal file
32
.circleci/config.yml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
version: 2
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
working_directory: ~/SEG2105-Olympus/OlympusServices
|
||||||
|
docker:
|
||||||
|
- image: circleci/android:api-28-alpha
|
||||||
|
environment:
|
||||||
|
JVM_OPTS: -Xmx3200m
|
||||||
|
steps:
|
||||||
|
- checkout:
|
||||||
|
path: ~/SEG2105-Olympus
|
||||||
|
- restore_cache:
|
||||||
|
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
|
||||||
|
- run:
|
||||||
|
name: Chmod permissions
|
||||||
|
command: sudo chmod +x ./gradlew
|
||||||
|
- run:
|
||||||
|
name: Download Dependencies
|
||||||
|
command: ./gradlew androidDependencies
|
||||||
|
- save_cache:
|
||||||
|
paths:
|
||||||
|
- ~/.gradle
|
||||||
|
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
|
||||||
|
- run:
|
||||||
|
name: Run UnitTest
|
||||||
|
command: ./gradlew test
|
||||||
|
- store_artifacts:
|
||||||
|
path: app/build/outputs/apk/debug/
|
||||||
|
destination: apks/
|
||||||
|
- store_test_results:
|
||||||
|
path: app/build/test-results
|
||||||
|
|
BIN
Deliverable2.zip
Normal file
BIN
Deliverable2.zip
Normal file
Binary file not shown.
14
OlympusServices/.idea/assetWizardSettings.xml
Normal file
14
OlympusServices/.idea/assetWizardSettings.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="WizardSettings">
|
||||||
|
<option name="children">
|
||||||
|
<map>
|
||||||
|
<entry key="vectorWizard">
|
||||||
|
<value>
|
||||||
|
<PersistentState />
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -24,7 +24,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||||
implementation 'com.android.support:design:28.0.0'
|
implementation 'com.android.support:design:28.0.0'
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||||
|
@ -39,6 +39,7 @@ dependencies {
|
||||||
implementation 'com.jaredrummler:material-spinner:1.2.5'
|
implementation 'com.jaredrummler:material-spinner:1.2.5'
|
||||||
implementation 'com.android.support:design:28.0.0-alpha3'
|
implementation 'com.android.support:design:28.0.0-alpha3'
|
||||||
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
|
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
|
||||||
|
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
|
@ -30,18 +30,45 @@
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".SignUp"
|
android:name=".SignUp"
|
||||||
|
android:label="Sign Up"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".LogIn"
|
android:name=".LogIn"
|
||||||
|
android:label="Log In"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".Welcome"
|
android:name=".Welcome"
|
||||||
|
android:label="Welcome"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".AdminWelcome"
|
android:name=".AdminWelcome"
|
||||||
|
android:label="Welcome"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity android:name=".UsersList" />
|
<activity
|
||||||
<activity android:name=".ServicesList"></activity>
|
android:name=".UsersList"
|
||||||
|
android:label="List of Users"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".AdminServicesList"
|
||||||
|
android:label="List of Services"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".ServiceProviderWelcome"
|
||||||
|
android:label="Welcome"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".EditProfile"
|
||||||
|
android:label="Edit Profile"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".ServiceProviderServicesList"
|
||||||
|
android:label="List of Services"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".ServiceProviderAvailabilities"
|
||||||
|
android:label="Availabilities"
|
||||||
|
android:screenOrientation="portrait"></activity>
|
||||||
|
<activity android:name=".SignUpPart2"></activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -1,10 +1,28 @@
|
||||||
package com.uottawa.olympus.olympusservices;
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class Admin is a child of the class userType. The class gives
|
||||||
|
* admin permission over the app such that the user can add and delete services
|
||||||
|
* and can add and delete other users from the database of the app.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public class Admin extends UserType {
|
public class Admin extends UserType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor for the admin object with predefined fields.
|
||||||
|
* There should only be one admin object for the entire app.
|
||||||
|
*/
|
||||||
Admin(){
|
Admin(){
|
||||||
super("admin", "admin", "Admin", "Admin");
|
super("admin", "admin", "Admin", "Admin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The getRole() method returns a string "Admin"
|
||||||
|
* the app gets role of user type objects for access
|
||||||
|
* app permission purposes.
|
||||||
|
*
|
||||||
|
* @return String object "Admin"
|
||||||
|
*/
|
||||||
public String getRole(){ return "Admin"; }
|
public String getRole(){ return "Admin"; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,213 @@
|
||||||
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the view and dialog listener for List of services
|
||||||
|
* which the admin can view and manipulate.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AdminServicesList extends AppCompatActivity implements NewServiceDialogFragment.NoticeDialogListener, EditServiceDialogFragment.NoticeDialogListener{
|
||||||
|
|
||||||
|
//field for RecyclerView
|
||||||
|
private RecyclerView mRecyclerView;
|
||||||
|
//field for adapter of Recycler view
|
||||||
|
private RecyclerView.Adapter mAdapter;
|
||||||
|
//field for layout manager of Recyler view.
|
||||||
|
private RecyclerView.LayoutManager mLayoutManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On creation loads up the xml, and generates the services list,
|
||||||
|
* and fillsout the recylerView fields.
|
||||||
|
*
|
||||||
|
* @param savedInstanceState Bundle to transfer information.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_admin_services_list);
|
||||||
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
|
List<String[]> serviceslist = dbHelper.getAllServices();
|
||||||
|
Service[] services = new Service[(serviceslist.size())];
|
||||||
|
Iterator iter = serviceslist.iterator();
|
||||||
|
for (int i=0; i<serviceslist.size();i++){
|
||||||
|
String[] current = (String[])iter.next();
|
||||||
|
services[i] = new Service(current[0], Double.parseDouble(current[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
mRecyclerView = (RecyclerView) findViewById(R.id.Services);
|
||||||
|
|
||||||
|
|
||||||
|
mLayoutManager = new LinearLayoutManager(this);
|
||||||
|
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||||
|
|
||||||
|
mAdapter = new MyAdapter(services, this);
|
||||||
|
mRecyclerView.setAdapter(mAdapter);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds new services to the generated list.
|
||||||
|
*
|
||||||
|
* @param view View object contains the generated list and buttons
|
||||||
|
*/
|
||||||
|
public void addService(View view) {
|
||||||
|
DialogFragment newFragment = new NewServiceDialogFragment();
|
||||||
|
newFragment.show(getSupportFragmentManager(), "addService");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edits services to the generated list.
|
||||||
|
*
|
||||||
|
* @param view View object contains the generated list and buttons
|
||||||
|
*/
|
||||||
|
public void editService(View view, String name) {
|
||||||
|
DialogFragment newFragment = new EditServiceDialogFragment();
|
||||||
|
newFragment.show(getSupportFragmentManager(), "editService");
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString("name", name);
|
||||||
|
newFragment.setArguments(args);
|
||||||
|
}
|
||||||
|
//add new service
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses dialog to obtain the fields for addSerivce.
|
||||||
|
*
|
||||||
|
* @param dialog DialogFragment used to obtain the fields for the added service
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onDialogNew(DialogFragment dialog) {
|
||||||
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
|
String name = (String)dialog.getArguments().get("name");
|
||||||
|
Double rate = (Double)dialog.getArguments().get("rate");
|
||||||
|
dbHelper.addService(new Service(name,rate));
|
||||||
|
dialog.dismiss();
|
||||||
|
this.recreate();
|
||||||
|
}
|
||||||
|
//user clicked cancel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses dialog to cancel adding a service.
|
||||||
|
*
|
||||||
|
* @param dialog DialogFragment that contains the cancel button.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onDialogNevermind(DialogFragment dialog) {
|
||||||
|
|
||||||
|
}
|
||||||
|
//edits service with info from dialog
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses Dialog to edit service.
|
||||||
|
*
|
||||||
|
* @param dialog DialogFragment that contains the fields and buttons to edit rate.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onDialogEdit(DialogFragment dialog) {
|
||||||
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
|
String name = (String)dialog.getArguments().get("name");
|
||||||
|
Double rate = (Double)dialog.getArguments().get("rate");
|
||||||
|
dbHelper.updateService(new Service(name,rate));
|
||||||
|
dialog.dismiss();
|
||||||
|
this.recreate();
|
||||||
|
}
|
||||||
|
//deletes service with info from dialog
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses Dialog to delete a service from the serviceList.
|
||||||
|
*
|
||||||
|
* @param dialog DialogFragment that contains the delete service button.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onDialogDelete(DialogFragment dialog) {
|
||||||
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
|
String name = (String)dialog.getArguments().get("name");
|
||||||
|
dbHelper.deleteService(name);
|
||||||
|
Toast.makeText(this, "Service \""+(String)dialog.getArguments().get("name")+"\" has been deleted", Toast.LENGTH_LONG).show();
|
||||||
|
dialog.dismiss();
|
||||||
|
this.recreate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ServicesHolder> {
|
||||||
|
|
||||||
|
private Service[] services;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
// Provide a reference to the views for each data item
|
||||||
|
// Complex data items may need more than one view per item, and
|
||||||
|
// you provide access to all the views for a data item in a view holder
|
||||||
|
|
||||||
|
// Provide a suitable constructor (depends on the kind of dataset)
|
||||||
|
public MyAdapter(Service[] services, Context context) {
|
||||||
|
this.services = services;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new views (invoked by the layout manager)
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ServicesHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View v = LayoutInflater.from(parent.getContext())
|
||||||
|
.inflate(R.layout.list_item, parent, false);
|
||||||
|
ServicesHolder vh = new ServicesHolder(v);
|
||||||
|
return vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace the contents of a view (invoked by the layout manager)
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(ServicesHolder holder, int position) {
|
||||||
|
Service service = services[position];
|
||||||
|
holder.name.setText(service.getName());
|
||||||
|
holder.rate.setText(String.format("$%,.2f", service.getRate()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the size of your dataset (invoked by the layout manager)
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return services.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ServicesHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
|
||||||
|
|
||||||
|
TextView name;
|
||||||
|
TextView rate;
|
||||||
|
|
||||||
|
public ServicesHolder(View row){
|
||||||
|
super(row);
|
||||||
|
name = row.findViewById(R.id.Name);
|
||||||
|
rate = row.findViewById(R.id.Rate);
|
||||||
|
row.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
TextView nameview = (TextView)view.findViewById(R.id.Name);
|
||||||
|
String name = nameview.getText().toString();
|
||||||
|
editService(view, name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,29 +5,72 @@ import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Admin Welcome class is the welcome
|
||||||
|
* screen for admin users when they have logged into the
|
||||||
|
* app. The admin welcome screen has features such as the
|
||||||
|
* user list and service list which it can only access.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public class AdminWelcome extends AppCompatActivity {
|
public class AdminWelcome extends AppCompatActivity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the xml pages for the class object
|
||||||
|
* on creation of the object.
|
||||||
|
*
|
||||||
|
* @param savedInstanceState Bundle for transfer of data.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_admin_welcome);
|
setContentView(R.layout.activity_admin_welcome);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override so that nothing occurs when pressing the
|
||||||
|
* back button on this activity of the app.
|
||||||
|
*
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed(){
|
public void onBackPressed(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out the user and returns them back to
|
||||||
|
* main activity. End all current user activity
|
||||||
|
* for security purposes.
|
||||||
|
*
|
||||||
|
* @param view View object of current activity.
|
||||||
|
*/
|
||||||
public void LogOut(View view){
|
public void LogOut(View view){
|
||||||
Intent intent = new Intent(getApplicationContext(), Main.class);
|
Intent intent = new Intent(getApplicationContext(), Main.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On click of list of user button that goes to
|
||||||
|
* UserList screen for the admin to edit the user list
|
||||||
|
* of the app.
|
||||||
|
*
|
||||||
|
* @param view View object of current activity
|
||||||
|
*/
|
||||||
public void goToUsers(View view){
|
public void goToUsers(View view){
|
||||||
Intent intent = new Intent(getApplicationContext(), UsersList.class);
|
Intent intent = new Intent(getApplicationContext(), UsersList.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On click of list of services button goes to
|
||||||
|
* ServiceList screen for the admin to edit the
|
||||||
|
* service list of the app.
|
||||||
|
*
|
||||||
|
* @param view
|
||||||
|
*/
|
||||||
public void goToServices(View view){
|
public void goToServices(View view){
|
||||||
Intent intent = new Intent(getApplicationContext(), ServicesList.class);
|
Intent intent = new Intent(getApplicationContext(), AdminServicesList.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package com.uottawa.olympus.olympusservices;
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is the class for Appointments
|
||||||
|
* which has not been implemented yet. This
|
||||||
|
* feature shall be expanded upon next deliverable.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class Appointment {
|
public class Appointment {
|
||||||
Service service;
|
Service service;
|
||||||
ServiceProvider provider;
|
ServiceProvider provider;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.database.sqlite.SQLiteOpenHelper;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ import java.util.List;
|
||||||
public class DBHelper extends SQLiteOpenHelper {
|
public class DBHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
//version of db used for update method
|
//version of db used for update method
|
||||||
private static final int DB_VERSION = 2;
|
private static final int DB_VERSION = 3;
|
||||||
//name of db in app data
|
//name of db in app data
|
||||||
private static final String DB_NAME = "UsersDB.db";
|
private static final String DB_NAME = "UsersDB.db";
|
||||||
|
|
||||||
|
@ -40,15 +41,44 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
private static final String COLUMN_FIRSTNAME = "firstName";
|
private static final String COLUMN_FIRSTNAME = "firstName";
|
||||||
private static final String COLUMN_LASTNAME = "lastName";
|
private static final String COLUMN_LASTNAME = "lastName";
|
||||||
private static final String COLUMN_USERTYPE = "userType";
|
private static final String COLUMN_USERTYPE = "userType";
|
||||||
|
private static final String COLUMN_ADDRESS = "address";
|
||||||
// private static final String TABLE_SERVICEPROVIDERS = "serviceProviders";
|
private static final String COLUMN_PHONE = "phone";
|
||||||
|
private static final String COLUMN_COMPANY = "company";
|
||||||
|
private static final String COLUMN_LICENSED = "licensed";
|
||||||
|
|
||||||
//name of table containing services and rates
|
//name of table containing services and rates
|
||||||
private static final String TABLE_SERVICES = "services";
|
private static final String TABLE_SERVICES = "services";
|
||||||
//columns of TABLE_LOGIN
|
//columns of TABLE_SERVICES
|
||||||
private static final String COLUMN_SERVICE = "service";
|
private static final String COLUMN_SERVICE = "service";
|
||||||
private static final String COLUMN_RATE = "rate";
|
private static final String COLUMN_RATE = "rate";
|
||||||
|
|
||||||
|
//name of table containing service provider information
|
||||||
|
private static final String TABLE_SERVICEPROVIDERS = "serviceProviders";
|
||||||
|
//columns of TABLE_SERVICEPROVIDERS
|
||||||
|
private static final String COLUMN_SERVICEPROVIDERNAME = "username";
|
||||||
|
private static final String COLUMN_SERVICEPROVIDERSERVICE = "service";
|
||||||
|
|
||||||
|
//name of table containing service provider availability
|
||||||
|
//availability is stored as number of minutes from 00:00
|
||||||
|
private static final String TABLE_AVAILABILITY = "availability";
|
||||||
|
//columns of TABLE_AVAILABILITY
|
||||||
|
private static final String COLUMN_AVAILABILITYNAME = "username";
|
||||||
|
private static final String COLUMN_MONSTART = "mondaystart";
|
||||||
|
private static final String COLUMN_MONEND = "mondayend";
|
||||||
|
private static final String COLUMN_TUESTART = "tuesdaystart";
|
||||||
|
private static final String COLUMN_TUEEND = "tuesdayend";
|
||||||
|
private static final String COLUMN_WEDSTART = "wednesdaystart";
|
||||||
|
private static final String COLUMN_WEDEND = "wednesdayend";
|
||||||
|
private static final String COLUMN_THUSTART = "thursdaystart";
|
||||||
|
private static final String COLUMN_THUEND = "thursdayend";
|
||||||
|
private static final String COLUMN_FRISTART = "fridaystart";
|
||||||
|
private static final String COLUMN_FRIEND = "fridayend";
|
||||||
|
private static final String COLUMN_SATSTART = "saturdaystart";
|
||||||
|
private static final String COLUMN_SATEND = "saturdayend";
|
||||||
|
private static final String COLUMN_SUNSTART = "sundaystart";
|
||||||
|
private static final String COLUMN_SUNEND = "sundayend";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of DBHelper to allow activities to access and
|
* Creates an instance of DBHelper to allow activities to access and
|
||||||
|
@ -71,10 +101,15 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
//making the table containing user login information
|
//making the table containing user login information
|
||||||
String CREATE_LOGIN_TABLE = "CREATE TABLE "+ TABLE_LOGIN + "("
|
String CREATE_LOGIN_TABLE = "CREATE TABLE "+ TABLE_LOGIN + "("
|
||||||
+ COLUMN_USERNAME + " TEXT UNIQUE NOT NULL PRIMARY KEY ON CONFLICT ROLLBACK,"
|
+ COLUMN_USERNAME + " TEXT UNIQUE NOT NULL PRIMARY KEY ON CONFLICT ROLLBACK,"
|
||||||
+ COLUMN_PASSWORD + " TEXT NOT NULL,"
|
+ COLUMN_PASSWORD + " TEXT,"
|
||||||
+ COLUMN_FIRSTNAME + " TEXT DEFAULT 'FirstName',"
|
+ COLUMN_FIRSTNAME + " TEXT DEFAULT 'FirstName',"
|
||||||
+ COLUMN_LASTNAME + " TEXT DEFAULT 'LastName',"
|
+ COLUMN_LASTNAME + " TEXT DEFAULT 'LastName',"
|
||||||
+ COLUMN_USERTYPE + " TEXT NOT NULL" + ")";
|
+ COLUMN_USERTYPE + " TEXT NOT NULL, "
|
||||||
|
+ COLUMN_ADDRESS + " TEXT, "
|
||||||
|
+ COLUMN_PHONE + " TEXT, "
|
||||||
|
+ COLUMN_COMPANY + " TEXT, "
|
||||||
|
+ COLUMN_LICENSED + " TEXT "
|
||||||
|
+ ")";
|
||||||
db.execSQL(CREATE_LOGIN_TABLE);
|
db.execSQL(CREATE_LOGIN_TABLE);
|
||||||
|
|
||||||
//making the table containing services and their rates
|
//making the table containing services and their rates
|
||||||
|
@ -82,6 +117,38 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
+ COLUMN_SERVICE + " TEXT UNIQUE NOT NULL PRIMARY KEY ON CONFLICT ROLLBACK,"
|
+ COLUMN_SERVICE + " TEXT UNIQUE NOT NULL PRIMARY KEY ON CONFLICT ROLLBACK,"
|
||||||
+ COLUMN_RATE + " REAL DEFAULT 0.0" + ")";
|
+ COLUMN_RATE + " REAL DEFAULT 0.0" + ")";
|
||||||
db.execSQL(CREATE_SERVICES_TABLE);
|
db.execSQL(CREATE_SERVICES_TABLE);
|
||||||
|
|
||||||
|
//making the table containing service providers and offered services
|
||||||
|
String CREATE_SERVICEPROVIDERS_TABLE = "CREATE TABLE "+ TABLE_SERVICEPROVIDERS + "("
|
||||||
|
+ COLUMN_SERVICEPROVIDERNAME + " TEXT, "
|
||||||
|
+ COLUMN_SERVICEPROVIDERSERVICE + " TEXT, "
|
||||||
|
//service provider name is foreign key
|
||||||
|
+ " FOREIGN KEY(" + COLUMN_SERVICEPROVIDERNAME
|
||||||
|
+ ") REFERENCES " + TABLE_LOGIN + "(" + COLUMN_USERNAME +"), "
|
||||||
|
//service is also foreign key
|
||||||
|
+ " FOREIGN KEY(" + COLUMN_SERVICEPROVIDERSERVICE
|
||||||
|
+ ") REFERENCES " + TABLE_SERVICES + "(" + COLUMN_SERVICE +") "
|
||||||
|
+ ")";
|
||||||
|
db.execSQL(CREATE_SERVICEPROVIDERS_TABLE);
|
||||||
|
|
||||||
|
//making the table containing services and their rates
|
||||||
|
String CREATE_AVAILABILITY_TABLE = "CREATE TABLE "+ TABLE_AVAILABILITY + "("
|
||||||
|
+ COLUMN_AVAILABILITYNAME + " TEXT UNIQUE NOT NULL PRIMARY KEY ON CONFLICT ROLLBACK, "
|
||||||
|
+ COLUMN_MONSTART + " REAL, "
|
||||||
|
+ COLUMN_MONEND + " REAL, "
|
||||||
|
+ COLUMN_TUESTART + " REAL, "
|
||||||
|
+ COLUMN_TUEEND + " REAL, "
|
||||||
|
+ COLUMN_WEDSTART + " REAL, "
|
||||||
|
+ COLUMN_WEDEND + " REAL, "
|
||||||
|
+ COLUMN_THUSTART + " REAL, "
|
||||||
|
+ COLUMN_THUEND + " REAL, "
|
||||||
|
+ COLUMN_FRISTART + " REAL, "
|
||||||
|
+ COLUMN_FRIEND + " REAL, "
|
||||||
|
+ COLUMN_SATSTART + " REAL, "
|
||||||
|
+ COLUMN_SATEND + " REAL, "
|
||||||
|
+ COLUMN_SUNSTART + " REAL, "
|
||||||
|
+ COLUMN_SUNEND + " REAL)";
|
||||||
|
db.execSQL(CREATE_AVAILABILITY_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,6 +164,39 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
db.execSQL("CREATE TABLE IF NOT EXISTS "+ TABLE_SERVICES + "("
|
db.execSQL("CREATE TABLE IF NOT EXISTS "+ TABLE_SERVICES + "("
|
||||||
+ COLUMN_SERVICE + " TEXT UNIQUE NOT NULL PRIMARY KEY ON CONFLICT ROLLBACK,"
|
+ COLUMN_SERVICE + " TEXT UNIQUE NOT NULL PRIMARY KEY ON CONFLICT ROLLBACK,"
|
||||||
+ COLUMN_RATE + " REAL DEFAULT 0.0" + ")");
|
+ COLUMN_RATE + " REAL DEFAULT 0.0" + ")");
|
||||||
|
|
||||||
|
case 2: //going from db versions 1-2 to 3
|
||||||
|
db.execSQL("CREATE TABLE IF NOT EXISTS "+ TABLE_SERVICEPROVIDERS + "("
|
||||||
|
+ COLUMN_SERVICEPROVIDERNAME + " TEXT NOT NULL, "
|
||||||
|
+ COLUMN_SERVICEPROVIDERSERVICE + " TEXT NOT NULL, "
|
||||||
|
//service provider name is foreign key
|
||||||
|
+ " FOREIGN KEY(" + COLUMN_SERVICEPROVIDERNAME
|
||||||
|
+ ") REFERENCES " + TABLE_LOGIN + "(" + COLUMN_USERNAME +"), "
|
||||||
|
//service is also foreign key
|
||||||
|
+ " FOREIGN KEY(" + COLUMN_SERVICEPROVIDERSERVICE
|
||||||
|
+ ") REFERENCES " + TABLE_SERVICES + "(" + COLUMN_SERVICE +") "
|
||||||
|
+ ")");
|
||||||
|
db.execSQL("CREATE TABLE IF NOT EXISTS "+ TABLE_AVAILABILITY + "("
|
||||||
|
+ COLUMN_AVAILABILITYNAME + " TEXT UNIQUE NOT NULL PRIMARY KEY ON CONFLICT ROLLBACK, "
|
||||||
|
+ COLUMN_MONSTART + " REAL, "
|
||||||
|
+ COLUMN_MONEND + " REAL, "
|
||||||
|
+ COLUMN_TUESTART + " REAL, "
|
||||||
|
+ COLUMN_TUEEND + " REAL, "
|
||||||
|
+ COLUMN_WEDSTART + " REAL, "
|
||||||
|
+ COLUMN_WEDEND + " REAL, "
|
||||||
|
+ COLUMN_THUSTART + " REAL, "
|
||||||
|
+ COLUMN_THUEND + " REAL, "
|
||||||
|
+ COLUMN_FRISTART + " REAL, "
|
||||||
|
+ COLUMN_FRIEND + " REAL, "
|
||||||
|
+ COLUMN_SATSTART + " REAL, "
|
||||||
|
+ COLUMN_SATEND + " REAL, "
|
||||||
|
+ COLUMN_SUNSTART + " REAL, "
|
||||||
|
+ COLUMN_SUNEND + " REAL)");
|
||||||
|
|
||||||
|
db.execSQL("ALTER TABLE " + TABLE_LOGIN + " ADD COLUMN " + COLUMN_ADDRESS + " TEXT");
|
||||||
|
db.execSQL("ALTER TABLE " + TABLE_LOGIN + " ADD COLUMN " + COLUMN_PHONE + " TEXT");
|
||||||
|
db.execSQL("ALTER TABLE " + TABLE_LOGIN + " ADD COLUMN " + COLUMN_COMPANY + " TEXT");
|
||||||
|
db.execSQL("ALTER TABLE " + TABLE_LOGIN + " ADD COLUMN " + COLUMN_LICENSED + " TEXT");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +217,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
* @return whether adding user was successful
|
* @return whether adding user was successful
|
||||||
*/
|
*/
|
||||||
public boolean addUser(UserType userType){
|
public boolean addUser(UserType userType){
|
||||||
|
if (userType == null) return false;
|
||||||
//Check for duplicate username by querying login table
|
//Check for duplicate username by querying login table
|
||||||
Cursor cursor = writeDB.query(TABLE_LOGIN,
|
Cursor cursor = writeDB.query(TABLE_LOGIN,
|
||||||
new String[] {COLUMN_USERNAME},
|
new String[] {COLUMN_USERNAME},
|
||||||
|
@ -137,10 +238,35 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
values.put(COLUMN_FIRSTNAME, userType.getFirstname());
|
values.put(COLUMN_FIRSTNAME, userType.getFirstname());
|
||||||
values.put(COLUMN_LASTNAME, userType.getLastname());
|
values.put(COLUMN_LASTNAME, userType.getLastname());
|
||||||
values.put(COLUMN_USERTYPE, userType.getClass().getSimpleName());
|
values.put(COLUMN_USERTYPE, userType.getClass().getSimpleName());
|
||||||
|
if (userType instanceof ServiceProvider){
|
||||||
|
ServiceProvider serviceProvider = (ServiceProvider)userType;
|
||||||
|
|
||||||
|
String address = serviceProvider.getAddress();
|
||||||
|
if (address != null){
|
||||||
|
values.put(COLUMN_ADDRESS, address);
|
||||||
|
}
|
||||||
|
|
||||||
|
String phone = serviceProvider.getPhonenumber();
|
||||||
|
if (phone != null){
|
||||||
|
values.put(COLUMN_PHONE, phone);
|
||||||
|
}
|
||||||
|
|
||||||
|
String company = serviceProvider.getCompanyname();
|
||||||
|
if (company != null){
|
||||||
|
values.put(COLUMN_COMPANY, company);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean licensed = serviceProvider.isLicensed();
|
||||||
|
values.put(COLUMN_LICENSED, Boolean.toString(licensed));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
writeDB.insert(TABLE_LOGIN, null, values);
|
writeDB.insert(TABLE_LOGIN, null, values);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks in database for user with requested username, and returns an
|
* Looks in database for user with requested username, and returns an
|
||||||
* object of UserType corresponding to said user's role.
|
* object of UserType corresponding to said user's role.
|
||||||
|
@ -150,7 +276,8 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
* @return object representing user found
|
* @return object representing user found
|
||||||
*/
|
*/
|
||||||
public UserType findUserByUsername(String username){
|
public UserType findUserByUsername(String username){
|
||||||
UserType usertype;
|
if (username == null) return null;
|
||||||
|
UserType usertype = null;
|
||||||
Cursor cursor = readDB.rawQuery("SELECT * FROM " + TABLE_LOGIN
|
Cursor cursor = readDB.rawQuery("SELECT * FROM " + TABLE_LOGIN
|
||||||
+ " WHERE " + COLUMN_USERNAME + " = ?",
|
+ " WHERE " + COLUMN_USERNAME + " = ?",
|
||||||
new String[]{username});
|
new String[]{username});
|
||||||
|
@ -159,18 +286,24 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
String password = cursor.getString(1);
|
String password = cursor.getString(1);
|
||||||
String firstname = cursor.getString(2);
|
String firstname = cursor.getString(2);
|
||||||
String lastname = cursor.getString(3);
|
String lastname = cursor.getString(3);
|
||||||
|
String address = cursor.getString(5);
|
||||||
|
String phonenumber = cursor.getString(6);
|
||||||
|
String companyname = cursor.getString(7);
|
||||||
|
boolean licensed = Boolean.parseBoolean(cursor.getString(8));
|
||||||
if (cursor.getString(4)
|
if (cursor.getString(4)
|
||||||
.equals("Admin")){
|
.equals("Admin")){
|
||||||
usertype = new Admin();
|
usertype = new Admin();
|
||||||
} else if (cursor.getString(4)
|
} else if (cursor.getString(4)
|
||||||
.equals("ServiceProvider")){
|
.equals("ServiceProvider")){
|
||||||
usertype = new ServiceProvider(username, password, firstname, lastname);
|
ServiceProvider serviceProvider = new ServiceProvider(username, password, firstname, lastname, address, phonenumber, companyname, licensed);
|
||||||
|
getAllServicesProvidedByUser(serviceProvider);
|
||||||
|
getAvailabilities(serviceProvider);
|
||||||
|
usertype = serviceProvider;
|
||||||
} else {
|
} else {
|
||||||
usertype = new HomeOwner(username, password, firstname, lastname);
|
usertype = new HomeOwner(username, password, firstname, lastname);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
usertype = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor.close();
|
cursor.close();
|
||||||
return usertype;
|
return usertype;
|
||||||
}
|
}
|
||||||
|
@ -189,14 +322,27 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
* @return whether updating user information was successful
|
* @return whether updating user information was successful
|
||||||
*/
|
*/
|
||||||
public boolean updateUserInfo(String username, String password, String firstname, String lastname){
|
public boolean updateUserInfo(String username, String password, String firstname, String lastname){
|
||||||
|
return updateUserInfo(username, password, firstname, lastname,
|
||||||
|
null, null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public boolean updateUserInfo(String username, String password, String firstname, String lastname,
|
||||||
|
String address, String phonenumber, String companyname, Boolean licensed){
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(COLUMN_PASSWORD, password);
|
if (password != null && !password.equals("")) values.put(COLUMN_PASSWORD, password);
|
||||||
values.put(COLUMN_FIRSTNAME, firstname);
|
if (firstname != null && !firstname.equals("")) values.put(COLUMN_FIRSTNAME, firstname);
|
||||||
values.put(COLUMN_LASTNAME, lastname);
|
if (lastname != null && !lastname.equals(""))values.put(COLUMN_LASTNAME, lastname);
|
||||||
|
if (address != null && !address.equals(""))values.put(COLUMN_ADDRESS, address);
|
||||||
|
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, Boolean.toString(licensed));
|
||||||
|
|
||||||
|
|
||||||
return writeDB.update(TABLE_LOGIN, values, COLUMN_USERNAME+" = ?",
|
return writeDB.update(TABLE_LOGIN, values, COLUMN_USERNAME+" = ?",
|
||||||
new String[]{username}) > 0;
|
new String[]{username}) > 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -236,11 +382,12 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
* @return whether adding service was successful
|
* @return whether adding service was successful
|
||||||
*/
|
*/
|
||||||
public boolean addService(Service service){
|
public boolean addService(Service service){
|
||||||
//Check for duplicate username by querying login table
|
if (service == null) return false;
|
||||||
|
//Check for duplicate username by querying services table
|
||||||
Cursor cursor = writeDB.query(TABLE_SERVICES,
|
Cursor cursor = writeDB.query(TABLE_SERVICES,
|
||||||
new String[] {COLUMN_SERVICE},
|
new String[] {COLUMN_SERVICE},
|
||||||
COLUMN_SERVICE + " = ?",
|
COLUMN_SERVICE + " = ?",
|
||||||
new String[]{service.getName()},
|
new String[]{service.getName().toLowerCase().trim()},
|
||||||
null, null, null,
|
null, null, null,
|
||||||
"1");
|
"1");
|
||||||
//If cursor has 1+ elements in it, username already exists in table
|
//If cursor has 1+ elements in it, username already exists in table
|
||||||
|
@ -251,7 +398,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(COLUMN_SERVICE, service.getName());
|
values.put(COLUMN_SERVICE, service.getName().toLowerCase().trim());
|
||||||
values.put(COLUMN_RATE, service.getRate());
|
values.put(COLUMN_RATE, service.getRate());
|
||||||
writeDB.insert(TABLE_SERVICES, null, values);
|
writeDB.insert(TABLE_SERVICES, null, values);
|
||||||
return true;
|
return true;
|
||||||
|
@ -266,7 +413,10 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
* @return object representing service found
|
* @return object representing service found
|
||||||
*/
|
*/
|
||||||
public Service findService(String serviceName){
|
public Service findService(String serviceName){
|
||||||
|
if (serviceName == null) return null;
|
||||||
|
|
||||||
Service service;
|
Service service;
|
||||||
|
serviceName = serviceName.toLowerCase().trim();
|
||||||
Cursor cursor = readDB.rawQuery("SELECT * FROM " + TABLE_SERVICES
|
Cursor cursor = readDB.rawQuery("SELECT * FROM " + TABLE_SERVICES
|
||||||
+ " WHERE " + COLUMN_SERVICE + " = ?",
|
+ " WHERE " + COLUMN_SERVICE + " = ?",
|
||||||
new String[]{serviceName});
|
new String[]{serviceName});
|
||||||
|
@ -293,11 +443,12 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
* @return whether updating service information was successful
|
* @return whether updating service information was successful
|
||||||
*/
|
*/
|
||||||
public boolean updateService(Service service){
|
public boolean updateService(Service service){
|
||||||
|
if (service == null) return false;
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(COLUMN_RATE, service.getRate());
|
values.put(COLUMN_RATE, service.getRate());
|
||||||
|
|
||||||
return writeDB.update(TABLE_SERVICES, values, COLUMN_SERVICE+" = ?",
|
return writeDB.update(TABLE_SERVICES, values, COLUMN_SERVICE+" = ?",
|
||||||
new String[]{service.getName()}) > 0;
|
new String[]{service.getName().toLowerCase().trim()}) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -312,6 +463,9 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
* @return whether updating service information was successful
|
* @return whether updating service information was successful
|
||||||
*/
|
*/
|
||||||
public boolean updateService(String name, double rate){
|
public boolean updateService(String name, double rate){
|
||||||
|
if (name == null) return false;
|
||||||
|
|
||||||
|
name = name.toLowerCase().trim();
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
if (rate > 0)
|
if (rate > 0)
|
||||||
values.put(COLUMN_RATE, rate);
|
values.put(COLUMN_RATE, rate);
|
||||||
|
@ -322,15 +476,37 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks in database for a service, and deletes the corresponding
|
* Looks in database for a service, and deletes the corresponding
|
||||||
* entry. Returns true if a user was deleted, false otherwise.
|
* entry. Returns true if a service was deleted, false otherwise.
|
||||||
*
|
*
|
||||||
* @param service service of entry to delete
|
* @param service service of entry to delete
|
||||||
* @return whether the service was deleted
|
* @return whether the service was deleted
|
||||||
*/
|
*/
|
||||||
public boolean deleteService(String service) {
|
public boolean deleteService(String service) {
|
||||||
return writeDB.delete(TABLE_SERVICES, COLUMN_SERVICE+" = ?",
|
if (service == null) return false;
|
||||||
|
|
||||||
|
boolean deleted;
|
||||||
|
String nullify = null;
|
||||||
|
service = service.toLowerCase().trim();
|
||||||
|
ContentValues contentValues = new ContentValues();
|
||||||
|
contentValues.put(COLUMN_SERVICEPROVIDERSERVICE, nullify);
|
||||||
|
writeDB.update(TABLE_SERVICEPROVIDERS, contentValues, COLUMN_SERVICEPROVIDERSERVICE+" = ?",
|
||||||
|
new String[]{service});
|
||||||
|
|
||||||
|
deleted = writeDB.delete(TABLE_SERVICES, COLUMN_SERVICE+" = ?",
|
||||||
new String[]{service}) > 0;
|
new String[]{service}) > 0;
|
||||||
|
|
||||||
|
if (deleted) {
|
||||||
|
writeDB.delete(TABLE_SERVICEPROVIDERS, COLUMN_SERVICEPROVIDERSERVICE+" = ?",
|
||||||
|
new String[]{service});
|
||||||
|
} else {
|
||||||
|
ContentValues restoreContentValues = new ContentValues();
|
||||||
|
restoreContentValues.put(COLUMN_SERVICEPROVIDERSERVICE, service);
|
||||||
|
writeDB.update(TABLE_SERVICEPROVIDERS, restoreContentValues, COLUMN_SERVICEPROVIDERSERVICE+" = ?",
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
|
return deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of String arrays containing the service categories,
|
* Returns a list of String arrays containing the service categories,
|
||||||
|
@ -339,7 +515,184 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
* @return list of arrays of [service, rate]
|
* @return list of arrays of [service, rate]
|
||||||
*/
|
*/
|
||||||
public List<String[]> getAllServices(){
|
public List<String[]> getAllServices(){
|
||||||
return getAll("SELECT * FROM " + TABLE_SERVICES);
|
return getAll("SELECT * FROM " + TABLE_SERVICES + " ORDER BY " + COLUMN_SERVICE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean addServiceProvidedByUser(ServiceProvider serviceProvider, Service service){
|
||||||
|
if (serviceProvider == null || service == null) return false;
|
||||||
|
return addServiceProvidedByUser(serviceProvider.getUsername(), service.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean addServiceProvidedByUser(ServiceProvider serviceProvider, String serviceName){
|
||||||
|
if (serviceProvider == null || serviceName == null) return false;
|
||||||
|
return addServiceProvidedByUser(serviceProvider.getUsername(), serviceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean addServiceProvidedByUser(String serviceProviderUsername, String serviceName){
|
||||||
|
if (serviceProviderUsername == null || serviceName == null) return false;
|
||||||
|
|
||||||
|
//TODO: Check if serviceProviderUsername and serviceName are in db before adding
|
||||||
|
|
||||||
|
serviceName = serviceName.toLowerCase().trim();
|
||||||
|
|
||||||
|
//Check for duplicate username/service combination by querying login table
|
||||||
|
Cursor cursor = writeDB.query(TABLE_SERVICEPROVIDERS,
|
||||||
|
new String[] {COLUMN_SERVICEPROVIDERNAME},
|
||||||
|
COLUMN_SERVICEPROVIDERNAME + " = ? AND "
|
||||||
|
+ COLUMN_SERVICEPROVIDERSERVICE + " = ?",
|
||||||
|
new String[]{serviceProviderUsername, serviceName},
|
||||||
|
null, null, null,
|
||||||
|
"1");
|
||||||
|
//If cursor has 1+ elements in it, username already exists in table
|
||||||
|
if (cursor != null && cursor.getCount() > 0){
|
||||||
|
cursor.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
cursor.close();
|
||||||
|
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.put(COLUMN_SERVICEPROVIDERNAME, serviceProviderUsername);
|
||||||
|
values.put(COLUMN_SERVICEPROVIDERSERVICE, serviceName);
|
||||||
|
writeDB.insert(TABLE_SERVICEPROVIDERS, null, values);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean deleteServiceProvidedByUser(ServiceProvider serviceProvider, Service service){
|
||||||
|
if (serviceProvider == null || service == null) return false;
|
||||||
|
return deleteServiceProvidedByUser(serviceProvider.getUsername(), service.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean deleteServiceProvidedByUser(ServiceProvider serviceProvider, String serviceName){
|
||||||
|
if (serviceProvider == null || serviceName == null) return false;
|
||||||
|
return deleteServiceProvidedByUser(serviceProvider.getUsername(), serviceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean deleteServiceProvidedByUser(String serviceProviderUsername, String serviceName){
|
||||||
|
if (serviceProviderUsername == null || serviceName == null) return false;
|
||||||
|
serviceName = serviceName.toLowerCase().trim();
|
||||||
|
return writeDB.delete(TABLE_SERVICEPROVIDERS,
|
||||||
|
COLUMN_SERVICEPROVIDERNAME + " = ? AND "
|
||||||
|
+ COLUMN_SERVICEPROVIDERSERVICE + " = ?",
|
||||||
|
new String[]{serviceProviderUsername, serviceName}) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String[]> getAllServicesProvidedByUser(ServiceProvider serviceProvider){
|
||||||
|
if (serviceProvider == null) return new ArrayList<>();
|
||||||
|
|
||||||
|
return getAllServicesProvidedByUser(serviceProvider.getUsername());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String[]> getAllServicesProvidedByUser(String serviceProviderName){
|
||||||
|
if (serviceProviderName == null) return new ArrayList<>();
|
||||||
|
|
||||||
|
return getAll("SELECT " + TABLE_SERVICES + "." + COLUMN_SERVICE + ", "
|
||||||
|
+ TABLE_SERVICES + "." + COLUMN_RATE
|
||||||
|
+ " FROM " + TABLE_SERVICES
|
||||||
|
+ " JOIN " + TABLE_SERVICEPROVIDERS
|
||||||
|
+ " ON " + TABLE_SERVICEPROVIDERS + "." + COLUMN_SERVICEPROVIDERSERVICE + " = "
|
||||||
|
+ TABLE_SERVICES + "." + COLUMN_SERVICE
|
||||||
|
+ " AND " + TABLE_SERVICEPROVIDERS + "." + COLUMN_SERVICEPROVIDERNAME
|
||||||
|
+ "= '" + serviceProviderName + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String[]> getAllProvidersByService(Service service){
|
||||||
|
if (service == null) return new ArrayList<>();
|
||||||
|
|
||||||
|
return getAllProvidersByService(service.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String[]> getAllProvidersByService(String serviceName){
|
||||||
|
if (serviceName == null) return new ArrayList<>();
|
||||||
|
|
||||||
|
serviceName = serviceName.toLowerCase().trim();
|
||||||
|
return getAll("SELECT " + COLUMN_SERVICEPROVIDERNAME
|
||||||
|
+ " FROM " + TABLE_SERVICEPROVIDERS
|
||||||
|
+ " WHERE " + COLUMN_SERVICEPROVIDERSERVICE + " = '"
|
||||||
|
+ serviceName + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateAvailability(ServiceProvider serviceProvider){
|
||||||
|
//availability is stored as number of minutes from 00:00
|
||||||
|
if (serviceProvider == null) return false;
|
||||||
|
int[][] availabilities = serviceProvider.getAvailabilities();
|
||||||
|
if (availabilities == null) return false;
|
||||||
|
|
||||||
|
Cursor cursor = readDB.rawQuery("SELECT * FROM " + TABLE_AVAILABILITY
|
||||||
|
+ " WHERE " + COLUMN_AVAILABILITYNAME + " = ?",
|
||||||
|
new String[]{serviceProvider.getUsername()});
|
||||||
|
|
||||||
|
ContentValues contentValues = new ContentValues();
|
||||||
|
addAvailabilityToContentValues(contentValues, COLUMN_MONSTART, COLUMN_MONEND, availabilities[0]);
|
||||||
|
addAvailabilityToContentValues(contentValues, COLUMN_TUESTART, COLUMN_TUEEND, availabilities[1]);
|
||||||
|
addAvailabilityToContentValues(contentValues, COLUMN_WEDSTART, COLUMN_WEDEND, availabilities[2]);
|
||||||
|
addAvailabilityToContentValues(contentValues, COLUMN_THUSTART, COLUMN_THUEND, availabilities[3]);
|
||||||
|
addAvailabilityToContentValues(contentValues, COLUMN_FRISTART, COLUMN_FRIEND, availabilities[4]);
|
||||||
|
addAvailabilityToContentValues(contentValues, COLUMN_SATSTART, COLUMN_SATEND, availabilities[5]);
|
||||||
|
addAvailabilityToContentValues(contentValues, COLUMN_SUNSTART, COLUMN_SUNEND, availabilities[6]);
|
||||||
|
if (!cursor.moveToFirst()){
|
||||||
|
contentValues.put(COLUMN_AVAILABILITYNAME, serviceProvider.getUsername());
|
||||||
|
writeDB.insert(TABLE_AVAILABILITY, null, contentValues);
|
||||||
|
} else {
|
||||||
|
writeDB.update(TABLE_AVAILABILITY, contentValues,
|
||||||
|
COLUMN_AVAILABILITYNAME + " = ?", new String[]{serviceProvider.getUsername()});
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addAvailabilityToContentValues(ContentValues contentValues,
|
||||||
|
String startColumn, String endColumn,
|
||||||
|
int[] startAndEndTimes){
|
||||||
|
if (startAndEndTimes == null){
|
||||||
|
contentValues.put(startColumn, 0);
|
||||||
|
contentValues.put(endColumn, 0);
|
||||||
|
} else {
|
||||||
|
int startTime = startAndEndTimes[0]*60+startAndEndTimes[1];
|
||||||
|
int endTime = startAndEndTimes[2]*60+startAndEndTimes[3];
|
||||||
|
if (endTime - startTime <=0 || startTime > 1439 || startTime <= 0
|
||||||
|
|| endTime > 1439 || endTime <= 0) {
|
||||||
|
contentValues.put(startColumn, 0);
|
||||||
|
contentValues.put(endColumn, 0);
|
||||||
|
} else {
|
||||||
|
contentValues.put(startColumn, startTime);
|
||||||
|
contentValues.put(endColumn, endTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//note that this method overwrites serviceProvider's availability if it exists
|
||||||
|
public int[][] getAvailabilities(ServiceProvider serviceProvider){
|
||||||
|
if (serviceProvider==null) return new int[7][4];
|
||||||
|
Cursor cursor = readDB.rawQuery("SELECT * FROM " + TABLE_AVAILABILITY
|
||||||
|
+ " WHERE " + COLUMN_AVAILABILITYNAME + " = ?",
|
||||||
|
new String[]{serviceProvider.getUsername()});
|
||||||
|
if (cursor.moveToFirst()){
|
||||||
|
for (int i = 0; i < 7; i++) {
|
||||||
|
int start = cursor.getInt(i*2+1);
|
||||||
|
int end = cursor.getInt(i*2+2);
|
||||||
|
serviceProvider.setAvailabilities(i, start/60, start%60,
|
||||||
|
end/60, end%60);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return serviceProvider.getAvailabilities();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getAvailabilities(String serviceProviderName){
|
||||||
|
int[][] availabilities = new int[7][4];
|
||||||
|
if (serviceProviderName==null) return availabilities;
|
||||||
|
|
||||||
|
Cursor cursor = readDB.rawQuery("SELECT * FROM " + TABLE_AVAILABILITY
|
||||||
|
+ " WHERE " + COLUMN_AVAILABILITYNAME + " = ?",
|
||||||
|
new String[]{serviceProviderName});
|
||||||
|
if (cursor.moveToFirst()){
|
||||||
|
for (int i = 0; i < 7; i++) {
|
||||||
|
int start = cursor.getInt(i*2+1);
|
||||||
|
int end = cursor.getInt(i*2+2);
|
||||||
|
availabilities[i] = new int[]{start/60, start%60, end/60, end%60};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return availabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -363,6 +716,11 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all items in a table
|
||||||
|
* @param rawQuery SELECT * query
|
||||||
|
* @return list of array representing all items in raw query
|
||||||
|
*/
|
||||||
private List<String[]> getAll(String rawQuery){
|
private List<String[]> getAll(String rawQuery){
|
||||||
List<String[]> list = new LinkedList<>();
|
List<String[]> list = new LinkedList<>();
|
||||||
String[] infoArray;
|
String[] infoArray;
|
||||||
|
@ -383,3 +741,4 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class DeleteServiceDialogFragment extends DialogFragment{
|
||||||
|
public interface NoticeDialogListener {
|
||||||
|
public void onDialogDelete(DialogFragment dialog);
|
||||||
|
public void onDialogNevermind(DialogFragment dialog);
|
||||||
|
}
|
||||||
|
DeleteServiceDialogFragment.NoticeDialogListener mListener;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
// Verify that the host activity implements the callback interface
|
||||||
|
try {
|
||||||
|
// Instantiate the NoticeDialogListener so we can send events to the host
|
||||||
|
mListener = (DeleteServiceDialogFragment.NoticeDialogListener) context;
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
// The activity doesn't implement the interface, throw exception
|
||||||
|
throw new ClassCastException(this.toString()
|
||||||
|
+ " must implement NoticeDialogListener");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
// Get the layout inflater
|
||||||
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
|
|
||||||
|
// Inflate and set the layout for the dialog
|
||||||
|
// Pass null as the parent view because its going in the dialog layout
|
||||||
|
builder.setView(inflater.inflate(R.layout.dialog_service_delete, null))
|
||||||
|
// Add action buttons
|
||||||
|
.setPositiveButton(R.string.remove, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString("name", (String)getArguments().get("name"));
|
||||||
|
DeleteServiceDialogFragment.this.setArguments(args);
|
||||||
|
mListener.onDialogDelete(DeleteServiceDialogFragment.this);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString("name", (String)getArguments().get("name"));
|
||||||
|
mListener.onDialogNevermind(DeleteServiceDialogFragment.this);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setTitle((String)getArguments().get("name"));
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
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 EditProfile extends AppCompatActivity {
|
||||||
|
String username;
|
||||||
|
DBHelper dbHelper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_edit_profile);
|
||||||
|
Bundle bundle = getIntent().getExtras();
|
||||||
|
username = bundle.getString("username");
|
||||||
|
dbHelper = new DBHelper(this);
|
||||||
|
ServiceProvider user;
|
||||||
|
user = (ServiceProvider)dbHelper.findUserByUsername(username);
|
||||||
|
TextView firstname = findViewById(R.id.FirstNameInput);
|
||||||
|
TextView lastname = findViewById(R.id.LastNameInput);
|
||||||
|
TextView password = findViewById(R.id.PasswordInput);
|
||||||
|
TextView companyname = findViewById(R.id.CompanyNameInput);
|
||||||
|
TextView address = findViewById(R.id.AddressInput);
|
||||||
|
TextView phonenumber = findViewById(R.id.PhoneNumberInput);
|
||||||
|
CheckBox licensed = findViewById(R.id.LicensedInput);
|
||||||
|
|
||||||
|
|
||||||
|
firstname.setText(user.getFirstname());
|
||||||
|
lastname.setText(user.getLastname());
|
||||||
|
password.setText(user.getPassword());
|
||||||
|
companyname.setText(user.getCompanyname());
|
||||||
|
address.setText(user.getAddress());
|
||||||
|
phonenumber.setText(user.getPhonenumber());
|
||||||
|
licensed.setChecked(user.isLicensed());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
|
public void Save(View view){
|
||||||
|
TextView firstname = findViewById(R.id.FirstNameInput);
|
||||||
|
TextView lastname = findViewById(R.id.LastNameInput);
|
||||||
|
TextView password = findViewById(R.id.PasswordInput);
|
||||||
|
TextView companyname = findViewById(R.id.CompanyNameInput);
|
||||||
|
TextView address = findViewById(R.id.AddressInput);
|
||||||
|
TextView phonenumber = findViewById(R.id.PhoneNumberInput);
|
||||||
|
CheckBox licensed = findViewById(R.id.LicensedInput);
|
||||||
|
|
||||||
|
if(password.getText().toString().length()>=5 && firstname.getText().toString().length()>0
|
||||||
|
&& lastname.getText().toString().length()>0 && companyname.getText().toString().length()>0
|
||||||
|
&& address.getText().toString().length()>0 && phonenumber.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]*")
|
||||||
|
&& companyname.getText().toString().matches("^[a-zA-Z0-9_ ]*$")
|
||||||
|
&& address.getText().toString().matches("^[a-zA-Z0-9_ ]*$")
|
||||||
|
&& phonenumber.getText().toString().matches("^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}$")
|
||||||
|
) {
|
||||||
|
|
||||||
|
if(dbHelper.updateUserInfo(username, password.getText().toString(), firstname.getText().toString(), lastname.getText().toString(),
|
||||||
|
address.getText().toString(), phonenumber.getText().toString(), companyname.getText().toString(), licensed.isChecked())){
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -7,10 +7,17 @@ import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class EditServiceDialogFragment extends DialogFragment{
|
public class EditServiceDialogFragment extends DialogFragment{
|
||||||
|
|
||||||
public interface NoticeDialogListener {
|
/**
|
||||||
|
* Creates a NoticeDialogListener interface for other classes to
|
||||||
|
* implement to have this class be functional in the other classes.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface NoticeDialogListener {
|
||||||
public void onDialogEdit(DialogFragment dialog);
|
public void onDialogEdit(DialogFragment dialog);
|
||||||
public void onDialogDelete(DialogFragment dialog);
|
public void onDialogDelete(DialogFragment dialog);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +37,14 @@ public interface NoticeDialogListener {
|
||||||
+ " must implement NoticeDialogListener");
|
+ " must implement NoticeDialogListener");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit the Dialog to change rate of a service that the
|
||||||
|
* admin wants to change.
|
||||||
|
*
|
||||||
|
* @param savedInstanceState Bundle to transfer information.
|
||||||
|
* @return Dialog that is sent to admin for information.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
@ -44,24 +59,32 @@ public interface NoticeDialogListener {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
//@anshu: get the name and rate to come from the dialog_service_new dialog
|
args.putString("name", (String)getArguments().get("name"));
|
||||||
args.putString("name", "hey");
|
EditText rateInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.RateInput);
|
||||||
args.putDouble("rate", 2.5);
|
if(rateInput.getText().toString().length()>0 && !rateInput.getText().toString().equals(".")){
|
||||||
//
|
Double rate = Double.parseDouble(rateInput.getText().toString());
|
||||||
|
args.putDouble("rate", rate);
|
||||||
|
|
||||||
EditServiceDialogFragment.this.setArguments(args);
|
EditServiceDialogFragment.this.setArguments(args);
|
||||||
mListener.onDialogEdit(EditServiceDialogFragment.this);
|
mListener.onDialogEdit(EditServiceDialogFragment.this);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
Toast.makeText(getContext(), "Rate cannot be empty", Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.delete, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.delete, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
//@anshu: get the name and rate to come from the dialog_service_new dialog
|
args.putString("name", (String)getArguments().get("name"));
|
||||||
args.putString("name", "hey");
|
|
||||||
//
|
|
||||||
EditServiceDialogFragment.this.setArguments(args);
|
EditServiceDialogFragment.this.setArguments(args);
|
||||||
mListener.onDialogDelete(EditServiceDialogFragment.this);
|
mListener.onDialogDelete(EditServiceDialogFragment.this);
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.setTitle((String)getArguments().get("name"));
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,35 @@
|
||||||
package com.uottawa.olympus.olympusservices;
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class HomeOwner is a child of the class userType. The class permission
|
||||||
|
* to the user of a standard homeowner hence users with homeowner permissions
|
||||||
|
* are able to book service providers. Has not been implemented yet.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public class HomeOwner extends UserType {
|
public class HomeOwner extends UserType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor of the HomeOwner object that takes the username, password,
|
||||||
|
* lastname, and firstname as parameters to use for the creation of a
|
||||||
|
* HomeOwner object.
|
||||||
|
*
|
||||||
|
* @param username String for username.
|
||||||
|
* @param password String for password.
|
||||||
|
* @param firstname String for firstname.
|
||||||
|
* @param lastname String for lastname.
|
||||||
|
*/
|
||||||
HomeOwner(String username, String password, String firstname, String lastname){
|
HomeOwner(String username, String password, String firstname, String lastname){
|
||||||
super(username, password, firstname, lastname);
|
super(username, password, firstname, lastname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the type of role the user is for this class.
|
||||||
|
* will return the string "HomeOwner".
|
||||||
|
*
|
||||||
|
* @return "HomeOwner" String object.
|
||||||
|
*/
|
||||||
public String getRole(){ return "HomeOwner"; }
|
public String getRole(){ return "HomeOwner"; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,34 @@ import android.widget.EditText;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The login activity for the app that checks
|
||||||
|
* credentials of users to allow them to log in and use
|
||||||
|
* the functionality of the app.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public class LogIn extends AppCompatActivity {
|
public class LogIn extends AppCompatActivity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On creation of this activity the login xml file
|
||||||
|
* is loaded up.
|
||||||
|
*
|
||||||
|
* @param savedInstanceState Bundle object for transfer of information.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_log_in);
|
setContentView(R.layout.activity_log_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On click of the login button the app checks if all specification
|
||||||
|
* for login credentials are met and then either sends an error toast
|
||||||
|
* or logs the user in.
|
||||||
|
*
|
||||||
|
* @param view View object that contains all the buttons and editTexts.
|
||||||
|
*/
|
||||||
public void onClickLogIn(View view){
|
public void onClickLogIn(View view){
|
||||||
String username = ((EditText) findViewById(R.id.UsernameInput)).getText().toString();
|
String username = ((EditText) findViewById(R.id.UsernameInput)).getText().toString();
|
||||||
String password = ((EditText) findViewById(R.id.PasswordInput)).getText().toString();
|
String password = ((EditText) findViewById(R.id.PasswordInput)).getText().toString();
|
||||||
|
@ -30,6 +50,12 @@ public class LogIn extends AppCompatActivity {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
else if(user.getRole()=="ServiceProvider"){
|
||||||
|
Intent intent = new Intent(getApplicationContext(),ServiceProviderWelcome.class);
|
||||||
|
intent.putExtra("username", username);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
Intent intent = new Intent(getApplicationContext(),Welcome.class);
|
Intent intent = new Intent(getApplicationContext(),Welcome.class);
|
||||||
intent.putExtra("username", username);
|
intent.putExtra("username", username);
|
||||||
|
@ -54,6 +80,12 @@ public class LogIn extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app closes the the activity when back is pressed and
|
||||||
|
* no user information written down is saved in the EditText for
|
||||||
|
* security purposes.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed(){
|
public void onBackPressed(){
|
||||||
Intent intent = new Intent(getApplicationContext(), Main.class);
|
Intent intent = new Intent(getApplicationContext(), Main.class);
|
||||||
|
|
|
@ -5,8 +5,21 @@ import android.os.Bundle;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The starting page of the app which contains two buttons
|
||||||
|
* of either registering for the app or logging into an existing
|
||||||
|
* account.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public class Main extends AppCompatActivity {
|
public class Main extends AppCompatActivity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On creation of the object the app loads up the xml page
|
||||||
|
* for the class and creates dbHelper object and Admin object
|
||||||
|
* and then add the admin into the database.
|
||||||
|
* @param savedInstanceState
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -18,6 +31,11 @@ public class Main extends AppCompatActivity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On click of the sign up button loads up the sign up activity
|
||||||
|
*
|
||||||
|
* @param view View object containing the buttons.
|
||||||
|
*/
|
||||||
public void onClickSignUp(View view){
|
public void onClickSignUp(View view){
|
||||||
Intent intent = new Intent(getApplicationContext(),SignUp.class);
|
Intent intent = new Intent(getApplicationContext(),SignUp.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
@ -25,6 +43,11 @@ public class Main extends AppCompatActivity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On click of the Login button loads up the login activity.
|
||||||
|
*
|
||||||
|
* @param view View object containing the buttons.
|
||||||
|
*/
|
||||||
public void onClickLogIn(View view){
|
public void onClickLogIn(View view){
|
||||||
Intent intent = new Intent(getApplicationContext(),LogIn.class);
|
Intent intent = new Intent(getApplicationContext(),LogIn.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -8,8 +8,29 @@ import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.rengwuxian.materialedittext.MaterialEditText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a dialog whenever admin adds a new service into the
|
||||||
|
* service list which the admin fills in to provide the fields of
|
||||||
|
* the service.
|
||||||
|
*/
|
||||||
public class NewServiceDialogFragment extends DialogFragment {
|
public class NewServiceDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a NoticeDialogListener interface for other classes to
|
||||||
|
* implement to have this class be functional in the other classes.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface NoticeDialogListener {
|
public interface NoticeDialogListener {
|
||||||
public void onDialogNew(DialogFragment dialog);
|
public void onDialogNew(DialogFragment dialog);
|
||||||
public void onDialogNevermind(DialogFragment dialog);
|
public void onDialogNevermind(DialogFragment dialog);
|
||||||
|
@ -30,27 +51,49 @@ public class NewServiceDialogFragment extends DialogFragment {
|
||||||
+ " must implement NoticeDialogListener");
|
+ " must implement NoticeDialogListener");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the Dialog to add the name and rate of a new service that
|
||||||
|
* the admin has added to the list of services.
|
||||||
|
*
|
||||||
|
* @param savedInstanceState Bundle to transfer information.
|
||||||
|
* @return Dialog that is sent to admin for information.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
// Get the layout inflater
|
// Get the layout inflater
|
||||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
|
View view = inflater.inflate(R.layout.dialog_service_new, null);
|
||||||
|
|
||||||
|
|
||||||
// Inflate and set the layout for the dialog
|
// Inflate and set the layout for the dialog
|
||||||
// Pass null as the parent view because its going in the dialog layout
|
// Pass null as the parent view because its going in the dialog layout
|
||||||
builder.setView(inflater.inflate(R.layout.dialog_service_new, null))
|
builder.setView(view)
|
||||||
// Add action buttons
|
// Add action buttons
|
||||||
.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
EditText nameInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.NameInput);
|
||||||
|
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 && !rateInput.getText().toString().equals(".") && name.length()>0 && name.matches("^[a-zA-Z0-9_ ]*$") && dbHelper.findService(name)==null){
|
||||||
|
Double rate = Double.parseDouble(rateInput.getText().toString());
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
//@anshu: get the name and rate to come from the dialog_service_new dialog
|
args.putString("name", name);
|
||||||
args.putString("name", "hey");
|
args.putDouble("rate", rate);
|
||||||
args.putDouble("rate", 2.5);
|
|
||||||
///
|
|
||||||
NewServiceDialogFragment.this.setArguments(args);
|
NewServiceDialogFragment.this.setArguments(args);
|
||||||
mListener.onDialogNew(NewServiceDialogFragment.this);
|
mListener.onDialogNew(NewServiceDialogFragment.this);
|
||||||
}
|
}
|
||||||
|
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{
|
||||||
|
Toast.makeText(getContext(), "Service already exists", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
|
@ -3,33 +3,78 @@ package com.uottawa.olympus.olympusservices;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates a service object that can be managed by admin and service providers
|
||||||
|
* and be viewed by the homeowner for the sale of service which is the main
|
||||||
|
* functionality of the app.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public class Service {
|
public class Service {
|
||||||
|
//name of the service field.
|
||||||
private String name;
|
private String name;
|
||||||
|
//rate of the service field.
|
||||||
private double rate;
|
private double rate;
|
||||||
|
//list of services the providers that offers this service.
|
||||||
private List<ServiceProvider> serviceProviders;
|
private List<ServiceProvider> serviceProviders;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for a new service which uses the parameters
|
||||||
|
* to fill in the fields of the service and creates an arrayList
|
||||||
|
* for all the providers that provide that service.
|
||||||
|
*
|
||||||
|
* @param name String of the name of service.
|
||||||
|
* @param rate double of the price of service.
|
||||||
|
*/
|
||||||
Service(String name, double rate) {
|
Service(String name, double rate) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rate = rate;
|
this.rate = rate;
|
||||||
serviceProviders = new ArrayList<ServiceProvider>();
|
serviceProviders = new ArrayList<ServiceProvider>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Name field of the service.
|
||||||
|
*
|
||||||
|
* @return String of the name.
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Rate field of the service.
|
||||||
|
*
|
||||||
|
* @return double of the rate.
|
||||||
|
*/
|
||||||
public double getRate() {
|
public double getRate() {
|
||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the name field of the object to parameter given.
|
||||||
|
*
|
||||||
|
* @param name String object of new name
|
||||||
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the rate field of the object to parameter given.
|
||||||
|
*
|
||||||
|
* @param rate double of new rate.
|
||||||
|
*/
|
||||||
public void setRate(double rate) {
|
public void setRate(double rate) {
|
||||||
this.rate = rate;
|
this.rate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new service provider that offers this service into the list
|
||||||
|
* of service providers that offer this service.
|
||||||
|
*
|
||||||
|
* @param user Service Provider object which is added to the service's list.
|
||||||
|
* @return boolean of if the Service provider has been added.
|
||||||
|
*/
|
||||||
public boolean addServiceProvider(ServiceProvider user){
|
public boolean addServiceProvider(ServiceProvider user){
|
||||||
for (ServiceProvider listUser : serviceProviders){
|
for (ServiceProvider listUser : serviceProviders){
|
||||||
if (user.getUsername().equals(listUser.getUsername())){
|
if (user.getUsername().equals(listUser.getUsername())){
|
||||||
|
|
|
@ -1,19 +1,72 @@
|
||||||
package com.uottawa.olympus.olympusservices;
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The service provider is the child userType class. The service provider
|
||||||
|
* class provides services which the homeowner can buy in the app.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public class ServiceProvider extends UserType {
|
public class ServiceProvider extends UserType {
|
||||||
|
|
||||||
|
//Field for list of services that service provider offers.
|
||||||
private List<Service> services;
|
private List<Service> services;
|
||||||
|
//Field for array of availabilities
|
||||||
|
/*
|
||||||
|
DO NOT CHANGE THIS ARRAY. The 2D array size is hard coded such that the first array has a size
|
||||||
|
of 7 and the array inside has an array size of 4. The array is setup such that the index represent a day of the
|
||||||
|
week. Monday is 0, Tuesday is 1, Wednesday is 2, Thursday is 3, Friday is 4, Saturday is 5,
|
||||||
|
Sunday is 6. so, [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]. Inside each of
|
||||||
|
the arrays there is a another array containing int values such that index 0,1,2,3 is startHour,
|
||||||
|
startMin, endHour, endMin respectively.
|
||||||
|
*/
|
||||||
|
private int[][] availabilities;
|
||||||
|
|
||||||
ServiceProvider(String username, String password, String firstname, String lastname){
|
private String address;
|
||||||
|
private String phonenumber;
|
||||||
|
private String companyname;
|
||||||
|
private boolean licensed;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the service object which takes the parameters to
|
||||||
|
* fill out the service providers field.
|
||||||
|
*
|
||||||
|
* @param username String of the username.
|
||||||
|
* @param password String of the password.
|
||||||
|
* @param firstname String of the firstname.
|
||||||
|
* @param lastname String of the 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];
|
||||||
|
this.address = address;
|
||||||
|
this.phonenumber = phonenumber;
|
||||||
|
this.companyname = companyname;
|
||||||
|
this.licensed = licensed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets the role of the UserType.
|
||||||
|
*
|
||||||
|
* @return String "Service Provider"
|
||||||
|
*/
|
||||||
public String getRole(){ return "ServiceProvider"; }
|
public String getRole(){ return "ServiceProvider"; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds service to the to service list if the service is in the
|
||||||
|
* database list of services.
|
||||||
|
*
|
||||||
|
* @param service Service object which is added to the services field.
|
||||||
|
* @return boolean whether service is added.
|
||||||
|
*/
|
||||||
public boolean addService(Service service){
|
public boolean addService(Service service){
|
||||||
for (Service listService : services){
|
for (Service listService : services){
|
||||||
if (service.getName().equals(listService.getName())){
|
if (service.getName().equals(listService.getName())){
|
||||||
|
@ -24,8 +77,65 @@ public class ServiceProvider extends UserType {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the services list field of service provider.
|
||||||
|
*
|
||||||
|
* @return arrayList of Services
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void setAvailabilities(int day, int startHour, int startMin, int endHour, int endMin){
|
||||||
|
availabilities[day][0] = startHour;
|
||||||
|
availabilities[day][1] = startMin;
|
||||||
|
availabilities[day][2] = endHour;
|
||||||
|
availabilities[day][3] = endMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getAvailabilities(){
|
||||||
|
return availabilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvailabilities(int[][] availabilities) {
|
||||||
|
this.availabilities = availabilities;
|
||||||
|
}
|
||||||
|
public void setServices(List<Service> services) {
|
||||||
|
this.services = services;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Service> getServices(){
|
public List<Service> getServices(){
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhonenumber() {
|
||||||
|
return phonenumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhonenumber(String phonenumber) {
|
||||||
|
this.phonenumber = phonenumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompanyname() {
|
||||||
|
return companyname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompanyname(String companyname) {
|
||||||
|
this.companyname = companyname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLicensed() {
|
||||||
|
return licensed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicensed(boolean licensed) {
|
||||||
|
this.licensed = licensed;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
import android.app.TimePickerDialog;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TimePicker;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
public class ServiceProviderAvailabilities extends AppCompatActivity {
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_service_provider_availabilities);
|
||||||
|
Bundle bundle = getIntent().getExtras();
|
||||||
|
username = bundle.getString("username");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onClick(View v) {
|
||||||
|
// Get Current Time
|
||||||
|
final Calendar c = Calendar.getInstance();
|
||||||
|
int hour = c.get(Calendar.HOUR_OF_DAY);
|
||||||
|
int minute = c.get(Calendar.MINUTE);
|
||||||
|
|
||||||
|
final Button button = (Button)v;
|
||||||
|
|
||||||
|
// Launch Time Picker Dialog
|
||||||
|
TimePickerDialog timePickerDialog = new TimePickerDialog(this,
|
||||||
|
new TimePickerDialog.OnTimeSetListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTimeSet(TimePicker view, int hourOfDay,
|
||||||
|
int minute) {
|
||||||
|
if (minute==0){
|
||||||
|
button.setText(hourOfDay + ":00");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
button.setText(hourOfDay + ":" + minute);
|
||||||
|
}
|
||||||
|
|
||||||
|
//set availibility for service provider and check start time is less than finish
|
||||||
|
}
|
||||||
|
|
||||||
|
}, hour, minute, false);
|
||||||
|
timePickerDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRemove(View view){
|
||||||
|
//set time to Start/End, set availibility for start and end to null
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,238 @@
|
||||||
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListAdapter;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.jaredrummler.materialspinner.MaterialSpinner;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the view and dialog listener for List of services
|
||||||
|
* which the admin can view and manipulate.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ServiceProviderServicesList extends AppCompatActivity implements DeleteServiceDialogFragment.NoticeDialogListener{
|
||||||
|
|
||||||
|
//field for RecyclerView
|
||||||
|
private RecyclerView mRecyclerView;
|
||||||
|
//field for adapter of Recycler view
|
||||||
|
private RecyclerView.Adapter mAdapter;
|
||||||
|
//field for layout manager of Recyler view.
|
||||||
|
private RecyclerView.LayoutManager mLayoutManager;
|
||||||
|
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On creation loads up the xml, and generates the services list,
|
||||||
|
* and fillsout the recylerView fields.
|
||||||
|
*
|
||||||
|
* @param savedInstanceState Bundle to transfer information.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_service_provider_services_list);
|
||||||
|
|
||||||
|
Bundle bundle = getIntent().getExtras();
|
||||||
|
username = bundle.getString("username");
|
||||||
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
|
|
||||||
|
//grid
|
||||||
|
List<String[]> serviceslist2 = dbHelper.getAllServicesProvidedByUser(username);
|
||||||
|
Service[] services2 = new Service[(serviceslist2.size())];
|
||||||
|
Iterator iter2 = serviceslist2.iterator();
|
||||||
|
for (int i=0; i<serviceslist2.size();i++){
|
||||||
|
String[] current = (String[])iter2.next();
|
||||||
|
services2[i] = new Service(current[0], Double.parseDouble(current[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
mRecyclerView = (RecyclerView) findViewById(R.id.Services);
|
||||||
|
|
||||||
|
|
||||||
|
mLayoutManager = new LinearLayoutManager(this);
|
||||||
|
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||||
|
|
||||||
|
mAdapter = new MyAdapter(services2, this);
|
||||||
|
mRecyclerView.setAdapter(mAdapter);
|
||||||
|
|
||||||
|
//spinner
|
||||||
|
MaterialSpinner spinner = findViewById(R.id.ServicesInput);
|
||||||
|
|
||||||
|
List<String[]> serviceslist = dbHelper.getAllServices();
|
||||||
|
String[] services = new String[(serviceslist.size())];
|
||||||
|
Iterator iter = serviceslist.iterator();
|
||||||
|
for (int i=0; i<serviceslist.size();i++){
|
||||||
|
String[] current = (String[])iter.next();
|
||||||
|
services[i] = current[0];
|
||||||
|
}
|
||||||
|
ArrayAdapter<String> servicesadapter = new ArrayAdapter<String>
|
||||||
|
(this, android.R.layout.simple_spinner_item, services);
|
||||||
|
|
||||||
|
servicesadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
|
||||||
|
spinner.setAdapter(servicesadapter);
|
||||||
|
|
||||||
|
spinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
|
||||||
|
|
||||||
|
@Override public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
|
||||||
|
Snackbar.make(view, "Clicked " + item, Snackbar.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes services from the list.
|
||||||
|
*
|
||||||
|
* @param view View object contains the generated list and buttons
|
||||||
|
*/
|
||||||
|
public void deleteService(View view, String name) {
|
||||||
|
DialogFragment newFragment = new DeleteServiceDialogFragment();
|
||||||
|
newFragment.show(getSupportFragmentManager(), "addService");
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString("name", name);
|
||||||
|
newFragment.setArguments(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds service to the list.
|
||||||
|
*
|
||||||
|
* @param view View object contains the generated list and buttons
|
||||||
|
*/
|
||||||
|
public void addService(View view) {
|
||||||
|
MaterialSpinner spinner = findViewById(R.id.ServicesInput);
|
||||||
|
String servicename = spinner.getText().toString();
|
||||||
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
|
if(dbHelper.addServiceProvidedByUser(username, servicename)){
|
||||||
|
this.recreate();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Toast.makeText(this, "Could not add service", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses Dialog to delete a service from the serviceList.
|
||||||
|
*
|
||||||
|
* @param dialog DialogFragment that contains the delete service button.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDialogDelete(DialogFragment dialog) {
|
||||||
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
|
String name = (String)dialog.getArguments().get("name");
|
||||||
|
dbHelper.deleteServiceProvidedByUser(username, name);
|
||||||
|
dialog.dismiss();
|
||||||
|
this.recreate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does nothing
|
||||||
|
*
|
||||||
|
* @param dialog DialogFragment that contains the cancel button.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onDialogNevermind(DialogFragment dialog) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ServicesHolder> {
|
||||||
|
|
||||||
|
private Service[] services;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
// Provide a reference to the views for each data item
|
||||||
|
// Complex data items may need more than one view per item, and
|
||||||
|
// you provide access to all the views for a data item in a view holder
|
||||||
|
|
||||||
|
// Provide a suitable constructor (depends on the kind of dataset)
|
||||||
|
public MyAdapter(Service[] services, Context context) {
|
||||||
|
this.services = services;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new views (invoked by the layout manager)
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ServicesHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View v = LayoutInflater.from(parent.getContext())
|
||||||
|
.inflate(R.layout.list_item, parent, false);
|
||||||
|
ServicesHolder vh = new ServicesHolder(v);
|
||||||
|
return vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace the contents of a view (invoked by the layout manager)
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(ServicesHolder holder, int position) {
|
||||||
|
Service service = services[position];
|
||||||
|
holder.name.setText(service.getName());
|
||||||
|
holder.rate.setText(String.format("$%,.2f", service.getRate()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the size of your dataset (invoked by the layout manager)
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return services.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ServicesHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
|
||||||
|
|
||||||
|
TextView name;
|
||||||
|
TextView rate;
|
||||||
|
|
||||||
|
public ServicesHolder(View row){
|
||||||
|
super(row);
|
||||||
|
name = row.findViewById(R.id.Name);
|
||||||
|
rate = row.findViewById(R.id.Rate);
|
||||||
|
row.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
TextView nameview = (TextView)view.findViewById(R.id.Name);
|
||||||
|
String name = nameview.getText().toString();
|
||||||
|
deleteService(view, name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Welcome class creates the welcome screen for the HomeOwners and ServiceProviders
|
||||||
|
* as a temporary screen until full functionality of those two a classes are
|
||||||
|
* implemented.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ServiceProviderWelcome extends AppCompatActivity {
|
||||||
|
String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On creation of this object the app will display the xml file for
|
||||||
|
* the welcome page which gets the role and username of the UserType
|
||||||
|
* object and welcomes the user with a message.
|
||||||
|
*
|
||||||
|
* @param savedInstanceState Bundle to transfer data
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_service_provider_welcome);
|
||||||
|
Bundle bundle = getIntent().getExtras();
|
||||||
|
username = bundle.getString("username");
|
||||||
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
|
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");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override so that nothing occurs when pressing the
|
||||||
|
* back button on this activity of the app.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onBackPressed(){
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out the user and returns them back to
|
||||||
|
* main activity. End all current user activity
|
||||||
|
* for security purposes.
|
||||||
|
*
|
||||||
|
* @param view View object of current activity.
|
||||||
|
*/
|
||||||
|
public void LogOut(View view){
|
||||||
|
Intent intent = new Intent(getApplicationContext(), Main.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EditProfile(View view){
|
||||||
|
Intent intent = new Intent(getApplicationContext(),EditProfile.class);
|
||||||
|
intent.putExtra("username", username);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EditServices(View view){
|
||||||
|
Intent intent = new Intent(getApplicationContext(),ServiceProviderServicesList.class);
|
||||||
|
intent.putExtra("username", username);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
public void EditAvailabilities(View view){
|
||||||
|
Intent intent = new Intent(getApplicationContext(),ServiceProviderAvailabilities.class);
|
||||||
|
intent.putExtra("username", username);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,86 +0,0 @@
|
||||||
package com.uottawa.olympus.olympusservices;
|
|
||||||
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.GridView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ServicesList extends AppCompatActivity implements NewServiceDialogFragment.NoticeDialogListener, EditServiceDialogFragment.NoticeDialogListener{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_services_list);
|
|
||||||
DBHelper dbHelper = new DBHelper(this);
|
|
||||||
List<String[]> users = dbHelper.getAllServices();
|
|
||||||
String[] services = new String[(users.size()+1)*2];
|
|
||||||
services[0] = "Name";
|
|
||||||
services[1] = "Rate";
|
|
||||||
Iterator iter = users.iterator();
|
|
||||||
for (int i=0; i<users.size();i++){
|
|
||||||
String[] current = (String[])iter.next();
|
|
||||||
services[(i+1)*2] = current[0];
|
|
||||||
services[(i+1)*2+1] = current[1];
|
|
||||||
}
|
|
||||||
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.simple_list_item_1_customized, services);
|
|
||||||
GridView gridView = findViewById(R.id.Services);
|
|
||||||
gridView.setAdapter(adapter);
|
|
||||||
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view,
|
|
||||||
int position, long id) {
|
|
||||||
editService(view);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
public void addService(View view) {
|
|
||||||
DialogFragment newFragment = new NewServiceDialogFragment();
|
|
||||||
newFragment.show(getSupportFragmentManager(), "addService");
|
|
||||||
}
|
|
||||||
public void editService(View view) {
|
|
||||||
DialogFragment newFragment = new EditServiceDialogFragment();
|
|
||||||
newFragment.show(getSupportFragmentManager(), "editService");
|
|
||||||
}
|
|
||||||
//add new service
|
|
||||||
@Override
|
|
||||||
public void onDialogNew(DialogFragment dialog) {
|
|
||||||
DBHelper dbHelper = new DBHelper(this);
|
|
||||||
String name = (String)dialog.getArguments().get("name");
|
|
||||||
Double rate = (Double)dialog.getArguments().get("rate");
|
|
||||||
dbHelper.addService(new Service(name,rate));
|
|
||||||
dialog.dismiss();
|
|
||||||
this.recreate();
|
|
||||||
}
|
|
||||||
//user clicked cancel
|
|
||||||
@Override
|
|
||||||
public void onDialogNevermind(DialogFragment dialog) {
|
|
||||||
|
|
||||||
}
|
|
||||||
//edits service with info from dialog
|
|
||||||
@Override
|
|
||||||
public void onDialogEdit(DialogFragment dialog) {
|
|
||||||
DBHelper dbHelper = new DBHelper(this);
|
|
||||||
String name = (String)dialog.getArguments().get("name");
|
|
||||||
Double rate = (Double)dialog.getArguments().get("rate");
|
|
||||||
dbHelper.updateService(new Service(name,rate));
|
|
||||||
dialog.dismiss();
|
|
||||||
this.recreate();
|
|
||||||
}
|
|
||||||
//deletes service with info from dialog
|
|
||||||
@Override
|
|
||||||
public void onDialogDelete(DialogFragment dialog) {
|
|
||||||
DBHelper dbHelper = new DBHelper(this);
|
|
||||||
String name = (String)dialog.getArguments().get("name");
|
|
||||||
dbHelper.deleteService(name);
|
|
||||||
dialog.dismiss();
|
|
||||||
this.recreate();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -9,7 +9,21 @@ import android.widget.EditText;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is used to create new userType where the user
|
||||||
|
* fills in his information and his data is sent to to the database
|
||||||
|
* to create a new userType object.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public class SignUp extends AppCompatActivity {
|
public class SignUp extends AppCompatActivity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On creation of this class the xml page is loaded up onto the app and
|
||||||
|
* the EditTexts are set up to accept the information of the user.
|
||||||
|
*
|
||||||
|
* @param savedInstanceState Bundle for transferring information
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -25,6 +39,13 @@ public class SignUp extends AppCompatActivity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On click creates a new user if the the user information
|
||||||
|
* fits the criteria specified by the documentation and is
|
||||||
|
* not a duplicate of another user.
|
||||||
|
*
|
||||||
|
* @param view View object that contains all the editText and buttons used.
|
||||||
|
*/
|
||||||
public void onClickSignUp(View view){
|
public void onClickSignUp(View view){
|
||||||
UserType newUser;
|
UserType newUser;
|
||||||
String username = ((EditText) findViewById(R.id.UsernameInput)).getText().toString();
|
String username = ((EditText) findViewById(R.id.UsernameInput)).getText().toString();
|
||||||
|
@ -32,41 +53,66 @@ public class SignUp extends AppCompatActivity {
|
||||||
String firstname = ((EditText) findViewById(R.id.FirstNameInput)).getText().toString();
|
String firstname = ((EditText) findViewById(R.id.FirstNameInput)).getText().toString();
|
||||||
String lastname = ((EditText) findViewById(R.id.LastNameInput)).getText().toString();
|
String lastname = ((EditText) findViewById(R.id.LastNameInput)).getText().toString();
|
||||||
MaterialSpinner spinner = findViewById(R.id.RoleInput);
|
MaterialSpinner spinner = findViewById(R.id.RoleInput);
|
||||||
//TODO add message conditional to check if every EditText is filled up to standards
|
|
||||||
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);
|
||||||
break;
|
|
||||||
case "Service Provider":
|
|
||||||
newUser = new ServiceProvider(username,password,firstname,lastname);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
newUser = new HomeOwner(username,password,firstname,lastname); //if nothing is enter then defaults to user role.
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
DBHelper dbHelper = new DBHelper(this);
|
|
||||||
Intent intent = new Intent(getApplicationContext(),LogIn.class); //TODO check if signup should take to the login page or automatically login
|
|
||||||
if(dbHelper.addUser(newUser)){
|
if(dbHelper.addUser(newUser)){
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}else{
|
}else{
|
||||||
Toast.makeText(this,"Username is taken",Toast.LENGTH_LONG).show();
|
Toast.makeText(this,"Username is taken",Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case "Service Provider":
|
||||||
|
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(intent2);
|
||||||
|
finish();
|
||||||
|
}else{
|
||||||
|
Toast.makeText(this,"Username is taken",Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
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();
|
||||||
}
|
}
|
||||||
else if (username.length()<=5 || password.length()<=5 ){
|
else if (username.length()<5 || password.length()<5 ){
|
||||||
Toast.makeText(this, "Password and username must be longer than 4 characters", Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "Password and username must be longer than 4 characters", Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Toast.makeText(this, "Fields may only contain alphanumeric values", Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "Fields may only contain alphanumeric values", Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app closes the the activity when back is pressed and
|
||||||
|
* no user information written down is saved in the EditText for
|
||||||
|
* security purposes.
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed(){
|
public void onBackPressed(){
|
||||||
Intent intent = new Intent(getApplicationContext(), Main.class);
|
Intent intent = new Intent(getApplicationContext(), Main.class);
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
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;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
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}$")) {
|
||||||
|
|
||||||
|
ServiceProvider serviceProvider = new ServiceProvider(username, password, firstname, lastname,
|
||||||
|
address, phonenumber, companyname, licensed);
|
||||||
|
if(dbHelper.addUser(serviceProvider)){
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}else{
|
||||||
|
Toast.makeText(this,"Could not create account",Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Toast.makeText(this, "Fields cannot be empty and must be formatted correctly", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,16 +3,33 @@ package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UserType is the abstract object that is the parent class
|
||||||
|
* of all users in this program with all common methods and
|
||||||
|
* fields set in this one class.
|
||||||
|
*/
|
||||||
|
|
||||||
public abstract class UserType {
|
public abstract class UserType {
|
||||||
|
|
||||||
|
//field for the username attached to the userType.
|
||||||
String username;
|
String username;
|
||||||
|
//field for the password attached to the userType.
|
||||||
String password;
|
String password;
|
||||||
|
//field for the firstname attached to the userType.
|
||||||
String firstname;
|
String firstname;
|
||||||
|
//field for the lastname attached to the userType.
|
||||||
String lastname;
|
String lastname;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor filling out all the field values with given parameters
|
||||||
|
* entered by a new user for the app.
|
||||||
|
*
|
||||||
|
* @param username String object containing the username.
|
||||||
|
* @param password String object containing the password.
|
||||||
|
* @param firstname String object containing the firstname.
|
||||||
|
* @param lastname String object containing the lastname.
|
||||||
|
*/
|
||||||
UserType(String username, String password, String firstname, String lastname){
|
UserType(String username, String password, String firstname, String lastname){
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
|
@ -20,25 +37,54 @@ public abstract class UserType {
|
||||||
this.lastname = lastname;
|
this.lastname = lastname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract method to get the role of each userType child in the app.
|
||||||
|
*
|
||||||
|
* @return String object specifying the role of userType.
|
||||||
|
*/
|
||||||
public abstract String getRole();
|
public abstract String getRole();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the username field of userType.
|
||||||
|
*
|
||||||
|
* @return String of the username.
|
||||||
|
*/
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the password field of userType.
|
||||||
|
*
|
||||||
|
* @return String of the password.
|
||||||
|
*/
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the firstname field of userType.
|
||||||
|
*
|
||||||
|
* @return String of firstname
|
||||||
|
*/
|
||||||
public String getFirstname() {
|
public String getFirstname() {
|
||||||
return firstname;
|
return firstname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the lastname field of userType.
|
||||||
|
*
|
||||||
|
* @return String of lastname
|
||||||
|
*/
|
||||||
public String getLastname() {
|
public String getLastname() {
|
||||||
return lastname;
|
return lastname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the username field with given parameters.
|
||||||
|
*
|
||||||
|
* @param username String for new username.
|
||||||
|
*/
|
||||||
public void setUsername(String username) {
|
public void setUsername(String username) {
|
||||||
//remember to call updateUser(String username, String password, String firstname, String lastname)
|
//remember to call updateUser(String username, String password, String firstname, String lastname)
|
||||||
//in activity whenever a setter is called. DBHelper requires a Context (Activity) to be initialized
|
//in activity whenever a setter is called. DBHelper requires a Context (Activity) to be initialized
|
||||||
|
@ -47,6 +93,11 @@ public abstract class UserType {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the password field with given parameters.
|
||||||
|
*
|
||||||
|
* @param password String of new password.
|
||||||
|
*/
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
//remember to call updateUser(String username, String password, String firstname, String lastname)
|
//remember to call updateUser(String username, String password, String firstname, String lastname)
|
||||||
//in activity whenever a setter is called. DBHelper requires a Context (Activity) to be initialized
|
//in activity whenever a setter is called. DBHelper requires a Context (Activity) to be initialized
|
||||||
|
@ -54,6 +105,11 @@ public abstract class UserType {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the firstname field with given parameters.
|
||||||
|
*
|
||||||
|
* @param firstname String of new firstname.
|
||||||
|
*/
|
||||||
public void setFirstname(String firstname) {
|
public void setFirstname(String firstname) {
|
||||||
//remember to call updateUser(String username, String password, String firstname, String lastname)
|
//remember to call updateUser(String username, String password, String firstname, String lastname)
|
||||||
//in activity whenever a setter is called. DBHelper requires a Context (Activity) to be initialized
|
//in activity whenever a setter is called. DBHelper requires a Context (Activity) to be initialized
|
||||||
|
@ -68,7 +124,11 @@ public abstract class UserType {
|
||||||
this.lastname = lastname;
|
this.lastname = lastname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares this userType and another userType to see if there fields are equal.
|
||||||
|
*
|
||||||
|
* @param other Usertype object that is compared to this userType.
|
||||||
|
*/
|
||||||
public boolean equals(UserType other){
|
public boolean equals(UserType other){
|
||||||
if(this.username.equals(other.username)&&this.password.equals(other.password)&&
|
if(this.username.equals(other.username)&&this.password.equals(other.password)&&
|
||||||
this.firstname.equals(other.firstname)&&this.lastname.equals(other.lastname)){
|
this.firstname.equals(other.firstname)&&this.lastname.equals(other.lastname)){
|
||||||
|
|
|
@ -8,8 +8,22 @@ import android.widget.GridView;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* screen for user list that the admin can access
|
||||||
|
* and manage all users in the program. Userlist is generated through
|
||||||
|
* the database using DBHelper class.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public class UsersList extends AppCompatActivity {
|
public class UsersList extends AppCompatActivity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* on Creation of this class the app loads up the xml page for
|
||||||
|
* activity_user_list and generates a gridview using the database
|
||||||
|
* for all the users in the app.
|
||||||
|
*
|
||||||
|
* @param savedInstanceState bundle to transfer data
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -17,14 +31,12 @@ public class UsersList extends AppCompatActivity {
|
||||||
|
|
||||||
DBHelper dbHelper = new DBHelper(this);
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
List<String[]> users = dbHelper.getAllUsers();
|
List<String[]> users = dbHelper.getAllUsers();
|
||||||
String[] usernames = new String[(users.size()+1)*2];
|
String[] usernames = new String[(users.size())*2];
|
||||||
usernames[0] = "Username";
|
|
||||||
usernames[1] = "User Type";
|
|
||||||
Iterator iter = users.iterator();
|
Iterator iter = users.iterator();
|
||||||
for (int i=0; i<users.size();i++){
|
for (int i=0; i<users.size();i++){
|
||||||
String[] current = (String[])iter.next();
|
String[] current = (String[])iter.next();
|
||||||
usernames[(i+1)*2] = current[0];
|
usernames[(i)*2] = current[0];
|
||||||
usernames[(i+1)*2+1] = current[3];
|
usernames[(i)*2+1] = current[3];
|
||||||
}
|
}
|
||||||
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.simple_list_item_1_customized, usernames);
|
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.simple_list_item_1_customized, usernames);
|
||||||
GridView gridView = findViewById(R.id.Users);
|
GridView gridView = findViewById(R.id.Users);
|
||||||
|
|
|
@ -6,8 +6,21 @@ import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Welcome class creates the welcome screen for the HomeOwners and ServiceProviders
|
||||||
|
* as a temporary screen until full functionality of those two a classes are
|
||||||
|
* implemented.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class Welcome extends AppCompatActivity {
|
public class Welcome extends AppCompatActivity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On creation of this object the app will display the xml file for
|
||||||
|
* the welcome page which gets the role and username of the UserType
|
||||||
|
* object and welcomes the user with a message.
|
||||||
|
*
|
||||||
|
* @param savedInstanceState Bundle to transfer data
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -24,9 +37,23 @@ public class Welcome extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override so that nothing occurs when pressing the
|
||||||
|
* back button on this activity of the app.
|
||||||
|
*
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed(){
|
public void onBackPressed(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out the user and returns them back to
|
||||||
|
* main activity. End all current user activity
|
||||||
|
* for security purposes.
|
||||||
|
*
|
||||||
|
* @param view View object of current activity.
|
||||||
|
*/
|
||||||
public void LogOut(View view){
|
public void LogOut(View view){
|
||||||
Intent intent = new Intent(getApplicationContext(), Main.class);
|
Intent intent = new Intent(getApplicationContext(), Main.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?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=".AdminServicesList">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingBottom="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
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"
|
||||||
|
android:text="Name"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Title2"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Hourly Rate"
|
||||||
|
android:gravity="end"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/Services"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="300dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Title3"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Click on service to edit or delete"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/newService"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:text="Add New Service"
|
||||||
|
android:onClick="addService"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -30,7 +30,7 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/Users"
|
android:id="@+id/Users"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:onClick="goToUsers"
|
android:onClick="goToUsers"
|
||||||
android:text="List of Users"
|
android:text="List of Users"
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/Services"
|
android:id="@+id/Services"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:onClick="goToServices"
|
android:onClick="goToServices"
|
||||||
android:text="List of Services"
|
android:text="List of Services"
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/LogOut"
|
android:id="@+id/LogOut"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
android:layout_marginTop="50dp"
|
android:layout_marginTop="50dp"
|
||||||
android:onClick="LogOut"
|
android:onClick="LogOut"
|
||||||
android:text="Logout"
|
android:text="Logout"
|
||||||
|
|
|
@ -0,0 +1,134 @@
|
||||||
|
<?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=".EditProfile">
|
||||||
|
<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
|
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText
|
||||||
|
android:id="@+id/FirstNameInput"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:background="@drawable/customborder"
|
||||||
|
android:hint="First 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" />
|
||||||
|
|
||||||
|
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText
|
||||||
|
android:id="@+id/LastNameInput"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:background="@drawable/customborder"
|
||||||
|
android:hint="Last 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"/>
|
||||||
|
|
||||||
|
//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"/>
|
||||||
|
|
||||||
|
|
||||||
|
//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"/>
|
||||||
|
|
||||||
|
|
||||||
|
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText
|
||||||
|
android:id="@+id/PasswordInput"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:background="@drawable/customborder"
|
||||||
|
android:hint="Password"
|
||||||
|
android:textSize="15sp"
|
||||||
|
app:met_baseColor="@android:color/white"
|
||||||
|
app:met_floatingLabel="highlight"
|
||||||
|
app:met_primaryColor="@color/colorWhite"
|
||||||
|
app:met_singleLineEllipsis="true"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:textCursorDrawable="@color/colorWhite"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/SignUp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Save"
|
||||||
|
android:onClick="Save"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -12,12 +12,20 @@
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
android:background="@drawable/background"
|
android:background="@drawable/background"
|
||||||
tools:context=".LogIn">
|
tools:context=".LogIn">
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/Title"
|
android:id="@+id/Title"
|
||||||
android:layout_width="300dp"
|
android:layout_width="300dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="20dp"
|
android:layout_marginBottom="20dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/login"
|
android:text="@string/login"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
@ -60,12 +68,13 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/LogIn"
|
android:id="@+id/LogIn"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="40dp"
|
||||||
android:onClick="onClickLogIn"
|
android:onClick="onClickLogIn"
|
||||||
android:text="@string/login"
|
android:text="@string/login"
|
||||||
android:theme="@style/AppTheme.Button" />
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,29 +17,34 @@
|
||||||
android:id="@+id/Title"
|
android:id="@+id/Title"
|
||||||
android:layout_width="300dp"
|
android:layout_width="300dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="100dp"
|
android:layout_marginBottom="70dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/CompanyName"
|
android:text="@string/CompanyName"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="36sp"
|
android:textSize="36sp"
|
||||||
app:fontFamily="@font/julius_sans_one" />
|
app:fontFamily="@font/julius_sans_one"
|
||||||
|
android:layout_marginTop="30dp"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/SignUp"
|
android:id="@+id/SignUp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="70dp"
|
||||||
android:layout_marginBottom="50dp"
|
android:layout_marginBottom="35dp"
|
||||||
android:onClick="onClickSignUp"
|
android:onClick="onClickSignUp"
|
||||||
android:text="@string/signup"
|
android:text="@string/signup"
|
||||||
android:theme="@style/AppTheme.Button" />
|
android:theme="@style/AppTheme.Button"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/LogIn"
|
android:id="@+id/LogIn"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="70dp"
|
||||||
android:onClick="onClickLogIn"
|
android:onClick="onClickLogIn"
|
||||||
android:text="@string/login"
|
android:text="@string/login"
|
||||||
android:theme="@style/AppTheme.Button" />
|
android:theme="@style/AppTheme.Button"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -0,0 +1,350 @@
|
||||||
|
<?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=".ServiceProviderAvailabilities">
|
||||||
|
<TableLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Day"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:text="Day"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center_vertical"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Start"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:paddingLeft="20dp"
|
||||||
|
android:text="Start"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center_vertical"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/End"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:paddingLeft="20dp"
|
||||||
|
android:text="End"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center_vertical"/>
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Monday"
|
||||||
|
android:layout_width="105dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:text="Monday"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center_vertical"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/MondayStart"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Start"
|
||||||
|
android:theme="@style/AppTheme.Button"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:layout_marginRight="10dp"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/MondayEnd"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="End"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/DeleteMon"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="X"
|
||||||
|
android:onClick="onRemove"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Tuesday"
|
||||||
|
android:layout_width="105dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:text="Tuesday"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center_vertical"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/TuesdayStart"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Start"
|
||||||
|
android:theme="@style/AppTheme.Button"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:layout_marginRight="10dp"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/TuesdayEnd"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="End"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/DeleteTuesday"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="X"
|
||||||
|
android:onClick="onRemove"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Wednesday"
|
||||||
|
android:layout_width="105dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:text="Wednesday"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center_vertical"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/WednesdayStart"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Start"
|
||||||
|
android:theme="@style/AppTheme.Button"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:layout_marginRight="10dp"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/WednesdayEnd"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="End"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/DeleteWednesday"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="X"
|
||||||
|
android:onClick="onRemove"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Thursday"
|
||||||
|
android:layout_width="105dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:text="Thursday"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center_vertical"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/ThursdayStart"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Start"
|
||||||
|
android:theme="@style/AppTheme.Button"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:layout_marginRight="10dp"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/ThursdayEnd"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="End"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/DeleteThursday"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="X"
|
||||||
|
android:onClick="onRemove"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Friday"
|
||||||
|
android:layout_width="105dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:text="Friday"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center_vertical"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/FridayStart"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Start"
|
||||||
|
android:theme="@style/AppTheme.Button"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:layout_marginRight="10dp"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/FridayEnd"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="End"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/DeleteFriday"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="X"
|
||||||
|
android:onClick="onRemove"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Saturday"
|
||||||
|
android:layout_width="105dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:text="Saturday"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center_vertical"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/SaturdayStart"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Start"
|
||||||
|
android:theme="@style/AppTheme.Button"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:layout_marginRight="10dp"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/SaturdayEnd"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="End"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/DeleteSaturday"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="X"
|
||||||
|
android:onClick="onRemove"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Sunday"
|
||||||
|
android:layout_width="105dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:text="Sunday"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center_vertical"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/SundayStart"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Start"
|
||||||
|
android:theme="@style/AppTheme.Button"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:layout_marginRight="10dp"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/SundayEnd"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="End"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/DeleteSunday"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="X"
|
||||||
|
android:onClick="onRemove"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
</TableLayout>
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,98 @@
|
||||||
|
<?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=".ServiceProviderServicesList">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingBottom="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
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"
|
||||||
|
android:text="Name"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Title2"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Hourly Rate"
|
||||||
|
android:gravity="end"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/Services"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="300dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Title3"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Click on service to remove"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
// component used from https://github.com/jaredrummler/MaterialSpinner
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginTop="20dp">
|
||||||
|
|
||||||
|
<com.jaredrummler.materialspinner.MaterialSpinner
|
||||||
|
android:id="@+id/ServicesInput"
|
||||||
|
android:layout_width="250dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginTop="5dp"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/newService"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="addService"
|
||||||
|
android:text="Add"
|
||||||
|
android:textSize="10sp"
|
||||||
|
android:theme="@style/AppTheme.Button"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?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=".ServiceProviderWelcome">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Welcome"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Welcome"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
app:fontFamily="@font/julius_sans_one" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/Profile"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:onClick="EditProfile"
|
||||||
|
android:text="Profile"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/Services"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:onClick="EditServices"
|
||||||
|
android:text="Services"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/Availabilities"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:text="Availabilities"
|
||||||
|
android:onClick="EditAvailabilities"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/Bookings"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:text="Bookings"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/LogOut"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:onClick="LogOut"
|
||||||
|
android:text="Logout"
|
||||||
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</LinearLayout>
|
|
@ -1,51 +0,0 @@
|
||||||
<?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=".ServicesList">
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/Welcome"
|
|
||||||
android:layout_width="300dp"
|
|
||||||
android:layout_height="80dp"
|
|
||||||
android:layout_marginBottom="20dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="List of Services"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
app:fontFamily="@font/julius_sans_one" />
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<GridView
|
|
||||||
android:id="@+id/Services"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="250dp"
|
|
||||||
android:numColumns="2"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textSize="15sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/newService"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:text="Add New Service"
|
|
||||||
android:onClick="addService"
|
|
||||||
android:theme="@style/AppTheme.Button" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -12,18 +12,14 @@
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
android:background="@drawable/background"
|
android:background="@drawable/background"
|
||||||
tools:context=".SignUp">
|
tools:context=".SignUp">
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/Title"
|
|
||||||
android:layout_width="300dp"
|
|
||||||
android:layout_height="20dp"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/signup"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textSize="15sp"
|
|
||||||
app:fontFamily="@font/julius_sans_one" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView"
|
android:id="@+id/textView"
|
||||||
|
@ -104,5 +100,7 @@
|
||||||
android:onClick="onClickSignUp"
|
android:onClick="onClickSignUp"
|
||||||
android:text="@string/signup"
|
android:text="@string/signup"
|
||||||
android:theme="@style/AppTheme.Button" />
|
android:theme="@style/AppTheme.Button" />
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -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>
|
|
@ -12,31 +12,54 @@
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
android:background="@drawable/background"
|
android:background="@drawable/background"
|
||||||
tools:context=".Welcome">
|
tools:context=".Welcome">
|
||||||
<TextView
|
|
||||||
android:id="@+id/Welcome"
|
|
||||||
android:layout_width="300dp"
|
|
||||||
android:layout_height="80dp"
|
|
||||||
android:layout_marginBottom="20dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="List of Users"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
app:fontFamily="@font/julius_sans_one" />
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Title1"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Username"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:gravity="center"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Title2"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="User Type"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:gravity="center"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<GridView
|
<GridView
|
||||||
android:id="@+id/Users"
|
android:id="@+id/Users"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="450dp"
|
||||||
android:numColumns="2"
|
android:numColumns="2"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?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"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Title1"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Are you sure you want to remove this service from your account?"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginRight="40dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -5,21 +5,6 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
//component used from https://github.com/rengwuxian/MaterialEditText
|
|
||||||
<com.rengwuxian.materialedittext.MaterialEditText
|
|
||||||
android:id="@+id/NameInput"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="80dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:hint="@string/servicename"
|
|
||||||
android:textCursorDrawable="@color/colorWhite"
|
|
||||||
android:textSize="15sp"
|
|
||||||
app:met_baseColor="@android:color/black"
|
|
||||||
app:met_floatingLabel="highlight"
|
|
||||||
app:met_primaryColor="@color/colorBlack"
|
|
||||||
app:met_singleLineEllipsis="true"
|
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
android:layout_marginRight="20dp"/>
|
|
||||||
|
|
||||||
//component used from https://github.com/rengwuxian/MaterialEditText
|
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||||
<com.rengwuxian.materialedittext.MaterialEditText
|
<com.rengwuxian.materialedittext.MaterialEditText
|
||||||
|
@ -31,6 +16,7 @@
|
||||||
android:inputType="numberDecimal"
|
android:inputType="numberDecimal"
|
||||||
android:textCursorDrawable="@color/colorWhite"
|
android:textCursorDrawable="@color/colorWhite"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
|
android:text=""
|
||||||
app:met_baseColor="@android:color/black"
|
app:met_baseColor="@android:color/black"
|
||||||
app:met_floatingLabel="highlight"
|
app:met_floatingLabel="highlight"
|
||||||
app:met_primaryColor="@color/colorBlack"
|
app:met_primaryColor="@color/colorBlack"
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
android:hint="@string/servicename"
|
android:hint="@string/servicename"
|
||||||
android:textCursorDrawable="@color/colorWhite"
|
android:textCursorDrawable="@color/colorWhite"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
|
android:text=""
|
||||||
app:met_baseColor="@android:color/black"
|
app:met_baseColor="@android:color/black"
|
||||||
app:met_floatingLabel="highlight"
|
app:met_floatingLabel="highlight"
|
||||||
app:met_primaryColor="@color/colorBlack"
|
app:met_primaryColor="@color/colorBlack"
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
android:layout_height="80dp"
|
android:layout_height="80dp"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:hint="@string/servicerate"
|
android:hint="@string/servicerate"
|
||||||
|
android:text=""
|
||||||
android:inputType="numberDecimal"
|
android:inputType="numberDecimal"
|
||||||
android:textCursorDrawable="@color/colorWhite"
|
android:textCursorDrawable="@color/colorWhite"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
|
|
36
OlympusServices/app/src/main/res/layout/list_item.xml
Normal file
36
OlympusServices/app/src/main/res/layout/list_item.xml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="true"
|
||||||
|
android:background="@color/colorWhite"
|
||||||
|
android:layout_marginBottom="5dp">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingTop="6dp"
|
||||||
|
android:paddingBottom="6dp"
|
||||||
|
android:id="@+id/Name"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@color/colorBlack"
|
||||||
|
android:textSize="15sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Rate"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:paddingTop="6dp"
|
||||||
|
android:paddingBottom="6dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@color/colorBlack"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:gravity="end"/>
|
||||||
|
</LinearLayout>
|
|
@ -8,8 +8,12 @@
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
|
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
|
||||||
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
|
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
android:paddingStart="30dp"
|
||||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
||||||
android:textColor="@android:color/white">
|
android:textColor="@android:color/black"
|
||||||
|
android:background="@color/colorWhite"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
</TextView>
|
</TextView>
|
|
@ -27,6 +27,7 @@
|
||||||
<string name="cancel">Cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
<string name="update">Update</string>
|
<string name="update">Update</string>
|
||||||
<string name="delete">Delete</string>
|
<string name="delete">Delete</string>
|
||||||
|
<string name="remove">Remove</string>
|
||||||
<string name="add">Add</string>
|
<string name="add">Add</string>
|
||||||
<string-array name="roles">
|
<string-array name="roles">
|
||||||
<item>Admin</item>
|
<item>Admin</item>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Base.Theme.AppCompat.Light">
|
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorWhite</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -13,4 +13,5 @@
|
||||||
<item name="android:textColor">@color/colorBlack</item>
|
<item name="android:textColor">@color/colorBlack</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -6,6 +6,10 @@ import static org.junit.Assert.*;
|
||||||
|
|
||||||
public class AdminTest {
|
public class AdminTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiates an Admin account and tests if the strings match to the required inputs.
|
||||||
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAdmin() {
|
public void testAdmin() {
|
||||||
Admin admin = new Admin();
|
Admin admin = new Admin();
|
||||||
|
|
|
@ -48,7 +48,8 @@ public class DBIntegrationTest {
|
||||||
assertEquals("Garzon", dbUser.getLastname());
|
assertEquals("Garzon", dbUser.getLastname());
|
||||||
|
|
||||||
|
|
||||||
originalUser = new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman");
|
originalUser = new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman",
|
||||||
|
"testaddress", "8888888888", "companydotcom", true);
|
||||||
addedTwo = dbHelper.addUser(originalUser);
|
addedTwo = dbHelper.addUser(originalUser);
|
||||||
dbUser = dbHelper.findUserByUsername("jbO4aBF4dC");
|
dbUser = dbHelper.findUserByUsername("jbO4aBF4dC");
|
||||||
|
|
||||||
|
@ -79,7 +80,8 @@ public class DBIntegrationTest {
|
||||||
assertTrue(added);
|
assertTrue(added);
|
||||||
added = dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "seg2105", "Miguel", "Garzon"));
|
added = dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "seg2105", "Miguel", "Garzon"));
|
||||||
assertTrue(!added);
|
assertTrue(!added);
|
||||||
added = dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman"));
|
added = dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman",
|
||||||
|
"testaddress", "8888888888", "companydotcom", true));
|
||||||
assertTrue(!added);
|
assertTrue(!added);
|
||||||
|
|
||||||
dbHelper.deleteUser("jbO4aBF4dC");
|
dbHelper.deleteUser("jbO4aBF4dC");
|
||||||
|
@ -140,7 +142,7 @@ public class DBIntegrationTest {
|
||||||
addedOne = dbHelper.addService(originalService);
|
addedOne = dbHelper.addService(originalService);
|
||||||
dbService = dbHelper.findService("Exterminating flatworms");
|
dbService = dbHelper.findService("Exterminating flatworms");
|
||||||
|
|
||||||
assertEquals("Exterminating flatworms", dbService.getName());
|
assertEquals("exterminating flatworms", dbService.getName());
|
||||||
assertEquals(20.00, dbService.getRate(), 0.001);
|
assertEquals(20.00, dbService.getRate(), 0.001);
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,7 +150,7 @@ public class DBIntegrationTest {
|
||||||
addedTwo = dbHelper.addService(originalService);
|
addedTwo = dbHelper.addService(originalService);
|
||||||
dbService = dbHelper.findService("Cleaning fishtanks");
|
dbService = dbHelper.findService("Cleaning fishtanks");
|
||||||
|
|
||||||
assertEquals("Cleaning fishtanks", dbService.getName());
|
assertEquals("cleaning fishtanks", dbService.getName());
|
||||||
assertEquals(15.00, dbService.getRate(), 0.001);
|
assertEquals(15.00, dbService.getRate(), 0.001);
|
||||||
|
|
||||||
if (addedOne) {
|
if (addedOne) {
|
||||||
|
@ -186,7 +188,7 @@ public class DBIntegrationTest {
|
||||||
|
|
||||||
service = dbHelper.findService("Exterminating flatworms");
|
service = dbHelper.findService("Exterminating flatworms");
|
||||||
|
|
||||||
assertEquals("Exterminating flatworms", service.getName());
|
assertEquals("exterminating flatworms", service.getName());
|
||||||
assertEquals(25.00, service.getRate(), 0.001);
|
assertEquals(25.00, service.getRate(), 0.001);
|
||||||
|
|
||||||
dbHelper.deleteService("Exterminating flatworms");
|
dbHelper.deleteService("Exterminating flatworms");
|
||||||
|
@ -210,5 +212,100 @@ public class DBIntegrationTest {
|
||||||
dbHelper.deleteService("Exterminating flatworms");
|
dbHelper.deleteService("Exterminating flatworms");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddAndDeleteServiceProvidedByUser(){
|
||||||
|
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||||
|
"testaddress", "8888888888", "companydotcom", true));
|
||||||
|
dbHelper.addService(new Service("Hitman", 12358));
|
||||||
|
boolean added = dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "hitman");
|
||||||
|
assertTrue(added);
|
||||||
|
boolean deleted = dbHelper.deleteServiceProvidedByUser("jbO4aBF4dC", "Hitman");
|
||||||
|
assertTrue(deleted);
|
||||||
|
dbHelper.deleteUser("jbO4aBF4dC");
|
||||||
|
dbHelper.deleteService("hitman");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetAllServicesProvidedByUserAndDeleteService(){
|
||||||
|
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||||
|
"testaddress", "8888888888", "companydotcom", true));
|
||||||
|
|
||||||
|
dbHelper.addService(new Service("Hitman", 12358));
|
||||||
|
dbHelper.addService(new Service("Exterminating flatworms", 392.457));
|
||||||
|
|
||||||
|
dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "hitman");
|
||||||
|
dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "exterminating flatworms");
|
||||||
|
|
||||||
|
List<String[]> servicesProvidedByUser = dbHelper.getAllServicesProvidedByUser("jbO4aBF4dC");
|
||||||
|
assertEquals(2, servicesProvidedByUser.size());
|
||||||
|
assertEquals("hitman", servicesProvidedByUser.get(0)[0]);
|
||||||
|
assertEquals(12358, Double.parseDouble(servicesProvidedByUser.get(0)[1]), 0.00001);
|
||||||
|
assertEquals("exterminating flatworms", servicesProvidedByUser.get(1)[0]);
|
||||||
|
assertEquals(392.457, Double.parseDouble(servicesProvidedByUser.get(1)[1]), 0.00001);
|
||||||
|
|
||||||
|
dbHelper.deleteService("hitman");
|
||||||
|
servicesProvidedByUser = dbHelper.getAllServicesProvidedByUser("jbO4aBF4dC");
|
||||||
|
assertEquals(1, servicesProvidedByUser.size());
|
||||||
|
|
||||||
|
dbHelper.deleteService("exterminating flatworms");
|
||||||
|
servicesProvidedByUser = dbHelper.getAllServicesProvidedByUser("jbO4aBF4dC");
|
||||||
|
assertEquals(0, servicesProvidedByUser.size());
|
||||||
|
|
||||||
|
dbHelper.deleteUser("jbO4aBF4dC");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetAllProvidersByService(){
|
||||||
|
dbHelper.addService(new Service("Exterminating flatworms", 392.457));
|
||||||
|
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||||
|
"testaddress", "8888888888", "companydotcom", true));
|
||||||
|
dbHelper.addUser(new ServiceProvider("7MuF1c59XP", null, null, null,
|
||||||
|
"testaddress", "8888888888", "companydotcom", true));
|
||||||
|
|
||||||
|
dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "exterminating flatworms");
|
||||||
|
dbHelper.addServiceProvidedByUser("7MuF1c59XP", "exterminating flatworms");
|
||||||
|
|
||||||
|
List<String[]> providersByService = dbHelper.getAllProvidersByService("exterminating flatworms");
|
||||||
|
|
||||||
|
assertEquals(2, providersByService.size());
|
||||||
|
assertEquals("jbO4aBF4dC", providersByService.get(0)[0]);
|
||||||
|
assertEquals("7MuF1c59XP", providersByService.get(1)[0]);
|
||||||
|
|
||||||
|
dbHelper.deleteService("Exterminating flatworms");
|
||||||
|
dbHelper.deleteUser("jbO4aBF4dC");
|
||||||
|
dbHelper.deleteUser("7MuF1c59XP");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateAndGetAvailability(){
|
||||||
|
ServiceProvider serviceProvider = new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||||
|
"testaddress", "8888888888", "companydotcom", true);
|
||||||
|
serviceProvider.setAvailabilities(0, 4, 18, 19, 30);
|
||||||
|
serviceProvider.setAvailabilities(3, 8, 12, 15, 14);
|
||||||
|
|
||||||
|
//TODO:Perhaps implement a deep clone function for UserType?
|
||||||
|
ServiceProvider serviceProvider2 = new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||||
|
"testaddress", "8888888888", "companydotcom", true);
|
||||||
|
serviceProvider2.setAvailabilities(0, 4, 18, 19, 30);
|
||||||
|
serviceProvider2.setAvailabilities(3, 8, 12, 15, 14);
|
||||||
|
|
||||||
|
dbHelper.addUser(serviceProvider2);
|
||||||
|
|
||||||
|
boolean updated = dbHelper.updateAvailability(serviceProvider2);
|
||||||
|
assertTrue(updated);
|
||||||
|
|
||||||
|
serviceProvider2.setAvailabilities(3, 8, 12, 15, 10);
|
||||||
|
int[][] dbAvailabilities = dbHelper.getAvailabilities(serviceProvider2);
|
||||||
|
int[][] availabilities = serviceProvider.getAvailabilities();
|
||||||
|
|
||||||
|
assertEquals(14, serviceProvider2.getAvailabilities()[3][3]);
|
||||||
|
|
||||||
|
for (int i = 0; i < 7; i++){
|
||||||
|
for (int j = 0; j < 4; j++){
|
||||||
|
assertEquals(availabilities[i][j], dbAvailabilities[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,10 @@ import static org.junit.Assert.*;
|
||||||
|
|
||||||
public class HomeOwnerTest {
|
public class HomeOwnerTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiates an Homeowner account and tests if the random strings match to the required inputs.
|
||||||
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHomeOwner(){
|
public void testHomeOwner(){
|
||||||
UserType user = new HomeOwner( "John123", "1234567890", "John", "Doe" );
|
UserType user = new HomeOwner( "John123", "1234567890", "John", "Doe" );
|
||||||
|
|
|
@ -8,7 +8,12 @@ import static org.junit.Assert.*;
|
||||||
|
|
||||||
public class ServiceProviderTest {
|
public class ServiceProviderTest {
|
||||||
|
|
||||||
ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe");
|
ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe",
|
||||||
|
"testaddress", "8888888888", "companydotcom", true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiates an ServiceProvider account and tests if the random strings match to the required inputs.
|
||||||
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testServiceProvider() {
|
public void testServiceProvider() {
|
||||||
|
@ -27,13 +32,18 @@ public class ServiceProviderTest {
|
||||||
assertNotEquals("Doe", serviceprovider.getLastname());
|
assertNotEquals("Doe", serviceprovider.getLastname());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds services and tests if they match the requirements in order to function properly. Example: If a service has a same name it doesn't count as one.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addServiceTest() {
|
public void addServiceTest() {
|
||||||
serviceprovider.addService( new Service( "KitchenCleaner", 50 ) );
|
serviceprovider.addService( new Service( "KitchenCleaner", 50 ) );
|
||||||
serviceprovider.addService( new Service( "FrenchMaid", 250 ) );
|
serviceprovider.addService( new Service( "FrenchMaid", 250 ) );
|
||||||
serviceprovider.addService( new Service( "FrenchMaid", 250 ) );
|
serviceprovider.addService( new Service( "FrenchMaid", 210 ) );
|
||||||
serviceprovider.addService( new Service( "SecretService", 150 ) );
|
|
||||||
serviceprovider.addService( new Service( "SecretService", 150 ) );
|
serviceprovider.addService( new Service( "SecretService", 150 ) );
|
||||||
|
serviceprovider.addService( new Service( "SecretService", 110 ) );
|
||||||
int numOfServices = serviceprovider.getServices().size();
|
int numOfServices = serviceprovider.getServices().size();
|
||||||
assertEquals( 3, numOfServices );
|
assertEquals( 3, numOfServices );
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,10 @@ import static org.junit.Assert.*;
|
||||||
public class ServiceTest {
|
public class ServiceTest {
|
||||||
Service service = new Service( "FrenchMaid", 250 );
|
Service service = new Service( "FrenchMaid", 250 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiates an Service account and tests if the random strings match to the required inputs.
|
||||||
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testService(){
|
public void testService(){
|
||||||
assertEquals( "FrenchMaid", service.getName() );
|
assertEquals( "FrenchMaid", service.getName() );
|
||||||
|
@ -17,12 +21,23 @@ public class ServiceTest {
|
||||||
assertNotEquals( 250, service.getRate());
|
assertNotEquals( 250, service.getRate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds service providers and tests if they match the requirements in order to function properly. Example: If a service has a same name it doesn't count as one.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addServiceProviderTest(){
|
public void addServiceProviderTest(){
|
||||||
service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe" ) );
|
service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe",
|
||||||
service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe" ) );
|
"testaddress", "8888888888", "companydotcom", true) );
|
||||||
service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe" ) );
|
service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe",
|
||||||
service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe" ) );
|
"testaddress", "8888888888", "companydotcom", true) );
|
||||||
|
service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe",
|
||||||
|
"testaddress", "8888888888", "companydotcom", true) );
|
||||||
|
service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe",
|
||||||
|
"testaddress", "8888888888", "companydotcom", true) );
|
||||||
|
service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "John", "Doe",
|
||||||
|
"testaddress", "8888888888", "companydotcom", true) );
|
||||||
int numOfSP = service.getServiceProviders().size();
|
int numOfSP = service.getServiceProviders().size();
|
||||||
assertEquals( 2,numOfSP );
|
assertEquals( 2,numOfSP );
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,16 @@ import static org.junit.Assert.*;
|
||||||
|
|
||||||
public class UserTypeTest {
|
public class UserTypeTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests if the every user that is created is equal to each other or not.
|
||||||
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void userTypeComparaison() {
|
public void userTypeComparaison() {
|
||||||
UserType user = new HomeOwner("John123", "1234567890", "John", "Doe");
|
UserType user = new HomeOwner("John123", "1234567890", "John", "Doe");
|
||||||
UserType admin = new Admin();
|
UserType admin = new Admin();
|
||||||
UserType serviceprovider = new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe");
|
UserType serviceprovider = new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe",
|
||||||
|
"testaddress", "8888888888", "companydotcom", true);
|
||||||
boolean userservice = user.equals(serviceprovider);
|
boolean userservice = user.equals(serviceprovider);
|
||||||
boolean useradmin = user.equals(admin);
|
boolean useradmin = user.equals(admin);
|
||||||
boolean serviceadmin = serviceprovider.equals(admin);
|
boolean serviceadmin = serviceprovider.equals(admin);
|
||||||
|
|
62
ProjectUML.ump
Normal file
62
ProjectUML.ump
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
class UserType
|
||||||
|
{
|
||||||
|
firstname;
|
||||||
|
lastname;
|
||||||
|
username;
|
||||||
|
password;
|
||||||
|
}
|
||||||
|
|
||||||
|
class HomeOwner
|
||||||
|
{
|
||||||
|
isA UserType;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ServiceProvider
|
||||||
|
{
|
||||||
|
int[] availabilities;
|
||||||
|
address;
|
||||||
|
int phonenumber;
|
||||||
|
companyname;
|
||||||
|
boolean licensed;
|
||||||
|
isA UserType;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Admin
|
||||||
|
{
|
||||||
|
isA UserType;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Service
|
||||||
|
{
|
||||||
|
name;
|
||||||
|
double rate;
|
||||||
|
* -- * ServiceProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
//$?[End_of_model]$?
|
||||||
|
|
||||||
|
class UserType
|
||||||
|
{
|
||||||
|
position 475 69 141 109;
|
||||||
|
}
|
||||||
|
|
||||||
|
class HomeOwner
|
||||||
|
{
|
||||||
|
position 109 233 109 41;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ServiceProvider
|
||||||
|
{
|
||||||
|
position 849 239 173 126;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Admin
|
||||||
|
{
|
||||||
|
position 490 236 109 41;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Service
|
||||||
|
{
|
||||||
|
position 853 422 112 75;
|
||||||
|
position.association Service__ServiceProvider 65,0 61,126;
|
||||||
|
}
|
|
@ -1,3 +1,8 @@
|
||||||
# SEG2105-Olympus
|
# SEG2105-Olympus
|
||||||
SEG2105 final project, Ivana Erlich, Anshu Sharma, Batuhan Basoglu, Mary Tran
|
SEG2105 final project, Ivana Erlich, Anshu Sharma, Batuhan Basoglu, Mary Tran
|
||||||
|
|
||||||
https://github.com/ebivibe/SEG2105-Olympus
|
https://github.com/ebivibe/SEG2105-Olympus
|
||||||
|
|
||||||
|
Admin account is precreated with
|
||||||
|
username = admin,
|
||||||
|
password = admin
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue