added some new ui
This commit is contained in:
parent
9787466a06
commit
534bb270f4
7 changed files with 386 additions and 7 deletions
|
@ -60,9 +60,10 @@ public class FindServiceProvider extends AppCompatActivity {
|
||||||
spinner2.setItems(services);
|
spinner2.setItems(services);
|
||||||
|
|
||||||
|
|
||||||
//iffy code
|
//iffy code, update once we can pull the actual service providers
|
||||||
ServiceProvider provider = (ServiceProvider)dbHelper.findUserByUsername("testing");
|
ServiceProvider provider = (ServiceProvider)dbHelper.findUserByUsername("testing");
|
||||||
ServiceProvider[] providerslist = {provider};
|
ServiceProvider[] providerslist = {provider};
|
||||||
|
//iffy code ends here
|
||||||
|
|
||||||
mRecyclerView = (RecyclerView) findViewById(R.id.ServiceProviders);
|
mRecyclerView = (RecyclerView) findViewById(R.id.ServiceProviders);
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,26 @@
|
||||||
package com.uottawa.olympus.olympusservices;
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class HomeOwnerBookings extends AppCompatActivity {
|
public class HomeOwnerBookings 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;
|
String username;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,6 +29,16 @@ public class HomeOwnerBookings extends AppCompatActivity {
|
||||||
setContentView(R.layout.activity_home_owner_bookings);
|
setContentView(R.layout.activity_home_owner_bookings);
|
||||||
Bundle bundle = getIntent().getExtras();
|
Bundle bundle = getIntent().getExtras();
|
||||||
username = bundle.getString("username");
|
username = bundle.getString("username");
|
||||||
|
|
||||||
|
/*
|
||||||
|
Booking[] bookings;
|
||||||
|
//get bookings here
|
||||||
|
mRecyclerView = (RecyclerView) findViewById(R.id.Bookings);
|
||||||
|
mLayoutManager = new LinearLayoutManager(this);
|
||||||
|
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||||
|
mAdapter = new AdminServicesList.MyAdapter(booking, this);
|
||||||
|
mRecyclerView.setAdapter(mAdapter);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,4 +53,68 @@ public class HomeOwnerBookings extends AppCompatActivity {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
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.name.setText(booking.getServiceprovider());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 name;
|
||||||
|
TextView rate;
|
||||||
|
|
||||||
|
public BookingHolder(View row){
|
||||||
|
super(row);
|
||||||
|
name = row.findViewById(R.id.Name);
|
||||||
|
rate = row.findViewById(R.id.Rate);
|
||||||
|
row.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
TextView nameview = (TextView)view.findViewById(R.id.Name);
|
||||||
|
String name = nameview.getText().toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,44 @@
|
||||||
package com.uottawa.olympus.olympusservices;
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class ServiceProviderBookings extends AppCompatActivity {
|
public class ServiceProviderBookings 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;
|
String username;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_service_provider_bookings);
|
setContentView(R.layout.activity_home_owner_bookings);
|
||||||
Bundle bundle = getIntent().getExtras();
|
Bundle bundle = getIntent().getExtras();
|
||||||
username = bundle.getString("username");
|
username = bundle.getString("username");
|
||||||
|
|
||||||
|
/*
|
||||||
|
Booking[] bookings;
|
||||||
|
//get bookings here
|
||||||
|
mRecyclerView = (RecyclerView) findViewById(R.id.Bookings);
|
||||||
|
mLayoutManager = new LinearLayoutManager(this);
|
||||||
|
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||||
|
mAdapter = new AdminServicesList.MyAdapter(booking, this);
|
||||||
|
mRecyclerView.setAdapter(mAdapter);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,9 +48,73 @@ public class ServiceProviderBookings extends AppCompatActivity {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed(){
|
public void onBackPressed(){
|
||||||
Intent intent = new Intent(getApplicationContext(),ServiceProviderWelcome.class);
|
Intent intent = new Intent(getApplicationContext(),Welcome.class);
|
||||||
intent.putExtra("username", username);
|
intent.putExtra("username", username);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
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.name.setText(booking.getServiceprovider());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 name;
|
||||||
|
TextView rate;
|
||||||
|
|
||||||
|
public BookingHolder(View row){
|
||||||
|
super(row);
|
||||||
|
name = row.findViewById(R.id.Name);
|
||||||
|
rate = row.findViewById(R.id.Rate);
|
||||||
|
row.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
TextView nameview = (TextView)view.findViewById(R.id.Name);
|
||||||
|
String name = nameview.getText().toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<!--Border width and color-->
|
||||||
|
<stroke android:width="5px" android:color="#000000" />
|
||||||
|
</shape>
|
|
@ -1,9 +1,22 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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=".HomeOwnerBookings">
|
tools:context=".HomeOwnerBookings">
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/Bookings"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="500dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -1,9 +1,22 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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=".ServiceProviderBookings">
|
tools:context=".ServiceProviderBookings">
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/Bookings"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="500dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
166
OlympusServices/app/src/main/res/layout/booking_list_item.xml
Normal file
166
OlympusServices/app/src/main/res/layout/booking_list_item.xml
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
<?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">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/customborder2">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/ServiceProvider"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingTop="6dp"
|
||||||
|
android:layout_width="130dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
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="45dp"
|
||||||
|
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="45dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/customborder2">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/HomeOwner"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingTop="6dp"
|
||||||
|
android:layout_width="130dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
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="45dp"
|
||||||
|
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="45dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/customborder2">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Service"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingTop="6dp"
|
||||||
|
android:layout_width="130dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
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="45dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Service"
|
||||||
|
android:textColor="@color/colorBlack"
|
||||||
|
android:textSize="15sp"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/customborder2">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Date"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingTop="6dp"
|
||||||
|
android:layout_width="130dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:text="Date and Time:"
|
||||||
|
android:textColor="@color/colorBlack"
|
||||||
|
android:textSize="15sp"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/DateName"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingTop="6dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Date Start-End"
|
||||||
|
android:textColor="@color/colorBlack"
|
||||||
|
android:textSize="15sp"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/customborder2">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/Status"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingTop="6dp"
|
||||||
|
android:layout_width="130dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
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="45dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Status"
|
||||||
|
android:textColor="@color/colorBlack"
|
||||||
|
android:textSize="15sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
Loading…
Reference in a new issue