@Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   mWidth = w;
   mHeight = h;
   initBarValues();
   super.onSizeChanged(w, h, oldw, oldh);
 }
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    final int edgePadding = (int) (EDGE_PADDING_DIP * mDensity);
    mLeftHandleX = edgePadding + mDimpleWidth / 2;
    final int length = isHoriz() ? w : h;
    mRightHandleX = length - edgePadding - mDimpleWidth / 2;
    mMidHandleX = length / 2;
    mDimpleSpacing = (length / 2) - mLeftHandleX;

    // bg matrix only needs to be calculated once
    mBgMatrix.setTranslate(0, 0);
    mBgMatrix.postScale(mDensityScaleFactor, mDensityScaleFactor);
    if (!isHoriz()) {
      // set up matrix for translating drawing of background and arrow assets
      final int left = w - mBackgroundHeight;
      mBgMatrix.preRotate(-90, 0, 0);
      if (mLenseMode) {
        mBgMatrix.postTranslate(left, h + mStatusBarSize);
        mBgMatrix.postScale(1, mStatusBarScale);
      } else mBgMatrix.postTranslate(left, h);
    } else {
      mBgMatrix.postTranslate(0, h - mBackgroundHeight);
    }
  }
Beispiel #3
1
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   width = w;
   height = h;
   setValue();
 }
Beispiel #4
1
  @Override
  protected void onSizeChanged(final int w, final int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    if (mLoader != null) {
      try {
        mLoader.join();
      } catch (InterruptedException e) {
        Log.e(LOG_TAG, "Unexpected error", e);
      }
    }
    if (svgResourceId != 0) {
      mLoader =
          new Thread(
              new Runnable() {
                @Override
                public void run() {

                  svgUtils.load(getContext(), svgResourceId);

                  synchronized (mSvgLock) {
                    width = w - getPaddingLeft() - getPaddingRight();
                    height = h - getPaddingTop() - getPaddingBottom();
                    paths = svgUtils.getPathsForViewport(width, height);
                    updatePathsPhaseLocked();
                  }
                }
              },
              "SVG Loader");
      mLoader.start();
    }
  }
Beispiel #5
1
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   maxCircleSize = w / 2;
   tempBitmap = Bitmap.createBitmap(getWidth(), getWidth(), Bitmap.Config.ARGB_8888);
   tempCanvas = new Canvas(tempBitmap);
 }
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    this.width = w;
    this.height = h;
    itemWidth = Math.min(itemWidth, width);
    int number = height / itemHeight;
    if ((number & 1) == 1) {
      this.numberPerPage = number;
    } else {
      this.numberPerPage = number - 1;
    }
    this.topBottomPadding = (height - numberPerPage * itemHeight) / 2;
    this.leftRightPadding = (width - itemWidth) / 2;
    this.originalSelectedIndex = 0;
    this.selectedIndex = 0;

    itemList = new ArrayList<ItemView>();
    for (int i = -numberPerPage / 2; i < stringList.size() + numberPerPage / 2; i++) {
      ItemView itemView = new ItemView(getContext());
      itemView.setIndex(i);
      itemView.setyOffset((i + numberPerPage / 2) * itemHeight);
      LogUtil.i("chenxu", "onSizeChanged:i:" + i + " yoffset:" + itemView.getyOffset());
      if (i >= 0 && i < stringList.size()) {
        itemView.setText(stringList.get(i));
      } else {
        itemView.setText("");
      }
      itemList.add(itemView);
    }
  }
Beispiel #7
0
  @Override
  protected synchronized void onSizeChanged(int w, int h, int oldw, int oldh) {

    // update pixel conversion values
    PixelUtils.init(getContext());

    // disable hardware acceleration if it's not explicitly supported
    // by the current Plot implementation. this check only applies to
    // honeycomb and later environments.
    if (Build.VERSION.SDK_INT >= 11) {
      if (!isHwAccelerationSupported() && isHardwareAccelerated()) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
      }
    }

    // pingPong is only used in background rendering mode.
    if (renderMode == RenderMode.USE_BACKGROUND_THREAD) {
      pingPong.resize(h, w);
    }

    RectF cRect = new RectF(0, 0, w, h);
    RectF mRect = boxModel.getMarginatedRect(cRect);
    RectF pRect = boxModel.getPaddedRect(mRect);

    layout(new DisplayDimensions(cRect, mRect, pRect));
    super.onSizeChanged(w, h, oldw, oldh);
    if (renderThread != null && !renderThread.isAlive()) {
      renderThread.start();
    }
  }
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    // Reinitialize the current animation.
    mCurrentAnim = null;
  }
  @Override
  protected void onSizeChanged(final int w, final int h, final int oldw, final int oldh) {
    this.width = w;
    this.height = h;

    super.onSizeChanged(w, h, oldw, oldh);
  }
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   centerX = w / 2;
   centerY = h / 2;
   radarRadius = Math.min(w, h);
 }
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    int thumbWidth = mThumb.getIntrinsicWidth();
    int thumbHeight = mThumb.getIntrinsicHeight();
    int addedThumb = mAddedTouchBounds;
    int halfThumb = thumbWidth / 2;
    int paddingLeft = getPaddingLeft() + addedThumb;
    int paddingRight = getPaddingRight();
    int bottom = getHeight() - getPaddingBottom() - addedThumb;
    mThumb.setBounds(paddingLeft, bottom - thumbHeight, paddingLeft + thumbWidth, bottom);
    int trackHeight = Math.max(mTrackHeight / 2, 1);
    mTrack.setBounds(
        paddingLeft + halfThumb,
        bottom - halfThumb - trackHeight,
        getWidth() - halfThumb - paddingRight - addedThumb,
        bottom - halfThumb + trackHeight);
    int scrubberHeight = Math.max(mScrubberHeight / 2, 2);
    mScrubber.setBounds(
        paddingLeft + halfThumb,
        bottom - halfThumb - scrubberHeight,
        paddingLeft + halfThumb,
        bottom - halfThumb + scrubberHeight);

    // Update the thumb position after size changed
    updateThumbPosFromCurrentProgress();
  }
Beispiel #12
0
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   this.width = w / 9f;
   this.height = h / 9f;
   getRect(selX, selY, selRect);
   super.onSizeChanged(w, h, oldw, oldh);
 }
Beispiel #13
0
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   ww = w;
   hh = h;
   super.onSizeChanged(w, h, oldw, oldh);
   SetPosition(1500, 1500);
 }
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    //        Logger.d(TAG, String.format("onSizeChanged, w: %s, h: %s, oldw: %s, oldh: %s", w, h,
    // oldw, oldh));
    if (isFirst && w > 0 && h > 0) {
      isFirst = false;

      originWidth = w;
      originHeight = h;

      originRadius = Math.min(originWidth, originHeight) / 2;
      curRadius = originRadius;
      touchedPointRadius = originRadius;

      maxMoveLength = ABAppUtil.getDeviceHeight(context) / 6;

      refreshStartPoint();

      ViewGroup.LayoutParams lp = this.getLayoutParams();
      if (RelativeLayout.LayoutParams.class.isAssignableFrom(lp.getClass())) {
        originLp = (RelativeLayout.LayoutParams) lp;
      }
      newLp = new RelativeLayout.LayoutParams(lp.width, lp.height);
    }
  }
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    mWidth = w;
    mHeight = h;
  }
Beispiel #16
0
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   canvasBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
   drawCanvas = new Canvas(canvasBitmap);
   // view given size
 }
Beispiel #17
0
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   alphaPattern.setBounds(new Rect(0, 0, w, h));
   centerX = w / 2.0f;
   centerY = h / 2.0f;
 }
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   ww = w;
   hh = h;
   init();
   super.onSizeChanged(w, h, oldw, oldh);
 }
Beispiel #19
0
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    sHeight = getHeight();
    sWidth = getWidth();
    if (sHeight == 0 || sWidth == 0) {
      android.util.DisplayMetrics mMetrics = new android.util.DisplayMetrics();
      android.view.WindowManager wm =
          (android.view.WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
      wm.getDefaultDisplay().getMetrics(mMetrics);
      sHeight = mMetrics.heightPixels;
      sWidth = mMetrics.widthPixels;
    }

    if (sHeight < sWidth) {
      texY = 0;
      texX = (sWidth - sHeight) / 2;
      ;
      texWidth = sHeight;
    } else {
      texY = (sHeight - sWidth) / 2;
      texX = 0;
      texWidth = sWidth;
    }

    mBitmapViewWidth = (int) (sWidth / 2);
    mCenterX = mBitmapViewWidth;
    mCenterY = sHeight / 2;
    mScreenRadius = Math.min(mBitmapViewWidth, sHeight / 2);
    // mBitmap.getHeight()));
    setDrawingCacheBackgroundColor(Color.TRANSPARENT);
    setBitmap();
    drawIntoBitmap();
  }
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   mMeasureWidth = w;
   mMeasureHeigth = h;
   initView();
 }
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   mHeight = h;
   mWidth = w;
   recalculateIndicatorWidth();
 }
Beispiel #22
0
 /**
  * Use onSizeChanged instead of onAttachedToWindow to get the dimensions of the view, because this
  * method is called after measuring the dimensions of MATCH_PARENT & WRAP_CONTENT. Use this
  * dimensions to setup the bounds and paints.
  */
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   setupBounds(w, h);
   setupPaints();
   invalidate();
 }
Beispiel #23
0
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    mTotalWidth = w;
    mTotalHeight = h;
    mProgressWidth = mTotalWidth - mLeftMargin - mRightMargin;
    mArcRadius = (mTotalHeight - 2 * mLeftMargin) / 2;

    mOuterSrcRect = new Rect(0, 0, mOuterWidth, mOuterHeight);
    mOuterDestRect = new Rect(0, 0, mTotalWidth, mTotalHeight);

    mWhiteRectF =
        new RectF(
            mLeftMargin + mCurrentProgressPosition,
            mLeftMargin,
            mTotalWidth - mRightMargin,
            mTotalHeight - mLeftMargin);
    mOrangeRectF =
        new RectF(
            mLeftMargin + mArcRadius,
            mLeftMargin,
            mCurrentProgressPosition,
            mTotalHeight - mLeftMargin);

    mArcRectF =
        new RectF(
            mLeftMargin, mLeftMargin, mLeftMargin + 2 * mArcRadius, mTotalHeight - mLeftMargin);
    mArcRightLocation = mLeftMargin + mArcRadius;
  }
Beispiel #24
0
 public void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   outerRadius = w / 2;
   innerRadius = w / 4;
   actualX = outerRadius;
   actualY = outerRadius;
 }
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    // Account for padding
    float xpad = (float) (getPaddingLeft() + getPaddingRight());
    float ypad = (float) (getPaddingTop() + getPaddingBottom());

    float ww = (float) w - xpad;
    float hh = (float) h - ypad;
    float size = Math.min(ww, hh);

    // Figure out how big we can make the pie.
    backBound =
        new RectF(
            0.0f, 0.0f, size - coverPaint.getStrokeWidth(), size - coverPaint.getStrokeWidth());
    backBound.offsetTo(
        getPaddingLeft() + coverPaint.getStrokeWidth() / 2,
        getPaddingTop() + coverPaint.getStrokeWidth() / 2);

    coverBound =
        new RectF(
            0.0f, 0.0f, size - coverPaint.getStrokeWidth(), size - coverPaint.getStrokeWidth());
    coverBound.offsetTo(
        getPaddingLeft() + coverPaint.getStrokeWidth() / 2,
        getPaddingTop() + coverPaint.getStrokeWidth() / 2);
  }
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @SuppressLint("NewApi")
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {

    super.onSizeChanged(w, h, oldw, oldh);

    final Context ctx = getContext();

    // This is the initial point at which we know the size of the View.

    // Create the two thumb objects and position line in view
    final float yPos = h - mBarPaddingBottom;
    if (mIsRangeBar) {
      mLeftThumb = new PinView(ctx);
      mLeftThumb.init(ctx, yPos, 0, mPinColor, mTextColor, mCircleSize, mCircleColor);
    }
    mRightThumb = new PinView(ctx);
    mRightThumb.init(ctx, yPos, 0, mPinColor, mTextColor, mCircleSize, mCircleColor);

    // Create the underlying bar.
    final float marginLeft = mExpandedPinRadius;

    final float barLength = w - (2 * marginLeft);
    mBar =
        new Bar(
            ctx,
            marginLeft,
            yPos,
            barLength,
            mTickCount,
            mTickHeightDP,
            mTickColor,
            mBarWeight,
            mBarColor);

    // Initialize thumbs to the desired indices
    if (mIsRangeBar) {
      mLeftThumb.setX(marginLeft + (mLeftIndex / (float) (mTickCount - 1)) * barLength);
      mLeftThumb.setXValue(getPinValue(mLeftIndex));
    }
    mRightThumb.setX(marginLeft + (mRightIndex / (float) (mTickCount - 1)) * barLength);
    mRightThumb.setXValue(getPinValue(mRightIndex));

    // Set the thumb indices.
    final int newLeftIndex = mIsRangeBar ? mBar.getNearestTickIndex(mLeftThumb) : 0;
    final int newRightIndex = mBar.getNearestTickIndex(mRightThumb);

    // Call the listener.
    if (newLeftIndex != mLeftIndex || newRightIndex != mRightIndex) {
      if (mListener != null) {
        mListener.onRangeChangeListener(
            this, mLeftIndex, mRightIndex, getPinValue(mLeftIndex), getPinValue(mRightIndex));
      }
    }

    // Create the line connecting the two thumbs.
    mConnectingLine = new ConnectingLine(ctx, yPos, mConnectingLineWeight, mConnectingLineColor);
  }
Beispiel #27
0
    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
      super.onSizeChanged(w, h, oldw, oldh);

      mAlphaPattern = new AlphaPatternDrawable((int) (5 * mDensity));
      mAlphaPattern.setBounds(
          borderSize, borderSize, this.getWidth() - borderSize, this.getHeight() - borderSize);
    }
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   SCREEN_WIDTH = getWidth();
   SCREEN_HEIGHT = getHeight();
   CY = SCREEN_HEIGHT / 2;
   CX = SCREEN_WIDTH / 2;
 }
Beispiel #29
0
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   view_width = w;
   view_height = h;
   Log.e("scrrenDesity", view_width + " " + view_height);
   genRects();
 }
Beispiel #30
0
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    bridge.parentChanged(this);

    scaleCursors();
  }