Example usage for android.widget ImageView getHeight

List of usage examples for android.widget ImageView getHeight

Introduction

In this page you can find the example usage for android.widget ImageView getHeight.

Prototype

@ViewDebug.ExportedProperty(category = "layout")
public final int getHeight() 

Source Link

Document

Return the height of your view.

Usage

From source file:com.landenlabs.all_UiDemo.frag.ImageScalesFrag.java

private Bitmap fillLowerLeft(final Drawable drawable, ImageView imageView, Bitmap prevBm) {

    // Compute  matrix to fill viewer with drawable starting with upper left
    // Stretching till 2nd edge is crossed (filling screen) with correct aspect ratio.
    Matrix m = new Matrix();
    m.reset();//ww  w . j  av  a2s  .  co  m
    int imgWidth = drawable.getIntrinsicWidth();
    int imgHeight = drawable.getIntrinsicHeight();
    int viewWidth = imageView.getWidth();
    int viewHeight = imageView.getHeight();
    float xScale = (float) viewWidth / imgWidth;
    float yScale = (float) viewHeight / imgHeight;
    float maxScale = Math.max(xScale, yScale);

    float dy = (imgHeight * maxScale - viewHeight) / maxScale;
    // dy = imgHeight / 2;
    m.preTranslate(0, -dy);
    m.postScale(maxScale, maxScale);

    imageView.setScaleType(ImageView.ScaleType.MATRIX);
    imageView.setImageMatrix(m);
    imageView.setImageDrawable(drawable);
    return prevBm;
}

From source file:com.fa.mastodon.activity.MainActivity.java

private void onFetchUserInfoSuccess(Account me, String domain) {
    // Add the header image and avatar from the account, into the navigation drawer header.
    headerResult.clear();//from   w  w w  .  ja  va  2s  . c  om

    ImageView background = headerResult.getHeaderBackgroundView();
    int backgroundWidth = background.getWidth();
    int backgroundHeight = background.getHeight();
    if (backgroundWidth == 0 || backgroundHeight == 0) {
        /* The header ImageView may not be layed out when the verify credentials call returns so
         * measure the dimensions and use those. */
        background.measure(View.MeasureSpec.EXACTLY, View.MeasureSpec.EXACTLY);
        backgroundWidth = background.getMeasuredWidth();
        backgroundHeight = background.getMeasuredHeight();
    }

    background.setBackgroundColor(ContextCompat.getColor(this, R.color.window_background_dark));

    if (backgroundWidth == 0 || backgroundHeight == 0) {
    } else {
        Picasso.with(MainActivity.this).load(me.header).placeholder(R.drawable.account_header_default)
                .resize(backgroundWidth, backgroundHeight).centerCrop().into(background);
    }

    headerResult.addProfiles(new ProfileDrawerItem().withName(me.getDisplayName())
            .withEmail(String.format("%s@%s", me.username, domain)).withIcon(me.avatar));

    // Show follow requests in the menu, if this is a locked account.
    if (me.locked) {
        PrimaryDrawerItem followRequestsItem = new PrimaryDrawerItem().withIdentifier(6)
                .withName(R.string.action_view_follow_requests).withSelectable(false)
                .withIcon(GoogleMaterial.Icon.gmd_person_add);
        drawer.addItemAtPosition(followRequestsItem, 3);
    }

    // Update the current login information.
    loggedInAccountId = me.id;
    loggedInAccountUsername = me.username;
    getPrivatePreferences().edit().putString("loggedInAccountId", loggedInAccountId)
            .putString("loggedInAccountUsername", loggedInAccountUsername)
            .putBoolean("loggedInAccountLocked", me.locked).apply();
}

From source file:com.frank.protean.photoview.PhotoViewAttacher.java

private int getImageViewHeight(ImageView imageView) {
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}

From source file:com.evandroid.musica.fragment.LocalLyricsFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    if (this.isHidden())
        return;/*  w ww  .j a v  a  2 s .co m*/

    megaListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {

        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            final ImageView indicator = (ImageView) v.findViewById(R.id.group_indicator);
            RotateAnimation anim;
            if (megaListView.isGroupExpanded(groupPosition)) {
                megaListView.collapseGroupWithAnimation(groupPosition);
                if (indicator != null) {
                    anim = new RotateAnimation(180f, 360f, indicator.getWidth() / 2, indicator.getHeight() / 2);
                    anim.setInterpolator(new DecelerateInterpolator(3));
                    anim.setDuration(500);
                    anim.setFillAfter(true);
                    indicator.startAnimation(anim);
                }
            } else {
                megaListView.expandGroupWithAnimation(groupPosition);
                if (indicator != null) {
                    anim = new RotateAnimation(0f, 180f, indicator.getWidth() / 2, indicator.getHeight() / 2);
                    anim.setInterpolator(new DecelerateInterpolator(2));
                    anim.setDuration(500);
                    anim.setFillAfter(true);
                    indicator.startAnimation(anim);
                }
            }
            return true;
        }
    });

    megaListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition,
                long id) {
            if (mSwiping) {
                mSwiping = false;
                return false;
            }
            final MainLyricActivity mainLyricActivity = (MainLyricActivity) getActivity();
            megaListView.setOnChildClickListener(null); // prevents bug on double tap
            mainLyricActivity.updateLyricsFragment(R.animator.slide_out_start, R.animator.slide_in_start, true,
                    lyricsArray.get(groupPosition).get(childPosition));
            return true;
        }
    });

    this.isActiveFragment = true;
    new DBContentLister(this).execute();
}

From source file:uk.org.ngo.squeezer.util.ImageWorker.java

/**
 * Load an image specified by the data parameter into an ImageView (override {@link
 * ImageWorker#processBitmap(BitmapWorkerTaskParams)} to define the processing logic). A memory and disk cache
 * will be used if an {@link ImageCache} has been set using {@link
 * ImageWorker#setImageCache(ImageCache)}. If the image is found in the memory cache, it is set
 * immediately, otherwise an {@link AsyncTask} will be created to asynchronously load the
 * bitmap.//  ww w . j  av a2s  .co  m
 *
 * @param data The URL of the image to download
 * @param imageView The ImageView to bind the downloaded image to
 */
public void loadImage(final Object data, final ImageView imageView) {
    if (data == null) {
        return;
    }

    int width = imageView.getWidth();
    int height = imageView.getHeight();

    // If the dimensions aren't known yet then the view hasn't been measured. Get a
    // ViewTreeObserver and listen for the PreDraw message. Using a GlobalLayoutListener
    // does not work for views that are in the list but drawn off-screen, possibly due
    // to the convertview. See http://stackoverflow.com/a/14325365 for some discussion.
    // The solution there, of posting a runnable, does not appear to reliably work on
    // devices running (at least) API 7. An OnPreDrawListener appears to work, and will
    // be called after measurement is complete.
    if (width == 0 || height == 0) {
        // Store the URL in the imageView's tag, in case the URL assigned to is changed.
        imageView.setTag(data);

        imageView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                imageView.getViewTreeObserver().removeOnPreDrawListener(this);
                // If the imageView is still assigned to the URL then we can load in to it.
                if (data.equals(imageView.getTag())) {
                    loadImage(data, imageView);
                }
                return true;
            }
        });
        return;
    }

    loadImage(data, imageView, width, height);
}

From source file:it.mb.whatshare.PairOutboundActivity.java

private void showPairingLayout() {
    View view = getLayoutInflater().inflate(R.layout.activity_qrcode, null);
    setContentView(view);//from   ww w .ja  v  a  2  s  . c  o  m
    String paired = getOutboundPaired();
    if (paired != null) {
        ((TextView) findViewById(R.id.qr_instructions))
                .setText(getString(R.string.new_outbound_instructions, paired));
    }
    inputCode = (EditText) findViewById(R.id.inputCode);

    inputCode.setFilters(new InputFilter[] { new InputFilter() {
        /*
         * (non- Javadoc )
         * 
         * @see android .text. InputFilter # filter( java .lang.
         * CharSequence , int, int, android .text. Spanned , int, int)
         */
        @Override
        public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
                int dend) {
            if (source instanceof SpannableStringBuilder) {
                SpannableStringBuilder sourceAsSpannableBuilder = (SpannableStringBuilder) source;
                for (int i = end - 1; i >= start; i--) {
                    char currentChar = source.charAt(i);
                    if (!Character.isLetterOrDigit(currentChar)) {
                        sourceAsSpannableBuilder.delete(i, i + 1);
                    }
                }
                return source;
            } else {
                StringBuilder filteredStringBuilder = new StringBuilder();
                for (int i = 0; i < end; i++) {
                    char currentChar = source.charAt(i);
                    if (Character.isLetterOrDigit(currentChar)) {
                        filteredStringBuilder.append(currentChar);
                    }
                }
                return filteredStringBuilder.toString();
            }
        }
    }, new InputFilter.LengthFilter(MAX_SHORTENED_URL_LENGTH) });

    inputCode.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                onSubmitPressed(null);
                return keepKeyboardVisible;
            }
            return false;
        }
    });

    final ImageView qrWrapper = (ImageView) findViewById(R.id.qr_code);
    qrWrapper.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

        private boolean createdQRCode = false;

        @Override
        public void onGlobalLayout() {
            if (!createdQRCode) {
                try {
                    Bitmap qrCode = generateQRCode(generateRandomSeed(),
                            getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
                                    ? qrWrapper.getHeight()
                                    : qrWrapper.getWidth());
                    if (qrCode != null) {
                        qrWrapper.setImageBitmap(qrCode);
                    }
                    createdQRCode = true;
                } catch (WriterException e) {
                    e.printStackTrace();
                }
            }
        }
    });
}

From source file:io.intue.kamu.BestNearbyFragment.java

@Override
public void bindCollectionItemView(Context context, View view, int groupId, int indexInGroup, int dataIndex,
        Object tag) {/*from   w ww . j  a  v a  2s  .  co m*/
    //        if (mCursor == null || !mCursor.moveToPosition(dataIndex)) {
    //            LOGW(TAG, "Can't bind collection view item, dataIndex=" + dataIndex +
    //                    (mCursor == null ? ": cursor is null" : ": bad data index."));
    //            return;
    //        }

    if (mresult == null) {
        return;
    }
    Venue result = mresult.get(dataIndex);

    final String sessionId = result.getId();
    if (sessionId == null) {
        return;
    }

    // first, read session info from cursor and put it in convenience variables
    final String sessionTitle = result.getName();
    //final String speakerNames = "SessionsQuery.SPEAKER_NAMES";
    //final String sessionAbstract = "SessionsQuery.ABSTRACT";
    //final long sessionStart = 44454544;
    //final long sessionEnd = 334343433;
    //final String roomName = "SessionsQuery.ROOM_NAME";
    int sessionColor = 0;
    sessionColor = sessionColor == 0 ? getResources().getColor(R.color.transparent) : sessionColor;
    //final String snippet = "SessionsQuery.SNIPPET";
    final Spannable styledSnippet = null;
    final boolean starred = false;
    //final String[] tags = "A,B,C".split(",");

    // now let's compute a few pieces of information from the data, which we will use
    // later to decide what to render where
    final boolean hasLivestream = false;
    final long now = UIUtils.getCurrentTime(context);
    final boolean happeningNow = false;

    // text that says "LIVE" if session is live, or empty if session is not live
    //final String liveNowText =  "";

    // get reference to all the views in the layout we will need
    final TextView titleView = (TextView) view.findViewById(R.id.session_title);
    final TextView subtitleView = (TextView) view.findViewById(R.id.session_subtitle);
    final TextView shortSubtitleView = (TextView) view.findViewById(R.id.session_subtitle_short);
    final TextView snippetView = (TextView) view.findViewById(R.id.session_snippet);
    //final TextView abstractView = (TextView) view.findViewById(R.id.session_abstract);
    //final TextView categoryView = (TextView) view.findViewById(R.id.session_category);
    final View boxView = view.findViewById(R.id.info_box);
    final View sessionTargetView = view.findViewById(R.id.session_target);

    if (sessionColor == 0) {
        // use default
        sessionColor = getResources().getColor(R.color.transparent);
    }
    sessionColor = UIUtils.scaleSessionColorToDefaultBG(sessionColor);

    ImageView photoView = (ImageView) view.findViewById(R.id.session_photo_colored);
    if (photoView != null) {
        if (!mPreloader.isDimensSet()) {
            final ImageView finalPhotoView = photoView;
            photoView.post(new Runnable() {
                @Override
                public void run() {
                    mPreloader.setDimens(finalPhotoView.getWidth(), finalPhotoView.getHeight());
                }
            });
        }
        // colored
        photoView.setColorFilter(UIUtils.setColorAlpha(sessionColor, UIUtils.SESSION_PHOTO_SCRIM_ALPHA));
    } else {
        photoView = (ImageView) view.findViewById(R.id.session_photo);
    }
    ((BaseActivity) getActivity()).getLPreviewUtils().setViewName(photoView, "photo_" + sessionId);

    // when we load a photo, it will fade in from transparent so the
    // background of the container must be the session color to avoid a white flash
    ViewParent parent = photoView.getParent();
    if (parent != null && parent instanceof View) {
        ((View) parent).setBackgroundColor(sessionColor);
    } else {
        photoView.setBackgroundColor(sessionColor);
    }

    String photo = result.getPhotoUrl();
    if (!TextUtils.isEmpty(photo)) {
        mImageLoader.loadImage(photo, photoView, true /*crop*/);
    } else {
        // cleaning the (potentially) recycled photoView, in case this session has no photo:
        photoView.setImageDrawable(null);
    }

    // render title
    titleView.setText(sessionTitle == null ? "?" : sessionTitle);

    // render subtitle into either the subtitle view, or the short subtitle view, as available
    if (subtitleView != null) {
        subtitleView.setText(result.getAddress());
    } else if (shortSubtitleView != null) {
        shortSubtitleView.setText(result.getAddress());
    }

    // render category
    //        if (categoryView != null) {
    //            TagMetadata.Tag groupTag = mTagMetadata.getSessionGroupTag(tags);
    //            if (groupTag != null && !Config.Tags.SESSIONS.equals(groupTag.getId())) {
    //                categoryView.setText(groupTag.getName());
    //                categoryView.setVisibility(View.VISIBLE);
    //            } else {
    //                categoryView.setVisibility(View.GONE);
    //            }
    //        }

    // if a snippet view is available, render the session snippet there.
    if (snippetView != null) {
        //if (mIsSearchCursor) {
        // render the search snippet into the snippet view
        snippetView.setText(styledSnippet);
        //            } else {
        //                // render speaker names and abstracts into the snippet view
        //                mBuffer.setLength(0);
        //                if (!TextUtils.isEmpty(speakerNames)) {
        //                    mBuffer.append(speakerNames).append(". ");
        //                }
        //                if (!TextUtils.isEmpty(sessionAbstract)) {
        //                    mBuffer.append(sessionAbstract);
        //                }
        //                snippetView.setText(mBuffer.toString());
        //            }
    }

    //        if (abstractView != null && !mIsSearchCursor) {
    //            // render speaker names and abstracts into the abstract view
    //            mBuffer.setLength(0);
    //            if (!TextUtils.isEmpty(speakerNames)) {
    //                mBuffer.append(speakerNames).append("\n\n");
    //            }
    //            if (!TextUtils.isEmpty(sessionAbstract)) {
    //                mBuffer.append(sessionAbstract);
    //            }
    //            abstractView.setText(mBuffer.toString());
    //        }

    // in expanded mode, the box background color follows the session color
    //if (useExpandedMode()) {
    boxView.setBackgroundColor(sessionColor);
    //}

    // show or hide the "in my schedule" indicator
    view.findViewById(R.id.indicator_in_schedule).setVisibility(starred ? View.VISIBLE : View.INVISIBLE);

    // if we are in condensed mode and this card is the hero card (big card at the top
    // of the screen), set up the message card if necessary.
    if (groupId == HERO_GROUP_ID) {
        // this is the hero view, so we might want to show a message card
        final boolean cardShown = setupMessageCard(view);

        // if this is the wide hero layout, show or hide the card or the session abstract
        // view, as appropriate (they are mutually exclusive).
        final View cardContainer = view.findViewById(R.id.message_card_container_wide);
        final View abstractContainer = view.findViewById(R.id.session_abstract);
        if (cardContainer != null && abstractContainer != null) {
            cardContainer.setVisibility(cardShown ? View.VISIBLE : View.GONE);
            abstractContainer.setVisibility(cardShown ? View.GONE : View.VISIBLE);
            abstractContainer.setBackgroundColor(sessionColor);
        }
    }

    // if this session is live right now, display the "LIVE NOW" icon on top of it
    View liveNowBadge = view.findViewById(R.id.live_now_badge);
    if (liveNowBadge != null) {
        liveNowBadge.setVisibility(happeningNow && hasLivestream ? View.VISIBLE : View.GONE);
    }

    // if this view is clicked, open the session details view
    final View finalPhotoView = photoView;
    sessionTargetView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mCallbacks.onSessionSelected(sessionId, finalPhotoView);
        }
    });

    // animate this card
    //        if (dataIndex > mMaxDataIndexAnimated) {
    //            mMaxDataIndexAnimated = dataIndex;
    //        }
}

From source file:com.geecko.QuickLyric.fragment.LocalLyricsFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    final MainActivity mainActivity = ((MainActivity) this.getActivity());
    super.onViewCreated(view, savedInstanceState);
    if (this.isHidden())
        return;//w  w w . j a va2  s  .  c o  m

    DrawerAdapter drawerAdapter = ((DrawerAdapter) ((ListView) mainActivity.findViewById(R.id.drawer_list))
            .getAdapter());
    if (drawerAdapter.getSelectedItem() != 1) {
        drawerAdapter.setSelectedItem(1);
        drawerAdapter.notifyDataSetChanged();
    }

    if (!megaListView.hasOnGroupClickListener())
        megaListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {

            @Override
            public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
                final ImageView indicator = (ImageView) v.findViewById(R.id.group_indicator);
                RotateAnimation anim;
                if (megaListView.isGroupExpanded(groupPosition)) {
                    megaListView.collapseGroupWithAnimation(groupPosition);
                    if (indicator != null) {
                        anim = new RotateAnimation(180f, 360f, indicator.getWidth() / 2,
                                indicator.getHeight() / 2);
                        anim.setInterpolator(new DecelerateInterpolator(3));
                        anim.setDuration(500);
                        anim.setFillAfter(true);
                        indicator.startAnimation(anim);
                    }
                } else {
                    megaListView.expandGroupWithAnimation(groupPosition);
                    if (indicator != null) {
                        anim = new RotateAnimation(0f, 180f, indicator.getWidth() / 2,
                                indicator.getHeight() / 2);
                        anim.setInterpolator(new DecelerateInterpolator(2));
                        anim.setDuration(500);
                        anim.setFillAfter(true);
                        indicator.startAnimation(anim);
                    }
                }
                return true;
            }
        });

    if (!megaListView.hasOnChildClickListener())
        megaListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
            @Override
            public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition,
                    long id) {
                if (mSwiping) {
                    mSwiping = false;
                    return false;
                }
                final MainActivity mainActivity = (MainActivity) getActivity();
                megaListView.setOnChildClickListener(null); // prevents bug on double tap
                mainActivity.updateLyricsFragment(R.animator.slide_out_start, R.animator.slide_in_start, true,
                        ((LocalAdapter) megaListView.getExpandableListAdapter()).getChild(groupPosition,
                                childPosition));
                return true;
            }
        });

    this.isActiveFragment = true;
    new DBContentLister(this).execute();
}

From source file:it.configure.imageloader.zoom.PhotoViewAttacher.java

@Override
public final void onFling(float startX, float startY, float velocityX, float velocityY) {
    if (DEBUG) {// w  ww.java2s.  c  om
        Log.d(LOG_TAG, "onFling. sX: " + startX + " sY: " + startY + " Vx: " + velocityX + " Vy: " + velocityY);
    }

    ImageView imageView = getImageView();
    if (hasDrawable(imageView)) {
        mCurrentFlingRunnable = new FlingRunnable(imageView.getContext());
        mCurrentFlingRunnable.fling(imageView.getWidth(), imageView.getHeight(), (int) velocityX,
                (int) velocityY);
        imageView.post(mCurrentFlingRunnable);
    }
}

From source file:com.sociablue.nanodegree_p1.MovieListFragment.java

private void initializeFab(View rootView) {
    final RelativeLayout buttonContainer = (RelativeLayout) rootView.findViewById(R.id.menu_button_container);
    final FloatingActionButton Fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
    final ImageView bottomBar = (ImageView) rootView.findViewById(R.id.menu_bottom_bar);
    final ImageView topBar = (ImageView) rootView.findViewById(R.id.menu_top_bar);
    Fab.setOnClickListener(new View.OnClickListener() {
        @TargetApi(Build.VERSION_CODES.LOLLIPOP)
        @Override//from  w ww.j a  va2  s.co m
        public void onClick(View v) {

            //Menu Button Icon Animation
            //Setting up necessary variables
            long animationDuration = 500;
            float containerHeight = buttonContainer.getHeight();
            float containerCenterY = containerHeight / 2;
            float containerCenterX = buttonContainer.getWidth() / 2;
            float topBarCenter = topBar.getTop() + topBar.getHeight() / 2;
            float widthOfBar = topBar.getWidth();
            float heightOfBar = topBar.getHeight();
            final float distanceBetweenBars = (containerCenterY - topBarCenter);

            /**
             *TODO: Refactor block of code to use Value Property Animator. Should be more efficient to animate multiple properties
             *and objects at the same time. Also, will try to break intialization into smaller functions.
             */

            //Setting up animations of hamburger bars and rotation

            /**
             * Animation For Top Menu Button Icon Bar. Sliding from the top to rest on top of the middle bar.
             * Y Translation is 1/2 the height of the hamburger bar minus the distance.
             * Subtracting the distance from the height because the distance between bars is
             * calculated of the exact center of the button.
             * With out the subtraction the bar would translate slightly below the middle bar.
             */
            float yTranslation = heightOfBar / 2 - distanceBetweenBars;
            float xTranslation = widthOfBar / 2 + heightOfBar / 2;
            TranslateAnimation topBarTranslationAnim = new TranslateAnimation(Animation.ABSOLUTE, 0f,
                    Animation.ABSOLUTE, 0F, Animation.ABSOLUTE, 0f, Animation.ABSOLUTE, distanceBetweenBars);
            topBarTranslationAnim.setDuration((long) (animationDuration * 0.8));
            topBarTranslationAnim.setFillAfter(true);

            //Animation for bottom hamburger bar. Translates and Rotates to create 'X'
            AnimationSet bottomBarAnimation = new AnimationSet(true);
            bottomBarAnimation.setFillAfter(true);

            //Rotate to create cross. (The cross becomes the X after the button rotation completes"
            RotateAnimation bottomBarRotationAnimation = new RotateAnimation(0f, 90f,
                    Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 1f);
            bottomBarRotationAnimation.setDuration(animationDuration);
            bottomBarAnimation.addAnimation(bottomBarRotationAnimation);

            //Translate to correct X alignment
            TranslateAnimation bottomBarTranslationAnimation = new TranslateAnimation(Animation.ABSOLUTE, 0f,
                    Animation.ABSOLUTE, -xTranslation, Animation.ABSOLUTE, 0f, Animation.ABSOLUTE,
                    -yTranslation);
            bottomBarTranslationAnimation.setDuration(animationDuration);
            bottomBarAnimation.addAnimation(bottomBarTranslationAnimation);

            //Button Specific Animations
            //Rotate Button Container
            RotateAnimation containerRotationAnimation = new RotateAnimation(0, 135f,
                    Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
            containerRotationAnimation.setDuration(animationDuration);
            containerRotationAnimation.setFillAfter(true);

            //Animate change of button color between Active and Disabled colors that have been
            //defined in color.xml
            int activeColor = getResources().getColor(R.color.active_button);
            int disabledColor = getResources().getColor(R.color.disabled_button);

            //Need to use ValueAnimator because property animator does not support BackgroundTint
            ValueAnimator buttonColorAnimation = ValueAnimator.ofArgb(activeColor, disabledColor);
            buttonColorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    Fab.setBackgroundTintList(ColorStateList.valueOf((int) animation.getAnimatedValue()));
                }
            });
            buttonColorAnimation.setDuration(animationDuration);

            //Start all the animations
            topBar.startAnimation(topBarTranslationAnim);
            bottomBar.startAnimation(bottomBarAnimation);
            buttonContainer.startAnimation(containerRotationAnimation);
            buttonColorAnimation.start();

            //Toogle mMenu open and closed
            if (mMenu.isOpen()) {
                //If mMenu is open, do the reverse of the animation
                containerRotationAnimation
                        .setInterpolator(new ReverseInterpolator(new AccelerateInterpolator()));
                topBarTranslationAnim.setInterpolator(new ReverseInterpolator(new AccelerateInterpolator()));
                bottomBarAnimation.setInterpolator(new ReverseInterpolator(new AccelerateInterpolator()));
                buttonColorAnimation.setInterpolator(new ReverseInterpolator(new LinearInterpolator()));
                mMenu.close();
            } else {
                bottomBarAnimation.setInterpolator(new AccelerateInterpolator());
                mMenu.open();
            }
        }
    });
}