Added custom toolbar and tab labels to board activity

This commit is contained in:
sjaramillo10 2017-11-16 22:56:43 -06:00 committed by Severiano Jaramillo
parent a541a70c1a
commit 5b3b3e2dda
5 changed files with 651 additions and 6 deletions

View file

@ -0,0 +1,573 @@
{
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "6dd1ca39bdde9af2cba2b35413c4975e",
"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, 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
}
],
"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": "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, 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
}
],
"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, \"6dd1ca39bdde9af2cba2b35413c4975e\")"
]
}
}

View file

@ -19,7 +19,8 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".activities.BoardActivity" > <activity android:name=".activities.BoardActivity"
android:theme="@style/AppTheme.NoActionBar" >
</activity> </activity>
<activity android:name=".activities.AccountSeedsManagementActivity" > <activity android:name=".activities.AccountSeedsManagementActivity" >
</activity> </activity>

View file

@ -2,12 +2,14 @@ package cy.agorise.crystalwallet.activities;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.PagerAdapter; import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.ImageButton; import android.widget.ImageButton;
import butterknife.BindView; import butterknife.BindView;
@ -38,8 +40,16 @@ public class BoardActivity extends AppCompatActivity {
setContentView(R.layout.board); setContentView(R.layout.board);
ButterKnife.bind(this); ButterKnife.bind(this);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
boardAdapter = new BoardPagerAdapter(getSupportFragmentManager()); boardAdapter = new BoardPagerAdapter(getSupportFragmentManager());
mPager.setAdapter(boardAdapter); mPager.setAdapter(boardAdapter);
TabLayout tabLayout = findViewById(R.id.tabs);
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager));
} }
@OnClick(R.id.btnGeneralSettings) @OnClick(R.id.btnGeneralSettings)

View file

@ -1,12 +1,72 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent" android:layout_height="match_parent"> xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
app:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_weight="1"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="@string/app_name">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TabItem
android:id="@+id/tabItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Balances" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Transactions" />
<android.support.design.widget.TabItem
android:id="@+id/tabItem3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Contacts" />
</android.support.design.widget.TabLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager" android:id="@+id/pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
<!-- Place settings button correctly -->
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -21,4 +81,4 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:background="@drawable/icon_setting" /> android:background="@drawable/icon_setting" />
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </android.support.design.widget.CoordinatorLayout>

View file

@ -15,6 +15,7 @@
<dimen name="items_erecipt">70dp</dimen> <dimen name="items_erecipt">70dp</dimen>
<dimen name="items_ereciptDouble">140dp</dimen> <dimen name="items_ereciptDouble">140dp</dimen>
<dimen name="items_ereciptImage">150dp</dimen> <dimen name="items_ereciptImage">150dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
<!-- Dimensions form the transaction list --> <!-- Dimensions form the transaction list -->
<dimen name="transaction_details_text_size">13sp</dimen> <dimen name="transaction_details_text_size">13sp</dimen>