Provide a better package structure for Room database related files.
This commit is contained in:
parent
dd770fdb5b
commit
5ec8afbdb3
28 changed files with 58 additions and 56 deletions
|
@ -89,11 +89,11 @@ class DatabaseLoadActivity: ConnectedActivity() {
|
|||
* @param assetList The list of assets obtained in the last 'list_assets' API call.
|
||||
*/
|
||||
private fun handlePlatformAssetBatch(assetList: List<Asset>) {
|
||||
val assets = mutableListOf<cy.agorise.bitsybitshareswallet.entities.Asset>()
|
||||
val assets = mutableListOf<cy.agorise.bitsybitshareswallet.database.entities.Asset>()
|
||||
|
||||
// TODO find if there is a better way to convert to Bitsy Asset instances
|
||||
for (_asset in assetList) {
|
||||
val asset = cy.agorise.bitsybitshareswallet.entities.Asset(
|
||||
val asset = cy.agorise.bitsybitshareswallet.database.entities.Asset(
|
||||
_asset.objectId,
|
||||
_asset.symbol,
|
||||
_asset.precision,
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.widget.Toast
|
|||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.list.listItemsSingleChoice
|
||||
import cy.agorise.bitsybitshareswallet.R
|
||||
import cy.agorise.bitsybitshareswallet.entities.Authority
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Authority
|
||||
import cy.agorise.bitsybitshareswallet.repositories.AuthorityRepository
|
||||
import cy.agorise.bitsybitshareswallet.repositories.UserAccountRepository
|
||||
import cy.agorise.bitsybitshareswallet.utils.Constants
|
||||
|
@ -235,7 +235,7 @@ class ImportBrainkeyActivity : ConnectedActivity() {
|
|||
val name = accountProperties.name
|
||||
val isLTM = accountProperties.membership_expiration_date == Constants.LIFETIME_EXPIRATION_DATE
|
||||
|
||||
val userAccount = cy.agorise.bitsybitshareswallet.entities.UserAccount(id, name, isLTM)
|
||||
val userAccount = cy.agorise.bitsybitshareswallet.database.entities.UserAccount(id, name, isLTM)
|
||||
|
||||
val userAccountRepository = UserAccountRepository(application)
|
||||
userAccountRepository.insert(userAccount)
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.widget.Toast
|
|||
import androidx.collection.LongSparseArray
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import cy.agorise.bitsybitshareswallet.R
|
||||
import cy.agorise.bitsybitshareswallet.entities.Balance
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Balance
|
||||
import cy.agorise.bitsybitshareswallet.fragments.BalancesFragment
|
||||
import cy.agorise.bitsybitshareswallet.fragments.MerchantsFragment
|
||||
import cy.agorise.bitsybitshareswallet.processors.TransfersLoader
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.widget.TextView
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.SortedList
|
||||
import cy.agorise.bitsybitshareswallet.R
|
||||
import cy.agorise.bitsybitshareswallet.entities.Balance
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Balance
|
||||
|
||||
class BalancesAdapter(private val context: Context) :
|
||||
RecyclerView.Adapter<BalancesAdapter.ViewHolder>() {
|
||||
|
|
|
@ -11,7 +11,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.SortedList
|
||||
import cy.agorise.bitsybitshareswallet.R
|
||||
import cy.agorise.bitsybitshareswallet.entities.Transfer
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Transfer
|
||||
|
||||
class TransactionsAdapter(private val context: Context) :
|
||||
RecyclerView.Adapter<TransactionsAdapter.ViewHolder>() {
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
package cy.agorise.bitsybitshareswallet.daos
|
||||
package cy.agorise.bitsybitshareswallet.database
|
||||
|
||||
import android.content.Context
|
||||
import androidx.room.Database
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import cy.agorise.bitsybitshareswallet.entities.*
|
||||
import cy.agorise.bitsybitshareswallet.database.daos.*
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.*
|
||||
|
||||
@Database(entities = [
|
||||
Asset::class,
|
||||
Authority::class,
|
||||
Balance::class,
|
||||
EquivalentValue::class,
|
||||
Transfer::class,
|
||||
UserAccount::class
|
||||
], version = 1, exportSchema = false)
|
||||
Asset::class,
|
||||
Authority::class,
|
||||
Balance::class,
|
||||
EquivalentValue::class,
|
||||
Transfer::class,
|
||||
UserAccount::class
|
||||
],
|
||||
version = 1, exportSchema = false)
|
||||
abstract class BitsyDatabase : RoomDatabase() {
|
||||
|
||||
abstract fun assetDao(): AssetDao
|
|
@ -1,11 +1,11 @@
|
|||
package cy.agorise.bitsybitshareswallet.daos
|
||||
package cy.agorise.bitsybitshareswallet.database.daos
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import cy.agorise.bitsybitshareswallet.entities.Asset
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Asset
|
||||
|
||||
@Dao
|
||||
interface AssetDao {
|
|
@ -1,10 +1,10 @@
|
|||
package cy.agorise.bitsybitshareswallet.daos
|
||||
package cy.agorise.bitsybitshareswallet.database.daos
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.Query
|
||||
import cy.agorise.bitsybitshareswallet.entities.Authority
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Authority
|
||||
import io.reactivex.Single
|
||||
|
||||
@Dao
|
|
@ -1,11 +1,11 @@
|
|||
package cy.agorise.bitsybitshareswallet.daos
|
||||
package cy.agorise.bitsybitshareswallet.database.daos
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import cy.agorise.bitsybitshareswallet.entities.Balance
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Balance
|
||||
|
||||
@Dao
|
||||
interface BalanceDao {
|
|
@ -1,10 +1,10 @@
|
|||
package cy.agorise.bitsybitshareswallet.daos
|
||||
package cy.agorise.bitsybitshareswallet.database.daos
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.Query
|
||||
import cy.agorise.bitsybitshareswallet.entities.EquivalentValue
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.EquivalentValue
|
||||
|
||||
@Dao
|
||||
interface EquivalentValueDao {
|
|
@ -1,11 +1,11 @@
|
|||
package cy.agorise.bitsybitshareswallet.daos
|
||||
package cy.agorise.bitsybitshareswallet.database.daos
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import cy.agorise.bitsybitshareswallet.entities.Transfer
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Transfer
|
||||
import io.reactivex.Single
|
||||
|
||||
@Dao
|
|
@ -1,10 +1,10 @@
|
|||
package cy.agorise.bitsybitshareswallet.daos
|
||||
package cy.agorise.bitsybitshareswallet.database.daos
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.Query
|
||||
import cy.agorise.bitsybitshareswallet.entities.UserAccount
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.UserAccount
|
||||
|
||||
@Dao
|
||||
interface UserAccountDao {
|
|
@ -1,4 +1,4 @@
|
|||
package cy.agorise.bitsybitshareswallet.entities
|
||||
package cy.agorise.bitsybitshareswallet.database.entities
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
|
@ -1,4 +1,4 @@
|
|||
package cy.agorise.bitsybitshareswallet.entities
|
||||
package cy.agorise.bitsybitshareswallet.database.entities
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
|
@ -1,4 +1,4 @@
|
|||
package cy.agorise.bitsybitshareswallet.entities
|
||||
package cy.agorise.bitsybitshareswallet.database.entities
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
|
@ -1,4 +1,4 @@
|
|||
package cy.agorise.bitsybitshareswallet.entities
|
||||
package cy.agorise.bitsybitshareswallet.database.entities
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
|
@ -1,4 +1,4 @@
|
|||
package cy.agorise.bitsybitshareswallet.entities
|
||||
package cy.agorise.bitsybitshareswallet.database.entities
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
|
@ -1,4 +1,4 @@
|
|||
package cy.agorise.bitsybitshareswallet.entities
|
||||
package cy.agorise.bitsybitshareswallet.database.entities
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
|
@ -14,9 +14,9 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import cy.agorise.bitsybitshareswallet.R
|
||||
import cy.agorise.bitsybitshareswallet.adapters.BalancesAdapter
|
||||
import cy.agorise.bitsybitshareswallet.adapters.TransactionsAdapter
|
||||
import cy.agorise.bitsybitshareswallet.entities.Balance
|
||||
import cy.agorise.bitsybitshareswallet.entities.Transfer
|
||||
import cy.agorise.bitsybitshareswallet.entities.UserAccount
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Balance
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Transfer
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.UserAccount
|
||||
import cy.agorise.bitsybitshareswallet.utils.Constants
|
||||
import cy.agorise.bitsybitshareswallet.viewmodels.BalanceViewModel
|
||||
import cy.agorise.bitsybitshareswallet.viewmodels.TransactionViewModel
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.util.Log
|
|||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import androidx.lifecycle.OnLifecycleEvent
|
||||
import cy.agorise.bitsybitshareswallet.entities.Transfer
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Transfer
|
||||
import cy.agorise.bitsybitshareswallet.models.HistoricalOperationEntry
|
||||
import cy.agorise.bitsybitshareswallet.repositories.AuthorityRepository
|
||||
import cy.agorise.bitsybitshareswallet.repositories.TransferRepository
|
||||
|
|
|
@ -2,9 +2,9 @@ package cy.agorise.bitsybitshareswallet.repositories
|
|||
|
||||
import android.app.Application
|
||||
import android.os.AsyncTask
|
||||
import cy.agorise.bitsybitshareswallet.daos.AssetDao
|
||||
import cy.agorise.bitsybitshareswallet.daos.BitsyDatabase
|
||||
import cy.agorise.bitsybitshareswallet.entities.Asset
|
||||
import cy.agorise.bitsybitshareswallet.database.daos.AssetDao
|
||||
import cy.agorise.bitsybitshareswallet.database.BitsyDatabase
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Asset
|
||||
|
||||
class AssetRepository internal constructor(application: Application) {
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ package cy.agorise.bitsybitshareswallet.repositories
|
|||
|
||||
import android.content.Context
|
||||
import android.os.AsyncTask
|
||||
import cy.agorise.bitsybitshareswallet.daos.AuthorityDao
|
||||
import cy.agorise.bitsybitshareswallet.daos.BitsyDatabase
|
||||
import cy.agorise.bitsybitshareswallet.entities.Authority
|
||||
import cy.agorise.bitsybitshareswallet.database.daos.AuthorityDao
|
||||
import cy.agorise.bitsybitshareswallet.database.BitsyDatabase
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Authority
|
||||
import io.reactivex.Single
|
||||
|
||||
class AuthorityRepository internal constructor(context: Context) {
|
||||
|
|
|
@ -3,9 +3,9 @@ package cy.agorise.bitsybitshareswallet.repositories
|
|||
import android.content.Context
|
||||
import android.os.AsyncTask
|
||||
import androidx.lifecycle.LiveData
|
||||
import cy.agorise.bitsybitshareswallet.daos.BalanceDao
|
||||
import cy.agorise.bitsybitshareswallet.daos.BitsyDatabase
|
||||
import cy.agorise.bitsybitshareswallet.entities.Balance
|
||||
import cy.agorise.bitsybitshareswallet.database.daos.BalanceDao
|
||||
import cy.agorise.bitsybitshareswallet.database.BitsyDatabase
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Balance
|
||||
|
||||
class BalanceRepository internal constructor(context: Context) {
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ package cy.agorise.bitsybitshareswallet.repositories
|
|||
import android.content.Context
|
||||
import android.os.AsyncTask
|
||||
import androidx.lifecycle.LiveData
|
||||
import cy.agorise.bitsybitshareswallet.daos.BitsyDatabase
|
||||
import cy.agorise.bitsybitshareswallet.daos.TransferDao
|
||||
import cy.agorise.bitsybitshareswallet.entities.Transfer
|
||||
import cy.agorise.bitsybitshareswallet.database.BitsyDatabase
|
||||
import cy.agorise.bitsybitshareswallet.database.daos.TransferDao
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Transfer
|
||||
import io.reactivex.Single
|
||||
|
||||
class TransferRepository internal constructor(context: Context) {
|
||||
|
|
|
@ -3,9 +3,9 @@ package cy.agorise.bitsybitshareswallet.repositories
|
|||
import android.app.Application
|
||||
import android.os.AsyncTask
|
||||
import androidx.lifecycle.LiveData
|
||||
import cy.agorise.bitsybitshareswallet.daos.BitsyDatabase
|
||||
import cy.agorise.bitsybitshareswallet.daos.UserAccountDao
|
||||
import cy.agorise.bitsybitshareswallet.entities.UserAccount
|
||||
import cy.agorise.bitsybitshareswallet.database.BitsyDatabase
|
||||
import cy.agorise.bitsybitshareswallet.database.daos.UserAccountDao
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.UserAccount
|
||||
|
||||
class UserAccountRepository internal constructor(application: Application) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package cy.agorise.bitsybitshareswallet.viewmodels
|
|||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.LiveData
|
||||
import cy.agorise.bitsybitshareswallet.entities.Balance
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Balance
|
||||
import cy.agorise.bitsybitshareswallet.repositories.BalanceRepository
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package cy.agorise.bitsybitshareswallet.viewmodels
|
|||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.LiveData
|
||||
import cy.agorise.bitsybitshareswallet.entities.Transfer
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.Transfer
|
||||
import cy.agorise.bitsybitshareswallet.repositories.TransferRepository
|
||||
|
||||
class TransactionViewModel(application: Application) : AndroidViewModel(application) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package cy.agorise.bitsybitshareswallet.viewmodels
|
|||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.LiveData
|
||||
import cy.agorise.bitsybitshareswallet.entities.UserAccount
|
||||
import cy.agorise.bitsybitshareswallet.database.entities.UserAccount
|
||||
import cy.agorise.bitsybitshareswallet.repositories.UserAccountRepository
|
||||
|
||||
class UserAccountViewModel(application: Application) : AndroidViewModel(application) {
|
||||
|
|
Loading…
Reference in a new issue