A little bit of cleanup
This commit is contained in:
parent
0c1f050868
commit
46419f7d83
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -60,12 +60,9 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (db.noteDAO().getAll().isEmpty()) {
|
if (db.noteDAO().getAll().isEmpty()) {
|
||||||
Log.d("UIVIS", "This should be what runs when the DB is empty");
|
|
||||||
noNotesText.setVisibility(VISIBLE);
|
noNotesText.setVisibility(VISIBLE);
|
||||||
notesRecyclerView.setVisibility(View.GONE);
|
notesRecyclerView.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
Log.d("UIVIS", "This should only run if there is something in the DB");
|
|
||||||
Log.d("UIVIS", "DB Count: " + db.noteDAO().getAll().size());
|
|
||||||
noNotesText.setVisibility(View.GONE);
|
noNotesText.setVisibility(View.GONE);
|
||||||
notesRecyclerView.setVisibility(VISIBLE);
|
notesRecyclerView.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public abstract class NoteDB extends RoomDatabase {
|
|||||||
public static NoteDB getDB(Context applicationContext) {
|
public static NoteDB getDB(Context applicationContext) {
|
||||||
if (db == null) {
|
if (db == null) {
|
||||||
db = Room.databaseBuilder(applicationContext, NoteDB.class, "Notes")
|
db = Room.databaseBuilder(applicationContext, NoteDB.class, "Notes")
|
||||||
.allowMainThreadQueries()
|
.allowMainThreadQueries() // This is critical to make this whole thing work
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user