- Added a Seed List View
- Added Import Seed View - Added Room objects for the Seeds
This commit is contained in:
parent
1c341ce27b
commit
0017eb76fb
22 changed files with 694 additions and 21 deletions
|
@ -52,4 +52,7 @@ dependencies {
|
|||
compile 'org.bitcoinj:bitcoinj-core:0.14.3'
|
||||
compile 'com.neovisionaries:nv-websocket-client:1.30'
|
||||
compile 'org.tukaani:xz:1.6'
|
||||
compile 'com.jakewharton:butterknife:8.8.1'
|
||||
apt 'com.jakewharton:butterknife-compiler:8.8.1'
|
||||
|
||||
}
|
||||
|
|
|
@ -10,13 +10,10 @@ import android.support.test.InstrumentationRegistry;
|
|||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import carbon.crypto.com.carbon.Assertions.RecyclerViewItemsCountAssertion;
|
||||
import cy.agorise.crystalwallet.IntroActivity;
|
||||
import cy.agorise.crystalwallet.activities.IntroActivity;
|
||||
import cy.agorise.crystalwallet.R;
|
||||
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||
import cy.agorise.crystalwallet.models.CryptoCoinTransaction;
|
||||
|
@ -25,9 +22,6 @@ import cy.agorise.crystalwallet.randomdatagenerators.RandomTransactionsGenerator
|
|||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Henry Varona on 19/9/2017.
|
||||
|
|
|
@ -10,13 +10,17 @@
|
|||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".IntroActivity">
|
||||
<activity android:name=".activities.IntroActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".activities.AccountSeedsManagementActivity" >
|
||||
</activity>
|
||||
<activity android:name=".activities.ImportSeedActivity" >
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,59 @@
|
|||
package cy.agorise.crystalwallet.activities;
|
||||
|
||||
import android.arch.lifecycle.LiveData;
|
||||
import android.arch.lifecycle.Observer;
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.Button;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import cy.agorise.crystalwallet.R;
|
||||
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||
import cy.agorise.crystalwallet.viewmodels.AccountSeedListViewModel;
|
||||
import cy.agorise.crystalwallet.views.AccountSeedListView;
|
||||
|
||||
public class AccountSeedsManagementActivity extends AppCompatActivity {
|
||||
|
||||
AccountSeedsManagementActivity accountSeedsManagementActivity;
|
||||
AccountSeedListViewModel accountSeedListViewModel;
|
||||
|
||||
@BindView(R.id.vAccountSeedList)
|
||||
AccountSeedListView vAccountSeedList;
|
||||
|
||||
@BindView(R.id.btnImportAccountSeed)
|
||||
Button btnImportAccountSeed;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.account_seeds_management);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
accountSeedListViewModel = ViewModelProviders.of(this).get(AccountSeedListViewModel.class);
|
||||
LiveData<List<AccountSeed>> accountSeedData = accountSeedListViewModel.getAccountSeedList();
|
||||
//vAccountSeedList = this.findViewById(R.id.vAccountSeedList);
|
||||
|
||||
accountSeedData.observe(this, new Observer<List<AccountSeed>>() {
|
||||
@Override
|
||||
public void onChanged(List<AccountSeed> accountSeeds) {
|
||||
vAccountSeedList.setData(accountSeeds);
|
||||
}
|
||||
});
|
||||
|
||||
//accountSeedListView.setData(null);
|
||||
}
|
||||
|
||||
@OnClick (R.id.btnImportAccountSeed)
|
||||
public void importAccountSeed(){
|
||||
Intent intent = new Intent(this, ImportSeedActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package cy.agorise.crystalwallet.activities;
|
||||
|
||||
import android.arch.lifecycle.LifecycleActivity;
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import cy.agorise.crystalwallet.R;
|
||||
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||
import cy.agorise.crystalwallet.viewmodels.AccountSeedListViewModel;
|
||||
import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel;
|
||||
import cy.agorise.crystalwallet.viewmodels.TransactionListViewModel;
|
||||
import cy.agorise.crystalwallet.views.TransactionListView;
|
||||
|
||||
public class ImportSeedActivity extends AppCompatActivity {
|
||||
|
||||
AccountSeedViewModel accountSeedViewModel;
|
||||
|
||||
@BindView(R.id.tvPin)
|
||||
TextView tvPin;
|
||||
|
||||
@BindView(R.id.tvPinConfirmation)
|
||||
TextView tvPinConfirmation;
|
||||
|
||||
@BindView(R.id.etSeedWords)
|
||||
TextView etSeedWords;
|
||||
|
||||
@BindView(R.id.btnImport)
|
||||
Button btnImport;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.import_seed);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
accountSeedViewModel = ViewModelProviders.of(this).get(AccountSeedViewModel.class);
|
||||
//this.seed = new AccountSeed();
|
||||
}
|
||||
|
||||
@OnClick(R.id.btnImport)
|
||||
public void importSeed(){
|
||||
AccountSeed seed = new AccountSeed();
|
||||
|
||||
//TODO verify if PIN and PIN confirmation are not null and are the same
|
||||
//TODO verify if words are already in the db
|
||||
seed.setMasterSeed(etSeedWords.getText().toString());
|
||||
|
||||
accountSeedViewModel.addSeed(seed);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package cy.agorise.crystalwallet;
|
||||
package cy.agorise.crystalwallet.activities;
|
||||
|
||||
import android.arch.lifecycle.LifecycleActivity;
|
||||
import android.arch.lifecycle.LiveData;
|
||||
|
@ -6,6 +6,7 @@ import android.arch.lifecycle.Observer;
|
|||
import android.arch.lifecycle.ViewModelProvider;
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.arch.paging.PagedList;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -14,6 +15,7 @@ import android.widget.Button;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import cy.agorise.crystalwallet.R;
|
||||
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||
import cy.agorise.crystalwallet.models.CryptoCoinTransaction;
|
||||
|
@ -21,12 +23,13 @@ import cy.agorise.crystalwallet.models.CryptoNetAccount;
|
|||
import cy.agorise.crystalwallet.randomdatagenerators.RandomCryptoNetAccountGenerator;
|
||||
import cy.agorise.crystalwallet.randomdatagenerators.RandomSeedGenerator;
|
||||
import cy.agorise.crystalwallet.randomdatagenerators.RandomTransactionsGenerator;
|
||||
import cy.agorise.crystalwallet.viewmodels.AccountSeedListViewModel;
|
||||
import cy.agorise.crystalwallet.viewmodels.TransactionListViewModel;
|
||||
import cy.agorise.crystalwallet.views.TransactionListView;
|
||||
|
||||
import static cy.agorise.crystalwallet.R.string.transactions;
|
||||
|
||||
public class IntroActivity extends LifecycleActivity {
|
||||
public class IntroActivity extends AppCompatActivity {
|
||||
|
||||
TransactionListViewModel transactionListViewModel;
|
||||
TransactionListView transactionListView;
|
||||
|
@ -36,6 +39,16 @@ public class IntroActivity extends LifecycleActivity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_intro);
|
||||
|
||||
//Checks if the user has any seed created
|
||||
AccountSeedListViewModel accountSeedListViewModel = ViewModelProviders.of(this).get(AccountSeedListViewModel.class);
|
||||
|
||||
if (accountSeedListViewModel.accountSeedsCount() == 0){
|
||||
//If the user doesn't have any seeds created, then
|
||||
//send the user to create/import an account
|
||||
Intent intent = new Intent(this, AccountSeedsManagementActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
/*CrystalDatabase db = CrystalDatabase.getAppDatabase(getApplicationContext());
|
||||
List<AccountSeed> seeds = RandomSeedGenerator.generateSeeds(2);
|
||||
for(int i=0;i<seeds.size();i++) {
|
||||
|
@ -53,7 +66,7 @@ public class IntroActivity extends LifecycleActivity {
|
|||
transactions.get(i).setId(newId);
|
||||
}*/
|
||||
|
||||
transactionListView = this.findViewById(R.id.transaction_list);
|
||||
/*transactionListView = this.findViewById(R.id.transaction_list);
|
||||
|
||||
transactionListViewModel = ViewModelProviders.of(this).get(TransactionListViewModel.class);
|
||||
LiveData<PagedList<CryptoCoinTransaction>> transactionData = transactionListViewModel.getTransactionList();
|
||||
|
@ -64,6 +77,6 @@ public class IntroActivity extends LifecycleActivity {
|
|||
public void onChanged(PagedList<CryptoCoinTransaction> cryptoCoinTransactions) {
|
||||
transactionListView.setData(cryptoCoinTransactions);
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package cy.agorise.crystalwallet.dao;
|
||||
|
||||
import android.arch.lifecycle.LiveData;
|
||||
import android.arch.lifecycle.MutableLiveData;
|
||||
import android.arch.persistence.room.Dao;
|
||||
import android.arch.persistence.room.Insert;
|
||||
import android.arch.persistence.room.OnConflictStrategy;
|
||||
|
@ -17,9 +19,17 @@ import cy.agorise.crystalwallet.models.AccountSeed;
|
|||
public interface AccountSeedDao {
|
||||
|
||||
@Query("SELECT * FROM account_seed")
|
||||
List<AccountSeed> getAll();
|
||||
LiveData<List<AccountSeed>> getAll();
|
||||
|
||||
@Query("SELECT * FROM account_seed WHERE id = :id")
|
||||
LiveData<AccountSeed> findById(long id);
|
||||
|
||||
@Query("SELECT COUNT(*) from account_seed")
|
||||
int countAccountSeeds();
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
public long[] insertAccountSeed(AccountSeed... seeds);
|
||||
public long[] insertAccountSeeds(AccountSeed... seeds);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
public long insertAccountSeed(AccountSeed seed);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,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.CryptoNetAccount;
|
||||
|
||||
import static cy.agorise.crystalwallet.R.string.account;
|
||||
|
@ -84,4 +85,22 @@ public class Converters {
|
|||
return CryptoNet.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
public String seedTypeToName(SeedType value) {
|
||||
if (value == null) {
|
||||
return "";
|
||||
} else {
|
||||
return value.name();
|
||||
}
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
public SeedType nameToSeedType(String value) {
|
||||
if (value.equals("")){
|
||||
return null;
|
||||
} else {
|
||||
return SeedType.valueOf(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package cy.agorise.crystalwallet.enums;
|
||||
|
||||
/**
|
||||
* Created by Henry Varona on 30/9/2017.
|
||||
*/
|
||||
|
||||
public enum SeedType {
|
||||
BIP39,
|
||||
BRAINKEY
|
||||
}
|
|
@ -4,6 +4,10 @@ package cy.agorise.crystalwallet.models;
|
|||
import android.arch.persistence.room.ColumnInfo;
|
||||
import android.arch.persistence.room.Entity;
|
||||
import android.arch.persistence.room.PrimaryKey;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.recyclerview.extensions.DiffCallback;
|
||||
|
||||
import cy.agorise.crystalwallet.enums.SeedType;
|
||||
|
||||
/**
|
||||
* Represents a type of crypto seed for HD wallets
|
||||
|
@ -32,6 +36,11 @@ public class AccountSeed {
|
|||
@ColumnInfo(name = "master_seed")
|
||||
private String mMasterSeed;
|
||||
|
||||
/**
|
||||
* The type of this seed: BIP39, BRAINKEY
|
||||
*/
|
||||
private SeedType type;
|
||||
|
||||
public long getId() {
|
||||
return mId;
|
||||
}
|
||||
|
@ -56,5 +65,36 @@ public class AccountSeed {
|
|||
this.mMasterSeed = mMasterSeed;
|
||||
}
|
||||
|
||||
public SeedType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(SeedType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public static final DiffCallback<AccountSeed> DIFF_CALLBACK = new DiffCallback<AccountSeed>() {
|
||||
@Override
|
||||
public boolean areItemsTheSame(
|
||||
@NonNull AccountSeed oldAccountSeed, @NonNull AccountSeed newAccountSeed) {
|
||||
return oldAccountSeed.getId() == newAccountSeed.getId();
|
||||
}
|
||||
@Override
|
||||
public boolean areContentsTheSame(
|
||||
@NonNull AccountSeed oldAccountSeed, @NonNull AccountSeed newAccountSeed) {
|
||||
return oldAccountSeed.equals(newAccountSeed);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
AccountSeed that = (AccountSeed) o;
|
||||
|
||||
if (mId != that.mId) return false;
|
||||
return mMasterSeed.equals(that.mMasterSeed);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package cy.agorise.crystalwallet.viewmodels;
|
||||
|
||||
import android.app.Application;
|
||||
import android.arch.lifecycle.AndroidViewModel;
|
||||
import android.arch.lifecycle.LiveData;
|
||||
import android.arch.paging.PagedList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||
import cy.agorise.crystalwallet.models.CryptoCoinTransaction;
|
||||
|
||||
/**
|
||||
* Created by Henry Varona on 27/9/2017.
|
||||
*/
|
||||
|
||||
public class AccountSeedListViewModel extends AndroidViewModel {
|
||||
|
||||
private LiveData<List<AccountSeed>> accountSeedList;
|
||||
private CrystalDatabase db;
|
||||
|
||||
public AccountSeedListViewModel(Application application) {
|
||||
super(application);
|
||||
this.db = CrystalDatabase.getAppDatabase(application.getApplicationContext());
|
||||
this.accountSeedList = this.db.accountSeedDao().getAll();
|
||||
}
|
||||
|
||||
public LiveData<List<AccountSeed>> getAccountSeedList(){
|
||||
return this.accountSeedList;
|
||||
}
|
||||
|
||||
public int accountSeedsCount(){
|
||||
return this.db.accountSeedDao().countAccountSeeds();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package cy.agorise.crystalwallet.viewmodels;
|
||||
|
||||
import android.app.Application;
|
||||
import android.arch.lifecycle.AndroidViewModel;
|
||||
import android.arch.lifecycle.LiveData;
|
||||
import android.arch.lifecycle.MutableLiveData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||
|
||||
/**
|
||||
* Created by Henry Varona on 27/9/2017.
|
||||
*/
|
||||
|
||||
public class AccountSeedViewModel extends AndroidViewModel {
|
||||
|
||||
private LiveData<AccountSeed> accountSeed;
|
||||
private CrystalDatabase db;
|
||||
|
||||
public AccountSeedViewModel(Application application) {
|
||||
super(application);
|
||||
this.db = CrystalDatabase.getAppDatabase(application.getApplicationContext());
|
||||
}
|
||||
|
||||
public void loadSeed(int seedId){
|
||||
this.accountSeed = this.db.accountSeedDao().findById(seedId);
|
||||
}
|
||||
|
||||
public void addSeed(AccountSeed seed){
|
||||
this.db.accountSeedDao().insertAccountSeed(seed);
|
||||
}
|
||||
|
||||
public LiveData<AccountSeed> getAccountSeed(){
|
||||
return this.accountSeed;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package cy.agorise.crystalwallet.views;
|
||||
|
||||
|
||||
import android.arch.paging.PagedListAdapter;
|
||||
import android.support.v7.recyclerview.extensions.ListAdapter;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import cy.agorise.crystalwallet.R;
|
||||
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||
import cy.agorise.crystalwallet.models.CryptoCoinTransaction;
|
||||
|
||||
/**
|
||||
* Created by Henry Varona on 11/9/2017.
|
||||
*/
|
||||
|
||||
public class AccountSeedListAdapter extends ListAdapter<AccountSeed, AccountSeedViewHolder> {
|
||||
|
||||
public AccountSeedListAdapter() {
|
||||
super(AccountSeed.DIFF_CALLBACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountSeedViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.account_seed_list_item,parent,false);
|
||||
|
||||
return new AccountSeedViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(AccountSeedViewHolder holder, int position) {
|
||||
AccountSeed accountSeed = getItem(position);
|
||||
if (accountSeed != null) {
|
||||
holder.bindTo(accountSeed);
|
||||
} else {
|
||||
holder.clear();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package cy.agorise.crystalwallet.views;
|
||||
|
||||
import android.arch.paging.PagedList;
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cy.agorise.crystalwallet.R;
|
||||
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||
import cy.agorise.crystalwallet.models.CryptoCoinTransaction;
|
||||
import cy.agorise.crystalwallet.viewmodels.AccountSeedListViewModel;
|
||||
import cy.agorise.crystalwallet.viewmodels.TransactionListViewModel;
|
||||
|
||||
/**
|
||||
* Created by Henry Varona on 10/9/2017.
|
||||
*/
|
||||
|
||||
public class AccountSeedListView extends RelativeLayout {
|
||||
|
||||
LayoutInflater mInflater;
|
||||
|
||||
View rootView;
|
||||
RecyclerView listView;
|
||||
AccountSeedListAdapter listAdapter;
|
||||
|
||||
AccountSeedListViewModel accountSeedListViewModel;
|
||||
|
||||
public AccountSeedListView(Context context){
|
||||
super(context);
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public AccountSeedListView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public AccountSeedListView(Context context, AttributeSet attrs, int defStyle){
|
||||
super(context, attrs, defStyle);
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public void init(){
|
||||
rootView = mInflater.inflate(R.layout.account_seed_list, this, true);
|
||||
this.listView = rootView.findViewById(R.id.accountSeedListView);
|
||||
|
||||
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.getContext());
|
||||
this.listView.setLayoutManager(linearLayoutManager);
|
||||
this.listView.setNestedScrollingEnabled(false);
|
||||
}
|
||||
|
||||
public void setData(List<AccountSeed> data){
|
||||
if (this.listAdapter == null) {
|
||||
this.listAdapter = new AccountSeedListAdapter();
|
||||
this.listView.setAdapter(this.listAdapter);
|
||||
}
|
||||
|
||||
if (data != null) {
|
||||
this.listAdapter.setList(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package cy.agorise.crystalwallet.views;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import cy.agorise.crystalwallet.R;
|
||||
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||
import cy.agorise.crystalwallet.models.CryptoCoinTransaction;
|
||||
|
||||
/**
|
||||
* Created by Henry Varona on 17/9/2017.
|
||||
*/
|
||||
|
||||
public class AccountSeedViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView tvAccountSeedName;
|
||||
|
||||
public AccountSeedViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
tvAccountSeedName = (TextView) itemView.findViewById(R.id.tvAccountSeedName);
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
tvAccountSeedName.setText("loading...");
|
||||
}
|
||||
|
||||
public void bindTo(final AccountSeed accountSeed) {
|
||||
if (accountSeed == null){
|
||||
tvAccountSeedName.setText("loading...");
|
||||
} else {
|
||||
tvAccountSeedName.setText(accountSeed.getName());
|
||||
}
|
||||
}
|
||||
}
|
13
app/src/main/res/layout/account_seed_list.xml
Normal file
13
app/src/main/res/layout/account_seed_list.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/accountSeedListView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
24
app/src/main/res/layout/account_seed_list_item.xml
Normal file
24
app/src/main/res/layout/account_seed_list_item.xml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAccountSeedName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:text="name of the account" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
20
app/src/main/res/layout/account_seeds_management.xml
Normal file
20
app/src/main/res/layout/account_seeds_management.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnImportAccountSeed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="import seed" />
|
||||
|
||||
<cy.agorise.crystalwallet.views.AccountSeedListView
|
||||
android:id="@+id/vAccountSeedList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
</cy.agorise.crystalwallet.views.AccountSeedListView>
|
||||
</RelativeLayout>
|
|
@ -95,16 +95,17 @@
|
|||
android:layout_gravity="center"
|
||||
android:id="@+id/btnCancel"
|
||||
android:text="@string/cancel"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnWallet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/green"
|
||||
android:textColor="@color/white"
|
||||
android:layout_margin="10dp"
|
||||
android:padding="10dp"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/btnWallet"
|
||||
android:text="@string/create_wallet"/>
|
||||
android:layout_margin="10dp"
|
||||
android:background="@color/green"
|
||||
android:padding="10dp"
|
||||
android:text="@string/import_new_account"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="cy.agorise.crystalwallet.IntroActivity">
|
||||
tools:context="cy.agorise.crystalwallet.activities.IntroActivity">
|
||||
|
||||
<cy.agorise.crystalwallet.views.TransactionListView
|
||||
android:id="@+id/transaction_list"
|
||||
|
|
181
app/src/main/res/layout/import_seed.xml
Normal file
181
app/src/main/res/layout/import_seed.xml
Normal file
|
@ -0,0 +1,181 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/white"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="0dp"
|
||||
android:paddingLeft="0dp"
|
||||
android:paddingRight="0dp"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/txt_6_digits_pin"
|
||||
android:id="@+id/tvPin"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="10dp"/>
|
||||
|
||||
<EditText
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
android:id="@+id/etPin"
|
||||
android:layout_width="match_parent"
|
||||
android:inputType="number"
|
||||
android:background="@drawable/edittext_bg"
|
||||
android:maxLines="1"
|
||||
android:layout_height="40dp"/>
|
||||
<TextView
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/tvPinConfirmation"
|
||||
android:text="@string/txt_6_digits_pin_confirm"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="10dp"/>
|
||||
|
||||
<EditText
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
android:id="@+id/etPinConfirmation"
|
||||
android:layout_width="match_parent"
|
||||
android:inputType="number"
|
||||
android:background="@drawable/edittext_bg"
|
||||
android:singleLine="true"
|
||||
android:maxLines="1"
|
||||
android:layout_height="40dp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/seed_words"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="10dp"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etSeedWords"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
android:background="@drawable/edittext_bg"
|
||||
android:gravity="top"
|
||||
android:inputType="textMultiLine" />
|
||||
|
||||
<TextView
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/txt_account_name"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="10dp"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etAccountName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
android:background="@drawable/edittext_bg"
|
||||
android:gravity="top"
|
||||
android:inputType="textMultiLine" />
|
||||
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/txt_brain_key_info"
|
||||
android:textSize="15dp"
|
||||
android:layout_marginTop="10dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center">
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/pink"
|
||||
android:textColor="@color/white"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/btnCancel"
|
||||
android:text="@string/cancel"/>
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/green"
|
||||
android:textColor="@color/white"
|
||||
android:layout_margin="10dp"
|
||||
android:padding="10dp"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/btnImport"
|
||||
android:text="@string/create_wallet"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="bottom"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/black">
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/bottomBarColor">
|
||||
<TextView
|
||||
android:text="@string/v_1_0_beta"
|
||||
android:id="@+id/tvAppVersion_brain_key_activity"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/tvBlockNumberHead_brain_key_activity"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:gravity="center"
|
||||
android:text="@string/block_number"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSocketConnected_brain_key_activity"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
<ImageView android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/icon_setting"
|
||||
android:visibility="invisible"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -33,6 +33,7 @@
|
|||
<string name="account_label">Choose File</string>
|
||||
<string name="loading_msg">Please wait until Balances are loading</string>
|
||||
|
||||
<string name="seed_words">Seed</string>
|
||||
<string name="txt_6_digits_pin">PIN (6+ digits)</string>
|
||||
<string name="txt_6_digits_pin_confirm">PIN confirm</string>
|
||||
<string name="create">CREATE</string>
|
||||
|
|
Loading…
Reference in a new issue