Java Code Examples for android.support.design.widget.FloatingActionButton#show()
The following examples show how to use
android.support.design.widget.FloatingActionButton#show() .
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: MainActivity.java From rosetta with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); // This floating button switching between Arabic and English Locales manually upon click final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); setSupportActionBar(toolbar); if (MainApplication.languageSwitcher.getCurrentLocale().getLanguage().equals("ar")) { fab.hide(); } else { fab.show(); } fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { MainApplication.languageSwitcher.switchToLaunch(MainActivity.this); } }); }
Example 2
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 3
Source File: AnagramsActivity.java From jterm-cswithandroid with Apache License 2.0 | 6 votes |
private void processWord(EditText editText) { TextView resultView = (TextView) findViewById(R.id.resultView); String word = editText.getText().toString().trim().toLowerCase(); if (word.length() == 0) { return; } String color = "#cc0029"; if (dictionary.isGoodWord(word, currentWord) && anagrams.contains(word)) { anagrams.remove(word); color = "#00aa29"; } else { word = "X " + word; } resultView.append(Html.fromHtml(String.format("<font color=%s>%s</font><BR>", color, word))); editText.setText(""); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.show(); }
Example 4
Source File: QuizActivity.java From android-topeka with Apache License 2.0 | 6 votes |
private void initLayout(String categoryId) { setContentView(R.layout.activity_quiz); //noinspection PrivateResource mIcon = (ImageView) findViewById(R.id.icon); int resId = getResources().getIdentifier(IMAGE_CATEGORY + categoryId, DRAWABLE, getApplicationContext().getPackageName()); mIcon.setImageResource(resId); mIcon.setImageResource(resId); ViewCompat.animate(mIcon) .scaleX(1) .scaleY(1) .alpha(1) .setInterpolator(mInterpolator) .setStartDelay(300) .start(); mQuizFab = (FloatingActionButton) findViewById(R.id.fab_quiz); mQuizFab.setImageResource(R.drawable.ic_play); if (mSavedStateIsPlaying) { mQuizFab.hide(); } else { mQuizFab.show(); } mQuizFab.setOnClickListener(mOnClickListener); }
Example 5
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 6
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 7
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 8
Source File: AutoHideFAB.java From Slide 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 (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { child.hide(); } else if (dyConsumed < 0 && child.getVisibility() == View.GONE) { child.show(); } }
Example 9
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 10
Source File: ScrollAwareFABBehavior.java From Nibo with MIT License | 5 votes |
@Override public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton child, View dependency) { /** * Because we are not moving it, we always return false in this method. */ if (offset == 0) setOffsetValue(parent); if (mBottomSheetBehaviorRef == null) getBottomSheetBehavior(parent); int DyFix = getDyBetweenChildAndDependency(child, dependency); if ((child.getY() + DyFix) < offset) child.hide(); else if ((child.getY() + DyFix) >= offset) { /** * We are calculating every time point in Y where BottomSheet get {@link BottomSheetBehaviorGoogleMapsLike#STATE_COLLAPSED}. * If PeekHeight change dynamically we can reflect the behavior asap. */ if (mBottomSheetBehaviorRef == null || mBottomSheetBehaviorRef.get() == null) getBottomSheetBehavior(parent); int collapsedY = dependency.getHeight() - mBottomSheetBehaviorRef.get().getPeekHeight(); if ((child.getY() + DyFix) > collapsedY) child.hide(); else child.show(); } return false; }
Example 11
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 12
Source File: FABScrollBehavior.java From TinyList with GNU General Public License v2.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 || dyUnconsumed > 0) && child.getVisibility() == View.VISIBLE) { if (FABScrollBehavior.canHideChild) child.hide(); } else if ((dyConsumed < 0 || dyUnconsumed < 0) && child.getVisibility() == View.GONE) { child.show(); } }
Example 13
Source File: ScrollAwareFABBehavior.java From MicroReader 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 14
Source File: ScrollAwareFABBehavior.java From Rumble 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 ((dyConsumed > 0) && (child.getVisibility() == View.VISIBLE)) { child.hide(); } else if ((dyConsumed < 0) && (child.getVisibility() != View.VISIBLE)) { child.show(); } }
Example 15
Source File: GenerateKeyActivity.java From privacy-friendly-food-tracker with GNU General Public License v3.0 | 5 votes |
@Override public void onHidden(FloatingActionButton fab) { super.onHidden(fab); if(fabShouldBeShown){ fab.show(); } }
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: MainActivity.java From v9porn with MIT License | 5 votes |
private void showFloatingActionButton(final FloatingActionButton fabSearch) { fabSearch.show(new FloatingActionButton.OnVisibilityChangedListener() { @Override public void onShown(FloatingActionButton fab) { fabSearch.requestLayout(); bottomNavigationBar.setFab(fab); } }); }
Example 18
Source File: FloatingActionButtonScrollBehavior.java From SeeWeather 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 && child.getVisibility() == View.VISIBLE) { child.hide(); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { child.show(); } }
Example 19
Source File: ScrollHideBehavior.java From octoandroid with GNU General Public License v3.0 | 4 votes |
@Override public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target) { super.onStopNestedScroll(coordinatorLayout, child, target); child.show(); }
Example 20
Source File: ScrollAwareFabBehaviorForDeleteActivities.java From privacy-friendly-shopping-list with Apache License 2.0 | 4 votes |
@Override public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target) { child.show(); }