Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
parkingo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
SHAILESH KUMAR
parkingo
Commits
d5d40a76
Commit
d5d40a76
authored
Nov 26, 2019
by
Bhavesh Yadav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filled slots now return from firebase
parent
4d7cb155
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
22 deletions
+52
-22
app/src/main/java/com/example/infiniteLoop/parkingo/currentParks.java
.../java/com/example/infiniteLoop/parkingo/currentParks.java
+4
-1
app/src/main/java/com/example/infiniteLoop/parkingo/sqlite_ops.java
...in/java/com/example/infiniteLoop/parkingo/sqlite_ops.java
+48
-21
No files found.
app/src/main/java/com/example/infiniteLoop/parkingo/currentParks.java
View file @
d5d40a76
...
@@ -26,8 +26,11 @@ public class currentParks extends Activity {
...
@@ -26,8 +26,11 @@ public class currentParks extends Activity {
ll
=
findViewById
(
R
.
id
.
ll
);
ll
=
findViewById
(
R
.
id
.
ll
);
sqlite_ops
so
=
new
sqlite_ops
(
this
);
sqlite_ops
so
=
new
sqlite_ops
(
this
);
al
=
so
.
getAllFilledSlotDetails
(
);
so
.
getAllFilledSlotDetails
(
this
);
}
public
void
showCurrentParkings
(
final
ArrayList
al
)
{
curparks
=
findViewById
(
R
.
id
.
curparks
);
curparks
=
findViewById
(
R
.
id
.
curparks
);
if
(
al
.
size
()>
0
){
if
(
al
.
size
()>
0
){
SimpleAdapter
sa
=
new
SimpleAdapter
(
this
,
al
,
R
.
layout
.
current_park_listview
,
keys
,
ids
);
SimpleAdapter
sa
=
new
SimpleAdapter
(
this
,
al
,
R
.
layout
.
current_park_listview
,
keys
,
ids
);
...
...
app/src/main/java/com/example/infiniteLoop/parkingo/sqlite_ops.java
View file @
d5d40a76
...
@@ -191,6 +191,7 @@ public class sqlite_ops extends SQLiteOpenHelper{
...
@@ -191,6 +191,7 @@ public class sqlite_ops extends SQLiteOpenHelper{
parkingRecord
.
put
(
"slot"
,
cd
.
getSlot
());
parkingRecord
.
put
(
"slot"
,
cd
.
getSlot
());
parkingRecord
.
put
(
"vehicle"
,
cd
.
getVehicle_no
());
parkingRecord
.
put
(
"vehicle"
,
cd
.
getVehicle_no
());
parkingRecord
.
put
(
"checkInTimeDate"
,
timeStamp
.
toString
());
parkingRecord
.
put
(
"checkInTimeDate"
,
timeStamp
.
toString
());
parkingRecord
.
put
(
"status"
,
1
);
fdb
=
FirebaseFirestore
.
getInstance
();
fdb
=
FirebaseFirestore
.
getInstance
();
fdb
.
collection
(
"records"
)
fdb
.
collection
(
"records"
)
.
add
(
parkingRecord
)
.
add
(
parkingRecord
)
...
@@ -412,26 +413,52 @@ public class sqlite_ops extends SQLiteOpenHelper{
...
@@ -412,26 +413,52 @@ public class sqlite_ops extends SQLiteOpenHelper{
return
true
;
return
true
;
}
}
public
ArrayList
getAllFilledSlotDetails
(){
public
void
getAllFilledSlotDetails
(
final
currentParks
cp
){
ArrayList
slots
=
new
ArrayList
();
// ArrayList slots=new ArrayList();
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
// SQLiteDatabase db= this.getWritableDatabase();
Cursor
cursor
=
db
.
query
(
"records"
,
new
String
[]{
"name"
,
"mobile"
,
"vehicle"
,
"slot"
},
"isempty=?"
,
// Cursor cursor = db.query("records",new String[]{"name","mobile","vehicle","slot"},"isempty=?",
new
String
[]{
"0"
},
null
,
null
,
null
,
null
);
// new String[]{"0"}, null, null, null, null);
if
(
cursor
!=
null
){
// if(cursor!=null){
cursor
.
moveToFirst
();
// cursor.moveToFirst();
if
(
cursor
.
getCount
()!=
0
){
// if(cursor.getCount()!=0){
do
{
// do{
HashMap
hm
=
new
HashMap
();
// HashMap hm=new HashMap();
hm
.
put
(
"slot"
,
cursor
.
getString
(
cursor
.
getColumnIndex
(
"slot"
)));
// hm.put("slot", cursor.getString(cursor.getColumnIndex("slot")));
hm
.
put
(
"vehicle"
,
cursor
.
getString
(
cursor
.
getColumnIndex
(
"vehicle"
)));
// hm.put("vehicle",cursor.getString(cursor.getColumnIndex("vehicle")));
hm
.
put
(
"name"
,
cursor
.
getString
(
cursor
.
getColumnIndex
(
"name"
)));
// hm.put("name",cursor.getString(cursor.getColumnIndex("name")));
hm
.
put
(
"mobile"
,
cursor
.
getString
(
cursor
.
getColumnIndex
(
"mobile"
)));
// hm.put("mobile",cursor.getString(cursor.getColumnIndex("mobile")));
// slots.add(hm);
// }while(cursor.moveToNext());
// }
//
// }
fdb
=
FirebaseFirestore
.
getInstance
();
fdb
.
collection
(
"records"
).
whereEqualTo
(
"uname"
,
userInfo
.
getInstance
().
getName
())
.
whereEqualTo
(
"status"
,
1
).
get
()
.
addOnCompleteListener
(
new
OnCompleteListener
<
QuerySnapshot
>()
{
@Override
public
void
onComplete
(
@NonNull
Task
<
QuerySnapshot
>
task
)
{
if
(
task
.
isSuccessful
())
{
ArrayList
slots
=
new
ArrayList
();
for
(
QueryDocumentSnapshot
document
:
task
.
getResult
())
{
// slots.add(document);
HashMap
hm
=
new
HashMap
();
hm
.
put
(
"name"
,
document
.
getData
().
get
(
"name"
).
toString
());
hm
.
put
(
"uname"
,
document
.
getData
().
get
(
"uname"
).
toString
());
hm
.
put
(
"slot"
,
document
.
getData
().
get
(
"slot"
).
toString
());
hm
.
put
(
"vehicle"
,
document
.
getData
().
get
(
"vehicle"
).
toString
());
hm
.
put
(
"mobile"
,
document
.
getData
().
get
(
"mobile"
).
toString
());
Log
.
d
(
"Ticket"
,
"getting record"
+
document
.
getData
().
toString
());
slots
.
add
(
hm
);
slots
.
add
(
hm
);
}
while
(
cursor
.
moveToNext
());
}
}
cp
.
showCurrentParkings
(
slots
);
}
}
db
.
close
();
else
{
return
slots
;
Log
.
d
(
"Checkin"
,
"slot update failed"
);
}
}
});
// db.close();
return
;
}
}
}
}
\ No newline at end of file
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