Compare commits
236 commits
Author | SHA1 | Date | |
---|---|---|---|
|
48df7d76b6 | ||
|
a8f5aade8b | ||
|
80794c51c4 | ||
|
a553346fb2 | ||
|
22201c1405 | ||
|
3758bb594f | ||
|
aa0e073669 | ||
|
789239155f | ||
|
e0564d3e2b | ||
|
9b19c2e820 | ||
|
4d25a0c460 | ||
|
36ff2f2e60 | ||
|
7d3ef3bf92 | ||
|
7f169fe0e6 | ||
|
3c4e875a03 | ||
|
8999a149cb | ||
|
e50c681d54 | ||
|
89b982a152 | ||
|
8e6bced748 | ||
|
746316b097 | ||
|
0452609381 | ||
|
7989def6d7 | ||
|
95d9913136 | ||
|
b7df84eb5b | ||
|
bf002bbdbc | ||
|
8d5f01325c | ||
|
b3771bf12c | ||
|
ee4bc0e409 | ||
|
c42098ad28 | ||
|
82124d4155 | ||
|
3de19b4d96 | ||
|
66c1bce848 | ||
|
f0fa476399 | ||
|
a6dd977652 | ||
|
5c04bbc762 | ||
|
19a549c3f1 | ||
|
6815ba0cd0 | ||
|
44a2fe402e | ||
|
4914779451 | ||
|
3cf1f74dc4 | ||
|
cb7cc82006 | ||
|
13f588531a | ||
|
da469fe266 | ||
|
c29889070d | ||
|
3abfa0a23c | ||
|
47f83cf705 | ||
|
89be9c3680 | ||
|
ffce249510 | ||
|
49b01c0e5a | ||
|
fb4c32bcb1 | ||
|
3e3e529040 | ||
|
465c082115 | ||
|
1f4ca327f6 | ||
|
5b6734cbbb | ||
|
a385f7e18c | ||
|
f7545624bd | ||
|
cae9e119b5 | ||
|
2607a7d10d | ||
|
2c75c50435 | ||
|
65e1cb6200 | ||
|
4dfd27d96f | ||
|
8450b04d03 | ||
|
abc98d59f2 | ||
|
3bdd8b5ad6 | ||
|
5b8b0fdfd2 | ||
|
f5c191a781 | ||
|
7bb04d516b | ||
|
658a227d7b | ||
|
16402a2aff | ||
|
7624f2053b | ||
|
4953db6c55 | ||
|
04829231e2 | ||
|
2117d58685 | ||
|
b1910247c3 | ||
|
924bb3319e | ||
|
92c4d8cfd8 | ||
|
d7cf9ba311 | ||
|
66d33d4cc4 | ||
|
76c693e91e | ||
|
90a1161f16 | ||
|
2742160b60 | ||
|
5e781ee225 | ||
|
a2ff9fc82c | ||
|
1a1a9cc6a0 | ||
|
2d9e2d565b | ||
|
3d1c4b24af | ||
|
3eb2b0dafe | ||
|
c44539c59d | ||
|
56c57404bd | ||
|
9f5883bdee | ||
|
6e1c5915ca | ||
|
2ebda7ab71 | ||
|
c463906934 | ||
|
d2b074d518 | ||
|
5eed3f6ee3 | ||
|
1634fcfb16 | ||
|
60f9008151 | ||
|
6b72b3162c | ||
|
24b16fd8b1 | ||
|
2eb8555ae5 | ||
|
e45e742d71 | ||
|
3be59387a4 | ||
|
3155b66a7e | ||
|
94b333ded9 | ||
|
4a7c058c5f | ||
|
a88a575e7c | ||
|
696c4e4e4b | ||
|
0ae6c76777 | ||
|
d4fd4900ed | ||
|
caafe441b9 | ||
|
a517c63e7a | ||
|
bf2b4ae004 | ||
|
c3f35ad540 | ||
|
e374be7175 | ||
|
4202da62cb | ||
|
1da25d2aff | ||
|
19b42bf9a5 | ||
|
ad48945e19 | ||
|
39b59d5660 | ||
|
9a93d20dce | ||
|
6b0686fbdf | ||
|
32f1031782 | ||
|
16e39ff120 | ||
|
9c6c3ea257 | ||
|
4fd07d81b1 | ||
|
b730557cec | ||
|
65fc33daa1 | ||
|
47a422705d | ||
|
bd8ef59874 | ||
|
89985db38f | ||
|
38f3a14dbf | ||
|
d5824827cf | ||
|
1d8b1d6dfb | ||
|
8e3c6db4ef | ||
|
5687572fda | ||
|
24c15fafa0 | ||
|
163b1173cf | ||
|
df6c25b065 | ||
|
8ae08f829b | ||
|
cc8e5946c5 | ||
|
95e281fc87 | ||
|
d1f7e5a81c | ||
|
c5d85d3f5c | ||
|
f615b2f6e1 | ||
|
4520816740 | ||
|
ef6446f05b | ||
|
d4f1433f91 | ||
|
aa56f4d772 | ||
|
c11c42c305 | ||
|
88c6150dff | ||
|
76f860b9eb | ||
|
a92cda9aed | ||
|
e02b30c0ba | ||
|
ab9fa36a68 | ||
|
59317ddf37 | ||
|
676c92763e | ||
|
62fd194ad9 | ||
|
4831f71cd4 | ||
|
dff3eda2f5 | ||
|
e38d34b9eb | ||
|
afe8db8c2d | ||
|
0d0fa1ed99 | ||
|
0ad149265f | ||
|
4862bc8a7b | ||
|
295242e572 | ||
|
4fcbb34f38 | ||
|
672a241e88 | ||
|
3a4c792cb5 | ||
|
2ea28277c3 | ||
|
45ede0cbd5 | ||
|
33611b8983 | ||
|
ea0e8bd7d1 | ||
|
8ac71c9cac | ||
|
6f49545aba | ||
|
695ab61b15 | ||
|
aa0fa2a4ba | ||
|
ec69678da4 | ||
|
674ed9352f | ||
|
39ba11d11b | ||
|
23293089cb | ||
|
8b2532d27e | ||
|
073885ebeb | ||
|
3491212fbc | ||
|
7790edac33 | ||
|
60c0da3558 | ||
|
6c270be5ce | ||
|
7646deb05b | ||
|
97148737de | ||
|
d29b03972e | ||
|
319428eebb | ||
|
2da777b576 | ||
|
22cfef6b7b | ||
|
1f822b8181 | ||
|
4fe5b70d6e | ||
|
c91d38cf18 | ||
|
04362b99c0 | ||
|
8c35832b28 | ||
|
f12d7aa693 | ||
|
3288d51cf7 | ||
|
4a725dd6d6 | ||
|
a1d92aa423 | ||
|
d740cf72d3 | ||
|
8be4ccbbd7 | ||
|
fc2f8bba29 | ||
|
7edfe3a185 | ||
|
114c698b61 | ||
|
173f6097fd | ||
|
f1c28f1a4c | ||
|
9cd04e06da | ||
|
5599bd9179 | ||
|
9bb3534191 | ||
|
6f9590413f | ||
|
ab84abd042 | ||
|
0d9cf73143 | ||
|
7cde8be55a | ||
|
296aaf05e3 | ||
|
1014a78de8 | ||
|
555932b877 | ||
|
a80c6d37dc | ||
|
5a382baab4 | ||
|
8ecd089fe3 | ||
|
bba1c248a1 | ||
|
b22a32b4a2 | ||
|
aa102421ef | ||
|
e1b947ef43 | ||
|
0499d81093 | ||
|
0b36bb32e3 | ||
|
f299770923 | ||
|
6b1ff038c8 | ||
|
bcfa204f44 | ||
|
ac7e8aec0a | ||
|
a9746fb215 | ||
|
65bc8b2109 | ||
|
9cd853df11 | ||
|
50b0fc49c1 | ||
|
0aed26f071 |
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
Deliverable1.zip
Normal file
BIN
Deliverable2.zip
Normal file
BIN
Deliverable3.zip
Normal file
|
@ -25,7 +25,7 @@
|
|||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -16,18 +16,32 @@ android {
|
|||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
testOptions {
|
||||
unitTests {
|
||||
includeAndroidResources = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
implementation 'com.android.support:design:28.0.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'androidx.test:core:1.0.0'
|
||||
testImplementation 'org.mockito:mockito-core:1.10.19'
|
||||
testImplementation 'org.robolectric:robolectric:4.0-alpha-3-SNAPSHOT'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test:rules:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
|
||||
implementation 'com.jaredrummler:material-spinner:1.2.5'
|
||||
implementation 'com.android.support:design:28.0.0-alpha3'
|
||||
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
|
||||
|
||||
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
|
||||
}
|
||||
|
|
|
@ -9,15 +9,14 @@
|
|||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:icon="@mipmap/ic_launcher_round"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity
|
||||
android:name=".Main"
|
||||
android:label="@string/app_name">
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
@ -29,13 +28,52 @@
|
|||
android:name="preloaded_fonts"
|
||||
android:resource="@array/preloaded_fonts" />
|
||||
|
||||
<activity android:name=".SignUp" android:parentActivityName=".Main">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".Main" />
|
||||
</activity>
|
||||
<activity android:name=".LogIn" />
|
||||
<activity android:name=".Welcome"/>
|
||||
<activity
|
||||
android:name=".SignUp"
|
||||
android:label="Sign Up"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".LogIn"
|
||||
android:label="Log In"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Welcome"
|
||||
android:label="Welcome"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".AdminWelcome"
|
||||
android:label="Welcome"
|
||||
android:screenOrientation="portrait" />
|
||||
<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=".ServiceProviderEditProfile"
|
||||
android:label="Edit Profile"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateHidden" />
|
||||
<activity
|
||||
android:name=".ServiceProviderServicesList"
|
||||
android:label="List of Services"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ServiceProviderAvailabilities"
|
||||
android:label="Availabilities"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".SignUpPart2" />
|
||||
<activity android:name=".Bookings" />
|
||||
<activity android:name=".FindServiceProvider" />
|
||||
<activity android:name=".MakeBooking" />
|
||||
<activity android:name=".HomeOwnerEditProfile"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
BIN
OlympusServices/app/src/main/ic_launcher-web.png
Normal file
After Width: | Height: | Size: 37 KiB |
|
@ -0,0 +1,32 @@
|
|||
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 {
|
||||
|
||||
/**
|
||||
* The constructor for the admin object with predefined fields.
|
||||
* There should only be one admin object for the entire app.
|
||||
*/
|
||||
Admin(){
|
||||
super("admin", "admin", "Admin", "Admin");
|
||||
}
|
||||
|
||||
Admin(String hash, String salt){
|
||||
super("admin", hash, salt, "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"; }
|
||||
}
|
|
@ -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.service_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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
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 {
|
||||
|
||||
/**
|
||||
* Creates the xml pages for the class object
|
||||
* on creation of the object.
|
||||
*
|
||||
* @param savedInstanceState Bundle for transfer of data.
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_admin_welcome);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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){
|
||||
Intent intent = new Intent(getApplicationContext(), UsersList.class);
|
||||
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){
|
||||
Intent intent = new Intent(getApplicationContext(), AdminServicesList.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
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 {
|
||||
Service service;
|
||||
ServiceProvider provider;
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
public class Booking {
|
||||
private int starth;
|
||||
private int startmin;
|
||||
private int endh;
|
||||
private int endmin;
|
||||
private int day;
|
||||
private int month;
|
||||
private int year;
|
||||
private ServiceProvider serviceprovider; //username
|
||||
private HomeOwner homeowner; //username
|
||||
private Service service;
|
||||
public enum Status {
|
||||
PENDING{
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Pending";
|
||||
}
|
||||
},
|
||||
CONFIRMED{
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Confirmed";
|
||||
}
|
||||
},
|
||||
CANCELLED{
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Cancelled";
|
||||
}
|
||||
}
|
||||
}
|
||||
private Status status;
|
||||
|
||||
private int rating; //out of 5
|
||||
private String comment;
|
||||
|
||||
public Booking(int starth, int startmin, int endh, int endmin, int day, int month, int year,
|
||||
ServiceProvider serviceprovider, HomeOwner homeowner, Service service){
|
||||
this.starth = starth;
|
||||
this.startmin = startmin;
|
||||
this.endh = endh;
|
||||
this.endmin = endmin;
|
||||
this.day = day;
|
||||
this.month = month;
|
||||
this.year = year;
|
||||
this.serviceprovider = serviceprovider;
|
||||
this.homeowner = homeowner;
|
||||
this.service = service;
|
||||
this.status = Status.PENDING;
|
||||
}
|
||||
|
||||
|
||||
public int getStarth() {
|
||||
return starth;
|
||||
}
|
||||
|
||||
public void setStarth(int starth) {
|
||||
this.starth = starth;
|
||||
}
|
||||
|
||||
public int getStartmin() {
|
||||
return startmin;
|
||||
}
|
||||
|
||||
public void setStartmin(int startmin) {
|
||||
this.startmin = startmin;
|
||||
}
|
||||
|
||||
public int getEndh() {
|
||||
return endh;
|
||||
}
|
||||
|
||||
public void setEndh(int endh) {
|
||||
this.endh = endh;
|
||||
}
|
||||
|
||||
public int getEndmin() {
|
||||
return endmin;
|
||||
}
|
||||
|
||||
public void setEndmin(int endmin) {
|
||||
this.endmin = endmin;
|
||||
}
|
||||
|
||||
public int getDay() {
|
||||
return day;
|
||||
}
|
||||
|
||||
public void setDay(int day) {
|
||||
this.day = day;
|
||||
}
|
||||
|
||||
public int getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(int month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public int getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(int year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public ServiceProvider getServiceprovider() {
|
||||
return serviceprovider;
|
||||
}
|
||||
|
||||
public void setServiceprovider(ServiceProvider serviceprovider) {
|
||||
this.serviceprovider = serviceprovider;
|
||||
}
|
||||
|
||||
public HomeOwner getHomeowner() {
|
||||
return homeowner;
|
||||
}
|
||||
|
||||
public void setHomeowner(HomeOwner homeowner) {
|
||||
this.homeowner = homeowner;
|
||||
}
|
||||
|
||||
public Service getService(){ return service; }
|
||||
|
||||
public void setService(Service service) { this.service = service;}
|
||||
|
||||
public void setStatus(Status status){
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Status getStatus(){
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public int getRating() {
|
||||
return rating;
|
||||
}
|
||||
|
||||
public void setRating(int rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,378 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Bookings extends AppCompatActivity {
|
||||
|
||||
//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;
|
||||
|
||||
String username;
|
||||
DBHelper dbhelper;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_bookings);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
username = bundle.getString("username");
|
||||
dbhelper = new DBHelper(this);
|
||||
|
||||
List<Booking> booking = (List<Booking>)dbhelper.findBookings(username);
|
||||
Collections.reverse(booking);
|
||||
Booking[] bookings = new Booking[booking.size()];
|
||||
bookings = booking.toArray(bookings);
|
||||
Booking[] mostRecentBookings = new Booking[bookings.length];
|
||||
|
||||
/* //mock data
|
||||
Booking[] bookings = {new Booking(5, 5, 6, 6, 2, 3, 2019, (ServiceProvider)dbhelper.findUserByUsername("testing"),
|
||||
(HomeOwner)dbhelper.findUserByUsername("tester"), dbhelper.findService("service1"))};
|
||||
*/
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.Bookings);
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mAdapter = new MyAdapter(bookings, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
SwitchCompat toggle = findViewById(R.id.Switch);
|
||||
toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
List<Booking> booking = (List<Booking>)dbhelper.findBookings(username);
|
||||
Booking[] bookings = new Booking[booking.size()];
|
||||
bookings = booking.toArray(bookings);
|
||||
mAdapter = new MyAdapter(bookings, Bookings.this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
List<Booking> booking = (List<Booking>)dbhelper.findNonCancelledBookings(username);
|
||||
Booking[] bookings = new Booking[booking.size()];
|
||||
bookings = booking.toArray(bookings);
|
||||
mAdapter = new MyAdapter(bookings, Bookings.this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Override so that previous screen refreshes when pressing the
|
||||
* back button on this activity of the app.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void onBackPressed(){
|
||||
Intent intent;
|
||||
if(dbhelper.findUserByUsername(username).getRole().equals("ServiceProvider")){
|
||||
intent = new Intent(getApplicationContext(),ServiceProviderWelcome.class);
|
||||
}
|
||||
else{
|
||||
intent = new Intent(getApplicationContext(),Welcome.class);
|
||||
}
|
||||
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.BookingHolder> {
|
||||
|
||||
private Booking[] bookings;
|
||||
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(Booking[] bookings, Context context) {
|
||||
this.bookings = bookings;
|
||||
}
|
||||
|
||||
// Create new views (invoked by the layout manager)
|
||||
@NonNull
|
||||
@Override
|
||||
public BookingHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.booking_list_item, parent, false);
|
||||
BookingHolder vh = new BookingHolder(v);
|
||||
return vh;
|
||||
}
|
||||
|
||||
// Replace the contents of a view (invoked by the layout manager)
|
||||
@Override
|
||||
public void onBindViewHolder(BookingHolder holder, int position) {
|
||||
Booking booking = bookings[position];
|
||||
holder.serviceprovider.setText(booking.getServiceprovider().getFirstname()+" "+booking.getServiceprovider().getLastname()+", "+booking.getServiceprovider().getCompanyname());
|
||||
holder.homeowner.setText(booking.getHomeowner().getFirstname()+" "+booking.getHomeowner().getLastname());
|
||||
holder.service.setText(booking.getService().getName());
|
||||
String day;
|
||||
String month;
|
||||
String year = booking.getYear()+"";
|
||||
if(booking.getDay()<10){
|
||||
day = "0"+booking.getDay();
|
||||
}
|
||||
else{
|
||||
day = booking.getDay()+"";
|
||||
}
|
||||
if(booking.getMonth()<10){
|
||||
month = "0"+booking.getMonth();
|
||||
}
|
||||
else{
|
||||
month = booking.getMonth()+"";
|
||||
}
|
||||
|
||||
holder.date.setText(month+"/"+day+"/"+year);
|
||||
holder.start.setText(formatTime(booking.getStarth(), booking.getStartmin()));
|
||||
holder.end.setText(formatTime(booking.getEndh(), booking.getEndmin()));
|
||||
holder.status.setText(booking.getStatus().toString());
|
||||
holder.ho = booking.getHomeowner().getUsername();
|
||||
holder.sp = booking.getServiceprovider().getUsername();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Return the size of your dataset (invoked by the layout manager)
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return bookings.length;
|
||||
}
|
||||
|
||||
class BookingHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
|
||||
|
||||
TextView homeowner;
|
||||
TextView serviceprovider;
|
||||
TextView service;
|
||||
TextView date;
|
||||
TextView start;
|
||||
TextView end;
|
||||
TextView status;
|
||||
String ho;
|
||||
String sp;
|
||||
int starth;
|
||||
int startmin;
|
||||
int endh;
|
||||
int endmin;
|
||||
int month;
|
||||
int day;
|
||||
int year;
|
||||
|
||||
public BookingHolder(View row){
|
||||
super(row);
|
||||
homeowner = row.findViewById(R.id.HomeOwnerName);
|
||||
serviceprovider = row.findViewById(R.id.ServiceProviderName);
|
||||
service = row.findViewById(R.id.ServiceName);
|
||||
date = row.findViewById(R.id.DateName);
|
||||
start = row.findViewById(R.id.StartTime);
|
||||
end = row.findViewById(R.id.EndTime);
|
||||
status = row.findViewById(R.id.StatusName);
|
||||
|
||||
|
||||
row.setOnClickListener(this);
|
||||
}
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(dbhelper.findUserByUsername(username).getRole()=="ServiceProvider"){
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(Bookings.this);
|
||||
alertDialogBuilder.setMessage("Cancel or Confirm your booking");
|
||||
alertDialogBuilder.setPositiveButton("Confirm Booking",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
int[] times = parseTime(start.getText().toString(), end.getText().toString());
|
||||
starth = times[0];
|
||||
startmin = times[1];
|
||||
endh = times[2];
|
||||
endmin = times[3];
|
||||
String[] dates = date.getText().toString().split("/");
|
||||
month = Integer.parseInt(dates[0].replaceAll("\\s+",""));
|
||||
day = Integer.parseInt(dates[1].replaceAll("\\s+",""));
|
||||
year = Integer.parseInt(dates[2].replaceAll("\\s+",""));
|
||||
if(dbhelper.confirmBooking(new Booking(starth, startmin, endh, endmin, day, month, year, (ServiceProvider)dbhelper.findUserByUsername(sp),
|
||||
(HomeOwner)dbhelper.findUserByUsername(ho),
|
||||
new Service(service.getText().toString(), 5)))){
|
||||
|
||||
Toast.makeText(Bookings.this,"Booking is confirmed",Toast.LENGTH_LONG).show();
|
||||
Bookings.this.recreate();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(Bookings.this,"Booking could not be confirmed",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
alertDialogBuilder.setNegativeButton("Cancel Booking",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
int[] times = parseTime(start.getText().toString(), end.getText().toString());
|
||||
starth = times[0];
|
||||
startmin = times[1];
|
||||
endh = times[2];
|
||||
endmin = times[3];
|
||||
String[] dates = date.getText().toString().split("/");
|
||||
month = Integer.parseInt(dates[0].replaceAll("\\s+",""));
|
||||
day = Integer.parseInt(dates[1].replaceAll("\\s+",""));
|
||||
year = Integer.parseInt(dates[2].replaceAll("\\s+",""));
|
||||
if(dbhelper.cancelBooking(new Booking(starth, startmin, endh, endmin, day, month, year, (ServiceProvider)dbhelper.findUserByUsername(sp),
|
||||
(HomeOwner)dbhelper.findUserByUsername(ho),
|
||||
new Service(service.getText().toString(), 5)))){
|
||||
Toast.makeText(Bookings.this,"Booking is cancelled",Toast.LENGTH_LONG).show();
|
||||
Bookings.this.recreate();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(Bookings.this,"Booking could not be cancelled",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
alertDialog.show();
|
||||
}
|
||||
else{
|
||||
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(Bookings.this);
|
||||
alertDialogBuilder.setView(R.layout.rating_item);
|
||||
alertDialogBuilder.setPositiveButton("Rate Booking",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
int[] times = parseTime(start.getText().toString(), end.getText().toString());
|
||||
starth = times[0];
|
||||
startmin = times[1];
|
||||
endh = times[2];
|
||||
endmin = times[3];
|
||||
String[] dates = date.getText().toString().split("/");
|
||||
month = Integer.parseInt(dates[0].replaceAll("\\s+",""));
|
||||
day = Integer.parseInt(dates[1].replaceAll("\\s+",""));
|
||||
year = Integer.parseInt(dates[2].replaceAll("\\s+",""));
|
||||
RadioGroup ratingselect = ((AlertDialog) arg0).findViewById(R.id.RatingSelect);
|
||||
int selectedId = ratingselect.getCheckedRadioButtonId();
|
||||
RadioButton ratingpicked;
|
||||
EditText comment = ((AlertDialog) arg0).findViewById(R.id.Comment);
|
||||
if(selectedId!=-1 && !comment.getText().toString().equals("")){
|
||||
ratingpicked = (RadioButton)((AlertDialog) arg0).findViewById(selectedId);
|
||||
double rating = Double.parseDouble(ratingpicked.getText().toString());
|
||||
|
||||
Booking booking = new Booking(starth, startmin, endh, endmin, day, month, year, (ServiceProvider)dbhelper.findUserByUsername(sp),
|
||||
(HomeOwner)dbhelper.findUserByUsername(ho),
|
||||
new Service(service.getText().toString(), 5));
|
||||
if(!dbhelper.addRating(booking, rating, comment.getText().toString())){
|
||||
Toast.makeText(Bookings.this, "Rating cannot be added before the appointment", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else{
|
||||
Bookings.this.recreate();
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
Toast.makeText(Bookings.this, "Rating and comment must be filled in", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
alertDialogBuilder.setNegativeButton("Cancel Booking",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
int[] times = parseTime(start.getText().toString(), end.getText().toString());
|
||||
starth = times[0];
|
||||
startmin = times[1];
|
||||
endh = times[2];
|
||||
endmin = times[3];
|
||||
String[] dates = date.getText().toString().split("/");
|
||||
month = Integer.parseInt(dates[0].replaceAll("\\s+",""));
|
||||
day = Integer.parseInt(dates[1].replaceAll("\\s+",""));
|
||||
year = Integer.parseInt(dates[2].replaceAll("\\s+",""));
|
||||
if(dbhelper.cancelBooking(new Booking(starth, startmin, endh, endmin, day, month, year, (ServiceProvider)dbhelper.findUserByUsername(sp),
|
||||
(HomeOwner)dbhelper.findUserByUsername(ho),
|
||||
new Service(service.getText().toString(), 5)))){
|
||||
Toast.makeText(Bookings.this,"Booking is cancelled",Toast.LENGTH_LONG).show();
|
||||
Bookings.this.recreate();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(Bookings.this,"Booking could not be cancelled",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
alertDialog.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private String formatTime(int hours, int minutes){
|
||||
String time = "";
|
||||
if(hours<10){
|
||||
time = time+"0"+hours+":";
|
||||
}else{
|
||||
time = time+hours+":";
|
||||
}
|
||||
if (minutes<10){
|
||||
time = time+"0"+minutes;
|
||||
}
|
||||
else {
|
||||
time = time+minutes;
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
|
||||
private int[] parseTime(String startTime, String endTime){
|
||||
int[] times = new int[4];
|
||||
if(startTime.equals("START")){
|
||||
times[0]=0;
|
||||
times[1]=0;
|
||||
}else{
|
||||
times[0] = Integer.parseInt(startTime.substring(0,2));
|
||||
times[1] = Integer.parseInt(startTime.substring(3));
|
||||
}
|
||||
if(endTime.equals("END")){
|
||||
times[2]=0;
|
||||
times[3]=0;
|
||||
}else{
|
||||
times[2] = Integer.parseInt(endTime.substring(0,2));
|
||||
times[3] = Integer.parseInt(endTime.substring(3));
|
||||
}
|
||||
return times;
|
||||
}
|
||||
}
|
|
@ -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,90 @@
|
|||
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 EditServiceDialogFragment 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 void onDialogEdit(DialogFragment dialog);
|
||||
public void onDialogDelete(DialogFragment dialog);
|
||||
}
|
||||
EditServiceDialogFragment.NoticeDialogListener mListener;
|
||||
|
||||
// Override the Fragment.onAttach() method to instantiate the NoticeDialogListener
|
||||
@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 = (EditServiceDialogFragment.NoticeDialogListener) context;
|
||||
} catch (ClassCastException e) {
|
||||
// The activity doesn't implement the interface, throw exception
|
||||
throw new ClassCastException(this.toString()
|
||||
+ " 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
|
||||
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_edit, null))
|
||||
// Add action buttons
|
||||
.setPositiveButton(R.string.update, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString("name", (String)getArguments().get("name"));
|
||||
EditText rateInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.RateInput);
|
||||
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);
|
||||
mListener.onDialogEdit(EditServiceDialogFragment.this);
|
||||
}
|
||||
else{
|
||||
Toast.makeText(getContext(), "Rate cannot be empty", Toast.LENGTH_LONG).show();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.delete, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString("name", (String)getArguments().get("name"));
|
||||
|
||||
EditServiceDialogFragment.this.setArguments(args);
|
||||
mListener.onDialogDelete(EditServiceDialogFragment.this);
|
||||
}
|
||||
})
|
||||
.setTitle((String)getArguments().get("name"));
|
||||
return builder.create();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,455 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
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.Button;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.RatingBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.jaredrummler.materialspinner.MaterialSpinner;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class FindServiceProvider extends AppCompatActivity {
|
||||
String username;
|
||||
DBHelper dbHelper;
|
||||
|
||||
//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;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_find_service_provider);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
username = bundle.getString("username");
|
||||
|
||||
|
||||
dbHelper = new DBHelper(this);
|
||||
MaterialSpinner spinner2 = 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];
|
||||
}
|
||||
spinner2.setItems(services);
|
||||
|
||||
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.ServiceProviders);
|
||||
|
||||
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed(){
|
||||
Intent intent = new Intent(getApplicationContext(),Welcome.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
public void Reset(View view){
|
||||
|
||||
Button button = findViewById(R.id.Start);
|
||||
Button button2 = findViewById(R.id.End);
|
||||
Button button3 = findViewById(R.id.Date);
|
||||
RadioGroup ratingselect = findViewById(R.id.RatingSelect);
|
||||
button.setText("START");
|
||||
button2.setText("END");
|
||||
button3.setText("DATE");
|
||||
ratingselect.clearCheck();
|
||||
//clears recycler view
|
||||
String[][] empty = {};
|
||||
mAdapter = new MyAdapter(empty, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
|
||||
}
|
||||
public void Search(View view){
|
||||
MaterialSpinner spinner = findViewById(R.id.ServicesInput);
|
||||
Button button = findViewById(R.id.Start);
|
||||
Button button2 = findViewById(R.id.End);
|
||||
Button button3 = findViewById(R.id.Date);
|
||||
RadioGroup ratingselect = findViewById(R.id.RatingSelect);
|
||||
int selectedId = ratingselect.getCheckedRadioButtonId();
|
||||
RadioButton ratingpicked;
|
||||
|
||||
String service = spinner.getText().toString();
|
||||
String start;
|
||||
String end;
|
||||
String date;
|
||||
double rating;
|
||||
List<String[]> providers;
|
||||
if(!button.getText().toString().equals("Start") && !button2.getText().toString().equals("End")
|
||||
&& !button3.getText().toString().equals("Date")){
|
||||
System.out.println(button.getText().toString()+":"+button2.getText().toString()+":"+button3.getText().toString());
|
||||
start = button.getText().toString();
|
||||
end = button2.getText().toString();
|
||||
date = button3.getText().toString();
|
||||
|
||||
String[] dates = date.split("/");
|
||||
int month = Integer.parseInt(dates[0].replaceAll("\\s+",""));
|
||||
int day = Integer.parseInt(dates[1].replaceAll("\\s+",""));
|
||||
int year = Integer.parseInt(dates[2].replaceAll("\\s+",""));
|
||||
|
||||
String[] starttimes = start.split(":");
|
||||
int starth = Integer.parseInt(starttimes[0].replaceAll("\\s+",""));
|
||||
int startmin = Integer.parseInt(starttimes[1].replaceAll("\\s+",""));
|
||||
|
||||
String[] endtimes = end.split(":");
|
||||
int endh = Integer.parseInt(endtimes[0].replaceAll("\\s+",""));
|
||||
int endmin = Integer.parseInt(endtimes[1].replaceAll("\\s+",""));
|
||||
|
||||
int[] times = {starth, startmin, endh, endmin};
|
||||
if(selectedId!=-1 && validateTime(times)){
|
||||
ratingpicked = (RadioButton) findViewById(selectedId);
|
||||
rating = Double.parseDouble(ratingpicked.getText().toString());
|
||||
providers = dbHelper.getProvidersByTimeAndRating(service, rating, year, month, day,
|
||||
starth, startmin, endh, endmin);
|
||||
}
|
||||
else if(validateTime(times)){
|
||||
providers = dbHelper.getProvidersByTime(service, year, month, day,
|
||||
starth, startmin, endh, endmin);
|
||||
}
|
||||
else if(selectedId!=-1){
|
||||
Toast.makeText(this, "Times are invalid, only searching by service and rating"+starth+";"+startmin+","+endh+";"+endmin, Toast.LENGTH_SHORT).show();
|
||||
ratingpicked = (RadioButton) findViewById(selectedId);
|
||||
rating = Double.parseDouble(ratingpicked.getText().toString());
|
||||
providers = dbHelper.getProvidersAboveRating(service, rating);
|
||||
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Times are invalid, only searching by service", Toast.LENGTH_SHORT).show();
|
||||
providers = dbHelper.getAllProvidersByService(service);
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(selectedId!=-1){
|
||||
ratingpicked = (RadioButton) findViewById(selectedId);
|
||||
rating = Double.parseDouble(ratingpicked.getText().toString());
|
||||
providers = dbHelper.getProvidersAboveRating(service, rating);
|
||||
}
|
||||
else{
|
||||
providers = dbHelper.getAllProvidersByService(service);
|
||||
}
|
||||
}
|
||||
|
||||
//update recycler view
|
||||
String[][] providerslist = new String[providers.size()][];
|
||||
for(int i=0; i<providers.size(); i++){
|
||||
providerslist[i] = providers.get(i);
|
||||
}
|
||||
|
||||
mAdapter = new MyAdapter(providerslist, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void makeBooking(String serviceprovider){
|
||||
MaterialSpinner spinner = findViewById(R.id.ServicesInput);
|
||||
String service = spinner.getText().toString();
|
||||
Intent intent = new Intent(getApplicationContext(),MakeBooking.class);
|
||||
intent.putExtra("homeowner", username);
|
||||
intent.putExtra("serviceprovider", serviceprovider);
|
||||
intent.putExtra("service", service);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onClickDate(View view){
|
||||
|
||||
final Button button = (Button)view;
|
||||
final Calendar c = Calendar.getInstance();
|
||||
|
||||
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int month, int day) {
|
||||
Calendar newDate = Calendar.getInstance();
|
||||
newDate.set(year, month, day);
|
||||
month++;
|
||||
String daystring;
|
||||
String monthstring;
|
||||
if((""+day).length()==1){
|
||||
daystring = "0"+day;
|
||||
}
|
||||
else{
|
||||
daystring = day+"";
|
||||
}
|
||||
if((""+month).length()==1){
|
||||
monthstring = "0"+month;
|
||||
}
|
||||
else{
|
||||
monthstring = ""+month;
|
||||
}
|
||||
button.setText(monthstring + " / " + daystring + " / "
|
||||
+ year);
|
||||
|
||||
button.setTextSize(9);
|
||||
}
|
||||
|
||||
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
|
||||
datePickerDialog.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void onClickTime(View view){
|
||||
final Calendar c = Calendar.getInstance();
|
||||
int hour = c.get(Calendar.HOUR_OF_DAY);
|
||||
int minute = c.get(Calendar.MINUTE);
|
||||
final Button button = (Button)view;
|
||||
|
||||
// Launch Time Picker Dialog
|
||||
TimePickerDialog timePickerDialog = new TimePickerDialog(this,
|
||||
new TimePickerDialog.OnTimeSetListener() {
|
||||
|
||||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay,
|
||||
int minute) {
|
||||
String time = "";
|
||||
|
||||
button.setText(formatTime(hourOfDay,minute));
|
||||
|
||||
//set availibility for service provider and check start time is less than finish
|
||||
}
|
||||
|
||||
}, hour, minute, false);
|
||||
timePickerDialog.show();
|
||||
|
||||
}
|
||||
|
||||
private String formatTime(int hours, int minutes){
|
||||
String time = "";
|
||||
if(hours<10){
|
||||
time = time+"0"+hours+":";
|
||||
}else{
|
||||
time = time+hours+":";
|
||||
}
|
||||
if (minutes<10){
|
||||
time = time+"0"+minutes;
|
||||
}
|
||||
else {
|
||||
time = time+minutes;
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
private int[] parseTime(String startTime, String endTime){
|
||||
int[] times = new int[4];
|
||||
if(startTime.equals("START")){
|
||||
times[0]=0;
|
||||
times[1]=0;
|
||||
}else{
|
||||
times[0] = Integer.parseInt(startTime.substring(0,2));
|
||||
times[1] = Integer.parseInt(startTime.substring(3));
|
||||
}
|
||||
if(endTime.equals("END")){
|
||||
times[2]=0;
|
||||
times[3]=0;
|
||||
}else{
|
||||
times[2] = Integer.parseInt(endTime.substring(0,2));
|
||||
times[3] = Integer.parseInt(endTime.substring(3));
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
private boolean validateTime(int[] time){
|
||||
if(time[0]==0&&time[1]==0&&time[2]==0&&time[3]==0){
|
||||
return true;
|
||||
}
|
||||
if(time[2]>time[0]){
|
||||
return true;
|
||||
}else{
|
||||
if(time[2]==time[0]&&time[3]>time[1]){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ProviderHolder> {
|
||||
|
||||
private String[][] serviceProviders;
|
||||
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(String[][] serviceProviders, Context context) {
|
||||
this.serviceProviders = serviceProviders;
|
||||
}
|
||||
|
||||
// Create new views (invoked by the layout manager)
|
||||
@NonNull
|
||||
@Override
|
||||
public ProviderHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.service_list_item, parent, false);
|
||||
ProviderHolder vh = new ProviderHolder(v);
|
||||
return vh;
|
||||
}
|
||||
|
||||
// Replace the contents of a view (invoked by the layout manager)
|
||||
@Override
|
||||
public void onBindViewHolder(ProviderHolder holder, int position) {
|
||||
String[] serviceprovider = serviceProviders[position];
|
||||
holder.name.setText(serviceprovider[1]+" "+serviceprovider[2]);
|
||||
holder.rate.setText(""+serviceprovider[3]);
|
||||
holder.username.setText(serviceprovider[0]);
|
||||
|
||||
}
|
||||
|
||||
// Return the size of your dataset (invoked by the layout manager)
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return serviceProviders.length;
|
||||
}
|
||||
|
||||
class ProviderHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
|
||||
|
||||
TextView name;
|
||||
TextView rate;
|
||||
TextView username;
|
||||
|
||||
public ProviderHolder(View row){
|
||||
super(row);
|
||||
name = row.findViewById(R.id.Name);
|
||||
rate = row.findViewById(R.id.Rate);
|
||||
username = row.findViewById(R.id.Username);
|
||||
row.setOnClickListener(this);
|
||||
}
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
TextView nameview = (TextView)view.findViewById(R.id.Username);
|
||||
final String name = nameview.getText().toString();
|
||||
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(FindServiceProvider.this);
|
||||
|
||||
|
||||
alertDialogBuilder.setView(R.layout.sp_info_item);
|
||||
|
||||
|
||||
alertDialogBuilder.setPositiveButton("Make Booking",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
makeBooking(name);
|
||||
}
|
||||
});
|
||||
|
||||
alertDialogBuilder.setNegativeButton("Nevermind",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
alertDialog.show();
|
||||
ServiceProvider sp = (ServiceProvider)dbHelper.findUserByUsername(name);
|
||||
TextView spname = alertDialog.findViewById(R.id.NameName);
|
||||
spname.setText(sp.getFirstname()+" "+sp.getLastname());
|
||||
|
||||
TextView company = alertDialog.findViewById(R.id.CompanyName);
|
||||
company.setText(sp.getCompanyname());
|
||||
|
||||
TextView address = alertDialog.findViewById(R.id.AddressName);
|
||||
address.setText(sp.getAddress());
|
||||
|
||||
TextView phone = alertDialog.findViewById(R.id.PhoneNumberName);
|
||||
phone.setText(sp.getPhonenumber());
|
||||
|
||||
TextView licensed = alertDialog.findViewById(R.id.LicensedName);
|
||||
if(sp.isLicensed()){
|
||||
licensed.setText("Yes");
|
||||
}
|
||||
else{
|
||||
licensed.setText("No");
|
||||
}
|
||||
TextView description = alertDialog.findViewById(R.id.DescriptionName);
|
||||
description.setText(sp.getDescription());
|
||||
|
||||
TextView rating = alertDialog.findViewById(R.id.AverageRatingName);
|
||||
MaterialSpinner spinner = findViewById(R.id.ServicesInput);
|
||||
rating.setText(""+dbHelper.getAverageRating(name, spinner.getText().toString()));
|
||||
|
||||
TextView ratingtext = alertDialog.findViewById(R.id.AverageRating);
|
||||
ratingtext.setText("Rating for " +spinner.getText().toString());
|
||||
|
||||
//actual data
|
||||
List<String[]> randc = dbHelper.getAllRatingsAndComments(name,spinner.getText().toString());
|
||||
String[] ratings = new String[randc.size()];
|
||||
for(int i=0; i<randc.size(); i++){
|
||||
ratings[i] = "Rating: "+randc.get(i)[1]+"\nComment: "+randc.get(i)[2];
|
||||
}
|
||||
|
||||
/*mock data
|
||||
String[] ratings ={"Rating: 5\nComment: Did great","Rating: 1\nComment: Worst plumber ever",
|
||||
"Rating: 1\nComment: Couldn't find my house", "Rating: 2\nComment: Too expensive, ok plumber"};
|
||||
*/
|
||||
|
||||
|
||||
ArrayAdapter adapter = new ArrayAdapter<String>(FindServiceProvider.this, R.layout.simple_list_item_1_customized, ratings);
|
||||
|
||||
ListView listView = (ListView) alertDialog.findViewById(R.id.RatingList);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
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 {
|
||||
|
||||
/**
|
||||
* 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){
|
||||
super(username, password, firstname, lastname);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 hash String for hash.
|
||||
* @param salt String for salt.
|
||||
* @param firstname String for firstname.
|
||||
* @param lastname String for lastname.
|
||||
*/
|
||||
HomeOwner(String username, String hash, String salt, String firstname, String lastname){
|
||||
super(username, hash, salt, 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"; }
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class HomeOwnerEditProfile extends AppCompatActivity {
|
||||
String username;
|
||||
DBHelper dbHelper;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_home_owner_edit_profile);
|
||||
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
username = bundle.getString("username");
|
||||
dbHelper = new DBHelper(this);
|
||||
UserType user;
|
||||
user = dbHelper.findUserByUsername(username);
|
||||
TextView firstname = findViewById(R.id.FirstNameInput);
|
||||
TextView lastname = findViewById(R.id.LastNameInput);
|
||||
TextView password = findViewById(R.id.PasswordInput);
|
||||
|
||||
|
||||
firstname.setText(user.getFirstname());
|
||||
lastname.setText(user.getLastname());
|
||||
password.setText("");
|
||||
|
||||
}
|
||||
/**
|
||||
* 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(),Welcome.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves updated user information to the database
|
||||
* @param view
|
||||
*/
|
||||
public void Save(View view){
|
||||
TextView firstname = findViewById(R.id.FirstNameInput);
|
||||
TextView lastname = findViewById(R.id.LastNameInput);
|
||||
TextView password = findViewById(R.id.PasswordInput);
|
||||
|
||||
//Checks for the fields
|
||||
if((password.getText().toString().length()>=5 || password.getText().toString().equals(""))
|
||||
&& firstname.getText().toString().length()>0
|
||||
&& lastname.getText().toString().length()>0
|
||||
&& password.getText().toString().matches("[a-zA-Z0-9]*")
|
||||
&& firstname.getText().toString().matches("[a-zA-Z]*")
|
||||
&& lastname.getText().toString().matches("[a-zA-Z]*")
|
||||
) {
|
||||
|
||||
if(dbHelper.updateUserInfo(username, password.getText().toString(), firstname.getText().toString(), lastname.getText().toString()
|
||||
)){
|
||||
//add comment method here
|
||||
Toast.makeText(this, "Profile has been updated", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Could not update profile ", Toast.LENGTH_LONG).show();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Fields cannot be empty and must be formatted correctly", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -2,12 +2,99 @@ package com.uottawa.olympus.olympusservices;
|
|||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.content.Intent;
|
||||
import android.widget.EditText;
|
||||
import android.view.View;
|
||||
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 {
|
||||
|
||||
/**
|
||||
* On creation of this activity the login xml file
|
||||
* is loaded up.
|
||||
*
|
||||
* @param savedInstanceState Bundle object for transfer of information.
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
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){
|
||||
String username = ((EditText) findViewById(R.id.UsernameInput)).getText().toString();
|
||||
String password = ((EditText) findViewById(R.id.PasswordInput)).getText().toString();
|
||||
DBHelper dbHelper = new DBHelper(this);
|
||||
if(username.matches("[a-zA-Z0-9]*")&&password.matches("[a-zA-Z0-9]*")
|
||||
&& password.length()>0 && username.length()>0) {
|
||||
if (dbHelper.findUserByUsername(username) != null) {
|
||||
UserType user = dbHelper.findUserByUsername(username);
|
||||
if (user.getUsername().equals(username) &&
|
||||
PasswordEncryption.slowEquals(user.getHash(),
|
||||
PasswordEncryption.encrypt(password, user.getSalt()))) {
|
||||
if(user.getRole()=="Admin"){
|
||||
Intent intent = new Intent(getApplicationContext(),AdminWelcome.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
else if(user.getRole()=="ServiceProvider"){
|
||||
Intent intent = new Intent(getApplicationContext(),ServiceProviderWelcome.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
else {
|
||||
Intent intent = new Intent(getApplicationContext(),Welcome.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
Toast.makeText(this, "Wrong Password", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(this, "Account does not exist", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
else if(username.length()==0 || password.length()==0){
|
||||
Toast.makeText(this, "Fields cannot be empty", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else{
|
||||
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
|
||||
public void onBackPressed(){
|
||||
Intent intent = new Intent(getApplicationContext(), Main.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,13 +5,53 @@ import android.os.Bundle;
|
|||
import android.content.Intent;
|
||||
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 {
|
||||
|
||||
/**
|
||||
* 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
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
UserType admin = new Admin();
|
||||
DBHelper dbHelper = new DBHelper(this);
|
||||
dbHelper.addUser(admin);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 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){
|
||||
Intent intent = new Intent(getApplicationContext(),SignUp.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On click of the Login button loads up the login activity.
|
||||
*
|
||||
* @param view View object containing the buttons.
|
||||
*/
|
||||
public void onClickLogIn(View view){
|
||||
Intent intent = new Intent(getApplicationContext(),LogIn.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,227 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.app.DatePickerDialog;
|
||||
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.DatePicker;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class MakeBooking extends AppCompatActivity {
|
||||
String homeowner;
|
||||
String serviceprovider;
|
||||
String service;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_make_booking);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
homeowner = bundle.getString("homeowner");
|
||||
serviceprovider = bundle.getString("serviceprovider");
|
||||
service = bundle.getString("service");
|
||||
|
||||
TextView homeo = findViewById(R.id.HomeOwner);
|
||||
TextView servicep = findViewById(R.id.ServiceProvider);
|
||||
TextView serv = findViewById(R.id.Service);
|
||||
|
||||
homeo.setText("Home Owner: \n"+homeowner);
|
||||
servicep.setText("ServiceProvider: \n"+serviceprovider);
|
||||
serv.setText("Service: \n"+service);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed(){
|
||||
Intent intent = new Intent(getApplicationContext(),Welcome.class);
|
||||
intent.putExtra("username", homeowner);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
public void Cancel(View view){
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
public void Book(View view){
|
||||
Button button = findViewById(R.id.Start);
|
||||
Button button2 = findViewById(R.id.End);
|
||||
Button button3 = findViewById(R.id.Date);
|
||||
|
||||
if(!button.getText().toString().equals("Start") && !button2.getText().toString().equals("End")
|
||||
&& !button3.getText().toString().equals("Date")){
|
||||
String[] dates = button3.getText().toString().split("/");
|
||||
int month = Integer.parseInt(dates[0].replaceAll("\\s+",""));
|
||||
int day = Integer.parseInt(dates[1].replaceAll("\\s+",""));
|
||||
int year = Integer.parseInt(dates[2].replaceAll("\\s+",""));
|
||||
|
||||
String[] starttimes = button.getText().toString().split(":");
|
||||
int starth = Integer.parseInt(starttimes[0].replaceAll("\\s+",""));
|
||||
int startmin = Integer.parseInt(starttimes[1].replaceAll("\\s+",""));
|
||||
|
||||
String[] endtimes = button2.getText().toString().split(":");
|
||||
int endh = Integer.parseInt(endtimes[0].replaceAll("\\s+",""));
|
||||
int endmin = Integer.parseInt(endtimes[1].replaceAll("\\s+",""));
|
||||
|
||||
Date date = new Date();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
Date selecteddate = sdf.parse(dates[2].replaceAll("\\s+","") + "-" + dates[0].replaceAll("\\s+","") + "-" + dates[1].replaceAll("\\s+",""));
|
||||
if(selecteddate.compareTo(date)<0){
|
||||
Toast.makeText(this, "Date must be a future date", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else{
|
||||
if (starth<endh || (starth==endh && startmin<endmin)){
|
||||
DBHelper dbHelper = new DBHelper(this);
|
||||
|
||||
|
||||
if (dbHelper.addBooking(serviceprovider, homeowner, service, year, month, day,
|
||||
starth, startmin, endh, endmin)) {
|
||||
Toast.makeText(this, "Booking Made", Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(getApplicationContext(), Welcome.class);
|
||||
intent.putExtra("username", homeowner);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
} else {
|
||||
Toast.makeText(this, "Booking could not be made", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Time is invalid", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
Toast.makeText(this, "Date is invalid", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Date and times must be selected", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickDate(View view){
|
||||
|
||||
final Button button = (Button)view;
|
||||
final Calendar c = Calendar.getInstance();
|
||||
|
||||
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int month, int day) {
|
||||
Calendar newDate = Calendar.getInstance();
|
||||
newDate.set(year, month, day);
|
||||
month++;
|
||||
String daystring;
|
||||
String monthstring;
|
||||
if((""+day).length()==1){
|
||||
daystring = "0"+day;
|
||||
}
|
||||
else{
|
||||
daystring = day+"";
|
||||
}
|
||||
if((""+month).length()==1){
|
||||
monthstring = "0"+month;
|
||||
}
|
||||
else{
|
||||
monthstring = ""+month;
|
||||
}
|
||||
button.setText(monthstring + " / " + daystring + " / "
|
||||
+ year);
|
||||
}
|
||||
|
||||
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
|
||||
datePickerDialog.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void onClickTime(View view){
|
||||
final Calendar c = Calendar.getInstance();
|
||||
int hour = c.get(Calendar.HOUR_OF_DAY);
|
||||
int minute = c.get(Calendar.MINUTE);
|
||||
final Button button = (Button)view;
|
||||
|
||||
// Launch Time Picker Dialog
|
||||
TimePickerDialog timePickerDialog = new TimePickerDialog(this,
|
||||
new TimePickerDialog.OnTimeSetListener() {
|
||||
|
||||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay,
|
||||
int minute) {
|
||||
String time = "";
|
||||
|
||||
button.setText(formatTime(hourOfDay,minute));
|
||||
//set availibility for service provider and check start time is less than finish
|
||||
}
|
||||
|
||||
}, hour, minute, false);
|
||||
timePickerDialog.show();
|
||||
|
||||
}
|
||||
|
||||
private String formatTime(int hours, int minutes){
|
||||
String time = "";
|
||||
if(hours<10){
|
||||
time = time+"0"+hours+":";
|
||||
}else{
|
||||
time = time+hours+":";
|
||||
}
|
||||
if (minutes<10){
|
||||
time = time+"0"+minutes;
|
||||
}
|
||||
else {
|
||||
time = time+minutes;
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
private int[] parseTime(String startTime, String endTime){
|
||||
int[] times = new int[4];
|
||||
if(startTime.equals("START")){
|
||||
times[0]=0;
|
||||
times[1]=0;
|
||||
}else{
|
||||
times[0] = Integer.parseInt(startTime.substring(0,2));
|
||||
times[1] = Integer.parseInt(startTime.substring(3));
|
||||
}
|
||||
if(endTime.equals("END")){
|
||||
times[2]=0;
|
||||
times[3]=0;
|
||||
}else{
|
||||
times[2] = Integer.parseInt(endTime.substring(0,2));
|
||||
times[3] = Integer.parseInt(endTime.substring(3));
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
private boolean validateTime(int[] time){
|
||||
if(time[0]==0&&time[1]==0&&time[2]==0&&time[3]==0){
|
||||
return true;
|
||||
}
|
||||
if(time[2]>time[0]){
|
||||
return true;
|
||||
}else{
|
||||
if(time[2]==time[0]&&time[3]>time[1]){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
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.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 {
|
||||
|
||||
/**
|
||||
* Creates a NoticeDialogListener interface for other classes to
|
||||
* implement to have this class be functional in the other classes.
|
||||
*
|
||||
*/
|
||||
public interface NoticeDialogListener {
|
||||
public void onDialogNew(DialogFragment dialog);
|
||||
public void onDialogNevermind(DialogFragment dialog);
|
||||
}
|
||||
NoticeDialogListener mListener;
|
||||
|
||||
// Override the Fragment.onAttach() method to instantiate the NoticeDialogListener
|
||||
@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 = (NoticeDialogListener) context;
|
||||
} catch (ClassCastException e) {
|
||||
// The activity doesn't implement the interface, throw exception
|
||||
throw new ClassCastException(this.toString()
|
||||
+ " 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
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
// Get the layout inflater
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.dialog_service_new, null);
|
||||
|
||||
|
||||
// Inflate and set the layout for the dialog
|
||||
// Pass null as the parent view because its going in the dialog layout
|
||||
builder.setView(view)
|
||||
// Add action buttons
|
||||
.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
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();
|
||||
args.putString("name", name);
|
||||
args.putDouble("rate", rate);
|
||||
NewServiceDialogFragment.this.setArguments(args);
|
||||
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() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
NewServiceDialogFragment.this.getDialog().cancel();
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.os.Message;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.lang.Math;
|
||||
|
||||
public class PasswordEncryption {
|
||||
private static final MessageDigest MESSAGE_DIGEST;
|
||||
private static final char[] POSSIBLE_CHARS;
|
||||
private static final SecureRandom random;
|
||||
|
||||
static{
|
||||
MessageDigest messageDigest;
|
||||
try{
|
||||
messageDigest = MessageDigest.getInstance("SHA-256");
|
||||
} catch (NoSuchAlgorithmException e){
|
||||
messageDigest = null;
|
||||
}
|
||||
MESSAGE_DIGEST = messageDigest;
|
||||
|
||||
POSSIBLE_CHARS = new char[94];
|
||||
for (int i = 33; i<127; i++){
|
||||
POSSIBLE_CHARS[i-33] = (char)i;
|
||||
}
|
||||
|
||||
random = new SecureRandom();
|
||||
}
|
||||
|
||||
public static String encrypt(String password, String salt){
|
||||
password = salt + password;
|
||||
|
||||
byte[] passwordBytes = password.getBytes();
|
||||
byte[] hashedPassword;
|
||||
|
||||
MESSAGE_DIGEST.reset();
|
||||
MESSAGE_DIGEST.update(passwordBytes);
|
||||
hashedPassword = MESSAGE_DIGEST.digest();
|
||||
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < hashedPassword.length; i++) {
|
||||
if ((hashedPassword[i] & 0xff) < 0x10) {
|
||||
sb.append("0");
|
||||
}
|
||||
|
||||
sb.append(Long.toString(hashedPassword[i] & 0xff, 16));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String generateSalt(){
|
||||
long stringID = Math.abs(random.nextLong());
|
||||
String salt = "";
|
||||
|
||||
while(stringID > 0){
|
||||
//the least significant digit is added to nonce string first
|
||||
int index = (int)(stringID%94);
|
||||
salt += POSSIBLE_CHARS[index];
|
||||
stringID /= 94;
|
||||
}
|
||||
return salt;
|
||||
}
|
||||
|
||||
public static boolean slowEquals(String one, String two){
|
||||
byte[] first = one.getBytes();
|
||||
byte[] second = two.getBytes();
|
||||
|
||||
int length = first.length > second.length ? second.length : first.length;
|
||||
boolean same = true;
|
||||
for (int i = 0; i<length; i++){
|
||||
if (first[i] != second[i]){
|
||||
same = false;
|
||||
}
|
||||
}
|
||||
return same;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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 {
|
||||
//name of the service field.
|
||||
private String name;
|
||||
//rate of the service field.
|
||||
private double rate;
|
||||
//list of services the providers that offers this service.
|
||||
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) {
|
||||
this.name = name;
|
||||
this.rate = rate;
|
||||
serviceProviders = new ArrayList<ServiceProvider>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Name field of the service.
|
||||
*
|
||||
* @return String of the name.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Rate field of the service.
|
||||
*
|
||||
* @return double of the rate.
|
||||
*/
|
||||
public double getRate() {
|
||||
return rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the name field of the object to parameter given.
|
||||
*
|
||||
* @param name String object of new name
|
||||
*/
|
||||
public void setName(String 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) {
|
||||
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){
|
||||
for (ServiceProvider listUser : serviceProviders){
|
||||
if (user.getUsername().equals(listUser.getUsername())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
serviceProviders.add(user);
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<ServiceProvider> getServiceProviders(){
|
||||
return serviceProviders;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,207 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
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 {
|
||||
|
||||
//Field for list of services that service provider offers.
|
||||
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;
|
||||
|
||||
private String address;
|
||||
private String phonenumber;
|
||||
private String companyname;
|
||||
private boolean licensed;
|
||||
private String description;
|
||||
private int rating;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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){
|
||||
this(username, password, firstname, lastname, address, phonenumber, companyname, licensed, "");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param username
|
||||
* @param password
|
||||
* @param firstname
|
||||
* @param lastname
|
||||
* @param address
|
||||
* @param phonenumber
|
||||
* @param companyname
|
||||
* @param licensed
|
||||
* @param description
|
||||
*/
|
||||
ServiceProvider(String username, String password, String firstname, String lastname, String address,
|
||||
String phonenumber, String companyname, boolean licensed, String description){
|
||||
super(username, password, firstname, lastname);
|
||||
services = new ArrayList<>();
|
||||
availabilities = new int[7][4];
|
||||
this.address = address;
|
||||
this.phonenumber = phonenumber;
|
||||
this.companyname = companyname;
|
||||
this.licensed = licensed;
|
||||
this.description = description;
|
||||
this.rating = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param username
|
||||
* @param hash
|
||||
* @param salt
|
||||
* @param firstname
|
||||
* @param lastname
|
||||
* @param address
|
||||
* @param phonenumber
|
||||
* @param companyname
|
||||
* @param licensed
|
||||
* @param description
|
||||
*/
|
||||
ServiceProvider(String username, String hash, String salt, String firstname, String lastname, String address,
|
||||
String phonenumber, String companyname, boolean licensed, String description){
|
||||
super(username, hash, salt, firstname, lastname);
|
||||
services = new ArrayList<>();
|
||||
availabilities = new int[7][4];
|
||||
this.address = address;
|
||||
this.phonenumber = phonenumber;
|
||||
this.companyname = companyname;
|
||||
this.licensed = licensed;
|
||||
this.description = description;
|
||||
this.rating = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gets the role of the UserType.
|
||||
*
|
||||
* @return String "Service Provider"
|
||||
*/
|
||||
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){
|
||||
for (Service listService : services){
|
||||
if (service.getName().equals(listService.getName())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
services.add(service);
|
||||
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(){
|
||||
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;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public int getRating() {
|
||||
return rating;
|
||||
}
|
||||
|
||||
public void setRating(int rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,241 @@
|
|||
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 android.widget.Toast;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
*
|
||||
* This class is the java class for the Service Provider's Availabilities menu. This class generates the menu from
|
||||
* the saved Availabilities that the user has set previously or on default set no Availabilities.
|
||||
* The menu gives the option to change availabilities for each day of the week or remove his availability on that
|
||||
* day. User will receive a toast if they set impossible availabilities or they will receive a toast saying
|
||||
* that their availabilities have been saved.
|
||||
*
|
||||
*/
|
||||
|
||||
public class ServiceProviderAvailabilities extends AppCompatActivity {
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* This class generates the availabilities from the serviceProvider class fields
|
||||
* on creation of this menu so the user can edit and change it on the menu.
|
||||
*
|
||||
* @param savedInstanceState
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_service_provider_availabilities);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
username = bundle.getString("username");
|
||||
DBHelper dbHelper = new DBHelper(this);
|
||||
ServiceProvider user = (ServiceProvider) dbHelper.findUserByUsername(username);
|
||||
int[][] days = user.getAvailabilities();
|
||||
String startTime;
|
||||
String endTime;
|
||||
int i = 0;
|
||||
for(int[] times: days){
|
||||
startTime = formatTime(times[0],times[1]);
|
||||
endTime = formatTime(times[2],times[3]);
|
||||
if(times[0]==0&×[1]==0&×[2]==0&×[3]==0){
|
||||
startTime = "START";
|
||||
endTime = "END";
|
||||
}
|
||||
if(i==0){
|
||||
((Button)findViewById(R.id.MondayStart)).setText(startTime);
|
||||
((Button)findViewById(R.id.MondayEnd)).setText(endTime);
|
||||
}else if(i==1){
|
||||
((Button)findViewById(R.id.TuesdayStart)).setText(startTime);
|
||||
((Button)findViewById(R.id.TuesdayEnd)).setText(endTime);
|
||||
}else if(i==2){
|
||||
((Button)findViewById(R.id.WednesdayStart)).setText(startTime);
|
||||
((Button)findViewById(R.id.WednesdayEnd)).setText(endTime);
|
||||
}else if(i==3){
|
||||
((Button)findViewById(R.id.ThursdayStart)).setText(startTime);
|
||||
((Button)findViewById(R.id.ThursdayEnd)).setText(endTime);
|
||||
}else if(i==4){
|
||||
((Button)findViewById(R.id.FridayStart)).setText(startTime);
|
||||
((Button)findViewById(R.id.FridayEnd)).setText(endTime);
|
||||
}else if(i==5){
|
||||
((Button)findViewById(R.id.SaturdayStart)).setText(startTime);
|
||||
((Button)findViewById(R.id.SaturdayEnd)).setText(endTime);
|
||||
}else if(i==6){
|
||||
((Button)findViewById(R.id.SundayStart)).setText(startTime);
|
||||
((Button)findViewById(R.id.SundayEnd)).setText(endTime);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
String time = "";
|
||||
|
||||
button.setText(formatTime(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
|
||||
Button start;
|
||||
Button end;
|
||||
if(view.getId()==R.id.DeleteMon){
|
||||
start = findViewById(R.id.MondayStart);
|
||||
end = findViewById(R.id.MondayEnd);
|
||||
start.setText("START");
|
||||
end.setText("END");
|
||||
}else if(view.getId()==R.id.DeleteTuesday){
|
||||
start = findViewById(R.id.TuesdayStart);
|
||||
end = findViewById(R.id.TuesdayEnd);
|
||||
start.setText("START");
|
||||
end.setText("END");
|
||||
}else if(view.getId()==R.id.DeleteWednesday){
|
||||
start = findViewById(R.id.WednesdayStart);
|
||||
end = findViewById(R.id.WednesdayEnd);
|
||||
start.setText("START");
|
||||
end.setText("END");
|
||||
}else if(view.getId()==R.id.DeleteThursday){
|
||||
start = findViewById(R.id.ThursdayStart);
|
||||
end = findViewById(R.id.ThursdayEnd);
|
||||
start.setText("START");
|
||||
end.setText("END");
|
||||
}else if(view.getId()==R.id.DeleteFriday){
|
||||
start = findViewById(R.id.FridayStart);
|
||||
end = findViewById(R.id.FridayEnd);
|
||||
start.setText("START");
|
||||
end.setText("END");
|
||||
}else if(view.getId()==R.id.DeleteSaturday){
|
||||
start = findViewById(R.id.SaturdayStart);
|
||||
end = findViewById(R.id.SaturdayEnd);
|
||||
start.setText("START");
|
||||
end.setText("END");
|
||||
}else{
|
||||
start = findViewById(R.id.SundayStart);
|
||||
end = findViewById(R.id.SundayEnd);
|
||||
start.setText("START");
|
||||
end.setText("END");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the views of the UI to generate 2D int array and updates the database and user with
|
||||
* the new 2D on click of the setTime button.
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
public void onSetTimes(View view){
|
||||
int[] mondayTime = parseTime( ((Button)findViewById(R.id.MondayStart)).getText().toString(),((Button)findViewById(R.id.MondayEnd)).getText().toString() );
|
||||
int[] tuesdayTime = parseTime( ((Button)findViewById(R.id.TuesdayStart)).getText().toString(),((Button)findViewById(R.id.TuesdayEnd)).getText().toString() );
|
||||
int[] wednesdayTime = parseTime( ((Button)findViewById(R.id.WednesdayStart)).getText().toString(),((Button)findViewById(R.id.WednesdayEnd)).getText().toString() );
|
||||
int[] thursdayTime = parseTime( ((Button)findViewById(R.id.ThursdayStart)).getText().toString(),((Button)findViewById(R.id.ThursdayEnd)).getText().toString() );
|
||||
int[] fridayTime = parseTime( ((Button)findViewById(R.id.FridayStart)).getText().toString(), ((Button)findViewById(R.id.FridayEnd)).getText().toString() );
|
||||
int[] saturdayTime = parseTime( ((Button)findViewById(R.id.SaturdayStart)).getText().toString(),((Button)findViewById(R.id.SaturdayEnd)).getText().toString() );
|
||||
int[] sundayTime = parseTime( ((Button)findViewById(R.id.SundayStart)).getText().toString(),((Button)findViewById(R.id.SundayEnd)).getText().toString() );
|
||||
int[][] availabilities = {mondayTime,tuesdayTime,wednesdayTime,thursdayTime,fridayTime,saturdayTime,sundayTime};
|
||||
boolean validation = true;
|
||||
for(int[] times: availabilities){
|
||||
if(!validateTime(times)){
|
||||
validation = false;
|
||||
}
|
||||
}
|
||||
if(validation){
|
||||
DBHelper dbHelper = new DBHelper(this);
|
||||
ServiceProvider user = (ServiceProvider) dbHelper.findUserByUsername(username);
|
||||
user.setAvailabilities(availabilities);
|
||||
dbHelper.updateAvailability(user);
|
||||
Toast.makeText(this, "New Availabilities have been set.", Toast.LENGTH_LONG).show();
|
||||
} else{
|
||||
Toast.makeText(this, "All end times must be later then start times.", Toast.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();
|
||||
}
|
||||
|
||||
private String formatTime(int hours, int minutes){
|
||||
String time = "";
|
||||
if(hours<10){
|
||||
time = time+"0"+hours+":";
|
||||
}else{
|
||||
time = time+hours+":";
|
||||
}
|
||||
if (minutes<10){
|
||||
time = time+"0"+minutes;
|
||||
}
|
||||
else {
|
||||
time = time+minutes;
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
private int[] parseTime(String startTime, String endTime){
|
||||
int[] times = new int[4];
|
||||
if(startTime.equals("START")){
|
||||
times[0]=0;
|
||||
times[1]=0;
|
||||
}else{
|
||||
times[0] = Integer.parseInt(startTime.substring(0,2));
|
||||
times[1] = Integer.parseInt(startTime.substring(3));
|
||||
}
|
||||
if(endTime.equals("END")){
|
||||
times[2]=0;
|
||||
times[3]=0;
|
||||
}else{
|
||||
times[2] = Integer.parseInt(endTime.substring(0,2));
|
||||
times[3] = Integer.parseInt(endTime.substring(3));
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
private boolean validateTime(int[] time){
|
||||
if(time[0]==0&&time[1]==0&&time[2]==0&&time[3]==0){
|
||||
return true;
|
||||
}
|
||||
if(time[2]>time[0]){
|
||||
return true;
|
||||
}else{
|
||||
if(time[2]==time[0]&&time[3]>time[1]){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
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 ServiceProviderEditProfile extends AppCompatActivity {
|
||||
String username;
|
||||
DBHelper dbHelper;
|
||||
|
||||
/**
|
||||
* Prepoplates the fields with user information when the activity is created
|
||||
* @param savedInstanceState
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_service_provider_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);
|
||||
TextView description = findViewById(R.id.DescriptionInput);
|
||||
CheckBox licensed = findViewById(R.id.LicensedInput);
|
||||
|
||||
|
||||
firstname.setText(user.getFirstname());
|
||||
lastname.setText(user.getLastname());
|
||||
password.setText("");
|
||||
companyname.setText(user.getCompanyname());
|
||||
address.setText(user.getAddress());
|
||||
phonenumber.setText(user.getPhonenumber());
|
||||
description.setText(user.getDescription());
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves updated user information to the database
|
||||
* @param view
|
||||
*/
|
||||
public void Save(View view){
|
||||
TextView firstname = findViewById(R.id.FirstNameInput);
|
||||
TextView lastname = findViewById(R.id.LastNameInput);
|
||||
TextView password = findViewById(R.id.PasswordInput);
|
||||
TextView companyname = findViewById(R.id.CompanyNameInput);
|
||||
TextView address = findViewById(R.id.AddressInput);
|
||||
TextView phonenumber = findViewById(R.id.PhoneNumberInput);
|
||||
TextView description = findViewById(R.id.DescriptionInput);
|
||||
CheckBox licensed = findViewById(R.id.LicensedInput);
|
||||
|
||||
//Checks for the fields
|
||||
if((password.getText().toString().length()>=5 || password.getText().toString().equals(""))
|
||||
&& 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_ ]*$")
|
||||
&& description.getText().toString().matches("^[a-zA-Z0-9_ ]*$")
|
||||
&& phonenumber.getText().toString().matches("^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}$")
|
||||
&& address.getText().toString().replaceAll("\\s+","").length()>0) {
|
||||
|
||||
|
||||
if(dbHelper.updateUserInfo(username, password.getText().toString(), firstname.getText().toString(), lastname.getText().toString(),
|
||||
address.getText().toString(), phonenumber.getText().toString(), companyname.getText().toString(), licensed.isChecked(), description.getText().toString())){
|
||||
//add comment method here
|
||||
Toast.makeText(this, "Profile has been updated", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Could not update profile ", Toast.LENGTH_LONG).show();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Fields cannot be empty (other than description) and must be formatted correctly", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,232 @@
|
|||
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.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 fills out 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];
|
||||
}
|
||||
spinner.setItems(services);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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.service_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;
|
||||
}
|
||||
|
||||
//nested class for the items in the recycler view
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Onclick function for the items in the recycler view
|
||||
* @param view
|
||||
*/
|
||||
@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,89 @@
|
|||
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(),ServiceProviderEditProfile.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();
|
||||
}
|
||||
public void SeeBookings(View view){
|
||||
Intent intent = new Intent(getApplicationContext(),Bookings.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -4,22 +4,123 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.os.Bundle;
|
||||
import com.jaredrummler.materialspinner.MaterialSpinner;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.content.Intent;
|
||||
import android.widget.EditText;
|
||||
import android.view.View;
|
||||
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 {
|
||||
|
||||
/**
|
||||
* 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
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sign_up);
|
||||
MaterialSpinner spinner = findViewById(R.id.RoleInput);
|
||||
spinner.setItems("Ice Cream Sandwich", "Jelly Bean", "KitKat", "Lollipop", "Marshmallow");
|
||||
spinner.setItems("Home Owner", "Service Provider");
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
public static void main(String[] args){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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){
|
||||
UserType newUser;
|
||||
String username = ((EditText) findViewById(R.id.UsernameInput)).getText().toString();
|
||||
String password = ((EditText) findViewById(R.id.PasswordInput)).getText().toString();
|
||||
String firstname = ((EditText) findViewById(R.id.FirstNameInput)).getText().toString();
|
||||
String lastname = ((EditText) findViewById(R.id.LastNameInput)).getText().toString();
|
||||
MaterialSpinner spinner = findViewById(R.id.RoleInput);
|
||||
|
||||
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]*")){
|
||||
DBHelper dbHelper = new DBHelper(this);
|
||||
Intent intent = new Intent(getApplicationContext(),LogIn.class);
|
||||
switch(spinner.getText().toString()){
|
||||
case "Home Owner":
|
||||
newUser = new HomeOwner(username,password,firstname,lastname);
|
||||
if(dbHelper.addUser(newUser)){
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(this,"Username is taken",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
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){
|
||||
Toast.makeText(this, "Fields cannot be empty", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else if (username.length()<5 || password.length()<5 ){
|
||||
Toast.makeText(this, "Password and username must be longer than 4 characters", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else{
|
||||
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
|
||||
public void onBackPressed(){
|
||||
Intent intent = new Intent(getApplicationContext(), Main.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
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();
|
||||
String description = ((EditText) findViewById(R.id.DescriptionInput)).getText().toString();
|
||||
|
||||
if(companyname.length()>0 && address.length()>0 && phonenumber.length()>0
|
||||
&& companyname.matches("^[a-zA-Z0-9_ ]*$") && address.matches("^[a-zA-Z0-9_ ]*$")
|
||||
&& phonenumber.matches("^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}$")
|
||||
&& description.matches("^[a-zA-Z0-9_ ]*$")
|
||||
&& companyname.replaceAll("\\s+","").length()>0
|
||||
&& address.replaceAll("\\s+","").length()>0) {
|
||||
|
||||
ServiceProvider serviceProvider = new ServiceProvider(username, password, firstname, lastname,
|
||||
address, phonenumber, companyname, licensed, description);
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
|
||||
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 {
|
||||
|
||||
//field for the username attached to the userType.
|
||||
String username;
|
||||
//field for the password hash attached to the userType.
|
||||
String hash;
|
||||
//field for the firstname attached to the userType.
|
||||
String firstname;
|
||||
//field for the lastname attached to the userType.
|
||||
String lastname;
|
||||
//field for the salt attached to the userType.
|
||||
String salt;
|
||||
|
||||
|
||||
/**
|
||||
* 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){
|
||||
this.username = username;
|
||||
this.firstname = firstname;
|
||||
this.lastname = lastname;
|
||||
|
||||
this.salt = PasswordEncryption.generateSalt();
|
||||
this.hash = PasswordEncryption.encrypt(password, salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 hash String object containing the password hash.
|
||||
* @param firstname String object containing the firstname.
|
||||
* @param lastname String object containing the lastname.
|
||||
* @param salt String object containing the salt.
|
||||
*/
|
||||
UserType(String username, String hash, String salt, String firstname, String lastname){
|
||||
this.username = username;
|
||||
this.firstname = firstname;
|
||||
this.lastname = lastname;
|
||||
|
||||
this.salt = salt;
|
||||
this.hash = hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Gets the username field of userType.
|
||||
*
|
||||
* @return String of the username.
|
||||
*/
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hash field of userType.
|
||||
*
|
||||
* @return String of the hash.
|
||||
*/
|
||||
public String getHash() {
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the firstname field of userType.
|
||||
*
|
||||
* @return String of firstname
|
||||
*/
|
||||
public String getFirstname() {
|
||||
return firstname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lastname field of userType.
|
||||
*
|
||||
* @return String of lastname
|
||||
*/
|
||||
public String getLastname() {
|
||||
return lastname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the salt field of userType.
|
||||
*
|
||||
* @return String of salt
|
||||
*/
|
||||
public String getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the username field with given parameters.
|
||||
*
|
||||
* @param username String for new username.
|
||||
*/
|
||||
public void setUsername(String username) {
|
||||
//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
|
||||
//so cannot be initialized in this class
|
||||
this.username = username;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the password field with given parameters.
|
||||
*
|
||||
* @param password String of new password.
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
//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
|
||||
//so cannot be initialized in this class
|
||||
this.salt = PasswordEncryption.generateSalt();
|
||||
this.hash = PasswordEncryption.encrypt(password, salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the firstname field with given parameters.
|
||||
*
|
||||
* @param firstname String of new firstname.
|
||||
*/
|
||||
public void setFirstname(String firstname) {
|
||||
//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
|
||||
//so cannot be initialized in this class
|
||||
this.firstname = firstname;
|
||||
}
|
||||
|
||||
public void setLastname(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
|
||||
//so cannot be initialized in this class
|
||||
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){
|
||||
if(this.username.equals(other.username)&&this.hash.equals(other.hash)&&
|
||||
this.firstname.equals(other.firstname)&&this.lastname.equals(other.lastname)
|
||||
&&this.salt.equals(other.salt)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
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.GridView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Iterator;
|
||||
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 {
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
//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 DBHelper dbHelper;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_users_list);
|
||||
|
||||
dbHelper = new DBHelper(this);
|
||||
List<String[]> users = dbHelper.getAllUsers();
|
||||
String[] usernames = new String[(users.size())];
|
||||
Iterator iter = users.iterator();
|
||||
for (int i=0; i<users.size();i++){
|
||||
String[] current = (String[])iter.next();
|
||||
usernames[(i)] = current[0];
|
||||
}
|
||||
|
||||
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.Users);
|
||||
|
||||
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
|
||||
mAdapter = new UsersList.MyAdapter(usernames, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
|
||||
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.UsersHolder> {
|
||||
|
||||
private String[] users;
|
||||
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(String[] users, Context context) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
// Create new views (invoked by the layout manager)
|
||||
@NonNull
|
||||
@Override
|
||||
public UsersHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.user_list_item, parent, false);
|
||||
return new UsersHolder(v);
|
||||
}
|
||||
|
||||
// Replace the contents of a view (invoked by the layout manager)
|
||||
@Override
|
||||
public void onBindViewHolder(UsersHolder holder, int position) {
|
||||
UserType user = dbHelper.findUserByUsername(users[position]);
|
||||
holder.name.setText(user.getUsername());
|
||||
holder.rate.setText(user.getRole());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Return the size of your dataset (invoked by the layout manager)
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return users.length;
|
||||
}
|
||||
|
||||
class UsersHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
TextView name;
|
||||
TextView rate;
|
||||
|
||||
public UsersHolder(View row){
|
||||
super(row);
|
||||
name = row.findViewById(R.id.Name);
|
||||
rate = row.findViewById(R.id.Role);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,12 +2,82 @@ 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 Welcome 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_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 Home Owner");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 SeeBookings(View view){
|
||||
Intent intent = new Intent(getApplicationContext(),Bookings.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
public void FindServiceProvider(View view){
|
||||
Intent intent = new Intent(getApplicationContext(),FindServiceProvider.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
public void EditProfile(View view){
|
||||
Intent intent = new Intent(getApplicationContext(),HomeOwnerEditProfile.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<!--Border width and color-->
|
||||
<stroke android:width="2px" android:color="#000000" />
|
||||
</shape>
|
BIN
OlympusServices/app/src/main/res/drawable/logo.JPG
Normal file
After Width: | Height: | Size: 18 KiB |
|
@ -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>
|
|
@ -0,0 +1,54 @@
|
|||
<?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=".AdminWelcome">
|
||||
<TextView
|
||||
android:id="@+id/Welcome"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:gravity="center"
|
||||
android:text="Welcome Admin"
|
||||
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/Users"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:onClick="goToUsers"
|
||||
android:text="List of Users"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
<Button
|
||||
android:id="@+id/Services"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:onClick="goToServices"
|
||||
android:text="List of Services"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
<Button
|
||||
android:id="@+id/LogOut"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:onClick="LogOut"
|
||||
android:text="Logout"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
</LinearLayout>
|
|
@ -0,0 +1,31 @@
|
|||
<?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=".Bookings">
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Show cancelled bookings"
|
||||
android:id="@+id/Switch"
|
||||
android:checked="true"
|
||||
android:theme="@style/Switch"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:textColor="@color/colorWhite"/>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/Bookings"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="450dp"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,197 @@
|
|||
<?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=".FindServiceProvider">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="5dp">
|
||||
<TextView
|
||||
android:id="@+id/ServicePick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="By Service:"
|
||||
android:paddingRight="5dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="15sp" />
|
||||
<com.jaredrummler.materialspinner.MaterialSpinner
|
||||
android:id="@+id/ServicesInput"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="5dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="start"
|
||||
android:layout_gravity="start"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/DatePick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="start"
|
||||
android:layout_gravity="start"
|
||||
android:text="By Time:"
|
||||
android:textAlignment="textStart"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="15sp"/>
|
||||
<Button
|
||||
android:id="@+id/Start"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Start"
|
||||
android:textSize="11sp"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickTime"/>
|
||||
<Button
|
||||
android:id="@+id/End"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="End"
|
||||
android:textSize="11sp"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickTime"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/Date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Date"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickDate"
|
||||
android:layout_gravity="end"
|
||||
android:textSize="11sp"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="start"
|
||||
android:layout_gravity="start">
|
||||
<TextView
|
||||
android:id="@+id/RatingPick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="start"
|
||||
android:layout_gravity="start"
|
||||
android:text="By Rating:"
|
||||
android:textAlignment="textStart"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/RatingSelect"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:buttonTint="@color/colorWhite"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="2"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:buttonTint="@color/colorWhite"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="3"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:buttonTint="@color/colorWhite"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:buttonTint="@color/colorWhite"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="5"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:buttonTint="@color/colorWhite"/>
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
<Button
|
||||
android:id="@+id/Reset"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="45dp"
|
||||
android:text="Reset"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="Reset"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/Search"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="45dp"
|
||||
android:text="Search"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="Search"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/ServiceProviders"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:layout_marginTop="15dp"/>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,71 @@
|
|||
<?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=".HomeOwnerEditProfile">
|
||||
|
||||
//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"
|
||||
android:layout_marginTop="20dp"/>
|
||||
|
||||
//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/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/Save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Save"
|
||||
android:onClick="Save"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -12,5 +12,72 @@
|
|||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/background"
|
||||
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
|
||||
android:id="@+id/Title"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:paddingTop="20dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/login"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="36sp"
|
||||
app:fontFamily="@font/julius_sans_one" />
|
||||
|
||||
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||
<com.rengwuxian.materialedittext.MaterialEditText
|
||||
android:id="@+id/UsernameInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="@color/colorWhite"
|
||||
android:textSize="15sp"
|
||||
android:hint="@string/username"
|
||||
android:layout_marginTop="40dp"
|
||||
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/PasswordInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="@drawable/customborder"
|
||||
android:textSize="15sp"
|
||||
android:hint="@string/password"
|
||||
android:layout_marginTop="20dp"
|
||||
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/LogIn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:onClick="onClickLogIn"
|
||||
android:text="@string/login"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -17,27 +17,34 @@
|
|||
android:id="@+id/Title"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:layout_marginBottom="70dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/CompanyName"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="36sp"
|
||||
app:fontFamily="@font/julius_sans_one" />
|
||||
app:fontFamily="@font/julius_sans_one"
|
||||
android:layout_marginTop="30dp"/>
|
||||
|
||||
<Button
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:id="@+id/SignUp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:text="@string/signup" />
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:onClick="onClickSignUp"
|
||||
android:text="@string/signup"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"/>
|
||||
|
||||
<Button
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:id="@+id/LogIn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/login" />
|
||||
android:layout_height="70dp"
|
||||
android:onClick="onClickLogIn"
|
||||
android:text="@string/login"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,127 @@
|
|||
<?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=".MakeBooking">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="10dp">
|
||||
<TextView
|
||||
android:background="@color/colorWhite"
|
||||
android:id="@+id/HomeOwner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Home Owner:"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_gravity="start"/>
|
||||
<TextView
|
||||
android:background="@color/colorWhite"
|
||||
android:id="@+id/ServiceProvider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Service Provider:"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_gravity="start"/>
|
||||
<TextView
|
||||
android:background="@color/colorWhite"
|
||||
android:id="@+id/Service"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Service:"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_gravity="start"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="10dp">
|
||||
<Button
|
||||
android:id="@+id/Start"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Start"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickTime"
|
||||
android:layout_marginRight="5dp"/>
|
||||
<Button
|
||||
android:id="@+id/End"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="End"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickTime"
|
||||
android:layout_marginRight="5dp"/>
|
||||
<Button
|
||||
android:id="@+id/Date"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Date"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickDate"
|
||||
android:layout_gravity="end"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="30dp">
|
||||
<Button
|
||||
android:id="@+id/Book"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="55dp"
|
||||
android:text="Book"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="Book"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"/>
|
||||
<Button
|
||||
android:id="@+id/Cancel"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="55dp"
|
||||
android:text="Cancel"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="Cancel"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,369 @@
|
|||
<?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="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="8dp"
|
||||
android:background="@drawable/background"
|
||||
tools:context=".ServiceProviderAvailabilities">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="435dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp">
|
||||
|
||||
<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>
|
||||
</ScrollView>
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onSetTimes"
|
||||
android:text="Save"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:layout_marginTop="5dp"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,148 @@
|
|||
<?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=".ServiceProviderEditProfile">
|
||||
<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/DescriptionInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="@drawable/customborder"
|
||||
android:hint="General Description"
|
||||
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/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/Save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Save"
|
||||
android:onClick="Save"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</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,70 @@
|
|||
<?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:onClick="SeeBookings"
|
||||
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>
|
|
@ -12,82 +12,95 @@
|
|||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/background"
|
||||
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="50dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/signup"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="36sp"
|
||||
app:fontFamily="@font/julius_sans_one" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:text="Role" />
|
||||
android:text="Role"
|
||||
android:textColor="#6d81a5"
|
||||
android:textSize="15sp" />
|
||||
|
||||
// component used from https://github.com/jaredrummler/MaterialSpinner
|
||||
<com.jaredrummler.materialspinner.MaterialSpinner
|
||||
android:id="@+id/RoleInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="15dp" />
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginBottom="10dp" />
|
||||
|
||||
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||
<com.rengwuxian.materialedittext.MaterialEditText
|
||||
android:id="@+id/UsernameInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Username"
|
||||
android:textSize="20sp"
|
||||
app:met_baseColor="@android:color/white"
|
||||
android:layout_height="80dp"
|
||||
android:background="@color/colorWhite"
|
||||
android:hint="Username"
|
||||
android:textSize="15sp"
|
||||
app:met_baseColor="@android:color/white"
|
||||
app:met_floatingLabel="highlight"
|
||||
app:met_primaryColor="?colorAccent"
|
||||
app:met_singleLineEllipsis="true"/>
|
||||
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/PasswordInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:background="@drawable/customborder"
|
||||
android:hint="Password"
|
||||
android:textSize="20sp"
|
||||
android:textSize="15sp"
|
||||
app:met_baseColor="@android:color/white"
|
||||
app:met_floatingLabel="highlight"
|
||||
app:met_primaryColor="?colorAccent"
|
||||
app:met_primaryColor="@color/colorWhite"
|
||||
app:met_singleLineEllipsis="true"
|
||||
android:background="@drawable/customborder"/>
|
||||
android:inputType="textPassword"
|
||||
android:textCursorDrawable="@color/colorWhite"/>
|
||||
|
||||
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||
<com.rengwuxian.materialedittext.MaterialEditText
|
||||
android:id="@+id/FirstNameInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:background="@drawable/customborder"
|
||||
android:hint="First Name"
|
||||
android:textSize="20sp"
|
||||
android:textSize="15sp"
|
||||
app:met_baseColor="@android:color/white"
|
||||
app:met_floatingLabel="highlight"
|
||||
app:met_primaryColor="?colorAccent"
|
||||
app:met_primaryColor="@color/colorWhite"
|
||||
app:met_singleLineEllipsis="true"
|
||||
android:background="@drawable/customborder"/>
|
||||
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="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:background="@drawable/customborder"
|
||||
android:hint="Last Name"
|
||||
android:textSize="20sp"
|
||||
android:textSize="15sp"
|
||||
app:met_baseColor="@android:color/white"
|
||||
app:met_floatingLabel="highlight"
|
||||
app:met_primaryColor="?colorAccent"
|
||||
app:met_primaryColor="@color/colorWhite"
|
||||
app:met_singleLineEllipsis="true"
|
||||
android:background="@drawable/customborder"/>
|
||||
|
||||
|
||||
|
||||
android:textCursorDrawable="@color/colorWhite"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/SignUp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickSignUp"
|
||||
android:text="@string/signup"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,108 @@
|
|||
<?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"/>
|
||||
|
||||
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||
<com.rengwuxian.materialedittext.MaterialEditText
|
||||
android:id="@+id/DescriptionInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="@drawable/customborder"
|
||||
android:hint="General Description"
|
||||
android:text=""
|
||||
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"/>
|
||||
|
||||
<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>
|
|
@ -0,0 +1,68 @@
|
|||
<?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=".UsersList">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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:paddingLeft="10dp"/>
|
||||
|
||||
<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="end"
|
||||
android:paddingRight="10dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/Users"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -13,4 +13,49 @@
|
|||
android:background="@drawable/background"
|
||||
tools:context=".Welcome">
|
||||
|
||||
<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:text="Profile"
|
||||
android:onClick="EditProfile"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
<Button
|
||||
android:id="@+id/Find"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="Find a Service Provider"
|
||||
android:onClick="FindServiceProvider"
|
||||
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:onClick="SeeBookings"
|
||||
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>
|
210
OlympusServices/app/src/main/res/layout/booking_list_item.xml
Normal file
|
@ -0,0 +1,210 @@
|
|||
<?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:background="@color/colorWhite"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="10dp"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/customborder2"
|
||||
android:paddingBottom="10dp">
|
||||
<TextView
|
||||
android:id="@+id/ServiceProvider"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Service Provider:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/ServiceProviderName"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Service Provider"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/customborder2"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/HomeOwner"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Home Owner:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/HomeOwnerName"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Home Owner"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/customborder2"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Service"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Service:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/ServiceName"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Service"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/customborder2"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Date"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Date and Time:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/DateName"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Date"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/StartTime"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text=""
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/Timespace"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="to"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/EndTime"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text=""
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/customborder2"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Status"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Status:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/StatusName"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Status"
|
||||
android:textColor="@color/colorBlack"
|
||||
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>
|
|
@ -0,0 +1,28 @@
|
|||
<?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">
|
||||
|
||||
|
||||
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||
<com.rengwuxian.materialedittext.MaterialEditText
|
||||
android:id="@+id/RateInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:hint="@string/servicerate"
|
||||
android:inputType="numberDecimal"
|
||||
android:textCursorDrawable="@color/colorWhite"
|
||||
android:textSize="15sp"
|
||||
android:text=""
|
||||
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"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,44 @@
|
|||
<?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">
|
||||
|
||||
//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"
|
||||
android:text=""
|
||||
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
|
||||
<com.rengwuxian.materialedittext.MaterialEditText
|
||||
android:id="@+id/RateInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:hint="@string/servicerate"
|
||||
android:text=""
|
||||
android:inputType="numberDecimal"
|
||||
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"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,61 @@
|
|||
<?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:orientation="vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_marginBottom="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Rating"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Rating:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
android:paddingRight="10dp"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/RatingName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Comment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Comment: "
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
android:paddingRight="10dp"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/CommentName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
91
OlympusServices/app/src/main/res/layout/rating_item.xml
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?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="match_parent"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="10dp">
|
||||
<TextView
|
||||
android:id="@+id/RatingPick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="start"
|
||||
android:layout_gravity="start"
|
||||
android:text="Rating:"
|
||||
android:textAlignment="textStart"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/RatingSelect"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:buttonTint="@color/colorBlack"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="2"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:buttonTint="@color/colorBlack"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="3"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:buttonTint="@color/colorBlack"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:buttonTint="@color/colorBlack"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="5"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:buttonTint="@color/colorBlack"/>
|
||||
|
||||
</RadioGroup>
|
||||
</LinearLayout>
|
||||
|
||||
//component used from https://github.com/rengwuxian/MaterialEditText
|
||||
<com.rengwuxian.materialedittext.MaterialEditText
|
||||
android:id="@+id/Comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="@color/colorWhite"
|
||||
android:textSize="15sp"
|
||||
android:hint="Comment"
|
||||
android:text=""
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textCursorDrawable="@color/colorWhite"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,48 @@
|
|||
<?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"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Username"
|
||||
android:text=""
|
||||
android:layout_height="0dp"
|
||||
android:layout_width="0dp"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="0sp"
|
||||
android:gravity="end"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
|
||||
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
||||
android:paddingBottom="5dp"
|
||||
android:textColor="@android:color/black"
|
||||
android:background="@color/colorWhite"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:textSize="15sp"
|
||||
|
||||
|
||||
>
|
||||
|
||||
</TextView>
|
212
OlympusServices/app/src/main/res/layout/sp_info_item.xml
Normal file
|
@ -0,0 +1,212 @@
|
|||
<?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="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="400dp"
|
||||
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/Name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Service Provider:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
android:paddingRight="10dp"/>
|
||||
<TextView
|
||||
android:id="@+id/NameName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="FirstName"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="10dp">
|
||||
<TextView
|
||||
android:id="@+id/Company"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Company:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
android:paddingRight="10dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/CompanyName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Company"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Address"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Address:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
android:paddingRight="10dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/AddressName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Address"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/PhoneNumber"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Phone Number:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
android:paddingRight="10dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/PhoneNumberName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="PhoneNumber"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="10dp">
|
||||
<TextView
|
||||
android:id="@+id/Licensed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Licensed:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
android:paddingRight="10dp"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/LicensedName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Licensed"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Description:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
android:paddingRight="10dp"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DescriptionName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Description"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/AverageRating"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Average Rating:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
android:paddingRight="10dp"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/AverageRatingName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Rating"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/RatingList"
|
||||
android:paddingTop="5dp"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="200dp"
|
||||
android:background="@drawable/customborder2"/>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
36
OlympusServices/app/src/main/res/layout/user_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/Role"
|
||||
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>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 6 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9 KiB After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
@ -2,7 +2,7 @@
|
|||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="colorAccent">#303F9F</color>
|
||||
<color name="colorWhite">#FFFFFF</color>
|
||||
<color name="colorBlack">#000000</color>
|
||||
</resources>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FFFFFF</color>
|
||||
</resources>
|
|
@ -19,6 +19,16 @@
|
|||
<string name="login">Log In</string>
|
||||
<string name="newusername">Enter Username</string>
|
||||
<string name="newpassword">Enter Password</string>
|
||||
<string name="password">Password</string>
|
||||
<string name="username">Username</string>
|
||||
<string name="servicename">Service Name</string>
|
||||
<string name="servicerate">Service Rate</string>
|
||||
<string name="save">Save</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="update">Update</string>
|
||||
<string name="delete">Delete</string>
|
||||
<string name="remove">Remove</string>
|
||||
<string name="add">Add</string>
|
||||
<string-array name="roles">
|
||||
<item>Admin</item>
|
||||
<item>User</item>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorPrimaryDark">@color/colorWhite</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
|
@ -13,4 +13,11 @@
|
|||
<item name="android:textColor">@color/colorBlack</item>
|
||||
</style>
|
||||
|
||||
<style name="Switch" parent="Theme.AppCompat">
|
||||
<item name="colorControlNormal">@color/colorWhite</item>
|
||||
<item name="colorControlActivated">@color/colorWhite</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class AdminTest {
|
||||
|
||||
/**
|
||||
* Initiates an Admin account and tests if the strings match to the required inputs.
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testAdmin() {
|
||||
Admin admin = new Admin();
|
||||
String username = admin.getUsername();
|
||||
String firstname = admin.getFirstname();
|
||||
String lastname = admin.getLastname();
|
||||
String role = admin.getRole();
|
||||
assertEquals("Admin", role);
|
||||
assertEquals("admin", username);
|
||||
assertEquals(PasswordEncryption.encrypt("admin", admin.getSalt()), admin.getHash());
|
||||
assertEquals("Admin", firstname);
|
||||
assertEquals("Admin", lastname);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class BookingTest {
|
||||
HomeOwner user = new HomeOwner( "John123", "1234567890", "John", "Doe" );
|
||||
ServiceProvider serviceprovider = new ServiceProvider("Jane123", "1234567890", "Jane", "Doe", "testaddress", "8888888888", "companydotcom", true);
|
||||
Service service = new Service( "FrenchMaid", 250 );
|
||||
Booking book = new Booking(13, 30, 16, 0, 0, 0, 2019,
|
||||
serviceprovider, user, service);
|
||||
|
||||
/**
|
||||
* tests starth input and its functions.
|
||||
*/
|
||||
@Test
|
||||
public void testStarth() {
|
||||
assertEquals(13, book.getStarth());
|
||||
book.setStarth(10);
|
||||
assertNotEquals(13, book.getStarth());
|
||||
}
|
||||
|
||||
/**
|
||||
* tests startmin input and its functions.
|
||||
*/
|
||||
@Test
|
||||
public void testStartmin() {
|
||||
assertEquals(30, book.getStartmin());
|
||||
book.setStartmin(20);
|
||||
assertNotEquals(30, book.getStartmin());
|
||||
}
|
||||
|
||||
/**
|
||||
* tests Endh input and its functions.
|
||||
*/
|
||||
@Test
|
||||
public void testEndh() {
|
||||
assertEquals(16, book.getEndh());
|
||||
book.setEndh(14);
|
||||
assertNotEquals(16, book.getEndh());
|
||||
}
|
||||
|
||||
/**
|
||||
* tests Endmin input and its functions.
|
||||
*/
|
||||
@Test
|
||||
public void testEndmin() {
|
||||
assertEquals(0, book.getEndmin());
|
||||
book.setEndmin(20);
|
||||
assertNotEquals(0, book.getEndmin());
|
||||
}
|
||||
|
||||
/**
|
||||
* tests Day input and its functions.
|
||||
*/
|
||||
@Test
|
||||
public void testDay() {
|
||||
assertEquals(0, book.getDay());
|
||||
book.setDay(1);
|
||||
assertNotEquals(0, book.getDay());
|
||||
}
|
||||
|
||||
/**
|
||||
* tests Month input and its functions.
|
||||
*/
|
||||
@Test
|
||||
public void testMonth() {
|
||||
assertEquals(0, book.getMonth());
|
||||
book.setMonth(2);
|
||||
assertNotEquals(0, book.getMonth());
|
||||
}
|
||||
|
||||
/**
|
||||
* tests Year input and its functions.
|
||||
*/
|
||||
@Test
|
||||
public void testYear() {
|
||||
assertEquals(2019, book.getYear());
|
||||
book.setYear(2020);
|
||||
assertNotEquals(2019, book.getYear());
|
||||
}
|
||||
|
||||
/**
|
||||
* tests ServiceProvider in booking class and its functions.
|
||||
*/
|
||||
@Test
|
||||
public void testServiceprovider() {
|
||||
assertEquals(serviceprovider, book.getServiceprovider() );
|
||||
ServiceProvider serviceprovider2 = new ServiceProvider("Joshua123", "1234567890", "Joshua", "Doe", "testoaddress", "8888888888", "whateverdotcom", true);
|
||||
book.setServiceprovider(serviceprovider2);
|
||||
assertNotEquals(serviceprovider, book.getServiceprovider());
|
||||
}
|
||||
|
||||
/**
|
||||
* tests HomeOwner in booking class and its functions.
|
||||
*/
|
||||
@Test
|
||||
public void testHomeowner() {
|
||||
assertEquals(user, book.getHomeowner() );
|
||||
HomeOwner user2 = new HomeOwner( "Johnny123", "1234567890", "Johnny", "Dumas" );
|
||||
book.setHomeowner(user2);
|
||||
assertNotEquals(user, book.getHomeowner());
|
||||
}
|
||||
|
||||
/**
|
||||
* tests Service in booking class and its functions.
|
||||
*/
|
||||
@Test
|
||||
public void testService() {
|
||||
assertEquals(service, book.getService() );
|
||||
Service service2 = new Service( "ItalianMafia", 300 );
|
||||
book.setService(service2);
|
||||
assertNotEquals(service, book.getService());
|
||||
}
|
||||
|
||||
/**
|
||||
* tests Status and its functions by setting it up.
|
||||
*/
|
||||
@Test
|
||||
public void testStatus() {
|
||||
book.setStatus(Booking.Status.CONFIRMED);
|
||||
assertEquals(Booking.Status.CONFIRMED, book.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* tests Rating and its functions by setting it up.
|
||||
*/
|
||||
@Test
|
||||
public void testRating() {
|
||||
book.setRating(5);
|
||||
assertEquals(5, book.getRating());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,635 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
//import android.content.Context;
|
||||
//import android.database.DatabaseUtils;
|
||||
//import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.List;
|
||||
import com.uottawa.olympus.olympusservices.Booking.Status;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(packageName = "com.uottawa.olympus.olympusservices")
|
||||
public class DBIntegrationTest {
|
||||
|
||||
/**
|
||||
* Enum for setting up before a test
|
||||
*/
|
||||
private enum TestAfter{
|
||||
USER, SERVICE, LINK, AVAILABILITY, BOOKING, RATING;
|
||||
}
|
||||
|
||||
|
||||
private DBHelper dbHelper = new DBHelper(RuntimeEnvironment.application);
|
||||
|
||||
//testing user login table
|
||||
@Test
|
||||
public void testAdminExists(){
|
||||
//Admin is automatically created when DB starts up, if admin does not already exist.
|
||||
//so findUserByUsername("admin") should always return an Admin object
|
||||
UserType dbUser = dbHelper.findUserByUsername("admin");
|
||||
assertEquals("Admin", dbUser.getClass().getSimpleName());
|
||||
assertEquals("admin", dbUser.getUsername());
|
||||
assertEquals("Admin", dbUser.getFirstname());
|
||||
assertEquals("Admin", dbUser.getLastname());
|
||||
assertEquals(PasswordEncryption.encrypt("admin", dbUser.getSalt()), dbUser.getHash());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndDeleteUser(){
|
||||
UserType originalUser, dbUser;
|
||||
boolean deleted, addedOne, addedTwo;
|
||||
|
||||
//add a HomeOwner to database
|
||||
originalUser = new HomeOwner("mgarzon", "soccer", "Miguel", "Garzon");
|
||||
addedOne = dbHelper.addUser(originalUser);
|
||||
|
||||
//test retrieving HomeOwner, and confirm that user info is the same as that in object passed
|
||||
dbUser = dbHelper.findUserByUsername("mgarzon");
|
||||
assertEquals("HomeOwner", dbUser.getClass().getSimpleName());
|
||||
assertEquals("mgarzon", dbUser.getUsername());
|
||||
assertEquals(originalUser.getHash(), dbUser.getHash());
|
||||
assertEquals(originalUser.getSalt(), dbUser.getSalt());
|
||||
assertEquals("Miguel", dbUser.getFirstname());
|
||||
assertEquals("Garzon", dbUser.getLastname());
|
||||
|
||||
//add a ServiceProvider to database
|
||||
originalUser = new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman",
|
||||
"testaddress", "8888888888", "companydotcom", true);
|
||||
addedTwo = dbHelper.addUser(originalUser);
|
||||
|
||||
//test retrieving ServiceProvider, and confirm that user info is the same as that in object passed
|
||||
dbUser = dbHelper.findUserByUsername("jbO4aBF4dC");
|
||||
assertEquals("ServiceProvider", dbUser.getClass().getSimpleName());
|
||||
assertEquals("jbO4aBF4dC", dbUser.getUsername());
|
||||
assertEquals(originalUser.getHash(), dbUser.getHash());
|
||||
assertEquals(originalUser.getSalt(), dbUser.getSalt());
|
||||
assertEquals("Juan", dbUser.getFirstname());
|
||||
assertEquals("Guzman", dbUser.getLastname());
|
||||
|
||||
//if user exsists in database, delete and test that user has been deleted
|
||||
if (addedOne) {
|
||||
deleted = dbHelper.deleteUser("mgarzon");
|
||||
assertTrue(deleted);
|
||||
}
|
||||
|
||||
if (addedTwo) {
|
||||
deleted = dbHelper.deleteUser("jbO4aBF4dC");
|
||||
assertTrue(deleted);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndGetServiceProvider(){
|
||||
//ServiceProviders have extra fields that can be added to the DB
|
||||
ServiceProvider serviceProvider = new ServiceProvider("7MuF1c59XP", null, null, null,
|
||||
"testaddress", "8888888888", "companydotcom", true);
|
||||
dbHelper.addUser(serviceProvider);
|
||||
|
||||
//retrieve ServiceProvider and test the newly added fields
|
||||
UserType userType = dbHelper.findUserByUsername("7MuF1c59XP");
|
||||
//UserType returned should be an instance of ServiceProvider.
|
||||
//Also serves as check before casting
|
||||
assertTrue(userType instanceof ServiceProvider);
|
||||
|
||||
ServiceProvider dbServiceProvider = (ServiceProvider) userType;
|
||||
assertEquals(serviceProvider.getAddress(), dbServiceProvider.getAddress());
|
||||
assertEquals(serviceProvider.getPhonenumber(), dbServiceProvider.getPhonenumber());
|
||||
assertEquals(serviceProvider.getCompanyname(), dbServiceProvider.getCompanyname());
|
||||
assertEquals(serviceProvider.isLicensed(), dbServiceProvider.isLicensed());
|
||||
assertEquals(serviceProvider.getDescription(), dbServiceProvider.getDescription());
|
||||
|
||||
dbHelper.deleteUser("7MuF1c59XP");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteServiceProvider(){
|
||||
//make sure all the rows related to ServiceProvider in all tables are deleted
|
||||
ServiceProvider serviceProvider = new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||
"testaddress", "8888888888", "companydotcom", true);
|
||||
dbHelper.addUser(serviceProvider);
|
||||
|
||||
Service service1 = new Service("Hitman", 12358);
|
||||
Service service2 = new Service("Exterminating flatworms", 392.457);
|
||||
dbHelper.addService(service1);
|
||||
dbHelper.addService(service2);
|
||||
|
||||
dbHelper.addServiceProvidedByUser(serviceProvider, service1);
|
||||
dbHelper.addServiceProvidedByUser(serviceProvider, service2);
|
||||
|
||||
serviceProvider.setAvailabilities(0, 4, 18, 19, 30);
|
||||
serviceProvider.setAvailabilities(1, 5, 20, 21, 11);
|
||||
serviceProvider.setAvailabilities(3, 7, 12, 15, 14);
|
||||
serviceProvider.setAvailabilities(4, 0, 0, 23, 29);
|
||||
dbHelper.updateAvailability(serviceProvider);
|
||||
|
||||
dbHelper.deleteUser("jbO4aBF4dC");
|
||||
|
||||
List<String[]> providersList = dbHelper.getAllProvidersByService("hitman");
|
||||
assertEquals(0, providersList.size());
|
||||
providersList = dbHelper.getAllProvidersByService("hitman");
|
||||
assertEquals(0, providersList.size());
|
||||
|
||||
int[][] availabilities = dbHelper.getAvailabilities(serviceProvider);
|
||||
for (int i = 0; i<7; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
assertEquals(0, availabilities[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddDuplicateUsers(){
|
||||
boolean added;
|
||||
added = dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "soccer", "Miguel", "Garzon"));
|
||||
assertTrue(added);
|
||||
//should not be able to add user of same username, regardless of user type
|
||||
added = dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "seg2105", "Miguel", "Garzon"));
|
||||
assertTrue(!added);
|
||||
added = dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman",
|
||||
"testaddress", "8888888888", "companydotcom", true));
|
||||
assertTrue(!added);
|
||||
|
||||
dbHelper.deleteUser("jbO4aBF4dC");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateUserLogin(){
|
||||
boolean updated;
|
||||
UserType dbUser;
|
||||
|
||||
dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "soccer", "Miguel", "Garzon"));
|
||||
updated = dbHelper.updateUserInfo("jbO4aBF4dC", "soccer", "Juan", "Guzman");
|
||||
assertTrue(updated);
|
||||
|
||||
dbUser = dbHelper.findUserByUsername("jbO4aBF4dC");
|
||||
|
||||
assertEquals("jbO4aBF4dC", dbUser.getUsername());
|
||||
assertEquals("Juan", dbUser.getFirstname());
|
||||
assertEquals("Guzman", dbUser.getLastname());
|
||||
|
||||
//changed on character of username. Everything is case sensitive!
|
||||
updated = dbHelper.updateUserInfo("JbO4aBF4dC", "seg2105", "Juan", "Guzman");
|
||||
assertTrue(!updated);
|
||||
|
||||
dbHelper.deleteUser("jbO4aBF4dC");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllUsers(){
|
||||
setUp(TestAfter.USER);
|
||||
|
||||
List<String[]> allUsers = dbHelper.getAllUsers();
|
||||
assertEquals(allUsers.size(), 5);
|
||||
|
||||
for (String[] user : allUsers){
|
||||
UserType usertype = dbHelper.findUserByUsername(user[0]);
|
||||
assertEquals(usertype.getFirstname(), user[1]);
|
||||
assertEquals(usertype.getLastname(), user[2]);
|
||||
assertEquals(usertype.getClass().getSimpleName(), user[3]);
|
||||
}
|
||||
|
||||
dbHelper.deleteUser("jbO4aBF4dC");
|
||||
}
|
||||
|
||||
|
||||
//Testing services table
|
||||
@Test
|
||||
public void testAddAndDeleteServices(){
|
||||
Service originalService, dbService;
|
||||
boolean deleted, addedOne, addedTwo;
|
||||
|
||||
|
||||
originalService = new Service("Exterminating flatworms", 20.00);
|
||||
addedOne = dbHelper.addService(originalService);
|
||||
dbService = dbHelper.findService("Exterminating flatworms");
|
||||
|
||||
assertEquals("exterminating flatworms", dbService.getName());
|
||||
assertEquals(20.00, dbService.getRate(), 0.001);
|
||||
|
||||
|
||||
originalService = new Service("Cleaning fishtanks", 15.00);
|
||||
addedTwo = dbHelper.addService(originalService);
|
||||
dbService = dbHelper.findService("Cleaning fishtanks");
|
||||
|
||||
assertEquals("cleaning fishtanks", dbService.getName());
|
||||
assertEquals(15.00, dbService.getRate(), 0.001);
|
||||
|
||||
if (addedOne) {
|
||||
deleted = dbHelper.deleteService("Exterminating flatworms");
|
||||
assertTrue(deleted);
|
||||
}
|
||||
|
||||
if (addedTwo) {
|
||||
deleted = dbHelper.deleteService("Cleaning fishtanks");
|
||||
assertTrue(deleted);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAddDuplicateService(){
|
||||
boolean added;
|
||||
|
||||
added = dbHelper.addService(new Service("Exterminating flatworms", 20.00));
|
||||
assertTrue(added);
|
||||
added = dbHelper.addService(new Service("Exterminating flatworms", 25.00));
|
||||
assertTrue(!added);
|
||||
added = dbHelper.addService(new Service("extermiNating fLatworms", 25.00));
|
||||
assertTrue(!added);
|
||||
|
||||
dbHelper.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateService(){
|
||||
boolean updated;
|
||||
Service service;
|
||||
|
||||
dbHelper.addService(new Service("Exterminating flatworms", 20.00));
|
||||
updated = dbHelper.updateService("Exterminating flatworms", 25.00);
|
||||
assertTrue(updated);
|
||||
|
||||
service = dbHelper.findService("Exterminating flatworms");
|
||||
|
||||
assertEquals("exterminating flatworms", service.getName());
|
||||
assertEquals(25.00, service.getRate(), 0.001);
|
||||
|
||||
dbHelper.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllServices(){
|
||||
setUp(TestAfter.SERVICE);
|
||||
|
||||
List<String[]> allServices = dbHelper.getAllServices();
|
||||
assertTrue(allServices.size() == 3);
|
||||
|
||||
for (String[] service : allServices){
|
||||
Service dbService = dbHelper.findService(service[0]);
|
||||
assertEquals(dbService.getRate(), Double.parseDouble(service[1]), 0.001);
|
||||
}
|
||||
|
||||
dbHelper.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndDeleteServiceProvidedByUser(){
|
||||
setUp(TestAfter.SERVICE);
|
||||
|
||||
boolean added = dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "hitman");
|
||||
assertTrue(added);
|
||||
boolean deleted = dbHelper.deleteServiceProvidedByUser("jbO4aBF4dC", "Hitman");
|
||||
assertTrue(deleted);
|
||||
|
||||
dbHelper.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllServicesProvidedByUserAndDeleteService(){
|
||||
setUp(TestAfter.LINK);
|
||||
|
||||
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.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllProvidersByService(){
|
||||
setUp(TestAfter.LINK);
|
||||
|
||||
List<String[]> providersByService = dbHelper.getAllProvidersByService("exterminating flatworms");
|
||||
|
||||
assertEquals(2, providersByService.size());
|
||||
assertEquals("jbO4aBF4dC", providersByService.get(0)[0]);
|
||||
assertEquals("DW44FkUsX7", providersByService.get(1)[0]);
|
||||
|
||||
dbHelper.deleteAll();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDeleteServiceProvidedByUser(){
|
||||
setUp(TestAfter.LINK);
|
||||
|
||||
List<String[]> servicesProvidedByUser = dbHelper.getAllServicesProvidedByUser("jbO4aBF4dC");
|
||||
assertEquals(2, servicesProvidedByUser.size());
|
||||
|
||||
dbHelper.deleteServiceProvidedByUser("jbO4aBF4dC","hitman");
|
||||
servicesProvidedByUser = dbHelper.getAllServicesProvidedByUser("jbO4aBF4dC");
|
||||
assertEquals(1, servicesProvidedByUser.size());
|
||||
|
||||
dbHelper.deleteServiceProvidedByUser("jbO4aBF4dC", "exterminating flatworms");
|
||||
servicesProvidedByUser = dbHelper.getAllServicesProvidedByUser("jbO4aBF4dC");
|
||||
assertEquals(0, servicesProvidedByUser.size());
|
||||
|
||||
dbHelper.deleteAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@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(1, 5, 20, 21, 11);
|
||||
serviceProvider.setAvailabilities(3, 7, 12, 15, 14);
|
||||
serviceProvider.setAvailabilities(4, 0, 0, 23, 29);
|
||||
|
||||
//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(1, 5, 20, 21, 11);
|
||||
serviceProvider2.setAvailabilities(3, 7, 12, 15, 14);
|
||||
serviceProvider2.setAvailabilities(4, 0, 0, 23, 29);
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
dbHelper.deleteAll();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testInvalidAvailability(){
|
||||
ServiceProvider serviceProvider = new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||
"testaddress", "8888888888", "companydotcom", true);
|
||||
serviceProvider.setAvailabilities(2, 8, 14, 8, 14);
|
||||
serviceProvider.setAvailabilities(3, 15, 12, 8, 14);
|
||||
|
||||
|
||||
dbHelper.addUser(serviceProvider);
|
||||
|
||||
boolean updated = dbHelper.updateAvailability(serviceProvider);
|
||||
assertTrue(updated);
|
||||
int[][] dbAvailabilities = dbHelper.getAvailabilities(serviceProvider);
|
||||
int[][] availabilities = serviceProvider.getAvailabilities();
|
||||
|
||||
for (int i = 0; i<7; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
assertEquals(0, availabilities[i][j]);
|
||||
assertEquals(0, dbAvailabilities[i][j]);
|
||||
}
|
||||
}
|
||||
dbHelper.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetByTime(){
|
||||
setUp(TestAfter.AVAILABILITY);
|
||||
|
||||
//December 3 2020 is a Thursday
|
||||
List<String[]> providers = dbHelper.getProvidersByTime("Exterminating flatworms", 2020,
|
||||
12, 3, 6, 12, 10, 0);
|
||||
assertEquals(0, providers.size());
|
||||
|
||||
providers = dbHelper.getProvidersByTime("Exterminating flatworms", 2020,
|
||||
12, 3, 7, 12, 10, 0);
|
||||
assertEquals(1, providers.size());
|
||||
String[] firstProvider = providers.get(0);
|
||||
assertEquals("jbO4aBF4dC", firstProvider[0]);
|
||||
assertEquals("Jack", firstProvider[1]);
|
||||
assertEquals("Black", firstProvider[2]);
|
||||
assertEquals(0, Double.parseDouble(firstProvider[3]), 0.0001);
|
||||
|
||||
//December 4 2020 is a Friday
|
||||
providers = dbHelper.getProvidersByTime("Exterminating flatworms", 2020,
|
||||
12, 4, 10, 0, 13, 0);
|
||||
assertEquals(2, providers.size());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testAddBooking(){
|
||||
setUp(TestAfter.AVAILABILITY);
|
||||
|
||||
//December 1, 2020 is a Tuesday. Provider is available from 5:20 to 21:11
|
||||
boolean added = dbHelper.addBooking("jbO4aBF4dC", "7MuF1c59XP", "Hitman",
|
||||
2020, 12, 1, 8, 12, 10, 0);
|
||||
assertTrue(added);
|
||||
|
||||
//This booking has already been done so cannot be booked anymore
|
||||
added = dbHelper.addBooking("jbO4aBF4dC", "7MuF1c59XP", "Hitman",
|
||||
2020, 12, 1, 8, 12, 10, 0);
|
||||
assertTrue(!added);
|
||||
|
||||
//Provider is available from 5:20 to 21:11, but has a booking from 8:12 to 10:00
|
||||
added = dbHelper.addBooking("jbO4aBF4dC", "7MuF1c59XP", "Hitman",
|
||||
2020, 12, 1, 9, 12, 12, 0);
|
||||
assertTrue(!added);
|
||||
|
||||
//December 3, 2020 is a Thursday. Provider is available from 7:12 to 15:14
|
||||
added = dbHelper.addBooking("jbO4aBF4dC", "7MuF1c59XP", "Hitman",
|
||||
2020, 12, 3, 6, 12, 7, 30);
|
||||
assertTrue(!added);
|
||||
|
||||
//November 20, 2018 is in the past. Should not be able to add booking
|
||||
added = dbHelper.addBooking("jbO4aBF4dC", "7MuF1c59XP", "Hitman",
|
||||
2018, 11, 20, 8, 12, 10, 0);
|
||||
assertTrue(!added);
|
||||
|
||||
dbHelper.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testViewListOfBookings(){
|
||||
setUp(TestAfter.AVAILABILITY);
|
||||
|
||||
List<Booking> bookings = dbHelper.findBookings("jbO4aBF4dC");
|
||||
assertEquals(0, bookings.size());
|
||||
bookings = dbHelper.findBookings("7MuF1c59XP");
|
||||
assertEquals(0, bookings.size());
|
||||
bookings = dbHelper.findBookings("DW44FkUsX7");
|
||||
assertEquals(0, bookings.size());
|
||||
|
||||
dbHelper.addBooking("jbO4aBF4dC", "7MuF1c59XP", "Hitman",
|
||||
2020, 12, 1, 8, 12, 10, 0);
|
||||
bookings = dbHelper.findBookings("jbO4aBF4dC");
|
||||
assertEquals(1, bookings.size());
|
||||
bookings = dbHelper.findBookings("7MuF1c59XP");
|
||||
assertEquals(1, bookings.size());
|
||||
bookings = dbHelper.findBookings("DW44FkUsX7");
|
||||
assertEquals(0, bookings.size());
|
||||
|
||||
dbHelper.addBooking("DW44FkUsX7", "7MuF1c59XP", "petting cats",
|
||||
2020, 12, 4, 10, 0, 10, 30);
|
||||
bookings = dbHelper.findBookings("jbO4aBF4dC");
|
||||
assertEquals(1, bookings.size());
|
||||
bookings = dbHelper.findBookings("7MuF1c59XP");
|
||||
assertEquals(2, bookings.size());
|
||||
bookings = dbHelper.findBookings("DW44FkUsX7");
|
||||
assertEquals(1, bookings.size());
|
||||
|
||||
dbHelper.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfirmAndCancelBooking(){
|
||||
setUp(TestAfter.AVAILABILITY);
|
||||
|
||||
Booking booking = new Booking(8, 12, 10, 0,1,
|
||||
12, 2020, (ServiceProvider)dbHelper.findUserByUsername("jbO4aBF4dC"),
|
||||
(HomeOwner)dbHelper.findUserByUsername("7MuF1c59XP"), dbHelper.findService("Hitman"));
|
||||
dbHelper.addBooking(booking);
|
||||
|
||||
assertTrue(dbHelper.confirmBooking(booking));
|
||||
List<Booking> bookings = dbHelper.findBookings("jbO4aBF4dC");
|
||||
Booking dbBooking = bookings.get(0);
|
||||
assertEquals(Status.CONFIRMED, dbBooking.getStatus());
|
||||
|
||||
assertTrue(dbHelper.cancelBooking(booking));
|
||||
bookings = dbHelper.findBookings("jbO4aBF4dC");
|
||||
dbBooking = bookings.get(0);
|
||||
assertEquals(Status.CANCELLED, dbBooking.getStatus());
|
||||
|
||||
bookings = dbHelper.findNonCancelledBookings("jbO4aBF4dC");
|
||||
assertEquals(0, bookings.size());
|
||||
|
||||
dbHelper.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRating(){
|
||||
setUp(TestAfter.BOOKING);
|
||||
|
||||
ServiceProvider serviceProvider = (ServiceProvider)dbHelper.findUserByUsername("jbO4aBF4dC");
|
||||
HomeOwner homeOwner = (HomeOwner)dbHelper.findUserByUsername("7MuF1c59XP");
|
||||
Service service = dbHelper.findService("Hitman");
|
||||
|
||||
Booking booking = new Booking(8, 12, 10, 0,
|
||||
2, 10, 2018,
|
||||
serviceProvider, homeOwner, service);
|
||||
boolean added = dbHelper.addRating(booking, 5, "100%");
|
||||
assertTrue(added);
|
||||
|
||||
double rating = dbHelper.getAverageRating("jbO4aBF4dC","Hitman");
|
||||
assertEquals(5, rating, 0.0001);
|
||||
|
||||
booking = new Booking(10, 01, 11, 0,
|
||||
2, 10, 2018,
|
||||
serviceProvider, homeOwner, service);
|
||||
added = dbHelper.addRating(booking, 1, "Wrong target");
|
||||
assertTrue(added);
|
||||
|
||||
rating = dbHelper.getAverageRating("jbO4aBF4dC","Hitman");
|
||||
assertEquals(3, rating, 0.0001);
|
||||
|
||||
rating = dbHelper.getAverageRating("jbO4aBF4dC","exterminating flatworms");
|
||||
assertEquals(0, rating, 0.0001);
|
||||
|
||||
dbHelper.deleteAll();
|
||||
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void printUsersTable(){
|
||||
// dbHelper.printTable("userInfo");
|
||||
// }
|
||||
|
||||
// Ever gotten tired of adding things at the start of a test just to delete it all again?
|
||||
// I have.
|
||||
// This is a work in progress
|
||||
private void setUp(TestAfter testAfter){
|
||||
dbHelper.deleteAll();
|
||||
|
||||
dbHelper.addUser(new Admin());
|
||||
|
||||
ServiceProvider serviceProvider1 = new ServiceProvider("jbO4aBF4dC", null, "Jack", "Black",
|
||||
"testaddress", "8888888888", "companydotcom", true);
|
||||
dbHelper.addUser(serviceProvider1);
|
||||
|
||||
ServiceProvider serviceProvider2 = new ServiceProvider("DW44FkUsX7", null, "Dwayne", "Johnson",
|
||||
"testaddress", "1248921742", "companydotcom", false);
|
||||
dbHelper.addUser(serviceProvider2);
|
||||
|
||||
HomeOwner homeOwner1 = new HomeOwner("7MuF1c59XP", null, "Mufasa", "Died");
|
||||
dbHelper.addUser(homeOwner1);
|
||||
|
||||
HomeOwner homeOwner2 = new HomeOwner("wRV3phzpl5", null, "Wren", "Phillips");
|
||||
dbHelper.addUser(homeOwner2);
|
||||
|
||||
Service service1 = new Service("Hitman", 12358);
|
||||
dbHelper.addService(service1);
|
||||
|
||||
Service service2 = new Service("Exterminating flatworms", 392.457);
|
||||
dbHelper.addService(service2);
|
||||
|
||||
Service service3 = new Service("Petting cats", 0);
|
||||
dbHelper.addService(service3);
|
||||
|
||||
if (!(testAfter.equals(TestAfter.USER) || testAfter.equals(TestAfter.SERVICE))){
|
||||
dbHelper.addServiceProvidedByUser(serviceProvider1, service1);
|
||||
dbHelper.addServiceProvidedByUser(serviceProvider1, service2);
|
||||
|
||||
dbHelper.addServiceProvidedByUser(serviceProvider2, service3);
|
||||
dbHelper.addServiceProvidedByUser(serviceProvider2, service2);
|
||||
|
||||
if (!testAfter.equals(TestAfter.LINK)){
|
||||
//serviceProvider1 is available on Monday, Tuesday, Thursday, and Friday
|
||||
serviceProvider1.setAvailabilities(0, 4, 18, 19, 30);
|
||||
serviceProvider1.setAvailabilities(1, 5, 20, 21, 11);
|
||||
serviceProvider1.setAvailabilities(3, 7, 12, 15, 14);
|
||||
serviceProvider1.setAvailabilities(4, 0, 0, 23, 29);
|
||||
|
||||
dbHelper.updateAvailability(serviceProvider1);
|
||||
|
||||
//serviceProvider2 is only available on Friday
|
||||
serviceProvider2.setAvailabilities(4, 10, 0, 23, 29);
|
||||
|
||||
dbHelper.updateAvailability(serviceProvider2);
|
||||
|
||||
if (!testAfter.equals(TestAfter.AVAILABILITY)){
|
||||
Booking booking1 = new Booking(8, 12, 10, 0,1,
|
||||
12, 2020, serviceProvider1, homeOwner1, service1);
|
||||
dbHelper.addBooking(booking1);
|
||||
}
|
||||
|
||||
if (testAfter.equals(TestAfter.BOOKING)){
|
||||
//October 2 2018 is a Tuesday
|
||||
dbHelper.forceAddBookingDONTTOUCH("jbO4aBF4dC", "7MuF1c59XP", "Hitman",
|
||||
2018, 10, 2, 8, 12, 10, 0, Status.PENDING);
|
||||
dbHelper.forceAddBookingDONTTOUCH("jbO4aBF4dC", "7MuF1c59XP", "Hitman",
|
||||
2018, 10, 2, 10, 01, 11, 0, Status.PENDING);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class HomeOwnerTest {
|
||||
|
||||
/**
|
||||
* Initiates an Homeowner account and tests if the random strings match to the required inputs.
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testHomeOwner(){
|
||||
UserType user = new HomeOwner( "John123", "1234567890", "John", "Doe" );
|
||||
String role = user.getRole();
|
||||
String salt = user.getSalt();
|
||||
assertEquals("HomeOwner", role);
|
||||
assertEquals("John123", user.getUsername());
|
||||
assertEquals( PasswordEncryption.encrypt("1234567890", salt), user.getHash());
|
||||
assertEquals("John", user.getFirstname());
|
||||
assertEquals("Doe", user.getLastname());
|
||||
user.setUsername( "username" );
|
||||
user.setPassword( "password" );
|
||||
user.setFirstname( "firstname" );
|
||||
user.setLastname( "lastname" );
|
||||
assertNotEquals("John123", user.getUsername());
|
||||
assertNotEquals("1234567890", user.getHash());
|
||||
assertNotEquals("password", user.getHash());
|
||||
assertNotEquals( PasswordEncryption.encrypt("1234567890", salt), user.getHash());
|
||||
assertNotEquals(PasswordEncryption.encrypt("password", salt), user.getHash());
|
||||
assertNotEquals("John", user.getFirstname());
|
||||
assertNotEquals("Doe", user.getLastname());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class PasswordTest {
|
||||
|
||||
@Test
|
||||
public void testHashes(){
|
||||
String string1 = PasswordEncryption.encrypt("helloworld", "i]/S9evY\\,");
|
||||
String string2 = PasswordEncryption.encrypt("helloworld", "i]/S9evY\\,");
|
||||
|
||||
assertTrue(PasswordEncryption.slowEquals(string1, string2));
|
||||
|
||||
String string3 = PasswordEncryption.encrypt("helloworld", "i]/S9evY\\");
|
||||
assertTrue(!PasswordEncryption.slowEquals(string1, string3));
|
||||
|
||||
String string4 = PasswordEncryption.encrypt("helloworl", "i]/S9evY\\,");
|
||||
assertTrue(!PasswordEncryption.slowEquals(string1, string4));
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ServiceProviderTest {
|
||||
|
||||
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
|
||||
public void testServiceProvider() {
|
||||
String salt = serviceprovider.getSalt();
|
||||
assertEquals( "John123", serviceprovider.getUsername());
|
||||
assertEquals( PasswordEncryption.encrypt("1234567890", salt), serviceprovider.getHash());
|
||||
assertEquals( "John", serviceprovider.getFirstname());
|
||||
assertEquals( "Doe", serviceprovider.getLastname());
|
||||
assertEquals( "ServiceProvider", serviceprovider.getRole());
|
||||
serviceprovider.setUsername("username");
|
||||
serviceprovider.setPassword("password");
|
||||
serviceprovider.setFirstname("firstname");
|
||||
serviceprovider.setLastname("lastname");
|
||||
assertNotEquals("John123", serviceprovider.getUsername());
|
||||
assertNotEquals("1234567890", serviceprovider.getHash());
|
||||
assertNotEquals("password", serviceprovider.getHash());
|
||||
assertNotEquals( PasswordEncryption.encrypt("1234567890", salt), serviceprovider.getHash());
|
||||
assertNotEquals(PasswordEncryption.encrypt("password", salt), serviceprovider.getHash());
|
||||
assertNotEquals("John", serviceprovider.getFirstname());
|
||||
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
|
||||
public void addServiceTest() {
|
||||
serviceprovider.addService( new Service( "KitchenCleaner", 50 ) );
|
||||
serviceprovider.addService( new Service( "FrenchMaid", 250 ) );
|
||||
serviceprovider.addService( new Service( "FrenchMaid", 210 ) );
|
||||
serviceprovider.addService( new Service( "SecretService", 150 ) );
|
||||
serviceprovider.addService( new Service( "SecretService", 110 ) );
|
||||
int numOfServices = serviceprovider.getServices().size();
|
||||
assertEquals( 3, numOfServices );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ServiceProviderTest2 {
|
||||
ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe",
|
||||
"testaddress", "8888888888", "companydotcom", true, "LOL");
|
||||
|
||||
|
||||
/**
|
||||
* sets availabilities and tests them.
|
||||
*/
|
||||
@Test
|
||||
public void testAvailabilities() {
|
||||
int [][] availability = new int[7][4];
|
||||
assertEquals( availability, serviceprovider.getAvailabilities());
|
||||
serviceprovider.setAvailabilities(5, 8, 30, 12, 0);
|
||||
availability[5][0] = 8;
|
||||
availability[5][1] = 30;
|
||||
availability[5][2] = 12;
|
||||
availability[5][3] = 0;
|
||||
assertEquals( availability, serviceprovider.getAvailabilities());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests other instances and checks if they are correct
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testOtherInstances() {
|
||||
assertEquals( "testaddress", serviceprovider.getAddress() );
|
||||
assertEquals( "8888888888", serviceprovider.getPhonenumber() );
|
||||
assertEquals( "companydotcom", serviceprovider.getCompanyname() );
|
||||
assertEquals( true, serviceprovider.isLicensed() );
|
||||
assertEquals( "LOL", serviceprovider.getDescription() );
|
||||
serviceprovider.setAddress( "Canada, Ontario" );
|
||||
serviceprovider.setPhonenumber( "+1-416-555-0182" );
|
||||
serviceprovider.setCompanyname( "Google" );
|
||||
serviceprovider.setLicensed( false );
|
||||
serviceprovider.setDescription( "Nope" );
|
||||
assertNotEquals( "testaddress", serviceprovider.getAddress() );
|
||||
assertNotEquals( "8888888888", serviceprovider.getPhonenumber() );
|
||||
assertNotEquals( "companydotcom", serviceprovider.getCompanyname() );
|
||||
assertNotEquals( true, serviceprovider.isLicensed() );
|
||||
assertNotEquals( "LOL", serviceprovider.getDescription() );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ServiceTest {
|
||||
Service service = new Service( "FrenchMaid", 250 );
|
||||
|
||||
/**
|
||||
* Initiates an Service account and tests if the random strings match to the required inputs.
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testService(){
|
||||
assertEquals( "FrenchMaid", service.getName() );
|
||||
assertEquals( 250, service.getRate(), 0);
|
||||
service.setName( "ItalianMafia" );
|
||||
service.setRate( 200 );
|
||||
assertNotEquals( "FrenchMaid", service.getName() );
|
||||
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
|
||||
public void addServiceProviderTest(){
|
||||
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( "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();
|
||||
assertEquals( 2,numOfSP );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class UserTypeTest {
|
||||
|
||||
/**
|
||||
* Tests if the every user that is created is equal to each other or not.
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void userTypeComparaison() {
|
||||
UserType user = new HomeOwner("John123", "1234567890", "John", "Doe");
|
||||
UserType admin = new Admin();
|
||||
UserType serviceprovider = new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe",
|
||||
"testaddress", "8888888888", "companydotcom", true);
|
||||
boolean userservice = user.equals(serviceprovider);
|
||||
boolean useradmin = user.equals(admin);
|
||||
boolean serviceadmin = serviceprovider.equals(admin);
|
||||
assertNotEquals( true, useradmin );
|
||||
assertNotEquals( true, serviceadmin );
|
||||
assertNotEquals( true, userservice );
|
||||
user = new HomeOwner(serviceprovider.getUsername(), serviceprovider.getHash(), serviceprovider.getSalt(),
|
||||
serviceprovider.getFirstname(), serviceprovider.getLastname());
|
||||
userservice = user.equals(serviceprovider);
|
||||
assertEquals( true, userservice );
|
||||
}
|
||||
}
|
|
@ -7,8 +7,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.4'
|
||||
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#Fri Sep 28 14:59:51 EDT 2018
|
||||
<<<<<<< HEAD
|
||||
#Fri Oct 05 11:36:36 EDT 2018
|
||||
=======
|
||||
#Fri Oct 05 10:21:14 EDT 2018
|
||||
>>>>>>> refs/remotes/origin/master
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||
|
|
93
ProjectUML.ump
Normal file
|
@ -0,0 +1,93 @@
|
|||
class UserType
|
||||
{
|
||||
firstname;
|
||||
lastname;
|
||||
username;
|
||||
salt;
|
||||
hash;
|
||||
}
|
||||
|
||||
class HomeOwner
|
||||
{
|
||||
isA UserType;
|
||||
}
|
||||
|
||||
class ServiceProvider
|
||||
{
|
||||
int[] availabilities;
|
||||
address;
|
||||
int phonenumber;
|
||||
companyname;
|
||||
boolean licensed;
|
||||
description;
|
||||
isA UserType;
|
||||
}
|
||||
|
||||
class Admin
|
||||
{
|
||||
isA UserType;
|
||||
1 -- * Service;
|
||||
}
|
||||
|
||||
class Service
|
||||
{
|
||||
name;
|
||||
double rate;
|
||||
* -- * ServiceProvider;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Booking
|
||||
{
|
||||
int starth;
|
||||
int startmin;
|
||||
int endh;
|
||||
int endmin;
|
||||
int day;
|
||||
int month;
|
||||
int year;
|
||||
status;
|
||||
int rating;
|
||||
comment;
|
||||
* -- 1 HomeOwner;
|
||||
* -- 1 ServiceProvider;
|
||||
* -- 1 Service;
|
||||
}
|
||||
|
||||
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;
|
||||
position.association Admin__Service 66,41 0,52;
|
||||
position.association Admin__Service:create 109,28 0,60;
|
||||
position.association Admin__Service:creates 109,16 0,28;
|
||||
}
|
||||
|
||||
class Service
|
||||
{
|
||||
position 849 474 112 75;
|
||||
position.association Service__ServiceProvider 65,0 65,143;
|
||||
}
|
||||
|
||||
class Booking
|
||||
{
|
||||
position 99 433 178 194;
|
||||
position.association Booking__HomeOwner 62,0 54,41;
|
||||
position.association Booking__ServiceProvider 178,50 0,94;
|
||||
position.association Booking__Service 178,120 0,68;
|
||||
}
|
17
README.md
|
@ -1,2 +1,19 @@
|
|||
# SEG2105-Olympus
|
||||
SEG2105 final project, Ivana Erlich, Anshu Sharma, Batuhan Basoglu, Mary Tran
|
||||
|
||||
https://github.com/ebivibe/SEG2105-Olympus
|
||||
|
||||
Admin account is precreated with
|
||||
username = admin,
|
||||
password = admin
|
||||
|
||||
|
||||
ServiceProvider account is precreated with
|
||||
username = testing,
|
||||
password = testing
|
||||
|
||||
APK tested on a Sony Xperia XA2, model H3123
|
||||
|
||||
Build Status
|
||||
[![CircleCI](https://circleci.com/gh/ebivibe/SEG2105-Olympus/tree/master.svg?style=svg&circle-token=01dbbc3800d7ee80871796675582a67ba7c83604)](https://circleci.com/gh/ebivibe/SEG2105-Olympus/tree/master)
|
||||
|
||||
|
|