show destination in tx view

This commit is contained in:
m2049r 2017-08-22 13:02:31 +02:00
parent 110621824a
commit 0421bcfac3
3 changed files with 37 additions and 2 deletions

View File

@ -41,6 +41,8 @@ import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.TimeZone;
public class TxFragment extends Fragment {
@ -60,6 +62,7 @@ public class TxFragment extends Fragment {
TextView tvTxTimestamp;
TextView tvTxId;
TextView tvTxKey;
TextView tvDestination;
TextView tvTxPaymentId;
TextView tvTxBlockheight;
TextView tvTxAmount;
@ -78,6 +81,7 @@ public class TxFragment extends Fragment {
tvTxTimestamp = (TextView) view.findViewById(R.id.tvTxTimestamp);
tvTxId = (TextView) view.findViewById(R.id.tvTxId);
tvTxKey = (TextView) view.findViewById(R.id.tvTxKey);
tvDestination = (TextView) view.findViewById(R.id.tvDestination);
tvTxPaymentId = (TextView) view.findViewById(R.id.tvTxPaymentId);
tvTxBlockheight = (TextView) view.findViewById(R.id.tvTxBlockheight);
tvTxAmount = (TextView) view.findViewById(R.id.tvTxAmount);
@ -158,7 +162,7 @@ public class TxFragment extends Fragment {
} else {
comma = true;
}
sb.append("[").append(transfer.address.substring(0, 6)).append("] ");
sb.append(transfer.address).append(": ");
sb.append(Wallet.getDisplayAmount(transfer.amount));
}
} else {
@ -202,10 +206,13 @@ public class TxFragment extends Fragment {
String sign = (info.direction == TransactionInfo.Direction.Direction_In ? "+" : "-");
tvTxAmount.setText(sign + Wallet.getDisplayAmount(info.amount));
tvTxFee.setText(Wallet.getDisplayAmount(info.fee));
Set<String> destinations = new HashSet<>();
StringBuffer sb = new StringBuffer();
StringBuffer dstSb = new StringBuffer();
if (info.transfers != null) {
boolean newline = false;
for (Transfer transfer : info.transfers) {
destinations.add(transfer.address);
if (newline) {
sb.append("\n");
} else {
@ -214,10 +221,21 @@ public class TxFragment extends Fragment {
sb.append("[").append(transfer.address.substring(0, 6)).append("] ");
sb.append(Wallet.getDisplayAmount(transfer.amount));
}
newline = false;
for (String dst : destinations) {
if (newline) {
dstSb.append("\n");
} else {
newline = true;
}
dstSb.append(dst);
}
} else {
sb.append("-");
dstSb.append(info.direction == TransactionInfo.Direction.Direction_In ? activityCallback.getWalletAddress() : "-");
}
tvTxTransfers.setText(sb.toString());
tvDestination.setText(dstSb.toString());
this.info = info;
bCopy.setEnabled(true);
}

View File

@ -46,6 +46,22 @@
android:textIsSelectable="true" />
</TableRow>
<TableRow>
<TextView
android:gravity="right"
android:padding="8dp"
android:text="@string/tx_destination"
android:textColor="@color/colorAccent" />
<TextView
android:id="@+id/tvDestination"
android:gravity="left"
android:padding="8dip"
android:selectAllOnFocus="true"
android:textIsSelectable="true" />
</TableRow>
<TableRow>
<TextView

View File

@ -121,6 +121,7 @@
<string name="tx_timestamp">Timestamp</string>
<string name="tx_id">TX ID</string>
<string name="tx_key">TX Key</string>
<string name="tx_destination">Destination</string>
<string name="tx_paymentId">Payment ID</string>
<string name="tx_blockheight">Block</string>
<string name="tx_amount">Amount</string>