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
9785da74
Commit
9785da74
authored
Nov 27, 2019
by
Bhavesh Yadav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Balance now updates on firebase
parent
59275085
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
app/src/main/java/com/example/infiniteLoop/parkingo/sqlite_ops.java
...in/java/com/example/infiniteLoop/parkingo/sqlite_ops.java
+19
-0
app/src/main/java/com/example/infiniteLoop/parkingo/wallets.java
.../main/java/com/example/infiniteLoop/parkingo/wallets.java
+3
-1
No files found.
app/src/main/java/com/example/infiniteLoop/parkingo/sqlite_ops.java
View file @
9785da74
...
@@ -5,6 +5,7 @@ import android.database.Cursor;
...
@@ -5,6 +5,7 @@ import android.database.Cursor;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteOpenHelper
;
import
android.database.sqlite.SQLiteOpenHelper
;
import
android.util.Log
;
import
android.util.Log
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
...
@@ -498,6 +499,24 @@ public class sqlite_ops extends SQLiteOpenHelper{
...
@@ -498,6 +499,24 @@ public class sqlite_ops extends SQLiteOpenHelper{
}
}
public
void
updateBalance
(
String
uname
,
int
balance
)
{
fdb
=
FirebaseFirestore
.
getInstance
();
fdb
.
collection
(
"users"
).
document
(
uname
).
update
(
"balance"
,
balance
)
.
addOnSuccessListener
(
new
OnSuccessListener
<
Void
>()
{
@Override
public
void
onSuccess
(
Void
aVoid
)
{
Log
.
d
(
TAG
,
"Balance successfully updated!"
);
}
})
.
addOnFailureListener
(
new
OnFailureListener
()
{
@Override
public
void
onFailure
(
@NonNull
Exception
e
)
{
Log
.
w
(
TAG
,
"Error updating balance"
,
e
);
}
});;
}
public
void
getAllFilledSlotDetails
(
final
currentParks
cp
){
public
void
getAllFilledSlotDetails
(
final
currentParks
cp
){
// ArrayList slots=new ArrayList();
// ArrayList slots=new ArrayList();
// SQLiteDatabase db= this.getWritableDatabase();
// SQLiteDatabase db= this.getWritableDatabase();
...
...
app/src/main/java/com/example/infiniteLoop/parkingo/wallets.java
View file @
9785da74
...
@@ -56,6 +56,8 @@ public class wallets extends Activity {
...
@@ -56,6 +56,8 @@ public class wallets extends Activity {
int
newBalance
=
Integer
.
parseInt
(
top_up_text
)+
uinfo
.
getBalance
();
int
newBalance
=
Integer
.
parseInt
(
top_up_text
)+
uinfo
.
getBalance
();
uinfo
.
setBalance
(
newBalance
);
uinfo
.
setBalance
(
newBalance
);
balance
.
setText
(
"\u20B9 "
+
uinfo
.
getBalance
());
balance
.
setText
(
"\u20B9 "
+
uinfo
.
getBalance
());
sqlite_ops
so
=
new
sqlite_ops
(
wallets
.
this
);
so
.
updateBalance
(
uinfo
.
getUsername
(),
uinfo
.
getBalance
());
}
}
});
});
...
...
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