From bc9d671656eec6cf0e34e189bfb58f1e26ba702e Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Tue, 30 Oct 2018 08:18:40 -0600 Subject: [PATCH] Improved MainActivity TabLayout by making tabMode=scrollable and adding an animation to the bitshares logo to visually show when the fragment it represents is selected. --- .../activities/MainActivity.kt | 8 +------- .../main/res/drawable/bts_logo_unselected.xml | 19 +++++++++++++++++++ .../main/res/drawable/tab_home_selector.xml | 5 +++++ app/src/main/res/layout/activity_main.xml | 12 +++--------- app/src/main/res/values/colors.xml | 6 ++++-- .../res/values/ic_launcher_background.xml | 4 ---- 6 files changed, 32 insertions(+), 22 deletions(-) create mode 100644 app/src/main/res/drawable/bts_logo_unselected.xml create mode 100644 app/src/main/res/drawable/tab_home_selector.xml delete mode 100644 app/src/main/res/values/ic_launcher_background.xml diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt index 9f0bb1a..359ecaa 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt @@ -43,13 +43,7 @@ class MainActivity : AppCompatActivity() { tabLayout.setupWithViewPager(viewPager) // Force first tab to show BTS icon - tabLayout.getTabAt(0)?.setIcon(R.drawable.bts_logo) - - fab.setOnClickListener { view -> - Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) - .setAction("Action", null).show() - } - + tabLayout.getTabAt(0)?.setIcon(R.drawable.tab_home_selector) } diff --git a/app/src/main/res/drawable/bts_logo_unselected.xml b/app/src/main/res/drawable/bts_logo_unselected.xml new file mode 100644 index 0000000..8173798 --- /dev/null +++ b/app/src/main/res/drawable/bts_logo_unselected.xml @@ -0,0 +1,19 @@ + + + + + + + + + diff --git a/app/src/main/res/drawable/tab_home_selector.xml b/app/src/main/res/drawable/tab_home_selector.xml new file mode 100644 index 0000000..0af9508 --- /dev/null +++ b/app/src/main/res/drawable/tab_home_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 7389f67..10c3844 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -31,7 +31,9 @@ + android:layout_height="wrap_content" + app:tabIndicatorHeight="0dp" + app:tabMode="scrollable"/> @@ -41,12 +43,4 @@ android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> - - \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 69b2233..97c5a84 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,6 +1,8 @@ - #008577 - #00574B + #009FE3 + #0071b1 #D81B60 + + #000 diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml deleted file mode 100644 index c5d5899..0000000 --- a/app/src/main/res/values/ic_launcher_background.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - #FFFFFF - \ No newline at end of file