diff --git a/app/src/main/java/cy/agorise/crystalwallet/application/CrystalApplication.java b/app/src/main/java/cy/agorise/crystalwallet/application/CrystalApplication.java index 4d33b2c..8319739 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/application/CrystalApplication.java +++ b/app/src/main/java/cy/agorise/crystalwallet/application/CrystalApplication.java @@ -16,6 +16,5 @@ public class CrystalApplication extends Application { //initialize the database CrystalDatabase db = CrystalDatabase.getAppDatabase(this.getApplicationContext()); - db.accountSeedDao().getAll(); } } diff --git a/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java b/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java index e7eb916..7cd993f 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java +++ b/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java @@ -38,9 +38,13 @@ public abstract class CrystalDatabase extends RoomDatabase { database.execSQL("CREATE TABLE 'account_seed' ('id' INTEGER PRIMARY KEY AUTOINCREMENT, " + "'name' TEXT, 'master_seed' NUMERIC)"); database.execSQL("CREATE TABLE 'crypto_net_account' ('id' INTEGER PRIMARY KEY AUTOINCREMENT, " - + "'seed_id', " + + "'seed_id' INTEGER, " + "'account_number' INT, 'account_index' INT," + "FOREIGN_KEY(seed_id) REFERENCES seed(id))"); + database.execSQL("CREATE TABLE 'crypto_coin_transaction' ('id' INTEGER PRIMARY KEY AUTOINCREMENT, " + + "'account_id' INTEGER, " + + "'date' INT, 'is_input' INT," + + "FOREIGN_KEY(account_id) REFERENCES crypto_net_account(id))"); } }; } diff --git a/app/src/main/java/cy/agorise/crystalwallet/models/CryptoCoinTransaction.java b/app/src/main/java/cy/agorise/crystalwallet/models/CryptoCoinTransaction.java new file mode 100644 index 0000000..3e5ff0d --- /dev/null +++ b/app/src/main/java/cy/agorise/crystalwallet/models/CryptoCoinTransaction.java @@ -0,0 +1,66 @@ +package cy.agorise.crystalwallet.models; + +import android.arch.persistence.room.ColumnInfo; +import android.arch.persistence.room.Entity; +import android.arch.persistence.room.PrimaryKey; + +import java.util.Date; + +/** + * Created by Henry Varona on 11/9/2017. + */ +@Entity(tableName="crypto_coin_transaction") +public class CryptoCoinTransaction { + + protected CryptoNetAccount account; + + @PrimaryKey(autoGenerate = true) + @ColumnInfo(name="id") + protected int id; + @ColumnInfo(name="date") + protected Date date; + @ColumnInfo(name="is_input") + protected boolean isInput; + @ColumnInfo(name="account_id") + protected int accountId; + + public int getAccountId() { + return accountId; + } + + public void setAccountId(int accountId) { + this.accountId = accountId; + } + + public CryptoNetAccount getAccount() { + return account; + } + + public void setAccount(CryptoNetAccount account) { + this.account = account; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public boolean getInput() { + return isInput; + } + + public void setInput(boolean input) { + this.isInput = input; + } +} diff --git a/app/src/main/java/cy/agorise/crystalwallet/views/TransactionListAdapter.java b/app/src/main/java/cy/agorise/crystalwallet/views/TransactionListAdapter.java new file mode 100644 index 0000000..84a12d9 --- /dev/null +++ b/app/src/main/java/cy/agorise/crystalwallet/views/TransactionListAdapter.java @@ -0,0 +1,23 @@ +package cy.agorise.crystalwallet.views; + + +import android.content.Context; +import android.widget.ArrayAdapter; +import android.widget.ListAdapter; + +import java.util.List; + +import cy.agorise.crystalwallet.models.CryptoCoinTransaction; + +/** + * Created by Henry Varona on 11/9/2017. + */ + +public class TransactionListAdapter extends ArrayAdapter { + + + + public TransactionListAdapter(Context context, int resource, List items) { + super(context, resource, items); + } +} diff --git a/app/src/main/java/cy/agorise/crystalwallet/views/TransactionListView.java b/app/src/main/java/cy/agorise/crystalwallet/views/TransactionListView.java new file mode 100644 index 0000000..8fc8b5d --- /dev/null +++ b/app/src/main/java/cy/agorise/crystalwallet/views/TransactionListView.java @@ -0,0 +1,31 @@ +package cy.agorise.crystalwallet.views; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.RelativeLayout; + +import cy.agorise.crystalwallet.R; + +/** + * Created by Henry Varona on 10/9/2017. + */ + +public class TransactionListView extends RelativeLayout { + + View rootView; + ListView list; + ListAdapter listAdapter; + + public TransactionListView(Context context, AttributeSet attrs) { + super(context, attrs); + rootView = inflate(context, R.layout.transaction_list, this); + list = rootView.findViewById(R.id.transactionListView); + listAdapter = new TransactionListAdapter(); + list.setAdapter(listAdapter); + } + + +} diff --git a/app/src/main/res/layout/transaction_list.xml b/app/src/main/res/layout/transaction_list.xml new file mode 100644 index 0000000..34a79de --- /dev/null +++ b/app/src/main/res/layout/transaction_list.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/transaction_list_item.xml b/app/src/main/res/layout/transaction_list_item.xml new file mode 100644 index 0000000..f4818c7 --- /dev/null +++ b/app/src/main/res/layout/transaction_list_item.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + \ No newline at end of file