Merge pull request #6 from davidtadeovargas/feat_ui_improvements
Feat ui improvements
This commit is contained in:
commit
c3bd0a5f53
70 changed files with 3490 additions and 395 deletions
|
@ -1,5 +1,13 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
kapt {
|
||||
generateStubs = true
|
||||
javacOptions {
|
||||
option("-Xmaxerrs", 500)
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
|
@ -40,19 +48,24 @@ android {
|
|||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
//androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
//androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
implementation 'com.jaredrummler:material-spinner:1.2.5'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
||||
//testCompile 'com.android.support.test:runner:1.0.1'
|
||||
implementation 'com.afollestad.material-dialogs:core:0.9.6.0' //DTVV Thrusday 31 July 2018
|
||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||
implementation 'com.github.bumptech.glide:glide:4.7.1'
|
||||
// Glide v4 uses this new annotation processor -- see https://bumptech.github.io/glide/doc/generatedapi.html
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
|
||||
implementation 'com.android.support:support-v4:27.1.1'
|
||||
implementation 'com.android.support:design:27.1.1'
|
||||
implementation 'com.android.support:cardview-v7:27.1.1'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
||||
implementation 'android.arch.lifecycle:runtime:1.1.1'
|
||||
implementation 'android.arch.lifecycle:extensions:1.1.1'
|
||||
implementation 'android.arch.persistence.room:runtime:1.1.0'
|
||||
implementation 'android.arch.paging:runtime:1.0.0'
|
||||
implementation 'com.idescout.sql:sqlscout-server:2.0'
|
||||
implementation 'com.google.code.gson:gson:2.8.0'
|
||||
|
@ -72,8 +85,15 @@ dependencies {
|
|||
|
||||
//testCompile 'junit:junit: 4.12'
|
||||
testImplementation 'org.mockito:mockito-core:1.10.19'
|
||||
implementation 'android.arch.persistence.room:runtime:1.1.0'
|
||||
|
||||
kapt 'android.arch.persistence.room:runtime:1.1.0'
|
||||
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
|
||||
kapt 'android.arch.lifecycle:compiler:1.1.1'
|
||||
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
|
||||
kapt 'android.arch.persistence.room:compiler:1.1.0'
|
||||
annotationProcessor 'android.arch.persistence.room:compiler:1.1.0'
|
||||
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
|
||||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
|
||||
|
||||
implementation 'com.squareup.picasso:picasso:2.5.2'
|
||||
|
|
704
app/schemas/cy.agorise.crystalwallet.dao.CrystalDatabase/3.json
Normal file
704
app/schemas/cy.agorise.crystalwallet.dao.CrystalDatabase/3.json
Normal file
|
@ -0,0 +1,704 @@
|
|||
{
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 3,
|
||||
"identityHash": "5aa4eae5c7cf7e77a2ebc1d7a9dc7070",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "account_seed",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT, `master_seed` TEXT, `type` TEXT)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "mId",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mName",
|
||||
"columnName": "name",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "mMasterSeed",
|
||||
"columnName": "master_seed",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "type",
|
||||
"columnName": "type",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
},
|
||||
{
|
||||
"tableName": "crypto_net_account",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `seed_id` INTEGER NOT NULL, `account_index` INTEGER NOT NULL, `crypto_net` TEXT, `name` TEXT, FOREIGN KEY(`seed_id`) REFERENCES `account_seed`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "mId",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mSeedId",
|
||||
"columnName": "seed_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mAccountIndex",
|
||||
"columnName": "account_index",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mCryptoNet",
|
||||
"columnName": "crypto_net",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "mName",
|
||||
"columnName": "name",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
"name": "index_crypto_net_account_id",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"createSql": "CREATE INDEX `index_crypto_net_account_id` ON `${TABLE_NAME}` (`id`)"
|
||||
},
|
||||
{
|
||||
"name": "index_crypto_net_account_seed_id",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"seed_id"
|
||||
],
|
||||
"createSql": "CREATE INDEX `index_crypto_net_account_seed_id` ON `${TABLE_NAME}` (`seed_id`)"
|
||||
},
|
||||
{
|
||||
"name": "index_crypto_net_account_seed_id_crypto_net_account_index",
|
||||
"unique": true,
|
||||
"columnNames": [
|
||||
"seed_id",
|
||||
"crypto_net",
|
||||
"account_index"
|
||||
],
|
||||
"createSql": "CREATE UNIQUE INDEX `index_crypto_net_account_seed_id_crypto_net_account_index` ON `${TABLE_NAME}` (`seed_id`, `crypto_net`, `account_index`)"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"table": "account_seed",
|
||||
"onDelete": "NO ACTION",
|
||||
"onUpdate": "NO ACTION",
|
||||
"columns": [
|
||||
"seed_id"
|
||||
],
|
||||
"referencedColumns": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tableName": "crypto_coin_transaction",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `date` INTEGER, `is_input` INTEGER NOT NULL, `account_id` INTEGER NOT NULL, `amount` INTEGER NOT NULL, `id_currency` INTEGER NOT NULL, `is_confirmed` INTEGER NOT NULL, `from` TEXT, `to` TEXT, FOREIGN KEY(`account_id`) REFERENCES `crypto_net_account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`id_currency`) REFERENCES `crypto_currency`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "date",
|
||||
"columnName": "date",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "isInput",
|
||||
"columnName": "is_input",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "accountId",
|
||||
"columnName": "account_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "amount",
|
||||
"columnName": "amount",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "idCurrency",
|
||||
"columnName": "id_currency",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "isConfirmed",
|
||||
"columnName": "is_confirmed",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "from",
|
||||
"columnName": "from",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "to",
|
||||
"columnName": "to",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
"name": "index_crypto_coin_transaction_account_id",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"account_id"
|
||||
],
|
||||
"createSql": "CREATE INDEX `index_crypto_coin_transaction_account_id` ON `${TABLE_NAME}` (`account_id`)"
|
||||
},
|
||||
{
|
||||
"name": "index_crypto_coin_transaction_id_currency",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"id_currency"
|
||||
],
|
||||
"createSql": "CREATE INDEX `index_crypto_coin_transaction_id_currency` ON `${TABLE_NAME}` (`id_currency`)"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"table": "crypto_net_account",
|
||||
"onDelete": "CASCADE",
|
||||
"onUpdate": "NO ACTION",
|
||||
"columns": [
|
||||
"account_id"
|
||||
],
|
||||
"referencedColumns": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"table": "crypto_currency",
|
||||
"onDelete": "CASCADE",
|
||||
"onUpdate": "NO ACTION",
|
||||
"columns": [
|
||||
"id_currency"
|
||||
],
|
||||
"referencedColumns": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tableName": "contact",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT, `email` TEXT, `gravatar` TEXT)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "mId",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mName",
|
||||
"columnName": "name",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "mEmail",
|
||||
"columnName": "email",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "mGravatar",
|
||||
"columnName": "gravatar",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
"name": "index_contact_id",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"createSql": "CREATE INDEX `index_contact_id` ON `${TABLE_NAME}` (`id`)"
|
||||
},
|
||||
{
|
||||
"name": "index_contact_name",
|
||||
"unique": true,
|
||||
"columnNames": [
|
||||
"name"
|
||||
],
|
||||
"createSql": "CREATE UNIQUE INDEX `index_contact_name` ON `${TABLE_NAME}` (`name`)"
|
||||
},
|
||||
{
|
||||
"name": "index_contact_email",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"email"
|
||||
],
|
||||
"createSql": "CREATE INDEX `index_contact_email` ON `${TABLE_NAME}` (`email`)"
|
||||
}
|
||||
],
|
||||
"foreignKeys": []
|
||||
},
|
||||
{
|
||||
"tableName": "contact_address",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `contact_id` INTEGER NOT NULL, `crypto_net` TEXT NOT NULL, `address` TEXT)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "mId",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mContactId",
|
||||
"columnName": "contact_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mCryptoNet",
|
||||
"columnName": "crypto_net",
|
||||
"affinity": "TEXT",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mAddress",
|
||||
"columnName": "address",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
"name": "index_contact_address_id",
|
||||
"unique": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"createSql": "CREATE UNIQUE INDEX `index_contact_address_id` ON `${TABLE_NAME}` (`id`)"
|
||||
},
|
||||
{
|
||||
"name": "index_contact_address_contact_id_crypto_net",
|
||||
"unique": true,
|
||||
"columnNames": [
|
||||
"contact_id",
|
||||
"crypto_net"
|
||||
],
|
||||
"createSql": "CREATE UNIQUE INDEX `index_contact_address_contact_id_crypto_net` ON `${TABLE_NAME}` (`contact_id`, `crypto_net`)"
|
||||
}
|
||||
],
|
||||
"foreignKeys": []
|
||||
},
|
||||
{
|
||||
"tableName": "crypto_currency",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT, `crypto_net` TEXT, `precision` INTEGER NOT NULL)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "mId",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mName",
|
||||
"columnName": "name",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "mCryptoNet",
|
||||
"columnName": "crypto_net",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "mPrecision",
|
||||
"columnName": "precision",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
"name": "index_crypto_currency_crypto_net_name",
|
||||
"unique": true,
|
||||
"columnNames": [
|
||||
"crypto_net",
|
||||
"name"
|
||||
],
|
||||
"createSql": "CREATE UNIQUE INDEX `index_crypto_currency_crypto_net_name` ON `${TABLE_NAME}` (`crypto_net`, `name`)"
|
||||
}
|
||||
],
|
||||
"foreignKeys": []
|
||||
},
|
||||
{
|
||||
"tableName": "crypto_coin_balance",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `account_id` INTEGER NOT NULL, `crypto_currency_id` INTEGER NOT NULL, `balance` INTEGER NOT NULL, FOREIGN KEY(`account_id`) REFERENCES `crypto_net_account`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "mId",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mAccountId",
|
||||
"columnName": "account_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mCryptoCurrencyId",
|
||||
"columnName": "crypto_currency_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mBalance",
|
||||
"columnName": "balance",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
"name": "index_crypto_coin_balance_id",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"createSql": "CREATE INDEX `index_crypto_coin_balance_id` ON `${TABLE_NAME}` (`id`)"
|
||||
},
|
||||
{
|
||||
"name": "index_crypto_coin_balance_account_id",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"account_id"
|
||||
],
|
||||
"createSql": "CREATE INDEX `index_crypto_coin_balance_account_id` ON `${TABLE_NAME}` (`account_id`)"
|
||||
},
|
||||
{
|
||||
"name": "index_crypto_coin_balance_account_id_crypto_currency_id",
|
||||
"unique": true,
|
||||
"columnNames": [
|
||||
"account_id",
|
||||
"crypto_currency_id"
|
||||
],
|
||||
"createSql": "CREATE UNIQUE INDEX `index_crypto_coin_balance_account_id_crypto_currency_id` ON `${TABLE_NAME}` (`account_id`, `crypto_currency_id`)"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"table": "crypto_net_account",
|
||||
"onDelete": "NO ACTION",
|
||||
"onUpdate": "NO ACTION",
|
||||
"columns": [
|
||||
"account_id"
|
||||
],
|
||||
"referencedColumns": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tableName": "graphene_account",
|
||||
"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": [
|
||||
{
|
||||
"fieldPath": "cryptoNetAccountId",
|
||||
"columnName": "crypto_net_account_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "name",
|
||||
"columnName": "account_name",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "accountId",
|
||||
"columnName": "account_id",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "upgradedToLtm",
|
||||
"columnName": "upgraded_to_ltm",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"crypto_net_account_id"
|
||||
],
|
||||
"autoGenerate": false
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"table": "crypto_net_account",
|
||||
"onDelete": "NO ACTION",
|
||||
"onUpdate": "NO ACTION",
|
||||
"columns": [
|
||||
"crypto_net_account_id"
|
||||
],
|
||||
"referencedColumns": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tableName": "bitshares_asset",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`crypto_curreny_id` INTEGER NOT NULL, `bitshares_id` TEXT, `asset_type` TEXT, PRIMARY KEY(`crypto_curreny_id`), FOREIGN KEY(`crypto_curreny_id`) REFERENCES `crypto_currency`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "cryptoCurrencyId",
|
||||
"columnName": "crypto_curreny_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "bitsharesId",
|
||||
"columnName": "bitshares_id",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "assetType",
|
||||
"columnName": "asset_type",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"crypto_curreny_id"
|
||||
],
|
||||
"autoGenerate": false
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"table": "crypto_currency",
|
||||
"onDelete": "NO ACTION",
|
||||
"onUpdate": "NO ACTION",
|
||||
"columns": [
|
||||
"crypto_curreny_id"
|
||||
],
|
||||
"referencedColumns": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tableName": "crypto_currency_equivalence",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `from_crypto_currency_id` INTEGER NOT NULL, `to_crypto_currency_id` INTEGER NOT NULL, `value` INTEGER NOT NULL, `last_checked` INTEGER, FOREIGN KEY(`from_crypto_currency_id`) REFERENCES `crypto_currency`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`to_crypto_currency_id`) REFERENCES `crypto_currency`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "fromCurrencyId",
|
||||
"columnName": "from_crypto_currency_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "toCurrencyId",
|
||||
"columnName": "to_crypto_currency_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "value",
|
||||
"columnName": "value",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "lastChecked",
|
||||
"columnName": "last_checked",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
"name": "index_crypto_currency_equivalence_from_crypto_currency_id_to_crypto_currency_id",
|
||||
"unique": true,
|
||||
"columnNames": [
|
||||
"from_crypto_currency_id",
|
||||
"to_crypto_currency_id"
|
||||
],
|
||||
"createSql": "CREATE UNIQUE INDEX `index_crypto_currency_equivalence_from_crypto_currency_id_to_crypto_currency_id` ON `${TABLE_NAME}` (`from_crypto_currency_id`, `to_crypto_currency_id`)"
|
||||
},
|
||||
{
|
||||
"name": "index_crypto_currency_equivalence_from_crypto_currency_id",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"from_crypto_currency_id"
|
||||
],
|
||||
"createSql": "CREATE INDEX `index_crypto_currency_equivalence_from_crypto_currency_id` ON `${TABLE_NAME}` (`from_crypto_currency_id`)"
|
||||
},
|
||||
{
|
||||
"name": "index_crypto_currency_equivalence_to_crypto_currency_id",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"to_crypto_currency_id"
|
||||
],
|
||||
"createSql": "CREATE INDEX `index_crypto_currency_equivalence_to_crypto_currency_id` ON `${TABLE_NAME}` (`to_crypto_currency_id`)"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"table": "crypto_currency",
|
||||
"onDelete": "CASCADE",
|
||||
"onUpdate": "NO ACTION",
|
||||
"columns": [
|
||||
"from_crypto_currency_id"
|
||||
],
|
||||
"referencedColumns": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"table": "crypto_currency",
|
||||
"onDelete": "CASCADE",
|
||||
"onUpdate": "NO ACTION",
|
||||
"columns": [
|
||||
"to_crypto_currency_id"
|
||||
],
|
||||
"referencedColumns": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tableName": "general_setting",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT, `value` TEXT)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "mId",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "mName",
|
||||
"columnName": "name",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "mValue",
|
||||
"columnName": "value",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
}
|
||||
],
|
||||
"setupQueries": [
|
||||
"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, \"5aa4eae5c7cf7e77a2ebc1d7a9dc7070\")"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -31,13 +31,15 @@
|
|||
<activity android:name=".activities.BoardActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar" >
|
||||
</activity>
|
||||
<activity android:name=".activities.CreateSeedActivity" >
|
||||
</activity>
|
||||
<activity android:name=".activities.LoadingActivity"
|
||||
android:theme="@style/ActivityDialog">
|
||||
</activity>
|
||||
<activity android:name=".activities.AccountSeedsManagementActivity" >
|
||||
</activity>
|
||||
<activity android:name=".activities.ImportSeedActivity" >
|
||||
</activity>
|
||||
<activity android:name=".activities.CreateSeedActivity"
|
||||
android:noHistory="true">
|
||||
</activity>
|
||||
<activity android:name=".activities.SendTransactionActivity" >
|
||||
</activity>
|
||||
<activity android:name=".activities.GeneralSettingsActivity" >
|
||||
|
@ -100,6 +102,22 @@
|
|||
|
||||
<activity android:name=".activities.CreateContactActivity">
|
||||
</activity>
|
||||
|
||||
|
||||
<!--Test activities-->
|
||||
<activity android:name=".tests.activities.dialogs.Test_DialogMaterialActivity">
|
||||
</activity>
|
||||
<activity android:name=".tests.activities.dialogs.Test_LoadingActivity">
|
||||
</activity>
|
||||
<activity android:name=".tests.activities.dialogs.Test_CrystalDialogActivity">
|
||||
</activity>
|
||||
<activity android:name=".tests.activities.dialogs.Test_GIFActivity">
|
||||
</activity>
|
||||
<activity android:name=".tests.activities.dialogs.Test_ToastActivity">
|
||||
</activity>
|
||||
<activity android:name=".tests.activities.dialogs.Test_VideoActivity">
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -3,12 +3,16 @@ package cy.agorise.crystalwallet.activities;
|
|||
import android.arch.lifecycle.LiveData;
|
||||
import android.arch.lifecycle.Observer;
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
@ -17,19 +21,28 @@ import cy.agorise.crystalwallet.R;
|
|||
import cy.agorise.crystalwallet.models.AccountSeed;
|
||||
import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel;
|
||||
|
||||
//tvBrainKey
|
||||
public class BackupSeedActivity extends AppCompatActivity {
|
||||
|
||||
AccountSeedViewModel accountSeedViewModel;
|
||||
|
||||
@BindView(R.id.tvMnemonic)
|
||||
TextView tvMnemonic;
|
||||
@BindView(R.id.tvBrainKey)
|
||||
TextView textfieldBrainkey;
|
||||
@BindView(R.id.btnOk)
|
||||
Button btnOk;
|
||||
@BindView(R.id.btnCopy)
|
||||
Button btnCopy;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.backup_seed);
|
||||
|
||||
//Note: Test porpouses
|
||||
/*final TextView textView = findViewById(R.id.tvBrainKey);
|
||||
textView.setText("sakk902909321o p3k21kldsa0'dsa90'e930eidakdñsakdñlsakdi90i03 2i90idopsasakk902909321op3k21 kldsa0'dsa90'e930eid akdñsakdñlsakdi90i032i90idopsa");
|
||||
*/
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
long seedId = getIntent().getLongExtra("SEED_ID",-1);
|
||||
|
@ -41,7 +54,7 @@ public class BackupSeedActivity extends AppCompatActivity {
|
|||
liveDataAccountSeed.observe(this, new Observer<AccountSeed>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable AccountSeed accountSeed) {
|
||||
tvMnemonic.setText(accountSeed.getMasterSeed());
|
||||
textfieldBrainkey.setText(accountSeed.getMasterSeed());
|
||||
}
|
||||
});
|
||||
accountSeedViewModel.loadSeed(seedId);
|
||||
|
@ -56,4 +69,23 @@ public class BackupSeedActivity extends AppCompatActivity {
|
|||
Intent intent = new Intent(this, IntroActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clic on button copy to clipboard
|
||||
* */
|
||||
@OnClick(R.id.btnCopy)
|
||||
public void btnCopyClick(){
|
||||
|
||||
/*
|
||||
* Save to clipboard the brainkey chain
|
||||
* */
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText(textfieldBrainkey.getText(), textfieldBrainkey.getText().toString());
|
||||
clipboard.setPrimaryClip(clip);
|
||||
|
||||
/*
|
||||
* Success message
|
||||
* */
|
||||
Toast.makeText(this.getBaseContext(),getResources().getString(R.string.window_seed_toast_clipboard), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import android.content.Intent;
|
|||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
|
@ -17,16 +19,22 @@ import android.support.v4.app.FragmentManager;
|
|||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Pair;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sjaramillo10.animatedtablayout.AnimatedTabLayout;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
@ -39,6 +47,7 @@ import cy.agorise.crystalwallet.fragments.ContactsFragment;
|
|||
import cy.agorise.crystalwallet.fragments.ReceiveTransactionFragment;
|
||||
import cy.agorise.crystalwallet.fragments.SendTransactionFragment;
|
||||
import cy.agorise.crystalwallet.fragments.TransactionsFragment;
|
||||
import cy.agorise.crystalwallet.views.natives.GIFView;
|
||||
import de.hdodenhof.circleimageview.CircleImageView;
|
||||
import cy.agorise.crystalwallet.viewmodels.CryptoNetBalanceListViewModel;
|
||||
|
||||
|
@ -47,7 +56,7 @@ import cy.agorise.crystalwallet.viewmodels.CryptoNetBalanceListViewModel;
|
|||
*
|
||||
*/
|
||||
|
||||
public class BoardActivity extends AppCompatActivity {
|
||||
public class BoardActivity extends CustomActivity {
|
||||
|
||||
@BindView(R.id.tabLayout)
|
||||
public TabLayout tabLayout;
|
||||
|
@ -64,6 +73,9 @@ public class BoardActivity extends AppCompatActivity {
|
|||
@BindView(R.id.fabAddContact)
|
||||
public FloatingActionButton fabAddContact;
|
||||
|
||||
@BindView(R.id.imagevieGIF)
|
||||
public GIFView imagevieGIF;
|
||||
|
||||
public BoardPagerAdapter boardAdapter;
|
||||
|
||||
/*
|
||||
|
@ -98,6 +110,61 @@ public class BoardActivity extends AppCompatActivity {
|
|||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
/*
|
||||
* Set the bubbles animation
|
||||
* */
|
||||
imagevieGIF.centerCrop();
|
||||
imagevieGIF.load(R.raw.burbujas);
|
||||
|
||||
/*
|
||||
* Listener tabLayout to resalt text when clicked
|
||||
* */
|
||||
final TabLayout tabLayoutFinal = tabLayout;
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(final TabLayout.Tab tab) {
|
||||
|
||||
globalActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
LinearLayout tabLayout = (LinearLayout)((ViewGroup) tabLayoutFinal.getChildAt(0)).getChildAt(tab.getPosition());
|
||||
tabLayout.setBackgroundColor(Color.TRANSPARENT);
|
||||
TextView tabTextView = (TextView) tabLayout.getChildAt(1);
|
||||
//tabTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP ,50);
|
||||
Spannable WordtoSpan = new SpannableString(tabTextView.getText());
|
||||
WordtoSpan.setSpan(new ForegroundColorSpan(Color.WHITE), 0, tabTextView.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
tabTextView.setText(WordtoSpan);
|
||||
tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.BOLD);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(final TabLayout.Tab tab) {
|
||||
|
||||
globalActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
LinearLayout tabLayout = (LinearLayout)((ViewGroup) tabLayoutFinal.getChildAt(0)).getChildAt(tab.getPosition());
|
||||
TextView tabTextView = (TextView) tabLayout.getChildAt(1);
|
||||
//tabTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP ,50);
|
||||
Spannable WordtoSpan = new SpannableString(tabTextView.getText());
|
||||
WordtoSpan.setSpan(new ForegroundColorSpan(globalActivity.getResources().getColor(R.color.lightGrayClear)), 0, tabTextView.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
tabTextView.setText(WordtoSpan);
|
||||
tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.NORMAL);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// Appbar animation
|
||||
mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||
@Override
|
||||
|
|
|
@ -1,204 +0,0 @@
|
|||
package cy.agorise.crystalwallet.activities;
|
||||
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TextInputEditText;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Editable;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import butterknife.OnTextChanged;
|
||||
import cy.agorise.crystalwallet.R;
|
||||
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
|
||||
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
|
||||
import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest;
|
||||
import cy.agorise.crystalwallet.models.GrapheneAccount;
|
||||
import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel;
|
||||
import cy.agorise.crystalwallet.viewmodels.validators.CreateSeedValidator;
|
||||
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
|
||||
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
|
||||
|
||||
public class CreateSeedActivity extends AppCompatActivity implements UIValidatorListener {
|
||||
|
||||
AccountSeedViewModel accountSeedViewModel;
|
||||
CreateSeedValidator createSeedValidator;
|
||||
|
||||
@BindView(R.id.tilPin)
|
||||
TextInputLayout tilPin;
|
||||
|
||||
@BindView(R.id.tietPin)
|
||||
TextInputEditText tietPin;
|
||||
|
||||
@BindView(R.id.tilPinConfirmation)
|
||||
TextInputLayout tilPinConfirmation;
|
||||
|
||||
@BindView(R.id.tietPinConfirmation)
|
||||
TextInputEditText tietPinConfirmation;
|
||||
|
||||
//@BindView(R.id.tvSeedWords)
|
||||
//TextView tvSeedWords;
|
||||
|
||||
@BindView(R.id.tilAccountName)
|
||||
TextInputLayout tilAccountName;
|
||||
|
||||
@BindView (R.id.tietAccountName)
|
||||
TextInputEditText tietAccountName;
|
||||
|
||||
@BindView(R.id.btnCreate)
|
||||
Button btnCreate;
|
||||
|
||||
@BindView(R.id.btnCancel)
|
||||
Button btnCancel;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.create_seed);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
tilPin.setErrorEnabled(true);
|
||||
tilPinConfirmation.setErrorEnabled(true);
|
||||
tilAccountName.setErrorEnabled(true);
|
||||
|
||||
btnCreate.setEnabled(false);
|
||||
accountSeedViewModel = ViewModelProviders.of(this).get(AccountSeedViewModel.class);
|
||||
createSeedValidator = new CreateSeedValidator(this.getApplicationContext(),tietPin,tietPinConfirmation,tietAccountName);
|
||||
createSeedValidator.setListener(this);
|
||||
}
|
||||
|
||||
@OnTextChanged(value = R.id.tietPin,
|
||||
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
||||
void afterPinChanged(Editable editable) {
|
||||
this.createSeedValidator.validate();
|
||||
}
|
||||
|
||||
@OnTextChanged(value = R.id.tietPinConfirmation,
|
||||
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
||||
void afterPinConfirmationChanged(Editable editable) {
|
||||
this.createSeedValidator.validate();
|
||||
}
|
||||
|
||||
/*@OnTextChanged(value = R.id.etSeedWords,
|
||||
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
||||
void afterSeedWordsChanged(Editable editable) {
|
||||
this.createSeedValidator.validate();
|
||||
}
|
||||
*/
|
||||
|
||||
@OnTextChanged(value = R.id.tietAccountName,
|
||||
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
||||
void afterAccountNameChanged(Editable editable) {
|
||||
this.createSeedValidator.validate();
|
||||
}
|
||||
|
||||
@OnClick(R.id.btnCancel)
|
||||
public void cancel(){
|
||||
this.finish();
|
||||
}
|
||||
|
||||
@OnClick(R.id.btnCreate)
|
||||
public void createSeed(){
|
||||
if (this.createSeedValidator.isValid()) {
|
||||
// Make request to create a bitshare account
|
||||
final ValidateCreateBitsharesAccountRequest request =
|
||||
new ValidateCreateBitsharesAccountRequest(tietAccountName.getText().toString(), getApplicationContext());
|
||||
|
||||
|
||||
//Makes dialog to tell the user that the account is been created
|
||||
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(CreateSeedActivity.this,R.style.AppTheme);
|
||||
alertBuilder.setView(R.layout.progress_creating_account);
|
||||
//alertBuilder.setTitle("Processing");
|
||||
//alertBuilder.setMessage("Creating Bitshares Account");
|
||||
final AlertDialog processDialog = alertBuilder.create();
|
||||
CreateSeedActivity.this.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
processDialog.setCancelable(false);
|
||||
processDialog.show();
|
||||
processDialog.getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
});
|
||||
|
||||
request.setListener(new CryptoNetInfoRequestListener() {
|
||||
@Override
|
||||
public void onCarryOut() {
|
||||
processDialog.dismiss();
|
||||
if (request.getStatus().equals(ValidateCreateBitsharesAccountRequest.StatusCode.SUCCEEDED)) {
|
||||
GrapheneAccount accountSeed = request.getAccount();
|
||||
Intent intent = new Intent(getApplicationContext(), BackupSeedActivity.class);
|
||||
intent.putExtra("SEED_ID", accountSeed.getId());
|
||||
startActivity(intent);
|
||||
} else {
|
||||
createSeedValidator.validate();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Thread thread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
CryptoNetInfoRequests.getInstance().addRequest(request);
|
||||
}
|
||||
};
|
||||
|
||||
thread.start();
|
||||
|
||||
|
||||
|
||||
//this.finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValidationSucceeded(final ValidationField field) {
|
||||
final CreateSeedActivity activity = this;
|
||||
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
if (field.getView() == tietPin) {
|
||||
tilPin.setError("");
|
||||
} else if (field.getView() == tietPinConfirmation){
|
||||
tilPinConfirmation.setError("");
|
||||
} else if (field.getView() == tietAccountName){
|
||||
tilAccountName.setError("");
|
||||
} //else if (field.getView() == etSeedWords){
|
||||
// tvSeedWordsError.setText("");
|
||||
//}
|
||||
|
||||
if (activity.createSeedValidator.isValid()){
|
||||
btnCreate.setEnabled(true);
|
||||
} else {
|
||||
btnCreate.setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValidationFailed(final ValidationField field) {
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (field.getView() == tietPin) {
|
||||
tilPin.setError(field.getMessage());
|
||||
} else if (field.getView() == tietPinConfirmation){
|
||||
tilPinConfirmation.setError(field.getMessage());
|
||||
} else if (field.getView() == tietAccountName){
|
||||
tilAccountName.setError(field.getMessage());
|
||||
} //else if (field.getView() == etSeedWords){
|
||||
// tvSeedWordsError.setText(field.getMessage());
|
||||
//}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,245 @@
|
|||
package cy.agorise.crystalwallet.activities
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Toast
|
||||
import butterknife.ButterKnife
|
||||
import butterknife.OnClick
|
||||
import butterknife.OnTextChanged
|
||||
import cy.agorise.crystalwallet.R
|
||||
import cy.agorise.crystalwallet.dialogs.material.CrystalDialog
|
||||
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests
|
||||
import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest
|
||||
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces.UIValidatorListener
|
||||
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields.BitsharesAccountNameValidation
|
||||
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields.BitsharesAccountNameValidation.OnAccountExist
|
||||
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields.CustomValidationField
|
||||
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields.PinDoubleConfirmationValidationField
|
||||
import cy.agorise.crystalwallet.views.natives.CustomTextInputEditText
|
||||
import kotlinx.android.synthetic.main.create_seed.*
|
||||
|
||||
|
||||
/*
|
||||
* This activity creates a new account with some security concerns
|
||||
* */
|
||||
class CreateSeedActivity : CustomActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
/*
|
||||
* Assign the view to this controller
|
||||
* */
|
||||
setContentView(R.layout.create_seed)
|
||||
|
||||
/*
|
||||
* Initialice butterknife MVC
|
||||
* */
|
||||
ButterKnife.bind(this)
|
||||
|
||||
/*
|
||||
* Add the controls to the validator
|
||||
* */
|
||||
this.fieldsValidator.add(tietPin)
|
||||
this.fieldsValidator.add(tietPinConfirmation)
|
||||
this.fieldsValidator.add(tietAccountName)
|
||||
|
||||
/*
|
||||
* Validations listener
|
||||
* */
|
||||
val uiValidatorListener = object : UIValidatorListener {
|
||||
|
||||
override fun onValidationSucceeded(customValidationField: CustomValidationField) {
|
||||
|
||||
try {
|
||||
|
||||
/*
|
||||
* Remove error
|
||||
* */
|
||||
runOnUiThread {
|
||||
val customTextInputEditText = customValidationField.currentView as CustomTextInputEditText
|
||||
customTextInputEditText.error = null
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Validate if can continue
|
||||
* */
|
||||
validateFieldsToContinue()
|
||||
}
|
||||
|
||||
override fun onValidationFailed(customValidationField: CustomValidationField) {
|
||||
|
||||
/*
|
||||
* Set error label
|
||||
* */
|
||||
runOnUiThread {
|
||||
val customTextInputEditText = customValidationField.currentView as CustomTextInputEditText
|
||||
customTextInputEditText.error = customTextInputEditText.fieldValidatorModel.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create the pin double validation
|
||||
* */
|
||||
val pinDoubleConfirmationValidationField = PinDoubleConfirmationValidationField(this, tietPin, tietPinConfirmation, uiValidatorListener)
|
||||
|
||||
/*
|
||||
* Listener for the validation for success or fail
|
||||
* */
|
||||
tietPin?.setUiValidator(pinDoubleConfirmationValidationField) //Validator for the field
|
||||
tietPinConfirmation?.setUiValidator(pinDoubleConfirmationValidationField) //Validator for the field
|
||||
|
||||
/*
|
||||
* Account name validator
|
||||
* */
|
||||
val bitsharesAccountNameValidation = BitsharesAccountNameValidation(this, tietAccountName, uiValidatorListener)
|
||||
val onAccountExist = object : OnAccountExist {
|
||||
override fun onAccountExists() {
|
||||
runOnUiThread { Toast.makeText(globalActivity, resources.getString(R.string.account_name_already_exist), Toast.LENGTH_LONG).show() }
|
||||
}
|
||||
|
||||
}
|
||||
bitsharesAccountNameValidation.setOnAccountExist(onAccountExist)
|
||||
tietAccountName?.setUiValidator(bitsharesAccountNameValidation)
|
||||
|
||||
/*This button should not be enabled till all the fields be correctly filled*/
|
||||
disableCreate()
|
||||
|
||||
/*
|
||||
* Set the focus on the fisrt field and show keyboard
|
||||
* */
|
||||
tilPin?.requestFocus()
|
||||
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.showSoftInput(tilPin, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
|
||||
|
||||
@OnTextChanged(value = R.id.tietPin, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
||||
internal fun afterPinChanged(editable: Editable) {
|
||||
this.fieldsValidator.validate()
|
||||
|
||||
/*
|
||||
* Validate continue to create account
|
||||
* */
|
||||
validateFieldsToContinue()
|
||||
}
|
||||
|
||||
@OnTextChanged(value = R.id.tietPinConfirmation, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
||||
internal fun afterPinConfirmationChanged(editable: Editable) {
|
||||
this.fieldsValidator.validate()
|
||||
|
||||
/*
|
||||
* Validate continue to create account
|
||||
* */
|
||||
validateFieldsToContinue()
|
||||
}
|
||||
|
||||
@OnTextChanged(value = R.id.tietAccountName, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
||||
internal fun afterAccountNameChanged(editable: Editable) {
|
||||
this.fieldsValidator.validate()
|
||||
|
||||
/*
|
||||
* Always disable till the server response comes
|
||||
* */
|
||||
disableCreate()
|
||||
}
|
||||
|
||||
@OnClick(R.id.btnCancel)
|
||||
fun cancel() {
|
||||
|
||||
/*
|
||||
* Exit of the activity
|
||||
* */
|
||||
this.finish()
|
||||
}
|
||||
|
||||
@OnClick(R.id.btnCreate)
|
||||
fun createSeed() {
|
||||
|
||||
// Make request to create a bitshare account
|
||||
val request = ValidateCreateBitsharesAccountRequest(tietAccountName?.getText().toString(), applicationContext)
|
||||
|
||||
//DTVV: Friday 27 July 2018
|
||||
//Makes dialog to tell the user that the account is been created
|
||||
val creatingAccountMaterialDialog = CrystalDialog(this)
|
||||
creatingAccountMaterialDialog.setText(this.resources.getString(R.string.window_create_seed_DialogMessage))
|
||||
creatingAccountMaterialDialog.build()
|
||||
this@CreateSeedActivity.runOnUiThread { creatingAccountMaterialDialog.show() }
|
||||
request.setListener {
|
||||
creatingAccountMaterialDialog.dismiss()
|
||||
if (request.status == ValidateCreateBitsharesAccountRequest.StatusCode.SUCCEEDED) {
|
||||
val accountSeed = request.account
|
||||
val intent = Intent(applicationContext, BackupSeedActivity::class.java)
|
||||
intent.putExtra("SEED_ID", accountSeed.id)
|
||||
startActivity(intent)
|
||||
} else {
|
||||
fieldsValidator.validate()
|
||||
}
|
||||
}
|
||||
|
||||
val thread = object : Thread() {
|
||||
override fun run() {
|
||||
|
||||
/*
|
||||
*
|
||||
* Run thread*/
|
||||
CryptoNetInfoRequests.getInstance().addRequest(request)
|
||||
}
|
||||
}
|
||||
|
||||
thread.start()
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate that all is complete to continue to create
|
||||
* */
|
||||
private fun validateFieldsToContinue() {
|
||||
|
||||
var result = false //Contains the final result
|
||||
|
||||
val pinValid: Boolean? = this.tietPin?.getFieldValidatorModel()?.isValid
|
||||
val pinConfirmationValid = this.tietPinConfirmation?.getFieldValidatorModel()?.isValid
|
||||
val pinAccountNameValid = this.tietAccountName?.getFieldValidatorModel()?.isValid
|
||||
|
||||
if (pinValid!! &&
|
||||
pinConfirmationValid!! &&
|
||||
pinAccountNameValid!!) {
|
||||
result = true //Validation is correct
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If the result is true so the user can continue to the creation of the account
|
||||
* */
|
||||
if (result) {
|
||||
enableCreate()
|
||||
} else {
|
||||
disableCreate()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable create button
|
||||
* */
|
||||
private fun enableCreate() {
|
||||
btnCreate?.setEnabled(true)
|
||||
btnCreate?.setBackgroundColor(resources.getColor(R.color.colorPrimary))
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable create button
|
||||
* */
|
||||
private fun disableCreate() {
|
||||
btnCreate?.setEnabled(false)
|
||||
btnCreate?.setBackground(resources.getDrawable(R.drawable.disable_style))
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package cy.agorise.crystalwallet.activities
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import cy.agorise.crystalwallet.util.FieldsValidator
|
||||
|
||||
|
||||
/*
|
||||
* Custom implementaion of the activity
|
||||
* */
|
||||
open class CustomActivity : AppCompatActivity() {
|
||||
|
||||
/*
|
||||
* Contains the validator for general fields
|
||||
* */
|
||||
@JvmField protected var fieldsValidator = FieldsValidator()
|
||||