added new activities, started find service provider
This commit is contained in:
parent
af48d1b905
commit
d15af93180
15 changed files with 414 additions and 62 deletions
Binary file not shown.
|
@ -25,7 +25,7 @@
|
|||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
android:name=".EditProfile"
|
||||
android:label="Edit Profile"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateHidden"/>
|
||||
android:windowSoftInputMode="stateHidden" />
|
||||
<activity
|
||||
android:name=".ServiceProviderServicesList"
|
||||
android:label="List of Services"
|
||||
|
@ -68,8 +68,11 @@
|
|||
<activity
|
||||
android:name=".ServiceProviderAvailabilities"
|
||||
android:label="Availabilities"
|
||||
android:screenOrientation="portrait"></activity>
|
||||
<activity android:name=".SignUpPart2"></activity>
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".SignUpPart2" />
|
||||
<activity android:name=".ServiceProviderBookings" />
|
||||
<activity android:name=".HomeOwnerBookings" />
|
||||
<activity android:name=".FindServiceProvider"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,156 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.Intent;
|
||||
import android.support.design.widget.Snackbar;
|
||||
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.RatingBar;
|
||||
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;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_find_service_provider);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
username = bundle.getString("username");
|
||||
|
||||
MaterialSpinner spinner = findViewById(R.id.RatingInput);
|
||||
spinner.setItems(1, 2, 3, 4, 5);
|
||||
|
||||
dbHelper = new DBHelper(this);
|
||||
MaterialSpinner spinner2 = findViewById(R.id.ServicesInput);
|
||||
|
||||
List<String[]> serviceslist = dbHelper.getAllServices();
|
||||
String[] services = new String[(serviceslist.size())];
|
||||
Iterator iter = serviceslist.iterator();
|
||||
for (int i=0; i<serviceslist.size();i++){
|
||||
String[] current = (String[])iter.next();
|
||||
services[i] = current[0];
|
||||
}
|
||||
spinner2.setItems(services);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed(){
|
||||
Intent intent = new Intent(getApplicationContext(),Welcome.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
public void Search(View 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);
|
||||
button.setText(month + " / " + (day) + " / "
|
||||
+ year);
|
||||
}
|
||||
|
||||
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
|
||||
datePickerDialog.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void onClickTime(View view){
|
||||
final Calendar c = Calendar.getInstance();
|
||||
int hour = c.get(Calendar.HOUR_OF_DAY);
|
||||
int minute = c.get(Calendar.MINUTE);
|
||||
final Button button = (Button)view;
|
||||
|
||||
// Launch Time Picker Dialog
|
||||
TimePickerDialog timePickerDialog = new TimePickerDialog(this,
|
||||
new TimePickerDialog.OnTimeSetListener() {
|
||||
|
||||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay,
|
||||
int minute) {
|
||||
String time = "";
|
||||
|
||||
button.setText(formatTime(hourOfDay,minute));
|
||||
//set availibility for service provider and check start time is less than finish
|
||||
}
|
||||
|
||||
}, hour, minute, false);
|
||||
timePickerDialog.show();
|
||||
|
||||
}
|
||||
|
||||
private String formatTime(int hours, int minutes){
|
||||
String time = "";
|
||||
if(hours<10){
|
||||
time = time+"0"+hours+":";
|
||||
}else{
|
||||
time = time+hours+":";
|
||||
}
|
||||
if (minutes<10){
|
||||
time = time+"0"+minutes;
|
||||
}
|
||||
else {
|
||||
time = time+minutes;
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
private int[] parseTime(String startTime, String endTime){
|
||||
int[] times = new int[4];
|
||||
if(startTime.equals("START")){
|
||||
times[0]=0;
|
||||
times[1]=0;
|
||||
}else{
|
||||
times[0] = Integer.parseInt(startTime.substring(0,2));
|
||||
times[1] = Integer.parseInt(startTime.substring(3));
|
||||
}
|
||||
if(endTime.equals("END")){
|
||||
times[2]=0;
|
||||
times[3]=0;
|
||||
}else{
|
||||
times[2] = Integer.parseInt(endTime.substring(0,2));
|
||||
times[3] = Integer.parseInt(endTime.substring(3));
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
private boolean validateTime(int[] time){
|
||||
if(time[0]==0&&time[1]==0&&time[2]==0&&time[3]==0){
|
||||
return true;
|
||||
}
|
||||
if(time[2]>time[0]){
|
||||
return true;
|
||||
}else{
|
||||
if(time[2]==time[0]&&time[3]>time[1]){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class HomeOwnerBookings extends AppCompatActivity {
|
||||
String username;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_home_owner_bookings);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
username = bundle.getString("username");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.uottawa.olympus.olympusservices;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class ServiceProviderBookings extends AppCompatActivity {
|
||||
String username;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_service_provider_bookings);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
username = bundle.getString("username");
|
||||
}
|
||||
|
||||
/**
|
||||
* Override so that previous screen refreshes when pressing the
|
||||
* back button on this activity of the app.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void onBackPressed(){
|
||||
Intent intent = new Intent(getApplicationContext(),ServiceProviderWelcome.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
|
@ -83,15 +83,6 @@ public class ServiceProviderServicesList extends AppCompatActivity implements De
|
|||
spinner.setItems(services);
|
||||
|
||||
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,8 +32,7 @@ public class ServiceProviderWelcome extends AppCompatActivity {
|
|||
UserType user;
|
||||
user = dbHelper.findUserByUsername(username);
|
||||
TextView welcome = findViewById(R.id.Welcome);
|
||||
welcome.setText("Welcome "+user.getFirstname()+ " you are logged in as a Service Provider");
|
||||
|
||||
welcome.setText("Welcome "+user.getFirstname()+ " you are logged in as a Home Owner");
|
||||
|
||||
|
||||
}
|
||||
|
@ -79,6 +78,12 @@ public class ServiceProviderWelcome extends AppCompatActivity {
|
|||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
public void SeeBookings(View view){
|
||||
Intent intent = new Intent(getApplicationContext(),ServiceProviderBookings.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.content.Intent;
|
|||
*
|
||||
*/
|
||||
public class Welcome extends AppCompatActivity {
|
||||
String username;
|
||||
|
||||
/**
|
||||
* On creation of this object the app will display the xml file for
|
||||
|
@ -26,14 +27,13 @@ public class Welcome extends AppCompatActivity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_welcome);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
String username = bundle.getString("username");
|
||||
username = bundle.getString("username");
|
||||
DBHelper dbHelper = new DBHelper(this);
|
||||
UserType user;
|
||||
user = dbHelper.findUserByUsername(username);
|
||||
TextView role = findViewById(R.id.Role);
|
||||
TextView name = findViewById(R.id.name);
|
||||
role.setText(user.getRole());
|
||||
name.setText(user.getFirstname());
|
||||
TextView welcome = findViewById(R.id.Welcome);
|
||||
welcome.setText("Welcome "+user.getFirstname()+ " you are logged in as a Service Provider");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -60,5 +60,19 @@ public class Welcome extends AppCompatActivity {
|
|||
finish();
|
||||
}
|
||||
|
||||
public void SeeBookings(View view){
|
||||
Intent intent = new Intent(getApplicationContext(),HomeOwnerBookings.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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
<?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"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/DatePick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="By Time:"
|
||||
android:paddingRight="20dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="15sp"/>
|
||||
<Button
|
||||
android:id="@+id/Start"
|
||||
android:layout_width="115dp"
|
||||
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="115dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="End"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickTime"
|
||||
android:layout_marginRight="5dp"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/Date"
|
||||
android:layout_width="235dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Date"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickDate"
|
||||
android:layout_gravity="end"/>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="5dp">
|
||||
<TextView
|
||||
android:id="@+id/RatingPick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="By Rating:"
|
||||
android:paddingRight="10dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<com.jaredrummler.materialspinner.MaterialSpinner
|
||||
android:id="@+id/RatingInput"
|
||||
android:layout_width="235dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="5dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/Search"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="45dp"
|
||||
android:text="Search"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="Search"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout 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"
|
||||
tools:context=".HomeOwnerBookings">
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout 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"
|
||||
tools:context=".ServiceProviderBookings">
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -57,6 +57,7 @@
|
|||
android:layout_height="60dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="Bookings"
|
||||
android:onClick="SeeBookings"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
<Button
|
||||
android:id="@+id/LogOut"
|
||||
|
|
|
@ -17,59 +17,44 @@
|
|||
android:id="@+id/Welcome"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:gravity="center"
|
||||
android:text="Welcome"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="50dp"
|
||||
app:fontFamily="@font/julius_sans_one" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:gravity="center"
|
||||
android:text="FirstNameHere"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="20sp"
|
||||
android:background="@drawable/customborder"
|
||||
android:layout_marginTop="10dp"
|
||||
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/Profile"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="Profile"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
<Button
|
||||
android:id="@+id/Find"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="Find a Service Provider"
|
||||
android:onClick="FindServiceProvider"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
<Button
|
||||
android:id="@+id/Bookings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="Bookings"
|
||||
android:onClick="SeeBookings"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
<Button
|
||||
android:id="@+id/LogOut"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:onClick="LogOut"
|
||||
android:text="Logout"
|
||||
android:theme="@style/AppTheme.Button" />
|
||||
|
||||
</LinearLayout>
|
|
@ -13,5 +13,10 @@
|
|||
<item name="android:textColor">@color/colorBlack</item>
|
||||
</style>
|
||||
|
||||
<style name="RatingBar" parent="Theme.AppCompat">
|
||||
<item name="colorControlNormal">@color/colorWhite</item>
|
||||
<item name="colorControlActivated">@color/colorWhite</item>
|
||||
</style>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue