Tabnine Logo
MathUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
MathUtils
in
android.support.v4.math

Best Java code snippets using android.support.v4.math.MathUtils (Showing top 6 results out of 315)

origin: skimarxall/AnchorSheetBehavior

@Override
public int clampViewPositionVertical(View child, int top, int dy) {
  return MathUtils.clamp(top, mMinOffset, mHideable ? mParentHeight : mMaxOffset);
}
origin: laenger/ViewPagerBottomSheet

@Override
public int clampViewPositionVertical(View child, int top, int dy) {
  return MathUtils.clamp(top, mMinOffset, mHideable ? mParentHeight : mMaxOffset);
}
origin: opacapp/multiline-collapsingtoolbar

/**
 * Set the value indicating the current scroll value. This decides how much of the
 * background will be displayed, as well as the title metrics/positioning.
 *
 * A value of {@code 0.0} indicates that the layout is fully expanded.
 * A value of {@code 1.0} indicates that the layout is fully collapsed.
 */
void setExpansionFraction(float fraction) {
  fraction = MathUtils.clamp(fraction, 0f, 1f);
  if (fraction != mExpandedFraction) {
    mExpandedFraction = fraction;
    calculateCurrentOffsets();
  }
}
origin: SouthernBox/NestedCalendar

int calendarOffset = MathUtils.clamp(
    getTopAndBottomOffset() - dy, calendarMinOffset, 0);
setTopAndBottomOffset(calendarOffset);
if (behavior instanceof CalendarScrollBehavior) {
  final CalendarScrollBehavior listBehavior = (CalendarScrollBehavior) behavior;
  int listOffset = MathUtils.clamp(
      listBehavior.getTopAndBottomOffset() - dy, -listMaxOffset, 0);
  listBehavior.setTopAndBottomOffset(listOffset);
origin: DarkionAvey/SwipeSpinnerWidget

  @Override
  public void run() {
    float translation = (isVertical() ? mRecyclerView.getTranslationY() : mRecyclerView.getTranslationX());
    float fraction = MathUtils.clamp(Math.abs((translation / getDragThreshold())), 0f, 1f);
    int scroll = (int) (0f - translation * Math.pow(fraction, SCROLL_EXPONENT));
    if (Math.abs(scroll) > 0 && (isVertical() && mRecyclerView.canScrollVertically(scroll) || !isVertical() && mRecyclerView.canScrollHorizontally(scroll))) {
      if (mScrollCallbacks != null)
        mScrollCallbacks.onScrolled((translation > 0 ? 1f : -1) * fraction);
      mRecyclerView.scrollBy(isVertical() ? 0 : scroll, isVertical() ? scroll : 0);
    }
    mRecyclerView.post(mScrollByRunnable);
  }
};
origin: opacapp/multiline-collapsingtoolbar

offsetHelper.setTopAndBottomOffset(MathUtils.clamp(
    -verticalOffset, 0, getMaxOffsetForPinChild(child)));
break;
android.support.v4.mathMathUtils

Most used methods

  • clamp

Popular in Java

  • Finding current android device location
  • getSharedPreferences (Context)
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now