From 4a34c3a8ae9dfe5ac0bab3cfba390a86cdf57ce3 Mon Sep 17 00:00:00 2001 From: Javier Varona Date: Thu, 6 Sep 2018 22:13:28 -0400 Subject: [PATCH] - Now the import seed button sends the user to the import seed activity - Fixed account seed kotlin viewmodel so it can be instantiated with the ViewModelProvider --- app/build.gradle | 2 ++ .../fragments/ImportAccountOptionsFragment.java | 7 +++++++ .../crystalwallet/viewmodels/AccountSeedViewModel.kt | 9 ++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c193220..f20eac1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -108,4 +108,6 @@ dependencies { exclude group: 'org.json', module: 'json' } + kapt "android.arch.lifecycle:compiler:1.1.1" + kapt "android.arch.persistence.room:compiler:1.1.0" } diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java index 1e7ef17..ca278d5 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java @@ -22,6 +22,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import cy.agorise.crystalwallet.R; +import cy.agorise.crystalwallet.activities.ImportSeedActivity; import cy.agorise.crystalwallet.activities.IntroActivity; import cy.agorise.crystalwallet.requestmanagers.FileServiceRequestListener; import cy.agorise.crystalwallet.requestmanagers.FileServiceRequests; @@ -97,6 +98,12 @@ public class ImportAccountOptionsFragment extends DialogFragment { } + @OnClick (R.id.btnImportSeed) + public void importSeed(){ + Intent intent = new Intent(this.getActivity(), ImportSeedActivity.class); + startActivity(intent); + } + @Override public void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); diff --git a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/AccountSeedViewModel.kt b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/AccountSeedViewModel.kt index f887ae8..aa9d3e9 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/AccountSeedViewModel.kt +++ b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/AccountSeedViewModel.kt @@ -6,15 +6,14 @@ import android.arch.lifecycle.LiveData import cy.agorise.crystalwallet.dao.CrystalDatabase import cy.agorise.crystalwallet.models.AccountSeed -class AccountSeedViewModel : AndroidViewModel { +class AccountSeedViewModel(application: Application) : AndroidViewModel(application) { private var accountSeed: LiveData? = null private val db: CrystalDatabase - private val app: Application + private val app: Application = application - constructor(application: Application,db:CrystalDatabase): super(application) { - this.app = application; - this.db = db; + init{ + this.db = CrystalDatabase.getAppDatabase(this.app.getApplicationContext()); } fun loadSeed(seedId: Long) {