Archived
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user