Merge develop into master #1

Merged
SemvdH merged 297 commits from develop into main 2021-01-06 22:20:51 +00:00
2 changed files with 11 additions and 0 deletions
Showing only changes of commit 49f78efdd3 - Show all commits

View File

@@ -22,6 +22,9 @@ public interface CouponDao {
@Query("SELECT * FROM coupon")
LiveData<List<Coupon>> selectAll();
@Update
public void update(Coupon coupon);
/*
to add an observer to the livedata, you can use the example from https://medium.com/mindorks/using-room-database-with-livedata-android-jetpack-cbf89b677b47
*/

View File

@@ -20,6 +20,14 @@ public class CouponRepository {
mAllCoupons = mCouponDao.selectAll();
}
public void insert(Coupon... coupons) {
mCouponDao.insertAll(coupons);
}
public void update(Coupon coupon) {
mCouponDao.update(coupon);
}
public LiveData<List<Coupon>> getAllCoupons() {
return mAllCoupons;
}