Merge branch 'develop_ui_improvements' of https://github.com/Agorise/crystal-wallet-android into develop

This commit is contained in:
hvarona 2018-09-09 11:55:20 -04:00
commit 74d8dbd749
81 changed files with 3312 additions and 1066 deletions

View file

@ -1,5 +1,13 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
kapt {
generateStubs = true
javacOptions {
option("-Xmaxerrs", 500)
}
}
android { android {
compileSdkVersion 27 compileSdkVersion 27
@ -40,19 +48,24 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) 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', { androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
}) })
implementation 'com.jaredrummler:material-spinner:1.2.5'
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.1.60"
//testCompile 'com.android.support.test:runner:1.0.1' //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.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:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1' implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2' implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'android.arch.lifecycle:runtime:1.1.1' implementation 'android.arch.lifecycle:runtime:1.1.1'
implementation 'android.arch.lifecycle:extensions: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 'android.arch.paging:runtime:1.0.0'
implementation 'com.idescout.sql:sqlscout-server:2.0' implementation 'com.idescout.sql:sqlscout-server:2.0'
implementation 'com.google.code.gson:gson:2.8.0' implementation 'com.google.code.gson:gson:2.8.0'
@ -72,8 +85,15 @@ dependencies {
//testCompile 'junit:junit: 4.12' //testCompile 'junit:junit: 4.12'
testImplementation 'org.mockito:mockito-core:1.10.19' 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' 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' 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' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.picasso:picasso:2.5.2' implementation 'com.squareup.picasso:picasso:2.5.2'
@ -88,4 +108,6 @@ dependencies {
exclude group: 'org.json', module: 'json' exclude group: 'org.json', module: 'json'
} }
kapt "android.arch.lifecycle:compiler:1.1.1"
kapt "android.arch.persistence.room:compiler:1.1.0"
} }

View 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\")"
]
}
}

View file

@ -17,7 +17,9 @@
android:supportsRtl="true" android:supportsRtl="true"
android:configChanges="locale" android:configChanges="locale"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".activities.LicenseActivity"> <activity
android:name=".activities.LicenseActivity"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -31,13 +33,15 @@
<activity android:name=".activities.BoardActivity" <activity android:name=".activities.BoardActivity"
android:theme="@style/AppTheme.NoActionBar" > android:theme="@style/AppTheme.NoActionBar" >
</activity> </activity>
<activity android:name=".activities.CreateSeedActivity" >
</activity>
<activity android:name=".activities.LoadingActivity"
android:theme="@style/ActivityDialog">
</activity>
<activity android:name=".activities.AccountSeedsManagementActivity" > <activity android:name=".activities.AccountSeedsManagementActivity" >
</activity> </activity>
<activity android:name=".activities.ImportSeedActivity" > <activity android:name=".activities.ImportSeedActivity" >
</activity> </activity>
<activity android:name=".activities.CreateSeedActivity"
android:noHistory="true">
</activity>
<activity android:name=".activities.SendTransactionActivity" > <activity android:name=".activities.SendTransactionActivity" >
</activity> </activity>
<activity android:name=".activities.GeneralSettingsActivity" > <activity android:name=".activities.GeneralSettingsActivity" >
@ -100,6 +104,7 @@
<activity android:name=".activities.CreateContactActivity"> <activity android:name=".activities.CreateContactActivity">
</activity> </activity>
</application> </application>
</manifest> </manifest>

View file

@ -3,12 +3,16 @@ package cy.agorise.crystalwallet.activities;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
@ -17,19 +21,28 @@ import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.models.AccountSeed; import cy.agorise.crystalwallet.models.AccountSeed;
import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel; import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel;
//tvBrainKey
public class BackupSeedActivity extends AppCompatActivity { public class BackupSeedActivity extends AppCompatActivity {
AccountSeedViewModel accountSeedViewModel; AccountSeedViewModel accountSeedViewModel;
@BindView(R.id.tvMnemonic) @BindView(R.id.tvBrainKey)
TextView tvMnemonic; TextView textfieldBrainkey;
@BindView(R.id.btnOk) @BindView(R.id.btnOk)
Button btnOk; Button btnOk;
@BindView(R.id.btnCopy)
Button btnCopy;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.backup_seed); 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); ButterKnife.bind(this);
long seedId = getIntent().getLongExtra("SEED_ID",-1); long seedId = getIntent().getLongExtra("SEED_ID",-1);
@ -41,7 +54,7 @@ public class BackupSeedActivity extends AppCompatActivity {
liveDataAccountSeed.observe(this, new Observer<AccountSeed>() { liveDataAccountSeed.observe(this, new Observer<AccountSeed>() {
@Override @Override
public void onChanged(@Nullable AccountSeed accountSeed) { public void onChanged(@Nullable AccountSeed accountSeed) {
tvMnemonic.setText(accountSeed.getMasterSeed()); textfieldBrainkey.setText(accountSeed.getMasterSeed());
} }
}); });
accountSeedViewModel.loadSeed(seedId); accountSeedViewModel.loadSeed(seedId);
@ -56,4 +69,23 @@ public class BackupSeedActivity extends AppCompatActivity {
Intent intent = new Intent(this, IntroActivity.class); Intent intent = new Intent(this, IntroActivity.class);
startActivity(intent); 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();
}
} }

View file

@ -8,6 +8,8 @@ import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Typeface;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.FloatingActionButton; 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.FragmentStatePagerAdapter;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; 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.util.Pair;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator; import android.view.animation.LinearInterpolator;
import android.widget.ImageView; 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; 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.ReceiveTransactionFragment;
import cy.agorise.crystalwallet.fragments.SendTransactionFragment; import cy.agorise.crystalwallet.fragments.SendTransactionFragment;
import cy.agorise.crystalwallet.fragments.TransactionsFragment; import cy.agorise.crystalwallet.fragments.TransactionsFragment;
import cy.agorise.crystalwallet.views.natives.GIFView;
import de.hdodenhof.circleimageview.CircleImageView; import de.hdodenhof.circleimageview.CircleImageView;
import cy.agorise.crystalwallet.viewmodels.CryptoNetBalanceListViewModel; import cy.agorise.crystalwallet.viewmodels.CryptoNetBalanceListViewModel;
@ -46,8 +55,7 @@ import cy.agorise.crystalwallet.viewmodels.CryptoNetBalanceListViewModel;
* Created by Henry Varona on 7/10/2017. * Created by Henry Varona on 7/10/2017.
* *
*/ */
public class BoardActivity extends CustomActivity {
public class BoardActivity extends AppCompatActivity {
@BindView(R.id.tabLayout) @BindView(R.id.tabLayout)
public TabLayout tabLayout; public TabLayout tabLayout;
@ -64,6 +72,9 @@ public class BoardActivity extends AppCompatActivity {
@BindView(R.id.fabAddContact) @BindView(R.id.fabAddContact)
public FloatingActionButton fabAddContact; public FloatingActionButton fabAddContact;
@BindView(R.id.imagevieGIF)
public GIFView imagevieGIF;
public BoardPagerAdapter boardAdapter; public BoardPagerAdapter boardAdapter;
/* /*
@ -98,6 +109,61 @@ public class BoardActivity extends AppCompatActivity {
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(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 // Appbar animation
mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
@Override @Override

View file

@ -4,15 +4,14 @@ import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,20 +32,14 @@ import cy.agorise.crystalwallet.views.ContactAddressListAdapter;
public class CreateContactActivity extends AppCompatActivity implements UIValidatorListener { public class CreateContactActivity extends AppCompatActivity implements UIValidatorListener {
@BindView(R.id.etName) @BindView(R.id.tilName)
EditText etName; TextInputLayout tilName;
@BindView(R.id.tvNameError) @BindView(R.id.tietName)
TextView tvNameError; TextInputEditText tietName;
@BindView(R.id.etEmail)
EditText etEmail;
@BindView(R.id.tvEmailError)
TextView tvEmailError;
@BindView(R.id.btnCancel) @BindView(R.id.btnCancel)
Button btnCancel; Button btnCancel;
@BindView(R.id.btnCreate) @BindView(R.id.btnCreate)
Button btnCreate; Button btnCreate;
@BindView(R.id.btnModify)
Button btnModify;
@BindView(R.id.rvContactAddresses) @BindView(R.id.rvContactAddresses)
RecyclerView rvContactAddresses; RecyclerView rvContactAddresses;
@BindView(R.id.btnAddAddress) @BindView(R.id.btnAddAddress)
@ -59,6 +52,8 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
Contact contact; Contact contact;
long contactId;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -71,10 +66,7 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
rvContactAddresses.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rvContactAddresses.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
rvContactAddresses.setAdapter(listAdapter); rvContactAddresses.setAdapter(listAdapter);
long contactId = this.getIntent().getLongExtra("CONTACT_ID",-1); contactId = getIntent().getLongExtra("CONTACT_ID",-1);
btnCreate.setVisibility(View.GONE);
btnModify.setVisibility(View.GONE);
if (contactId >= 0){ if (contactId >= 0){
final ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class); final ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class);
@ -88,8 +80,7 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
public void onChanged(@Nullable Contact contactChanged) { public void onChanged(@Nullable Contact contactChanged) {
if (contactChanged != null){ if (contactChanged != null){
contact = contactChanged; contact = contactChanged;
etName.setText(contact.getName()); tietName.setText(contact.getName());
etEmail.setText(contact.getEmail());
LiveData<List<ContactAddress>> contactAddresses = contactViewModel.getContactAddresses(); LiveData<List<ContactAddress>> contactAddresses = contactViewModel.getContactAddresses();
@ -102,9 +93,10 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
} }
}); });
modifyContactValidator = new ModifyContactValidator(thisActivity.getApplicationContext(),contact,etName,etEmail); modifyContactValidator = new ModifyContactValidator(
thisActivity.getApplicationContext(), contact, tietName);
modifyContactValidator.setListener(thisActivity); modifyContactValidator.setListener(thisActivity);
btnModify.setVisibility(View.VISIBLE); btnCreate.setText(R.string.modify);
} else { } else {
//No contact was found, this will exit the activity //No contact was found, this will exit the activity
finish(); finish();
@ -112,9 +104,9 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
} }
}); });
} else { } else {
contactAddressList = new ArrayList<ContactAddress>(); contactAddressList = new ArrayList<>();
listAdapter.submitList(contactAddressList); listAdapter.submitList(contactAddressList);
createContactValidator = new CreateContactValidator(this.getApplicationContext(),etName,etEmail); createContactValidator = new CreateContactValidator(this.getApplicationContext(),tietName);
createContactValidator.setListener(this); createContactValidator.setListener(this);
btnCreate.setVisibility(View.VISIBLE); btnCreate.setVisibility(View.VISIBLE);
@ -139,19 +131,12 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
return false; return false;
} }
@OnTextChanged(value = R.id.etName, @OnTextChanged(value = R.id.tietName,
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void afterContactNameChanged(Editable editable) { void afterContactNameChanged() {
this.validate(); this.validate();
} }
@OnTextChanged(value = R.id.etEmail,
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void afterEmailChanged(Editable editable) {
this.validate();
}
@OnClick(R.id.btnAddAddress) @OnClick(R.id.btnAddAddress)
public void addAddress(){ public void addAddress(){
ContactAddress newContactAddress = new ContactAddress(); ContactAddress newContactAddress = new ContactAddress();
@ -164,42 +149,43 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
this.finish(); this.finish();
} }
@OnClick(R.id.btnModify)
public void modifyContact(){
if (this.modifyContactValidator.isValid()) {
this.contact.setName(etName.getText().toString());
this.contact.setEmail(etEmail.getText().toString());
this.contact.clearAddresses();
for (ContactAddress contactAddress : contactAddressList){
this.contact.addAddress(contactAddress);
}
ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class);
if (contactViewModel.modifyContact(this.contact)){
this.finish();
} else {
this.modifyContactValidator.validate();
}
}
}
@OnClick(R.id.btnCreate) @OnClick(R.id.btnCreate)
public void createContact(){ public void createOrModifyContact(){
if (this.createContactValidator.isValid()) { if(contactId >= 0) {
Contact newContact = new Contact(); // Modifying existing contact
newContact.setName(etName.getText().toString());
newContact.setEmail(etEmail.getText().toString());
for (ContactAddress contactAddress : contactAddressList){ if (this.modifyContactValidator.isValid()) {
newContact.addAddress(contactAddress); this.contact.setName(tietName.getText().toString());
this.contact.clearAddresses();
for (ContactAddress contactAddress : contactAddressList){
this.contact.addAddress(contactAddress);
}
ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class);
if (contactViewModel.modifyContact(this.contact)){
this.finish();
} else {
this.modifyContactValidator.validate();
}
} }
} else {
// Creating a new contact
ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class); if (this.createContactValidator.isValid()) {
if (contactViewModel.addContact(newContact)){ Contact newContact = new Contact();
this.finish(); newContact.setName(tietName.getText().toString());
} else {
createContactValidator.validate(); for (ContactAddress contactAddress : contactAddressList){
newContact.addAddress(contactAddress);
}
ContactViewModel contactViewModel = ViewModelProviders.of(this).get(ContactViewModel.class);
if (contactViewModel.addContact(newContact)){
this.finish();
} else {
createContactValidator.validate();
}
} }
} }
} }
@ -211,10 +197,8 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
public void run() { public void run() {
if (field.getView() == etName) { if (field.getView() == tietName) {
tvNameError.setText(""); tilName.setError("");
} else if (field.getView() == etEmail) {
tvEmailError.setText("");
} }
if (activity.isValid()){ if (activity.isValid()){
@ -232,10 +216,8 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
@Override @Override
public void run() { public void run() {
if (field.getView() == etName) { if (field.getView() == tietName) {
tvNameError.setText(field.getMessage()); tilName.setError(field.getMessage());
} else if (field.getView() == etEmail) {
tvEmailError.setText(field.getMessage());
} }
} }
}); });

View file

@ -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());
//}
}
});
}
}

View file

@ -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.progress()
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()
}
}
(object : Thread() {
override fun run() {
/*
*
* Run thread*/
CryptoNetInfoRequests.getInstance().addRequest(request)
}
}).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))
}
}

View file

@ -0,0 +1,31 @@
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()
/*
* Contains the global activity
* */
protected lateinit var globalActivity: Activity
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
/*
* Save the current activity for further reference
* */
this.globalActivity = this
}
}

View file

@ -12,6 +12,7 @@ import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.Toast;
import java.util.List; import java.util.List;
@ -19,13 +20,18 @@ import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator;
import cy.agorise.crystalwallet.application.CrystalApplication;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.dialogs.material.ToastIt;
import cy.agorise.crystalwallet.enums.CryptoNet;
import cy.agorise.crystalwallet.fragments.ImportAccountOptionsFragment; import cy.agorise.crystalwallet.fragments.ImportAccountOptionsFragment;
import cy.agorise.crystalwallet.models.AccountSeed; import cy.agorise.crystalwallet.models.AccountSeed;
import cy.agorise.crystalwallet.models.CryptoCoinBalance; import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCoinTransaction; import cy.agorise.crystalwallet.models.CryptoCoinTransaction;
import cy.agorise.crystalwallet.models.CryptoNetAccount; import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.models.GeneralSetting;
import cy.agorise.crystalwallet.network.CryptoNetManager;
import cy.agorise.crystalwallet.randomdatagenerators.RandomCryptoCoinBalanceGenerator; import cy.agorise.crystalwallet.randomdatagenerators.RandomCryptoCoinBalanceGenerator;
import cy.agorise.crystalwallet.randomdatagenerators.RandomCryptoNetAccountGenerator; import cy.agorise.crystalwallet.randomdatagenerators.RandomCryptoNetAccountGenerator;
import cy.agorise.crystalwallet.randomdatagenerators.RandomSeedGenerator; import cy.agorise.crystalwallet.randomdatagenerators.RandomSeedGenerator;
@ -35,10 +41,7 @@ import cy.agorise.crystalwallet.viewmodels.AccountSeedListViewModel;
import cy.agorise.crystalwallet.viewmodels.TransactionListViewModel; import cy.agorise.crystalwallet.viewmodels.TransactionListViewModel;
import cy.agorise.crystalwallet.views.TransactionListView; import cy.agorise.crystalwallet.views.TransactionListView;
public class IntroActivity extends AppCompatActivity { public class IntroActivity extends CustomActivity {
TransactionListViewModel transactionListViewModel;
TransactionListView transactionListView;
@BindView(R.id.surface_view) @BindView(R.id.surface_view)
public SurfaceView mSurfaceView; public SurfaceView mSurfaceView;
@ -53,6 +56,7 @@ public class IntroActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_intro); setContentView(R.layout.activity_intro);
ButterKnife.bind(this); ButterKnife.bind(this);
// Appbar animation // Appbar animation
@ -97,6 +101,7 @@ public class IntroActivity extends AppCompatActivity {
Intent intent = new Intent(this, BoardActivity.class); Intent intent = new Intent(this, BoardActivity.class);
//Intent intent = new Intent(this, PocketRequestActivity.class); //Intent intent = new Intent(this, PocketRequestActivity.class);
startActivity(intent); startActivity(intent);
finish();
} }
/*CrystalDatabase db = CrystalDatabase.getAppDatabase(getApplicationContext()); /*CrystalDatabase db = CrystalDatabase.getAppDatabase(getApplicationContext());

View file

@ -10,8 +10,11 @@ import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.application.CrystalApplication;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.enums.CryptoNet;
import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.models.GeneralSetting;
import cy.agorise.crystalwallet.network.CryptoNetManager;
public class LicenseActivity extends AppCompatActivity { public class LicenseActivity extends AppCompatActivity {
@ -23,6 +26,7 @@ public class LicenseActivity extends AppCompatActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_license); setContentView(R.layout.activity_license);
ButterKnife.bind(this); ButterKnife.bind(this);
// TODO check if license has been agreed // TODO check if license has been agreed
@ -37,6 +41,7 @@ public class LicenseActivity extends AppCompatActivity {
if ((generalSettingLastLicenseRead != null) && (Integer.parseInt(generalSettingLastLicenseRead.getValue()) >= licenseVersion)) { if ((generalSettingLastLicenseRead != null) && (Integer.parseInt(generalSettingLastLicenseRead.getValue()) >= licenseVersion)) {
Intent intent = new Intent(this, IntroActivity.class); Intent intent = new Intent(this, IntroActivity.class);
startActivity(intent); startActivity(intent);
finish();
} }
} }
@ -52,6 +57,7 @@ public class LicenseActivity extends AppCompatActivity {
Intent intent = new Intent(this, IntroActivity.class); Intent intent = new Intent(this, IntroActivity.class);
startActivity(intent); startActivity(intent);
finish();
} }
@OnClick(R.id.btnDisAgree) @OnClick(R.id.btnDisAgree)

View file

@ -0,0 +1,256 @@
package cy.agorise.crystalwallet.activities
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import butterknife.ButterKnife
import kotlinx.android.synthetic.main.loading_activity.*
import android.view.animation.AnimationUtils
import android.widget.ImageView
import butterknife.BindView
import cy.agorise.crystalwallet.R
/*
* This activity is to show a loading window when it is needed
* */
class LoadingActivity : CustomActivity() {
@BindView(R.id.imageviewLoading)
lateinit var imageviewLoading:ImageView
override fun onCreate(savedInstanceState: Bundle?) {
/*
* Construct the parent
* */
super.onCreate(savedInstanceState)
/*
* If the window was closed before be created so finish it
* */
if(destroyWindow!!){
finish()
}
/*
* Assign the view to this controller
* */
setContentView(cy.agorise.crystalwallet.R.layout.loading_activity)
/*
* Save the current activity
* */
currentActivity = this
/*
* If has to manage timer
* */
if(LoadingActivity.seconds != -1){
/*
* */
Handler().postDelayed({
/*
* Reset flag
* */
LoadingActivity.seconds = -1
finish() //Finish the current window
}, (LoadingActivity.seconds * 1000).toLong())
}
/*
* Initialice butterknife MVC
* */
ButterKnife.bind(this)
/*
* If has to change the loading sizes so
* */
if(loadinIconChangeSize){
imageviewLoading.layoutParams.width = loadingIconWidth
imageviewLoading.layoutParams.height = loadingIconHeigt
}
/*
* Rotate the image
* */
val rotation = AnimationUtils.loadAnimation(this, cy.agorise.crystalwallet.R.anim.rotate360)
imageviewLoading.startAnimation(rotation)
/*
* If listener is set deliver response
* */
if(onLoadingReady != null){
onLoadingReady!!.onLoadingReady()
}
}
/*
* This events hires when the window is destroyed
* */
override fun onDestroy() {
super.onDestroy()
/*
* If listener is set deliver response
* */
if(onLoadingClosed != null){
onLoadingClosed?.onLoadingClosed()
}
}
override fun onResume() {
super.onResume()
/*
* If the window was closed before be created so finish it
* */
if(destroyWindow!!){
finish()
}
}
/*
* Static methods
* */
companion object {
/*
* Contains the activity shown
* */
private var currentActivity: Activity? = null
/*
* Flag to validate if the window has to finish or not
* */
private var destroyWindow:Boolean? = false
/*
* Listener when the loading window is closed
* */
private var onLoadingClosed:LoadingClosed? = null
/*
* Listener when the loading window is resume
* */
private var onLoadingReady:LoadingReady? = null
/*
* Contains the seconds to finish the window in case of timer
* */
private var seconds:Int = -1
/*
* Contains the icon loading size
* */
private var loadingIconWidth:Int = -1
private var loadingIconHeigt:Int = -1
private var loadinIconChangeSize:Boolean = false
/*
* Show the loading activity
* */
@JvmStatic
open fun show(activity: Activity) {
if(activity!=null){
/*
* If it is not visible
* */
if(currentActivity==null){
/*
* Reset flags
* */
destroyWindow = false
/*
* Show the loading activity
* */
val intent = Intent(activity, LoadingActivity::class.java)
activity.startActivity(intent)
}
}
}
/*
* Dismiss the loading activity
* */
@JvmStatic
open fun dismiss() {
if(currentActivity!=null){
/*
* Close the activity
* */
currentActivity?.finish()
/*
* Reset flags
* */
loadinIconChangeSize = false
currentActivity = null
destroyWindow = true
}
}
/*
* Change the loading icon size
* */
@JvmStatic
open fun loadingIconSize(width:Int,heigth:Int) {
/*
* The loading icon size wil change
* */
loadinIconChangeSize = true
/*
* Save the sizes
* */
loadingIconWidth = width
loadingIconHeigt = heigth
}
/*
* When the loading window is closed
* */
@JvmStatic
open fun onLoadingClosed(onLoadingClose: LoadingClosed) {
this.onLoadingClosed = onLoadingClose
}
/*
* When the loading window is up and visible
* */
@JvmStatic
open fun onLoadingReady(onLoadingResume:LoadingReady) {
this.onLoadingReady = onLoadingResume
}
/*
* Timer to close the window
* */
@JvmStatic
open fun closeOnTime(seconds:Int) {
LoadingActivity.seconds = seconds
}
}
/*
* Interface for all the events
* */
interface LoadingClosed{
fun onLoadingClosed()
}
interface LoadingReady{
fun onLoadingReady()
}
}

View file

@ -7,22 +7,18 @@ import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.text.Editable; import android.text.Editable;
import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView;
import java.util.List; import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnTextChanged; import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.application.CrystalSecurityMonitor; import cy.agorise.crystalwallet.application.CrystalSecurityMonitor;
import cy.agorise.crystalwallet.models.AccountSeed; import cy.agorise.crystalwallet.models.AccountSeed;
import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.models.GeneralSetting;
import cy.agorise.crystalwallet.util.PasswordManager; import cy.agorise.crystalwallet.util.PasswordManager;
import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel;
import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel; import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel;
public class PinRequestActivity extends AppCompatActivity { public class PinRequestActivity extends AppCompatActivity {

View file

@ -11,6 +11,8 @@ import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import com.jaredrummler.materialspinner.MaterialSpinner;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -35,8 +37,8 @@ public class SendTransactionActivity extends AppCompatActivity implements UIVali
SendTransactionValidator sendTransactionValidator; SendTransactionValidator sendTransactionValidator;
/*@BindView(R.id.etFrom) @BindView(R.id.spFrom)
EditText etFrom;*/ MaterialSpinner spFrom;
@BindView(R.id.tvFromError) @BindView(R.id.tvFromError)
TextView tvFromError; TextView tvFromError;
@BindView(R.id.etTo) @BindView(R.id.etTo)
@ -102,7 +104,7 @@ public class SendTransactionActivity extends AppCompatActivity implements UIVali
} }
}); });
//sendTransactionValidator = new SendTransactionValidator(this.getApplicationContext(), this.cryptoNetAccount, etFrom, etTo, spAsset, etAmount, etMemo); sendTransactionValidator = new SendTransactionValidator(this.getApplicationContext(), this.cryptoNetAccount, spFrom, etTo, spAsset, etAmount, etMemo);
sendTransactionValidator.setListener(this); sendTransactionValidator.setListener(this);
} else { } else {
this.finish(); this.finish();

View file

@ -8,7 +8,6 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import cy.agorise.crystalwallet.application.constant.BitsharesConstant;
import cy.agorise.crystalwallet.dao.BitsharesAssetDao; import cy.agorise.crystalwallet.dao.BitsharesAssetDao;
import cy.agorise.crystalwallet.dao.CryptoCoinBalanceDao; import cy.agorise.crystalwallet.dao.CryptoCoinBalanceDao;
import cy.agorise.crystalwallet.dao.CryptoCurrencyDao; import cy.agorise.crystalwallet.dao.CryptoCurrencyDao;
@ -81,6 +80,8 @@ public abstract class GrapheneApiGenerator {
*/ */
private static HashMap<Long, SubscriptionListener> currentBitsharesListener = new HashMap<>(); private static HashMap<Long, SubscriptionListener> currentBitsharesListener = new HashMap<>();
/** /**
* Retrieves the data of an account searching by it's id * Retrieves the data of an account searching by it's id
* *
@ -702,5 +703,4 @@ public abstract class GrapheneApiGenerator {
} }
} }
} }

View file

@ -1,5 +1,6 @@
package cy.agorise.crystalwallet.application; package cy.agorise.crystalwallet.application;
import android.app.Activity;
import android.app.Application; import android.app.Application;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
@ -11,6 +12,7 @@ import com.idescout.sql.SqlScoutServer;
import java.util.Locale; import java.util.Locale;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.enums.CryptoNet; import cy.agorise.crystalwallet.enums.CryptoNet;
import cy.agorise.crystalwallet.models.BitsharesAsset; import cy.agorise.crystalwallet.models.BitsharesAsset;
@ -91,7 +93,9 @@ public class CrystalApplication extends Application {
CryptoNetEvents.getInstance().addListener(crystalWalletNotifier); CryptoNetEvents.getInstance().addListener(crystalWalletNotifier);
//Next line is for use the bitshares main net //Next line is for use the bitshares main net
CryptoNetManager.addCryptoNetURL(CryptoNet.BITSHARES,BITSHARES_URL); // TODO fix, the following line accepts one string not an array it needs to accept an arrey
// TODO and hoop over the urls if no connection can be established
CryptoNetManager.addCryptoNetURL(CryptoNet.BITSHARES,BITSHARES_URL[2]);
GeneralSetting generalSettingPreferredLanguage = db.generalSettingDao().getSettingByName(GeneralSetting.SETTING_NAME_PREFERRED_LANGUAGE); GeneralSetting generalSettingPreferredLanguage = db.generalSettingDao().getSettingByName(GeneralSetting.SETTING_NAME_PREFERRED_LANGUAGE);

View file

@ -0,0 +1,30 @@
package cy.agorise.crystalwallet.dialogs.material
import android.app.Activity
import cy.agorise.crystalwallet.R
import kotlinx.android.synthetic.main.account_seed_list.view.*
/*
* Dialog material that shows loading gif and and explicit message
* */
open class CrystalDialog : DialogMaterial{
constructor(activity: Activity) : super(activity) {
/*
* Prepare the dialog
* */
this.builder.title("")
this.builder.content("")
}
}
/*
* Internal interfaces
* */
interface PositiveResponse{
fun onPositive()
}
interface NegativeResponse{
fun onNegative()
}

View file

@ -0,0 +1,150 @@
package cy.agorise.crystalwallet.dialogs.material
import android.app.Activity
import com.afollestad.materialdialogs.MaterialDialog
import cy.agorise.crystalwallet.R
/*
*
* Controls the custom implementarion for all kind of material dialogs
* Reference in: https://github.com/afollestad/material-dialogs
*
* */
open abstract class DialogMaterial{
protected var builder: MaterialDialog.Builder //Contains the builder
protected lateinit var materialDialog: MaterialDialog //Contains the controller for the dialog
/*
* Contains the activity
* */
protected var activity:Activity;
/*
* Contains the response for positive button click
* */
var positiveResponse:PositiveResponse? = null
/*
* Contains the response for negative button click
* */
var negativeResponse:NegativeResponse? = null
constructor(activity: Activity) {
/*
* Save the activity
* */
this.activity = activity
/*
* Init the builder
* */
builder = MaterialDialog.Builder(activity)
}
/*
* Show the dialog
* */
fun show() {
/*
* If user wants positive and negative
* */
if(positiveResponse != null && negativeResponse != null){
/*
* Add positve
* */
builder.positiveText(activity.resources.getString(R.string.ok))
builder.onPositive { dialog, which ->
/*
* If response is not null deliver response
* */
if(positiveResponse != null){
positiveResponse!!.onPositive()
}
}
/*
* Add negative
* */
builder.negativeText(activity.resources.getString(R.string.cancel))
builder.onNegative { dialog, which ->
/*
* If response is not null deliver response
* */
if(negativeResponse != null){
negativeResponse!!.onNegative()
}
}
}
/*
* If user wants positive button
* */
if(positiveResponse != null){
builder.positiveText(activity.resources.getString(R.string.ok))
builder.onPositive { dialog, which ->
/*
* If response is not null deliver response
* */
if(positiveResponse != null){
positiveResponse!!.onPositive()
}
}
}
/*
* Build internal material dialog, this lets to show it
* */
this.build()
/*
* Show the dialog
* */
materialDialog.show()
}
/*
* Close the dialog
* */
fun dismiss() {
this.materialDialog.dismiss()
}
/*
* After the class is completed as needed, we need to call this method to join all together after show the
* childs implementations
* */
open fun build() {
this.materialDialog = this.builder.build()
}
/*
* Set indeterminate progress
*
* */
open fun progress(){
this.builder.progress(true, 0)
}
/*
* Setters and getters
* */
fun setText(message: String) {
this.builder.content(message)
}
fun setTitle(title: String) {
this.builder.title(title)
}
/*
* End of setters and getters
* */
}

View file

@ -0,0 +1,30 @@
package cy.agorise.crystalwallet.dialogs.material
import android.app.Activity
import android.widget.Toast
/*
* This class is an implementation of toast
* */
class ToastIt {
/*
* Satitic methods
* */
companion object {
/*
* Show long toast
* */
@JvmStatic fun showLongToast(activity: Activity, message:String) {
Toast.makeText(activity, message, Toast.LENGTH_LONG).show()
}
/*
* Show short toast
* */
@JvmStatic fun showShortToast(activity: Activity, message:String) {
Toast.makeText(activity, message, Toast.LENGTH_SHORT).show()
}
}
}

View file

@ -5,8 +5,12 @@ import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.arch.paging.PagedList; import android.arch.paging.PagedList;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -16,12 +20,16 @@ import butterknife.ButterKnife;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.models.Contact; import cy.agorise.crystalwallet.models.Contact;
import cy.agorise.crystalwallet.viewmodels.ContactListViewModel; import cy.agorise.crystalwallet.viewmodels.ContactListViewModel;
import cy.agorise.crystalwallet.views.ContactListView; import cy.agorise.crystalwallet.views.ContactListAdapter;
public class ContactsFragment extends Fragment { public class ContactsFragment extends Fragment {
@BindView(R.id.vContactListView) @BindView(R.id.rvContacts)
ContactListView contactListView; RecyclerView rvContacts;
ContactListAdapter adapter;
FloatingActionButton fabAddContact;
public ContactsFragment() { public ContactsFragment() {
// Required empty public constructor // Required empty public constructor
@ -40,23 +48,47 @@ public class ContactsFragment extends Fragment {
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Inflate the layout for this fragment // Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_contacts, container, false); View view = inflater.inflate(R.layout.fragment_contacts, container, false);
ButterKnife.bind(this, v); ButterKnife.bind(this, view);
ContactListViewModel contactListViewModel = ViewModelProviders.of(this).get(ContactListViewModel.class); // Configure RecyclerView and its adapter
contactListViewModel.init(); rvContacts.setLayoutManager(new LinearLayoutManager(getContext()));
adapter = new ContactListAdapter();
rvContacts.setAdapter(adapter);
fabAddContact = getActivity().findViewById(R.id.fabAddContact);
// Hides the fab when scrolling down
rvContacts.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
// Scroll down
if(dy > 0 && fabAddContact.isShown())
fabAddContact.hide();
// Scroll up
if(dy < 0 && !fabAddContact.isShown())
fabAddContact.show();
}
});
// Gets contacts LiveData instance from ContactsViewModel
ContactListViewModel contactListViewModel =
ViewModelProviders.of(this).get(ContactListViewModel.class);
LiveData<PagedList<Contact>> contactsLiveData = contactListViewModel.getContactList(); LiveData<PagedList<Contact>> contactsLiveData = contactListViewModel.getContactList();
contactsLiveData.observe(this, new Observer<PagedList<Contact>>() { contactsLiveData.observe(this, new Observer<PagedList<Contact>>() {
@Override @Override
public void onChanged(@Nullable PagedList<Contact> contacts) { public void onChanged(@Nullable PagedList<Contact> contacts) {
contactListView.setData(contacts); adapter.submitList(contacts);
} }
}); });
return v; return view;
} }
} }

View file

@ -22,12 +22,15 @@ import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.activities.ImportSeedActivity;
import cy.agorise.crystalwallet.activities.IntroActivity; import cy.agorise.crystalwallet.activities.IntroActivity;
import cy.agorise.crystalwallet.requestmanagers.FileServiceRequestListener; import cy.agorise.crystalwallet.requestmanagers.FileServiceRequestListener;
import cy.agorise.crystalwallet.requestmanagers.FileServiceRequests; import cy.agorise.crystalwallet.requestmanagers.FileServiceRequests;
import cy.agorise.crystalwallet.requestmanagers.ImportBackupRequest; import cy.agorise.crystalwallet.requestmanagers.ImportBackupRequest;
import cy.agorise.crystalwallet.util.UriTranslator; import cy.agorise.crystalwallet.util.UriTranslator;
import static android.app.Activity.RESULT_OK;
/** /**
* Created by xd on 1/25/18. * Created by xd on 1/25/18.
* Shows a dialog where the user can select how to import his/her existing account * Shows a dialog where the user can select how to import his/her existing account
@ -95,11 +98,17 @@ public class ImportAccountOptionsFragment extends DialogFragment {
} }
@OnClick (R.id.btnImportSeed)
public void importSeed(){
Intent intent = new Intent(this.getActivity(), ImportSeedActivity.class);
startActivity(intent);
}
@Override @Override
public void onActivityResult(int requestCode, int resultCode, final Intent data) { public void onActivityResult(int requestCode, int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (requestCode == FILE_CONTENT_REQUEST_CODE){ if ((requestCode == FILE_CONTENT_REQUEST_CODE) && (resultCode == RESULT_OK)){
LayoutInflater inflater = getActivity().getLayoutInflater(); LayoutInflater inflater = getActivity().getLayoutInflater();
View passwordDialogView = inflater.inflate(R.layout.dialog_password_input, null); View passwordDialogView = inflater.inflate(R.layout.dialog_password_input, null);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getContext()); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getContext());

View file

@ -1,16 +1,13 @@
package cy.agorise.crystalwallet.fragments; package cy.agorise.crystalwallet.fragments;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.text.Editable; import android.text.Editable;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -21,9 +18,7 @@ import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnTextChanged; import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.activities.CreateSeedActivity;
import cy.agorise.crystalwallet.application.CrystalSecurityMonitor; import cy.agorise.crystalwallet.application.CrystalSecurityMonitor;
import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.models.GeneralSetting;
import cy.agorise.crystalwallet.util.PasswordManager; import cy.agorise.crystalwallet.util.PasswordManager;
import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel; import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel;

View file

@ -32,6 +32,7 @@ import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import com.google.zxing.Result; import com.google.zxing.Result;
import com.jaredrummler.materialspinner.MaterialSpinner;
import java.io.File; import java.io.File;
import java.math.RoundingMode; import java.math.RoundingMode;
@ -73,7 +74,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
SendTransactionValidator sendTransactionValidator; SendTransactionValidator sendTransactionValidator;
@BindView(R.id.spFrom) @BindView(R.id.spFrom)
Spinner spFrom; MaterialSpinner spFrom;
@BindView(R.id.tvFromError) @BindView(R.id.tvFromError)
TextView tvFromError; TextView tvFromError;
@BindView(R.id.etTo) @BindView(R.id.etTo)
@ -152,8 +153,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
* this is only for graphene accounts. * this is only for graphene accounts.
* *
**/ **/
this.grapheneAccount = new GrapheneAccount(this.cryptoNetAccount); //this.grapheneAccount = new GrapheneAccount(this.cryptoNetAccount);
this.grapheneAccount.loadInfo(db.grapheneAccountInfoDao().getByAccountId(this.cryptoNetAccountId)); //this.grapheneAccount.loadInfo(db.grapheneAccountInfoDao().getByAccountId(this.cryptoNetAccountId));
final LiveData<List<CryptoCoinBalance>> balancesList = db.cryptoCoinBalanceDao().getBalancesFromAccount(cryptoNetAccountId); final LiveData<List<CryptoCoinBalance>> balancesList = db.cryptoCoinBalanceDao().getBalancesFromAccount(cryptoNetAccountId);
balancesList.observe(this, new Observer<List<CryptoCoinBalance>>() { balancesList.observe(this, new Observer<List<CryptoCoinBalance>>() {
@ -176,8 +177,27 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
CryptoNetAccountListViewModel cryptoNetAccountListViewModel = ViewModelProviders.of(this).get(CryptoNetAccountListViewModel.class); CryptoNetAccountListViewModel cryptoNetAccountListViewModel = ViewModelProviders.of(this).get(CryptoNetAccountListViewModel.class);
List<CryptoNetAccount> cryptoNetAccounts = cryptoNetAccountListViewModel.getCryptoNetAccountList(); List<CryptoNetAccount> cryptoNetAccounts = cryptoNetAccountListViewModel.getCryptoNetAccountList();
CryptoNetAccountAdapter fromSpinnerAdapter = new CryptoNetAccountAdapter(this.getContext(), android.R.layout.simple_spinner_item, cryptoNetAccounts); CryptoNetAccountAdapter fromSpinnerAdapter = new CryptoNetAccountAdapter(this.getContext(), android.R.layout.simple_spinner_item, cryptoNetAccounts);
spFrom.setAdapter(fromSpinnerAdapter);
spFrom.setSelection(0); //spFrom.setAdapter(fromSpinnerAdapter);
//spFrom.setSelection(0);
/*
* Custom material spinner implementation
* */
spFrom.setItems(cryptoNetAccounts);
//spFrom.setSelectedIndex(0);
spFrom.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<CryptoNetAccount>() {
@Override
public void onItemSelected(MaterialSpinner view, int position, long id, CryptoNetAccount item) {
sendTransactionValidator.validate();
}
});
spFrom.setOnNothingSelectedListener(new MaterialSpinner.OnNothingSelectedListener() {
@Override public void onNothingSelected(MaterialSpinner spinner) {
}
});
// etFrom.setText(this.grapheneAccount.getName()); // etFrom.setText(this.grapheneAccount.getName());
} }
@ -230,10 +250,10 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
} }
} }
@OnItemSelected(R.id.spFrom) /*@OnItemSelected(R.id.spFrom)
public void afterFromSelected(Spinner spinner, int position) { public void afterFromSelected(Spinner spinner, int position) {
this.sendTransactionValidator.validate(); this.sendTransactionValidator.validate();
} }*/
@OnTextChanged(value = R.id.etTo, @OnTextChanged(value = R.id.etTo,
callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
@ -311,7 +331,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
@OnClick(R.id.btnSend) @OnClick(R.id.btnSend)
public void sendTransaction(){ public void sendTransaction(){
if (this.sendTransactionValidator.isValid()) { if (this.sendTransactionValidator.isValid()) {
CryptoNetAccount fromAccountSelected = (CryptoNetAccount) spFrom.getSelectedItem(); CryptoNetAccount fromAccountSelected = (CryptoNetAccount) spFrom.getItems().get(spFrom.getSelectedIndex());
/* /*

View file

@ -0,0 +1,56 @@
package cy.agorise.crystalwallet.models;
import android.view.View;
public class FieldValidatorModel {
/*
* Determine if the field is valid
* */
private boolean valid;
/*
* Contains the message of the error
* */
private String message;
/*
* Setters and getters
* */
public boolean isValid() {
return valid;
}
public void setValid(boolean valid) {
this.valid = valid;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
/*
* End of setters and getters
* */
/*
* Set tha the field is invalid
* */
final public void setInvalid(){
this.valid = false;
}
/*
* Set tha the field is valid
* */
final public void setValid(){
this.valid = true;
}
}

View file

@ -1,5 +1,6 @@
package cy.agorise.crystalwallet.network; package cy.agorise.crystalwallet.network;
import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator;
import cy.agorise.crystalwallet.enums.CryptoNet; import cy.agorise.crystalwallet.enums.CryptoNet;
import cy.agorise.graphenej.interfaces.WitnessResponseListener; import cy.agorise.graphenej.interfaces.WitnessResponseListener;
import cy.agorise.graphenej.models.BaseResponse; import cy.agorise.graphenej.models.BaseResponse;
@ -23,15 +24,21 @@ public class BitsharesCryptoNetVerifier extends CryptoNetVerifier {
private final String CHAIN_ID = "9cf6f255a208100d2bb275a3c52f4b1589b7ec9c9bfc2cb2a5fe6411295106d8";//testnet private final String CHAIN_ID = "9cf6f255a208100d2bb275a3c52f4b1589b7ec9c9bfc2cb2a5fe6411295106d8";//testnet
//private final String CHAIN_ID = "4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8";//mainnet //private final String CHAIN_ID = "4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8";//mainnet
@Override
public void checkURL(final String url) {
public BitsharesCryptoNetVerifier(){
/**/
final long startTime = System.currentTimeMillis(); final long startTime = System.currentTimeMillis();
WebSocketThread thread = new WebSocketThread(new GetChainId(new WitnessResponseListener() { thread = new WebSocketThread(new GetChainId(new WitnessResponseListener() {
@Override @Override
public void onSuccess(WitnessResponse response) { public void onSuccess(WitnessResponse response) {
if(response.result instanceof String) { if(response.result instanceof String) {
if(response.result.equals(CHAIN_ID)) { if(response.result.equals(CHAIN_ID)) {
CryptoNetManager.verifiedCryptoNetURL(cryptoNet, url, System.currentTimeMillis() - startTime); CryptoNetManager.verifiedCryptoNetURL(cryptoNet, null, System.currentTimeMillis() - startTime);
}else{ }else{
System.out.println(" BitsharesCryptoNetVerifier Error we are not in the net current chain id " + response.result + " excepted " + CHAIN_ID); System.out.println(" BitsharesCryptoNetVerifier Error we are not in the net current chain id " + response.result + " excepted " + CHAIN_ID);
//TODO handle error bad chain //TODO handle error bad chain
@ -43,8 +50,15 @@ public class BitsharesCryptoNetVerifier extends CryptoNetVerifier {
public void onError(BaseResponse.Error error) { public void onError(BaseResponse.Error error) {
//TODO handle error //TODO handle error
} }
}),url); }),null);
thread.start();
}
@Override
public void checkURL(final String url) {
thread.setmUrl(url); //Set the url
thread.start(); //Run the thread connection
} }
@Override @Override

View file

@ -1,11 +1,9 @@
package cy.agorise.crystalwallet.network; package cy.agorise.crystalwallet.network;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -61,20 +59,30 @@ public abstract class CryptoNetManager {
} }
} }
public static void addCryptoNetURL(CryptoNet crypto, String[] urls){
if(!CryptoNetURLs.containsKey(crypto)){
CryptoNetURLs.put(crypto,new HashSet<String>());
}
CryptoNetVerifier verifier = CryptoNetVerifier.getNetworkVerify(crypto);
for(String url : urls) { /*
* Utility for above methods
*
* */
public static void addCryptoNetURL(CryptoNet crypto,
String[] urls) {
if (!CryptoNetURLs.containsKey(crypto)) {
CryptoNetURLs.put(crypto, new HashSet<String>());
}
CryptoNetVerifier verifier = CryptoNetVerifier.getNetworkVerify(crypto);
for (String url : urls) {
CryptoNetURLs.get(crypto).add(url); CryptoNetURLs.get(crypto).add(url);
if(verifier != null) { if (verifier != null) {
verifier.checkURL(url); verifier.checkURL(url);
} }
} }
} }
public static void removeCryptoNetURL(CryptoNet crypto, String url){ public static void removeCryptoNetURL(CryptoNet crypto, String url){
if(CryptoNetURLs.containsKey(crypto)){ if(CryptoNetURLs.containsKey(crypto)){
CryptoNetURLs.get(crypto).remove(url); CryptoNetURLs.get(crypto).remove(url);
@ -145,5 +153,4 @@ public abstract class CryptoNetManager {
return (int) (this.getTime() - testedURL.getTime()); return (int) (this.getTime() - testedURL.getTime());
} }
} }
} }

View file

@ -1,5 +1,8 @@
package cy.agorise.crystalwallet.network; package cy.agorise.crystalwallet.network;
import android.app.Activity;
import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator;
import cy.agorise.crystalwallet.enums.CryptoNet; import cy.agorise.crystalwallet.enums.CryptoNet;
/** /**
@ -12,6 +15,14 @@ import cy.agorise.crystalwallet.enums.CryptoNet;
public abstract class CryptoNetVerifier { public abstract class CryptoNetVerifier {
/*
* Contains the worker connection thread
*/
protected WebSocketThread thread;
static CryptoNetVerifier getNetworkVerify(CryptoNet cryptoNet){ static CryptoNetVerifier getNetworkVerify(CryptoNet cryptoNet){
if(cryptoNet.getLabel().equals(CryptoNet.BITSHARES.getLabel())){ if(cryptoNet.getLabel().equals(CryptoNet.BITSHARES.getLabel())){
return new BitsharesCryptoNetVerifier(); return new BitsharesCryptoNetVerifier();
@ -22,4 +33,9 @@ public abstract class CryptoNetVerifier {
public abstract void checkURL(final String url); public abstract void checkURL(final String url);
public abstract String getChainId(); public abstract String getChainId();
public WebSocketThread getThread() {
return thread;
}
} }

View file

@ -3,7 +3,6 @@ package cy.agorise.crystalwallet.network;
import android.util.Log; import android.util.Log;
import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocket;
import com.neovisionaries.ws.client.WebSocketException;
import com.neovisionaries.ws.client.WebSocketFactory; import com.neovisionaries.ws.client.WebSocketFactory;
import com.neovisionaries.ws.client.WebSocketListener; import com.neovisionaries.ws.client.WebSocketListener;
@ -34,6 +33,11 @@ public class WebSocketThread extends Thread {
private boolean canChange = true; private boolean canChange = true;
/*
* Object needed for socket connection
* */
private WebSocketFactory factory;
/** /**
* Basic constructor, * Basic constructor,
* *
@ -43,16 +47,27 @@ public class WebSocketThread extends Thread {
* @param url The url to connect * @param url The url to connect
*/ */
public WebSocketThread(WebSocketListener webSocketListener, String url) { public WebSocketThread(WebSocketListener webSocketListener, String url) {
try {
WebSocketFactory factory = new WebSocketFactory().setConnectionTimeout(5000); /*
this.mUrl = url; * The listener always can be setted
this.mWebSocketListener = webSocketListener; * */
this.mWebSocket = factory.createSocket(this.mUrl); this.mWebSocketListener = webSocketListener;
this.mWebSocket.addListener(this.mWebSocketListener);
} catch (IOException e) { /*
Log.e(TAG, "IOException. Msg: "+e.getMessage()); *
} catch(NullPointerException e){ * If at this point the url is not defined, this will be set after
Log.e(TAG, "NullPointerException at WebsocketWorkerThreas. Msg: "+e.getMessage()); * */
if(url!=null){
try {
factory = new WebSocketFactory().setConnectionTimeout(5000);
this.mUrl = url;
this.mWebSocket = factory.createSocket(this.mUrl);
this.mWebSocket.addListener(this.mWebSocketListener);
} catch (IOException e) {
Log.e(TAG, "IOException. Msg: "+e.getMessage());
} catch(NullPointerException e){
Log.e(TAG, "NullPointerException at WebsocketWorkerThreas. Msg: "+e.getMessage());
}
} }
} }
@ -110,16 +125,28 @@ public class WebSocketThread extends Thread {
@Override @Override
public void run() { public void run() {
canChange = false; canChange = false;
// Moves the current Thread into the background // Moves the current Thread into the background
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND); android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
try { try {
/*
* If the initialization of the socket comes after
* */
if(factory==null){
factory = new WebSocketFactory().setConnectionTimeout(5000);
this.mWebSocket = factory.createSocket(this.mUrl);
this.mWebSocket.addListener(this.mWebSocketListener);
}
WebSocketThread.currentThreads.put(this.getId(),this); WebSocketThread.currentThreads.put(this.getId(),this);
mWebSocket.connect(); mWebSocket.connect();
} catch (WebSocketException e) {
} catch (final Exception e) {
Log.e(TAG, "WebSocketException. Msg: "+e.getMessage()); Log.e(TAG, "WebSocketException. Msg: "+e.getMessage());
} catch(NullPointerException e){
Log.e(TAG, "NullPointerException. Msg: "+e.getMessage());
} }
WebSocketThread.currentThreads.remove(this.getId()); WebSocketThread.currentThreads.remove(this.getId());
} }
@ -127,4 +154,9 @@ public class WebSocketThread extends Thread {
public boolean isConnected(){ public boolean isConnected(){
return mWebSocket.isOpen(); return mWebSocket.isOpen();
} }
public void setmUrl(String mUrl) {
this.mUrl = mUrl;
}
} }

View file

@ -1,5 +1,7 @@
package cy.agorise.crystalwallet.requestmanagers; package cy.agorise.crystalwallet.requestmanagers;
import android.app.Activity;
import cy.agorise.crystalwallet.enums.CryptoCoin; import cy.agorise.crystalwallet.enums.CryptoCoin;
/** /**
@ -19,6 +21,13 @@ public abstract class CryptoNetInfoRequest {
*/ */
protected CryptoNetInfoRequestListener listener; protected CryptoNetInfoRequestListener listener;
protected CryptoNetInfoRequest(CryptoCoin coin){ protected CryptoNetInfoRequest(CryptoCoin coin){
this.coin = coin; this.coin = coin;
} }
@ -31,4 +40,5 @@ public abstract class CryptoNetInfoRequest {
listener.onCarryOut(); listener.onCarryOut();
CryptoNetInfoRequests.getInstance().removeRequest(this); CryptoNetInfoRequests.getInstance().removeRequest(this);
} }
} }

View file

@ -0,0 +1,307 @@
package cy.agorise.crystalwallet.util;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.support.v4.view.MotionEventCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.ListView;
import android.widget.ScrollView;
/**
* Found this class on the internet and did some changes do adjust it to our
* needs but I still need to figure out some stuff to obtain the exact desired
* animation
*/
public class BounceTouchListener implements View.OnTouchListener {
private static final long DEFAULT_ANIMATION_TIME = 600L;
private boolean downCalled = false;
private OnTranslateListener onTranslateListener;
private View mMainView;
private View mContent;
private float mDownY;
private boolean mSwipingDown;
private boolean mSwipingUp;
private Interpolator mInterpolator = new DecelerateInterpolator(3f);
private boolean swipeUpEnabled = true;
private int mActivePointerId = -99;
private float mLastTouchY = -99;
private int mMaxAbsTranslation = -99;
private BounceTouchListener(View mainView, int contentResId, @Nullable OnTranslateListener listener) {
mMainView = mainView;
mContent = (contentResId == -1) ? mMainView : mMainView.findViewById(contentResId);
onTranslateListener = listener;
}
/**
* Creates a new BounceTouchListener
*
* @param mainScrollableView The main view that this touch listener is attached to
* @param onTranslateListener To perform action on translation, can be null if not needed
* @return A new BounceTouchListener attached to the given scrollable view
*/
public static BounceTouchListener create(View mainScrollableView, @Nullable OnTranslateListener onTranslateListener) {
return create(mainScrollableView, -1, onTranslateListener);
}
/**
* Creates a new BounceTouchListener
*
* @param mainView The main view that this touch listener is attached to
* @param contentResId Resource Id of the scrollable view
* @param onTranslateListener To perform action on translation, can be null if not needed
* @return A new BounceTouchListener attached to the given scrollable view
*/
public static BounceTouchListener create(View mainView, @IdRes int contentResId,
@Nullable OnTranslateListener onTranslateListener) {
return new BounceTouchListener(mainView, contentResId, onTranslateListener);
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
final int action = MotionEventCompat.getActionMasked(motionEvent);
switch (action) {
case MotionEvent.ACTION_DOWN: {
onDownMotionEvent(motionEvent);
view.onTouchEvent(motionEvent);
downCalled = true;
if (mContent.getTranslationY() == 0) {
return false;
}
}
case MotionEvent.ACTION_MOVE: {
if (mActivePointerId == -99) {
onDownMotionEvent(motionEvent);
downCalled = true;
}
final int pointerIndex =
MotionEventCompat.findPointerIndex(motionEvent, mActivePointerId);
final float y = MotionEventCompat.getY(motionEvent, pointerIndex);
if (!hasHitTop() && !hasHitBottom() || !downCalled) {
if (!downCalled) {
downCalled = true;
}
mDownY = y;
view.onTouchEvent(motionEvent);
return false;
}
float deltaY = y - mDownY;
if (Math.abs(deltaY) > 0 && hasHitTop() && deltaY > 0) {
mSwipingDown = true;
sendCancelEventToView(view, motionEvent);
}
if (swipeUpEnabled) {
if (Math.abs(deltaY) > 0 && hasHitBottom() && deltaY < 0) {
mSwipingUp = true;
sendCancelEventToView(view, motionEvent);
}
}
if (mSwipingDown || mSwipingUp) {
if ((deltaY <= 0 && mSwipingDown) || (deltaY >= 0 && mSwipingUp)) {
mDownY = 0;
mSwipingDown = false;
mSwipingUp = false;
downCalled = false;
MotionEvent downEvent = MotionEvent.obtain(motionEvent);
downEvent.setAction(MotionEvent.ACTION_DOWN |
(MotionEventCompat.getActionIndex(motionEvent) << MotionEventCompat.ACTION_POINTER_INDEX_SHIFT));
view.onTouchEvent(downEvent);
break;
}
int translation = (int) ((deltaY / Math.abs(deltaY)) * Math.pow(Math.abs(deltaY), .8f));
if (mMaxAbsTranslation > 0) {
if (translation < 0) {
translation = Math.max(-mMaxAbsTranslation, translation);
} else {
translation = Math.min(mMaxAbsTranslation, translation);
}
}
mContent.setTranslationY(translation);
if (onTranslateListener != null)
onTranslateListener.onTranslate(mContent.getTranslationY());
return true;
}
break;
}
case MotionEvent.ACTION_UP: {
mActivePointerId = -99;
// cancel
mContent.animate()
.setInterpolator(mInterpolator)
.translationY(0)
.setDuration(DEFAULT_ANIMATION_TIME)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
((ValueAnimator) animation).addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
if (onTranslateListener != null) {
onTranslateListener.onTranslate(mContent.getTranslationY());
}
}
});
super.onAnimationStart(animation);
}
});
mDownY = 0;
mSwipingDown = false;
mSwipingUp = false;
downCalled = false;
break;
}
case MotionEvent.ACTION_CANCEL: {
mActivePointerId = -99;
break;
}
case MotionEvent.ACTION_POINTER_UP: {
final int pointerIndex = MotionEventCompat.getActionIndex(motionEvent);
final int pointerId = MotionEventCompat.getPointerId(motionEvent, pointerIndex);
if (pointerId == mActivePointerId) {
final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
mLastTouchY = MotionEventCompat.getY(motionEvent, newPointerIndex);
mActivePointerId = MotionEventCompat.getPointerId(motionEvent, newPointerIndex);
if (mContent.getTranslationY() > 0) {
mDownY = mLastTouchY - (int) Math.pow(mContent.getTranslationY(), 10f / 8f);
mContent.animate().cancel();
} else if (mContent.getTranslationY() < 0) {
mDownY = mLastTouchY + (int) Math.pow(-mContent.getTranslationY(), 10f / 8f);
mContent.animate().cancel();
}
}
break;
}
}
return false;
}
private void sendCancelEventToView(View view, MotionEvent motionEvent) {
((ViewGroup) view).requestDisallowInterceptTouchEvent(true);
MotionEvent cancelEvent = MotionEvent.obtain(motionEvent);
cancelEvent.setAction(MotionEvent.ACTION_CANCEL |
(MotionEventCompat.getActionIndex(motionEvent) << MotionEventCompat.ACTION_POINTER_INDEX_SHIFT));
view.onTouchEvent(cancelEvent);
}
private void onDownMotionEvent(MotionEvent motionEvent) {
final int pointerIndex = MotionEventCompat.getActionIndex(motionEvent);
mLastTouchY = MotionEventCompat.getY(motionEvent, pointerIndex);
mActivePointerId = MotionEventCompat.getPointerId(motionEvent, 0);
if (mContent.getTranslationY() > 0) {
mDownY = mLastTouchY - (int) Math.pow(mContent.getTranslationY(), 10f / 8f);
mContent.animate().cancel();
} else if (mContent.getTranslationY() < 0) {
mDownY = mLastTouchY + (int) Math.pow(-mContent.getTranslationY(), 10f / 8f);
mContent.animate().cancel();
} else {
mDownY = mLastTouchY;
}
}
private boolean hasHitBottom() {
if (mMainView instanceof ScrollView) {
ScrollView scrollView = (ScrollView) mMainView;
View view = scrollView.getChildAt(scrollView.getChildCount() - 1);
int diff = (view.getBottom() - (scrollView.getHeight() + scrollView.getScrollY()));// Calculate the scrolldiff
return diff == 0;
} else if (mMainView instanceof ListView) {
ListView listView = (ListView) mMainView;
if (listView.getAdapter() != null) {
if (listView.getAdapter().getCount() > 0) {
return listView.getLastVisiblePosition() == listView.getAdapter().getCount() - 1 &&
listView.getChildAt(listView.getChildCount() - 1).getBottom() <= listView.getHeight();
}
}
} else if (mMainView instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) mMainView;
if (recyclerView.getAdapter() != null && recyclerView.getLayoutManager() != null) {
RecyclerView.Adapter adapter = recyclerView.getAdapter();
if (adapter.getItemCount() > 0) {
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (layoutManager instanceof LinearLayoutManager) {
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager;
return linearLayoutManager.findLastCompletelyVisibleItemPosition() == adapter.getItemCount() - 1;
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
int[] checks = staggeredGridLayoutManager.findLastCompletelyVisibleItemPositions(null);
for (int check : checks) {
if (check == adapter.getItemCount() - 1)
return true;
}
}
}
}
}
return false;
}
private boolean hasHitTop() {
if (mMainView instanceof ScrollView) {
ScrollView scrollView = (ScrollView) mMainView;
return scrollView.getScrollY() == 0;
} else if (mMainView instanceof ListView) {
ListView listView = (ListView) mMainView;
if (listView.getAdapter() != null) {
if (listView.getAdapter().getCount() > 0) {
return listView.getFirstVisiblePosition() == 0 &&
listView.getChildAt(0).getTop() >= 0;
}
}
} else if (mMainView instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) mMainView;
if (recyclerView.getAdapter() != null && recyclerView.getLayoutManager() != null) {
RecyclerView.Adapter adapter = recyclerView.getAdapter();
if (adapter.getItemCount() > 0) {
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (layoutManager instanceof LinearLayoutManager) {
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager;
return linearLayoutManager.findFirstCompletelyVisibleItemPosition() == 0;
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
int[] checks = staggeredGridLayoutManager.findFirstCompletelyVisibleItemPositions(null);
for (int check : checks) {
if (check == 0)
return true;
}
}
}
}
}
return false;
}
public void setMaxAbsTranslation(int maxAbsTranslation) {
this.mMaxAbsTranslation = maxAbsTranslation;
}
public interface OnTranslateListener {
void onTranslate(float translation);
}
}

View file

@ -0,0 +1,38 @@
package cy.agorise.crystalwallet.util
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces.UIValidator
import java.util.ArrayList
class FieldsValidator {
/*
* Contains the fields to validate
* */
private var fields: MutableList<UIValidator> = ArrayList()
/*
* Setters and getters
* */
fun setFields(fields: List<UIValidator>) {
this.fields = fields as MutableList<UIValidator>
}
/*
* Endo of setters and getters
* */
/*
* Validate all the fields
* */
fun validate() {
for (uiValidator in fields) {
uiValidator.validate()
}
}
/*
* Add component to the list
* */
fun add(uiValidator: UIValidator) {
this.fields.add(uiValidator)
}
}

View file

@ -1,39 +0,0 @@
package cy.agorise.crystalwallet.viewmodels;
import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.arch.lifecycle.LiveData;
import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.models.AccountSeed;
/**
* Created by Henry Varona on 27/9/2017.
*/
public class AccountSeedViewModel extends AndroidViewModel {
private LiveData<AccountSeed> accountSeed;
private CrystalDatabase db;
private Application app;
public AccountSeedViewModel(Application application) {
super(application);
this.db = CrystalDatabase.getAppDatabase(application.getApplicationContext());
this.app = application;
}
public void loadSeed(long seedId){
this.accountSeed = this.db.accountSeedDao().findByIdLiveData(seedId);
}
public void addSeed(AccountSeed seed){
long newId = this.db.accountSeedDao().insertAccountSeed(seed);
seed.setId(newId);
}
public LiveData<AccountSeed> getAccountSeed(){
return this.accountSeed;
}
}

View file

@ -0,0 +1,31 @@
package cy.agorise.crystalwallet.viewmodels
import android.app.Application
import android.arch.lifecycle.AndroidViewModel
import android.arch.lifecycle.LiveData
import cy.agorise.crystalwallet.dao.CrystalDatabase
import cy.agorise.crystalwallet.models.AccountSeed
class AccountSeedViewModel(application: Application) : AndroidViewModel(application) {
private var accountSeed: LiveData<AccountSeed>? = null
private val db: CrystalDatabase
private val app: Application = application
init{
this.db = CrystalDatabase.getAppDatabase(this.app.getApplicationContext());
}
fun loadSeed(seedId: Long) {
this.accountSeed = this.db.accountSeedDao().findByIdLiveData(seedId)
}
fun addSeed(seed: AccountSeed) {
val newId = this.db.accountSeedDao().insertAccountSeed(seed)
seed.id = newId
}
fun getAccountSeed(): LiveData<AccountSeed>? {
return this.accountSeed
}
}

View file

@ -32,16 +32,6 @@ public class ContactListViewModel extends AndroidViewModel {
).build(); ).build();
} }
public void init(){
contactList = new LivePagedListBuilder(this.db.contactDao().contactsByName(),
new PagedList.Config.Builder()
.setEnablePlaceholders(true)
.setPageSize(10)
.setPrefetchDistance(10)
.build()
).build();
}
public void init(CryptoNet cryptoNet){ public void init(CryptoNet cryptoNet){
contactList = new LivePagedListBuilder(this.db.contactDao().contactsByNameAndCryptoNet(cryptoNet.name()), contactList = new LivePagedListBuilder(this.db.contactDao().contactsByNameAndCryptoNet(cryptoNet.name()),
new PagedList.Config.Builder() new PagedList.Config.Builder()

View file

@ -15,9 +15,8 @@ import cy.agorise.crystalwallet.viewmodels.validators.validationfields.PinValida
public class CreateContactValidator extends UIValidator { public class CreateContactValidator extends UIValidator {
public CreateContactValidator(Context context, EditText nameEdit, EditText emailEdit){ public CreateContactValidator(Context context, EditText nameEdit){
super(context); super(context);
this.addField(new ContactNameValidationField(nameEdit)); this.addField(new ContactNameValidationField(nameEdit));
this.addField(new EmailValidationField(emailEdit));
} }
} }

View file

@ -13,9 +13,8 @@ import cy.agorise.crystalwallet.viewmodels.validators.validationfields.EmailVali
public class ModifyContactValidator extends UIValidator { public class ModifyContactValidator extends UIValidator {
public ModifyContactValidator(Context context, Contact contact, EditText nameEdit, EditText emailEdit){ public ModifyContactValidator(Context context, Contact contact, EditText nameEdit){
super(context); super(context);
this.addField(new ContactNameValidationField(nameEdit, contact)); this.addField(new ContactNameValidationField(nameEdit, contact));
this.addField(new EmailValidationField(emailEdit));
} }
} }

View file

@ -4,6 +4,8 @@ import android.content.Context;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
import com.jaredrummler.materialspinner.MaterialSpinner;
import cy.agorise.crystalwallet.models.CryptoNetAccount; import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.AmountValidationField; import cy.agorise.crystalwallet.viewmodels.validators.validationfields.AmountValidationField;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.AssetValidationField; import cy.agorise.crystalwallet.viewmodels.validators.validationfields.AssetValidationField;
@ -20,7 +22,7 @@ public class SendTransactionValidator extends UIValidator {
private CryptoNetAccount account; private CryptoNetAccount account;
public SendTransactionValidator(Context context, CryptoNetAccount account, Spinner fromEdit, EditText toEdit, Spinner assetSpinner, EditText amountEdit, EditText memoEdit){ public SendTransactionValidator(Context context, CryptoNetAccount account, MaterialSpinner fromEdit, EditText toEdit, Spinner assetSpinner, EditText amountEdit, EditText memoEdit){
super(context); super(context);
this.account = account; this.account = account;
this.addField(new FromValidationField(fromEdit)); this.addField(new FromValidationField(fromEdit));

View file

@ -0,0 +1,9 @@
package cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces
/*
* Interface that all the views that need validation can use
* */
interface UIValidator {
fun validate()
}

View file

@ -0,0 +1,12 @@
package cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields.CustomValidationField
/*
* Listener to deliver response to controls from inner validations
* */
interface UIValidatorListener {
fun onValidationFailed(customValidationField: CustomValidationField)
fun onValidationSucceeded(customValidationField: CustomValidationField)
}

View file

@ -0,0 +1,227 @@
package cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields
import android.app.Activity
import cy.agorise.crystalwallet.R
import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator
import cy.agorise.crystalwallet.dialogs.material.CrystalDialog
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests
import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces.UIValidator
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces.UIValidatorListener
import cy.agorise.crystalwallet.views.natives.CustomTextInputEditText
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener
/*
*
* Validation layer for Account Name
* */
class BitsharesAccountNameValidation : CustomValidationField, UIValidator {
/*
* Contains the field to validate
* */
private val accountNameField: CustomTextInputEditText
/*
* Interface to validate when an account exist an take over control it
* */
private var onAccountExist: OnAccountExist? = null
constructor ( activity: Activity,
accountNameField: CustomTextInputEditText,
uiValidatorListener: UIValidatorListener) : super(activity) {
this.accountNameField = accountNameField
this.uiValidatorListener = uiValidatorListener
/*
* The current view for errors will be this
* */
this.currentView = this.accountNameField
}
override fun validate() {
val newValue = accountNameField.text.toString()
/*
Contains the validation result
*/
var result = true
/*
* Validate empty field
* */
if (newValue == "") {
/*
* Validation not passed
* */
result = false
accountNameField.fieldValidatorModel.setInvalid()
accountNameField.fieldValidatorModel.message = this.accountNameField.resources.getString(R.string.create_account_window_err_account_empty)
} else {
/*
* Remove error
* */
accountNameField.error = null
/*
Validate at least min length
*/
if (newValue.length < 10) {
/*
* Validation not passed
* */
result = false
accountNameField.fieldValidatorModel.setInvalid()
accountNameField.fieldValidatorModel.message = this.accountNameField.resources.getString(R.string.create_account_window_err_min_account_name_len)
} else {
/*
* Remove error
* */
accountNameField.error = null
/*
Validate at least one character
*/
if (!newValue.matches(".*[a-zA-Z]+.*".toRegex())) {
/*
* Validation not passed
* */
result = false
accountNameField.fieldValidatorModel.setInvalid()
accountNameField.fieldValidatorModel.message = this.accountNameField.resources.getString(R.string.create_account_window_err_at_least_one_character)
} else {
/*
* Remove error
* */
accountNameField.error = null
/*
Validate at least one number for the account string
*/
if (!newValue.matches(".*\\d+.*".toRegex())) {
/*
* Validation not passed
* */
result = false
accountNameField.fieldValidatorModel.setInvalid()
accountNameField.fieldValidatorModel.message = this.accountNameField.resources.getString(R.string.create_account_window_err_at_least_one_number)
} else {
/*
* Remove error
* */
accountNameField.error = null
/*
Validate at least one middle script
*/
if (!newValue.contains("-")) {
/*
* Validation not passed
* */
result = false
accountNameField.fieldValidatorModel.setInvalid()
accountNameField.fieldValidatorModel.message = this.accountNameField.resources.getString(R.string.create_account_window_err_at_least_one_script)
} else {
/*
* Remove error
* */
accountNameField.error = null
}
}
}
}
}
/*
* If passed first validations
* */
if (!result) {
/*
* Deliver result
* */
if (uiValidatorListener != null) {
uiValidatorListener.onValidationFailed(this)
}
} else {
/*
* Show the dialog for connection with the server
* */
val creatingAccountMaterialDialog = CrystalDialog(activity)
creatingAccountMaterialDialog.setText(activity.resources.getString(R.string.window_create_seed_Server_validation))
creatingAccountMaterialDialog.build()
creatingAccountMaterialDialog.show()
val request = ValidateExistBitsharesAccountRequest(newValue)
request.setListener {
/*
* Dismiss the dialog of loading
* */
creatingAccountMaterialDialog.dismiss()
if (request.accountExists) {
/*
* The account exists and is not valid
* */
accountNameField.fieldValidatorModel.setInvalid()
accountNameField.fieldValidatorModel.message = accountNameField.resources.getString(R.string.account_name_already_exist)
} else {
/*
* Passed all validations
* */
accountNameField.fieldValidatorModel.setValid()
/*
* Deliver the response
* */
if (uiValidatorListener != null) {
uiValidatorListener.onValidationSucceeded(globalCustomValidationField)
}
}
}
CryptoNetInfoRequests.getInstance().addRequest(request)
}
/*
* Passed initial validations, next final validations
* */
}
/*
* Setters and getters
* */
fun setOnAccountExist(onAccountExist: OnAccountExist) {
this.onAccountExist = onAccountExist
}
/*
* End of setters and getters
* */
/*
* Interface to validate when an account exist an take over control it
* */
open interface OnAccountExist {
fun onAccountExists()
}
}

View file

@ -0,0 +1,43 @@
package cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields
import android.app.Activity
import android.view.View
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces.UIValidatorListener
open class CustomValidationField {
/*
* Listener to deliver response to controller
* */
protected lateinit var uiValidatorListener: UIValidatorListener
/*
* Contains the field to validate
* */
@JvmField var currentView : View? = null
/*
* Contains a handler to my self
* */
@JvmField protected var globalCustomValidationField: CustomValidationField
/*
* Contains the acivity for utility
* */
@JvmField protected var activity: Activity
constructor(activity:Activity){
/*
* Save the activity
* */
this.activity = activity
/*
* Init the custom field for later references
* */
this.globalCustomValidationField = this
}
}

View file

@ -0,0 +1,131 @@
package cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields
import android.app.Activity
import cy.agorise.crystalwallet.R
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces.UIValidator
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces.UIValidatorListener
import cy.agorise.crystalwallet.views.natives.CustomTextInputEditText
/*
* Validate PIN and PIN confirmation
* */
class PinDoubleConfirmationValidationField : CustomValidationField, UIValidator {
/*
* Contain the fields to validate
* */
private val pinField: CustomTextInputEditText
private val pinConfirmationField: CustomTextInputEditText
constructor(activity: Activity,
pinField: CustomTextInputEditText,
pinConfirmationField: CustomTextInputEditText,
pinDoubleConfirmationInterface: UIValidatorListener) : super(activity) {
this.pinField = pinField
this.pinConfirmationField = pinConfirmationField
this.uiValidatorListener = pinDoubleConfirmationInterface
}
override fun validate() {
val pin = pinField.text.toString().trim { it <= ' ' }
val pinConfirmation = pinConfirmationField.text.toString().trim { it <= ' ' }
/*
* Contains the result for the validations
* */
var result = true
/*
Check if the two fields are equals theme selfs
* */
if (pin.length < 5) {
/*
*
* False validation
* */
pinField.fieldValidatorModel.message = this.pinField.context.resources.getString(R.string.create_account_window_err_at_least_pin_characters)
result = false
/*
* The current view for error
* */
this.currentView = pinField
} else {
/*Remove the error*/
pinField.error = null
/*
* Same validation for PIN Confirmation
* */
if (pinConfirmation.length < 5) {
/*
*
* False validation
* */
pinConfirmationField.fieldValidatorModel.message = this.pinField.context.resources.getString(R.string.create_account_window_err_at_least_pin_characters)
result = false
/*
* The current view for error
* */
this.currentView = pinConfirmationField
} else {
/*Remove the error*/
pinField.error = null
/*
* Final validation, check if the PINs are equals
*
* */
if (!pin.isEmpty() && !pinConfirmation.isEmpty() && pinConfirmation.compareTo(pin) != 0) {
/*
*
* False validation
* */
pinField.fieldValidatorModel.message = this.pinField.context.resources.getString(R.string.mismatch_pin)
pinConfirmationField.fieldValidatorModel.message = this.pinField.context.resources.getString(R.string.mismatch_pin)
result = false
/*
* The current view for error
* */
this.currentView = pinConfirmationField
}
}
}
/*
* Passed validations
* */
if (result) {
pinField.fieldValidatorModel.setValid()
pinConfirmationField.fieldValidatorModel.setValid()
/*
* Connect response to controller
* */
if (uiValidatorListener != null) {
uiValidatorListener.onValidationSucceeded(this)
}
} else {
/*
* Connect response to controller
* */
if (uiValidatorListener != null) {
uiValidatorListener.onValidationFailed(this)
}
}/*
* Not passed validations
* */
}
}

View file

@ -21,15 +21,47 @@ public class BitsharesAccountNameDoesntExistsValidationField extends ValidationF
} }
public void validate(){ public void validate(){
final String newValue = accountNameField.getText().toString(); final String newValue = accountNameField.getText().toString();
this.setLastValue(newValue); this.setLastValue(newValue);
this.startValidating(); this.startValidating();
/*
* Validate empty field
* */
if (newValue.equals("")){ if (newValue.equals("")){
setValidForValue("", false); setValidForValue("", false);
setMessageForValue("",""); setMessageForValue("","");
validator.validationFailed(this); validator.validationFailed(this);
} else { }
/*
Validate at least min length
*/
else if(newValue.length()<10){
setValidForValue("", false);
setMessageForValue(validator.getContext().getResources().getString(R.string.create_account_window_err_min_account_name_len),"");
validator.validationFailed(this);
}
/*
Validate at least one number for the account string
*/
else if(!newValue.matches(".*\\\\d+.*")){
setValidForValue("", false);
setMessageForValue(validator.getContext().getResources().getString(R.string.create_account_window_err_at_least_one_number),"");
validator.validationFailed(this);
}
/*
Validate at least one middle script
*/
else if(!newValue.contains("-")){
setValidForValue("", false);
setMessageForValue(accountNameField.getContext().getResources().getString(R.string.create_account_window_err_at_least_one_number),"");
validator.validationFailed(this);
}
/*
* Passed all primary validations
* */
else {
final ValidationField field = this; final ValidationField field = this;
@ -37,11 +69,17 @@ public class BitsharesAccountNameDoesntExistsValidationField extends ValidationF
request.setListener(new CryptoNetInfoRequestListener() { request.setListener(new CryptoNetInfoRequestListener() {
@Override @Override
public void onCarryOut() { public void onCarryOut() {
if (request.getAccountExists()) { if (request.getAccountExists()) {
/*
* The account exists and is not valid
* */
setMessageForValue(newValue,validator.getContext().getResources().getString(R.string.account_name_already_exist,"'"+newValue+"'")); setMessageForValue(newValue,validator.getContext().getResources().getString(R.string.account_name_already_exist,"'"+newValue+"'"));
setValidForValue(newValue, false); setValidForValue(newValue, false);
} else { } else {
setValidForValue(newValue, true); setValidForValue(newValue, true);
} }
} }
}); });

View file

@ -2,7 +2,10 @@ package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.Spinner; import android.widget.Spinner;
import com.jaredrummler.materialspinner.MaterialSpinner;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest;
@ -14,9 +17,9 @@ import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountReq
public class FromValidationField extends ValidationField { public class FromValidationField extends ValidationField {
//private EditText fromField; //private EditText fromField;
private Spinner fromField; private MaterialSpinner fromField;
public FromValidationField(Spinner fromField){ public FromValidationField(MaterialSpinner fromField){
super(fromField); super(fromField);
this.fromField = fromField; this.fromField = fromField;
} }
@ -24,8 +27,9 @@ public class FromValidationField extends ValidationField {
public void validate(){ public void validate(){
final String newValue; final String newValue;
if (fromField.getSelectedItem() != null) { if (fromField.getSelectedIndex() != -1) {
newValue = fromField.getSelectedItem().toString(); final CryptoNetAccount cryptoNetAccount = (CryptoNetAccount) fromField.getItems().get(fromField.getSelectedIndex());
newValue = cryptoNetAccount.getName();
} else { } else {
newValue = ""; newValue = "";
} }

View file

@ -0,0 +1,11 @@
package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces.UIValidator;
public class PinValidationField_ implements UIValidator {
@Override
public void validate() {
}
}

View file

@ -3,7 +3,10 @@ package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
import com.jaredrummler.materialspinner.MaterialSpinner;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest;
@ -14,10 +17,10 @@ import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountReq
public class ToValidationField extends ValidationField { public class ToValidationField extends ValidationField {
private Spinner fromField; private MaterialSpinner fromField;
private EditText toField; private EditText toField;
public ToValidationField(Spinner fromField, EditText toField){ public ToValidationField(MaterialSpinner fromField, EditText toField){
super(toField); super(toField);
this.fromField = fromField; this.fromField = fromField;
this.toField = toField; this.toField = toField;
@ -25,8 +28,9 @@ public class ToValidationField extends ValidationField {
public void validate(){ public void validate(){
final String fromNewValue; final String fromNewValue;
if (fromField.getSelectedItem() != null) { if (fromField.getSelectedIndex() != -1) {
fromNewValue = fromField.getSelectedItem().toString(); final CryptoNetAccount cryptoNetAccount = (CryptoNetAccount) fromField.getItems().get(fromField.getSelectedIndex());
fromNewValue = cryptoNetAccount.getName();
} else { } else {
fromNewValue = ""; fromNewValue = "";
} }

View file

@ -18,6 +18,10 @@ public abstract class ValidationField {
protected UIValidator validator; protected UIValidator validator;
protected View view; protected View view;
public ValidationField(View view){ public ValidationField(View view){
this.lastValue = ""; this.lastValue = "";
this.message = ""; this.message = "";

View file

@ -1,111 +0,0 @@
package cy.agorise.crystalwallet.views;
import android.arch.paging.PagedList;
import android.content.Context;
import android.support.v4.app.Fragment;
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 cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.models.Contact;
import cy.agorise.crystalwallet.viewmodels.ContactListViewModel;
/**
* Created by Henry Varona on 1/15/2018.
*
* A list view showing the user contacts
*/
public class ContactListView extends RelativeLayout {
LayoutInflater mInflater;
/*
* The root view of this view
*/
View rootView;
/*
* The list view that holds every user contact item
*/
RecyclerView listView;
/*
* The adapter for the previous list view
*/
ContactListAdapter listAdapter;
ContactListViewModel contactListViewModel;
/*
* how much contacts will remain to show before the list loads more
*/
private int visibleThreshold = 5;
/*
* if true, the contact list will be loading new data
*/
private boolean loading = true;
/*
* One of three constructors needed to be inflated from a layout
*/
public ContactListView(Context context){
super(context);
this.mInflater = LayoutInflater.from(context);
init();
}
/*
* One of three constructors needed to be inflated from a layout
*/
public ContactListView(Context context, AttributeSet attrs) {
super(context, attrs);
this.mInflater = LayoutInflater.from(context);
init();
}
/*
* One of three constructors needed to be inflated from a layout
*/
public ContactListView(Context context, AttributeSet attrs, int defStyle){
super(context, attrs, defStyle);
this.mInflater = LayoutInflater.from(context);
init();
}
/*
* Initializes this view
*/
public void init(){
rootView = mInflater.inflate(R.layout.contact_list, this, true);
this.listView = rootView.findViewById(R.id.contactListView);
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.getContext());
this.listView.setLayoutManager(linearLayoutManager);
//Prevents the list to start again when scrolling to the end
//this.listView.setNestedScrollingEnabled(false);
}
/*
* Sets the elements data of this view
*
* @param data the contacts that will be showed to the user
*/
public void setData(PagedList<Contact> data){
//Initializes the adapter of the contact list
if (this.listAdapter == null) {
this.listAdapter = new ContactListAdapter();
this.listView.setAdapter(this.listAdapter);
}
//Sets the data of the transaction list
if (data != null) {
this.listAdapter.submitList(data);
}
}
}

View file

@ -78,7 +78,8 @@ public class ContactViewHolder extends RecyclerView.ViewHolder {
Picasso.with(this.context) Picasso.with(this.context)
.load(gravatarUrl) .load(gravatarUrl)
.transform(new CircleTransformation()) .placeholder(R.drawable.avatar_placeholder)
//.transform(new CircleTransformation())
.into(ivThumbnail); .into(ivThumbnail);
} }

View file

@ -192,7 +192,14 @@ public class CryptoNetBalanceViewHolder extends RecyclerView.ViewHolder {
} else { } else {
final CryptoNetBalanceViewHolder thisViewHolder = this; final CryptoNetBalanceViewHolder thisViewHolder = this;
this.cryptoNetAccountId = balance.getAccountId(); this.cryptoNetAccountId = balance.getAccountId();
cryptoNetName.setText(balance.getCryptoNet().getLabel());
/*
* The first letter should be in mayus
* */
final String crypto = balance.getCryptoNet().getLabel().toString().toLowerCase();
final String upperString = crypto.substring(0,1).toUpperCase() + crypto.substring(1);
cryptoNetName.setText(upperString);
//Loads the crypto coin balance list of this account using a ViewModel and retrieving a LiveData List //Loads the crypto coin balance list of this account using a ViewModel and retrieving a LiveData List
CryptoCoinBalanceListViewModel cryptoCoinBalanceListViewModel = ViewModelProviders.of(this.fragment).get(CryptoCoinBalanceListViewModel.class); CryptoCoinBalanceListViewModel cryptoCoinBalanceListViewModel = ViewModelProviders.of(this.fragment).get(CryptoCoinBalanceListViewModel.class);

View file

@ -0,0 +1,70 @@
package cy.agorise.crystalwallet.views.natives;
import android.content.Context;
import android.support.design.widget.TextInputEditText;
import android.util.AttributeSet;
import android.view.View;
import cy.agorise.crystalwallet.models.FieldValidatorModel;
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces.UIValidator;
/*
* Custom implementation of the native control to get more over control it
* */
public class CustomTextInputEditText extends TextInputEditText implements UIValidator {
/*
* Contains the field validator, this aid to validate the field
* */
private FieldValidatorModel fieldValidatorModel = new FieldValidatorModel();
/*
* Interface to validate the field
* */
private UIValidator uiValidator;
/*
* Contains the last input value
* */
private String lastValue;
public CustomTextInputEditText(Context context, AttributeSet attrs) {
super(context, attrs);
/*
* Set listener to get the last value of the control
* */
this.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus){
lastValue = getText().toString();
}
}
});
}
public void setFieldValidatorModel(FieldValidatorModel fieldValidatorModel) {
this.fieldValidatorModel = fieldValidatorModel;
}
public void setUiValidator(UIValidator uiValidator) {
this.uiValidator = uiValidator;
}
public FieldValidatorModel getFieldValidatorModel() {
return fieldValidatorModel;
}
public String getLastValue() {
return lastValue;
}
/*
* End of setters and getters
* */
@Override
public void validate() {
uiValidator.validate();
}
}

View file

@ -0,0 +1,37 @@
package cy.agorise.crystalwallet.views.natives
import android.content.Context
import android.util.AttributeSet
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import cy.agorise.crystalwallet.R
/*
* GIF implementation based on existing imageview class
* */
class GIFView : ImageView {
/*
* Contains aditional options for the gif
* */
private var options: RequestOptions? = RequestOptions()
constructor(context:Context,attrs: AttributeSet?) : super(context,attrs) {
}
/*
* Load the gif
* */
fun load(rawID:Int){
Glide.with(this).asGif().load(rawID).apply(options!!).into(this)
}
/*
* Option to fit the gif in the container
* */
fun centerCrop(){
options!!.centerCrop()
}
}

View file

@ -0,0 +1,34 @@
package cy.agorise.crystalwallet.views.natives
import android.content.Context
import android.net.Uri
import android.util.AttributeSet
import android.widget.VideoView
import cy.agorise.crystalwallet.R
import kotlinx.android.synthetic.main.empty_activity.*
/*
* Extensión for videoview
* */
class VideoExView(context: Context?, attrs: AttributeSet?) : VideoView(context, attrs) {
/*
* Set the path based on raw, this should be called first to set the video path
* */
fun setVideoRaw(rawID:Int){
val uriPath = "android.resource://" + context.packageName + "/" + R.raw.appbar_background
val uri = Uri.parse(uriPath)
this.setVideoURI(uri)
}
/*
* With this method the video play continues
* */
fun playContinius(){
start()
this.setOnCompletionListener {
start()
}
}
}

View file

@ -1,13 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"> <set xmlns:android="http://schemas.android.com/apk/res/android">
<!--DTVV: Friday July 28 2018
Change android:repeatCount="0" to android:repeatCount="1000"
-->
<rotate xmlns:android="http://schemas.android.com/apk/res/android" <rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0" android:fromDegrees="0"
android:pivotX="50%" android:pivotX="50%"
android:pivotY="50%" android:pivotY="50%"
android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="1000" android:duration="1000"
android:repeatCount="0" android:repeatCount="1000"
android:toDegrees="360" /> android:toDegrees="360" />
</set> </set>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<item android:right="5dp" android:top="5dp">
<shape>
<corners android:radius="3dp" />
<solid android:color="#D6D6D6" />
</shape>
</item>
<item android:bottom="2dp" android:left="2dp">
<shape>
<gradient android:angle="270"
android:endColor="#E2E2E2" android:startColor="#BABABA" />
<stroke android:width="1dp" android:color="#BABABA" />
<corners android:radius="4dp" />
<padding android:bottom="10dp" android:left="10dp"
android:right="10dp" android:top="10dp" />
</shape>
</item>
</layer-list>
</item>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -1,146 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:weightSum="3"
android:background="@color/white"
tools:context="cy.agorise.crystalwallet.activities.MainActivity">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:layout_alignParentTop="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="@string/account_create_register_or_import"
android:textSize="15dp"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:text="@string/txt_account_name"
android:textStyle="bold"/>
<EditText
android:id="@+id/etAccountName"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/edittext_bg"
android:maxLines="1"
android:singleLine="true"/>
<TextView
android:id="@+id/tvErrorAccountName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/red"
android:visibility="gone"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:id="@+id/tvPin"
android:text="@string/txt_6_digits_pin"
android:textStyle="bold"/>
<EditText
android:id="@+id/etPin"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/edittext_bg"
android:inputType="number"
android:maxLines="1"
android:singleLine="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:id="@+id/tvPinConfirmation"
android:text="@string/txt_6_digits_pin_confirm"
android:textStyle="bold"/>
<EditText
android:id="@+id/etPinConfirmation"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/edittext_bg"
android:inputType="number"
android:maxLines="1"
android:singleLine="true"/>
<Button
android:id="@+id/btnCreate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/create"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/or"
android:layout_margin="10dp"
android:id="@+id/tvOrAccount" />
<Button
android:id="@+id/tvExistingAccount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/existing_account"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:layout_gravity="bottom"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_gravity="bottom"
android:background="@color/bottomBarColor"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<TextView
android:id="@+id/tvAppVersion"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:background="@color/bottomBarColor"/>
<TextView
android:background="@color/bottomBarColor"
android:id="@+id/tvBlockNumberHead"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center"/>
<ImageView
android:id="@+id/ivSocketConnected"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_gravity="center"/>
<ImageView android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_gravity="center"
android:visibility="invisible"
android:src="@drawable/icon_setting"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -1,174 +1,88 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout
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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:focusableInTouchMode="true"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="@dimen/activity_vertical_margin"> android:paddingTop="@dimen/activity_vertical_margin">
<TextView <android.support.design.widget.TextInputLayout
android:id="@+id/tvName" android:id="@+id/tilName"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginEnd="@dimen/activity_horizontal_margin">
android:layout_marginTop="10dp"
android:text="Contact Name"
android:textStyle="bold" />
<EditText <android.support.design.widget.TextInputEditText
android:id="@+id/etName" android:id="@+id/tietName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:background="@drawable/edittext_bg"
android:maxLines="1"
android:textColor="@color/black" />
<TextView
android:id="@+id/tvNameError"
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:maxLines="1"
android:textColor="@color/red" />
<TextView
android:id="@+id/tvEmail"
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="Email"
android:textStyle="bold" />
<EditText
android:id="@+id/etEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:background="@drawable/edittext_bg"
android:maxLines="1"
android:textColor="@color/black" />
<TextView
android:id="@+id/tvEmailError"
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:maxLines="1"
android:textColor="@color/red" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/rvContactAddresses"
android:layout_width="match_parent"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
<Button
android:id="@+id/btnAddAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/rvContactAddresses"
android:text="Add"/>
</RelativeLayout>
<LinearLayout
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:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:background="@color/pink"
android:text="@string/cancel"
android:textColor="@color/white" />
<Button
android:id="@+id/btnCreate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:background="@color/green"
android:padding="10dp"
android:text="Create Contact"
android:textColor="@color/white" />
<Button
android:id="@+id/btnModify"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:background="@color/green"
android:padding="10dp"
android:text="Modify Contact"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="bottom"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/black"></LinearLayout> android:hint="Contact Name"
android:inputType="textPersonName"
android:maxLines="1"/>
<LinearLayout </android.support.design.widget.TextInputLayout>
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="@color/bottomBarColor"
android:gravity="bottom"
android:orientation="horizontal">
<TextView <Button
android:id="@+id/tvAppVersion_brain_key_activity" android:id="@+id/btnAddAddress"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_marginTop="@dimen/spacing_different_topic"
android:gravity="center" android:text="@string/add"
android:text="@string/v_1_0_beta" /> android:textStyle="bold"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
app:layout_constraintTop_toBottomOf="@id/tilName"
app:layout_constraintEnd_toEndOf="parent"/>
<TextView <TextView
android:id="@+id/tvBlockNumberHead_brain_key_activity" android:id="@+id/tvCryptoAddresses"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_weight="2" android:layout_marginTop="8dp"
android:gravity="center" android:layout_marginStart="@dimen/activity_horizontal_margin"
android:text="@string/block_number" /> android:text="Crypto addresses"
android:textAppearance="@style/TextAppearance.Body1"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="@id/btnAddAddress"
app:layout_constraintStart_toStartOf="parent"/>
<ImageView <android.support.v7.widget.RecyclerView
android:id="@+id/ivSocketConnected_brain_key_activity" android:id="@+id/rvContactAddresses"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_weight="0.5" /> android:layout_marginEnd="@dimen/activity_horizontal_margin"
app:layout_constraintTop_toBottomOf="@id/btnAddAddress"
tools:listitem="@layout/contact_address_list_item"
tools:itemCount="1"/>
<ImageView <Button
android:layout_width="0dp" android:id="@+id/btnCancel"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_gravity="center" android:layout_height="wrap_content"
android:layout_weight="0.5" android:layout_marginTop="@dimen/spacing_different_section"
android:src="@drawable/icon_setting" android:layout_marginStart="@dimen/activity_horizontal_margin"
android:visibility="invisible" /> android:theme="@style/RedButton"
</LinearLayout> android:text="@string/cancel"
</LinearLayout> app:layout_constraintTop_toBottomOf="@id/rvContactAddresses"
app:layout_constraintStart_toStartOf="parent"/>
</LinearLayout> <Button
android:id="@+id/btnCreate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:theme="@style/BlueButton"
android:text="Create"
app:layout_constraintTop_toTopOf="@id/btnCancel"
app:layout_constraintEnd_toEndOf="parent"/>
<cy.agorise.crystalwallet.util.BottomStatusBar
android:id="@+id/bottomStatusBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"/>
</android.support.constraint.ConstraintLayout>

View file

@ -1,34 +0,0 @@
<?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="match_parent"
android:orientation="vertical"
android:gravity="center"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<Button
android:id="@+id/tvImportBrainKey"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="@string/import_brainkey"/>
<Button
android:id="@+id/tvBackup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="@string/import_backup"
android:layout_marginTop="20dp" />
<Button
android:id="@+id/btnWifBackup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="@string/import_wif"
android:layout_marginTop="20dp"/>
</LinearLayout>

View file

@ -1,52 +1,91 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:background="@color/white"
android:paddingBottom="0dp" android:paddingBottom="0dp"
android:paddingLeft="0dp" android:paddingLeft="0dp"
android:paddingRight="0dp" android:paddingRight="0dp"
android:paddingTop="@dimen/activity_vertical_margin"> android:paddingTop="@dimen/activity_vertical_margin">
<TextView <RelativeLayout
android:id="@+id/tvMnemonicTitle" android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_centerInParent="true">
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="10dp"
android:text="@string/seed_words"
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tvMnemonic" android:id="@+id/tvMnemonicTitle"
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
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:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/btnOk"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_margin="10dp" android:layout_marginRight="@dimen/activity_horizontal_margin"
android:background="@color/pink" android:layout_marginTop="10dp"
android:text="@string/ok" android:layout_marginBottom="20dp"
android:textColor="@color/white" /> android:text="@string/window_seed_backup"
</LinearLayout> android:layout_centerHorizontal="true"
</LinearLayout> android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/tvBrainKey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvMnemonicTitle"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:gravity="center"
android:background="@drawable/edittext_bg"
android:layout_centerHorizontal="true"
android:textColor="@color/black"
android:layout_marginBottom="20dp"/>
<ImageView
android:id="@+id/backup_seeed_imageview_warning"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentStart="true"
android:layout_marginLeft="35dp"
android:layout_alignTop="@+id/backup_seed_textview_leyend_backup"
android:background="@drawable/warning" />
<TextView
android:id="@+id/backup_seed_textview_leyend_backup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:textColor="@color/send_strong_orange"
android:layout_marginRight="70dp"
android:text="@string/window_seed_leyend_backup"
android:textSize="14dp"
android:layout_below="@+id/tvBrainKey"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="20dp"
android:layout_below="@+id/backup_seed_textview_leyend_backup"
android:layout_centerHorizontal="true"
android:weightSum="2">
<Button
android:id="@+id/btnOk"
android:layout_weight="1"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:background="@drawable/ok"/>
<Button
android:id="@+id/btnCopy"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:text="@string/window_seed_copy"
android:textColor="@color/black" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>

View file

@ -25,8 +25,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:maxHeight="32dp" android:maxHeight="28dp"
android:maxWidth="32dp" android:maxWidth="28dp"
app:srcCompat="@drawable/bts" /> app:srcCompat="@drawable/bts" />
<TextView <TextView
@ -34,6 +34,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@id/ivCryptoNetIcon" android:layout_toRightOf="@id/ivCryptoNetIcon"
android:ems="10" android:ems="10"
android:text="unknown coin" /> android:text="unknown coin" />

View file

@ -3,16 +3,15 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activities.BoardActivity"> tools:context=".activities.BoardActivity">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height" android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
app:theme="@style/AppTheme.AppBarOverlay"> app:theme="@style/AppTheme.AppBarOverlay">
@ -21,6 +20,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:background="@color/red"
app:contentScrim="@color/transparent" app:contentScrim="@color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed" app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar"> app:toolbarId="@+id/toolbar">
@ -30,10 +30,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<View <cy.agorise.crystalwallet.views.natives.GIFView
android:id="@+id/imagevieGIF"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorPrimaryTransparent"/> />
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
@ -99,9 +100,14 @@
<android.support.design.widget.TabLayout <android.support.design.widget.TabLayout
android:id="@+id/tabLayout" android:id="@+id/tabLayout"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@color/transparent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:tabSelectedTextColor="@color/white"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
app:tabIndicatorHeight="0dp"
app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
app:tabTextColor="@color/lightGrayClear"
android:animateLayoutChanges="true" /> android:animateLayoutChanges="true" />
</android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.CollapsingToolbarLayout>

View file

@ -1,30 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout 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_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"> android:paddingTop="10dp">
<RelativeLayout <Spinner
android:id="@+id/spCryptoNet"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/etAddress"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_marginStart="8dp"/>
android:layout_alignParentTop="true">
<Spinner
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
android:id="@+id/spCryptoNet"/>
<EditText
android:id="@+id/etAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/spCryptoNet"
android:layout_alignParentEnd="true"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout> </LinearLayout>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -9,5 +10,6 @@
android:id="@+id/contactListView" android:id="@+id/contactListView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:listitem="@layout/contact_list_item"
/> />
</LinearLayout> </LinearLayout>

View file

@ -1,47 +1,53 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="10dp" android:paddingStart="16dp"
android:paddingRight="10dp" android:paddingEnd="16dp"
android:paddingTop="10dp"> android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout <cy.agorise.crystalwallet.util.CircularImageView
android:layout_width="match_parent" android:id="@+id/ivContactThumbnail"
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
android:src="@drawable/avatar_placeholder"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<TextView
android:id="@+id/tvContactName"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_marginTop="8dp"
android:layout_alignParentTop="true"> android:layout_marginStart="16dp"
tools:text="Loading name..."
android:textAppearance="@style/TextAppearance.Body1"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/ivContactThumbnail"/>
<ImageView <TextView
android:layout_width="@dimen/icon_size" android:id="@+id/tvLastPaid"
android:layout_height="@dimen/icon_size" android:layout_width="wrap_content"
android:id="@+id/ivContactThumbnail"/> android:layout_height="wrap_content"
android:layout_marginTop="8dp"
tools:text="Paid: Jan 1, 2001, 01:01"
android:textColor="@android:color/darker_gray"
app:layout_constraintStart_toStartOf="@id/tvContactName"
app:layout_constraintTop_toBottomOf="@id/tvContactName"/>
<TextView <ImageView
android:id="@+id/tvContactName" android:id="@+id/ivDeleteContact"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/ivContactThumbnail" android:src="@drawable/deleteicon"
android:text="Loading name..." app:layout_constraintTop_toTopOf="parent"
android:textStyle="bold" /> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView </android.support.constraint.ConstraintLayout>
android:id="@+id/tvLastPaid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvContactName"
android:layout_toRightOf="@+id/ivContactThumbnail"
android:text="Paid: Jan 1, 2001, 01:01"
android:textColor="@android:color/darker_gray"
android:visibility="gone" />
<ImageView
android:id="@+id/ivDeleteContact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:src="@drawable/deleteicon" />
</RelativeLayout>
</LinearLayout>

View file

@ -6,13 +6,23 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".activities.CreateSeedActivity"> tools:context=".activities.CreateSeedActivity">
<TextView
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="20dp"
android:text="@string/txt_brain_key_info"
app:layout_constraintTop_toTopOf="parent"
android:textSize="15dp" />
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:id="@+id/tilPin" android:id="@+id/tilPin"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="24dp" android:layout_marginEnd="24dp"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:layout_marginTop="32dp" android:layout_marginTop="112dp"
app:layout_constraintBottom_toTopOf="@+id/tilPinConfirmation" app:layout_constraintBottom_toTopOf="@+id/tilPinConfirmation"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"
@ -21,13 +31,15 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"> app:layout_constraintVertical_chainStyle="packed">
<android.support.design.widget.TextInputEditText <cy.agorise.crystalwallet.views.natives.CustomTextInputEditText
android:id="@+id/tietPin" android:id="@+id/tietPin"
android:maxLength="32"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/txt_6_digits_pin" android:hint="@string/txt_6_digits_pin"
android:inputType="number" android:inputType="number"
android:singleLine="true" /> android:singleLine="true" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
@ -40,13 +52,15 @@
app:layout_constraintStart_toStartOf="@id/tilPin" app:layout_constraintStart_toStartOf="@id/tilPin"
app:layout_constraintEnd_toEndOf="@id/tilPin"> app:layout_constraintEnd_toEndOf="@id/tilPin">
<android.support.design.widget.TextInputEditText <cy.agorise.crystalwallet.views.natives.CustomTextInputEditText
android:id="@+id/tietPinConfirmation" android:id="@+id/tietPinConfirmation"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/txt_6_digits_pin_confirm" android:hint="@string/txt_6_digits_pin_confirm"
android:maxLength="32"
android:inputType="number" android:inputType="number"
android:singleLine="true" /> android:singleLine="true" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
@ -59,32 +73,25 @@
app:layout_constraintStart_toStartOf="@id/tilPinConfirmation" app:layout_constraintStart_toStartOf="@id/tilPinConfirmation"
app:layout_constraintEnd_toEndOf="@id/tilPinConfirmation"> app:layout_constraintEnd_toEndOf="@id/tilPinConfirmation">
<android.support.design.widget.TextInputEditText <cy.agorise.crystalwallet.views.natives.CustomTextInputEditText
android:id="@+id/tietAccountName" android:id="@+id/tietAccountName"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/txt_account_name" android:hint="@string/txt_account_name"
android:digits="abcdefghijklmnopqrstuvwxyz1234567890 -"
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:maxLength="255"
android:singleLine="true" /> android:singleLine="true" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
<!--
<TextView
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/txt_brain_key_info"
android:textSize="15dp"
android:visibility="gone" /> -->
<Button <Button
android:id="@+id/btnCancel" android:id="@+id/btnCancel"
android:layout_width="wrap_content" android:layout_width="140dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="24dp" android:layout_marginStart="4dp"
android:layout_marginTop="48dp" android:layout_marginTop="28dp"
android:background="@color/redColor" android:background="@color/redColor"
android:text="@string/cancel" android:text="@string/cancel"
android:textColor="@color/white" android:textColor="@color/white"
@ -95,10 +102,10 @@
<Button <Button
android:id="@+id/btnCreate" android:id="@+id/btnCreate"
android:layout_width="wrap_content" android:layout_width="140dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginEnd="24dp" android:layout_marginEnd="4dp"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
android:padding="10dp" android:padding="10dp"
android:text="@string/create_wallet" android:text="@string/create_wallet"
@ -106,47 +113,7 @@
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@id/tilAccountName" app:layout_constraintEnd_toEndOf="@id/tilAccountName"
app:layout_constraintTop_toTopOf="@id/btnCancel" /> app:layout_constraintTop_toTopOf="@id/btnCancel" />
<!--
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="@color/bottomBarColor"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/tvAppVersion_brain_key_activity"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@string/v_1_0_beta" />
<TextView
android:id="@+id/tvBlockNumberHead_brain_key_activity"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center"
android:text="@string/block_number" />
<ImageView
android:id="@+id/ivSocketConnected_brain_key_activity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5" />
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:src="@drawable/icon_setting"
android:visibility="invisible" />
</LinearLayout>
-->
<cy.agorise.crystalwallet.util.BottomStatusBar <cy.agorise.crystalwallet.util.BottomStatusBar
android:id="@+id/bottomStatusBar" android:id="@+id/bottomStatusBar"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<cy.agorise.crystalwallet.views.natives.GIFView
android:id="@+id/gifView"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="200px"
android:layout_centerInParent="true"/>
<cy.agorise.crystalwallet.views.natives.VideoExView
android:layout_width="match_parent"
android:layout_height="200px"
android:layout_centerInParent="true"
android:visibility="gone"
android:id="@+id/video"/>
</RelativeLayout>

View file

@ -4,9 +4,19 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="cy.agorise.crystalwallet.fragments.BalanceFragment"> tools:context="cy.agorise.crystalwallet.fragments.BalanceFragment">
<!--<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_gravity="start"
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="#d9d9d9"
android:animateLayoutChanges="true" />-->
<cy.agorise.crystalwallet.views.CryptoNetBalanceListView <cy.agorise.crystalwallet.views.CryptoNetBalanceListView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/vCryptoNetBalanceListView" /> android:id="@+id/vCryptoNetBalanceListView" />
</FrameLayout> </FrameLayout>

View file

@ -4,9 +4,10 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="cy.agorise.crystalwallet.fragments.ContactsFragment"> tools:context="cy.agorise.crystalwallet.fragments.ContactsFragment">
<cy.agorise.crystalwallet.views.ContactListView <android.support.v7.widget.RecyclerView
android:id="@+id/rvContacts"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/vContactListView" /> tools:listitem="@layout/contact_list_item" />
</FrameLayout> </FrameLayout>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageviewLoading"
android:src="@drawable/loading"
android:layout_width="50dp"
android:layout_height="50dp"
android:adjustViewBounds="true"
android:layout_centerInParent="true">
</ImageView>
</RelativeLayout>

View file

@ -44,7 +44,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<Spinner <com.jaredrummler.materialspinner.MaterialSpinner
android:id="@+id/spFrom" android:id="@+id/spFrom"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -74,6 +74,7 @@
android:inputType="text" android:inputType="text"
android:textSize="20sp" android:textSize="20sp"
android:hint="@string/to_capital" android:hint="@string/to_capital"
android:maxLength="255"
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/gravatar" /> app:layout_constraintTop_toBottomOf="@+id/gravatar" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 KiB

View file

@ -18,15 +18,15 @@
<attr name="civ_selectorStrokeColor" format="color"/> <attr name="civ_selectorStrokeColor" format="color"/>
<!-- The selector stroke drawn around the image upon touch events this pixels wide. (if enabled) --> <!-- The selector stroke drawn around the image upon touch events this pixels wide. (if enabled) -->
<attr name="civ_selectorStrokeWidth" format="dimension"/> <attr name="civ_selectorStrokeWidth" format="dimension"/>
<!-- Whether or not to draw a shadow around your circular image. --> <!-- Whether or not to draw a disable_style around your circular image. -->
<attr name="civ_shadow" format="boolean"/> <attr name="civ_shadow" format="boolean"/>
<!-- The radius for the shadow to extend to. (if enabled) --> <!-- The radius for the disable_style to extend to. (if enabled) -->
<attr name="civ_shadowRadius" format="float"/> <attr name="civ_shadowRadius" format="float"/>
<!-- Horizontal shadow offset. (if enabled) --> <!-- Horizontal disable_style offset. (if enabled) -->
<attr name="civ_shadowDx" format="float"/> <attr name="civ_shadowDx" format="float"/>
<!-- Vertical shadow offset. (if enabled) --> <!-- Vertical disable_style offset. (if enabled) -->
<attr name="civ_shadowDy" format="float"/> <attr name="civ_shadowDy" format="float"/>
<!-- The color of the shadow drawn around your circular image. (if enabled) --> <!-- The color of the disable_style drawn around your circular image. (if enabled) -->
<attr name="civ_shadowColor" format="color"/> <attr name="civ_shadowColor" format="color"/>
</declare-styleable> </declare-styleable>

View file

@ -14,6 +14,9 @@
<color name="green">#147b00</color> <color name="green">#147b00</color>
<color name="lightGrayClear">#cccccc</color>
<color name="black">#000000</color> <color name="black">#000000</color>
<color name="greencolor">#70882E</color> <color name="greencolor">#70882E</color>
<color name="red">#ff0000</color> <color name="red">#ff0000</color>

View file

@ -2,24 +2,15 @@
<!-- Default screen margins, per the Android Design guidelines. --> <!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen> <dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="tab_max_width">264dp</dimen>
<dimen name="tab_padding_bottom">16dp</dimen>
<dimen name="tab_label">14sp</dimen>
<dimen name="custom_tab_layout_height">72dp</dimen>
<dimen name="app_bar_height">140sp</dimen> <dimen name="app_bar_height">140sp</dimen>
<dimen name="fab_margin">16dp</dimen> <dimen name="fab_margin">16dp</dimen>
<dimen name="text_margin">16dp</dimen>
<dimen name="layout_margin">35sp</dimen>
<dimen name="webview_margin">30sp</dimen>
<dimen name="transactionsheaderpading">5dp</dimen>
<dimen name="items_erecipt">70dp</dimen>
<dimen name="items_ereciptDouble">140dp</dimen>
<dimen name="items_ereciptImage">150dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
<!-- Dimensions form the transaction list --> <!-- Spacing between widgets vertically -->
<dimen name="transaction_details_text_size">13sp</dimen> <dimen name="spacing_same_topic">16dp</dimen>
<dimen name="spacing_different_topic">24dp</dimen>
<dimen name="spacing_different_section">40dp</dimen>
<!-- Settings --> <!-- Settings -->
<dimen name="icon_size">70dp</dimen> <dimen name="icon_size">60dp</dimen>
</resources> </resources>

View file

@ -33,6 +33,17 @@
<string name="account_label">Choose File</string> <string name="account_label">Choose File</string>
<string name="loading_msg">Please wait until Balances are loading</string> <string name="loading_msg">Please wait until Balances are loading</string>
<string name="window_create_seed_DialogTittle"></string>
<string name="window_create_seed_DialogMessage">Creating New Account ...</string>
<string name="window_create_seed_Server_validation">Validating With Server ...</string>
<string name="window_create_seed_Info">You will use your PIN yo make transactions between accounts</string>
<string name="window_seed_backup">Backup brainkey</string>
<string name="window_seed_toast_clipboard">Brainkey copied to clipboard!</string>
<string name="window_seed_copy">Copy</string>
<string name="window_seed_leyend_backup">IMPORTANT: Print this out, or write it down. Anyone with access to your recovery key will have access to funds within this wallet</string>
<string name="seed_words">Seed</string> <string name="seed_words">Seed</string>
<string name="txt_6_digits_pin">PIN (6+ digits)</string> <string name="txt_6_digits_pin">PIN (6+ digits)</string>
<string name="txt_6_digits_pin_confirm">PIN confirm</string> <string name="txt_6_digits_pin_confirm">PIN confirm</string>
@ -119,7 +130,7 @@
<string name="txt_validating_account">Validating account...</string> <string name="txt_validating_account">Validating account...</string>
<string name="validating_account">Validating Account...</string> <string name="validating_account">Validating Account...</string>
<string name="account_name_should_be_longer">Account name should be longer</string> <string name="account_name_should_be_longer">Account name should be longer</string>
<string name="account_name_already_exist">Account Name %s already exist</string> <string name="account_name_already_exist">Account Name already exist</string>
<string name="account_name_not_exist">Account Name %s does not exist</string> <string name="account_name_not_exist">Account Name %s does not exist</string>
<string name="account_already_exist">Account already exist</string> <string name="account_already_exist">Account already exist</string>
<string name="add_contact">Add</string> <string name="add_contact">Add</string>
@ -486,7 +497,7 @@
<string name="remove">Remove</string> <string name="remove">Remove</string>
<string name="user_name_password_placeholder">user_name Password</string> <string name="user_name_password_placeholder">user_name Password</string>
<string name="version_placeholder">v1.0</string> <string name="version_placeholder">v1.0</string>
<string name="block_number_placeholder">block# 14966596</string> <string name="block_number_placeholder">block# -----</string>
<string name="current_pin">Current PIN</string> <string name="current_pin">Current PIN</string>
<string name="new_pin">New PIN</string> <string name="new_pin">New PIN</string>
<string name="confirm_pin">Confirm PIN</string> <string name="confirm_pin">Confirm PIN</string>
@ -506,4 +517,6 @@
<string name="import_account_backup">Import Account Backup</string> <string name="import_account_backup">Import Account Backup</string>
<string name="disagree">Disagree</string> <string name="disagree">Disagree</string>
<string name="agree">Agree</string> <string name="agree">Agree</string>
<string name="add">Add</string>
<string name="modify">Modify</string>
</resources> </resources>

View file

@ -0,0 +1,15 @@
<resources>
<string name="create_account_window_err_at_least_one_number" translatable="false">The Account Name should contains at least one number</string>
<string name="create_account_window_err_min_account_name_len" translatable="false">The Account Name should contains at least 10 characters length</string>
<string name="create_account_window_err_pin_empty" translatable="false">PIN is emtpy</string>
<string name="create_account_window_err_pin_confirmation_empty" translatable="false">PIN is emtpy</string>
<string name="create_account_window_err_account_empty" translatable="false">Account Name is emtpy</string>
<string name="create_account_window_err_at_least_one_character" translatable="false">The Account Name should contains at least one character</string>
<string name="create_account_window_err_at_least_pin_characters" translatable="false">The PIN should contains at least 6 digits</string>
<string name="create_account_window_err_at_least_one_script" translatable="false">The Account Name should contain at least one \'-\'</string>
<string name="network_err_no_server_connection" translatable="false">No server connection</string>
</resources>

View file

@ -63,18 +63,20 @@
<item name="android:textAllCaps">true</item> <item name="android:textAllCaps">true</item>
</style> </style>
<style name="BlueButton" parent="Theme.AppCompat"> <style name="BaseButton" parent="Theme.AppCompat">
<item name="colorAccent">@color/colorPrimary</item> <item name="android:textColor">@android:color/white</item>
<item name="colorControlHighlight">@color/colorPrimaryDark</item>
<item name="colorButtonNormal">@color/gray</item> <item name="colorButtonNormal">@color/gray</item>
<item name="android:buttonStyle">@style/Widget.AppCompat.Button.Colored</item> <item name="android:buttonStyle">@style/Widget.AppCompat.Button.Colored</item>
</style> </style>
<style name="RedButton" parent="Theme.AppCompat"> <style name="BlueButton" parent="BaseButton">
<item name="colorAccent">@color/colorPrimary</item>
<item name="colorControlHighlight">@color/colorPrimaryDark</item>
</style>
<style name="RedButton" parent="BaseButton">
<item name="colorAccent">@color/red</item> <item name="colorAccent">@color/red</item>
<item name="colorControlHighlight">@color/redColor</item> <item name="colorControlHighlight">@color/redColor</item>
<item name="colorButtonNormal">@color/gray</item>
<item name="android:buttonStyle">@style/Widget.AppCompat.Button.Colored</item>
</style> </style>
<!-- Text styles --> <!-- Text styles -->

View file

@ -1,15 +1,16 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlinVersion = '1.1.51'
repositories { repositories {
jcenter() jcenter()
google() google()
} }
ext.kotlin_version = '1.2.51' ext.kotlin_version = '1.2.51'
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.1.3' classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.60"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }