Adds confirmation when going up from the edit monster screen to save, cancel, or discard changes.

This commit is contained in:
2021-05-27 19:16:05 -07:00
committed by Tom Hicks
parent b56a662c9e
commit 23bcdc237d
5 changed files with 114 additions and 22 deletions

View File

@@ -4,6 +4,7 @@ package com.majinnaibu.monstercards.data;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import com.majinnaibu.monstercards.models.Monster;
@@ -30,6 +31,9 @@ public interface MonsterDAO {
@Insert
Completable insertAll(Monster... monsters);
@Insert(onConflict = OnConflictStrategy.REPLACE)
Completable save(Monster... monsters);
@Delete
Completable delete(Monster monster);
}

View File

@@ -63,4 +63,9 @@ public class MonsterRepository {
return result;
}
public Completable saveMonster(Monster monster) {
Completable result = m_db.monsterDAO().save(monster);
result.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
return result;
}
}