balance colour + tx ordering

This commit is contained in:
m2049r 2017-08-29 08:43:56 +02:00
parent b3ea4540a1
commit e4562f07a4
2 changed files with 15 additions and 16 deletions

View File

@ -91,16 +91,15 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter<TransactionInfo
Collections.sort(data, new Comparator<TransactionInfo>() {
@Override
public int compare(TransactionInfo o1, TransactionInfo o2) {
if ((o1.isPending) && (o2.isPending)) {
long b1 = o1.timestamp;
long b2 = o2.timestamp;
return (b1 > b2) ? -1 : (b1 < b2) ? 1 : 0;
long b1 = o1.timestamp;
long b2 = o2.timestamp;
if (b1>b2) {
return -1;
} else if (b1<b2) {
return 1;
} else {
return o1.hash.compareTo(o2.hash);
}
if (o1.isPending) return -1;
if (o2.isPending) return 1;
long b1 = o1.blockheight;
long b2 = o2.blockheight;
return (b1 > b2) ? -1 : (b1 < b2) ? 1 : 0;
}
});
this.infoItems.addAll(data);
@ -150,15 +149,15 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter<TransactionInfo
this.tvAmount.setText(amountParts[0]);
this.tvAmountDecimal.setText(amountParts[1]);
if (infoItem.isPending) {
if (infoItem.isFailed) {
this.tvAmount.setText('(' + amountParts[0]);
this.tvAmountDecimal.setText(amountParts[1] + ')');
setTxColour(TX_FAILED);
} else if (infoItem.isPending) {
setTxColour(TX_PENDING);
if (infoItem.direction == TransactionInfo.Direction.Direction_Out) {
this.tvAmount.setText('-' + amountParts[0]);
}
} else if (infoItem.isFailed) {
this.tvAmount.setText('(' + amountParts[0]);
this.tvAmountDecimal.setText(amountParts[1] + ')');
setTxColour(TX_FAILED);
} else if (infoItem.direction == TransactionInfo.Direction.Direction_In) {
setTxColour(TX_GREEN);
} else {

View File

@ -69,7 +69,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00000000.000000000000"
android:textColor="@color/moneroOrange"
android:textColor="@color/tx_green"
android:textSize="24sp" />
<TextView
@ -77,7 +77,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="4sp"
android:text="@string/label_xmr"
android:textColor="@color/moneroOrange"
android:textColor="@color/tx_green"
android:textSize="24sp" />
</LinearLayout>