- Change account seed list in profile settings to crypto net account list
- Added settings for crypto net accounts. General settings for any crypto net account and Bitshares settings for bitshares accounts - Added new field in db for bitshares accounts: upgraded_to_ltm - Added button to upgrade to ltm (still in progress...)
This commit is contained in:
parent
3252062e74
commit
42e8637d11
21 changed files with 1022 additions and 19 deletions
|
@ -2,7 +2,7 @@
|
||||||
"formatVersion": 1,
|
"formatVersion": 1,
|
||||||
"database": {
|
"database": {
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"identityHash": "22cb2a56b28a9f7088ec98d6a72f9f67",
|
"identityHash": "14fe802949d125dda3e3c476a34481d7",
|
||||||
"entities": [
|
"entities": [
|
||||||
{
|
{
|
||||||
"tableName": "account_seed",
|
"tableName": "account_seed",
|
||||||
|
@ -478,7 +478,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tableName": "graphene_account",
|
"tableName": "graphene_account",
|
||||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`crypto_net_account_id` INTEGER NOT NULL, `account_name` TEXT, `account_id` TEXT, PRIMARY KEY(`crypto_net_account_id`), FOREIGN KEY(`crypto_net_account_id`) REFERENCES `crypto_net_account`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`crypto_net_account_id` INTEGER NOT NULL, `account_name` TEXT, `account_id` TEXT, `upgraded_to_ltm` INTEGER NOT NULL, PRIMARY KEY(`crypto_net_account_id`), FOREIGN KEY(`crypto_net_account_id`) REFERENCES `crypto_net_account`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fieldPath": "cryptoNetAccountId",
|
"fieldPath": "cryptoNetAccountId",
|
||||||
|
@ -497,6 +497,12 @@
|
||||||
"columnName": "account_id",
|
"columnName": "account_id",
|
||||||
"affinity": "TEXT",
|
"affinity": "TEXT",
|
||||||
"notNull": false
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "upgradedToLtm",
|
||||||
|
"columnName": "upgraded_to_ltm",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"primaryKey": {
|
"primaryKey": {
|
||||||
|
@ -692,7 +698,7 @@
|
||||||
],
|
],
|
||||||
"setupQueries": [
|
"setupQueries": [
|
||||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"22cb2a56b28a9f7088ec98d6a72f9f67\")"
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"14fe802949d125dda3e3c476a34481d7\")"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -52,6 +52,10 @@
|
||||||
<activity android:name=".activities.PatternRequestActivity"
|
<activity android:name=".activities.PatternRequestActivity"
|
||||||
android:noHistory="true">
|
android:noHistory="true">
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name=".activities.CryptoNetAccountSettingsActivity"
|
||||||
|
android:theme="@style/AppTheme.NoActionBar"
|
||||||
|
android:windowSoftInputMode="adjustPan">
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.SettingsActivity"
|
android:name=".activities.SettingsActivity"
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:theme="@style/AppTheme.NoActionBar"
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
package cy.agorise.crystalwallet.activities;
|
||||||
|
|
||||||
|
import android.media.MediaPlayer;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.design.widget.TabLayout;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.SurfaceHolder;
|
||||||
|
import android.view.SurfaceView;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.OnClick;
|
||||||
|
import cy.agorise.crystalwallet.R;
|
||||||
|
import cy.agorise.crystalwallet.fragments.BackupsSettingsFragment;
|
||||||
|
import cy.agorise.crystalwallet.fragments.GeneralSettingsFragment;
|
||||||
|
import cy.agorise.crystalwallet.fragments.SecuritySettingsFragment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by henry varona on 05/27/18.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AccountSettingsActivity extends AppCompatActivity{
|
||||||
|
|
||||||
|
@BindView(R.id.ivGoBack)
|
||||||
|
public ImageView ivGoBack;
|
||||||
|
|
||||||
|
@BindView(R.id.pager)
|
||||||
|
public ViewPager mPager;
|
||||||
|
|
||||||
|
public SettingsPagerAdapter settingsPagerAdapter;
|
||||||
|
|
||||||
|
@BindView(R.id.surface_view)
|
||||||
|
public SurfaceView mSurfaceView;
|
||||||
|
|
||||||
|
@BindView(R.id.tvBuildVersion)
|
||||||
|
public TextView tvBuildVersion;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.crypto_net_account_activity_settings);
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
// Appbar animation
|
||||||
|
mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||||
|
@Override
|
||||||
|
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||||||
|
//Log.d(TAG,"surfaceCreated");
|
||||||
|
MediaPlayer mediaPlayer = MediaPlayer.create(AccountSettingsActivity.this, R.raw.appbar_background);
|
||||||
|
mediaPlayer.setDisplay(mSurfaceView.getHolder());
|
||||||
|
mediaPlayer.setLooping(true);
|
||||||
|
mediaPlayer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) {
|
||||||
|
//Log.d(TAG,"surfaceChanged");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
|
||||||
|
//Log.d(TAG,"surfaceDestroyed");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
settingsPagerAdapter = new SettingsPagerAdapter(getSupportFragmentManager());
|
||||||
|
mPager.setAdapter(settingsPagerAdapter);
|
||||||
|
|
||||||
|
TabLayout tabLayout = findViewById(R.id.tabs);
|
||||||
|
|
||||||
|
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
||||||
|
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager));
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SettingsPagerAdapter extends FragmentStatePagerAdapter {
|
||||||
|
SettingsPagerAdapter(FragmentManager fm) {
|
||||||
|
super(fm);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Fragment getItem(int position) {
|
||||||
|
switch (position){
|
||||||
|
case 0:
|
||||||
|
return new GeneralSettingsFragment();
|
||||||
|
case 1:
|
||||||
|
return new SecuritySettingsFragment();
|
||||||
|
case 2:
|
||||||
|
return new BackupsSettingsFragment();
|
||||||
|
//case 3:
|
||||||
|
// return new AccountsSettingsFragment();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return null; //new OnConstructionFragment();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnClick(R.id.ivGoBack)
|
||||||
|
public void goBack(){
|
||||||
|
onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,8 +33,11 @@ import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
import cy.agorise.crystalwallet.R;
|
import cy.agorise.crystalwallet.R;
|
||||||
import cy.agorise.crystalwallet.models.AccountSeed;
|
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||||
|
import cy.agorise.crystalwallet.models.CryptoNetAccount;
|
||||||
import cy.agorise.crystalwallet.viewmodels.AccountSeedListViewModel;
|
import cy.agorise.crystalwallet.viewmodels.AccountSeedListViewModel;
|
||||||
|
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountListViewModel;
|
||||||
import cy.agorise.crystalwallet.views.AccountSeedListView;
|
import cy.agorise.crystalwallet.views.AccountSeedListView;
|
||||||
|
import cy.agorise.crystalwallet.views.CryptoNetAccountListView;
|
||||||
import de.hdodenhof.circleimageview.CircleImageView;
|
import de.hdodenhof.circleimageview.CircleImageView;
|
||||||
import id.zelory.compressor.Compressor;
|
import id.zelory.compressor.Compressor;
|
||||||
|
|
||||||
|
@ -51,8 +54,8 @@ public class AccountsActivity extends AppCompatActivity {
|
||||||
@BindView(R.id.tvClose)
|
@BindView(R.id.tvClose)
|
||||||
TextView tvClose;
|
TextView tvClose;
|
||||||
|
|
||||||
@BindView(R.id.vAccountSeedList)
|
@BindView(R.id.vAccountList)
|
||||||
AccountSeedListView vAccountSeedList;
|
CryptoNetAccountListView vAccountList;
|
||||||
|
|
||||||
@BindView(R.id.user_img)
|
@BindView(R.id.user_img)
|
||||||
CircleImageView userImg;
|
CircleImageView userImg;
|
||||||
|
@ -67,14 +70,14 @@ public class AccountsActivity extends AppCompatActivity {
|
||||||
setContentView(R.layout.activity_accounts);
|
setContentView(R.layout.activity_accounts);
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
AccountSeedListViewModel accountSeedListViewModel = ViewModelProviders.of(this).get(AccountSeedListViewModel.class);
|
CryptoNetAccountListViewModel crytpoNetAccountListViewModel = ViewModelProviders.of(this).get(CryptoNetAccountListViewModel.class);
|
||||||
LiveData<List<AccountSeed>> accountSeedData = accountSeedListViewModel.getAccountSeedList();
|
LiveData<List<CryptoNetAccount>> accountData = crytpoNetAccountListViewModel.getCryptoNetAccounts();
|
||||||
vAccountSeedList.setData(null);
|
vAccountList.setData(null);
|
||||||
|
|
||||||
accountSeedData.observe(this, new Observer<List<AccountSeed>>() {
|
accountData.observe(this, new Observer<List<CryptoNetAccount>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(List<AccountSeed> accountSeeds) {
|
public void onChanged(List<CryptoNetAccount> cryptoNetAccounts) {
|
||||||
vAccountSeedList.setData(accountSeeds);
|
vAccountList.setData(cryptoNetAccounts);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,171 @@
|
||||||
|
package cy.agorise.crystalwallet.activities;
|
||||||
|
|
||||||
|
import android.arch.lifecycle.LiveData;
|
||||||
|
import android.arch.lifecycle.Observer;
|
||||||
|
import android.arch.lifecycle.ViewModelProviders;
|
||||||
|
import android.media.MediaPlayer;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.design.widget.TabLayout;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.SurfaceHolder;
|
||||||
|
import android.view.SurfaceView;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.OnClick;
|
||||||
|
import cy.agorise.crystalwallet.R;
|
||||||
|
import cy.agorise.crystalwallet.fragments.BackupsSettingsFragment;
|
||||||
|
import cy.agorise.crystalwallet.fragments.BitsharesSettingsFragment;
|
||||||
|
import cy.agorise.crystalwallet.fragments.GeneralCryptoNetAccountSettingsFragment;
|
||||||
|
import cy.agorise.crystalwallet.fragments.GeneralSettingsFragment;
|
||||||
|
import cy.agorise.crystalwallet.fragments.SecuritySettingsFragment;
|
||||||
|
import cy.agorise.crystalwallet.models.CryptoNetAccount;
|
||||||
|
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountViewModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by henry varona on 05/28/18.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CryptoNetAccountSettingsActivity extends AppCompatActivity{
|
||||||
|
|
||||||
|
@BindView(R.id.ivGoBack)
|
||||||
|
public ImageView ivGoBack;
|
||||||
|
|
||||||
|
@BindView(R.id.pager)
|
||||||
|
public ViewPager mPager;
|
||||||
|
|
||||||
|
public SettingsPagerAdapter settingsPagerAdapter;
|
||||||
|
|
||||||
|
@BindView(R.id.surface_view)
|
||||||
|
public SurfaceView mSurfaceView;
|
||||||
|
|
||||||
|
@BindView(R.id.tvBuildVersion)
|
||||||
|
public TextView tvBuildVersion;
|
||||||
|
|
||||||
|
@BindView(R.id.tabs)
|
||||||
|
public TabLayout tabs;
|
||||||
|
|
||||||
|
private CryptoNetAccount cryptoNetAccount;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.crypto_net_account_activity_settings);
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
final CryptoNetAccountSettingsActivity thisActivity = this;
|
||||||
|
|
||||||
|
long accountId = getIntent().getLongExtra("CRYPTO_NET_ACCOUNT_ID",-1);
|
||||||
|
|
||||||
|
if (accountId > -1) {
|
||||||
|
CryptoNetAccountViewModel cryptoNetAccountViewModel = ViewModelProviders.of(this).get(CryptoNetAccountViewModel.class);
|
||||||
|
cryptoNetAccountViewModel.loadCryptoNetAccount(accountId);
|
||||||
|
LiveData<CryptoNetAccount> cryptoNetAccountLiveData = cryptoNetAccountViewModel.getCryptoNetAccount();
|
||||||
|
|
||||||
|
cryptoNetAccountLiveData.observe(this, new Observer<CryptoNetAccount>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(@Nullable CryptoNetAccount cryptoNetAccount) {
|
||||||
|
thisActivity.cryptoNetAccount = cryptoNetAccount;
|
||||||
|
|
||||||
|
settingsPagerAdapter = new SettingsPagerAdapter(getSupportFragmentManager());
|
||||||
|
mPager.setAdapter(settingsPagerAdapter);
|
||||||
|
|
||||||
|
TabLayout tabLayout = findViewById(R.id.tabs);
|
||||||
|
|
||||||
|
switch(cryptoNetAccount.getCryptoNet()){
|
||||||
|
case BITSHARES:
|
||||||
|
tabLayout.addTab(tabLayout.newTab().setText("Bitshares"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
||||||
|
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
// Appbar animation
|
||||||
|
mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||||
|
@Override
|
||||||
|
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||||||
|
//Log.d(TAG,"surfaceCreated");
|
||||||
|
MediaPlayer mediaPlayer = MediaPlayer.create(CryptoNetAccountSettingsActivity.this, R.raw.appbar_background);
|
||||||
|
mediaPlayer.setDisplay(mSurfaceView.getHolder());
|
||||||
|
mediaPlayer.setLooping(true);
|
||||||
|
mediaPlayer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) {
|
||||||
|
//Log.d(TAG,"surfaceChanged");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
|
||||||
|
//Log.d(TAG,"surfaceDestroyed");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SettingsPagerAdapter extends FragmentStatePagerAdapter {
|
||||||
|
SettingsPagerAdapter(FragmentManager fm) {
|
||||||
|
super(fm);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Fragment getItem(int position) {
|
||||||
|
switch (position){
|
||||||
|
case 0:
|
||||||
|
return GeneralCryptoNetAccountSettingsFragment.newInstance(cryptoNetAccount.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cryptoNetAccount != null){
|
||||||
|
switch (cryptoNetAccount.getCryptoNet()){
|
||||||
|
case BITSHARES:
|
||||||
|
switch(position){
|
||||||
|
case 1:
|
||||||
|
return BitsharesSettingsFragment.newInstance(cryptoNetAccount.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
int tabCount = 1;
|
||||||
|
|
||||||
|
if (cryptoNetAccount != null){
|
||||||
|
switch (cryptoNetAccount.getCryptoNet()){
|
||||||
|
case BITSHARES:
|
||||||
|
tabCount = tabCount+1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tabCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnClick(R.id.ivGoBack)
|
||||||
|
public void goBack(){
|
||||||
|
onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
package cy.agorise.crystalwallet.dao;
|
package cy.agorise.crystalwallet.dao;
|
||||||
|
|
||||||
|
import android.arch.persistence.db.SupportSQLiteDatabase;
|
||||||
import android.arch.persistence.room.Database;
|
import android.arch.persistence.room.Database;
|
||||||
import android.arch.persistence.room.Room;
|
import android.arch.persistence.room.Room;
|
||||||
import android.arch.persistence.room.RoomDatabase;
|
import android.arch.persistence.room.RoomDatabase;
|
||||||
import android.arch.persistence.room.TypeConverters;
|
import android.arch.persistence.room.TypeConverters;
|
||||||
|
import android.arch.persistence.room.migration.Migration;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.dao.converters.Converters;
|
import cy.agorise.crystalwallet.dao.converters.Converters;
|
||||||
|
@ -36,7 +38,7 @@ import cy.agorise.crystalwallet.models.GrapheneAccountInfo;
|
||||||
BitsharesAssetInfo.class,
|
BitsharesAssetInfo.class,
|
||||||
CryptoCurrencyEquivalence.class,
|
CryptoCurrencyEquivalence.class,
|
||||||
GeneralSetting.class
|
GeneralSetting.class
|
||||||
}, version = 2)
|
}, version = 3)
|
||||||
@TypeConverters({Converters.class})
|
@TypeConverters({Converters.class})
|
||||||
public abstract class CrystalDatabase extends RoomDatabase {
|
public abstract class CrystalDatabase extends RoomDatabase {
|
||||||
|
|
||||||
|
@ -59,8 +61,16 @@ public abstract class CrystalDatabase extends RoomDatabase {
|
||||||
Room.databaseBuilder(context,
|
Room.databaseBuilder(context,
|
||||||
CrystalDatabase.class, "CrystalWallet.db")
|
CrystalDatabase.class, "CrystalWallet.db")
|
||||||
.allowMainThreadQueries()
|
.allowMainThreadQueries()
|
||||||
|
.addMigrations(MIGRATION_2_3)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static final Migration MIGRATION_2_3 = new Migration(2, 3) {
|
||||||
|
@Override
|
||||||
|
public void migrate(SupportSQLiteDatabase database) {
|
||||||
|
database.execSQL("ALTER TABLE graphene_account ADD COLUMN upgraded_to_ltm INTEGER NOT NULL DEFAULT 0");
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,152 @@
|
||||||
|
package cy.agorise.crystalwallet.fragments;
|
||||||
|
|
||||||
|
import android.arch.lifecycle.LiveData;
|
||||||
|
import android.arch.lifecycle.Observer;
|
||||||
|
import android.arch.lifecycle.ViewModelProviders;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.vincent.filepicker.Constant;
|
||||||
|
import com.vincent.filepicker.activity.AudioPickActivity;
|
||||||
|
import com.vincent.filepicker.filter.entity.AudioFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Currency;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.OnClick;
|
||||||
|
import butterknife.OnItemSelected;
|
||||||
|
import cy.agorise.crystalwallet.R;
|
||||||
|
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||||
|
import cy.agorise.crystalwallet.enums.Language;
|
||||||
|
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||||
|
import cy.agorise.crystalwallet.models.CryptoNetAccount;
|
||||||
|
import cy.agorise.crystalwallet.models.GeneralSetting;
|
||||||
|
import cy.agorise.crystalwallet.models.GrapheneAccount;
|
||||||
|
import cy.agorise.crystalwallet.models.GrapheneAccountInfo;
|
||||||
|
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
|
||||||
|
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
|
||||||
|
import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesLTMUpgradeRequest;
|
||||||
|
import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel;
|
||||||
|
import cy.agorise.crystalwallet.views.TimeZoneAdapter;
|
||||||
|
|
||||||
|
import static android.app.Activity.RESULT_OK;
|
||||||
|
import static com.vincent.filepicker.activity.AudioPickActivity.IS_NEED_RECORDER;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by xd on 12/28/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BitsharesSettingsFragment extends Fragment {
|
||||||
|
|
||||||
|
private GeneralSettingListViewModel generalSettingListViewModel;
|
||||||
|
private LiveData<List<GeneralSetting>> generalSettingListLiveData;
|
||||||
|
|
||||||
|
@BindView (R.id.tvUpgradeToLtm)
|
||||||
|
TextView tvUpgradeToLtm;
|
||||||
|
@BindView (R.id.btnUpgradeToLtm)
|
||||||
|
Button btnUpgradeToLtm;
|
||||||
|
@BindView (R.id.tvAlreadyLtm)
|
||||||
|
TextView tvAlreadyLtm;
|
||||||
|
|
||||||
|
CryptoNetAccount cryptoNetAccount;
|
||||||
|
GrapheneAccountInfo grapheneAccountInfo;
|
||||||
|
GrapheneAccount grapheneAccount;
|
||||||
|
|
||||||
|
public BitsharesSettingsFragment() {
|
||||||
|
if (getArguments() != null) {
|
||||||
|
long cryptoNetAcountId = getArguments().getLong("CRYPTO_NET_ACCOUNT_ID", -1);
|
||||||
|
|
||||||
|
if (cryptoNetAcountId > -1) {
|
||||||
|
this.cryptoNetAccount = CrystalDatabase.getAppDatabase(getContext()).cryptoNetAccountDao().getById(cryptoNetAcountId);
|
||||||
|
this.grapheneAccountInfo = CrystalDatabase.getAppDatabase(getContext()).grapheneAccountInfoDao().getByAccountId(this.cryptoNetAccount.getId());
|
||||||
|
this.grapheneAccount = new GrapheneAccount(this.cryptoNetAccount);
|
||||||
|
this.grapheneAccount.loadInfo(this.grapheneAccountInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BitsharesSettingsFragment newInstance(long cryptoNetAccountId) {
|
||||||
|
BitsharesSettingsFragment fragment = new BitsharesSettingsFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
fragment.setArguments(args);
|
||||||
|
|
||||||
|
if (cryptoNetAccountId > -1){
|
||||||
|
fragment.cryptoNetAccount = CrystalDatabase.getAppDatabase(fragment.getContext()).cryptoNetAccountDao().getById(cryptoNetAccountId);
|
||||||
|
fragment.grapheneAccountInfo = CrystalDatabase.getAppDatabase(fragment.getContext()).grapheneAccountInfoDao().getByAccountId(fragment.cryptoNetAccount.getId());
|
||||||
|
fragment.grapheneAccount = new GrapheneAccount(fragment.cryptoNetAccount);
|
||||||
|
fragment.grapheneAccount.loadInfo(fragment.grapheneAccountInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
View v = inflater.inflate(R.layout.fragment_bitshares_settings, container, false);
|
||||||
|
ButterKnife.bind(this, v);
|
||||||
|
|
||||||
|
initAlreadyLtm();
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnClick (R.id.btnUpgradeToLtm)
|
||||||
|
public void upgradeAccountToLtm(){
|
||||||
|
final ValidateBitsharesLTMUpgradeRequest request = new ValidateBitsharesLTMUpgradeRequest(this.getContext(),this.grapheneAccount);
|
||||||
|
|
||||||
|
request.setListener(new CryptoNetInfoRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onCarryOut() {
|
||||||
|
switch (request.getStatus()){
|
||||||
|
case SUCCEEDED:
|
||||||
|
tvUpgradeToLtm.setVisibility(View.GONE);
|
||||||
|
btnUpgradeToLtm.setVisibility(View.GONE);
|
||||||
|
tvAlreadyLtm.setVisibility(View.VISIBLE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
CryptoNetInfoRequests.getInstance().addRequest(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initAlreadyLtm(){
|
||||||
|
if (this.grapheneAccount.getUpgradedToLtm()){
|
||||||
|
tvUpgradeToLtm.setVisibility(View.GONE);
|
||||||
|
btnUpgradeToLtm.setVisibility(View.GONE);
|
||||||
|
tvAlreadyLtm.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
tvUpgradeToLtm.setVisibility(View.VISIBLE);
|
||||||
|
btnUpgradeToLtm.setVisibility(View.VISIBLE);
|
||||||
|
tvAlreadyLtm.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package cy.agorise.crystalwallet.fragments;
|
||||||
|
|
||||||
|
import android.arch.lifecycle.LiveData;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import cy.agorise.crystalwallet.R;
|
||||||
|
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||||
|
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||||
|
import cy.agorise.crystalwallet.models.CryptoNetAccount;
|
||||||
|
import cy.agorise.crystalwallet.models.GeneralSetting;
|
||||||
|
import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by xd on 12/28/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GeneralCryptoNetAccountSettingsFragment extends Fragment {
|
||||||
|
|
||||||
|
@BindView(R.id.tvMnemonic)
|
||||||
|
TextView tvMnemonic;
|
||||||
|
|
||||||
|
CryptoNetAccount cryptoNetAccount;
|
||||||
|
AccountSeed accountSeed;
|
||||||
|
|
||||||
|
public GeneralCryptoNetAccountSettingsFragment() {
|
||||||
|
|
||||||
|
if (getArguments() != null) {
|
||||||
|
long cryptoNetAcountId = getArguments().getLong("CRYPTO_NET_ACCOUNT_ID", -1);
|
||||||
|
|
||||||
|
if (cryptoNetAcountId > -1) {
|
||||||
|
this.cryptoNetAccount = CrystalDatabase.getAppDatabase(getContext()).cryptoNetAccountDao().getById(cryptoNetAcountId);
|
||||||
|
this.accountSeed = CrystalDatabase.getAppDatabase(getContext()).accountSeedDao().findById(this.cryptoNetAccount.getSeedId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GeneralCryptoNetAccountSettingsFragment newInstance(long cryptoNetAccountId) {
|
||||||
|
GeneralCryptoNetAccountSettingsFragment fragment = new GeneralCryptoNetAccountSettingsFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putLong("CRYPTO_NET_ACCOUNT_ID", cryptoNetAccountId);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
|
||||||
|
|
||||||
|
if (cryptoNetAccountId > -1){
|
||||||
|
fragment.cryptoNetAccount = CrystalDatabase.getAppDatabase(fragment.getContext()).cryptoNetAccountDao().getById(cryptoNetAccountId);
|
||||||
|
fragment.accountSeed = CrystalDatabase.getAppDatabase(fragment.getContext()).accountSeedDao().findById(fragment.cryptoNetAccount.getSeedId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
View v = inflater.inflate(R.layout.fragment_general_crypto_net_account_settings, container, false);
|
||||||
|
ButterKnife.bind(this, v);
|
||||||
|
|
||||||
|
initAlreadyLtm();
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initAlreadyLtm(){
|
||||||
|
if (this.cryptoNetAccount != null) {
|
||||||
|
tvMnemonic.setText(this.accountSeed.getMasterSeed());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,8 @@ import android.arch.persistence.room.ForeignKey;
|
||||||
import android.arch.persistence.room.Ignore;
|
import android.arch.persistence.room.Ignore;
|
||||||
import android.arch.persistence.room.Index;
|
import android.arch.persistence.room.Index;
|
||||||
import android.arch.persistence.room.PrimaryKey;
|
import android.arch.persistence.room.PrimaryKey;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v7.recyclerview.extensions.DiffCallback;
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.enums.CryptoNet;
|
import cy.agorise.crystalwallet.enums.CryptoNet;
|
||||||
|
|
||||||
|
@ -108,4 +110,31 @@ public class CryptoNetAccount {
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return this.getName();
|
return this.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final DiffCallback<CryptoNetAccount> DIFF_CALLBACK = new DiffCallback<CryptoNetAccount>() {
|
||||||
|
@Override
|
||||||
|
public boolean areItemsTheSame(
|
||||||
|
@NonNull CryptoNetAccount oldAccount, @NonNull CryptoNetAccount newAccount) {
|
||||||
|
return oldAccount.getId() == newAccount.getId();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean areContentsTheSame(
|
||||||
|
@NonNull CryptoNetAccount oldAccount, @NonNull CryptoNetAccount newAccount) {
|
||||||
|
return oldAccount.equals(newAccount);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
CryptoNetAccount that = (CryptoNetAccount) o;
|
||||||
|
|
||||||
|
if (mId != that.mId) return false;
|
||||||
|
if (mSeedId != that.mSeedId) return false;
|
||||||
|
if (mAccountIndex != that.mAccountIndex) return false;
|
||||||
|
if (mCryptoNet != that.mCryptoNet) return false;
|
||||||
|
return mName != null ? mName.equals(that.mName) : that.mName == null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class GrapheneAccount extends CryptoNetAccount {
|
||||||
public static int subclass = 1;
|
public static int subclass = 1;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected String accountId;
|
protected String accountId;
|
||||||
|
protected boolean upgradedToLtm;
|
||||||
|
|
||||||
public GrapheneAccount() {
|
public GrapheneAccount() {
|
||||||
}
|
}
|
||||||
|
@ -32,6 +33,7 @@ public class GrapheneAccount extends CryptoNetAccount {
|
||||||
public void loadInfo(GrapheneAccountInfo info){
|
public void loadInfo(GrapheneAccountInfo info){
|
||||||
this.name = info.getName();
|
this.name = info.getName();
|
||||||
this.accountId = info.getAccountId();
|
this.accountId = info.getAccountId();
|
||||||
|
this.upgradedToLtm = info.getUpgradedToLtm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -50,6 +52,14 @@ public class GrapheneAccount extends CryptoNetAccount {
|
||||||
this.accountId = accountId;
|
this.accountId = accountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getUpgradedToLtm() {
|
||||||
|
return this.upgradedToLtm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpgradedToLtm(boolean upgradedToLtm){
|
||||||
|
this.upgradedToLtm = upgradedToLtm;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the owner key, generates from the seed if it has not been generated. null if it can't be generated
|
* Return the owner key, generates from the seed if it has not been generated. null if it can't be generated
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -36,6 +36,12 @@ public class GrapheneAccountInfo {
|
||||||
@ColumnInfo(name = "account_id")
|
@ColumnInfo(name = "account_id")
|
||||||
protected String accountId;
|
protected String accountId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the bitshares account is upgraded to LTM
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "upgraded_to_ltm")
|
||||||
|
protected boolean upgradedToLtm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Baisc constructor
|
* Baisc constructor
|
||||||
* @param cryptoNetAccountId The database ud of the CryptoNetAccount
|
* @param cryptoNetAccountId The database ud of the CryptoNetAccount
|
||||||
|
@ -77,4 +83,12 @@ public class GrapheneAccountInfo {
|
||||||
public void setAccountId(String accountId) {
|
public void setAccountId(String accountId) {
|
||||||
this.accountId = accountId;
|
this.accountId = accountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getUpgradedToLtm(){
|
||||||
|
return this.upgradedToLtm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpgradedToLtm(boolean upgradedToLtm){
|
||||||
|
this.upgradedToLtm = upgradedToLtm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,4 +26,8 @@ public class CryptoNetAccountListViewModel extends AndroidViewModel {
|
||||||
public List<CryptoNetAccount> getCryptoNetAccountList(){
|
public List<CryptoNetAccount> getCryptoNetAccountList(){
|
||||||
return this.db.cryptoNetAccountDao().getAllCryptoNetAccount();
|
return this.db.cryptoNetAccountDao().getAllCryptoNetAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<List<CryptoNetAccount>> getCryptoNetAccounts(){
|
||||||
|
return this.db.cryptoNetAccountDao().getAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package cy.agorise.crystalwallet.views;
|
||||||
|
|
||||||
|
|
||||||
|
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.CryptoNetAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Henry Varona on 05/27/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CryptoNetAccountListAdapter extends ListAdapter<CryptoNetAccount, CryptoNetAccountViewHolder> {
|
||||||
|
|
||||||
|
public CryptoNetAccountListAdapter() {
|
||||||
|
super(CryptoNetAccount.DIFF_CALLBACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CryptoNetAccountViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.crypto_net_account_list_item,parent,false);
|
||||||
|
|
||||||
|
return new CryptoNetAccountViewHolder(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(CryptoNetAccountViewHolder holder, int position) {
|
||||||
|
CryptoNetAccount cryptoNetAccount = getItem(position);
|
||||||
|
if (cryptoNetAccount != null) {
|
||||||
|
holder.bindTo(cryptoNetAccount);
|
||||||
|
} else {
|
||||||
|
holder.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package cy.agorise.crystalwallet.views;
|
||||||
|
|
||||||
|
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.CryptoNetAccount;
|
||||||
|
import cy.agorise.crystalwallet.viewmodels.AccountSeedListViewModel;
|
||||||
|
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountListViewModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Henry Varona on 05/27/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CryptoNetAccountListView extends RelativeLayout {
|
||||||
|
|
||||||
|
LayoutInflater mInflater;
|
||||||
|
|
||||||
|
View rootView;
|
||||||
|
RecyclerView listView;
|
||||||
|
CryptoNetAccountListAdapter listAdapter;
|
||||||
|
|
||||||
|
CryptoNetAccountListViewModel cryptoNetAccountListViewModel;
|
||||||
|
|
||||||
|
public CryptoNetAccountListView(Context context){
|
||||||
|
super(context);
|
||||||
|
this.mInflater = LayoutInflater.from(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CryptoNetAccountListView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
this.mInflater = LayoutInflater.from(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CryptoNetAccountListView(Context context, AttributeSet attrs, int defStyle){
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
this.mInflater = LayoutInflater.from(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(){
|
||||||
|
rootView = mInflater.inflate(R.layout.crypto_net_account_list, this, true);
|
||||||
|
this.listView = rootView.findViewById(R.id.cryptoNetAccountListView);
|
||||||
|
|
||||||
|
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.getContext());
|
||||||
|
this.listView.setLayoutManager(linearLayoutManager);
|
||||||
|
this.listView.setNestedScrollingEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<CryptoNetAccount> data){
|
||||||
|
if (this.listAdapter == null) {
|
||||||
|
this.listAdapter = new CryptoNetAccountListAdapter();
|
||||||
|
this.listView.setAdapter(this.listAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data != null) {
|
||||||
|
this.listAdapter.setList(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package cy.agorise.crystalwallet.views;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import cy.agorise.crystalwallet.R;
|
||||||
|
import cy.agorise.crystalwallet.activities.BackupSeedActivity;
|
||||||
|
import cy.agorise.crystalwallet.activities.CryptoNetAccountSettingsActivity;
|
||||||
|
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||||
|
import cy.agorise.crystalwallet.models.CryptoNetAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Henry Varona on 17/9/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CryptoNetAccountViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private TextView tvCryptoNetAccountName;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
public CryptoNetAccountViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
tvCryptoNetAccountName = (TextView) itemView.findViewById(R.id.tvCryptoNetAccountName);
|
||||||
|
context = itemView.getContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear(){
|
||||||
|
tvCryptoNetAccountName.setText("loading...");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bindTo(final CryptoNetAccount cryptoNetAccount) {
|
||||||
|
if (cryptoNetAccount == null){
|
||||||
|
tvCryptoNetAccountName.setText("loading...");
|
||||||
|
} else {
|
||||||
|
tvCryptoNetAccountName.setText(cryptoNetAccount.getName());
|
||||||
|
|
||||||
|
tvCryptoNetAccountName.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent intent = new Intent(context, CryptoNetAccountSettingsActivity.class);
|
||||||
|
intent.putExtra("CRYPTO_NET_ACCOUNT_ID", cryptoNetAccount.getId());
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -100,8 +100,8 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/secondView" />
|
app:layout_constraintTop_toBottomOf="@id/secondView" />
|
||||||
-->
|
-->
|
||||||
<cy.agorise.crystalwallet.views.AccountSeedListView
|
<cy.agorise.crystalwallet.views.CryptoNetAccountListView
|
||||||
android:id="@+id/vAccountSeedList"
|
android:id="@+id/vAccountList"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="250dp"
|
android:layout_height="250dp"
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
|
@ -118,10 +118,10 @@
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/vAccountSeedList"
|
app:layout_constraintBottom_toBottomOf="@id/vAccountList"
|
||||||
app:layout_constraintEnd_toEndOf="@id/vAccountSeedList"
|
app:layout_constraintEnd_toEndOf="@id/vAccountList"
|
||||||
app:layout_constraintStart_toStartOf="@id/vAccountSeedList"
|
app:layout_constraintStart_toStartOf="@id/vAccountList"
|
||||||
app:layout_constraintTop_toTopOf="@id/vAccountSeedList" />
|
app:layout_constraintTop_toTopOf="@id/vAccountList" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/forthView"
|
android:id="@+id/forthView"
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
android:background="@color/lightGray"
|
android:background="@color/lightGray"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/vAccountSeedList" />
|
app:layout_constraintTop_toBottomOf="@id/vAccountList" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/ivSettings"
|
android:id="@+id/ivSettings"
|
||||||
|
|
119
app/src/main/res/layout/crypto_net_account_activity_settings.xml
Normal file
119
app/src/main/res/layout/crypto_net_account_activity_settings.xml
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.design.widget.CoordinatorLayout
|
||||||
|
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:id="@+id/main_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activities.CryptoNetAccountSettingsActivity">
|
||||||
|
|
||||||
|
<android.support.design.widget.AppBarLayout
|
||||||
|
android:id="@+id/appbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
app:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<SurfaceView
|
||||||
|
android:id="@+id/surface_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/colorPrimaryTransparent"/>
|
||||||
|
|
||||||
|
<android.support.v7.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="@color/transparent"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
app:popupTheme="@style/AppTheme.PopupOverlay">
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivGoBack"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
app:srcCompat="@drawable/ic_arrow_back"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:contentDescription="@string/go_back_arrow" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:text="Account Settings"
|
||||||
|
android:textColor="@color/gray"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/ivGoBack"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivInfo"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
app:srcCompat="@drawable/ic_info_outline"
|
||||||
|
android:contentDescription="@string/info_icon"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
</android.support.v7.widget.Toolbar>
|
||||||
|
|
||||||
|
<android.support.design.widget.TabLayout
|
||||||
|
android:id="@+id/tabs"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:animateLayoutChanges="true">
|
||||||
|
|
||||||
|
<android.support.design.widget.TabItem
|
||||||
|
android:id="@+id/tabItem"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/general" />
|
||||||
|
</android.support.design.widget.TabLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
|
<android.support.v4.view.ViewPager
|
||||||
|
android:id="@+id/pager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_above="@id/bottomStatusBar"/>
|
||||||
|
|
||||||
|
<cy.agorise.crystalwallet.util.BottomStatusBar
|
||||||
|
android:id="@+id/bottomStatusBar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</android.support.design.widget.CoordinatorLayout>
|
13
app/src/main/res/layout/crypto_net_account_list.xml
Normal file
13
app/src/main/res/layout/crypto_net_account_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/cryptoNetAccountListView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
24
app/src/main/res/layout/crypto_net_account_list_item.xml
Normal file
24
app/src/main/res/layout/crypto_net_account_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/tvCryptoNetAccountName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="text"
|
||||||
|
android:text="name of the account" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
48
app/src/main/res/layout/fragment_bitshares_settings.xml
Normal file
48
app/src/main/res/layout/fragment_bitshares_settings.xml
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="20dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvUpgradeToLtm"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:text="Upgrade to LTM"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnUpgradeToLtm"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:text="Upgrade"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/tvUpgradeToLtm"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tvUpgradeToLtm" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvAlreadyLtm"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="Already upgraded to LTM"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btnUpgradeToLtm" />
|
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?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:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="0dp"
|
||||||
|
android:paddingLeft="0dp"
|
||||||
|
android:paddingRight="0dp"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvMnemonicTitle"
|
||||||
|
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:layout_marginTop="10dp"
|
||||||
|
android:text="@string/seed_words"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvMnemonic"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:background="@drawable/edittext_bg"
|
||||||
|
android:inputType="number"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@color/black" />
|
||||||
|
</LinearLayout>
|
Loading…
Reference in a new issue