From 7bb04d516b8d51878df1fa0a05c064a2f281bf03 Mon Sep 17 00:00:00 2001 From: IvanaE Date: Sun, 18 Nov 2018 13:26:50 -0500 Subject: [PATCH] added new activities, started find service provider --- .../.idea/caches/build_file_checksums.ser | Bin 537 -> 537 bytes OlympusServices/.idea/misc.xml | 2 +- .../app/src/main/AndroidManifest.xml | 9 +- .../olympusservices/FindServiceProvider.java | 156 ++++++++++++++++++ .../olympusservices/HomeOwnerBookings.java | 30 ++++ .../ServiceProviderBookings.java | 30 ++++ .../ServiceProviderServicesList.java | 9 - .../ServiceProviderWelcome.java | 9 +- .../olympus/olympusservices/Welcome.java | 24 ++- .../layout/activity_find_service_provider.xml | 114 +++++++++++++ .../layout/activity_home_owner_bookings.xml | 9 + .../activity_service_provider_bookings.xml | 9 + .../activity_service_provider_welcome.xml | 1 + .../src/main/res/layout/activity_welcome.xml | 69 +++----- .../app/src/main/res/values/styles.xml | 5 + 15 files changed, 414 insertions(+), 62 deletions(-) create mode 100644 OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/FindServiceProvider.java create mode 100644 OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/HomeOwnerBookings.java create mode 100644 OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderBookings.java create mode 100644 OlympusServices/app/src/main/res/layout/activity_find_service_provider.xml create mode 100644 OlympusServices/app/src/main/res/layout/activity_home_owner_bookings.xml create mode 100644 OlympusServices/app/src/main/res/layout/activity_service_provider_bookings.xml diff --git a/OlympusServices/.idea/caches/build_file_checksums.ser b/OlympusServices/.idea/caches/build_file_checksums.ser index 1253c2cb9173d9cf31ec70bb61e561bbe6b0ed75..e4933e68ca1e5fc353dff424960e8942198bdfc8 100644 GIT binary patch delta 15 XcmbQqGLvP(3>NjXVh=XXsbvHJF2M#I delta 15 XcmbQqGLvP(3>G - + diff --git a/OlympusServices/app/src/main/AndroidManifest.xml b/OlympusServices/app/src/main/AndroidManifest.xml index fe68bbe..d915ea2 100644 --- a/OlympusServices/app/src/main/AndroidManifest.xml +++ b/OlympusServices/app/src/main/AndroidManifest.xml @@ -60,7 +60,7 @@ android:name=".EditProfile" android:label="Edit Profile" android:screenOrientation="portrait" - android:windowSoftInputMode="stateHidden"/> + android:windowSoftInputMode="stateHidden" /> - + android:screenOrientation="portrait" /> + + + + \ No newline at end of file diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/FindServiceProvider.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/FindServiceProvider.java new file mode 100644 index 0000000..5bc311c --- /dev/null +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/FindServiceProvider.java @@ -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 serviceslist = dbHelper.getAllServices(); + String[] services = new String[(serviceslist.size())]; + Iterator iter = serviceslist.iterator(); + for (int i=0; itime[0]){ + return true; + }else{ + if(time[2]==time[0]&&time[3]>time[1]){ + return true; + }else{ + return false; + } + } + } +} diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/HomeOwnerBookings.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/HomeOwnerBookings.java new file mode 100644 index 0000000..432bc80 --- /dev/null +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/HomeOwnerBookings.java @@ -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(); + } +} diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderBookings.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderBookings.java new file mode 100644 index 0000000..8d1ccff --- /dev/null +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderBookings.java @@ -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(); + } +} diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderServicesList.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderServicesList.java index 21b47d3..36105c0 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderServicesList.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderServicesList.java @@ -83,15 +83,6 @@ public class ServiceProviderServicesList extends AppCompatActivity implements De spinner.setItems(services); - - - spinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() { - - @Override public void onItemSelected(MaterialSpinner view, int position, long id, String item) { - Snackbar.make(view, "Clicked " + item, Snackbar.LENGTH_LONG).show(); - } - }); - } diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderWelcome.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderWelcome.java index efa2570..448c1d9 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderWelcome.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProviderWelcome.java @@ -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(); + } } diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Welcome.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Welcome.java index 24ac48c..a054142 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Welcome.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Welcome.java @@ -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(); + } + } diff --git a/OlympusServices/app/src/main/res/layout/activity_find_service_provider.xml b/OlympusServices/app/src/main/res/layout/activity_find_service_provider.xml new file mode 100644 index 0000000..16bf843 --- /dev/null +++ b/OlympusServices/app/src/main/res/layout/activity_find_service_provider.xml @@ -0,0 +1,114 @@ + + + + + + + + + +