Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +8 −1 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ public class KeyButtonView extends ImageView { int mCode; int mTouchSlop; Drawable mGlowBG; int mGlowWidth, mGlowHeight; float mGlowAlpha = 0f, mGlowScale = 1f, mDrawingAlpha = 1f; boolean mSupportsLongpress = true; RectF mRect = new RectF(0f,0f,0f,0f); Loading Loading @@ -89,6 +90,8 @@ public class KeyButtonView extends ImageView { mGlowBG = a.getDrawable(R.styleable.KeyButtonView_glowBackground); if (mGlowBG != null) { setDrawingAlpha(BUTTON_QUIESCENT_ALPHA); mGlowWidth = mGlowBG.getIntrinsicWidth(); mGlowHeight = mGlowBG.getIntrinsicHeight(); } a.recycle(); Loading @@ -103,8 +106,12 @@ public class KeyButtonView extends ImageView { canvas.save(); final int w = getWidth(); final int h = getHeight(); final float aspect = (float)mGlowWidth / mGlowHeight; final int drawW = (int)(h*aspect); final int drawH = h; final int margin = (drawW-w)/2; canvas.scale(mGlowScale, mGlowScale, w*0.5f, h*0.5f); mGlowBG.setBounds(0, 0, w, h); mGlowBG.setBounds(-margin, 0, drawW-margin, drawH); mGlowBG.setAlpha((int)(mDrawingAlpha * mGlowAlpha * 255)); mGlowBG.draw(canvas); canvas.restore(); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +8 −1 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ public class KeyButtonView extends ImageView { int mCode; int mTouchSlop; Drawable mGlowBG; int mGlowWidth, mGlowHeight; float mGlowAlpha = 0f, mGlowScale = 1f, mDrawingAlpha = 1f; boolean mSupportsLongpress = true; RectF mRect = new RectF(0f,0f,0f,0f); Loading Loading @@ -89,6 +90,8 @@ public class KeyButtonView extends ImageView { mGlowBG = a.getDrawable(R.styleable.KeyButtonView_glowBackground); if (mGlowBG != null) { setDrawingAlpha(BUTTON_QUIESCENT_ALPHA); mGlowWidth = mGlowBG.getIntrinsicWidth(); mGlowHeight = mGlowBG.getIntrinsicHeight(); } a.recycle(); Loading @@ -103,8 +106,12 @@ public class KeyButtonView extends ImageView { canvas.save(); final int w = getWidth(); final int h = getHeight(); final float aspect = (float)mGlowWidth / mGlowHeight; final int drawW = (int)(h*aspect); final int drawH = h; final int margin = (drawW-w)/2; canvas.scale(mGlowScale, mGlowScale, w*0.5f, h*0.5f); mGlowBG.setBounds(0, 0, w, h); mGlowBG.setBounds(-margin, 0, drawW-margin, drawH); mGlowBG.setAlpha((int)(mDrawingAlpha * mGlowAlpha * 255)); mGlowBG.draw(canvas); canvas.restore(); Loading