Added bottom buttons to balance, transactions and contacts

This commit is contained in:
sjaramillo10 2017-11-16 23:43:10 -06:00
parent 575b85ebb4
commit 2cb9afb645
2 changed files with 79 additions and 3 deletions

View file

@ -2,6 +2,8 @@ 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.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TabLayout; 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;
@ -10,6 +12,7 @@ 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.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageButton; import android.widget.ImageButton;
import butterknife.BindView; import butterknife.BindView;
@ -32,6 +35,15 @@ public class BoardActivity extends AppCompatActivity {
@BindView(R.id.btnGeneralSettings) @BindView(R.id.btnGeneralSettings)
public ImageButton 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; public BoardPagerAdapter boardAdapter;
@Override @Override
@ -50,6 +62,52 @@ public class BoardActivity extends AppCompatActivity {
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager)); 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) @OnClick(R.id.btnGeneralSettings)

View file

@ -59,7 +59,25 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior"/> app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:id="@+id/fab" android:id="@+id/fabReceive"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_gravity="start|bottom"
android:layout_marginBottom="-125dp"
android:layout_marginStart="-125dp"
app:srcCompat="@android:drawable/ic_dialog_email" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabSend"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_gravity="end|bottom"
android:layout_marginBottom="-125dp"
android:layout_marginEnd="-125dp"
app:srcCompat="@android:drawable/ic_dialog_email" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabAddContact"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end|bottom" android:layout_gravity="end|bottom"
@ -71,14 +89,14 @@
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_gravity="bottom"
android:background="@color/white"> android:background="@color/white">
<ImageButton <ImageButton
android:id="@+id/btnGeneralSettings" android:id="@+id/btnGeneralSettings"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_centerHorizontal="true"
android:background="@drawable/icon_setting" /> android:background="@drawable/icon_setting" />
</RelativeLayout> </RelativeLayout>
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>