Added toolbar elements and fab animations to board activity

This commit is contained in:
Severiano Jaramillo 2017-11-29 01:40:41 -06:00
parent 3178798d9b
commit 6bdeab545b
8 changed files with 41 additions and 15 deletions

View file

@ -1,6 +1,7 @@
package cy.agorise.crystalwallet.activities;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout;
@ -12,6 +13,7 @@ import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.ImageButton;
import butterknife.BindView;
@ -71,7 +73,10 @@ public class BoardActivity extends AppCompatActivity {
});*/
// Hide Add Contact fab, it won't hide until first page changed...
fabAddContact.hide();
// Convert 72dp to pixels (fab is 56dp in diameter + 16dp margin)
final int fabDistanceToHide = (int) (72 * Resources.getSystem().getDisplayMetrics().density);;
fabAddContact.animate().translationY(fabDistanceToHide)
.setInterpolator(new LinearInterpolator()).start();
// Hide and show respective fabs when convenient
mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@ -86,19 +91,22 @@ public class BoardActivity extends AppCompatActivity {
case 0:
fabReceive.show();
fabSend.show();
fabAddContact.hide();
fabAddContact.animate().translationY(fabDistanceToHide)
.setInterpolator(new LinearInterpolator()).start();
break;
case 1:
fabReceive.show();
fabSend.show();
fabAddContact.hide();
fabAddContact.animate().translationY(fabDistanceToHide)
.setInterpolator(new LinearInterpolator()).start();
break;
default:
fabReceive.hide();
fabSend.hide();
fabAddContact.show();
fabAddContact.animate().translationY(0)
.setInterpolator(new LinearInterpolator()).start();
break;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/transparent" />
<corners android:radius="20dp" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View file

@ -5,7 +5,6 @@
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:theme="@style/AppTheme.NoActionBar"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
@ -23,14 +22,27 @@
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="Client Logo">
app:title="Client Logo"
app:titleTextColor="@color/white" >
<ImageView
android:id="@+id/toolbar_logo"
android:src="@drawable/gravtr"
android:layout_width="?attr/actionBarSize"
android:layout_height="match_parent"
android:layout_marginEnd="14dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_gravity="end"
android:background="@drawable/roundcorner"/>
</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:layout_height="wrap_content"
android:animateLayoutChanges="true">
<android.support.design.widget.TabItem
android:id="@+id/tabItem"
@ -76,7 +88,8 @@
android:layout_gravity="end|bottom"
android:layout_marginBottom="-125dp"
android:layout_marginEnd="-125dp"
app:srcCompat="@android:drawable/ic_dialog_email" />
app:backgroundTint="@color/white"
app:srcCompat="@drawable/send_icon" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabAddContact"
@ -84,7 +97,8 @@
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
app:backgroundTint="@color/colorPrimaryDark"
app:srcCompat="@drawable/add_contact_fab" />
<!-- Place settings button correctly -->

View file

@ -7,6 +7,7 @@
<color name="darkGray">#686767</color>
<color name="white">#ffffff</color>
<color name="pink">#f0006b</color>
<color name="transparent">#00ffffff</color>
<color name="green">#147b00</color>

View file

@ -1,6 +1,5 @@
<resources>
<style name="stylishDialog" parent="android:Theme.Dialog">
<item name="android:windowBackground">@color/whiteColor</item>
<item name="android:textColor">@color/black</item>
@ -13,7 +12,6 @@
</style>
<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
@ -34,16 +32,16 @@
<item name="android:colorButtonNormal">@color/white</item>
</style>
<style name="AppTheme.NoActionBar">
<style name="AppTheme.NoActionBar" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark" >
</style>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="splashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:windowNoTitle">true</item>