Skip to content

Commit

Permalink
Merge pull request #101 from XDagger/develop
Browse files Browse the repository at this point in the history
 Add remark to transactions
  • Loading branch information
ssyijiu authored Mar 9, 2020
2 parents c4bbeb5 + 5c67292 commit ce2a67d
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public TransactionAdapter(@Nullable
protected void convert(BaseViewHolder helper, final BlockDetailModel.BlockAsAddress item) {
helper.setText(R.id.item_transaction_tv_address, item.address);
helper.setText(R.id.item_transaction_tv_amount, item.getAmount());
helper.setText(R.id.item_transaction_tv_remark, item.remark);
helper.setTextColor(R.id.item_transaction_tv_amount, item.getAmountColor());
helper.setImageResource(R.id.item_transaction_img_type, item.getTypeImage());

Expand Down
21 changes: 4 additions & 17 deletions app/src/main/java/io/xdag/xdagwallet/model/BlockDetailModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import android.text.TextUtils;
import android.view.View;

import java.util.List;

import io.xdag.common.Common;
import io.xdag.xdagwallet.R;
import io.xdag.xdagwallet.net.error.ErrorResponse;
import java.util.List;

/**
* created by lxm on 2018/7/24.
Expand All @@ -23,21 +25,10 @@ public class BlockDetailModel extends ErrorResponse {
public String difficulty;
public String balance_address;
public String balance;
public String remark;
public List<BlockAsAddress> block_as_transaction;
public List<BlockAsAddress> block_as_address;

// public static class BlockAsTransaction {
// /**
// * direction : fee
// * address : 6LN4oKM6n3oEn/rvKSqLLcZnqiNpa4aa
// * amount : 0.000000000
// */
//
// public String direction;
// public String address;
// public String amount;
// }


public static class BlockAsAddress {
/**
Expand All @@ -53,10 +44,6 @@ public static class BlockAsAddress {
public String time;
public String remark;

public String getRemark(){
return remark;
}

public int getTypeImage() {
if (isInput()) {
return R.drawable.ic_input;
Expand Down
26 changes: 2 additions & 24 deletions app/src/main/java/io/xdag/xdagwallet/model/PoolListModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
public class PoolListModel implements Serializable {

private static final String CACHE_KEY = "io,xdag.android-wallet.pool.list";
private static final String CACHE_KEY = "io.xdag.android-wallet.pool.list";

private static final PoolListModel sInstance = new PoolListModel();

Expand All @@ -40,30 +40,8 @@ private PoolListModel() {

public void init() {
poolList.clear();
// xdagmine.com:13654
poolList.add(new PoolModel("xdagmine.com:13654"));
poolList.add(new PoolModel("feipool.xyz:13654"));
poolList.add(new PoolModel("xdagscan.com:13654"));
poolList.add(new PoolModel("cn.xdag.vspool.com:13654"));
poolList.add(new PoolModel("142.44.143.234:777"));
poolList.add(new PoolModel("pool.xdagcn.com:13654"));
poolList.add(new PoolModel("pool.xdagpool.com:13654"));
poolList.add(new PoolModel("xdag.coolmine.top:13654"));
poolList.add(new PoolModel("109.196.45.218:443"));
poolList.add(new PoolModel("139.99.124.23:13654"));
poolList.add(new PoolModel("xdag.jeepool.com:13654"));
poolList.add(new PoolModel("95.216.36.234:13654"));
poolList.add(new PoolModel("pool.xdagcn.com:13654"));
poolList.add(new PoolModel("xdag.yourspool.com:443"));
poolList.add(new PoolModel("xdag.uupool.cn:13654"));
poolList.add(new PoolModel("139.99.124.135:13654"));
poolList.add(new PoolModel("136.243.55.153:13654"));
poolList.add(new PoolModel("pool1.xdag.signal2noi.se:443"));
poolList.add(new PoolModel("78.46.82.220:13654"));
poolList.add(new PoolModel("172.105.216.53:3355"));
poolList.add(new PoolModel("142.44.143.234:777"));
poolList.add(new PoolModel("xdag.coolmine.top:13654"));
poolList.add(new PoolModel("xdag.poolaroid.cash:443"));
poolList.add(new PoolModel("pool.xdag.us:13654"));
}


Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/io/xdag/xdagwallet/net/HttpRequest.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package io.xdag.xdagwallet.net;

import android.app.Activity;

import java.util.List;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.xdag.xdagwallet.config.Config;
import io.xdag.xdagwallet.model.BlockDetailModel;
import io.xdag.xdagwallet.model.ConfigModel;
import io.xdag.xdagwallet.model.VersionModel;
import io.xdag.xdagwallet.net.error.ErrorConsumer;
import io.xdag.xdagwallet.net.rx.Detail2AddressListFunction;
import io.xdag.xdagwallet.net.rx.Detail2TranListFunction;
import java.util.List;

/**
* created by lxm on 2018/8/31.
Expand Down
22 changes: 15 additions & 7 deletions app/src/main/java/io/xdag/xdagwallet/net/error/ErrorConsumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

import android.app.Activity;
import android.text.TextUtils;

import com.google.gson.Gson;

import java.io.IOException;

import io.reactivex.functions.Consumer;
import io.xdag.common.tool.MLog;
import io.xdag.xdagwallet.util.AlertUtil;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.HttpException;

/**
* created by lxm on 2018/7/19.
*
* <p>
* handle exception
*/
public class ErrorConsumer implements Consumer<Throwable> {
Expand All @@ -30,26 +33,31 @@ public ErrorConsumer(Activity activity) {
}


@Override public void accept(Throwable throwable) {
@Override
public void accept(Throwable throwable) {
MLog.i(throwable.getMessage());
String errorMessage = throwable.getMessage();
String message = throwable.getMessage();
// ignore the time out of https://raw.githubusercontent.com/
if (message.contains("githubusercontent")) {
return;
}
if (throwable instanceof HttpException) {
// parse error message
HttpException httpException = (HttpException) throwable;
try {
ResponseBody errorBody = httpException.response().errorBody();
if (errorBody != null) {
ErrorResponse errorResponse = gson.fromJson(errorBody.string(),
ErrorResponse.class);
ErrorResponse.class);
if (errorResponse != null && !TextUtils.isEmpty(errorResponse.message)) {
errorMessage = errorResponse.message;
message = errorResponse.message;
}

}
} catch (IOException ignored) {
}

}
AlertUtil.show(activity, errorMessage);
AlertUtil.show(activity, message);
}
}
114 changes: 63 additions & 51 deletions app/src/main/res/layout/item_transaction.xml
Original file line number Diff line number Diff line change
@@ -1,62 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:elevation="@dimen/elevation"
android:focusable="true"
android:padding="@dimen/space_16">
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:elevation="@dimen/elevation"
android:focusable="true"
android:padding="@dimen/space_16">

<ImageView
android:id="@+id/item_transaction_img_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_input"
android:textSize="@dimen/size_text"
app:layout_constraintBottom_toBottomOf="@id/item_transaction_tv_time"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/item_transaction_tv_address"/>
android:id="@+id/item_transaction_img_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_input"
android:textSize="@dimen/size_text"
app:layout_constraintBottom_toBottomOf="@id/item_transaction_tv_time"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/item_transaction_tv_address" />

<TextView
android:id="@+id/item_transaction_tv_address"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/space_8"
android:layout_marginTop="@dimen/space_8"
android:layout_marginRight="@dimen/space_8"
android:ellipsize="middle"
android:singleLine="true"
android:textColor="@color/LIGHT_BLACK"
app:layout_constraintLeft_toRightOf="@id/item_transaction_img_type"
app:layout_constraintRight_toLeftOf="@id/item_transaction_tv_amount"
app:layout_constraintTop_toTopOf="parent"
tools:text="ewrXrSDbCmqH/fkLuQkEMiwed3709C2k" />

<TextView
android:id="@+id/item_transaction_tv_address"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/space_8"
android:layout_marginLeft="@dimen/space_8"
android:layout_marginRight="@dimen/space_8"
android:ellipsize="middle"
android:singleLine="true"
android:textColor="@color/LIGHT_BLACK"
app:layout_constraintLeft_toRightOf="@id/item_transaction_img_type"
app:layout_constraintRight_toLeftOf="@id/item_transaction_tv_amount"
app:layout_constraintTop_toTopOf="parent"
tools:text="ewrXrSDbCmqH/fkLuQkEMiwed3709C2k"/>
android:id="@+id/item_transaction_tv_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/size_title"
app:layout_constraintBottom_toBottomOf="@id/item_transaction_img_type"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/item_transaction_img_type"
tools:text="+100" />

<TextView
android:id="@+id/item_transaction_tv_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/size_title"
app:layout_constraintBottom_toBottomOf="@id/item_transaction_img_type"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/item_transaction_img_type"
tools:text="+100"/>
android:id="@+id/item_transaction_tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/space_4"
android:textColor="@color/GERY"
android:textSize="@dimen/size_tip"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="@id/item_transaction_tv_address"
app:layout_constraintTop_toBottomOf="@id/item_transaction_tv_address"
tools:text="2018/2/23 23:33" />

<TextView
android:id="@+id/item_transaction_tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
android:layout_marginTop="@dimen/space_4"
android:textColor="@color/GERY"
android:textSize="@dimen/size_tip"
app:layout_constraintLeft_toLeftOf="@id/item_transaction_tv_address"
app:layout_constraintTop_toBottomOf="@id/item_transaction_tv_address"
tools:text="2018/2/23 23:33"/>
android:id="@+id/item_transaction_tv_remark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/GERY"
android:textSize="@dimen/size_tip"
android:visibility="visible"
android:layout_marginStart="@dimen/space_32"
app:layout_constraintBottom_toBottomOf="@id/item_transaction_tv_time"
app:layout_constraintLeft_toRightOf="@id/item_transaction_tv_time"
app:layout_constraintTop_toTopOf="@id/item_transaction_tv_time"
tools:text="remark" />

</android.support.constraint.ConstraintLayout>
1 change: 0 additions & 1 deletion app/src/main/res/layout/layout_dialog_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits="@string/password_format"
android:maxLength="18"
android:layout_marginLeft="@dimen/space_24"
android:layout_marginRight="@dimen/space_24"
android:inputType="textPassword">
Expand Down
6 changes: 3 additions & 3 deletions update.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"versionCode": 24,
"versionName": "0.2.4",
"url": "https://github.com/XDagger/android-wallet/releases/download/release_0.2.4/android_wallet_release_v0.2.4.apk"
"versionCode": 25,
"versionName": "0.2.5(Fix bug)",
"url": "https://github.com/XDagger/android-wallet/releases/download/release_0.2.5/android_wallet_release_v0.2.5.apk"
}

0 comments on commit ce2a67d

Please sign in to comment.