Compare commits
138 commits
Author | SHA1 | Date | |
---|---|---|---|
|
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 |
74 changed files with 427 additions and 5873 deletions
5
.github/FUNDING.yml
vendored
5
.github/FUNDING.yml
vendored
|
@ -1,5 +0,0 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: [batuhan-basoglu]
|
||||
ko_fi: batuhanbasoglu
|
||||
liberapay: batuhan-basoglu
|
41
.github/workflows/mirror.yml
vendored
41
.github/workflows/mirror.yml
vendored
|
@ -1,41 +0,0 @@
|
|||
name: 🪞 Push to Mirrors
|
||||
|
||||
on: [ push, delete, create ]
|
||||
|
||||
# Ensures that only one mirror task will run at a time.
|
||||
concurrency:
|
||||
group: git-mirror
|
||||
|
||||
jobs:
|
||||
gitlab:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Mirror to GitLab
|
||||
uses: wearerequired/git-mirror-action@v1
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.ACTIONS_SSH_KEY }}
|
||||
with:
|
||||
source-repo: "git@github.com:batuhan-basoglu/SEG2105-Olympus-Android-Application.git"
|
||||
destination-repo: "git@gitlab.com:batuhan-basoglu/SEG2105-Olympus-Android-Application.git"
|
||||
|
||||
codeberg:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Mirror to Codeberg
|
||||
uses: wearerequired/git-mirror-action@v1
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.ACTIONS_SSH_KEY }}
|
||||
with:
|
||||
source-repo: "git@github.com:batuhan-basoglu/SEG2105-Olympus-Android-Application.git"
|
||||
destination-repo: "git@codeberg.org:batuhan-basoglu/SEG2105-Olympus-Android-Application.git"
|
||||
|
||||
forgejo:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Mirror to Forgejo
|
||||
uses: wearerequired/git-mirror-action@v1
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.ACTIONS_SSH_KEY }}
|
||||
with:
|
||||
source-repo: "git@github.com:batuhan-basoglu/SEG2105-Olympus-Android-Application.git"
|
||||
destination-repo: "git@git.batuhan.basoglu.ca:batuhan-basoglu/SEG2105-Olympus-Android-Application.git"
|
BIN
Deliverable3.zip
BIN
Deliverable3.zip
Binary file not shown.
BIN
Deliverable4.zip
BIN
Deliverable4.zip
Binary file not shown.
674
LICENSE.md
674
LICENSE.md
|
@ -1,674 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
14
OlympusServices/.idea/assetWizardSettings.xml
Normal file
14
OlympusServices/.idea/assetWizardSettings.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="WizardSettings">
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="vectorWizard">
|
||||
<value>
|
||||
<PersistentState />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="1.8" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,18 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="/home2/arctichawk1/Projects/SEG2105-Olympus-Android-Application/OlympusServices" />
|
||||
<option value="/home2/arctichawk1/Projects/SEG2105-Olympus-Android-Application/OlympusServices/app" />
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BintrayJCenter" />
|
||||
<option name="name" value="BintrayJCenter" />
|
||||
<option name="url" value="https://jcenter.bintray.com/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google" />
|
||||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="$USER_HOME$/Android/Sdk/extras/google/m2repository" />
|
||||
<option name="name" value="$USER_HOME$/Android/Sdk/extras/google/m2repository" />
|
||||
<option name="url" value="file:$USER_HOME$/Android/Sdk/extras/google/m2repository" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="$USER_HOME$/Android/Sdk/extras/m2repository" />
|
||||
<option name="name" value="$USER_HOME$/Android/Sdk/extras/m2repository" />
|
||||
<option name="url" value="file:$USER_HOME$/Android/Sdk/extras/m2repository" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="$USER_HOME$/Android/Sdk/extras/android/m2repository" />
|
||||
<option name="name" value="$USER_HOME$/Android/Sdk/extras/android/m2repository" />
|
||||
<option name="url" value="file:$USER_HOME$/Android/Sdk/extras/android/m2repository" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven" />
|
||||
<option name="name" value="maven" />
|
||||
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||
|
@ -24,7 +25,7 @@
|
|||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="corretto-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">
|
||||
|
|
12
OlympusServices/.idea/runConfigurations.xml
Normal file
12
OlympusServices/.idea/runConfigurations.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,22 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class LogInTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<LogIn> mActivityTestRule = new ActivityTestRule<LogIn>(LogIn.class);
|
||||
|
||||
@Test
|
||||
public void checkSignIn() throws Exception{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static android.support.test.espresso.Espresso.onData;
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
|
||||
import static android.support.test.espresso.action.ViewActions.typeText;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withSpinnerText;
|
||||
import static java.util.regex.Pattern.matches;
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.core.AllOf.allOf;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class SignUpTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<SignUp> mActivityTestRule = new ActivityTestRule<SignUp>(SignUp.class);
|
||||
private SignUp mActivity=null;
|
||||
private TextView text;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
mActivity = mActivityTestRule.getActivity();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSignUp1() throws Exception{
|
||||
onView(withId(R.id.UsernameInput)).perform(typeText("John123"), closeSoftKeyboard());
|
||||
onView(withId(R.id.PasswordInput)).perform(typeText("1234567890"), closeSoftKeyboard());
|
||||
onView(withId(R.id.FirstNameInput)).perform(typeText("John"), closeSoftKeyboard());
|
||||
onView(withId(R.id.LastNameInput)).perform(typeText("Doe"), closeSoftKeyboard());
|
||||
onView(withId(R.id.SignUp)).perform(click());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSignUp2() throws Exception{
|
||||
onView(withId(R.id.RoleInput)).perform(click());
|
||||
onData(allOf(is(instanceOf(String.class)), is("Service Provider"))).perform(click());
|
||||
onView(withId(R.id.UsernameInput)).perform(typeText("Service123"), closeSoftKeyboard());
|
||||
onView(withId(R.id.PasswordInput)).perform(typeText("1234567890"), closeSoftKeyboard());
|
||||
onView(withId(R.id.FirstNameInput)).perform(typeText("Jane"), closeSoftKeyboard());
|
||||
onView(withId(R.id.LastNameInput)).perform(typeText("Doe"), closeSoftKeyboard());
|
||||
onView(withId(R.id.SignUp)).perform(click());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSignUp3() throws Exception{
|
||||
onView(withId(R.id.UsernameInput)).perform(typeText(""), closeSoftKeyboard());
|
||||
onView(withId(R.id.PasswordInput)).perform(typeText(""), closeSoftKeyboard());
|
||||
onView(withId(R.id.FirstNameInput)).perform(typeText(""), closeSoftKeyboard());
|
||||
onView(withId(R.id.LastNameInput)).perform(typeText(""), closeSoftKeyboard());
|
||||
onView(withId(R.id.SignUp)).perform(click());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSignUp4() throws Exception{
|
||||
onView(withId(R.id.UsernameInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
|
||||
onView(withId(R.id.PasswordInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
|
||||
onView(withId(R.id.FirstNameInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
|
||||
onView(withId(R.id.LastNameInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
|
||||
onView(withId(R.id.SignUp)).perform(click());
|
||||
}
|
||||
|
||||
public void checkSignUp5() throws Exception{
|
||||
onView(withId(R.id.UsernameInput)).perform(typeText("user"), closeSoftKeyboard());
|
||||
onView(withId(R.id.PasswordInput)).perform(typeText("pass"), closeSoftKeyboard());
|
||||
onView(withId(R.id.FirstNameInput)).perform(typeText("Honda"), closeSoftKeyboard());
|
||||
onView(withId(R.id.LastNameInput)).perform(typeText("Gokuchi"), closeSoftKeyboard());
|
||||
onView(withId(R.id.SignUp)).perform(click());
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
mActivity=null;
|
||||
}
|
||||
}
|
|
@ -57,10 +57,9 @@
|
|||
android:label="Welcome"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ServiceProviderEditProfile"
|
||||
android:name=".EditProfile"
|
||||
android:label="Edit Profile"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateHidden" />
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ServiceProviderServicesList"
|
||||
android:label="List of Services"
|
||||
|
@ -68,12 +67,8 @@
|
|||
<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>
|
||||
android:screenOrientation="portrait"></activity>
|
||||
<activity android:name=".SignUpPart2"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -17,10 +17,6 @@ public class Admin extends UserType {
|
|||
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
|
||||
|
|
|
@ -163,7 +163,7 @@ public class AdminServicesList extends AppCompatActivity implements NewServiceDi
|
|||
@Override
|
||||
public ServicesHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.service_list_item, parent, false);
|
||||
.inflate(R.layout.list_item, parent, false);
|
||||
ServicesHolder vh = new ServicesHolder(v);
|
||||
return vh;
|
||||
}
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -1,404 +0,0 @@
|
|||
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);
|
||||
|
||||
//get the list of bookings
|
||||
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"))};
|
||||
*/
|
||||
|
||||
//Make the recycler view show the bookings
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.Bookings);
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mAdapter = new MyAdapter(bookings, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
//remove or add cancelled booking depending on the switch position
|
||||
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);
|
||||
Collections.reverse(booking);
|
||||
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);
|
||||
Collections.reverse(booking);
|
||||
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(){
|
||||
//goes back to the appropriate screen depending on the type of user
|
||||
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) {
|
||||
//show different dialogs depending on the type of user
|
||||
//Service Provider can confirm or cancel while Home Owner can rate and comment, or cancel
|
||||
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{ //if user is a Home Owner
|
||||
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+",""));
|
||||
|
||||
//rating bar
|
||||
RadioGroup ratingselect = ((AlertDialog) arg0).findViewById(R.id.RatingSelect);
|
||||
int selectedId = ratingselect.getCheckedRadioButtonId();
|
||||
RadioButton ratingpicked;
|
||||
//comment field
|
||||
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{
|
||||
Toast.makeText(Bookings.this, "Rating and comment added", Toast.LENGTH_SHORT).show();
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* formats the time into a string
|
||||
* @param hours
|
||||
* @param minutes
|
||||
* @return
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a string into an array of ints representing times
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -8,18 +8,14 @@ import android.widget.CheckBox;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class ServiceProviderEditProfile extends AppCompatActivity {
|
||||
public class EditProfile 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);
|
||||
setContentView(R.layout.activity_edit_profile);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
username = bundle.getString("username");
|
||||
dbHelper = new DBHelper(this);
|
||||
|
@ -31,19 +27,18 @@ public class ServiceProviderEditProfile extends AppCompatActivity {
|
|||
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("");
|
||||
password.setText(user.getPassword());
|
||||
companyname.setText(user.getCompanyname());
|
||||
address.setText(user.getAddress());
|
||||
phonenumber.setText(user.getPhonenumber());
|
||||
description.setText(user.getDescription());
|
||||
licensed.setChecked(user.isLicensed());
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,11 +53,6 @@ public class ServiceProviderEditProfile extends AppCompatActivity {
|
|||
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);
|
||||
|
@ -70,12 +60,9 @@ public class ServiceProviderEditProfile extends AppCompatActivity {
|
|||
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
|
||||
if(password.getText().toString().length()>=5 && firstname.getText().toString().length()>0
|
||||
&& lastname.getText().toString().length()>0 && companyname.getText().toString().length()>0
|
||||
&& address.getText().toString().length()>0 && phonenumber.getText().toString().length()>0
|
||||
&& password.getText().toString().matches("[a-zA-Z0-9]*")
|
||||
|
@ -83,14 +70,11 @@ public class ServiceProviderEditProfile extends AppCompatActivity {
|
|||
&& 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
|
||||
address.getText().toString(), phonenumber.getText().toString(), companyname.getText().toString(), licensed.isChecked())){
|
||||
Toast.makeText(this, "Profile has been updated", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else{
|
||||
|
@ -100,7 +84,7 @@ public class ServiceProviderEditProfile extends AppCompatActivity {
|
|||
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Fields cannot be empty (other than description) and must be formatted correctly", Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(this, "Fields cannot be empty and must be formatted correctly", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,495 +0,0 @@
|
|||
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);
|
||||
|
||||
//populate the list of services
|
||||
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 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the filter fields
|
||||
* @param view
|
||||
*/
|
||||
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;
|
||||
//time and date picked
|
||||
if(!button.getText().toString().equals("Start") && !button2.getText().toString().equals("End")
|
||||
&& !button3.getText().toString().equals("Date")){
|
||||
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};
|
||||
//rating picked and time valid
|
||||
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);
|
||||
}
|
||||
//rating not picked and time valid
|
||||
else if(validateTime(times)){
|
||||
providers = dbHelper.getProvidersByTime(service, year, month, day,
|
||||
starth, startmin, endh, endmin);
|
||||
}
|
||||
//rating picked
|
||||
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);
|
||||
|
||||
}
|
||||
//no rating & time not valid
|
||||
else{
|
||||
Toast.makeText(this, "Times are invalid, only searching by service", Toast.LENGTH_SHORT).show();
|
||||
providers = dbHelper.getAllProvidersByService(service);
|
||||
|
||||
}
|
||||
}
|
||||
//time and date not picked
|
||||
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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to the MakeBooking activity with the booking info
|
||||
* @param serviceprovider
|
||||
*/
|
||||
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();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the DatePicker dialog
|
||||
* @param view
|
||||
*/
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the TimePicker dialog
|
||||
* @param view
|
||||
*/
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Format time into a string
|
||||
* @param hours
|
||||
* @param minutes
|
||||
* @return
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse time into an array of ints
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate times
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//adapter for the recycler view
|
||||
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);
|
||||
//show service provider info
|
||||
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();
|
||||
|
||||
//set the service provider info
|
||||
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);
|
||||
//list of comments and ratings
|
||||
ListView listView = (ListView) alertDialog.findViewById(R.id.RatingList);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -24,21 +24,6 @@ public class HomeOwner extends UserType {
|
|||
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".
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -44,8 +44,7 @@ public class LogIn extends AppCompatActivity {
|
|||
if (dbHelper.findUserByUsername(username) != null) {
|
||||
UserType user = dbHelper.findUserByUsername(username);
|
||||
if (user.getUsername().equals(username) &&
|
||||
PasswordEncryption.slowEquals(user.getHash(),
|
||||
PasswordEncryption.encrypt(password, user.getSalt()))) {
|
||||
user.getPassword().equals(password)) {
|
||||
if(user.getRole()=="Admin"){
|
||||
Intent intent = new Intent(getApplicationContext(),AdminWelcome.class);
|
||||
startActivity(intent);
|
||||
|
|
|
@ -1,247 +0,0 @@
|
|||
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 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", 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);
|
||||
|
||||
//check that fields are filled in
|
||||
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+",""));
|
||||
|
||||
//parse times
|
||||
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+",""));
|
||||
|
||||
//check date is valid
|
||||
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{
|
||||
//check time is valid
|
||||
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();
|
||||
//show the date picker
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* formats the time into a string
|
||||
* @param hours
|
||||
* @param minutes
|
||||
* @return
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a string into an array of ints representing times
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -29,8 +29,6 @@ public class ServiceProvider extends UserType {
|
|||
private String phonenumber;
|
||||
private String companyname;
|
||||
private boolean licensed;
|
||||
private String description;
|
||||
private int rating;
|
||||
|
||||
|
||||
|
||||
|
@ -46,23 +44,6 @@ public class ServiceProvider extends UserType {
|
|||
*/
|
||||
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];
|
||||
|
@ -70,37 +51,8 @@ public class ServiceProvider extends UserType {
|
|||
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.
|
||||
*
|
||||
|
@ -187,21 +139,4 @@ public class ServiceProvider extends UserType {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,72 +7,18 @@ 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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,6 +27,7 @@ public class ServiceProviderAvailabilities extends AppCompatActivity {
|
|||
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
|
||||
|
@ -90,9 +37,13 @@ public class ServiceProviderAvailabilities extends AppCompatActivity {
|
|||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay,
|
||||
int minute) {
|
||||
String time = "";
|
||||
if (minute==0){
|
||||
button.setText(hourOfDay + ":00");
|
||||
}
|
||||
else {
|
||||
button.setText(hourOfDay + ":" + minute);
|
||||
}
|
||||
|
||||
button.setText(formatTime(hourOfDay,minute));
|
||||
//set availibility for service provider and check start time is less than finish
|
||||
}
|
||||
|
||||
|
@ -102,78 +53,6 @@ public class ServiceProviderAvailabilities extends AppCompatActivity {
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -188,54 +67,4 @@ public class ServiceProviderAvailabilities extends AppCompatActivity {
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -39,7 +40,7 @@ public class ServiceProviderServicesList extends AppCompatActivity implements De
|
|||
|
||||
/**
|
||||
* On creation loads up the xml, and generates the services list,
|
||||
* and fills out the recylerView fields.
|
||||
* and fillsout the recylerView fields.
|
||||
*
|
||||
* @param savedInstanceState Bundle to transfer information.
|
||||
*/
|
||||
|
@ -80,8 +81,19 @@ public class ServiceProviderServicesList extends AppCompatActivity implements De
|
|||
String[] current = (String[])iter.next();
|
||||
services[i] = current[0];
|
||||
}
|
||||
spinner.setItems(services);
|
||||
ArrayAdapter<String> servicesadapter = new ArrayAdapter<String>
|
||||
(this, android.R.layout.simple_spinner_item, services);
|
||||
|
||||
servicesadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
|
||||
spinner.setAdapter(servicesadapter);
|
||||
|
||||
spinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
|
||||
|
||||
@Override public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
|
||||
Snackbar.make(view, "Clicked " + item, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
@ -176,7 +188,7 @@ public class ServiceProviderServicesList extends AppCompatActivity implements De
|
|||
@Override
|
||||
public ServicesHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.service_list_item, parent, false);
|
||||
.inflate(R.layout.list_item, parent, false);
|
||||
ServicesHolder vh = new ServicesHolder(v);
|
||||
return vh;
|
||||
}
|
||||
|
@ -198,7 +210,6 @@ public class ServiceProviderServicesList extends AppCompatActivity implements De
|
|||
return services.length;
|
||||
}
|
||||
|
||||
//nested class for the items in the recycler view
|
||||
class ServicesHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
|
||||
|
||||
TextView name;
|
||||
|
@ -210,11 +221,6 @@ public class ServiceProviderServicesList extends AppCompatActivity implements De
|
|||
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);
|
||||
|
|
|
@ -35,6 +35,7 @@ public class ServiceProviderWelcome extends AppCompatActivity {
|
|||
welcome.setText("Welcome "+user.getFirstname()+ " you are logged in as a Service Provider");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +61,7 @@ public class ServiceProviderWelcome extends AppCompatActivity {
|
|||
}
|
||||
|
||||
public void EditProfile(View view){
|
||||
Intent intent = new Intent(getApplicationContext(),ServiceProviderEditProfile.class);
|
||||
Intent intent = new Intent(getApplicationContext(),EditProfile.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
@ -78,12 +79,6 @@ public class ServiceProviderWelcome extends AppCompatActivity {
|
|||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
public void SeeBookings(View view){
|
||||
Intent intent = new Intent(getApplicationContext(),Bookings.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -54,8 +54,7 @@ public class SignUp extends AppCompatActivity {
|
|||
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]*")
|
||||
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);
|
||||
|
|
|
@ -32,17 +32,13 @@ public class SignUpPart2 extends AppCompatActivity {
|
|||
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) {
|
||||
&& phonenumber.matches("^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}$")) {
|
||||
|
||||
ServiceProvider serviceProvider = new ServiceProvider(username, password, firstname, lastname,
|
||||
address, phonenumber, companyname, licensed, description);
|
||||
address, phonenumber, companyname, licensed);
|
||||
if(dbHelper.addUser(serviceProvider)){
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
|
|
@ -13,14 +13,12 @@ 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 password attached to the userType.
|
||||
String password;
|
||||
//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;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -34,30 +32,9 @@ public abstract class UserType {
|
|||
*/
|
||||
UserType(String username, String password, String firstname, String lastname){
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,12 +54,12 @@ public abstract class UserType {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the hash field of userType.
|
||||
* Gets the password field of userType.
|
||||
*
|
||||
* @return String of the hash.
|
||||
* @return String of the password.
|
||||
*/
|
||||
public String getHash() {
|
||||
return hash;
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,15 +80,6 @@ public abstract class UserType {
|
|||
return lastname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the salt field of userType.
|
||||
*
|
||||
* @return String of salt
|
||||
*/
|
||||
public String getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the username field with given parameters.
|
||||
*
|
||||
|
@ -134,8 +102,7 @@ public abstract class UserType {
|
|||
//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);
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -163,9 +130,8 @@ public abstract class UserType {
|
|||
* @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)){
|
||||
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;
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
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;
|
||||
|
@ -32,98 +24,22 @@ public class UsersList extends AppCompatActivity {
|
|||
*
|
||||
* @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);
|
||||
DBHelper dbHelper = new DBHelper(this);
|
||||
List<String[]> users = dbHelper.getAllUsers();
|
||||
String[] usernames = new String[(users.size())];
|
||||
String[] usernames = new String[(users.size())*2];
|
||||
Iterator iter = users.iterator();
|
||||
for (int i=0; i<users.size();i++){
|
||||
String[] current = (String[])iter.next();
|
||||
usernames[(i)] = current[0];
|
||||
usernames[(i)*2] = current[0];
|
||||
usernames[(i)*2+1] = current[3];
|
||||
}
|
||||
|
||||
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.Users);
|
||||
|
||||
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
|
||||
mAdapter = new UsersList.MyAdapter(usernames, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.simple_list_item_1_customized, usernames);
|
||||
GridView gridView = findViewById(R.id.Users);
|
||||
gridView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import android.content.Intent;
|
|||
*
|
||||
*/
|
||||
public class Welcome extends AppCompatActivity {
|
||||
String username;
|
||||
|
||||
/**
|
||||
* On creation of this object the app will display the xml file for
|
||||
|
@ -27,13 +26,14 @@ public class Welcome extends AppCompatActivity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_welcome);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
username = bundle.getString("username");
|
||||
String 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");
|
||||
|
||||
TextView role = findViewById(R.id.Role);
|
||||
TextView name = findViewById(R.id.name);
|
||||
role.setText(user.getRole());
|
||||
name.setText(user.getFirstname());
|
||||
|
||||
|
||||
}
|
||||
|
@ -60,24 +60,5 @@ public class Welcome extends AppCompatActivity {
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?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>
|
|
@ -11,7 +11,7 @@
|
|||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/background"
|
||||
tools:context=".AdminWelcome">
|
||||
tools:context=".Welcome">
|
||||
<TextView
|
||||
android:id="@+id/Welcome"
|
||||
android:layout_width="300dp"
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/background"
|
||||
tools:context=".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>
|
|
@ -11,7 +11,7 @@
|
|||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/background"
|
||||
tools:context=".ServiceProviderEditProfile">
|
||||
tools:context=".EditProfile">
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
@ -105,20 +105,6 @@
|
|||
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
|
||||
|
@ -136,7 +122,7 @@
|
|||
android:textCursorDrawable="@color/colorWhite"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/Save"
|
||||
android:id="@+id/SignUp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Save"
|
|
@ -1,197 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/background"
|
||||
tools:context=".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>
|
|
@ -1,71 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/background"
|
||||
tools:context=".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>
|
|
@ -1,127 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/background"
|
||||
tools:context=".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>
|
|
@ -7,25 +7,18 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/background"
|
||||
tools:context=".ServiceProviderAvailabilities">
|
||||
|
||||
<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">
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Day"
|
||||
|
@ -354,16 +347,4 @@
|
|||
</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>
|
|
@ -57,7 +57,6 @@
|
|||
android:layout_height="60dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="Bookings"
|
||||
android:onClick="SeeBookings"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
<Button
|
||||
android:id="@+id/LogOut"
|
||||
|
|
|
@ -80,21 +80,6 @@
|
|||
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"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/background"
|
||||
tools:context=".UsersList">
|
||||
tools:context=".Welcome">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
|
@ -34,7 +34,7 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="15sp"
|
||||
android:paddingLeft="10dp"/>
|
||||
android:gravity="center"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Title2"
|
||||
|
@ -47,21 +47,19 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="15sp"
|
||||
android:gravity="end"
|
||||
android:paddingRight="10dp"/>
|
||||
android:gravity="center"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<GridView
|
||||
android:id="@+id/Users"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="450dp"
|
||||
android:numColumns="2"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="15sp"
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/Users"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -17,45 +17,59 @@
|
|||
android:id="@+id/Welcome"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:gravity="center"
|
||||
android:text="Welcome"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="20sp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="50dp"
|
||||
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" />
|
||||
<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="60dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:onClick="LogOut"
|
||||
android:text="Logout"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,210 +0,0 @@
|
|||
<?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>
|
|
@ -21,7 +21,7 @@
|
|||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Role"
|
||||
android:id="@+id/Rate"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="6dp"
|
|
@ -1,61 +0,0 @@
|
|||
<?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>
|
|
@ -1,91 +0,0 @@
|
|||
<?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>
|
|
@ -1,48 +0,0 @@
|
|||
<?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>
|
|
@ -8,13 +8,11 @@
|
|||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
|
||||
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
|
||||
android:paddingStart="30dp"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
||||
android:paddingBottom="5dp"
|
||||
android:textColor="@android:color/black"
|
||||
android:background="@color/colorWhite"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:textSize="15sp"
|
||||
|
||||
|
||||
>
|
||||
|
||||
|
|
|
@ -1,212 +0,0 @@
|
|||
<?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>
|
|
@ -13,11 +13,5 @@
|
|||
<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>
|
||||
|
|
|
@ -14,12 +14,13 @@ public class AdminTest {
|
|||
public void testAdmin() {
|
||||
Admin admin = new Admin();
|
||||
String username = admin.getUsername();
|
||||
String password = admin.getPassword();
|
||||
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", password);
|
||||
assertEquals("Admin", firstname);
|
||||
assertEquals("Admin", lastname);
|
||||
}
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
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());
|
||||
}
|
||||
}
|
|
@ -12,35 +12,23 @@ 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.getPassword());
|
||||
assertEquals("Admin", dbUser.getFirstname());
|
||||
assertEquals("Admin", dbUser.getLastname());
|
||||
assertEquals(PasswordEncryption.encrypt("admin", dbUser.getSalt()), dbUser.getHash());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -48,34 +36,29 @@ public class DBIntegrationTest {
|
|||
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("soccer", dbUser.getPassword());
|
||||
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("seg2105", dbUser.getPassword());
|
||||
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);
|
||||
|
@ -85,73 +68,16 @@ public class DBIntegrationTest {
|
|||
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",
|
||||
|
@ -173,6 +99,7 @@ public class DBIntegrationTest {
|
|||
dbUser = dbHelper.findUserByUsername("jbO4aBF4dC");
|
||||
|
||||
assertEquals("jbO4aBF4dC", dbUser.getUsername());
|
||||
assertEquals("soccer", dbUser.getPassword());
|
||||
assertEquals("Juan", dbUser.getFirstname());
|
||||
assertEquals("Guzman", dbUser.getLastname());
|
||||
|
||||
|
@ -185,12 +112,15 @@ public class DBIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void testGetAllUsers(){
|
||||
setUp(TestAfter.USER);
|
||||
dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "soccer", "Miguel", "Garzon"));
|
||||
|
||||
List<String[]> allUsers = dbHelper.getAllUsers();
|
||||
assertEquals(allUsers.size(), 5);
|
||||
|
||||
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]);
|
||||
|
@ -243,10 +173,8 @@ public class DBIntegrationTest {
|
|||
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();
|
||||
dbHelper.deleteService("Exterminating flatworms");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -263,39 +191,50 @@ public class DBIntegrationTest {
|
|||
assertEquals("exterminating flatworms", service.getName());
|
||||
assertEquals(25.00, service.getRate(), 0.001);
|
||||
|
||||
dbHelper.deleteAll();
|
||||
dbHelper.deleteService("Exterminating flatworms");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllServices(){
|
||||
setUp(TestAfter.SERVICE);
|
||||
dbHelper.addService(new Service("Exterminating flatworms", 20.00));
|
||||
|
||||
List<String[]> allServices = dbHelper.getAllServices();
|
||||
assertTrue(allServices.size() == 3);
|
||||
|
||||
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.deleteAll();
|
||||
dbHelper.deleteService("Exterminating flatworms");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndDeleteServiceProvidedByUser(){
|
||||
setUp(TestAfter.SERVICE);
|
||||
|
||||
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||
"testaddress", "8888888888", "companydotcom", true));
|
||||
dbHelper.addService(new Service("Hitman", 12358));
|
||||
boolean added = dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "hitman");
|
||||
assertTrue(added);
|
||||
boolean deleted = dbHelper.deleteServiceProvidedByUser("jbO4aBF4dC", "Hitman");
|
||||
assertTrue(deleted);
|
||||
|
||||
dbHelper.deleteAll();
|
||||
dbHelper.deleteUser("jbO4aBF4dC");
|
||||
dbHelper.deleteService("hitman");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllServicesProvidedByUserAndDeleteService(){
|
||||
setUp(TestAfter.LINK);
|
||||
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||
"testaddress", "8888888888", "companydotcom", true));
|
||||
|
||||
dbHelper.addService(new Service("Hitman", 12358));
|
||||
dbHelper.addService(new Service("Exterminating flatworms", 392.457));
|
||||
|
||||
dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "hitman");
|
||||
dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "exterminating flatworms");
|
||||
|
||||
List<String[]> servicesProvidedByUser = dbHelper.getAllServicesProvidedByUser("jbO4aBF4dC");
|
||||
assertEquals(2, servicesProvidedByUser.size());
|
||||
|
@ -312,59 +251,43 @@ public class DBIntegrationTest {
|
|||
servicesProvidedByUser = dbHelper.getAllServicesProvidedByUser("jbO4aBF4dC");
|
||||
assertEquals(0, servicesProvidedByUser.size());
|
||||
|
||||
dbHelper.deleteAll();
|
||||
dbHelper.deleteUser("jbO4aBF4dC");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllProvidersByService(){
|
||||
setUp(TestAfter.LINK);
|
||||
dbHelper.addService(new Service("Exterminating flatworms", 392.457));
|
||||
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||
"testaddress", "8888888888", "companydotcom", true));
|
||||
dbHelper.addUser(new ServiceProvider("7MuF1c59XP", null, null, null,
|
||||
"testaddress", "8888888888", "companydotcom", true));
|
||||
|
||||
dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "exterminating flatworms");
|
||||
dbHelper.addServiceProvidedByUser("7MuF1c59XP", "exterminating flatworms");
|
||||
|
||||
List<String[]> providersByService = dbHelper.getAllProvidersByService("exterminating flatworms");
|
||||
|
||||
assertEquals(2, providersByService.size());
|
||||
assertEquals("jbO4aBF4dC", providersByService.get(0)[0]);
|
||||
assertEquals("DW44FkUsX7", providersByService.get(1)[0]);
|
||||
assertEquals("7MuF1c59XP", providersByService.get(1)[0]);
|
||||
|
||||
dbHelper.deleteAll();
|
||||
dbHelper.deleteService("Exterminating flatworms");
|
||||
dbHelper.deleteUser("jbO4aBF4dC");
|
||||
dbHelper.deleteUser("7MuF1c59XP");
|
||||
}
|
||||
|
||||
|
||||
@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);
|
||||
serviceProvider.setAvailabilities(3, 8, 12, 15, 14);
|
||||
|
||||
//TODO:Perhaps implement a deep clone function for UserType?
|
||||
ServiceProvider serviceProvider2 = new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||
"testaddress", "8888888888", "companydotcom", true);
|
||||
serviceProvider2.setAvailabilities(0, 4, 18, 19, 30);
|
||||
serviceProvider2.setAvailabilities(1, 5, 20, 21, 11);
|
||||
serviceProvider2.setAvailabilities(3, 7, 12, 15, 14);
|
||||
serviceProvider2.setAvailabilities(4, 0, 0, 23, 29);
|
||||
serviceProvider2.setAvailabilities(3, 8, 12, 15, 14);
|
||||
|
||||
dbHelper.addUser(serviceProvider2);
|
||||
|
||||
|
@ -382,254 +305,7 @@ public class DBIntegrationTest {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,10 +14,9 @@ public class HomeOwnerTest {
|
|||
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("1234567890", user.getPassword());
|
||||
assertEquals("John", user.getFirstname());
|
||||
assertEquals("Doe", user.getLastname());
|
||||
user.setUsername( "username" );
|
||||
|
@ -25,10 +24,7 @@ public class HomeOwnerTest {
|
|||
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("1234567890", user.getPassword());
|
||||
assertNotEquals("John", user.getFirstname());
|
||||
assertNotEquals("Doe", user.getLastname());
|
||||
}
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
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));
|
||||
|
||||
}
|
||||
}
|
|
@ -17,21 +17,17 @@ public class ServiceProviderTest {
|
|||
|
||||
@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");
|
||||
assertEquals( "John123", serviceprovider.getUsername() );
|
||||
assertEquals( "1234567890", serviceprovider.getPassword() );
|
||||
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("1234567890", serviceprovider.getPassword());
|
||||
assertNotEquals("John", serviceprovider.getFirstname());
|
||||
assertNotEquals("Doe", serviceprovider.getLastname());
|
||||
}
|
||||
|
|
|
@ -6,12 +6,8 @@ import static org.junit.Assert.*;
|
|||
|
||||
public class ServiceProviderTest2 {
|
||||
ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe",
|
||||
"testaddress", "8888888888", "companydotcom", true, "LOL");
|
||||
"testaddress", "8888888888", "companydotcom", true);
|
||||
|
||||
|
||||
/**
|
||||
* sets availabilities and tests them.
|
||||
*/
|
||||
@Test
|
||||
public void testAvailabilities() {
|
||||
int [][] availability = new int[7][4];
|
||||
|
@ -24,26 +20,19 @@ public class ServiceProviderTest2 {
|
|||
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() );
|
||||
}
|
||||
}
|
|
@ -27,8 +27,8 @@ public class UserTypeTest {
|
|||
assertNotEquals( true, useradmin );
|
||||
assertNotEquals( true, serviceadmin );
|
||||
assertNotEquals( true, userservice );
|
||||
user = new HomeOwner(serviceprovider.getUsername(), serviceprovider.getHash(), serviceprovider.getSalt(),
|
||||
serviceprovider.getFirstname(), serviceprovider.getLastname());
|
||||
user.setFirstname(serviceprovider.getFirstname());
|
||||
user.setUsername(serviceprovider.getUsername());
|
||||
userservice = user.equals(serviceprovider);
|
||||
assertEquals( true, userservice );
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
|
|
@ -7,4 +7,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||
|
|
|
@ -3,8 +3,7 @@ class UserType
|
|||
firstname;
|
||||
lastname;
|
||||
username;
|
||||
salt;
|
||||
hash;
|
||||
password;
|
||||
}
|
||||
|
||||
class HomeOwner
|
||||
|
@ -19,14 +18,12 @@ address;
|
|||
int phonenumber;
|
||||
companyname;
|
||||
boolean licensed;
|
||||
description;
|
||||
isA UserType;
|
||||
}
|
||||
|
||||
class Admin
|
||||
{
|
||||
isA UserType;
|
||||
1 -- * Service;
|
||||
}
|
||||
|
||||
class Service
|
||||
|
@ -36,24 +33,7 @@ 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;
|
||||
}
|
||||
//$?[End_of_model]$?
|
||||
|
||||
class UserType
|
||||
{
|
||||
|
@ -73,21 +53,10 @@ class ServiceProvider
|
|||
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;
|
||||
position 853 422 112 75;
|
||||
position.association Service__ServiceProvider 65,0 61,126;
|
||||
}
|
41
README.md
41
README.md
|
@ -1,39 +1,8 @@
|
|||
# SEG2105-Olympus
|
||||
SEG2105 final project, Ivana Erlich, Anshu Sharma, Batuhan Berk Başoğlu, Mary Tran
|
||||
SEG2105 final project, Ivana Erlich, Anshu Sharma, Batuhan Basoglu, Mary Tran
|
||||
|
||||
https://git.batuhan.basoglu.ca/batuhan-basoglu/SEG2105-Olympus-Android-Application
|
||||
|
||||
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)
|
||||
|
||||
APK tested on a Sony Xperia XA2, model H3123
|
||||
|
||||
Admin account is precreated with username = admin, password = admin
|
||||
|
||||
|
||||
3 ServiceProvider accounts are precreated with
|
||||
username = testing, password = testing;
|
||||
username = testing1, password = testing;
|
||||
username = testing2, password = testing.
|
||||
Service providers are available for the entire day if they are available.
|
||||
There is at least one service provider available on any day.
|
||||
|
||||
|
||||
3 HomeOwner accounts are precreated with
|
||||
username = tester, password = tester;
|
||||
username = tester1, password = tester;
|
||||
username = tester2, password = tester
|
||||
|
||||
|
||||
10 services are precreated.
|
||||
All three service providers offer the Dragon Tamer service.
|
||||
No service provider offers the Maid or Butler services.
|
||||
At least one service provider offers the remaining services.
|
||||
|
||||
|
||||
10 bookings are precreated.
|
||||
All three service providers have been booked with the Dragon Tamer service.
|
||||
Only two home owners (tester and tester1) have made bookings.
|
||||
|
||||
THERE BE DRAGONS
|
||||
https://github.com/ebivibe/SEG2105-Olympus
|
||||
|
||||
Admin account is precreated with
|
||||
username = admin,
|
||||
password = admin
|
||||
|
|
BIN
Screenshots.zip
BIN
Screenshots.zip
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 113 KiB |
Binary file not shown.
Before Width: | Height: | Size: 102 KiB |
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue