Merge branch 'develop' of github.com:Agorise/crystal-wallet-android into develop

feat_androidx_migration
Severiano Jaramillo 2018-10-25 13:40:50 -05:00
commit 960dd67394
17 changed files with 472 additions and 204 deletions

View File

@ -28,7 +28,7 @@ import cy.agorise.crystalwallet.dialogs.material.PositiveResponse;
import cy.agorise.crystalwallet.dialogs.material.QuestionDialog; import cy.agorise.crystalwallet.dialogs.material.QuestionDialog;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.requestmanagers.ValidateImportBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ImportBitsharesAccountRequest;
import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel; import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel;
import cy.agorise.crystalwallet.viewmodels.validators.ImportSeedValidator; import cy.agorise.crystalwallet.viewmodels.validators.ImportSeedValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener; import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
@ -210,6 +210,7 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator
clearErrors(); clearErrors();
} }
}); });
/*
etAccountName.addTextChangedListener(new TextWatcher() { etAccountName.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -224,14 +225,14 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
/* //
* Validate that PINs are equals // Validate that PINs are equals
* */ //
validatePINS(); validatePINS();
/* //
* If all is ready to continue enable the button, contrarie case disable it // If all is ready to continue enable the button, contrarie case disable it
* */ //
if(allFieldsAreOK()){ if(allFieldsAreOK()){
enableCreate(); enableCreate();
} }
@ -240,6 +241,7 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator
} }
} }
}); });
*/
accountSeedViewModel = ViewModelProviders.of(this).get(AccountSeedViewModel.class); accountSeedViewModel = ViewModelProviders.of(this).get(AccountSeedViewModel.class);
importSeedValidator = new ImportSeedValidator(this.getApplicationContext(),etPin,etPinConfirmation,etAccountName,etSeedWords); importSeedValidator = new ImportSeedValidator(this.getApplicationContext(),etPin,etPinConfirmation,etAccountName,etSeedWords);
@ -285,8 +287,8 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator
boolean complete = false; boolean complete = false;
if( etPin.getText().toString().trim().compareTo("")!=0 && if( etPin.getText().toString().trim().compareTo("")!=0 &&
etPinConfirmation.getText().toString().trim().compareTo("")!=0 && etPinConfirmation.getText().toString().trim().compareTo("")!=0 &&
etSeedWords.getText().toString().trim().compareTo("")!=0 && etSeedWords.getText().toString().trim().compareTo("")!=0 /*&&
etAccountName.getText().toString().trim().compareTo("")!=0){ etAccountName.getText().toString().trim().compareTo("")!=0*/){
if(pinsOK){ if(pinsOK){
complete = true; complete = true;
} }
@ -311,11 +313,11 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator
void afterSeedWordsChanged(Editable editable) { void afterSeedWordsChanged(Editable editable) {
this.importSeedValidator.validate(); this.importSeedValidator.validate();
} }
@OnTextChanged(value = R.id.etAccountName, /*@OnTextChanged(value = R.id.etAccountName,
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void afterAccountNameChanged(Editable editable) { void afterAccountNameChanged(Editable editable) {
this.importSeedValidator.validate(); this.importSeedValidator.validate();
} }*/
@OnClick(R.id.btnCancel) @OnClick(R.id.btnCancel)
public void cancel(){ public void cancel(){
@ -356,11 +358,11 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator
/* /*
* Validate mnemonic with the server * Validate mnemonic with the server
* */ * */
/*final ValidateImportBitsharesAccountRequest request = new ValidateImportBitsharesAccountRequest(etAccountName.getText().toString().trim(),etSeedWords.getText().toString().trim(),activity); /*final ImportBitsharesAccountRequest request = new ImportBitsharesAccountRequest(etSeedWords.getText().toString().trim(),activity);
request.setListener(new CryptoNetInfoRequestListener() { request.setListener(new CryptoNetInfoRequestListener() {
@Override @Override
public void onCarryOut() { public void onCarryOut() {
if(request.getStatus().equals(ValidateImportBitsharesAccountRequest.StatusCode.SUCCEEDED)){ if(request.getStatus().equals(ImportBitsharesAccountRequest.StatusCode.SUCCEEDED)){
//Correct //Correct
@ -391,8 +393,8 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator
final ImportSeedActivity thisActivity = this; final ImportSeedActivity thisActivity = this;
final ValidateImportBitsharesAccountRequest validatorRequest = final ImportBitsharesAccountRequest validatorRequest =
new ValidateImportBitsharesAccountRequest(etAccountName.getText().toString(), etSeedWords.getText().toString(), getApplicationContext(), true); new ImportBitsharesAccountRequest(etSeedWords.getText().toString(), getApplicationContext(), true);
validatorRequest.setListener(new CryptoNetInfoRequestListener() { validatorRequest.setListener(new CryptoNetInfoRequestListener() {
@Override @Override
@ -403,7 +405,7 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator
* */ * */
crystalLoading.dismiss(); crystalLoading.dismiss();
if (!validatorRequest.getStatus().equals(ValidateImportBitsharesAccountRequest.StatusCode.SUCCEEDED)) { if (!validatorRequest.getStatus().equals(ImportBitsharesAccountRequest.StatusCode.SUCCEEDED)) {
switch (validatorRequest.getStatus()){ switch (validatorRequest.getStatus()){
case PETITION_FAILED: case PETITION_FAILED:

View File

@ -25,6 +25,8 @@ import butterknife.ButterKnife;
import butterknife.OnTextChanged; import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.application.CrystalSecurityMonitor; import cy.agorise.crystalwallet.application.CrystalSecurityMonitor;
//import cy.agorise.crystalwallet.interfaces.OnResponse;
import cy.agorise.crystalwallet.interfaces.OnResponse;
import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.models.GeneralSetting;
import cy.agorise.crystalwallet.util.PasswordManager; import cy.agorise.crystalwallet.util.PasswordManager;
import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel; import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel;
@ -39,6 +41,11 @@ public class PatternRequestActivity extends AppCompatActivity {
@BindView(R.id.txtBadtry) @BindView(R.id.txtBadtry)
TextView txtBadtry; TextView txtBadtry;
/*
* External listener for success or fail
* */
private static OnResponse onResponse;
/* /*
* Contains the bad tries * Contains the bad tries
* */ * */
@ -67,6 +74,8 @@ public class PatternRequestActivity extends AppCompatActivity {
setContentView(R.layout.activity_pattern_request); setContentView(R.layout.activity_pattern_request);
ButterKnife.bind(this); ButterKnife.bind(this);
//onResponse = null;
GeneralSettingListViewModel generalSettingListViewModel = ViewModelProviders.of(this).get(GeneralSettingListViewModel.class); GeneralSettingListViewModel generalSettingListViewModel = ViewModelProviders.of(this).get(GeneralSettingListViewModel.class);
LiveData<List<GeneralSetting>> generalSettingsLiveData = generalSettingListViewModel.getGeneralSettingList(); LiveData<List<GeneralSetting>> generalSettingsLiveData = generalSettingListViewModel.getGeneralSettingList();
@ -100,11 +109,24 @@ public class PatternRequestActivity extends AppCompatActivity {
if (CrystalSecurityMonitor.getInstance(null).is2ndFactorSet()) { if (CrystalSecurityMonitor.getInstance(null).is2ndFactorSet()) {
//CrystalSecurityMonitor.getInstance(null).call2ndFactor(thisActivity); //CrystalSecurityMonitor.getInstance(null).call2ndFactor(thisActivity);
thisActivity.finish(); thisActivity.finish();
/*if(onResponse != null){
onResponse.onSuccess();
}*/
} else { } else {
thisActivity.finish(); thisActivity.finish();
/*if(onResponse != null){
onResponse.onSuccess();
}*/
} }
} else { } else {
incorrect(); incorrect();
/*if(onResponse != null){
onResponse.onFailed();
}*/
} }
} }
@ -122,6 +144,10 @@ public class PatternRequestActivity extends AppCompatActivity {
}); });
} }
public static void setOnResponse(OnResponse onResponse) {
PatternRequestActivity.onResponse = onResponse;
}
private void incorrect(){ private void incorrect(){
/* /*

View File

@ -31,6 +31,7 @@ import cy.agorise.crystalwallet.dialogs.material.DialogMaterial;
import cy.agorise.crystalwallet.dialogs.material.NegativeResponse; import cy.agorise.crystalwallet.dialogs.material.NegativeResponse;
import cy.agorise.crystalwallet.dialogs.material.PositiveResponse; import cy.agorise.crystalwallet.dialogs.material.PositiveResponse;
import cy.agorise.crystalwallet.dialogs.material.QuestionDialog; import cy.agorise.crystalwallet.dialogs.material.QuestionDialog;
import cy.agorise.crystalwallet.interfaces.OnResponse;
import cy.agorise.crystalwallet.models.AccountSeed; import cy.agorise.crystalwallet.models.AccountSeed;
import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.models.GeneralSetting;
import cy.agorise.crystalwallet.util.PasswordManager; import cy.agorise.crystalwallet.util.PasswordManager;
@ -46,15 +47,19 @@ public class PinRequestActivity extends AppCompatActivity {
TextView txtBadtry; TextView txtBadtry;
/* /*
* Contains the bad tries * Contains the bad tries
* */ * */
private int tries = 0; private int tries = 0;
/* /*
* Seconds counter * Seconds counter
* */ * */
private int seconds = 15; private int seconds = 15;
/*
* External listener for success or fail
* */
private static OnResponse onResponse;
@ -72,9 +77,11 @@ public class PinRequestActivity extends AppCompatActivity {
setContentView(R.layout.activity_pin_request); setContentView(R.layout.activity_pin_request);
ButterKnife.bind(this); ButterKnife.bind(this);
//onResponse = null;
/* /*
* Initially the button is disabled till the user type a valid PIN * Initially the button is disabled till the user type a valid PIN
* */ * */
btnOK.setEnabled(false); btnOK.setEnabled(false);
GeneralSettingListViewModel generalSettingListViewModel = ViewModelProviders.of(this).get(GeneralSettingListViewModel.class); GeneralSettingListViewModel generalSettingListViewModel = ViewModelProviders.of(this).get(GeneralSettingListViewModel.class);
@ -105,15 +112,24 @@ public class PinRequestActivity extends AppCompatActivity {
if (PasswordManager.checkPassword(passwordEncrypted, etPassword.getText().toString())) { if (PasswordManager.checkPassword(passwordEncrypted, etPassword.getText().toString())) {
if (CrystalSecurityMonitor.getInstance(null).is2ndFactorSet()) { if (CrystalSecurityMonitor.getInstance(null).is2ndFactorSet()) {
CrystalSecurityMonitor.getInstance(null).call2ndFactor(this); CrystalSecurityMonitor.getInstance(null).call2ndFactor(this);
if(onResponse != null){
onResponse.onSuccess();
}
} else { } else {
this.finish(); this.finish();
if(onResponse != null){
onResponse.onFailed();
}
} }
} }
else{ else{
/* /*
* One more bad try * One more bad try
* */ * */
++tries; ++tries;
final Activity activity = this; final Activity activity = this;
@ -121,8 +137,8 @@ public class PinRequestActivity extends AppCompatActivity {
etPassword.setTextColor(Color.RED); etPassword.setTextColor(Color.RED);
/* /*
* User can not go more up to 5 bad tries * User can not go more up to 5 bad tries
* */ * */
if(tries==4){ if(tries==4){
tries = 0; tries = 0;
@ -177,8 +193,8 @@ public class PinRequestActivity extends AppCompatActivity {
} }
/* /*
* Set in red the rext and reset the password after a period of time * Set in red the rext and reset the password after a period of time
* */ * */
final Timer t = new Timer(); final Timer t = new Timer();
//Set the schedule function and rate //Set the schedule function and rate
t.scheduleAtFixedRate(new TimerTask() { t.scheduleAtFixedRate(new TimerTask() {
@ -197,21 +213,26 @@ public class PinRequestActivity extends AppCompatActivity {
} }
}, },
//Set how long before to start calling the TimerTask (in milliseconds) //Set how long before to start calling the TimerTask (in milliseconds)
500, 500,
//Set the amount of time between each execution (in milliseconds) //Set the amount of time between each execution (in milliseconds)
500); 500);
} }
} }
public static void setOnResponse(OnResponse onResponse) {
PinRequestActivity.onResponse = onResponse;
}
@OnTextChanged(value = R.id.etPassword, @OnTextChanged(value = R.id.etPassword,
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void afterPasswordChanged(Editable editable) { void afterPasswordChanged(Editable editable) {
/* /*
* If it is valid length enable button * If it is valid length enable button
* */ * */
if(etPassword.getText().length()>=6){ if(etPassword.getText().length()>=6){
btnOK.setEnabled(true); btnOK.setEnabled(true);
} }
@ -219,6 +240,4 @@ public class PinRequestActivity extends AppCompatActivity {
btnOK.setEnabled(false); btnOK.setEnabled(false);
} }
} }
} }

View File

@ -1,5 +1,6 @@
package cy.agorise.crystalwallet.activities; package cy.agorise.crystalwallet.activities;
import android.app.Activity;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.os.Bundle; import android.os.Bundle;
@ -11,6 +12,7 @@ import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.jaredrummler.materialspinner.MaterialSpinner; import com.jaredrummler.materialspinner.MaterialSpinner;

View File

@ -124,13 +124,25 @@ public abstract class GrapheneApiGenerator {
new WitnessResponseListener() { new WitnessResponseListener() {
@Override @Override
public void onSuccess(WitnessResponse response) { public void onSuccess(WitnessResponse response) {
final List<List<UserAccount>> resp = (List<List<UserAccount>>) response.result; try {
if(resp.size() > 0){ final List<List<UserAccount>> resp = (List<List<UserAccount>>) response.result;
List<UserAccount> accounts = resp.get(0); if (resp.size() > 0) {
if(accounts.size() > 0){ List<UserAccount> accounts = resp.get(0);
for(UserAccount account : accounts) { if (accounts.size() > 0) {
request.getListener().success(account,request.getId());}}} for (UserAccount account : accounts) {
request.getListener().fail(request.getId()); request.getListener().success(account, request.getId());
break;
}
}else{
request.getListener().fail(request.getId());
}
} else {
request.getListener().fail(request.getId());
}
}catch(Exception e){
e.printStackTrace();
request.getListener().fail(request.getId());
}
} }
@Override @Override

View File

@ -16,6 +16,8 @@ import java.util.List;
import cy.agorise.crystalwallet.activities.PatternRequestActivity; import cy.agorise.crystalwallet.activities.PatternRequestActivity;
import cy.agorise.crystalwallet.activities.PinRequestActivity; import cy.agorise.crystalwallet.activities.PinRequestActivity;
import cy.agorise.crystalwallet.activities.PocketRequestActivity; 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.models.GeneralSetting;
import cy.agorise.crystalwallet.notifiers.CrystalWalletNotifier; import cy.agorise.crystalwallet.notifiers.CrystalWalletNotifier;
import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel; import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel;
@ -129,7 +131,7 @@ public class CrystalSecurityMonitor implements Application.ActivityLifecycleCall
public void onActivityStarted(Activity activity) { public void onActivityStarted(Activity activity) {
if (numStarted == 0) { if (numStarted == 0) {
if (!actualSecurity().equals("")){ if (!actualSecurity().equals("")){
callPasswordRequest(activity); callPasswordRequest(activity,null);
} }
} }
numStarted++; numStarted++;
@ -140,18 +142,39 @@ public class CrystalSecurityMonitor implements Application.ActivityLifecycleCall
numStarted--; numStarted--;
if (numStarted == 0) { if (numStarted == 0) {
if (!actualSecurity().equals("")){ 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"))) { if ((!activity.getIntent().hasExtra("ACTIVITY_TYPE")) || (!activity.getIntent().getStringExtra("ACTIVITY_TYPE").equals("PASSWORD_REQUEST"))) {
Intent intent = null; Intent intent = null;
if ((this.passwordEncrypted != null) && (!this.passwordEncrypted.equals(""))) { if ((this.passwordEncrypted != null) && (!this.passwordEncrypted.equals(""))) {
intent = new Intent(activity, PinRequestActivity.class); intent = new Intent(activity, PinRequestActivity.class);
PinRequestActivity.setOnResponse(null);
/*
* Connect error and success listeners
* */
if(onResponsePattern != null){
PinRequestActivity.setOnResponse(onResponsePattern);
}
} else if ((this.patternEncrypted != null) && (!this.patternEncrypted.equals(""))) { } else if ((this.patternEncrypted != null) && (!this.patternEncrypted.equals(""))) {
intent = new Intent(activity, PatternRequestActivity.class); intent = new Intent(activity, PatternRequestActivity.class);
PatternRequestActivity.setOnResponse(null);
/*
* Connect error and success listeners
* */
if(onResponsePattern != null){
PatternRequestActivity.setOnResponse(onResponsePattern);
}
} }
if (intent != null) { if (intent != null) {
intent.putExtra("ACTIVITY_TYPE", "PASSWORD_REQUEST"); intent.putExtra("ACTIVITY_TYPE", "PASSWORD_REQUEST");
@ -197,7 +220,4 @@ public class CrystalSecurityMonitor implements Application.ActivityLifecycleCall
public void onActivityDestroyed(Activity activity) { public void onActivityDestroyed(Activity activity) {
// //
} }
}
}

View File

@ -1,5 +1,6 @@
package cy.agorise.crystalwallet.fragments; package cy.agorise.crystalwallet.fragments;
import android.app.Activity;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
@ -8,6 +9,7 @@ import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.text.Editable; import android.text.Editable;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -27,7 +29,10 @@ import butterknife.ButterKnife;
import butterknife.OnTextChanged; import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.application.CrystalSecurityMonitor; 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.models.GeneralSetting;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.util.ChildViewPager; import cy.agorise.crystalwallet.util.ChildViewPager;
import cy.agorise.crystalwallet.util.PasswordManager; import cy.agorise.crystalwallet.util.PasswordManager;
import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel; import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel;
@ -47,8 +52,8 @@ public class PatternSecurityFragment extends Fragment {
TextView tvPatternText; TextView tvPatternText;
/* /*
* Contains the ChildViewPager to block the viewpager when the user is using the pattern control * Contains the ChildViewPager to block the viewpager when the user is using the pattern control
* */ * */
private ChildViewPager childViewPager; private ChildViewPager childViewPager;
private PatternLockViewListener actualPatternListener; private PatternLockViewListener actualPatternListener;
@ -169,8 +174,8 @@ public class PatternSecurityFragment extends Fragment {
private void resetPattern(){ private void resetPattern(){
/* /*
* Show error * Show error
* */ * */
tvPatternText.setText(getActivity().getResources().getString(R.string.Incorrect_pattern)); tvPatternText.setText(getActivity().getResources().getString(R.string.Incorrect_pattern));
tvPatternText.setTextColor(Color.RED); tvPatternText.setTextColor(Color.RED);
final Timer t = new Timer(); final Timer t = new Timer();
@ -199,7 +204,20 @@ public class PatternSecurityFragment extends Fragment {
public void savePattern(String pattern){ public void savePattern(String pattern){
String patternEncripted = PasswordManager.encriptPassword(pattern); String patternEncripted = PasswordManager.encriptPassword(pattern);
CrystalSecurityMonitor.getInstance(null).setPatternEncrypted(patternEncripted); 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 * Show success
@ -209,20 +227,20 @@ public class PatternSecurityFragment extends Fragment {
final Timer t_ = new Timer(); final Timer t_ = new Timer();
t_.scheduleAtFixedRate(new TimerTask() { t_.scheduleAtFixedRate(new TimerTask() {
@Override @Override
public void run() { public void run() {
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
t_.cancel(); t_.cancel();
showNewPatternUI(); showNewPatternUI();
} }
}); });
} }
}, },
//Set how long before to start calling the TimerTask (in milliseconds) //Set how long before to start calling the TimerTask (in milliseconds)
1000, 1000,
//Set the amount of time between each execution (in milliseconds) //Set the amount of time between each execution (in milliseconds)

View File

@ -152,6 +152,16 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
} }
List<CryptoCurrency> cryptoCurrencyList = db.cryptoCurrencyDao().getByIds(assetIds); List<CryptoCurrency> cryptoCurrencyList = db.cryptoCurrencyDao().getByIds(assetIds);
/*
* Test
* */
CryptoCurrency crypto1 = new CryptoCurrency();
crypto1.setId(1);
crypto1.setName("BITCOIN");
crypto1.setPrecision(1);
cryptoCurrencyList.add(crypto1);
CryptoCurrencyAdapter assetAdapter = new CryptoCurrencyAdapter(getContext(), android.R.layout.simple_spinner_item, cryptoCurrencyList); CryptoCurrencyAdapter assetAdapter = new CryptoCurrencyAdapter(getContext(), android.R.layout.simple_spinner_item, cryptoCurrencyList);
spAsset.setAdapter(assetAdapter); spAsset.setAdapter(assetAdapter);
} }

View File

@ -83,6 +83,11 @@ public class SecuritySettingsFragment extends Fragment {
View v = inflater.inflate(R.layout.fragment_security_settings, container, false); View v = inflater.inflate(R.layout.fragment_security_settings, container, false);
ButterKnife.bind(this, v); ButterKnife.bind(this, v);
/*
* For now this will not be implemented
* */
sPocketSecurity.setEnabled(false);
securityPagerAdapter = new SecurityPagerAdapter(getChildFragmentManager()); securityPagerAdapter = new SecurityPagerAdapter(getChildFragmentManager());
mPager.setAdapter(securityPagerAdapter); mPager.setAdapter(securityPagerAdapter);

View File

@ -58,8 +58,10 @@ import butterknife.OnClick;
import butterknife.OnItemSelected; import butterknife.OnItemSelected;
import butterknife.OnTextChanged; import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.application.CrystalSecurityMonitor;
import cy.agorise.crystalwallet.dialogs.material.CrystalDialog; import cy.agorise.crystalwallet.dialogs.material.CrystalDialog;
import cy.agorise.crystalwallet.dialogs.material.ToastIt; import cy.agorise.crystalwallet.dialogs.material.ToastIt;
import cy.agorise.crystalwallet.interfaces.OnResponse;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesSendRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesSendRequest;
@ -132,8 +134,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
View viewCamera; View viewCamera;
/* /*
* Flag to control when the camera is visible and when is hide * Flag to control when the camera is visible and when is hide
* */ * */
private boolean cameraVisible = true; private boolean cameraVisible = true;
Button btnScanQrCode; Button btnScanQrCode;
@ -180,53 +182,10 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
View view = inflater.inflate(R.layout.send_transaction, null); View view = inflater.inflate(R.layout.send_transaction, null);
ButterKnife.bind(this, view); 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); this.cryptoNetAccountId = getArguments().getLong("CRYPTO_NET_ACCOUNT_ID",-1);
final Activity activity = getActivity();
/* /*
* Add style to the spinner android * Add style to the spinner android
* */ * */
@ -237,9 +196,9 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
this.cryptoNetAccount = db.cryptoNetAccountDao().getById(this.cryptoNetAccountId); this.cryptoNetAccount = db.cryptoNetAccountDao().getById(this.cryptoNetAccountId);
/* /*
* this is only for graphene accounts. * this is only for graphene accounts.
* *
**/ **/
this.grapheneAccount = new GrapheneAccount(this.cryptoNetAccount); this.grapheneAccount = new GrapheneAccount(this.cryptoNetAccount);
this.grapheneAccount.loadInfo(db.grapheneAccountInfoDao().getByAccountId(this.cryptoNetAccountId)); this.grapheneAccount.loadInfo(db.grapheneAccountInfoDao().getByAccountId(this.cryptoNetAccountId));
@ -253,6 +212,15 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
} }
List<CryptoCurrency> cryptoCurrencyList = db.cryptoCurrencyDao().getByIds(assetIds); List<CryptoCurrency> 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); assetAdapter = new CryptoCurrencyAdapter(getContext(), android.R.layout.simple_spinner_item, cryptoCurrencyList);
spAsset.setAdapter(assetAdapter); spAsset.setAdapter(assetAdapter);
} }
@ -266,8 +234,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
CryptoNetAccountAdapter fromSpinnerAdapter = new CryptoNetAccountAdapter(this.getContext(), android.R.layout.simple_spinner_item, cryptoNetAccounts); CryptoNetAccountAdapter fromSpinnerAdapter = new CryptoNetAccountAdapter(this.getContext(), android.R.layout.simple_spinner_item, cryptoNetAccounts);
/* /*
* If only one account block the control * If only one account block the control
* */ * */
if(cryptoNetAccounts.size()==1){ if(cryptoNetAccounts.size()==1){
spFrom.setEnabled(false); spFrom.setEnabled(false);
} }
@ -276,8 +244,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
//spFrom.setSelection(0); //spFrom.setSelection(0);
/* /*
* Custom material spinner implementation * Custom material spinner implementation
* */ * */
spFrom.setItems(cryptoNetAccounts); spFrom.setItems(cryptoNetAccounts);
//spFrom.setSelectedIndex(0); //spFrom.setSelectedIndex(0);
spFrom.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<CryptoNetAccount>() { spFrom.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<CryptoNetAccount>() {
@ -307,8 +275,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
// Your Permission granted already .Do next code // Your Permission granted already .Do next code
/* /*
* Init the camera * Init the camera
* */ * */
try { try {
beginScanQrCode(); beginScanQrCode();
}catch(Exception e){ }catch(Exception e){
@ -344,8 +312,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
Toast.makeText(getActivity(), getActivity().getString(R.string.permission_denied_camera), Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), getActivity().getString(R.string.permission_denied_camera), Toast.LENGTH_LONG).show();
/* /*
* Disable the button of the camera visibility * Disable the button of the camera visibility
* */ * */
disableVisibilityCamera(); disableVisibilityCamera();
} else { } else {
@ -490,8 +458,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
mScannerView.stopCamera(); mScannerView.stopCamera();
/* /*
* Hide the camera or show it * Hide the camera or show it
* */ * */
if(cameraVisible){ if(cameraVisible){
hideCamera(); hideCamera();
} }
@ -522,31 +490,31 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
cameraVisible = true; cameraVisible = true;
/* /*
* Star the camera again * Star the camera again
* */ * */
beginScanQrCode(); beginScanQrCode();
} }
/* /*
* Hide the camera and show the black background * Hide the camera and show the black background
* */ * */
private void hideCamera(){ private void hideCamera(){
/* /*
* Change visibilities of views * Change visibilities of views
* */ * */
viewCamera.setVisibility(View.VISIBLE); viewCamera.setVisibility(View.VISIBLE);
mScannerView.setVisibility(View.INVISIBLE); mScannerView.setVisibility(View.INVISIBLE);
/* /*
* Change icon * Change icon
* */ * */
btnCloseCamera.setImageDrawable(getResources().getDrawable(R.drawable.ok)); btnCloseCamera.setImageDrawable(getResources().getDrawable(R.drawable.ok));
/* /*
* Reset variable * Reset variable
* */ * */
cameraVisible = false; cameraVisible = false;
} }
@ -627,12 +595,12 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
Long amount = (long)Math.floor(amountFromEditText*Math.round(Math.pow(10,((CryptoCurrency)spAsset.getSelectedItem()).getPrecision()))); Long amount = (long)Math.floor(amountFromEditText*Math.round(Math.pow(10,((CryptoCurrency)spAsset.getSelectedItem()).getPrecision())));
final ValidateBitsharesSendRequest sendRequest = new ValidateBitsharesSendRequest( final ValidateBitsharesSendRequest sendRequest = new ValidateBitsharesSendRequest(
this.getContext(), this.getContext(),
grapheneAccountSelected, grapheneAccountSelected,
this.etTo.getText().toString(), this.etTo.getText().toString(),
amount, amount,
((CryptoCurrency)spAsset.getSelectedItem()).getName(), ((CryptoCurrency)spAsset.getSelectedItem()).getName(),
etMemo.getText().toString() etMemo.getText().toString()
); );
sendRequest.setListener(new CryptoNetInfoRequestListener() { sendRequest.setListener(new CryptoNetInfoRequestListener() {
@ -653,14 +621,28 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
}); });
/* /*
* Show loading dialog * If exists mode scurity show it and valide events in case of success or fail
* */ * */
crystalDialog = new CrystalDialog((Activity) getContext()); CrystalSecurityMonitor.getInstance(null).callPasswordRequest(this.getActivity(), new OnResponse() {
crystalDialog.setText("Sending"); @Override
crystalDialog.progress(); public void onSuccess() {
crystalDialog.show();
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() {
}
});
} }
} }
@ -761,4 +743,4 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

View File

@ -0,0 +1,6 @@
package cy.agorise.crystalwallet.interfaces;
public interface OnResponse {
void onSuccess();
void onFailed();
}

View File

@ -28,6 +28,7 @@ import cy.agorise.crystalwallet.requestmanagers.CryptoNetEquivalentRequest;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequest; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequest;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestsListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestsListener;
import cy.agorise.crystalwallet.requestmanagers.GetBitsharesAccountNameCacheRequest; import cy.agorise.crystalwallet.requestmanagers.GetBitsharesAccountNameCacheRequest;
import cy.agorise.crystalwallet.requestmanagers.ImportBitsharesAccountRequest;
import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesLTMUpgradeRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesLTMUpgradeRequest;
import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesSendRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesSendRequest;
import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest;
@ -222,7 +223,9 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
@Override @Override
public void onNewRequest(CryptoNetInfoRequest request) { public void onNewRequest(CryptoNetInfoRequest request) {
if(request.getCoin().equals(CryptoCoin.BITSHARES)) { if(request.getCoin().equals(CryptoCoin.BITSHARES)) {
if (request instanceof ValidateImportBitsharesAccountRequest) { if (request instanceof ImportBitsharesAccountRequest) {
this.importAccount((ImportBitsharesAccountRequest) request);
} else if (request instanceof ValidateImportBitsharesAccountRequest) {
this.validateImportAccount((ValidateImportBitsharesAccountRequest) request); this.validateImportAccount((ValidateImportBitsharesAccountRequest) request);
} else if (request instanceof ValidateExistBitsharesAccountRequest) { } else if (request instanceof ValidateExistBitsharesAccountRequest) {
this.validateExistAcccount((ValidateExistBitsharesAccountRequest) request); this.validateExistAcccount((ValidateExistBitsharesAccountRequest) request);
@ -244,6 +247,78 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
} }
} }
private void importAccount(final ImportBitsharesAccountRequest importRequest){
final CrystalDatabase db = CrystalDatabase.getAppDatabase(importRequest.getContext());
final AccountSeedDao accountSeedDao = db.accountSeedDao();
ApiRequest getAccountNamesBK = new ApiRequest(0, new ApiRequestListener() {
@Override
public void success(Object answer, int idPetition) {
if(answer != null && importRequest.getStatus().equals(ImportBitsharesAccountRequest.StatusCode.NOT_STARTED)) {
UserAccount userAccount = (UserAccount) answer;
importRequest.setSeedType(SeedType.BRAINKEY);
importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.SUCCEEDED);
AccountSeed seed = new AccountSeed();
seed.setName(userAccount.getName());
seed.setType(importRequest.getSeedType());
seed.setMasterSeed(importRequest.getMnemonic());
long idSeed = accountSeedDao.insertAccountSeed(seed);
if (idSeed >= 0) {
GrapheneAccount account = new GrapheneAccount();
account.setCryptoNet(CryptoNet.BITSHARES);
account.setAccountIndex(0);
account.setSeedId(idSeed);
account.setAccountId(userAccount.getObjectId());
importAccountFromSeed(account, importRequest.getContext());
}
}
}
@Override
public void fail(int idPetition) {
BIP39 bip39 = new BIP39(-1, importRequest.getMnemonic());
ApiRequest getAccountNamesBP39 = new ApiRequest(0, new ApiRequestListener() {
@Override
public void success(Object answer, int idPetition) {
if(answer != null && importRequest.getStatus().equals(ImportBitsharesAccountRequest.StatusCode.NOT_STARTED)) {
UserAccount userAccount = (UserAccount) answer;
importRequest.setSeedType(SeedType.BIP39);
importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.SUCCEEDED);
AccountSeed seed = new AccountSeed();
seed.setName(userAccount.getName());
seed.setType(importRequest.getSeedType());
seed.setMasterSeed(importRequest.getMnemonic());
long idSeed = accountSeedDao.insertAccountSeed(seed);
if (idSeed >= 0) {
GrapheneAccount account = new GrapheneAccount();
account.setCryptoNet(CryptoNet.BITSHARES);
account.setAccountIndex(0);
account.setSeedId(idSeed);
account.setAccountId(userAccount.getObjectId());
importAccountFromSeed(account, importRequest.getContext());
}
}
}
@Override
public void fail(int idPetition) {
importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.BAD_SEED);
}
});
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(new Address(ECKey.fromPublicOnly(bip39.getBitsharesActiveKey(0).getPubKey())),getAccountNamesBP39);
}
});
BrainKey bk = new BrainKey(importRequest.getMnemonic(), 0);
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(bk.getPublicAddress("BTS"),getAccountNamesBK);
}
/** /**
* Process the import account request * Process the import account request
*/ */

View File

@ -31,9 +31,16 @@ public class GrapheneAccount extends CryptoNetAccount {
} }
public void loadInfo(GrapheneAccountInfo info){ public void loadInfo(GrapheneAccountInfo info){
this.name = info.getName(); if(info != null){
this.accountId = info.getAccountId(); this.name = info.getName();
this.upgradedToLtm = info.getUpgradedToLtm(); this.accountId = info.getAccountId();
this.upgradedToLtm = info.getUpgradedToLtm();
}
else{
this.name = "";
this.accountId = "-1";
this.upgradedToLtm = false;
}
} }
public String getName() { public String getName() {

View File

@ -0,0 +1,90 @@
package cy.agorise.crystalwallet.requestmanagers;
import android.content.Context;
import cy.agorise.crystalwallet.enums.CryptoCoin;
import cy.agorise.crystalwallet.enums.SeedType;
/**
* Imports a bitshares accounts,
*
* return true if the account exist, and the mnemonic (brainkey provide is for that account
* Created by Henry Varona on 10/24/2018.
*/
public class ImportBitsharesAccountRequest extends CryptoNetInfoRequest {
/**
* The status code of this request
*/
public enum StatusCode{
NOT_STARTED,
SUCCEEDED,
NO_INTERNET,
NO_SERVER_CONNECTION,
ACCOUNT_DOESNT_EXIST,
BAD_SEED,
NO_ACCOUNT_DATA,
PETITION_FAILED
}
/**
* The mnemonic words
*/
private final String mnemonic;
/**
* If this seed is BIP39 or Brainkey
*/
private SeedType seedType;
/**
* The status of this request
*/
private StatusCode status = StatusCode.NOT_STARTED;
private Context context;
public ImportBitsharesAccountRequest(String mnemonic, Context context){
super(CryptoCoin.BITSHARES);
this.mnemonic = mnemonic;
this.context = context;
}
public ImportBitsharesAccountRequest(String mnemonic, Context context, boolean addAccountIfValid){
super(CryptoCoin.BITSHARES);
this.mnemonic = mnemonic;
this.context = context;
}
public void validate(){
if (!(this.status.equals(StatusCode.NOT_STARTED))){
this._fireOnCarryOutEvent();
}
}
public String getMnemonic() {
return mnemonic;
}
public SeedType getSeedType() {
return seedType;
}
public Context getContext() {
return context;
}
public void setSeedType(SeedType seedType) {
this.seedType = seedType;
}
public void setStatus(StatusCode status) {
this.status = status;
this._fireOnCarryOutEvent();
}
public StatusCode getStatus() {
return status;
}
}

View File

@ -48,7 +48,12 @@ public class AmountValidationField extends ValidationField {
CryptoCoinBalance balance = CrystalDatabase.getAppDatabase(amountField.getContext()).cryptoCoinBalanceDao().getBalanceFromAccount(this.account.getId(),cryptoCurrency.getId()); 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)); setMessageForValue(mixedValues, validator.getContext().getResources().getString(R.string.insufficient_amount));
setValidForValue(mixedValues, false); setValidForValue(mixedValues, false);
} else if (newAmountValue == 0){ } else if (newAmountValue == 0){

View File

@ -84,8 +84,9 @@
android:layout_width="330dp" android:layout_width="330dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/etSeedWordsLayout" android:layout_below="@+id/etSeedWordsLayout"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_centerHorizontal="true"> android:visibility="gone">
<cy.agorise.crystalwallet.views.natives.CustomTextInputEditText <cy.agorise.crystalwallet.views.natives.CustomTextInputEditText
android:id="@+id/etAccountName" android:id="@+id/etAccountName"
@ -95,7 +96,8 @@
android:hint="@string/txt_account_name" android:hint="@string/txt_account_name"
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:maxLength="255" android:maxLength="255"
android:singleLine="true" /> android:singleLine="true"
android:visibility="gone" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>

View File

@ -5,7 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="24dp"> android:paddingBottom="24dp">
@ -18,11 +18,10 @@
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:layout_marginStart="0dp" android:layout_marginStart="0dp"
android:layout_marginTop="0dp" android:layout_marginTop="0dp"
app:layout_constraintEnd_toEndOf="parent" android:layout_alignParentTop="true"/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/txtTittle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
@ -31,89 +30,78 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="20sp" android:textSize="20sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" android:layout_alignParentTop="true" />
app:layout_constraintTop_toTopOf="parent" />
<cy.agorise.crystalwallet.util.CircularImageView <cy.agorise.crystalwallet.util.CircularImageView
android:id="@+id/gravatar" android:id="@+id/gravatar"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_below="@+id/txtTittle"
android:layout_marginStart="32dp" android:layout_marginStart="32dp"
android:layout_marginTop="90dp" android:layout_marginTop="30dp"
android:src="@drawable/avatar_placeholder" android:src="@drawable/avatar_placeholder" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Spinner <Spinner
android:id="@+id/spTo" android:id="@+id/spTo"
android:layout_width="0dp" android:layout_width="200dp"
android:layout_height="wrap_content" android:layout_height="50dp"
android:layout_marginEnd="24dp" android:layout_marginTop="30dp"
android:layout_marginStart="16dp" android:layout_below="@+id/txtTittle"
app:layout_constraintEnd_toEndOf="parent" android:layout_alignParentRight="true"
app:layout_constraintStart_toEndOf="@id/gravatar" android:layout_marginRight="20dp"/>
app:layout_constraintTop_toTopOf="@id/gravatar" />
<TextView <TextView
android:id="@+id/tvFromError" android:id="@+id/tvFromError"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/red" android:textColor="@color/red"
app:layout_constraintEnd_toEndOf="@+id/spTo" android:layout_below="@+id/gravatar"
app:layout_constraintStart_toStartOf="@+id/spTo" android:layout_marginTop="10dp"/>
app:layout_constraintTop_toBottomOf="@+id/topView" />
<EditText <EditText
android:id="@+id/etAmount" android:id="@+id/etAmount"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="24dp" android:layout_below="@+id/tvFromError"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:inputType="numberDecimal" android:layout_marginTop="10dp"
android:textSize="20sp"
android:hint="@string/amount" android:hint="@string/amount"
app:layout_constraintStart_toStartOf="parent" android:inputType="numberDecimal"
app:layout_constraintTop_toBottomOf="@+id/gravatar" /> android:textSize="20sp" />
<TextView <TextView
android:id="@+id/tvAmountError" android:id="@+id/tvAmountError"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/red" android:textColor="@color/red"
app:layout_constraintEnd_toEndOf="@+id/etAmount" android:layout_below="@+id/etAmount"/>
app:layout_constraintStart_toStartOf="@+id/etAmount"
app:layout_constraintTop_toBottomOf="@+id/etAmount" />
<Spinner <Spinner
android:id="@+id/spAsset" android:id="@+id/spAsset"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="24dp" android:layout_marginEnd="24dp"
android:layout_marginTop="8dp" android:layout_marginTop="25dp"
android:gravity="top" android:gravity="top"
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:layout_below="@+id/tvFromError"
android:textColor="@color/white" android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent" android:layout_alignParentRight="true"
app:layout_constraintTop_toTopOf="@+id/etAmount" /> android:layout_marginRight="20dp"/>
<View <View
android:id="@+id/viewSpinner" android:id="@+id/viewSpinner"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="3dp" android:layout_height="3dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:background="@color/gray" android:background="@color/gray" />
app:layout_constraintEnd_toEndOf="@+id/spAsset"
app:layout_constraintStart_toStartOf="@+id/spAsset"
app:layout_constraintTop_toBottomOf="@id/spAsset" />
<TextView <TextView
android:id="@+id/tvAssetError" android:id="@+id/tvAssetError"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/red" android:textColor="@color/red"
app:layout_constraintBottom_toBottomOf="@+id/tvAmountError" android:layout_below="@+id/spAsset"/>
app:layout_constraintEnd_toEndOf="@+id/spAsset"
app:layout_constraintStart_toStartOf="@+id/spAsset" />
<cy.agorise.crystalwallet.util.SquaredImageView <cy.agorise.crystalwallet.util.SquaredImageView
android:id="@+id/ivQrCode" android:id="@+id/ivQrCode"
@ -121,13 +109,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="24dp" android:layout_marginEnd="24dp"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:layout_marginTop="8dp" android:layout_marginTop="5dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:contentDescription="@string/qr_code" android:contentDescription="@string/qr_code"
android:src="@color/gray" android:src="@color/gray"
app:layout_constraintEnd_toEndOf="parent" android:layout_below="@+id/tvAmountError"
app:layout_constraintStart_toStartOf="parent" android:layout_centerHorizontal="true"/>
app:layout_constraintTop_toBottomOf="@+id/tvAmountError"/>
<TextView <TextView
android:id="@+id/tvShare" android:id="@+id/tvShare"
@ -139,20 +126,20 @@
android:text="@string/share_this_qr" android:text="@string/share_this_qr"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@id/ivQrCode" android:layout_below="@+id/ivQrCode" />
app:layout_constraintStart_toStartOf="parent"/>
<TextView <TextView
android:id="@+id/tvCancel" android:id="@+id/tvCancel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp" android:layout_marginEnd="24dp"
android:text="@string/close" android:text="@string/close"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintTop_toTopOf="@id/tvShare" android:layout_below="@+id/ivQrCode"
app:layout_constraintEnd_toEndOf="parent" /> android:layout_alignParentRight="true"/>
</android.support.constraint.ConstraintLayout> </RelativeLayout>
</ScrollView> </ScrollView>