Added a database to migrate entry storage to later; added checks to determine whether existing entries need to be migrated from preference storage to database

This commit is contained in:
denizk0461
2023-05-30 09:36:57 +02:00
parent 942af61b9d
commit cd075e9560
9 changed files with 119 additions and 13 deletions
@@ -23,6 +23,15 @@ class QuoteFragment : BaseFragment(R.layout.fragment_quote), QuoteAdapter.OnDele
super.onViewCreated(view, savedInstanceState)
storage = QuoteStorage.getInstance(context)
if (storage.getAllQuotes().isEmpty()) {
storage.noMigrationNecessary()
}
if (storage.needsMigration()) {
storage.migrateEntries()
}
quoteAdapter = QuoteAdapter(storage.getAllQuotes(), this)
binding.recyclerView.layoutManager = LinearLayoutManager(context)