- Adjusting send and receive fragment to work with multiaccounts
This commit is contained in:
parent
594bd4b816
commit
5b21c0719e
4 changed files with 34 additions and 3 deletions
|
@ -16,6 +16,7 @@ import android.os.FileObserver;
|
|||
import android.os.Parcelable;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -60,6 +61,9 @@ public class AccountsActivity extends AppCompatActivity {
|
|||
@BindView(R.id.user_img)
|
||||
CircleImageView userImg;
|
||||
|
||||
@BindView(R.id.fabAddAccount)
|
||||
FloatingActionButton fabAddAccount;
|
||||
|
||||
static final int NEW_PICTURE_REQUEST_CODE = 1;
|
||||
|
||||
FileObserver fileObserver;
|
||||
|
@ -125,6 +129,12 @@ public class AccountsActivity extends AppCompatActivity {
|
|||
.start();
|
||||
}
|
||||
|
||||
@OnClick(R.id.fabAddAccount)
|
||||
public void goToAddAccount(){
|
||||
Intent intent = new Intent(this, CreateSeedActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (ImagePicker.shouldHandle(requestCode, resultCode, data)) {
|
||||
|
|
|
@ -302,6 +302,15 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
|
|||
Log.e("ReceiveFragment","Amount casting error.");
|
||||
}
|
||||
|
||||
CryptoNetAccount toAccountSelected = (CryptoNetAccount) spTo.getSelectedItem();
|
||||
|
||||
/*
|
||||
* this is only for graphene accounts.
|
||||
*
|
||||
**/
|
||||
GrapheneAccount grapheneAccountSelected = new GrapheneAccount(toAccountSelected);
|
||||
grapheneAccountSelected.loadInfo(db.grapheneAccountInfoDao().getByAccountId(toAccountSelected.getId()));
|
||||
|
||||
|
||||
this.invoiceItems.clear();
|
||||
this.invoiceItems.add(
|
||||
|
@ -311,7 +320,7 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
|
|||
LineItem items[] = new LineItem[this.invoiceItems.size()];
|
||||
items = this.invoiceItems.toArray(items);
|
||||
this.invoice.setLineItems(items);
|
||||
this.invoice.setTo(this.grapheneAccount.getName());
|
||||
this.invoice.setTo(grapheneAccountSelected.getName());
|
||||
this.invoice.setCurrency(this.cryptoCurrency.getName());
|
||||
|
||||
try {
|
||||
|
|
|
@ -311,13 +311,25 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
|
|||
@OnClick(R.id.btnSend)
|
||||
public void sendTransaction(){
|
||||
if (this.sendTransactionValidator.isValid()) {
|
||||
CryptoNetAccount fromAccountSelected = (CryptoNetAccount) spFrom.getSelectedItem();
|
||||
|
||||
|
||||
/*
|
||||
* this is only for graphene accounts.
|
||||
*
|
||||
**/
|
||||
GrapheneAccount grapheneAccountSelected = new GrapheneAccount(fromAccountSelected);
|
||||
grapheneAccountSelected.loadInfo(db.grapheneAccountInfoDao().getByAccountId(fromAccountSelected.getId()));
|
||||
|
||||
|
||||
|
||||
//TODO convert the amount to long type using the precision of the currency
|
||||
Long amountFromEditText = Long.parseLong(this.etAmount.getText().toString());
|
||||
Long amount = amountFromEditText*Math.round(Math.pow(10,((CryptoCurrency)spAsset.getSelectedItem()).getPrecision()));
|
||||
|
||||
final ValidateBitsharesSendRequest sendRequest = new ValidateBitsharesSendRequest(
|
||||
this.getContext(),
|
||||
this.grapheneAccount,
|
||||
grapheneAccountSelected,
|
||||
this.etTo.getText().toString(),
|
||||
amount,
|
||||
((CryptoCurrency)spAsset.getSelectedItem()).getName(),
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
android:layout_height="55dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:visibility="gone"
|
||||
android:visibility="visible"
|
||||
app:backgroundTint="@color/colorPrimary"
|
||||
app:fabSize="normal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
Loading…
Reference in a new issue