final logic

This commit is contained in:
Anshu Sharma 2018-12-02 12:08:04 -05:00
parent 8999a149cb
commit aa0e073669
7 changed files with 13 additions and 49 deletions

View file

@ -1,14 +0,0 @@
<?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>

View file

@ -1,29 +1,5 @@
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173"> <code_scheme name="Project" version="173">
<DBN-PSQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<Objective-C-extensions> <Objective-C-extensions>
<file> <file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" /> <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View file

@ -18,6 +18,8 @@ import android.widget.RadioGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
public class Bookings extends AppCompatActivity { public class Bookings extends AppCompatActivity {
@ -41,10 +43,12 @@ public class Bookings extends AppCompatActivity {
dbhelper = new DBHelper(this); dbhelper = new DBHelper(this);
List<Booking> booking = (List<Booking>)dbhelper.findBookings(username); List<Booking> booking = (List<Booking>)dbhelper.findBookings(username);
Collections.reverse(booking);
Booking[] bookings = new Booking[booking.size()]; Booking[] bookings = new Booking[booking.size()];
bookings = booking.toArray(bookings); 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"), Booking[] bookings = {new Booking(5, 5, 6, 6, 2, 3, 2019, (ServiceProvider)dbhelper.findUserByUsername("testing"),
(HomeOwner)dbhelper.findUserByUsername("tester"), dbhelper.findService("service1"))}; (HomeOwner)dbhelper.findUserByUsername("tester"), dbhelper.findService("service1"))};
*/ */

View file

@ -85,7 +85,14 @@ public class FindServiceProvider extends AppCompatActivity {
public void Reset(View 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 //clears recycler view
String[][] empty = {}; String[][] empty = {};
mAdapter = new MyAdapter(empty, this); mAdapter = new MyAdapter(empty, this);

View file

@ -82,8 +82,6 @@ public class MakeBooking extends AppCompatActivity {
if (starth<endh || (starth==endh && startmin<endmin)){ if (starth<endh || (starth==endh && startmin<endmin)){
DBHelper dbHelper = new DBHelper(this); DBHelper dbHelper = new DBHelper(this);
//check if sp is availible not just true
if(true) {
if (dbHelper.addBooking(serviceprovider, homeowner, service, year, month, day, if (dbHelper.addBooking(serviceprovider, homeowner, service, year, month, day,
starth, startmin, endh, endmin)) { starth, startmin, endh, endmin)) {
@ -96,7 +94,6 @@ public class MakeBooking extends AppCompatActivity {
} else { } else {
Toast.makeText(this, "Booking could not be made", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Booking could not be made", Toast.LENGTH_SHORT).show();
} }
}
} }