Java Code Examples for android.support.design.widget.FloatingActionButton#getVisibility()
The following examples show how to use
android.support.design.widget.FloatingActionButton#getVisibility() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScrollAwareFABBehavior.java From yahnac with Apache License 2.0 | 6 votes |
@Override public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (loginSharedPreferences.isLoggedIn()) { if (dyConsumed > 0 && !this.isAnimatingOut && child.getVisibility() == View.VISIBLE) { animateOut(child); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { animateIn(child); } } }
Example 2
Source File: ScrollFABBehavior.java From chaoli-forum-for-android-2 with GNU General Public License v3.0 | 6 votes |
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { child.hide(new FloatingActionButton.OnVisibilityChangedListener() { @Override public void onHidden(FloatingActionButton fab) { super.onHidden(fab); fab.setVisibility(View.INVISIBLE); } }); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { child.show(); } }
Example 3
Source File: ScrollAwareFABBehavior.java From privacy-friendly-passwordgenerator with GNU General Public License v3.0 | 6 votes |
@Override public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { // User scrolled down and the FAB is currently visible -> hide the FAB child.hide(new FloatingActionButton.OnVisibilityChangedListener() { @Override public void onHidden(FloatingActionButton fab) { super.onHidden(fab); fab.setVisibility(View.INVISIBLE); } }); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { // User scrolled up and the FAB is currently not visible -> show the FAB child.show(); } }
Example 4
Source File: FloatingActionButtonScrollBehavior.java From FakeWeather with Apache License 2.0 | 6 votes |
@Override public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { /** design lib 升级到 25.1.0 导致 child.hide() 效果失效,法克哟 * http://stackoverflow.com/questions/41761736/android-design-library-25-1-0-causes-floatingactionbutton-behavior-to-stop-worki */ child.hide(new FloatingActionButton.OnVisibilityChangedListener() { @Override public void onHidden(FloatingActionButton fab) { super.onHidden(fab); fab.setVisibility(View.INVISIBLE); } }); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { child.show(); } }
Example 5
Source File: ScrollAwareFABBehavior.java From Birdays with Apache License 2.0 | 6 votes |
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { // Since Support Library 25.1.0 you must explicitly set visibility to show fab on scroll later child.hide(new FloatingActionButton.OnVisibilityChangedListener() { @Override public void onHidden(FloatingActionButton fab) { super.onHidden(fab); fab.setVisibility(View.INVISIBLE); } }); } else if (dyConsumed < 0 && child.getVisibility() == View.INVISIBLE) { child.show(); } }
Example 6
Source File: ScrollAwareFABBehavior2.java From MarkdownEditors with Apache License 2.0 | 5 votes |
@Override public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) { // User scrolled down and the FAB is currently visible -> hide the FAB animateOut(child); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { // User scrolled up and the FAB is currently not visible -> show the FAB animateIn(child); } }
Example 7
Source File: FABScrollBehavior.java From Expense-Tracker-App with MIT License | 5 votes |
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { child.hide(); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { child.show(); } }
Example 8
Source File: ScrollAwareFABBehavior.java From materialup with Apache License 2.0 | 5 votes |
@Override public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) { // User scrolled down and the FAB is currently visible -> hide the FAB toggle(child, false, false); } else if (dyConsumed < 0 && child.getVisibility() == View.INVISIBLE) { // User scrolled up and the FAB is currently not visible -> show the FAB toggle(child, true, false); } }
Example 9
Source File: ScrollAwareFABBehavior.java From android-wallet-app with GNU General Public License v3.0 | 5 votes |
@Override public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull FloatingActionButton child, @NonNull View target, int dxConsumed, int dyConsunmed, int dxUnconsumed, int dyUnconsumed, int type) { if (dyConsunmed > 0 && child.getVisibility() == View.VISIBLE) { child.hide(); } else if (dyConsunmed < 0 && child.getVisibility() != View.VISIBLE) { child.show(); } }
Example 10
Source File: ScrollAwareFABBehavior.java From AndroidBleManager with Apache License 2.0 | 5 votes |
@Override public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) { // User scrolled down and the FAB is currently visible -> hide the FAB animateOut(child); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { // User scrolled up and the FAB is currently not visible -> show the FAB animateIn(child); } }
Example 11
Source File: ScrollAwareFABBehavior.java From faceswap with Apache License 2.0 | 5 votes |
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if ((dyConsumed > 0) && (child.getVisibility() == View.VISIBLE)) { child.hide(); } else if ((dyConsumed < 0) && (child.getVisibility() != View.VISIBLE)) { child.show(); } }
Example 12
Source File: FABScrollBehaviour.java From hr with GNU Affero General Public License v3.0 | 5 votes |
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { child.hide(); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { child.show(); } }
Example 13
Source File: ScrollAwareFABBehavior.java From Loop with Apache License 2.0 | 5 votes |
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && !this.isAnimatingOut && child.getVisibility() == View.VISIBLE) { animateOut(child); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { animateIn(child); } }
Example 14
Source File: ScrollAwareFABBehavior.java From Bookster with Apache License 2.0 | 5 votes |
@Override public void onNestedScroll(@NonNull final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, @NonNull final View target, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) { animateOut(child); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { animateIn(child); } }
Example 15
Source File: ScrollAwareFABBehavior.java From GracefulMovies with Apache License 2.0 | 5 votes |
@Override public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull FloatingActionButton child, @NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type); if (dyConsumed > 0 && !mIsAnimatingOut && child.getVisibility() == View.VISIBLE) { animateOut(child); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { animateIn(child); } }
Example 16
Source File: FABScrollBehaviour.java From framework with GNU Affero General Public License v3.0 | 5 votes |
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { child.hide(); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { child.show(); } }
Example 17
Source File: RefreshButtonBehavior.java From QuickLyric with GNU General Public License v3.0 | 5 votes |
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if ((dyUnconsumed > 0 || dyConsumed > 25) && !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) { animateOut(child); } else if ((dyUnconsumed < 0 || dyConsumed < -10) && child.getVisibility() != View.VISIBLE) { animateIn(child); } }
Example 18
Source File: ScrollAwareFABBehavior.java From Toutiao with Apache License 2.0 | 5 votes |
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { child.setVisibility(View.INVISIBLE); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { child.show(); } }
Example 19
Source File: ScrollAwareFABBehavior.java From Awesome-WanAndroid with Apache License 2.0 | 5 votes |
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { child.setVisibility(View.INVISIBLE); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { child.show(); } }
Example 20
Source File: ScrollAwareFABBehavior.java From SteamGifts with MIT License | 4 votes |
@Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (child.getTag() == null) { return; } // try to get the current page, if there's any. View view = coordinatorLayout; ViewPager viewPager = (ViewPager) coordinatorLayout.findViewById(R.id.viewPager); if (viewPager != null && viewPager.getAdapter() instanceof FragmentAdapter) { int currentPage = viewPager.getCurrentItem(); FragmentAdapter pagerAdapter = (FragmentAdapter) viewPager.getAdapter(); Fragment currentItem = pagerAdapter.getItem(currentPage); view = currentItem.getView(); } if (view == null) { // We do not have a view we can immediately find. child.hide(); return; } // Hide if we're over the first item RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.list); if (recyclerView != null && recyclerView.getLayoutManager() instanceof LinearLayoutManager) { LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); if (layoutManager.findFirstVisibleItemPosition() == 0) { child.hide(); } else if (dyConsumed > 1 && child.getVisibility() == View.VISIBLE) child.hide(); else if (dyConsumed < 1 && child.getVisibility() != View.VISIBLE) child.show(); } else { // no recyclerview to attach to? child.hide(); } }