List of usage examples for android.graphics.drawable Drawable setAlpha
public abstract void setAlpha(@IntRange(from = 0, to = 255) int alpha);
From source file:com.zyk.launcher.AsyncTaskCallback.java
public void setPageBackgroundsVisible(boolean visible) { mPageBackgroundsVisible = visible;// www .j a v a 2s. co m int childCount = getChildCount(); for (int i = 0; i < childCount; ++i) { Drawable bg = getChildAt(i).getBackground(); if (bg != null) { bg.setAlpha(visible ? 255 : 0); } } }
From source file:com.zyk.launcher.AsyncTaskCallback.java
private void setupPage(PagedViewGridLayout layout) { // Note: We force a measure here to get around the fact that when we do layout calculations // immediately after syncing, we don't have a proper width. int widthSpec = MeasureSpec.makeMeasureSpec(mContentWidth, MeasureSpec.AT_MOST); int heightSpec = MeasureSpec.makeMeasureSpec(mContentHeight, MeasureSpec.AT_MOST); Drawable bg = getContext().getResources().getDrawable(R.drawable.quantum_panel_dark); if (bg != null) { bg.setAlpha(mPageBackgroundsVisible ? 255 : 0); layout.setBackground(bg);/*from w w w .ja va2 s . c o m*/ } layout.measure(widthSpec, heightSpec); }
From source file:com.zyk.launcher.AsyncTaskCallback.java
private void setupPage(AppsCustomizeCellLayout layout) { layout.setGridSize(mCellCountX, mCellCountY); // Note: We force a measure here to get around the fact that when we do layout calculations // immediately after syncing, we don't have a proper width. That said, we already know the // expected page width, so we can actually optimize by hiding all the TextView-based // children that are expensive to measure, and let that happen naturally later. setVisibilityOnChildren(layout, View.GONE); int widthSpec = MeasureSpec.makeMeasureSpec(mContentWidth, MeasureSpec.AT_MOST); int heightSpec = MeasureSpec.makeMeasureSpec(mContentHeight, MeasureSpec.AT_MOST); layout.measure(widthSpec, heightSpec); Drawable bg = getContext().getResources().getDrawable(R.drawable.quantum_panel); if (bg != null) { bg.setAlpha(mPageBackgroundsVisible ? 255 : 0); // layout.setBackground(bg); layout.setBackgroundColor(Color.TRANSPARENT); }//from ww w .ja v a2 s . c om setVisibilityOnChildren(layout, View.VISIBLE); }
From source file:com.android.leanlauncher.CellLayout.java
@Override protected void onDraw(Canvas canvas) { // When we're large, we are either drawn in a "hover" state (ie when dragging an item to // a neighboring page) or with just a normal background (if backgroundAlpha > 0.0f) // When we're small, we are either drawn normally or in the "accepts drops" state (during // a drag). However, we also drag the mini hover background *over* one of those two // backgrounds if (mDrawBackground && mBackgroundAlpha > 0.0f) { Drawable bg; if (mUseActiveGlowBackground) { // In the mini case, we draw the active_glow bg *over* the active background bg = mActiveGlowBackground;//from w ww . j ava 2 s .c o m } else { bg = mNormalBackground; } bg.setAlpha((int) (mBackgroundAlpha * mBackgroundAlphaMultiplier * 255)); bg.setBounds(mBackgroundRect); bg.draw(canvas); } final Paint paint = mDragOutlinePaint; for (int i = 0; i < mDragOutlines.length; i++) { final float alpha = mDragOutlineAlphas[i]; if (alpha > 0) { final Rect r = mDragOutlines[i]; mTempRect.set(r); Utilities.scaleRectAboutCenter(mTempRect, getChildrenScale()); final Bitmap b = (Bitmap) mDragOutlineAnims[i].getTag(); paint.setAlpha((int) (alpha + .5f)); canvas.drawBitmap(b, null, mTempRect, paint); } } }