Skip to content

Commit

Permalink
Add a new cloud node address under the testnet and optimize some func…
Browse files Browse the repository at this point in the history
…tions.
  • Loading branch information
healergyl committed Jul 18, 2023
1 parent c50f919 commit b64f243
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -873,11 +874,21 @@ public void run() {
LightningOuterClass.TransactionDetails resp = LightningOuterClass.TransactionDetails.parseFrom(bytes);
LogUtils.e(TAG, "------------------getPendingTxsChainOnResponse-----------------" + resp);
for (LightningOuterClass.Transaction transaction : resp.getTransactionsList()) {
if (StringUtils.isEmpty(String.valueOf(transaction.getNumConfirmations())) || transaction.getNumConfirmations() < 3) {
if (StringUtils.isEmpty(String.valueOf(transaction.getNumConfirmations())) || transaction.getNumConfirmations() < 1) {
mPendingTxsChainData.add(transaction);
}
}
mToBePaidNumTv.setText(mPendingTxsChainData.size() + "");
Collections.sort(mPendingTxsChainData, new Comparator<LightningOuterClass.Transaction>() {
@Override
public int compare(LightningOuterClass.Transaction o1, LightningOuterClass.Transaction o2) {
return (int) (o2.getTimeStamp() - o1.getTimeStamp());
}
});
try {
mToBePaidNumTv.setText(mPendingTxsChainData.size() + "");
} catch (Exception e) {
LogUtils.e(TAG, "Error: " + e.getMessage());
}
mPendingTxsChainAdapter.notifyDataSetChanged();
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
Expand Down Expand Up @@ -965,7 +976,17 @@ public void run() {
}
mPendingTxsAssetData.add(resp);
}
mToBePaidNumTv.setText(mPendingTxsAssetData.size() + "");
Collections.sort(mPendingTxsAssetData, new Comparator<LightningOuterClass.AssetTx>() {
@Override
public int compare(LightningOuterClass.AssetTx o1, LightningOuterClass.AssetTx o2) {
return (int) (o2.getBlocktime() - o1.getBlocktime());
}
});
try {
mToBePaidNumTv.setText(mPendingTxsAssetData.size() + "");
} catch (Exception e) {
LogUtils.e(TAG, "Error: " + e.getMessage());
}
mPendingTxsAssetAdapter.notifyDataSetChanged();
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
Expand Down Expand Up @@ -1327,7 +1348,7 @@ public void convert(ViewHolder holder, final int position, final LightningOuterC
DecimalFormat df = new DecimalFormat("0.00######");
if (item.getAmount() <= 0) {
holder.setText(R.id.tv_amount, df.format(Double.parseDouble(String.valueOf(item.getAmount())) / 100000000).replace("-", ""));
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 3) {
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 1) {
holder.setText(R.id.tv_receiver, "PENDING");
holder.setImageResource(R.id.iv_state, R.mipmap.icon_alarm_clock_blue);
} else {
Expand All @@ -1336,7 +1357,7 @@ public void convert(ViewHolder holder, final int position, final LightningOuterC
}
} else if (item.getAmount() > 0) {
holder.setText(R.id.tv_amount, df.format(Double.parseDouble(String.valueOf(item.getAmount())) / 100000000));
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 3) {
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 1) {
holder.setText(R.id.tv_receiver, "PENDING");
holder.setImageResource(R.id.iv_state, R.mipmap.icon_alarm_clock_blue);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void convert(ViewHolder holder, int position, LightningOuterClass.Transac
DecimalFormat df = new DecimalFormat("0.00######");
if (item.getAmount() <= 0) {
holder.setText(R.id.tv_amount, "- " + df.format(Double.parseDouble(String.valueOf(item.getAmount())) / 100000000).replace("-", ""));
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 3) {
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 1) {
holder.setText(R.id.tv_state, "Unnamed");
holder.setImageResource(R.id.iv_state, R.mipmap.icon_alarm_clock_blue);
} else {
Expand All @@ -110,7 +110,7 @@ public void convert(ViewHolder holder, int position, LightningOuterClass.Transac
}
} else if (item.getAmount() > 0) {
holder.setText(R.id.tv_amount, "+ " + df.format(Double.parseDouble(String.valueOf(item.getAmount())) / 100000000));
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 3) {
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 1) {
holder.setText(R.id.tv_state, "Unnamed");
holder.setImageResource(R.id.iv_state, R.mipmap.icon_alarm_clock_blue);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void show(final View view, LightningOuterClass.Transaction item, long ass
amountTv.setText(df.format(Double.parseDouble(String.valueOf(item.getAmount())) / 100000000).replace("-", ""));
String totalValue = (long) (Double.parseDouble(String.valueOf(item.getAmount()).replace("-", ""))) + item.getTotalFees() + "";
totalAmountTv.setText(df1.format(Double.parseDouble(totalValue) / 100000000 * Double.parseDouble(User.getInstance().getBtcPrice(mContext))));
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 3) {
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 1) {
typeTv.setText("PENDING");
typeIv.setImageResource(R.mipmap.icon_failed_red);
statusTv.setText("Pending");
Expand All @@ -93,7 +93,7 @@ public void show(final View view, LightningOuterClass.Transaction item, long ass
amountTv.setText(df.format(Double.parseDouble(String.valueOf(item.getAmount())) / 100000000));
String totalValue = (long) (Double.parseDouble(String.valueOf(item.getAmount()))) + item.getTotalFees() + "";
totalAmountTv.setText(df1.format(Double.parseDouble(totalValue) / 100000000 * Double.parseDouble(User.getInstance().getBtcPrice(mContext))));
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 3) {
if (StringUtils.isEmpty(String.valueOf(item.getNumConfirmations())) || item.getNumConfirmations() < 1) {
typeTv.setText("PENDING");
typeIv.setImageResource(R.mipmap.icon_failed_red);
statusTv.setText("Pending");
Expand Down
4 changes: 2 additions & 2 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ ext {
targetSdkVersion: 28,
compileVersion : 28,
buildToolVersion: "28.0.3",
versionCode : 5,
versionName : "0.1.4"
versionCode : 6,
versionName : "0.1.5"
]
// 依赖相关版本控制
depVersion = [
Expand Down

0 comments on commit b64f243

Please sign in to comment.