List of usage examples for android.graphics PixelFormat TRANSPARENT
int TRANSPARENT
To view the source code for android.graphics PixelFormat TRANSPARENT.
Click Source Link
From source file:Main.java
/** * Gets the opacity from a color. Inspired by Android ColorDrawable. * @param color// w w w . j a v a 2s. c o m * @return opacity expressed by one of PixelFormat constants */ public static int getOpacityFromColor(int color) { int colorAlpha = color >>> 24; if (colorAlpha == 255) { return PixelFormat.OPAQUE; } else if (colorAlpha == 0) { return PixelFormat.TRANSPARENT; } else { return PixelFormat.TRANSLUCENT; } }
From source file:Main.java
protected static WindowManager.LayoutParams createInsetParams() { WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(1, 1, WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, PixelFormat.TRANSPARENT); layoutParams.gravity = Gravity.TOP;/*from w w w. ja va 2s . c o m*/ layoutParams.y = 0; return layoutParams; }
From source file:com.yuntongxun.ecdemo.ui.chatting.ChattingActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { LogUtil.d(TAG, "onCreate"); super.onCreate(null); getWindow().setFormat(PixelFormat.TRANSPARENT); String recipients = getIntent().getStringExtra(ChattingFragment.RECIPIENTS); if (recipients == null) { finish();/* ww w . j av a 2 s . c o m*/ LogUtil.e(TAG, "recipients is null !!"); return; } setContentView(R.layout.chattingui_activity_container); mChattingFragment = new ChattingFragment(); Bundle bundle = getIntent().getExtras(); bundle.putBoolean(ChattingFragment.FROM_CHATTING_ACTIVITY, true); mChattingFragment.setArguments(bundle); getSupportFragmentManager().beginTransaction().add(R.id.ccp_root_view, mChattingFragment).commit(); }
From source file:android.support.v17.leanback.app.ErrorSupportFragment.java
/** * Sets a drawable for the fragment background. * * @param drawable The drawable used for the background. *//*from w ww .ja v a 2 s . c o m*/ public void setBackgroundDrawable(Drawable drawable) { mBackgroundDrawable = drawable; if (drawable != null) { final int opacity = drawable.getOpacity(); mIsBackgroundTranslucent = (opacity == PixelFormat.TRANSLUCENT || opacity == PixelFormat.TRANSPARENT); } updateBackground(); updateMessage(); }
From source file:com.ceabie.EffectiveLib.EffectImageView.java
@Override protected void onDraw(Canvas canvas) { if (mEffectDrawable == null || mEffectDrawable.getOpacity() == PixelFormat.TRANSPARENT // ? || getDrawable() == null) {// www . j ava 2 s .c o m super.onDraw(canvas); return; } if (mRectF == null) { mRectF = new RectF(); } mRectF.left = 0; mRectF.top = 0; mRectF.right = getMeasuredWidth(); mRectF.bottom = getMeasuredHeight(); int saveBottom = 0; // if (!mHardware) { saveBottom = canvas.saveLayer(mRectF, null, Canvas.CLIP_TO_LAYER_SAVE_FLAG | Canvas.HAS_ALPHA_LAYER_SAVE_FLAG); } super.onDraw(canvas); mPaint.setXfermode(mXfermodeDstIn); int saveCount = canvas.saveLayer(mRectF, mPaint, Canvas.CLIP_TO_LAYER_SAVE_FLAG); mPaint.setXfermode(null); mEffectDrawable.draw(canvas); canvas.restoreToCount(saveCount); if (!mHardware) { canvas.restoreToCount(saveBottom); } }
From source file:trumeet.keyguard.utils.MaskWindowUtils.java
@Nullable private View showKeyguardView(boolean showSettings) { if (Build.VERSION.SDK_INT >= 23) { if (!Settings.canDrawOverlays(mContext)) { if (!showSettings) return null; Intent i = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); mContext.startActivity(i);// ww w .j a v a2 s . c o m return null; } } View keyguardView = LayoutInflater.from(mContext).inflate(R.layout.layout_keyguard, null); WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams(); wmParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR; wmParams.format = PixelFormat.TRANSPARENT; wmParams.flags = WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR; wmParams.width = WindowManager.LayoutParams.MATCH_PARENT; wmParams.height = WindowManager.LayoutParams.MATCH_PARENT; mManager.addView(keyguardView, wmParams); mContext.startActivity(new Intent(mContext, KeyguardLiveActivity.class)); return keyguardView; }
From source file:com.intel.xdk.display.Display.java
@JavascriptInterface public void startAR() { arView = CameraPreview.newInstance(activity.getApplicationContext()); arView.setVisibility(View.INVISIBLE); arView.height = 100;/*from ww w .j a v a 2 s .c om*/ arView.width = 100; //no way to get current background color? arView.setBackgroundColor(Color.TRANSPARENT); SurfaceHolder sfhTrackHolder = arView.getHolder(); sfhTrackHolder.setFormat(PixelFormat.TRANSPARENT); sfhTrackHolder.setKeepScreenOn(true); sfhTrackHolder.setFixedSize(100, 100); activity.runOnUiThread(new Runnable() { public void run() { //activity.addContentView(arView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, 0.0F)); //activity.addContentView(arView, new LinearLayout.LayoutParams(400, 500, 0.0F)); ViewGroup rootView = (ViewGroup) webView.getParent().getParent(); rootView.addView(arView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); rootView.bringChildToFront((View) webView.getParent()); arView.setVisibility(View.VISIBLE); arView.showCamera(); webView.bringToFront(); webView.setBackgroundColor(0x00000000); LinearLayout ll = (LinearLayout) webView.getParent(); ll.setBackgroundColor(0x00000000); View activityView = activity.getCurrentFocus(); } }); }
From source file:com.jwork.spycamera.MainFragment.java
@SuppressWarnings("deprecation") private void initView(View view) { log.v(this, "initView()"); this.layoutBlack = (LinearLayout) view.findViewById(R.id.blackLayout); this.layoutBlack.setOnTouchListener(this); this.layoutCenter = (LinearLayout) view.findViewById(R.id.linearLayoutCenter); //Widgets//from ww w. j ava 2 s. c o m this.svPreview = (SurfaceView) view.findViewById(R.id.svPreview); this.svPreview.setDrawingCacheQuality(100); this.svPreview.setDrawingCacheEnabled(true); this.svPreview.setZOrderOnTop(true); this.svPreview.setOnTouchListener(this); this.shPreview = this.svPreview.getHolder(); this.shPreview.addCallback(this); this.shPreview.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); this.shPreview.setFormat(PixelFormat.TRANSPARENT); this.btnAuto = (Button) view.findViewById(R.id.btnAuto); this.btnAuto.setOnClickListener(this); this.btnBlack = (Button) view.findViewById(R.id.btnBlack); this.btnBlack.setOnClickListener(this); this.btnCapture = (Button) view.findViewById(R.id.btnCapture); this.btnCapture.setOnClickListener(this); this.btnFace = (Button) view.findViewById(R.id.btnFace); this.btnFace.setOnClickListener(this); this.btnVideo = (Button) view.findViewById(R.id.btnVideo); this.btnVideo.setOnClickListener(this); this.btnSwitchCam = (Button) view.findViewById(R.id.btnSwitchCam); this.btnSwitchCam.setOnClickListener(this); this.btnDecSize = (Button) view.findViewById(R.id.btnDecreaseSize); this.btnDecSize.setOnClickListener(this); this.btnIncSize = (Button) view.findViewById(R.id.btnIncreaseSize); this.btnIncSize.setOnClickListener(this); this.btnHelp = (Button) view.findViewById(R.id.btnHelp); this.btnHelp.setOnClickListener(this); this.btnSetting = (Button) view.findViewById(R.id.btnSetting); this.btnSetting.setOnClickListener(this); sgdPreview = new ScaleGestureDetector(activity, this); sgdBlack = new ScaleGestureDetector(activity, this); layoutBlack.setVisibility(View.INVISIBLE); layoutBlack.setOnTouchListener(this); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { btnFace.setVisibility(View.INVISIBLE); } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) { btnVideo.setVisibility(View.INVISIBLE); } }
From source file:android.support.design.widget.CircularBorderDrawable.java
@Override public int getOpacity() { return mBorderWidth > 0 ? PixelFormat.TRANSLUCENT : PixelFormat.TRANSPARENT; }
From source file:net.yanzm.actionbarprogress.MaterialIndeterminateProgressDrawable.java
@Override public int getOpacity() { int trackColorAlpha = trackColor >>> 24; int accentColorAlpha = accentColor >>> 24; if (trackColorAlpha == 255 && accentColorAlpha == 255) { return PixelFormat.OPAQUE; }/*from ww w . j a v a 2s . c o m*/ if (trackColorAlpha == 0 && accentColorAlpha == 0) { return PixelFormat.TRANSPARENT; } return PixelFormat.TRANSLUCENT; }