Skip to content

Commit

Permalink
Merge pull request #12 from bowyer-app/fix/update_demo
Browse files Browse the repository at this point in the history
Fix/update demo
  • Loading branch information
bowyer-app authored Aug 4, 2016
2 parents 586c062 + 5202e41 commit bc73ee2
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 10 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Provides the Floating Action Button Transition [as specified in the Material Des

It is strongly inspired by [fab-toolbar](https://github.com/bowyer-app/fab-toolbar)

![bottomsheet](https://github.com/bowyer-app/FabTransitionLayout/blob/master/art/bottomsheet.gif)
![bottomsheet](https://github.com/bowyer-app/FabTransitionLayout/blob/master/art/toolbar.gif)
| bottomsheet | toolbar | CoordinatorLayout|
| :---------------: |:---------------:| :---------------:|
|![bottomsheet](https://github.com/bowyer-app/FabTransitionLayout/blob/master/art/bottomsheet.gif)|![bottomsheet](https://github.com/bowyer-app/FabTransitionLayout/blob/master/art/toolbar.gif)|![CoordinatorLayout](https://github.com/bowyer-app/FabTransitionLayout/blob/master/art/CoordinatorLayout.gif)|

Usage
====
Expand Down
Binary file added art/CoordinatorLayout.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.bowyer.fabtransitionlayout.demo;

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
Expand All @@ -9,6 +12,8 @@
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
Expand All @@ -23,6 +28,9 @@ public class CoordinatorLayoutActivity extends AppCompatActivity {
@Bind(R.id.fabtoolbar) FooterLayout mFabToolbar;
@Bind(R.id.fab) FloatingActionButton mFab;
@Bind(R.id.list_view) RecyclerView mListView;
@Bind(R.id.ic_call) ImageView mIcCall;
@Bind(R.id.ic_email) ImageView mIcEmail;
@Bind(R.id.ic_forum) ImageView mIcForum;

@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -51,6 +59,25 @@ private void initListView() {
mFabToolbar.expandFab();
}

@OnClick(R.id.call) void onClickCall() {
iconAnim(mIcCall);
}

@OnClick(R.id.ic_email) void onClickEmail() {
iconAnim(mIcEmail);
}

@OnClick(R.id.ic_forum) void onClickForum() {
iconAnim(mIcForum);
}

private void iconAnim(View icon) {
Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(icon,
PropertyValuesHolder.ofFloat(View.SCALE_X, 1f, 1.5f, 1f),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 1.5f, 1f));
iconAnim.start();
}

@Override public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_coordinator, menu);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ private void initListView() {

private void iconAnim(View icon) {
Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(icon,
PropertyValuesHolder.ofFloat("scaleX", 1f, 1.5f, 1f),
PropertyValuesHolder.ofFloat("scaleY", 1f, 1.5f, 1f));
PropertyValuesHolder.ofFloat(View.SCALE_X, 1f, 1.5f, 1f),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 1.5f, 1f));
iconAnim.start();
}
}
71 changes: 66 additions & 5 deletions demo/src/main/res/layout/activity_coordinator_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,82 @@
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@id/list_view"
app:layout_anchorGravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_add_white_24dp"
app:layout_anchor="@id/list_view"
app:layout_anchorGravity="bottom|end"
/>

<com.bowyer.app.fabtransitionlayout.FooterLayout
android:id="@+id/fabtoolbar"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_height="@dimen/toolbar_height"
app:ft_color="@color/primary"
app:ft_container_gravity="center"
app:layout_anchor="@id/list_view"
app:layout_anchorGravity="bottom"
app:ft_container_gravity="center"
app:ft_color="@color/primary"
>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>

<RelativeLayout
android:id="@+id/call"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
>

<ImageView
android:id="@+id/ic_call"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerHorizontal="true"
android:scaleType="center"
android:src="@drawable/ic_call_white_36dp"
/>
</RelativeLayout>

<RelativeLayout
android:id="@+id/email"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
>

<ImageView
android:id="@+id/ic_email"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerHorizontal="true"
android:scaleType="center"
android:src="@drawable/ic_email_white_36dp"
/>
</RelativeLayout>

<RelativeLayout
android:id="@+id/forum"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
>

<ImageView
android:id="@+id/ic_forum"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerHorizontal="true"
android:scaleType="center"
android:src="@drawable/ic_forum_white_36dp"
/>
</RelativeLayout>
</LinearLayout>
</com.bowyer.app.fabtransitionlayout.FooterLayout>

</android.support.design.widget.CoordinatorLayout>
2 changes: 1 addition & 1 deletion demo/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="toolbar_height">72dp</dimen>
<dimen name="toolbar_height">56dp</dimen>
<dimen name="menu_height">48dp</dimen>
<dimen name="menu_text_size">16sp</dimen>
<dimen name="fab_margin">16dp</dimen>
Expand Down

0 comments on commit bc73ee2

Please sign in to comment.