Compare commits

...

64 commits

Author SHA1 Message Date
IvanaE
33611b8983 can no longer edit service name 2018-11-01 20:30:03 -04:00
IvanaE
ea0e8bd7d1 made it look pretty 2018-11-01 19:51:35 -04:00
IvanaE
8ac71c9cac fixed ui elements 2018-11-01 14:42:04 -04:00
IvanaE
6f49545aba fixed ui elements 2018-11-01 14:40:25 -04:00
IvanaE
695ab61b15 trying some wild stuff 2018-11-01 12:49:40 -04:00
FunwithaPorpoise
674ed9352f Merge pull request #15 from ebivibe/DBBranch
Changing gridview text colour to white
2018-10-31 12:58:05 -04:00
Mary Tran
39ba11d11b Changing gridview text colour to white 2018-10-31 12:55:15 -04:00
Mary Tran
23293089cb Increased DB version. Changed User to HomeOwner in existing DBs 2018-10-30 12:24:46 -04:00
IvanaE
8b2532d27e made it pretty 2018-10-30 11:16:56 -04:00
IvanaE
073885ebeb accidentally changed to many things 2018-10-30 11:16:06 -04:00
IvanaE
3491212fbc refactored user to homeowner 2018-10-30 11:08:08 -04:00
IvanaE
7790edac33 added popups and services 2018-10-28 19:31:34 -04:00
FunwithaPorpoise
60c0da3558 Merge pull request #14 from ebivibe/DBBranch
Db branch
2018-10-26 22:25:34 -04:00
Batuhan Berk Başoğlu
6c270be5ce Updated UML Diagram for Deliverable 2 2018-10-26 14:43:41 -04:00
Mary Tran
7646deb05b Replacing a relic from the past 2018-10-25 21:24:33 -04:00
Mary Tran
97148737de Added Integration Tests for services table 2018-10-25 16:43:08 -04:00
Mary Tran
d29b03972e Added new table for services. Not tested yet 2018-10-25 16:14:38 -04:00
IvanaE
319428eebb updated zip 2018-10-23 17:24:38 -04:00
IvanaE
2da777b576 Merge branch 'master' of https://github.com/ebivibe/SEG2105-Olympus 2018-10-23 17:16:36 -04:00
IvanaE
22cfef6b7b fixed security of users 2018-10-23 17:16:18 -04:00
IvanaE
1f822b8181 Add files via upload
added deliverable 1 submission
2018-10-23 00:03:49 -04:00
Mary Tran
4fe5b70d6e Changed ListView to GridView for admin welcome page 2018-10-22 23:09:55 -04:00
IvanaE
c91d38cf18 added admin welcome page 2018-10-22 14:48:11 -04:00
FunwithaPorpoise
04362b99c0 Merge pull request #12 from ebivibe/DBBranch
Db branch
2018-10-22 14:25:17 -04:00
Mary Tran
8c35832b28 Fixing getAllUsers again 2018-10-22 14:23:01 -04:00
Mary Tran
f12d7aa693 Added admin first, and fixed getAllUsers 2018-10-21 21:27:35 -04:00
Mary Tran
3288d51cf7 Add Admin first, always, and fixed getAllUsers 2018-10-21 21:13:11 -04:00
IvanaE
4a725dd6d6 added field validation 2018-10-21 16:34:47 -04:00
IvanaE
a1d92aa423 fixed welcome page? 2018-10-19 19:04:28 -04:00
IvanaE
d740cf72d3 Merge branch 'lBranch'
# Conflicts:
#	OlympusServices/.idea/caches/build_file_checksums.ser
#	OlympusServices/.idea/vcs.xml
#	OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/SignUp.java
#	OlympusServices/app/src/main/res/layout/activity_main.xml
#	OlympusServices/app/src/main/res/layout/activity_sign_up.xml
#	OlympusServices/build.gradle
2018-10-19 19:02:28 -04:00
Anshu Sharma
8be4ccbbd7 Logic 2018-10-19 16:45:18 -04:00
IvanaE
fc2f8bba29 added logo 2018-10-18 12:32:21 -04:00
IvanaE
7edfe3a185 changed cursor from pink to white - gotta stay on brand 2018-10-18 11:55:18 -04:00
IvanaE
114c698b61 made password field not visible, pop up text white instead of pink 2018-10-18 11:48:01 -04:00
IvanaE
173f6097fd Merge branch 'master' of https://github.com/ebivibe/SEG2105-Olympus
# Conflicts:
#	OlympusServices/app/src/main/res/layout/activity_log_in.xml
2018-10-18 11:36:47 -04:00
IvanaE
f1c28f1a4c made layout look good on actual phones 2018-10-18 11:33:05 -04:00
Batuhan Berk Başoğlu
9cd04e06da Merge branch 'master' of https://github.com/ebivibe/SEG2105-Olympus 2018-10-17 17:53:59 -04:00
Batuhan Berk Başoğlu
5599bd9179 Changed UML 2018-10-17 17:53:33 -04:00
IvanaE
9bb3534191 Update README.md 2018-10-17 13:20:45 -04:00
IvanaE
6f9590413f gave credit to style repos, removed admin option from sign up drop down 2018-10-15 10:36:54 -04:00
Batuhan Berk Başoğlu
ab84abd042 Fixed UML Diagram 2018-10-14 09:27:59 -04:00
Batuhan Berk Başoğlu
0d9cf73143 Fixed UML Diagram 2018-10-14 00:05:55 -04:00
Batuhan Berk Başoğlu
7cde8be55a Fixed UML Diagram 2018-10-14 00:02:58 -04:00
IvanaE
296aaf05e3 fixed merge conflict, when you pull check the right dependency is in your build.gradle file 2018-10-10 13:44:55 -04:00
IvanaE
1014a78de8 Merge pull request #1 from ebivibe/dbBranch
Added DBHelper for database access and DBTest. Added constructors, se…
2018-10-08 19:53:05 -04:00
Mary Tran
555932b877 Changed some unit test usernames to randomized string 2018-10-08 18:16:08 -04:00
Mary Tran
a80c6d37dc Added docs and ability to get a list of all users from database 2018-10-08 18:00:21 -04:00
Mary Tran
5a382baab4 Running unit tests with Robolectric instead of starting up emulator every time 2018-10-08 16:25:15 -04:00
Mary Tran
8ecd089fe3 Added DBHelper for database access and DBTest. Added constructors, setters, and getters to UserType classes 2018-10-08 11:48:58 -04:00
Batuhan Berk Başoğlu
bba1c248a1 fixed UML Class Diagram 2018-10-05 23:52:50 -04:00
Batuhan Berk Başoğlu
b22a32b4a2 Fixed UML Class Diagram 2018-10-05 23:51:28 -04:00
IvanaE
aa102421ef another text fix 2018-10-05 12:45:50 -04:00
IvanaE
e1b947ef43 fixed text 2018-10-05 12:45:07 -04:00
IvanaE
0499d81093 added borders 2018-10-05 12:38:13 -04:00
IvanaE
0b36bb32e3 added appointment class and finished ui 2018-10-05 12:35:05 -04:00
IvanaE
f299770923 Merge branch 'master' of https://github.com/ebivibe/SEG2105-Olympus 2018-10-05 11:57:47 -04:00
IvanaE
6b1ff038c8 created class files for UserType, User, ServiceProvider, Admin, Service 2018-10-05 11:57:32 -04:00
Batuhan Berk Başoğlu
bcfa204f44 fixed some file inconsistencies 2018-10-05 11:40:22 -04:00
Batuhan Berk Başoğlu
ac7e8aec0a fixed some file inconsistencies 2018-10-05 11:39:30 -04:00
Batuhan Berk Başoğlu
a9746fb215 Made the UML Class Diagram 2018-10-05 11:23:36 -04:00
Batuhan Berk Başoğlu
65bc8b2109 Made the UML Class Diagram 2018-10-05 11:20:01 -04:00
IvanaE
9cd853df11 fixed text colour 2018-10-04 14:14:59 -04:00
IvanaE
50b0fc49c1 Merge branch 'master' of https://github.com/ebivibe/SEG2105-Olympus 2018-10-04 13:24:26 -04:00
Batuhan Berk Başoğlu
0aed26f071 I made a empty file for UML Class 2018-09-28 22:23:37 -04:00
64 changed files with 1837 additions and 59 deletions

BIN
Deliverable1.zip Normal file

Binary file not shown.

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WizardSettings">
<option name="children">
<map>
<entry key="vectorWizard">
<value>
<PersistentState />
</value>
</entry>
</map>
</option>
</component>
</project>

View 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_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View file

@ -16,6 +16,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
dependencies {
@ -24,10 +29,15 @@ dependencies {
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:4.0-alpha-3-SNAPSHOT'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
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" }
}

View file

@ -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,20 @@
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:screenOrientation="portrait" />
<activity
android:name=".LogIn"
android:screenOrientation="portrait" />
<activity
android:name=".Welcome"
android:screenOrientation="portrait" />
<activity
android:name=".AdminWelcome"
android:screenOrientation="portrait" />
<activity android:name=".UsersList" />
<activity android:name=".ServicesList"></activity>
</application>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -0,0 +1,10 @@
package com.uottawa.olympus.olympusservices;
public class Admin extends UserType {
Admin(){
super("admin", "admin", "Admin", "Admin");
}
public String getRole(){ return "Admin"; }
}

View file

@ -0,0 +1,33 @@
package com.uottawa.olympus.olympusservices;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class AdminWelcome extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_welcome);
}
@Override
public void onBackPressed(){
}
public void LogOut(View view){
Intent intent = new Intent(getApplicationContext(), Main.class);
startActivity(intent);
finish();
}
public void goToUsers(View view){
Intent intent = new Intent(getApplicationContext(), UsersList.class);
startActivity(intent);
}
public void goToServices(View view){
Intent intent = new Intent(getApplicationContext(), ServicesList.class);
startActivity(intent);
}
}

View file

@ -0,0 +1,6 @@
package com.uottawa.olympus.olympusservices;
public class Appointment {
Service service;
ServiceProvider provider;
}

View file

@ -0,0 +1,385 @@
package com.uottawa.olympus.olympusservices;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.Cursor;
import android.content.ContentValues;
import java.util.LinkedList;
import java.util.List;
/**
* The class DBHelper allows the Android application to access and perform
* CRUD (Create, Read, Update, Delete) operations on the tables of the SQLite database.
* There is currently one table of all users' login information and names.
* Table of service providers and services to come soon.
*
* To use, create an object of this class with the current activity as context.
*
*/
public class DBHelper extends SQLiteOpenHelper {
//version of db used for update method
private static final int DB_VERSION = 2;
//name of db in app data
private static final String DB_NAME = "UsersDB.db";
//SQLiteDatabase for reading
private static SQLiteDatabase readDB;
//SQLiteDatabase for writing
private static SQLiteDatabase writeDB;
//name of table containing user login information and names
private static final String TABLE_LOGIN = "userInfo";
//columns of TABLE_LOGIN
private static final String COLUMN_USERNAME = "username";
private static final String COLUMN_PASSWORD = "password";
private static final String COLUMN_FIRSTNAME = "firstName";
private static final String COLUMN_LASTNAME = "lastName";
private static final String COLUMN_USERTYPE = "userType";
// private static final String TABLE_SERVICEPROVIDERS = "serviceProviders";
//name of table containing services and rates
private static final String TABLE_SERVICES = "services";
//columns of TABLE_LOGIN
private static final String COLUMN_SERVICE = "service";
private static final String COLUMN_RATE = "rate";
/**
* Creates an instance of DBHelper to allow activities to access and
* perform CRUD operations on the database via DBHelper's methods
*
* @param context current activity calling DBHelper
*/
public DBHelper(Context context){
super(context, DB_NAME, null, DB_VERSION);
//since these methods take a while we will call them once and store the returned dbs
readDB = this.getReadableDatabase();
writeDB = this.getWritableDatabase();
//pre-add the admin user
addUser(new Admin());
}
@Override
public void onCreate(SQLiteDatabase db){
//making the table containing user login information
String CREATE_LOGIN_TABLE = "CREATE TABLE "+ TABLE_LOGIN + "("
+ COLUMN_USERNAME + " TEXT UNIQUE NOT NULL PRIMARY KEY ON CONFLICT ROLLBACK,"
+ COLUMN_PASSWORD + " TEXT NOT NULL,"
+ COLUMN_FIRSTNAME + " TEXT DEFAULT 'FirstName',"
+ COLUMN_LASTNAME + " TEXT DEFAULT 'LastName',"
+ COLUMN_USERTYPE + " TEXT NOT NULL" + ")";
db.execSQL(CREATE_LOGIN_TABLE);
//making the table containing services and their rates
String CREATE_SERVICES_TABLE = "CREATE TABLE "+ TABLE_SERVICES + "("
+ COLUMN_SERVICE + " TEXT UNIQUE NOT NULL PRIMARY KEY ON CONFLICT ROLLBACK,"
+ COLUMN_RATE + " REAL DEFAULT 0.0" + ")";
db.execSQL(CREATE_SERVICES_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion){
switch(oldVersion){
case 1: //going from db version 1 to 2
//change usertype of Users to Homeowner
ContentValues values = new ContentValues();
values.put(COLUMN_USERTYPE, "HomeOwner");
db.update(TABLE_LOGIN, values, COLUMN_USERTYPE + " = ?", new String[]{"User"});
//if services table is not created, create it
db.execSQL("CREATE TABLE IF NOT EXISTS "+ TABLE_SERVICES + "("
+ COLUMN_SERVICE + " TEXT UNIQUE NOT NULL PRIMARY KEY ON CONFLICT ROLLBACK,"
+ COLUMN_RATE + " REAL DEFAULT 0.0" + ")");
}
}
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onUpgrade(db, oldVersion, newVersion);
}
//methods for table of users
/**
* Adds a user to the database. Returns false if there is a user already
* existing in the database with the same username. Returns true if
* successful in adding user to database.
*
* @param userType user to be added
* @return whether adding user was successful
*/
public boolean addUser(UserType userType){
//Check for duplicate username by querying login table
Cursor cursor = writeDB.query(TABLE_LOGIN,
new String[] {COLUMN_USERNAME},
COLUMN_USERNAME + " = ?",
new String[]{userType.getUsername()},
null, null, null,
"1");
//If cursor has 1+ elements in it, username already exists in table
if (cursor != null && cursor.getCount() > 0){
cursor.close();
return false;
}
cursor.close();
ContentValues values = new ContentValues();
values.put(COLUMN_USERNAME, userType.getUsername());
values.put(COLUMN_PASSWORD, userType.getPassword());
values.put(COLUMN_FIRSTNAME, userType.getFirstname());
values.put(COLUMN_LASTNAME, userType.getLastname());
values.put(COLUMN_USERTYPE, userType.getClass().getSimpleName());
writeDB.insert(TABLE_LOGIN, null, values);
return true;
}
/**
* Looks in database for user with requested username, and returns an
* object of UserType corresponding to said user's role.
* Returns null if no such user found.
*
* @param username username to look up
* @return object representing user found
*/
public UserType findUserByUsername(String username){
UserType usertype;
Cursor cursor = readDB.rawQuery("SELECT * FROM " + TABLE_LOGIN
+ " WHERE " + COLUMN_USERNAME + " = ?",
new String[]{username});
if (cursor.moveToFirst()){
String password = cursor.getString(1);
String firstname = cursor.getString(2);
String lastname = cursor.getString(3);
if (cursor.getString(4)
.equals("Admin")){
usertype = new Admin();
} else if (cursor.getString(4)
.equals("ServiceProvider")){
usertype = new ServiceProvider(username, password, firstname, lastname);
} else {
usertype = new HomeOwner(username, password, firstname, lastname);
}
} else {
usertype = null;
}
cursor.close();
return usertype;
}
/**
* Updates user login information and name for user with requested username.
* Returns true if a user of said username was found and entry updated.
* Returns false if no user was found of said username.
*
*
* @param username username of entry to update
* @param password new password
* @param firstname new first name
* @param lastname new last name
*
* @return whether updating user information was successful
*/
public boolean updateUserInfo(String username, String password, String firstname, String lastname){
ContentValues values = new ContentValues();
values.put(COLUMN_PASSWORD, password);
values.put(COLUMN_FIRSTNAME, firstname);
values.put(COLUMN_LASTNAME, lastname);
return writeDB.update(TABLE_LOGIN, values, COLUMN_USERNAME+" = ?",
new String[]{username}) > 0;
}
/**
* Looks in database for user with requested username, and deletes the corresponding
* entry. Returns true if a user was deleted, false otherwise.
*
* @param username username of entry to delete
* @return whether a user was deleted
*/
public boolean deleteUser(String username) {
return writeDB.delete(TABLE_LOGIN, COLUMN_USERNAME+" = ?",
new String[]{username}) > 0;
}
/**
* Returns a list of String arrays containing the username, first name,
* last name, and user type of every user in TABLE_LOGIN.
*
* @return list of arrays of [username, first name, last name, user type]
*/
public List<String[]> getAllUsers(){
return getAll("SELECT " + COLUMN_USERNAME + ", "
+ COLUMN_FIRSTNAME + ", "
+ COLUMN_LASTNAME + ", "
+ COLUMN_USERTYPE
+ " FROM "+TABLE_LOGIN);
}
//methods for table of services
/**
* Adds a service to the database. Returns false if service already
* exists in the database.
* Returns true if successful in adding service to database.
*
* @param service service to be added
* @return whether adding service was successful
*/
public boolean addService(Service service){
//Check for duplicate username by querying login table
Cursor cursor = writeDB.query(TABLE_SERVICES,
new String[] {COLUMN_SERVICE},
COLUMN_SERVICE + " = ?",
new String[]{service.getName()},
null, null, null,
"1");
//If cursor has 1+ elements in it, username already exists in table
if (cursor != null && cursor.getCount() > 0){
cursor.close();
return false;
}
cursor.close();
ContentValues values = new ContentValues();
values.put(COLUMN_SERVICE, service.getName());
values.put(COLUMN_RATE, service.getRate());
writeDB.insert(TABLE_SERVICES, null, values);
return true;
}
/**
* Looks in database for service with specified, and returns an
* object of Service if found.
* Returns null if no such service found.
*
* @param serviceName service to look up
* @return object representing service found
*/
public Service findService(String serviceName){
Service service;
Cursor cursor = readDB.rawQuery("SELECT * FROM " + TABLE_SERVICES
+ " WHERE " + COLUMN_SERVICE + " = ?",
new String[]{serviceName});
if (cursor.moveToFirst()){
String servName = cursor.getString(0);
double rate = cursor.getDouble(1);
service = new Service(servName, rate);
} else {
service = null;
}
cursor.close();
return service;
}
/**
* Updates service rate using a Service object.
* Returns true if a service was found and entry updated.
* Returns false if no service was found.
*
*
* @param service service object containing updated values
*
* @return whether updating service information was successful
*/
public boolean updateService(Service service){
ContentValues values = new ContentValues();
values.put(COLUMN_RATE, service.getRate());
return writeDB.update(TABLE_SERVICES, values, COLUMN_SERVICE+" = ?",
new String[]{service.getName()}) > 0;
}
/**
* Updates service rate using input of service name and rate.
* Returns true if a service was found and entry updated.
* Returns false if no service was found.
*
*
* @param name name of service
* @param rate rate of service
*
* @return whether updating service information was successful
*/
public boolean updateService(String name, double rate){
ContentValues values = new ContentValues();
if (rate > 0)
values.put(COLUMN_RATE, rate);
return writeDB.update(TABLE_SERVICES, values, COLUMN_SERVICE+" = ?",
new String[]{name}) > 0;
}
/**
* Looks in database for a service, and deletes the corresponding
* entry. Returns true if a user was deleted, false otherwise.
*
* @param service service of entry to delete
* @return whether the service was deleted
*/
public boolean deleteService(String service) {
return writeDB.delete(TABLE_SERVICES, COLUMN_SERVICE+" = ?",
new String[]{service}) > 0;
}
/**
* Returns a list of String arrays containing the service categories,
* names and hourly rates.
*
* @return list of arrays of [service, rate]
*/
public List<String[]> getAllServices(){
return getAll("SELECT * FROM " + TABLE_SERVICES);
}
/**
* Prints all entries of table. One row is printed per line. Columns are
* separated by spaces.
*
* @param tableName name of table to print
*/
void printTable(String tableName){
Cursor cursor = readDB.rawQuery("SELECT * FROM "+tableName, null);
cursor.moveToFirst();
for (int i = 0; i<cursor.getCount(); i++){
String[] columns = cursor.getColumnNames();
for (String name: columns) {
System.out.print(cursor.getString(cursor.getColumnIndex(name))+" ");
}
System.out.println();
cursor.moveToNext();
}
cursor.close();
}
private List<String[]> getAll(String rawQuery){
List<String[]> list = new LinkedList<>();
String[] infoArray;
Cursor cursor = readDB.rawQuery(rawQuery,null);
if (cursor.moveToFirst()) {
for (int i = 0; i < cursor.getCount(); i++) {
infoArray = new String[cursor.getColumnNames().length];
for (int j = 0; j < cursor.getColumnNames().length; j++) {
infoArray[j] = cursor.getString(j);
}
list.add(infoArray);
cursor.moveToNext();
}
}
cursor.close();
return list;
}
}

View file

@ -0,0 +1,68 @@
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;
public class EditServiceDialogFragment extends DialogFragment{
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");
}
}
@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();
//@anshu: get the name and rate to come from the dialog_service_new dialog
args.putString("name", (String)getArguments().get("name"));
args.putDouble("rate", 2.5);
//
EditServiceDialogFragment.this.setArguments(args);
mListener.onDialogEdit(EditServiceDialogFragment.this);
}
})
.setNegativeButton(R.string.delete, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Bundle args = new Bundle();
//@anshu: get the name and rate to come from the dialog_service_new dialog
args.putString("name", (String)getArguments().get("name"));
//
EditServiceDialogFragment.this.setArguments(args);
mListener.onDialogDelete(EditServiceDialogFragment.this);
}
})
.setTitle((String)getArguments().get("name"));
return builder.create();
}
}

View file

@ -0,0 +1,12 @@
package com.uottawa.olympus.olympusservices;
public class HomeOwner extends UserType {
HomeOwner(String username, String password, String firstname, String lastname){
super(username, password, firstname, lastname);
}
public String getRole(){ return "HomeOwner"; }
}

View file

@ -2,6 +2,10 @@ 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;
public class LogIn extends AppCompatActivity {
@ -10,4 +14,54 @@ public class LogIn extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_log_in);
}
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) &&
user.getPassword().equals(password)) {
if(user.getRole()=="Admin"){
Intent intent = new Intent(getApplicationContext(),AdminWelcome.class);
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();
}
}
@Override
public void onBackPressed(){
Intent intent = new Intent(getApplicationContext(), Main.class);
startActivity(intent);
finish();
}
}

View file

@ -11,7 +11,24 @@ public class Main extends AppCompatActivity {
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);
}
}
public void onClickSignUp(View view){
Intent intent = new Intent(getApplicationContext(),SignUp.class);
startActivity(intent);
finish();
}
public void onClickLogIn(View view){
Intent intent = new Intent(getApplicationContext(),LogIn.class);
startActivity(intent);
finish();
}
}

View file

@ -0,0 +1,10 @@
package com.uottawa.olympus.olympusservices;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

View file

@ -0,0 +1,63 @@
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;
public class NewServiceDialogFragment extends DialogFragment {
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");
}
}
@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_new, null))
// Add action buttons
.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
Bundle args = new Bundle();
//@anshu: get the name and rate to come from the dialog_service_new dialog
args.putString("name", "test2");
args.putDouble("rate", 2.5);
///
NewServiceDialogFragment.this.setArguments(args);
mListener.onDialogNew(NewServiceDialogFragment.this);
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
NewServiceDialogFragment.this.getDialog().cancel();
}
});
return builder.create();
}
}

View file

@ -0,0 +1,46 @@
package com.uottawa.olympus.olympusservices;
import java.util.ArrayList;
import java.util.List;
public class Service {
private String name;
private double rate;
private List<ServiceProvider> serviceProviders;
Service(String name, double rate) {
this.name = name;
this.rate = rate;
serviceProviders = new ArrayList<ServiceProvider>();
}
public String getName() {
return name;
}
public double getRate() {
return rate;
}
public void setName(String name) {
this.name = name;
}
public void setRate(double rate) {
this.rate = rate;
}
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;
}
}

View file

@ -0,0 +1,31 @@
package com.uottawa.olympus.olympusservices;
import java.util.ArrayList;
import java.util.List;
public class ServiceProvider extends UserType {
private List<Service> services;
ServiceProvider(String username, String password, String firstname, String lastname){
super(username, password, firstname, lastname);
services = new ArrayList<>();
}
public String getRole(){ return "ServiceProvider"; }
public boolean addService(Service service){
for (Service listService : services){
if (service.getName().equals(listService.getName())){
return false;
}
}
services.add(service);
return true;
}
public List<Service> getServices(){
return services;
}
}

View file

@ -0,0 +1,164 @@
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.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.TextView;
import java.util.Iterator;
import java.util.List;
public class ServicesList extends AppCompatActivity implements NewServiceDialogFragment.NoticeDialogListener, EditServiceDialogFragment.NoticeDialogListener{
private RecyclerView mRecyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_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);
}
public void addService(View view) {
DialogFragment newFragment = new NewServiceDialogFragment();
newFragment.show(getSupportFragmentManager(), "addService");
}
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
@Override
public void onDialogNew(DialogFragment dialog) {
DBHelper dbHelper = new DBHelper(this);
String name = (String)dialog.getArguments().get("name");
Double rate = (Double)dialog.getArguments().get("rate");
dbHelper.addService(new Service(name,rate));
dialog.dismiss();
this.recreate();
}
//user clicked cancel
@Override
public void onDialogNevermind(DialogFragment dialog) {
}
//edits service with info from dialog
@Override
public void onDialogEdit(DialogFragment dialog) {
DBHelper dbHelper = new DBHelper(this);
String name = (String)dialog.getArguments().get("name");
Double rate = (Double)dialog.getArguments().get("rate");
dbHelper.updateService(new Service(name,rate));
dialog.dismiss();
this.recreate();
}
//deletes service with info from dialog
@Override
public void onDialogDelete(DialogFragment dialog) {
DBHelper dbHelper = new DBHelper(this);
String name = (String)dialog.getArguments().get("name");
dbHelper.deleteService(name);
dialog.dismiss();
this.recreate();
}
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ServicesHolder> {
private Service[] services;
private Context context;
// Provide a reference to the views for each data item
// Complex data items may need more than one view per item, and
// you provide access to all the views for a data item in a view holder
// Provide a suitable constructor (depends on the kind of dataset)
public MyAdapter(Service[] services, Context context) {
this.services = services;
}
// Create new views (invoked by the layout manager)
@NonNull
@Override
public ServicesHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.list_item, parent, false);
ServicesHolder vh = new ServicesHolder(v);
return vh;
}
// Replace the contents of a view (invoked by the layout manager)
@Override
public void onBindViewHolder(ServicesHolder holder, int position) {
Service service = services[position];
holder.name.setText(service.getName());
holder.rate.setText(""+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);
}
}
}
}

View file

@ -4,6 +4,10 @@ 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;
public class SignUp extends AppCompatActivity {
@Override
@ -11,15 +15,65 @@ public class SignUp extends AppCompatActivity {
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){
}
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);
//TODO add message conditional to check if every EditText is filled up to standards
if(username.length()>=5 && password.length()>5 && firstname.length()>0 && lastname.length()>0 && username.matches("[a-zA-Z0-9]*") && password.matches("[a-zA-Z0-9]*")
&& firstname.matches("[a-zA-Z]*") && lastname.matches("[a-zA-Z]*")){
switch(spinner.getText().toString()){
case "Home Owner":
newUser = new HomeOwner(username,password,firstname,lastname);
break;
case "Service Provider":
newUser = new ServiceProvider(username,password,firstname,lastname);
break;
default:
newUser = new HomeOwner(username,password,firstname,lastname); //if nothing is enter then defaults to user role.
break;
}
DBHelper dbHelper = new DBHelper(this);
Intent intent = new Intent(getApplicationContext(),LogIn.class); //TODO check if signup should take to the login page or automatically login
if(dbHelper.addUser(newUser)){
startActivity(intent);
finish();
}else{
Toast.makeText(this,"Username is taken",Toast.LENGTH_LONG).show();
}
}
else if(firstname.length()==0 || lastname.length()==0 || username.length()==0 || password.length()==0){
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();
}
}
@Override
public void onBackPressed(){
Intent intent = new Intent(getApplicationContext(), Main.class);
startActivity(intent);
finish();
}
}

View file

@ -0,0 +1,81 @@
package com.uottawa.olympus.olympusservices;
import java.io.Serializable;
public abstract class UserType {
String username;
String password;
String firstname;
String lastname;
UserType(String username, String password, String firstname, String lastname){
this.username = username;
this.password = password;
this.firstname = firstname;
this.lastname = lastname;
}
public abstract String getRole();
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getFirstname() {
return firstname;
}
public String getLastname() {
return lastname;
}
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;
}
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.password = password;
}
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;
}
public boolean equals(UserType other){
if(this.username.equals(other.username)&&this.password.equals(other.password)&&
this.firstname.equals(other.firstname)&&this.lastname.equals(other.lastname)){
return true;
}
return false;
}
}

View file

@ -0,0 +1,33 @@
package com.uottawa.olympus.olympusservices;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import java.util.Iterator;
import java.util.List;
public class UsersList extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_users_list);
DBHelper dbHelper = new DBHelper(this);
List<String[]> users = dbHelper.getAllUsers();
String[] usernames = new String[(users.size()+1)*2];
usernames[0] = "Username";
usernames[1] = "User Type";
Iterator iter = users.iterator();
for (int i=0; i<users.size();i++){
String[] current = (String[])iter.next();
usernames[(i+1)*2] = current[0];
usernames[(i+1)*2+1] = current[3];
}
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.simple_list_item_1_customized, usernames);
GridView gridView = findViewById(R.id.Users);
gridView.setAdapter(adapter);
}
}

View file

@ -2,6 +2,9 @@ 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;
public class Welcome extends AppCompatActivity {
@ -9,5 +12,26 @@ public class Welcome extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
Bundle bundle = getIntent().getExtras();
String username = bundle.getString("username");
DBHelper dbHelper = new DBHelper(this);
UserType user;
user = dbHelper.findUserByUsername(username);
TextView role = findViewById(R.id.Role);
TextView name = findViewById(R.id.name);
role.setText(user.getRole());
name.setText(user.getFirstname());
}
@Override
public void onBackPressed(){
}
public void LogOut(View view){
Intent intent = new Intent(getApplicationContext(), Main.class);
startActivity(intent);
finish();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -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=".Welcome">
<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="wrap_content"
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="wrap_content"
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="wrap_content"
android:layout_marginTop="50dp"
android:onClick="LogOut"
android:text="Logout"
android:theme="@style/AppTheme.Button" />
</LinearLayout>

View file

@ -13,4 +13,62 @@
android:background="@drawable/background"
tools:context=".LogIn">
<TextView
android:id="@+id/Title"
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginBottom="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="wrap_content"
android:layout_marginTop="40dp"
android:onClick="onClickLogIn"
android:text="@string/login"
android:theme="@style/AppTheme.Button" />
</LinearLayout>

View file

@ -26,18 +26,20 @@
app:fontFamily="@font/julius_sans_one" />
<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:onClick="onClickSignUp"
android:text="@string/signup"
android:theme="@style/AppTheme.Button" />
<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:onClick="onClickLogIn"
android:text="@string/login"
android:theme="@style/AppTheme.Button" />
</LinearLayout>

View file

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/background"
tools:context=".ServicesList">
<TextView
android:id="@+id/Welcome"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="List of Services"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white"
android:textSize="20sp"
android:layout_marginTop="10dp"
app:fontFamily="@font/julius_sans_one" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="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="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: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="250dp"/>
</LinearLayout>
<Button
android:id="@+id/newService"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Add New Service"
android:onClick="addService"
android:theme="@style/AppTheme.Button" />
</LinearLayout>

View file

@ -16,78 +16,93 @@
<TextView
android:id="@+id/Title"
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginBottom="40dp"
android:layout_height="20dp"
android:layout_marginBottom="10dp"
android:gravity="center"
android:text="@string/signup"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white"
android:textSize="36sp"
android:textSize="15sp"
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>

View file

@ -0,0 +1,43 @@
<?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=".Welcome">
<TextView
android:id="@+id/Welcome"
android:layout_width="300dp"
android:layout_height="80dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="List of Users"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white"
android:textSize="20sp"
android:layout_marginTop="10dp"
app:fontFamily="@font/julius_sans_one" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<GridView
android:id="@+id/Users"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:numColumns="2"
android:textColor="@android:color/white"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>

View file

@ -13,4 +13,63 @@
android:background="@drawable/background"
tools:context=".Welcome">
<TextView
android:id="@+id/Welcome"
android:layout_width="300dp"
android:layout_height="80dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="Welcome"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white"
android:textSize="30sp"
android:layout_marginTop="50dp"
app:fontFamily="@font/julius_sans_one" />
<TextView
android:id="@+id/name"
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="FirstNameHere"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white"
android:textSize="20sp"
android:background="@drawable/customborder"
app:fontFamily="@font/julius_sans_one" />
<TextView
android:id="@+id/Roleis"
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="You are logged in as a"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white"
android:textSize="18sp"
app:fontFamily="@font/julius_sans_one" />
<TextView
android:id="@+id/Role"
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="Role Here"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white"
android:background="@drawable/customborder"
android:textSize="20sp"
app:fontFamily="@font/julius_sans_one" />
<Button
android:id="@+id/LogOut"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:onClick="LogOut"
android:text="Logout"
android:theme="@style/AppTheme.Button" />
</LinearLayout>

View file

@ -0,0 +1,27 @@
<?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"
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>

View file

@ -0,0 +1,42 @@
<?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"
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: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>

View file

@ -0,0 +1,31 @@
<?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="45dp"
android:clickable="true"
android:background="@drawable/customborder"
android:layout_marginBottom="5dp">
<TextView
android:paddingLeft="10dp"
android:paddingTop="8dp"
android:id="@+id/Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="@color/colorWhite"
android:textSize="15sp"/>
<TextView
android:id="@+id/Rate"
android:paddingLeft="10dp"
android:paddingTop="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="@color/colorWhite"
android:textSize="15sp"/>
</LinearLayout>

View file

@ -0,0 +1,15 @@
<?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:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="@android:color/white">
</TextView>

View file

@ -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>

View file

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -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>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View file

@ -19,6 +19,15 @@
<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="add">Add</string>
<string-array name="roles">
<item>Admin</item>
<item>User</item>

View file

@ -1,7 +1,7 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Base.Theme.AppCompat.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>

View file

@ -0,0 +1,214 @@
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 static org.junit.Assert.*;
@RunWith(RobolectricTestRunner.class)
@Config(packageName = "com.uottawa.olympus.olympusservices")
public class DBIntegrationTest {
private DBHelper dbHelper = new DBHelper(RuntimeEnvironment.application);
//testing user login table
@Test
public void testAdminExists(){
UserType dbUser = dbHelper.findUserByUsername("admin");
assertEquals("Admin", dbUser.getClass().getSimpleName());
assertEquals("admin", dbUser.getUsername());
assertEquals("admin", dbUser.getPassword());
assertEquals("Admin", dbUser.getFirstname());
assertEquals("Admin", dbUser.getLastname());
}
@Test
public void testAddAndDeleteUser(){
UserType originalUser, dbUser;
boolean deleted, addedOne, addedTwo;
originalUser = new HomeOwner("mgarzon", "soccer", "Miguel", "Garzon");
addedOne = dbHelper.addUser(originalUser);
dbUser = dbHelper.findUserByUsername("mgarzon");
assertEquals("HomeOwner", dbUser.getClass().getSimpleName());
assertEquals("mgarzon", dbUser.getUsername());
assertEquals("soccer", dbUser.getPassword());
assertEquals("Miguel", dbUser.getFirstname());
assertEquals("Garzon", dbUser.getLastname());
originalUser = new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman");
addedTwo = dbHelper.addUser(originalUser);
dbUser = dbHelper.findUserByUsername("jbO4aBF4dC");
assertEquals("ServiceProvider", dbUser.getClass().getSimpleName());
assertEquals("jbO4aBF4dC", dbUser.getUsername());
assertEquals("seg2105", dbUser.getPassword());
assertEquals("Juan", dbUser.getFirstname());
assertEquals("Guzman", dbUser.getLastname());
if (addedOne) {
deleted = dbHelper.deleteUser("mgarzon");
assertTrue(deleted);
}
if (addedTwo) {
deleted = dbHelper.deleteUser("jbO4aBF4dC");
assertTrue(deleted);
}
}
@Test
public void testAddDuplicateUsers(){
boolean added;
added = dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "soccer", "Miguel", "Garzon"));
assertTrue(added);
added = dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "seg2105", "Miguel", "Garzon"));
assertTrue(!added);
added = dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman"));
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("soccer", dbUser.getPassword());
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(){
dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "soccer", "Miguel", "Garzon"));
List<String[]> allUsers = dbHelper.getAllUsers();
for (String[] user : allUsers){
/* for (String s : user){
System.out.print(s + " ");
}
System.out.println();*/
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);
dbHelper.deleteService("Exterminating flatworms");
}
@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.deleteService("Exterminating flatworms");
}
@Test
public void testGetAllServices(){
dbHelper.addService(new Service("Exterminating flatworms", 20.00));
List<String[]> allServices = dbHelper.getAllServices();
for (String[] service : allServices){
/* for (String s : user){
System.out.print(s + " ");
}
System.out.println();*/
Service dbService = dbHelper.findService(service[0]);
assertEquals(dbService.getRate(), Double.parseDouble(service[1]), 0.001);
}
dbHelper.deleteService("Exterminating flatworms");
}
}

View file

@ -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

View file

@ -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

View file

@ -1,2 +1,3 @@
# SEG2105-Olympus
SEG2105 final project, Ivana Erlich, Anshu Sharma, Batuhan Basoglu, Mary Tran
https://github.com/ebivibe/SEG2105-Olympus

BIN
UML Class Diagram.docx Normal file

Binary file not shown.

BIN
~$L Class Diagram.docx Normal file

Binary file not shown.