From 2734f6777a6b7c439d9bc55c8756155721f76fa5 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Sun, 9 May 2021 00:44:42 -0600 Subject: added clear button but doesn't work yet --- .../brysonsteck/wiimmfiwatcher/viewmodel/FriendCodeViewModel.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/src/main/java/me/brysonsteck/wiimmfiwatcher/viewmodel') diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/viewmodel/FriendCodeViewModel.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/viewmodel/FriendCodeViewModel.java index ae300c0..87db049 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/viewmodel/FriendCodeViewModel.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/viewmodel/FriendCodeViewModel.java @@ -1,6 +1,7 @@ package me.brysonsteck.wiimmfiwatcher.viewmodel; import android.app.Application; +import android.database.sqlite.SQLiteDatabase; import androidx.databinding.ObservableArrayList; import androidx.lifecycle.AndroidViewModel; @@ -45,6 +46,13 @@ public class FriendCodeViewModel extends AndroidViewModel { return entries; } + public boolean deleteAll() { + for (FriendCode entry: entries) { + db.getFriendCodeDao().nukeTable(); + } + return true; + } + public void saveFriendCode(String name, String friendCode) { saving.setValue(true); new Thread(() -> { -- cgit v1.2.3