bitshares asset room fixes

master
henry 2017-10-18 22:56:37 -04:00
parent 258dd56a1e
commit 811d0d24a3
3 changed files with 24 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import java.util.Date;
import cy.agorise.crystalwallet.enums.CryptoCoin;
import cy.agorise.crystalwallet.enums.CryptoNet;
import cy.agorise.crystalwallet.enums.SeedType;
import cy.agorise.crystalwallet.models.BitsharesAsset;
import cy.agorise.crystalwallet.models.CryptoNetAccount;
import static cy.agorise.crystalwallet.R.string.account;
@ -117,4 +118,17 @@ public class Converters {
public CryptoNet accountNumberToCryptoNet(int value) {
return CryptoNet.fromBip44Index(value);
}
@TypeConverter
public String assetTypeToName(BitsharesAsset.Type type){
if(type == null){
return "";
}
return type.name();
}
@TypeConverter
public BitsharesAsset.Type nameToAssetType(String value){
return BitsharesAsset.Type.valueOf(value);
}
}

View File

@ -35,6 +35,9 @@ public class BitsharesAsset extends CryptoCurrency {
this.code = code;
}
public int getCode() {
return code;
}
}
public BitsharesAsset(String symbol, int precision, String bitsharesId, Type assetType) {

View File

@ -3,6 +3,9 @@ package cy.agorise.crystalwallet.models;
import android.arch.persistence.room.ColumnInfo;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.ForeignKey;
import android.arch.persistence.room.TypeConverters;
import cy.agorise.crystalwallet.dao.converters.Converters;
/**
* This represents the extens attributes of the Bitshares Assets, to be saved in the database
@ -22,8 +25,12 @@ public class BitsharesAssetInfo {
private String bitsharesId;
// The bitshares type see the enum below
@ColumnInfo(name = "asset_type")
@TypeConverters(Converters.class)
private BitsharesAsset.Type assetType;
public BitsharesAssetInfo() {
}
public BitsharesAssetInfo(String symbol, int precision, String bitsharesId, BitsharesAsset.Type assetType) {
this.bitsharesId = bitsharesId;
this.assetType = assetType;