From 2ca94de24156f592fa8f7840228285e320808124 Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 25 Oct 2018 01:34:48 -0500 Subject: [PATCH 1/8] -In the send assets screen it crashes when type an amount --- .../validators/validationfields/AmountValidationField.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java index 3b44223..a01f1a8 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java +++ b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java @@ -48,7 +48,12 @@ public class AmountValidationField extends ValidationField { CryptoCoinBalance balance = CrystalDatabase.getAppDatabase(amountField.getContext()).cryptoCoinBalanceDao().getBalanceFromAccount(this.account.getId(),cryptoCurrency.getId()); - if (newAmountValue > balance.getBalance()){ + double balanceDouble = 0; + if(balance != null){ + balanceDouble = balance.getBalance(); + } + + if (newAmountValue > balanceDouble){ setMessageForValue(mixedValues, validator.getContext().getResources().getString(R.string.insufficient_amount)); setValidForValue(mixedValues, false); } else if (newAmountValue == 0){ From b05cf62daf996ea267af2896c4d99dede90c12e4 Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 25 Oct 2018 01:55:58 -0500 Subject: [PATCH 2/8] -After henrry updated the file ImportSeedActivity i found some errors and i had to fix it again so it does not use 2 equeals services --- .../agorise/crystalwallet/activities/ImportSeedActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java index 56603fe..fa3cd44 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java @@ -358,7 +358,7 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator /* * Validate mnemonic with the server * */ - final ImportBitsharesAccountRequest request = new ImportBitsharesAccountRequest(etSeedWords.getText().toString().trim(),activity); + /*final ImportBitsharesAccountRequest request = new ImportBitsharesAccountRequest(etSeedWords.getText().toString().trim(),activity); request.setListener(new CryptoNetInfoRequestListener() { @Override public void onCarryOut() { @@ -378,7 +378,7 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator } } }); - CryptoNetInfoRequests.getInstance().addRequest(request); + CryptoNetInfoRequests.getInstance().addRequest(request);*/ } }); From a21796d2d00cc25e9f07f6e951ea6fc68026a192 Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 25 Oct 2018 02:04:02 -0500 Subject: [PATCH 3/8] -The GrapheneAccount class is crasing, now it is fixed --- .../crystalwallet/models/GrapheneAccount.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/models/GrapheneAccount.java b/app/src/main/java/cy/agorise/crystalwallet/models/GrapheneAccount.java index dfb4cb0..fd3e2c7 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/models/GrapheneAccount.java +++ b/app/src/main/java/cy/agorise/crystalwallet/models/GrapheneAccount.java @@ -31,9 +31,16 @@ public class GrapheneAccount extends CryptoNetAccount { } public void loadInfo(GrapheneAccountInfo info){ - this.name = info.getName(); - this.accountId = info.getAccountId(); - this.upgradedToLtm = info.getUpgradedToLtm(); + if(info != null){ + this.name = info.getName(); + this.accountId = info.getAccountId(); + this.upgradedToLtm = info.getUpgradedToLtm(); + } + else{ + this.name = ""; + this.accountId = "-1"; + this.upgradedToLtm = false; + } } public String getName() { From ba96d999ff85ff4bf098d55274785a1bb8c62aff Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 25 Oct 2018 02:13:11 -0500 Subject: [PATCH 4/8] Add listener to the class PatternRequestActivity to reuse the on success or fail password event --- .../activities/PatternRequestActivity.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java index 56ec8b1..41b7b9a 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java @@ -39,6 +39,11 @@ public class PatternRequestActivity extends AppCompatActivity { @BindView(R.id.txtBadtry) TextView txtBadtry; + /* + * External listener for success or fail + * */ + private OnResponse onResponse; + /* * Contains the bad tries * */ @@ -100,11 +105,24 @@ public class PatternRequestActivity extends AppCompatActivity { if (CrystalSecurityMonitor.getInstance(null).is2ndFactorSet()) { //CrystalSecurityMonitor.getInstance(null).call2ndFactor(thisActivity); thisActivity.finish(); + + if(onResponse != null){ + onResponse.onSuccess(); + } + } else { thisActivity.finish(); + + if(onResponse != null){ + onResponse.onSuccess(); + } } } else { incorrect(); + + if(onResponse != null){ + onResponse.onFailed(); + } } } @@ -122,6 +140,10 @@ public class PatternRequestActivity extends AppCompatActivity { }); } + public void setOnResponse(OnResponse onResponse) { + this.onResponse = onResponse; + } + private void incorrect(){ /* @@ -224,6 +246,14 @@ public class PatternRequestActivity extends AppCompatActivity { return patternString; } + + /* + * Listener events for success and fail + * */ + public interface OnResponse{ + void onSuccess(); + void onFailed(); + } } From 753a4a5943a8e91417f26799e92f88e0d706c6fc Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 25 Oct 2018 02:16:38 -0500 Subject: [PATCH 5/8] Fix to this commmit: Add listener to the class PatternRequestActivity to reuse the on success or fail password event --- .../crystalwallet/activities/PatternRequestActivity.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java index 41b7b9a..09e4bb8 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java @@ -42,7 +42,7 @@ public class PatternRequestActivity extends AppCompatActivity { /* * External listener for success or fail * */ - private OnResponse onResponse; + private static OnResponse onResponse; /* * Contains the bad tries @@ -108,6 +108,7 @@ public class PatternRequestActivity extends AppCompatActivity { if(onResponse != null){ onResponse.onSuccess(); + onResponse = null; } } else { @@ -115,6 +116,7 @@ public class PatternRequestActivity extends AppCompatActivity { if(onResponse != null){ onResponse.onSuccess(); + onResponse = null; } } } else { @@ -122,6 +124,7 @@ public class PatternRequestActivity extends AppCompatActivity { if(onResponse != null){ onResponse.onFailed(); + onResponse = null; } } } @@ -140,8 +143,8 @@ public class PatternRequestActivity extends AppCompatActivity { }); } - public void setOnResponse(OnResponse onResponse) { - this.onResponse = onResponse; + public static void setOnResponse(OnResponse onResponse) { + onResponse = onResponse; } private void incorrect(){ From 0bb428a658f0680d04052fb7eff0cb07aa30bbd3 Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 25 Oct 2018 02:22:43 -0500 Subject: [PATCH 6/8] Add listener to the class PinRequestActivity to reuse the on success or fail password event --- .../activities/PinRequestActivity.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/PinRequestActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/PinRequestActivity.java index b90ed6e..a725c46 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/PinRequestActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/PinRequestActivity.java @@ -31,6 +31,7 @@ import cy.agorise.crystalwallet.dialogs.material.DialogMaterial; import cy.agorise.crystalwallet.dialogs.material.NegativeResponse; import cy.agorise.crystalwallet.dialogs.material.PositiveResponse; import cy.agorise.crystalwallet.dialogs.material.QuestionDialog; +import cy.agorise.crystalwallet.interfaces.OnResponse; import cy.agorise.crystalwallet.models.AccountSeed; import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.util.PasswordManager; @@ -55,6 +56,10 @@ public class PinRequestActivity extends AppCompatActivity { * */ private int seconds = 15; + /* + * External listener for success or fail + * */ + private static OnResponse onResponse; @@ -105,8 +110,19 @@ public class PinRequestActivity extends AppCompatActivity { if (PasswordManager.checkPassword(passwordEncrypted, etPassword.getText().toString())) { if (CrystalSecurityMonitor.getInstance(null).is2ndFactorSet()) { CrystalSecurityMonitor.getInstance(null).call2ndFactor(this); + + if(onResponse != null){ + onResponse.onSuccess(); + onResponse = null; + } + } else { this.finish(); + + if(onResponse != null){ + onResponse.onFailed(); + onResponse = null; + } } } else{ @@ -205,6 +221,11 @@ public class PinRequestActivity extends AppCompatActivity { } + public static void setOnResponse(OnResponse onResponse) { + PinRequestActivity.onResponse = onResponse; + } + + @OnTextChanged(value = R.id.etPassword, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) void afterPasswordChanged(Editable editable) { From 71c26c0ddfd0dd704bb6f72db2cf633080cb321a Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 25 Oct 2018 02:24:15 -0500 Subject: [PATCH 7/8] -Add listener to the class PatternRequestActivity to reuse the on success or fail password event -Add listener to the class PinRequestActivity to reuse the on success or fail password event --- .../application/CrystalSecurityMonitor.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java b/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java index e027107..0d2da76 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java +++ b/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java @@ -16,6 +16,8 @@ import java.util.List; import cy.agorise.crystalwallet.activities.PatternRequestActivity; import cy.agorise.crystalwallet.activities.PinRequestActivity; import cy.agorise.crystalwallet.activities.PocketRequestActivity; +import cy.agorise.crystalwallet.fragments.PatternSecurityFragment; +import cy.agorise.crystalwallet.interfaces.OnResponse; import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.notifiers.CrystalWalletNotifier; import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel; @@ -129,7 +131,7 @@ public class CrystalSecurityMonitor implements Application.ActivityLifecycleCall public void onActivityStarted(Activity activity) { if (numStarted == 0) { if (!actualSecurity().equals("")){ - callPasswordRequest(activity); + callPasswordRequest(activity,null); } } numStarted++; @@ -140,17 +142,33 @@ public class CrystalSecurityMonitor implements Application.ActivityLifecycleCall numStarted--; if (numStarted == 0) { if (!actualSecurity().equals("")){ - callPasswordRequest(activity); + callPasswordRequest(activity,null); } } } - public void callPasswordRequest(Activity activity){ + public void callPasswordRequest(Activity activity, final OnResponse onResponsePattern){ if ((!activity.getIntent().hasExtra("ACTIVITY_TYPE")) || (!activity.getIntent().getStringExtra("ACTIVITY_TYPE").equals("PASSWORD_REQUEST"))) { Intent intent = null; if ((this.passwordEncrypted != null) && (!this.passwordEncrypted.equals(""))) { intent = new Intent(activity, PinRequestActivity.class); + + /* + * Connect error and success listeners + * */ + if(onResponsePattern != null){ + PinRequestActivity.setOnResponse(onResponsePattern); + } + } else if ((this.patternEncrypted != null) && (!this.patternEncrypted.equals(""))) { + + /* + * Connect error and success listeners + * */ + if(onResponsePattern != null){ + PatternRequestActivity.setOnResponse(onResponsePattern); + } + intent = new Intent(activity, PatternRequestActivity.class); } if (intent != null) { From ae3ed3725dca64d0d5645e25d4f41c6216cdf766 Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 25 Oct 2018 02:48:18 -0500 Subject: [PATCH 8/8] Security mode is only used when the user try to send assets in the send assets screen --- .../activities/PatternRequestActivity.java | 16 +--- .../activities/PinRequestActivity.java | 4 +- .../activities/SendTransactionActivity.java | 2 + .../application/CrystalSecurityMonitor.java | 9 +- .../fragments/PatternSecurityFragment.java | 20 ++++- .../fragments/SendTransactionFragment.java | 86 ++++++++----------- 6 files changed, 68 insertions(+), 69 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java index 09e4bb8..3612ff8 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/PatternRequestActivity.java @@ -25,6 +25,7 @@ import butterknife.ButterKnife; import butterknife.OnTextChanged; import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.application.CrystalSecurityMonitor; +import cy.agorise.crystalwallet.interfaces.OnResponse; import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.util.PasswordManager; import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel; @@ -72,6 +73,8 @@ public class PatternRequestActivity extends AppCompatActivity { setContentView(R.layout.activity_pattern_request); ButterKnife.bind(this); + //onResponse = null; + GeneralSettingListViewModel generalSettingListViewModel = ViewModelProviders.of(this).get(GeneralSettingListViewModel.class); LiveData> generalSettingsLiveData = generalSettingListViewModel.getGeneralSettingList(); @@ -108,7 +111,6 @@ public class PatternRequestActivity extends AppCompatActivity { if(onResponse != null){ onResponse.onSuccess(); - onResponse = null; } } else { @@ -116,7 +118,6 @@ public class PatternRequestActivity extends AppCompatActivity { if(onResponse != null){ onResponse.onSuccess(); - onResponse = null; } } } else { @@ -124,7 +125,6 @@ public class PatternRequestActivity extends AppCompatActivity { if(onResponse != null){ onResponse.onFailed(); - onResponse = null; } } } @@ -144,7 +144,7 @@ public class PatternRequestActivity extends AppCompatActivity { } public static void setOnResponse(OnResponse onResponse) { - onResponse = onResponse; + PatternRequestActivity.onResponse = onResponse; } private void incorrect(){ @@ -249,14 +249,6 @@ public class PatternRequestActivity extends AppCompatActivity { return patternString; } - - /* - * Listener events for success and fail - * */ - public interface OnResponse{ - void onSuccess(); - void onFailed(); - } } diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/PinRequestActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/PinRequestActivity.java index a725c46..2f93f18 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/PinRequestActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/PinRequestActivity.java @@ -77,6 +77,8 @@ public class PinRequestActivity extends AppCompatActivity { setContentView(R.layout.activity_pin_request); ButterKnife.bind(this); + //onResponse = null; + /* * Initially the button is disabled till the user type a valid PIN * */ @@ -113,7 +115,6 @@ public class PinRequestActivity extends AppCompatActivity { if(onResponse != null){ onResponse.onSuccess(); - onResponse = null; } } else { @@ -121,7 +122,6 @@ public class PinRequestActivity extends AppCompatActivity { if(onResponse != null){ onResponse.onFailed(); - onResponse = null; } } } diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java index adfa17c..26adfa1 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java @@ -1,5 +1,6 @@ package cy.agorise.crystalwallet.activities; +import android.app.Activity; import android.arch.lifecycle.LiveData; import android.arch.lifecycle.Observer; import android.os.Bundle; @@ -11,6 +12,7 @@ import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; +import android.widget.Toast; import com.jaredrummler.materialspinner.MaterialSpinner; diff --git a/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java b/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java index 0d2da76..3ed54da 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java +++ b/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java @@ -151,8 +151,11 @@ public class CrystalSecurityMonitor implements Application.ActivityLifecycleCall if ((!activity.getIntent().hasExtra("ACTIVITY_TYPE")) || (!activity.getIntent().getStringExtra("ACTIVITY_TYPE").equals("PASSWORD_REQUEST"))) { Intent intent = null; if ((this.passwordEncrypted != null) && (!this.passwordEncrypted.equals(""))) { + intent = new Intent(activity, PinRequestActivity.class); + PinRequestActivity.setOnResponse(null); + /* * Connect error and success listeners * */ @@ -162,14 +165,16 @@ public class CrystalSecurityMonitor implements Application.ActivityLifecycleCall } else if ((this.patternEncrypted != null) && (!this.patternEncrypted.equals(""))) { + intent = new Intent(activity, PatternRequestActivity.class); + + PatternRequestActivity.setOnResponse(null); + /* * Connect error and success listeners * */ if(onResponsePattern != null){ PatternRequestActivity.setOnResponse(onResponsePattern); } - - intent = new Intent(activity, PatternRequestActivity.class); } if (intent != null) { intent.putExtra("ACTIVITY_TYPE", "PASSWORD_REQUEST"); diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/PatternSecurityFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/PatternSecurityFragment.java index 63e15d7..c23306f 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/PatternSecurityFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/PatternSecurityFragment.java @@ -1,5 +1,6 @@ package cy.agorise.crystalwallet.fragments; +import android.app.Activity; import android.arch.lifecycle.LiveData; import android.arch.lifecycle.Observer; import android.arch.lifecycle.ViewModelProviders; @@ -8,6 +9,7 @@ import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.text.Editable; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -27,7 +29,10 @@ import butterknife.ButterKnife; import butterknife.OnTextChanged; import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.application.CrystalSecurityMonitor; +import cy.agorise.crystalwallet.dialogs.material.CrystalDialog; +import cy.agorise.crystalwallet.interfaces.OnResponse; import cy.agorise.crystalwallet.models.GeneralSetting; +import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests; import cy.agorise.crystalwallet.util.ChildViewPager; import cy.agorise.crystalwallet.util.PasswordManager; import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel; @@ -199,7 +204,20 @@ public class PatternSecurityFragment extends Fragment { public void savePattern(String pattern){ String patternEncripted = PasswordManager.encriptPassword(pattern); CrystalSecurityMonitor.getInstance(null).setPatternEncrypted(patternEncripted); - //CrystalSecurityMonitor.getInstance(null).callPasswordRequest(this.getActivity()); + /*CrystalSecurityMonitor.getInstance(null).callPasswordRequest(this.getActivity(), new OnResponse() { + @Override + public void onSuccess() { + + Log.i("onSuccess","onSuccess"); + Toast.makeText(getActivity(), "onSuccess", Toast.LENGTH_LONG).show(); + } + + @Override + public void onFailed() { + Log.i("onFailed","onFailed"); + Toast.makeText(getActivity(), "onFailed", Toast.LENGTH_LONG).show(); + } + });*/ /* * Show success diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java index eaa4445..45b5185 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java @@ -58,8 +58,10 @@ import butterknife.OnClick; import butterknife.OnItemSelected; import butterknife.OnTextChanged; import cy.agorise.crystalwallet.R; +import cy.agorise.crystalwallet.application.CrystalSecurityMonitor; import cy.agorise.crystalwallet.dialogs.material.CrystalDialog; import cy.agorise.crystalwallet.dialogs.material.ToastIt; +import cy.agorise.crystalwallet.interfaces.OnResponse; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesSendRequest; @@ -180,53 +182,10 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat View view = inflater.inflate(R.layout.send_transaction, null); ButterKnife.bind(this, view); - - /* - * Detet scroll changes - * */ - /*scrollMain.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() { - @Override - public void onScrollChanged() { - - View view = scrollMain.getChildAt(scrollMain.getChildCount() - 1); - - int diff = (view.getBottom() - (scrollMain.getHeight() + scrollMain.getScrollY())); - - float traslationY = btnSend.getTranslationY(); - - if(diff<=266 && diff>128){ - //btnSend.setTranslationY(0); - //viewSend.setTranslationY(0); - - btnSend.animate().y(880); - viewSend.animate().y(800); - } - else if(diff<=128 && diff>10){ - //btnSend.setTranslationY(-130); - //viewSend.setTranslationY(-130); - - btnSend.animate().y(880); - viewSend.animate().y(800); - } - else if(diff<=10 && diff>0){ - //btnSend.setTranslationY(-170); - //viewSend.setTranslationY(-170); - - btnSend.animate().y(680); - viewSend.animate().y(600); - } - else if(diff==0){ - //btnSend.setTranslationY(-190); - //viewSend.setTranslationY(-190); - - btnSend.animate().y(680); - viewSend.animate().y(600); - } - } - });*/ - this.cryptoNetAccountId = getArguments().getLong("CRYPTO_NET_ACCOUNT_ID",-1); + final Activity activity = getActivity(); + /* * Add style to the spinner android * */ @@ -253,6 +212,15 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat } List cryptoCurrencyList = db.cryptoCurrencyDao().getByIds(assetIds); + /* + * Test + * */ + /*CryptoCurrency crypto1 = new CryptoCurrency(); + crypto1.setId(1); + crypto1.setName("BITCOIN"); + crypto1.setPrecision(1); + cryptoCurrencyList.add(crypto1);*/ + assetAdapter = new CryptoCurrencyAdapter(getContext(), android.R.layout.simple_spinner_item, cryptoCurrencyList); spAsset.setAdapter(assetAdapter); } @@ -653,14 +621,28 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat }); /* - * Show loading dialog - * */ - crystalDialog = new CrystalDialog((Activity) getContext()); - crystalDialog.setText("Sending"); - crystalDialog.progress(); - crystalDialog.show(); + * If exists mode scurity show it and valide events in case of success or fail + * */ + CrystalSecurityMonitor.getInstance(null).callPasswordRequest(this.getActivity(), new OnResponse() { + @Override + public void onSuccess() { - CryptoNetInfoRequests.getInstance().addRequest(sendRequest); + /* + * Show loading dialog + * */ + crystalDialog = new CrystalDialog((Activity) getContext()); + crystalDialog.setText("Sending"); + crystalDialog.progress(); + crystalDialog.show(); + + CryptoNetInfoRequests.getInstance().addRequest(sendRequest); + } + + @Override + public void onFailed() { + + } + }); } }