// double mMultiple = mD2 / mD1;
// int newWidth = (int) (mDrawableRect.width() * mMultiple);
// int newHeight = (int) (newWidth / mRation_WH);
//
// int newleft = mDrawableRect.left / 2;
// int newtop = mDrawableRect.top / 2;
// int newright = mDrawableRect.right * (3 / 2);
// int newbotto = mDrawableRect.bottom * (3 / 2);
// // mDrawableRect.set(newleft, newtop, newright,
// newbotto);
//
// mDrawableRect.set(RectCenterX - newWidth / 2, RectCenterY
// - newHeight / 2, RectCenterX + newWidth / 2,
// RectCenterY + newHeight / 2);
// invalidate();
if (mDrawableRect.width() < mContext.getResources()
.getDisplayMetrics().widthPixels * 2) {
int offsetwidth = 10;
int offsettop = (int) (offsetwidth / mRation_WH);
mDrawableRect.set(mDrawableRect.left - offsetwidth,
mDrawableRect.top - offsettop,
mDrawableRect.right + offsetwidth,
mDrawableRect.bottom + offsettop);
Log.i("GCM", "aaaaaaaaaaaaaaa");
invalidate();
}
// mDrawableRect.offset((int) mHandsX, (int) mHandsY);
} else {
if (mDrawableRect.width() > mContext.getResources()
.getDisplayMetrics().widthPixels / 3) {
int offsetwidth = 10;
int offsettop = (int) (offsetwidth / mRation_WH);
mDrawableRect.set(mDrawableRect.left + offsetwidth,
mDrawableRect.top + offsettop,
mDrawableRect.right - offsetwidth,
mDrawableRect.bottom - offsettop);
invalidate();
Log.i("GCM", "bbbbbbbbbbbbbbb");
}
}
mD1 = mD2;
if (mHandsX < RectCenterX) {
if (mHandsY < RectCenterY) {
Log.i("PPPPPPP", "1");
} else {
Log.i("PPPPPPP", "3");
}
} else {
if (mHandsY < RectCenterY) {
Log.i("PPPPPPP", "2");
} else {
Log.i("PPPPPPP", "4");
}
}
//
break;
case MotionEvent.ACTION_UP:
Log.i("mStatus", "mutildouble_up");
mStatus = 0;
break;
default:
break;
}
break;
}
return true;
}
public void setBounds() {
if (isFirst) {
mRation_WH = (float) mDrawable.getIntrinsicWidth()
/ (float) mDrawable.getIntrinsicHeight();
int px_w = Math.min(getWidth(),
dip2px(mContext, mDrawable.getIntrinsicWidth()));
int px_h = (int) (px_w / mRation_WH);
int left = (getWidth() - px_w) / 2;
int top = (getHeight() - px_h) / 2;
int right = px_w + left;
int bottom = px_h + top;
mDrawableRect.set(left, top, right, bottom);
// mDrawableOffsetRect.set(mDrawableRect);
isFirst = false;
Log.i("rect1______", mDrawableRect.left + "," + mDrawableRect.top
+ "," + mDrawableRect.right + "," + mDrawableRect.bottom);
}
mDrawable.setBounds(mDrawableRect);
Log.i("rect2______", mDrawableRect.left + "," + mDrawableRect.top + ","
+ mDrawableRect.right + "," + mDrawableRect.bottom);
Log.i("center_______",
mDrawableRect.centerX() + "," + mDrawableRect.centerY());
}