use of com.google.firebase.database.ChildEventListener in project OnlineCanteen by josephgunawan97.
the class DeleteProductFragment method attachDatabaseReadListener.
private void attachDatabaseReadListener() {
if (productEventListener == null) {
productEventListener = new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
Product product = dataSnapshot.getValue(Product.class);
if (merchant.getUid().equals(product.getTokoId()))
deleteAdapter.addProductList(product);
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
databaseProducts.addChildEventListener(productEventListener);
}
}
use of com.google.firebase.database.ChildEventListener in project OnlineCanteen by josephgunawan97.
the class UserProductListFragment method attachProductDatabaseListener.
// ---------------- FIREBASE CHILD EVENT LISTENER -----------------//
private void attachProductDatabaseListener() {
if (productsEventListener == null) {
productsEventListener = new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
Product product = dataSnapshot.getValue(Product.class);
userProductItemAdapter.addProduct(product);
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
productsQuery.addChildEventListener(productsEventListener);
}
}
use of com.google.firebase.database.ChildEventListener in project EC2018App by Manan-YMCA.
the class MyNotificationsActivity method attachDatabaseListener.
private void attachDatabaseListener() {
if (mChildEventListener == null) {
mChildEventListener = new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
NotificationModel nm = dataSnapshot.getValue(NotificationModel.class);
updateList(nm);
progress.dismiss();
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
try {
NotificationModel nm = dataSnapshot.getValue(NotificationModel.class);
updateList(nm);
progress.dismiss();
} catch (Exception e) {
e.printStackTrace();
progress.dismiss();
}
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
NotificationModel nm = dataSnapshot.getValue(NotificationModel.class);
allNotificationsArrayList.remove(nm);
progress.dismiss();
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
progress.dismiss();
}
};
mDatabaseReference.addChildEventListener(mChildEventListener);
}
}
use of com.google.firebase.database.ChildEventListener in project EC2018App by Manan-YMCA.
the class MrCulFragment method attachDatabaseListener.
private void attachDatabaseListener() {
if (mChildEventListener == null) {
mChildEventListener = new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
if (dataSnapshot.getKey().equals("mrmsculmyca")) {
BrixxEventModel w = dataSnapshot.getValue(BrixxEventModel.class);
updateUI(w);
}
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
try {
if (dataSnapshot.getKey().equals("mrmsculmyca")) {
BrixxEventModel w = dataSnapshot.getValue(BrixxEventModel.class);
updateUI(w);
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
mDatabaseReference.addChildEventListener(mChildEventListener);
}
}
use of com.google.firebase.database.ChildEventListener in project EC2018App by Manan-YMCA.
the class RangritiFragment method attachDatabaseListener.
private void attachDatabaseListener() {
if (mChildEventListener == null) {
mChildEventListener = new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
if (dataSnapshot.getKey().equals("rangriti")) {
BrixxEventModel w = dataSnapshot.getValue(BrixxEventModel.class);
updateUI(w);
}
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
try {
if (dataSnapshot.getKey().equals("rangriti")) {
BrixxEventModel w = dataSnapshot.getValue(BrixxEventModel.class);
updateUI(w);
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
mDatabaseReference.addChildEventListener(mChildEventListener);
}
}
Aggregations