コード例 #1
0
  private void clearHistogram() {
    mMostCommonKeyHeight = 0;
    mMaxHeightCount = 0;
    mHeightHistogram.clear();

    mMaxWidthCount = 0;
    mMostCommonKeyWidth = 0;
    mWidthHistogram.clear();
  }
コード例 #2
0
 @Override
 protected void onSizeChanged(
     final int width, final int height, final int oldwidth, final int oldheight) {
   _textCachedSizes.clear();
   super.onSizeChanged(width, height, oldwidth, oldheight);
   if (width != oldwidth || height != oldheight) reAdjust();
 }
コード例 #3
0
 /** Cache should be reset whenever the cursor changes or groups are expanded or collapsed. */
 private void resetCache() {
   mCount = -1;
   mLastCachedListPosition = -1;
   mLastCachedCursorPosition = -1;
   mLastCachedGroup = -1;
   mPositionMetadata.listPosition = -1;
   mPositionCache.clear();
 }
コード例 #4
0
  private void createViewMetrics(Stack<ViewConstraints> springMetrics) {
    springMetrics.clear();
    mIdToViewConstraints.clear();

    if (mRootConstraints != null) {
      mRootConstraints.release();
      for (ViewConstraints mViewConstraint : mViewConstraints) {
        mViewConstraint.release();
      }

      mRootConstraints.reset(this);
      resizeViewConstraintsArray(getChildCount());
    } else {
      mRootConstraints = new ViewConstraints(this, mLayoutMath);
      mViewConstraints = new ViewConstraints[getChildCount()];
    }

    mRootConstraints.left.setValueObject(mLayoutMath.variable(0));
    mRootConstraints.top.setValueObject(mLayoutMath.variable(0));

    final int count = getChildCount();

    for (int i = 0; i < count; i++) {
      final View v = getChildAt(i);
      mIdToViewConstraints.append(v.getId(), i);
      if (mViewConstraints[i] == null) {
        mViewConstraints[i] = new ViewConstraints(v, mLayoutMath);
      } else {
        mViewConstraints[i].reset(v);
      }
    }

    for (int i = 0; i < count; i++) {
      final ViewConstraints viewConstraints = mViewConstraints[i];
      final LayoutParams layoutParams = (LayoutParams) viewConstraints.getView().getLayoutParams();

      if (layoutParams.getWidthWeight() > 0) {
        viewConstraints.markAsHorizontalSpring();
      }

      if (layoutParams.getHeightWeight() > 0) {
        viewConstraints.markAsVerticalSpring();
      }

      int[] childRules = layoutParams.getRelations();
      for (int relation : VALID_RELATIONS) {
        final ViewConstraints metrics = getViewMetrics(childRules[relation]);
        if (metrics != null) {
          metrics.updateRelation(viewConstraints, relation);
        }
      }
      if (viewConstraints.isHorizontalSpring() || viewConstraints.isVerticalSpring()) {
        springMetrics.add(viewConstraints);
      }
    }
  }
コード例 #5
0
 @Override
 public void setTextSize(final int unit, final float size) {
   final Context c = getContext();
   Resources r;
   if (c == null) r = Resources.getSystem();
   else r = c.getResources();
   _maxTextSize = TypedValue.applyDimension(unit, size, r.getDisplayMetrics());
   _textCachedSizes.clear();
   adjustTextSize();
 }
コード例 #6
0
 /**
  * Enables or disables size caching, enabling it will improve performance where you are animating
  * a value inside TextView. This stores the font size against getText().length() Be careful though
  * while enabling it as 0 takes more space than 1 on some fonts and so on.
  *
  * @param enable enable font size caching
  */
 public void setEnableSizeCache(final boolean enable) {
   _enableSizeCache = enable;
   _textCachedSizes.clear();
   adjustTextSize();
 }
コード例 #7
0
 @Override
 public void setTextSize(final float size) {
   _maxTextSize = size;
   _textCachedSizes.clear();
   adjustTextSize();
 }
コード例 #8
0
 @Override
 public void setTextSize(float size) {
   mMaxTextSize = size;
   mTextCachedSizes.clear();
   adjustTextSize(getText().toString());
 }
コード例 #9
0
 /**
  * Enables or disables size caching, enabling it will improve performance where you are animating
  * a value inside TextView. This stores the font size against getText().length() Be careful though
  * while enabling it as 0 takes more space than 1 on some fonts and so on.
  *
  * @param enable enable font size caching
  */
 public void enableSizeCache(boolean enable) {
   mEnableSizeCache = enable;
   mTextCachedSizes.clear();
   adjustTextSize(getText().toString());
 }
コード例 #10
0
 /** Removes all entries from the map. */
 public void unmapAll() {
   mMap.clear();
 }