final logic
This commit is contained in:
		
							parent
							
								
									ec9fabdef2
								
							
						
					
					
						commit
						1cedc6b92d
					
				
					 7 changed files with 13 additions and 49 deletions
				
			
		| 
						 | 
				
			
			@ -18,6 +18,8 @@ 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 {
 | 
			
		||||
| 
						 | 
				
			
			@ -41,10 +43,12 @@ public class Bookings extends AppCompatActivity {
 | 
			
		|||
        dbhelper = new DBHelper(this);
 | 
			
		||||
 | 
			
		||||
        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
 | 
			
		||||
        /* //mock data
 | 
			
		||||
        Booking[] bookings = {new Booking(5, 5, 6, 6, 2, 3, 2019, (ServiceProvider)dbhelper.findUserByUsername("testing"),
 | 
			
		||||
                (HomeOwner)dbhelper.findUserByUsername("tester"), dbhelper.findService("service1"))};
 | 
			
		||||
        */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,7 +85,14 @@ public class FindServiceProvider extends AppCompatActivity {
 | 
			
		|||
 | 
			
		||||
    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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,8 +82,6 @@ public class MakeBooking extends AppCompatActivity {
 | 
			
		|||
                    if (starth<endh || (starth==endh && startmin<endmin)){
 | 
			
		||||
                        DBHelper dbHelper = new DBHelper(this);
 | 
			
		||||
 | 
			
		||||
                        //check if sp is availible not just true
 | 
			
		||||
                        if(true) {
 | 
			
		||||
 | 
			
		||||
                            if (dbHelper.addBooking(serviceprovider, homeowner, service, year, month, day,
 | 
			
		||||
                                    starth, startmin, endh, endmin)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -96,7 +94,6 @@ public class MakeBooking extends AppCompatActivity {
 | 
			
		|||
                            } else {
 | 
			
		||||
                                Toast.makeText(this, "Booking could not be made", Toast.LENGTH_SHORT).show();
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue