diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.kt b/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.kt
index 9996daf..993ad24 100644
--- a/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.kt
+++ b/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.kt
@@ -10,7 +10,7 @@ import butterknife.ButterKnife
import butterknife.OnClick
import butterknife.OnTextChanged
import cy.agorise.crystalwallet.R
-import cy.agorise.crystalwallet.dialogs.material.CrystalDialog
+import cy.agorise.crystalwallet.dialogs.material.*
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests
import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest
import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest
@@ -167,39 +167,55 @@ class CreateSeedActivity : CustomActivity() {
@OnClick(R.id.btnCreate)
fun createSeed() {
- // Make request to create a bitshare account
- val request = ValidateCreateBitsharesAccountRequest(tietAccountName?.getText().toString(), applicationContext)
-
- //DTVV: Friday 27 July 2018
- //Makes dialog to tell the user that the account is been created
- val creatingAccountMaterialDialog = CrystalDialog(this)
- creatingAccountMaterialDialog.setText(this.resources.getString(R.string.window_create_seed_DialogMessage))
- creatingAccountMaterialDialog.progress()
- this@CreateSeedActivity.runOnUiThread {
- creatingAccountMaterialDialog.show()
- }
- request.setListener {
- creatingAccountMaterialDialog.dismiss()
- if (request.status == ValidateCreateBitsharesAccountRequest.StatusCode.SUCCEEDED) {
- val accountSeed = request.account
- val intent = Intent(applicationContext, BackupSeedActivity::class.java)
- intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
- intent.putExtra("SEED_ID", accountSeed.id)
- startActivity(intent)
- } else {
- fieldsValidator.validate()
+ /*
+ * Question if continue or not
+ * */
+ var questionDialog:QuestionDialog = QuestionDialog(globalActivity)
+ questionDialog.setText(getString(R.string.continue_question))
+ questionDialog.setOnNegative(object : NegativeResponse{
+ override fun onNegative(dialogMaterial: DialogMaterial) {
+ dialogMaterial.dismiss()
}
- }
+ })
+ questionDialog.setOnPositive(object : PositiveResponse{
+ override fun onPositive() {
- (object : Thread() {
- override fun run() {
+ // Make request to create a bitshare account
+ val request = ValidateCreateBitsharesAccountRequest(tietAccountName?.getText().toString(), applicationContext)
- /*
- *
- * Run thread*/
- CryptoNetInfoRequests.getInstance().addRequest(request)
+ //DTVV: Friday 27 July 2018
+ //Makes dialog to tell the user that the account is been created
+ val creatingAccountMaterialDialog = CrystalDialog(globalActivity)
+ creatingAccountMaterialDialog.setText(globalActivity.resources.getString(R.string.window_create_seed_DialogMessage))
+ creatingAccountMaterialDialog.progress()
+ this@CreateSeedActivity.runOnUiThread {
+ creatingAccountMaterialDialog.show()
+ }
+ request.setListener {
+ creatingAccountMaterialDialog.dismiss()
+ if (request.status == ValidateCreateBitsharesAccountRequest.StatusCode.SUCCEEDED) {
+ val accountSeed = request.account
+ val intent = Intent(applicationContext, BackupSeedActivity::class.java)
+ intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
+ intent.putExtra("SEED_ID", accountSeed.id)
+ startActivity(intent)
+ } else {
+ fieldsValidator.validate()
+ }
+ }
+
+ (object : Thread() {
+ override fun run() {
+
+ /*
+ *
+ * Run thread*/
+ CryptoNetInfoRequests.getInstance().addRequest(request)
+ }
+ }).start()
}
- }).start()
+ })
+ questionDialog.show()
}
/*
diff --git a/app/src/main/java/cy/agorise/crystalwallet/dialogs/material/CrystalDialog.kt b/app/src/main/java/cy/agorise/crystalwallet/dialogs/material/CrystalDialog.kt
index e21e0d2..4029e5e 100644
--- a/app/src/main/java/cy/agorise/crystalwallet/dialogs/material/CrystalDialog.kt
+++ b/app/src/main/java/cy/agorise/crystalwallet/dialogs/material/CrystalDialog.kt
@@ -1,8 +1,6 @@
package cy.agorise.crystalwallet.dialogs.material
import android.app.Activity
-import cy.agorise.crystalwallet.R
-import kotlinx.android.synthetic.main.account_seed_list.view.*
/*
* Dialog material that shows loading gif and and explicit message
@@ -26,5 +24,5 @@ interface PositiveResponse{
fun onPositive()
}
interface NegativeResponse{
- fun onNegative()
+ fun onNegative(dialogMaterial:DialogMaterial)
}
\ No newline at end of file
diff --git a/app/src/main/java/cy/agorise/crystalwallet/dialogs/material/DialogMaterial.kt b/app/src/main/java/cy/agorise/crystalwallet/dialogs/material/DialogMaterial.kt
index 9f43713..e1ba64d 100644
--- a/app/src/main/java/cy/agorise/crystalwallet/dialogs/material/DialogMaterial.kt
+++ b/app/src/main/java/cy/agorise/crystalwallet/dialogs/material/DialogMaterial.kt
@@ -20,16 +20,20 @@ open abstract class DialogMaterial{
* */
protected var activity:Activity;
+ /*
+ * Contains pointer to myself
+ * */
+ protected var dialogMaterial:DialogMaterial;
/*
* Contains the response for positive button click
* */
- var positiveResponse:PositiveResponse? = null
+ protected var positiveResponse:PositiveResponse? = null
/*
* Contains the response for negative button click
* */
- var negativeResponse:NegativeResponse? = null
+ protected var negativeResponse:NegativeResponse? = null
constructor(activity: Activity) {
@@ -39,6 +43,8 @@ open abstract class DialogMaterial{
* */
this.activity = activity
+ dialogMaterial = this;
+
/*
* Init the builder
* */
@@ -80,7 +86,7 @@ open abstract class DialogMaterial{
* If response is not null deliver response
* */
if(negativeResponse != null){
- negativeResponse!!.onNegative()
+ negativeResponse!!.onNegative(dialogMaterial)
}
}
}
@@ -142,6 +148,14 @@ open abstract class DialogMaterial{
this.builder.content(message)
}
+ fun setOnPositive(onPositive:PositiveResponse){
+ this.positiveResponse = onPositive
+ }
+
+ fun setOnNegative(onNegative:NegativeResponse){
+ this.negativeResponse = onNegative
+ }
+
fun setTitle(title: String) {
this.builder.title(title)
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1e1d236..1ae4695 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -280,6 +280,8 @@
head_block_number
e_receipt
+ Are you sure to continue?
+
Restoring backup from file
SmartcoinsWallet