Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uBus
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chiara Veronica Señires
uBus
Commits
a75c49d8
Commit
a75c49d8
authored
Nov 07, 2015
by
ejcris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No changes were made.
parent
bd26fcdd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
5 deletions
+76
-5
misc.xml
mobile-app/10-31-15/Project/.idea/misc.xml
+0
-4
SearchFragment.java
.../java/com/example/pearlsantos/project/SearchFragment.java
+67
-1
TimePicker.java
...main/java/com/example/pearlsantos/project/TimePicker.java
+9
-0
No files found.
mobile-app/10-31-15/Project/.idea/misc.xml
View file @
a75c49d8
...
...
@@ -37,11 +37,7 @@
<ConfirmationsSetting
value=
"0"
id=
"Add"
/>
<ConfirmationsSetting
value=
"0"
id=
"Remove"
/>
</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_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"
/>
</component>
<component
name=
"ProjectType"
>
...
...
mobile-app/10-31-15/Project/app/src/main/java/com/example/pearlsantos/project/SearchFragment.java
View file @
a75c49d8
package
com
.
example
.
pearlsantos
.
project
;
import
android.app.TimePickerDialog
;
import
android.content.SharedPreferences
;
import
android.support.v4.app.DialogFragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.FragmentActivity
;
import
android.support.v4.app.FragmentManager
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ArrayAdapter
;
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.
*/
public
class
SearchFragment
extends
Fragment
{
SharedPreferences
time
;
public
SearchFragment
()
{
}
...
...
@@ -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
;
...
...
mobile-app/10-31-15/Project/app/src/main/java/com/example/pearlsantos/project/TimePicker.java
View file @
a75c49d8
...
...
@@ -2,6 +2,8 @@ package com.example.pearlsantos.project;
import
android.app.Dialog
;
import
android.app.TimePickerDialog
;
import
android.content.SharedPreferences
;
import
android.support.annotation.Nullable
;
import
android.support.v4.app.DialogFragment
;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
...
...
@@ -10,6 +12,8 @@ import android.view.Menu;
import
android.view.MenuItem
;
import
java.util.Calendar
;
import
java.util.Map
;
import
java.util.Set
;
public
class
TimePicker
extends
DialogFragment
implements
TimePickerDialog
.
OnTimeSetListener
{
...
...
@@ -26,6 +30,11 @@ public class TimePicker extends DialogFragment implements TimePickerDialog.OnTim
@Override
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
//actually, here's one thing you can do, since I kinda forgot how to SharedPreferences
//1) get the time set using this time picker
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment