- Send view created, along with its Validators.

- Currency Spinner Adapter created
- Send activity and layout created
This commit is contained in:
Javier Varona 2017-10-25 21:33:38 -04:00
parent efb6820b9e
commit f4dbd4e93b
21 changed files with 630 additions and 633 deletions

View file

@ -1,6 +1,5 @@
package cy.agorise.crystalwallet.activities;
import android.app.Activity;
import android.arch.lifecycle.ViewModelProviders;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
@ -14,19 +13,16 @@ import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.enums.CryptoNet;
import cy.agorise.crystalwallet.enums.SeedType;
import cy.agorise.crystalwallet.models.AccountSeed;
import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.models.GrapheneAccount;
import cy.agorise.crystalwallet.models.GrapheneAccountInfo;
import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel;
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountViewModel;
import cy.agorise.crystalwallet.viewmodels.GrapheneAccountInfoViewModel;
import cy.agorise.crystalwallet.viewmodels.validators.ImportSeedValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
import cy.agorise.crystalwallet.viewmodels.validators.ValidationField;
import cy.agorise.crystalwallet.views.CryptoNetBalanceListView;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
public class ImportSeedActivity extends AppCompatActivity implements UIValidatorListener {

View file

@ -0,0 +1,209 @@
package cy.agorise.crystalwallet.activities;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.SimpleAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.enums.CryptoNet;
import cy.agorise.crystalwallet.enums.SeedType;
import cy.agorise.crystalwallet.models.AccountSeed;
import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCurrency;
import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.models.GrapheneAccountInfo;
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountViewModel;
import cy.agorise.crystalwallet.viewmodels.GrapheneAccountInfoViewModel;
import cy.agorise.crystalwallet.viewmodels.validators.SendTransactionValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
public class SendTransactionActivity extends AppCompatActivity implements UIValidatorListener {
SendTransactionValidator sendTransactionValidator;
@BindView(R.id.etFrom)
EditText etFrom;
@BindView(R.id.tvFromError)
TextView tvFromError;
@BindView(R.id.etTo)
EditText etTo;
@BindView(R.id.tvToError)
TextView tvToError;
@BindView(R.id.spAsset)
Spinner spAsset;
@BindView(R.id.tvAssetError)
TextView tvAssetError;
@BindView(R.id.etAmount)
EditText etAmount;
@BindView(R.id.tvAmountError)
TextView tvAmountError;
@BindView (R.id.etMemo)
EditText etMemo;
@BindView(R.id.tvMemoError)
TextView tvMemoError;
@BindView(R.id.btnSend)
Button btnSend;
@BindView(R.id.btnCancel)
Button btnCancel;
private long cryptoNetAccountId;
private CryptoNetAccount cryptoNetAccount;
private CrystalDatabase db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.send_transaction);
ButterKnife.bind(this);
btnSend.setEnabled(false);
this.cryptoNetAccountId = getIntent().getLongExtra("CRYPTO_NET_ACCOUNT_ID", -1);
if (this.cryptoNetAccountId != -1) {
db = CrystalDatabase.getAppDatabase(this);
this.cryptoNetAccount = db.cryptoNetAccountDao().getById(this.cryptoNetAccountId);
final LiveData<List<CryptoCoinBalance>> balancesList = db.cryptoCoinBalanceDao().getBalancesFromAccount(cryptoNetAccountId);
balancesList.observe(this, new Observer<List<CryptoCoinBalance>>() {
@Override
public void onChanged(@Nullable List<CryptoCoinBalance> cryptoCoinBalances) {
ArrayList<Long> assetIds = new ArrayList<Long>();
ArrayList<String> assetLabels = new ArrayList<String>();
for (CryptoCoinBalance nextBalance : balancesList.getValue()) {
assetIds.add(nextBalance.getCryptoCurrencyId());
}
List<CryptoCurrency> cryptoCurrencyList = db.cryptoCurrencyDao().getByIds(assetIds);
for (CryptoCurrency nextCurrency : cryptoCurrencyList) {
assetLabels.add(nextCurrency.getName());
}
ArrayAdapter<String> assetAdapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_spinner_item, assetLabels);
spAsset.setAdapter(assetAdapter);
}
});
sendTransactionValidator = new SendTransactionValidator(this.getApplicationContext(), this.cryptoNetAccount, etFrom, etTo, etAmount, etMemo);
sendTransactionValidator.setListener(this);
} else {
this.finish();
}
}
@OnTextChanged(value = R.id.etFrom,
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void afterFromChanged(Editable editable) {
this.sendTransactionValidator.validate();
}
@OnTextChanged(value = R.id.etTo,
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void afterToChanged(Editable editable) {
this.sendTransactionValidator.validate();
}
@OnTextChanged(value = R.id.etAmount,
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void afterAmountChanged(Editable editable) {
this.sendTransactionValidator.validate();
}
@OnTextChanged(value = R.id.etMemo,
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void afterMemoChanged(Editable editable) {
this.sendTransactionValidator.validate();
}
@OnClick(R.id.btnCancel)
public void cancel(){
this.finish();
}
@OnClick(R.id.btnSend)
public void importSeed(){
if (this.sendTransactionValidator.isValid()) {
AccountSeed seed = new AccountSeed();
//TODO verify if words are already in the db
//TODO check if name has been asigned to other seed
seed.setMasterSeed(etSeedWords.getText().toString());
seed.setName(etAccountName.getText().toString());
seed.setType(SeedType.BRAINKEY);
accountSeedViewModel.addSeed(seed);
CryptoNetAccountViewModel cryptoNetAccountViewModel = ViewModelProviders.of(this).get(CryptoNetAccountViewModel.class);
GrapheneAccountInfoViewModel grapheneAccountInfoViewModel = ViewModelProviders.of(this).get(GrapheneAccountInfoViewModel.class);
CryptoNetAccount cryptoNetAccount = new CryptoNetAccount();
cryptoNetAccount.setSeedId(seed.getId());
cryptoNetAccount.setAccountIndex(0);
cryptoNetAccount.setCryptoNet(CryptoNet.BITSHARES);
cryptoNetAccountViewModel.addCryptoNetAccount(cryptoNetAccount);
GrapheneAccountInfo grapheneAccountInfo = new GrapheneAccountInfo(cryptoNetAccount.getId());
grapheneAccountInfo.setName(etAccountName.getText().toString());
grapheneAccountInfoViewModel.addGrapheneAccountInfo(grapheneAccountInfo);
this.finish();
}
}
@Override
public void onValidationSucceeded(final ValidationField field) {
final SendTransactionActivity activity = this;
activity.runOnUiThread(new Runnable() {
public void run() {
if (field.getView() == etFrom) {
tvFromError.setText("");
} else if (field.getView() == etTo){
tvToError.setText("");
} else if (field.getView() == etAmount){
tvAmountError.setText("");
} else if (field.getView() == etMemo){
tvMemoError.setText("");
}
if (activity.sendTransactionValidator.isValid()){
btnSend.setEnabled(true);
} else {
btnSend.setEnabled(false);
}
}
});
}
@Override
public void onValidationFailed(ValidationField field) {
if (field.getView() == etFrom) {
tvFromError.setText(field.getMessage());
} else if (field.getView() == etTo){
tvToError.setText(field.getMessage());
} else if (field.getView() == etAmount){
tvAmountError.setText(field.getMessage());
} else if (field.getView() == etMemo){
tvMemoError.setText(field.getMessage());
}
}
}

View file

@ -28,6 +28,9 @@ public interface CryptoCoinBalanceDao {
@Query("SELECT * FROM crypto_coin_balance WHERE account_id = :accountId")
LiveData<List<CryptoCoinBalance>> getBalancesFromAccount(long accountId);
@Query("SELECT * FROM crypto_coin_balance WHERE account_id = :accountId AND crypto_currency_id = :assetId")
CryptoCoinBalance getBalanceFromAccount(long accountId, long assetId);
@Insert(onConflict = OnConflictStrategy.REPLACE)
public long[] insertCryptoCoinBalance(CryptoCoinBalance... balances);

View file

@ -22,6 +22,9 @@ public interface CryptoCurrencyDao {
@Query("SELECT * FROM crypto_currency WHERE id = :id")
CryptoCurrency getById(int id);
@Query("SELECT * FROM crypto_currency WHERE id IN (:ids)")
List<CryptoCurrency> getByIds(List<Long> ids);
@Insert(onConflict = OnConflictStrategy.REPLACE)
public long[] insertCryptoCurrency(CryptoCurrency... currencies);

View file

@ -3,6 +3,11 @@ package cy.agorise.crystalwallet.viewmodels.validators;
import android.content.Context;
import android.widget.EditText;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.BitsharesAccountMnemonicValidationField;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.BitsharesAccountNameValidationField;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.PinConfirmationValidationField;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.PinValidationField;
/**
* Created by Henry Varona on 2/10/2017.
*/

View file

@ -0,0 +1,36 @@
package cy.agorise.crystalwallet.viewmodels.validators;
import android.content.Context;
import android.widget.EditText;
import android.widget.Spinner;
import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.AmountValidationField;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.AssetValidationField;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.FromValidationField;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.MemoValidationField;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ToValidationField;
/**
* Created by Henry Varona on 2/10/2017.
*/
public class SendTransactionValidator extends UIValidator {
private CryptoNetAccount account;
public SendTransactionValidator(Context context, CryptoNetAccount account, EditText fromEdit, EditText toEdit, Spinner assetSpinner, EditText amountEdit, EditText memoEdit){
super(context);
this.account = account;
this.addField(new FromValidationField(fromEdit));
this.addField(new ToValidationField(fromEdit, toEdit));
this.addField(new AssetValidationField(assetSpinner));
this.addField(new AmountValidationField(amountEdit, assetSpinner, this.account));
this.addField(new MemoValidationField(memoEdit));
}
public CryptoNetAccount getAccount() {
return account;
}
}

View file

@ -5,11 +5,13 @@ import android.content.Context;
import java.util.ArrayList;
import java.util.List;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
/**
* Created by Henry Varona on 7/10/2017.
*/
abstract class UIValidator {
public abstract class UIValidator {
protected Context context;
protected UIValidatorListener listener;
protected List<ValidationField> validationFields;

View file

@ -1,5 +1,7 @@
package cy.agorise.crystalwallet.viewmodels.validators;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
/**
* Created by Henry Varona on 2/10/2017.
*/

View file

@ -0,0 +1,63 @@
package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.view.View;
import android.widget.EditText;
import android.widget.Spinner;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest;
import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCurrency;
import cy.agorise.crystalwallet.models.CryptoNetAccount;
/**
* Created by Henry Varona on 7/10/2017.
*/
public class AmountValidationField extends ValidationField {
private EditText amountField;
private Spinner assetSpinner;
private CryptoNetAccount account;
public AmountValidationField(EditText amountField, Spinner assetSpinner, CryptoNetAccount account) {
super(amountField);
this.amountField = amountField;
this.assetSpinner = assetSpinner;
this.account = account;
}
public void validate(){
try {
final float newAmountValue = Float.parseFloat(amountField.getText().toString());
final CryptoCurrency cryptoCurrency = (CryptoCurrency)assetSpinner.getSelectedItem();
final String mixedValues = newAmountValue+"_"+cryptoCurrency.getId();
this.setLastValue(mixedValues);
this.startValidating();
final ValidationField field = this;
CryptoCoinBalance balance = CrystalDatabase.getAppDatabase(amountField.getContext()).cryptoCoinBalanceDao().getBalanceFromAccount(this.account.getId(),cryptoCurrency.getId());
if (newAmountValue > balance.getBalance()){
setValidForValue(mixedValues, false);
setMessage(validator.getContext().getResources().getString(R.string.insufficient_amount));
validator.validationFailed(field);
} else if (newAmountValue == 0){
setValidForValue(mixedValues, false);
setMessage(validator.getContext().getResources().getString(R.string.amount_should_be_greater_than_zero));
validator.validationFailed(field);
} else {
setValidForValue(mixedValues, true);
validator.validationSucceeded(field);
}
} catch (NumberFormatException e){
setLastValue("");
setValidForValue("", false);
setMessage(validator.getContext().getResources().getString(R.string.please_enter_valid_amount));
validator.validationFailed(this);
}
}
}

View file

@ -0,0 +1,31 @@
package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText;
import android.widget.Spinner;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest;
import cy.agorise.crystalwallet.models.CryptoCurrency;
/**
* Created by Henry Varona on 7/10/2017.
*/
public class AssetValidationField extends ValidationField {
private Spinner assetField;
public AssetValidationField(Spinner assetField){
super(assetField);
this.assetField = assetField;
}
public void validate(){
final CryptoCurrency cryptoCurrencySelected = (CryptoCurrency) this.assetField.getSelectedItem();
final String newValue = ""+cryptoCurrencySelected.getId();
this.setLastValue(newValue);
validator.validationSucceeded(this);
}
}

View file

@ -1,4 +1,4 @@
package cy.agorise.crystalwallet.viewmodels.validators;
package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText;

View file

@ -1,13 +1,11 @@
package cy.agorise.crystalwallet.viewmodels.validators;
package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.content.Context;
import android.widget.EditText;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateImportBitsharesAccountRequest;
/**
* Created by Henry Varona on 7/10/2017.

View file

@ -0,0 +1,45 @@
package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest;
/**
* Created by Henry Varona on 7/10/2017.
*/
public class FromValidationField extends ValidationField {
private EditText fromField;
public FromValidationField(EditText fromField){
super(fromField);
this.fromField = fromField;
}
public void validate(){
final String newValue = fromField.getText().toString();
this.setLastValue(newValue);
this.startValidating();
final ValidationField field = this;
final ValidateExistBitsharesAccountRequest request = new ValidateExistBitsharesAccountRequest(newValue);
request.setListener(new CryptoNetInfoRequestListener() {
@Override
public void onCarryOut() {
if (!request.getAccountExists()){
setValidForValue(newValue, false);
setMessage(validator.getContext().getResources().getString(R.string.account_name_not_exist));
validator.validationFailed(field);
} else {
setValidForValue(newValue, true);
validator.validationSucceeded(field);
}
}
});
CryptoNetInfoRequests.getInstance().addRequest(request);
}
}

View file

@ -0,0 +1,29 @@
package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest;
/**
* Created by Henry Varona on 7/10/2017.
*/
public class MemoValidationField extends ValidationField {
private EditText memoField;
public MemoValidationField(EditText memoField){
super(memoField);
this.memoField = memoField;
}
public void validate(){
final String memoNewValue = memoField.getText().toString();
this.setLastValue(memoNewValue);
setValidForValue(memoNewValue, true);
validator.validationSucceeded(this);
}
}

View file

@ -1,6 +1,5 @@
package cy.agorise.crystalwallet.viewmodels.validators;
package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.content.Context;
import android.widget.EditText;
import cy.agorise.crystalwallet.R;

View file

@ -1,9 +1,9 @@
package cy.agorise.crystalwallet.viewmodels.validators;
package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.content.Context;
import android.widget.EditText;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
/**
* Created by Henry Varona on 7/10/2017.

View file

@ -0,0 +1,48 @@
package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest;
/**
* Created by Henry Varona on 7/10/2017.
*/
public class ToValidationField extends ValidationField {
private EditText fromField;
private EditText toField;
public ToValidationField(EditText fromField, EditText toField){
super(fromField);
this.fromField = fromField;
this.toField = toField;
}
public void validate(){
final String fromNewValue = fromField.getText().toString();
final String toNewValue = toField.getText().toString();
this.setLastValue(toNewValue);
this.startValidating();
final ValidationField field = this;
final ValidateExistBitsharesAccountRequest request = new ValidateExistBitsharesAccountRequest(toNewValue);
request.setListener(new CryptoNetInfoRequestListener() {
@Override
public void onCarryOut() {
if (!request.getAccountExists()){
setValidForValue(toNewValue, false);
setMessage(validator.getContext().getResources().getString(R.string.account_name_not_exist));
validator.validationFailed(field);
} else {
setValidForValue(toNewValue, true);
validator.validationSucceeded(field);
}
}
});
CryptoNetInfoRequests.getInstance().addRequest(request);
}
}

View file

@ -1,8 +1,10 @@
package cy.agorise.crystalwallet.viewmodels.validators;
package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.content.Context;
import android.view.View;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidator;
/**
* Created by Henry Varona on 2/10/2017.
*/

View file

@ -0,0 +1,40 @@
package cy.agorise.crystalwallet.views;
import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.models.CryptoCurrency;
/**
* Created by Henry Varona on 25/10/2017.
*/
public class CryptoCurrencyAdapter extends ArrayAdapter<CryptoCurrency> {
private List<CryptoCurrency> data;
public CryptoCurrencyAdapter(Context context, int resource, List<CryptoCurrency> objects) {
super(context, resource, objects);
this.data = objects;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater)this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.crypto_currency_adapter_item, parent, false);
TextView tvCryptoCurrencyName = v.findViewById(R.id.tvCryptoCurrencyName);
CryptoCurrency cryptoCurrency = getItem(position);
tvCryptoCurrencyName.setText(cryptoCurrency.getName());
return v;
}
}

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp">
<TextView
android:id="@+id/tvCryptoCurrencyName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10" />
</LinearLayout>

View file

@ -2,628 +2,98 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
<TextView
android:layout_width="match_parent"
android:layout_height="60sp"
android:background="#0099D5"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:visibility="gone">
<Button
android:layout_width="30sp"
android:layout_height="30sp"
android:layout_gravity="center"
android:background="@drawable/righticon"
android:onClick="backbutton" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/logoicon" />
</LinearLayout>
<ScrollView
android:layout_height="wrap_content"
android:text="@string/from_capital"
android:textSize="15sp" />
<EditText
android:id="@+id/etFrom"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<LinearLayout
android:id="@+id/FirstChild"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5sp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="10">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/from_capital"
android:textColor="#00060A"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" :"
android:textColor="#00060A"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40sp"
android:orientation="horizontal"
android:weightSum="5">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<RelativeLayout
android:id="@+id/rl_webviewFrom"
android:layout_width="40sp"
android:layout_height="40sp"
android:layout_alignParentLeft="true"
android:background="@drawable/rounded_corners">
<WebView
android:id="@+id/webviewFrom"
android:layout_width="34sp"
android:layout_height="34sp"
android:layout_centerInParent="true"
android:gravity="center" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5sp"
android:layout_marginRight="5sp"
android:layout_toRightOf="@+id/rl_webviewFrom"
android:background="@drawable/edittext_background_layer"
android:orientation="vertical">
<Spinner
android:id="@+id/spinnerFrom"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#000"
android:textSize="15sp"
android:visibility="gone"></Spinner>
<TextView
android:id="@+id/tvFrom"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:paddingLeft="10dp"
android:textColor="#000"
android:textSize="16sp"
android:visibility="gone" />
<!--<View android:layout_width="wrap_content"-->
<!--android:layout_height="2dp"-->
<!--android:background="@drawable/edittext_background_layer">-->
<!--</View>-->
</LinearLayout>
</RelativeLayout>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="4"
android:background="@null" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/SecChild"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/FirstChild"
android:layout_marginTop="5sp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="10">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/to_capital"
android:textColor="#00060A"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"
android:textColor="#00060A"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40sp"
android:orientation="horizontal"
android:weightSum="5">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<RelativeLayout
android:id="@+id/rl_webviewTo"
android:layout_width="40sp"
android:layout_height="40sp"
android:layout_alignParentLeft="true"
android:background="@drawable/rounded_corners">
<WebView
android:id="@+id/webviewTo"
android:layout_width="34sp"
android:layout_height="34sp"
android:layout_centerInParent="true"
android:gravity="center" />
</RelativeLayout>
<EditText
android:id="@+id/etReceiverAccount"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5sp"
android:layout_marginRight="5sp"
android:layout_toLeftOf="@+id/contactActivity"
android:layout_toRightOf="@+id/rl_webviewTo"
android:background="@drawable/edittext_background_layer"
android:maxLines="1"
android:paddingLeft="10dp"
android:textColor="#000"
android:textSize="16sp" />
<RelativeLayout
android:id="@+id/contactActivity"
android:layout_width="50sp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:orientation="horizontal">
<ImageButton
android:id="@+id/contactButton"
android:layout_width="25dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:src="@drawable/share_group" />
</RelativeLayout>
</RelativeLayout>
<ImageButton
android:id="@+id/scanning"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:background="@null"
android:src="@drawable/photo_icon" />
</LinearLayout>
<TextView
android:id="@+id/tvErrorRecieverAccount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:text=""
android:textColor="@android:color/holo_red_dark"
android:textSize="15sp"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ThirdChild"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/SecChild"
android:layout_marginTop="5sp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/amount"
android:textColor="#00060A"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"
android:textColor="#00060A"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/layout_margin"
android:background="@drawable/edittext_background_layer"
android:orientation="horizontal"
android:weightSum="1">
<EditText
android:id="@+id/etAmount"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@null"
android:gravity="center|end"
android:inputType="numberDecimal"
android:maxLines="1"
android:paddingRight="5dp"
android:singleLine="true"
android:text=""
android:textColor="@color/blackColor" />
<Spinner
android:id="@+id/spAssets"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
android:dropDownWidth="wrap_content"></Spinner>
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/tvAmountStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ThirdChild"
android:gravity="right"
android:text=""
android:textSize="15sp" />
<LinearLayout
android:id="@+id/llLoyalty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tvAmountStatus"
android:layout_marginTop="5sp"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/loyalty_points"
android:textColor="#00060A"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"
android:textColor="#00060A"
android:textSize="15sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/layout_margin"
android:background="@drawable/edittext_background_layer">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/layout_margin"
android:background="@drawable/edittext_background_layer"
android:orientation="horizontal"
android:weightSum="4">
<EditText
android:id="@+id/etLoyalty"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_weight="3"
android:background="@null"
android:gravity="center|right"
android:inputType="numberDecimal"
android:maxLines="1"
android:paddingRight="5dp"
android:singleLine="true"
android:text="" />
<TextView
android:id="@+id/tvLoyalty"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text=""
android:textSize="17sp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/tvLoyaltyStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/llLoyalty"
android:gravity="right"
android:text="nn FABLES is available"
android:textColor="@android:color/holo_red_dark"
android:textSize="15sp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/llBackupAsset"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tvLoyaltyStatus"
android:layout_marginTop="5sp"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/backup_asset"
android:textColor="#00060A"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"
android:textColor="#00060A"
android:textSize="15sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/layout_margin"
android:background="@drawable/edittext_background_layer">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/layout_margin"
android:background="@drawable/edittext_background_layer"
android:orientation="horizontal"
android:weightSum="4">
<EditText
android:id="@+id/etBackupAsset"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_weight="3"
android:background="@null"
android:gravity="center|right"
android:inputType="numberDecimal"
android:maxLines="1"
android:paddingRight="5dp"
android:text="" />
<TextView
android:id="@+id/tvBackupAsset"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="BTS"
android:textSize="17sp" />
</LinearLayout>
</RelativeLayout>
<TextView
android:id="@+id/tvBackupAssetBalanceValidate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:text=""
android:textSize="15dp" />
</LinearLayout>
<TextView
android:id="@+id/StatusThree"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/llBackupAsset"
android:gravity="right"
android:text="nn OBITS is available"
android:textColor="@android:color/holo_red_dark"
android:textSize="15sp"
android:visibility="gone" />
<TextView
android:id="@+id/tvTotalStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/StatusThree"
android:gravity="center"
android:text="(nn BTS + n.nn OBITS = nnnn BTS )"
android:textColor="#000"
android:textSize="15sp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/llMemo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tvTotalStatus"
android:layout_marginTop="5sp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="@string/memo_capital"
android:textColor="#00060A"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text=":"
android:textColor="#00060A"
android:textSize="15sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/layout_margin"
android:background="@drawable/edittext_background_layer">
<EditText
android:id="@+id/etMemo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:gravity="left"
android:text=""
android:textSize="15sp"
/>
</RelativeLayout>
</LinearLayout>
<CheckBox
android:id="@+id/cbAlwaysDonate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/llMemo"
android:layout_marginBottom="10dp"
android:layout_marginTop="20dp"
android:text="@string/checkbox_donate" />
<Button
android:id="@+id/btnSend"
android:layout_width="match_parent"
android:layout_height="@dimen/layout_margin"
android:weightSum="4"
android:background="@drawable/send_button_background"
android:gravity="center"
android:text="@string/send_capital"
android:drawableRight="@drawable/ic_send_button"
android:paddingLeft="40dp"
android:textColor="#fff"
android:textSize="17sp"
android:textStyle="bold"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:paddingEnd="100dp"
android:drawablePadding="-60dp"
android:layout_below="@id/cbAlwaysDonate"
android:enabled="false">
</Button>
</RelativeLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:textColor="@color/white" />
<TextView
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_weight="1"
android:background="@color/bottomBarColor"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
android:id="@+id/tvAppVersion_send_screen_activity"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@string/v_1_0_beta" />
<TextView
android:id="@+id/tvBlockNumberHead_send_screen_activity"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center"
android:text="@string/block_number" />
<ImageView
android:id="@+id/ivSocketConnected_send_screen_activity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5" />
<ImageView
android:id="@+id/OnClickSettings_send_screen_activity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:src="@drawable/icon_setting"
android:visibility="visible" />
</LinearLayout>
android:layout_height="wrap_content"
android:id="@+id/tvFromError"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/to_capital"
android:textSize="15sp" />
<EditText
android:id="@+id/etTo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:inputType="textMultiLine"
android:textColor="@color/white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvToError"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Asset"
android:textSize="15sp" />
<Spinner
android:id="@+id/spAsset"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:inputType="textMultiLine"
android:textColor="@color/white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvAssetError"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/amount"
android:textSize="15sp" />
<EditText
android:id="@+id/etAmount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:inputType="textMultiLine"
android:textColor="@color/white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvAmountError"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/memo_capital"
android:textSize="15sp" />
<EditText
android:id="@+id/etMemo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:inputType="textMultiLine"
android:textColor="@color/white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvMemoError"/>
<Button
android:id="@+id/btnCancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/cancel">
</Button>
<Button
android:id="@+id/btnSend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/send_capital">
</Button>
</LinearLayout>