Commit a75c49d8 authored by ejcris's avatar ejcris

No changes were made.

parent bd26fcdd
...@@ -37,11 +37,7 @@ ...@@ -37,11 +37,7 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<<<<<<< HEAD
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
=======
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
>>>>>>> d9d26fdd3d05d7a9728d40b1182198cc715c10ae
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
package com.example.pearlsantos.project; package com.example.pearlsantos.project;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
import android.content.SharedPreferences;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.DigitalClock; import android.widget.DigitalClock;
import android.widget.Spinner;
import android.widget.TextView;
import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import java.util.ArrayList;
import java.util.List;
/** /**
* A placeholder fragment containing a simple view. * A placeholder fragment containing a simple view.
*/ */
public class SearchFragment extends Fragment { public class SearchFragment extends Fragment {
SharedPreferences time;
public SearchFragment() { public SearchFragment() {
} }
...@@ -32,6 +46,58 @@ public class SearchFragment extends Fragment { ...@@ -32,6 +46,58 @@ public class SearchFragment extends Fragment {
} }
}); });
time = getContext().getSharedPreferences("bus", getContext().MODE_PRIVATE);
String hour = time.getString("hourOfDay", "");
String minute = time.getString("minute", "");
TextView from = (TextView) rootView.findViewById(R.id.fromSearch);
String fromSearch = from.toString().trim();
TextView to = (TextView) rootView.findViewById(R.id.toSearch);
String toSearch = to.toString().trim();
List<String> busCompanies = new ArrayList<>();
busCompanies.add("None");
Spinner s = (Spinner) rootView.findViewById(R.id.busLiners);
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(getContext(),
android.R.layout.simple_spinner_item, busCompanies);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
s.setAdapter(dataAdapter);
String bC = s.getSelectedItem().toString().trim();
ParseQuery<ParseObject> query = ParseQuery.getQuery("Schedule");
query.orderByAscending("departure");
query.whereContains("startingTerminal", fromSearch);
query.whereContains("destination", toSearch);
query.whereContains("busCompany", bC);
query.whereContains("departure", hour);
query.whereContains("arrival", minute);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> bC, ParseException e) {
if (e == null) {
Log.d("score", "Retrieved " + bC.size() + " scores");
} else {
Log.d("score", "Error: " + e.getMessage());
}
}
});
//
// String date = "2014-11-25 14:30";
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:MM");
// Date testDate = null;
// try {
// testDate = sdf.parse(date);
// }catch(Exception ex){
// ex.printStackTrace();
// }
// SimpleDateFormat formatter = new SimpleDateFormat("MM dd,yyyy hh:mm a");
// String newFormat = formatter.format(testDate);
// System.out.println(".....Date..."+newFormat);
return rootView; return rootView;
......
...@@ -2,6 +2,8 @@ package com.example.pearlsantos.project; ...@@ -2,6 +2,8 @@ package com.example.pearlsantos.project;
import android.app.Dialog; import android.app.Dialog;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
import android.content.SharedPreferences;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
...@@ -10,6 +12,8 @@ import android.view.Menu; ...@@ -10,6 +12,8 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import java.util.Calendar; import java.util.Calendar;
import java.util.Map;
import java.util.Set;
public class TimePicker extends DialogFragment implements TimePickerDialog.OnTimeSetListener { public class TimePicker extends DialogFragment implements TimePickerDialog.OnTimeSetListener {
...@@ -26,6 +30,11 @@ public class TimePicker extends DialogFragment implements TimePickerDialog.OnTim ...@@ -26,6 +30,11 @@ public class TimePicker extends DialogFragment implements TimePickerDialog.OnTim
@Override @Override
public void onTimeSet(android.widget.TimePicker view, int hourOfDay, int minute) { public void onTimeSet(android.widget.TimePicker view, int hourOfDay, int minute) {
SharedPreferences searchTime = getContext().getSharedPreferences("bus", getContext().MODE_PRIVATE);
SharedPreferences.Editor edit = searchTime.edit();
edit.putString("hourOfDay", Integer.toString(hourOfDay));
edit.putString("minute", Integer.toString(minute));
//hi EJ, I think this is where you put what you want to do with the time the user picks. Just tell me if you need help //hi EJ, I think this is where you put what you want to do with the time the user picks. Just tell me if you need help
//actually, here's one thing you can do, since I kinda forgot how to SharedPreferences //actually, here's one thing you can do, since I kinda forgot how to SharedPreferences
//1) get the time set using this time picker //1) get the time set using this time picker
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment