diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 83f17347..7affb3cc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,7 +14,7 @@ android:icon="@drawable/ic_monero_32dp" android:label="@string/app_name" android:supportsRtl="true" - android:theme="@style/AppTheme"> + android:theme="@style/MyMaterialTheme"> 16) { shortName = shortName.substring(0, 14) + "..."; } + // TODO very very rarely this craches because getAddress returns "" or so ... + // maybe because this runs in the ui thread and not in a 5MB thread String title = "[" + wallet.getAddress().substring(0, 6) + "] " + shortName; activityCallback.setTitle(title); @@ -194,14 +193,8 @@ public class WalletFragment extends Fragment implements TransactionInfoAdapter.O } long balance = wallet.getBalance(); long unlockedBalance = wallet.getUnlockedBalance(); - tvBalance.setText(Helper.getDisplayAmount(unlockedBalance)); - tvUnconfirmedAmount.setText(Helper.getDisplayAmount(balance - unlockedBalance)); - // balance cannot be less than unlockedBalance - /*if (balance != unlockedBalance) { - llPendingAmount.setVisibility(View.VISIBLE); - } else { - llPendingAmount.setVisibility(View.INVISIBLE); - }*/ + tvBalance.setText(getResources().getString(R.string.xmr_balance, Helper.getDisplayAmount(unlockedBalance))); + tvUnconfirmedAmount.setText(getResources().getString(R.string.xmr_balance, Helper.getDisplayAmount(balance - unlockedBalance))); String sync = ""; if (!activityCallback.hasBoundService()) throw new IllegalStateException("WalletService not bound."); diff --git a/app/src/main/java/com/m2049r/xmrwallet/layout/TransactionInfoAdapter.java b/app/src/main/java/com/m2049r/xmrwallet/layout/TransactionInfoAdapter.java index 3b8dc54e..7e833005 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/layout/TransactionInfoAdapter.java +++ b/app/src/main/java/com/m2049r/xmrwallet/layout/TransactionInfoAdapter.java @@ -16,7 +16,9 @@ package com.m2049r.xmrwallet.layout; +import android.content.Context; import android.graphics.Color; +import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; @@ -42,10 +44,15 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter infoItems; private final OnInteractionListener listener; - public TransactionInfoAdapter(OnInteractionListener listener) { + Context context; + + public TransactionInfoAdapter(Context context, OnInteractionListener listener) { + this.context = context; + inboundColour = ContextCompat.getColor(context, R.color.tx_green); + outboundColour = ContextCompat.getColor(context, R.color.tx_red); + pendingColour = ContextCompat.getColor(context, R.color.tx_pending); + failedColour = ContextCompat.getColor(context, R.color.tx_failed); this.infoItems = new ArrayList<>(); this.listener = listener; Calendar cal = Calendar.getInstance(); @@ -109,8 +123,7 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter 0)) { + String feeAmount = Wallet.getDisplayAmount(infoItem.fee); + String fee = feeAmount.substring(0, feeAmount.length() - (12 - 5)); + if (infoItem.isPending) { + this.tvFee.setText(context.getString(R.string.tx_list_fee_pending, fee)); + } else { + this.tvFee.setText(context.getString(R.string.tx_list_fee, fee)); + } + } else { + this.tvFee.setText(""); + } if (infoItem.isFailed) { - this.tvAmount.setText('(' + amountParts[0]); - this.tvAmountDecimal.setText(amountParts[1] + ')'); - setTxColour(TX_FAILED); + this.tvAmount.setText(context.getString(R.string.tx_list_amount_failed, amount)); + setTxColour(failedColour); } else if (infoItem.isPending) { - setTxColour(TX_PENDING); + setTxColour(pendingColour); if (infoItem.direction == TransactionInfo.Direction.Direction_Out) { - this.tvAmount.setText('-' + amountParts[0]); + this.tvAmount.setText(context.getString(R.string.tx_list_amount_negative, amount)); } } else if (infoItem.direction == TransactionInfo.Direction.Direction_In) { - setTxColour(TX_GREEN); + setTxColour(inboundColour); } else { - setTxColour(TX_RED); + setTxColour(outboundColour); } - this.tvPaymentId.setText(infoItem.paymentId.equals("0000000000000000")?"":infoItem.paymentId); + this.tvPaymentId.setText(infoItem.paymentId.equals("0000000000000000") ? "" : infoItem.paymentId); this.tvDateTime.setText(getDateTime(infoItem.timestamp)); itemView.setOnClickListener(this); diff --git a/app/src/main/res/color/text_color.xml b/app/src/main/res/color/text_color.xml new file mode 100644 index 00000000..bdb0a30f --- /dev/null +++ b/app/src/main/res/color/text_color.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/gen_fragment.xml b/app/src/main/res/layout/gen_fragment.xml index 567abaf8..99e88eba 100644 --- a/app/src/main/res/layout/gen_fragment.xml +++ b/app/src/main/res/layout/gen_fragment.xml @@ -12,6 +12,7 @@ + android:textAlignment="center" /> + android:textAlignment="center" /> + android:textAlignment="center" /> + android:textAlignment="center" /> + android:textAlignment="center" /> + android:textAlignment="center"/>