From 6b947e6df238fe9251db7f4ee90568d22a98ae57 Mon Sep 17 00:00:00 2001 From: sjaramillo10 Date: Thu, 16 Nov 2017 23:43:10 -0600 Subject: [PATCH] Added bottom buttons to balance, transactions and contacts --- .../activities/BoardActivity.java | 58 +++++++++++++++++++ app/src/main/res/layout/board.xml | 24 +++++++- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java index 4826a22..7d04f6f 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java @@ -2,6 +2,8 @@ package cy.agorise.crystalwallet.activities; import android.content.Intent; import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; @@ -10,6 +12,7 @@ import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; +import android.view.View; import android.widget.ImageButton; import butterknife.BindView; @@ -32,6 +35,15 @@ public class BoardActivity extends AppCompatActivity { @BindView(R.id.btnGeneralSettings) public ImageButton btnGeneralSettings; + @BindView(R.id.fabSend) + public FloatingActionButton fabSend; + + @BindView(R.id.fabReceive) + public FloatingActionButton fabReceive; + + @BindView(R.id.fabAddContact) + public FloatingActionButton fabAddContact; + public BoardPagerAdapter boardAdapter; @Override @@ -50,6 +62,52 @@ public class BoardActivity extends AppCompatActivity { mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager)); + + /*fabSend.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) + .setAction("Action", null).show(); + } + });*/ + + // + fabAddContact.hide(); + + mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + } + + @Override + public void onPageSelected(int position) { + + switch (position) { + case 0: + fabReceive.show(); + fabSend.show(); + fabAddContact.hide(); + break; + + case 1: + fabReceive.show(); + fabSend.show(); + fabAddContact.hide(); + break; + + default: + fabReceive.hide(); + fabSend.hide(); + fabAddContact.show(); + break; + } + } + + @Override + public void onPageScrollStateChanged(int state) { + + } + }); } @OnClick(R.id.btnGeneralSettings) diff --git a/app/src/main/res/layout/board.xml b/app/src/main/res/layout/board.xml index cbdaa46..50167ac 100644 --- a/app/src/main/res/layout/board.xml +++ b/app/src/main/res/layout/board.xml @@ -59,7 +59,25 @@ app:layout_behavior="@string/appbar_scrolling_view_behavior"/> + + + + \ No newline at end of file