Merge pull request #16 from m2049r/feature_txrecipient
show destinations in tx view
This commit is contained in:
commit
807d217aac
|
@ -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);
|
||||
|
@ -154,11 +158,11 @@ public class TxFragment extends Fragment {
|
|||
boolean comma = false;
|
||||
for (Transfer transfer : info.transfers) {
|
||||
if (comma) {
|
||||
sb.append(",");
|
||||
sb.append(", ");
|
||||
} 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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -122,6 +122,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>
|
||||
|
|
Loading…
Reference in New Issue