List of usage examples for android.graphics PixelFormat TRANSLUCENT
int TRANSLUCENT
To view the source code for android.graphics PixelFormat TRANSLUCENT.
Click Source Link
From source file:android.support.car.ui.CircleBitmapDrawable.java
@Override public int getOpacity() { return mDrawable != null ? mDrawable.getOpacity() : PixelFormat.TRANSLUCENT; }
From source file:com.fastaccess.tfl.ui.widget.drag.DragView.java
public void show(IBinder windowToken, int touchX, int touchY) { WindowManager.LayoutParams lp;// ww w. ja v a2 s . c o m int pixelFormat; pixelFormat = PixelFormat.TRANSLUCENT; lp = new WindowManager.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, touchX - mRegistrationX, touchY - mRegistrationY, WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, pixelFormat); lp.gravity = GravityCompat.START | Gravity.TOP; lp.token = windowToken; lp.setTitle("DragView"); mLayoutParams = lp; mWindowManager.addView(this, lp); }
From source file:edu.winlab.minijarvis.activity.CameraActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); //to prevent screen from dimming getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setFormat(PixelFormat.TRANSLUCENT); setContentView(R.layout.activity_main); mPreview = (SurfaceView) findViewById(R.id.preview); mCounter = (TextView) findViewById(R.id.counter); imgView = (ImageView) findViewById(R.id.image); holder = mPreview.getHolder();//from www.ja v a 2 s .co m holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); holder.addCallback(this); //Set Paint objects setRectPaint(); setTextPaint(); setBackground(); //to detect gestures mGestureDetector = createGestureDetector(this); //To safely open camera // Start the main thread. Image is captured when preview starts. Sync sync = new Sync(call, 500); }
From source file:com.androidzeitgeist.webcards.overlay.HandleView.java
void addToRoot() { setVisibility(View.VISIBLE);/*from w w w. j a v a 2 s. c o m*/ if (isShown()) { return; } int size = getResources().getDimensionPixelSize(R.dimen.overlay_button_size); WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(size, size, WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, PixelFormat.TRANSLUCENT); layoutParams.gravity = Gravity.CENTER_HORIZONTAL | Gravity.END; layoutParams.x = openOffsetX; try { windowManager.addView(this, layoutParams); } catch (final SecurityException | WindowManager.BadTokenException e) { // We do not have the permission to add a view to the window ("draw over other apps") Toast.makeText(getContext(), R.string.toast_missing_permission, Toast.LENGTH_SHORT).show(); } }
From source file:saschpe.android.textoverlay.service.TextOverlayService.java
@Override public void onCreate() { Log.d(TAG, "onCreate: Starting service"); super.onCreate(); int colorId = getResources().getIdentifier("red", "color", getPackageName()); textView = new TextView(this); textView.setTextColor(ContextCompat.getColor(this, colorId)); textView.setText(lastUsedOverlayText); WindowManager.LayoutParams params = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, PixelFormat.TRANSLUCENT); params.gravity = Gravity.CENTER | Gravity.BOTTOM; params.setTitle("Text Overlay"); WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE); wm.addView(textView, params);/* w w w. j ava 2 s . co m*/ LocalBroadcastManager.getInstance(this).registerReceiver(messageReceiver, new IntentFilter(ACTION_SET_TEXT)); }
From source file:uk.co.alt236.floatinginfo.provider.generalinfo.GeneralInfoProvider.java
private void createSystemWindow() { final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, 0, PixelFormat.TRANSLUCENT); final WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE); wm.addView(mUiManager.getView(), lp); }
From source file:com.appsimobile.appsii.AbstractHotspotHelper.java
@SuppressWarnings("deprecation") protected WindowManager.LayoutParams createHotspotParams(HotspotItem conf, SharedPreferences prefs) { Display display = mWindowManager.getDefaultDisplay(); mHeight = display.getHeight();//from w ww . j av a 2 s . c om float pct = conf.mHeightRelativeToViewHeight; int realHeight = (int) (mHeight * pct); if (realHeight < mDp56) realHeight = mDp56; int y = (int) (conf.mYPosRelativeToView * mHeight); int hotspotWidth = prefs.getInt("pref_hotspot_width", 22); int width = (int) (hotspotWidth * AppsiApplication.getDensity(mContext)); int xOffset = 0; if (conf.mLeft) { WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSLUCENT); params.gravity = Gravity.LEFT | Gravity.TOP; params.x = xOffset; params.y = y; params.width = width; params.height = realHeight; return params; } else { WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSLUCENT); params.gravity = Gravity.RIGHT | Gravity.TOP; params.x = xOffset; params.y = y; params.width = width; params.height = realHeight; return params; } }
From source file:org.opensilk.video.tv.ui.playback.PlaybackActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mComponent.inject(this); mPlayback.onCreate();//from w w w . j a v a 2 s. c om setMediaController(new MediaController(this, mPlayback.getMediaSession().getSessionToken())); mBinding = DataBindingUtil.setContentView(this, R.layout.activity_playback); mBinding.subtitlesSurface.setZOrderMediaOverlay(true); mBinding.subtitlesSurface.getHolder().setFormat(PixelFormat.TRANSLUCENT); setupSurfaces(); loadMediaItem(); }
From source file:com.rodrigopontes.androidbubbles.BubblesManager.java
private void initialize() { windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Point point = new Point(); windowManager.getDefaultDisplay().getSize(point); screenWidth = (short) point.x; screenHeight = (short) point.y; int statusBarResId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); statusBarHeight = (short) context.getResources().getDimensionPixelSize(statusBarResId); bubbleTrash = new BubbleTrash(); bubbleTrashParams = new WindowManager.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, PixelFormat.TRANSLUCENT); bubbleTrashParams.gravity = Gravity.TOP | Gravity.START; bubbleTrash.getFrameLayout().measure(screenWidth, screenHeight); bubbleTrashWidth = (short) (bubbleTrash.getFrameLayout().getMeasuredWidth() * BubblesProperties.TRASH_INCREASE_SIZE); bubbleTrashHeight = (short) (bubbleTrash.getFrameLayout().getMeasuredHeight() * BubblesProperties.TRASH_INCREASE_SIZE); bubbleTrash.getFrameLayout().setMinimumWidth(bubbleTrashWidth); bubbleTrash.getFrameLayout().setMinimumHeight(bubbleTrashHeight); bubbleTrash.getImageView().measure(screenWidth, screenHeight); bubbleTrash.getImageView().setX(bubbleTrashWidth / 2 - bubbleTrash.getImageView().getMeasuredWidth() / 2); bubbleTrash.getImageView().setY(bubbleTrashHeight / 2 - bubbleTrash.getImageView().getMeasuredHeight() / 2); bubbleTrash.getImageViewForeground().measure(screenWidth, screenHeight); bubbleTrash.getImageViewForeground() .setX(bubbleTrashWidth / 2 - bubbleTrash.getImageViewForeground().getMeasuredWidth() / 2); bubbleTrash.getImageViewForeground() .setY(bubbleTrashHeight / 2 - bubbleTrash.getImageViewForeground().getMeasuredHeight() / 2); bubbleTrashParams.x = (screenWidth - bubbleTrashWidth) / 2; bubbleTrashParams.y = screenHeight + BubblesProperties.TRASH_ENTER_SPEED; windowManager.addView(bubbleTrash.getFrameLayout(), bubbleTrashParams); }
From source file:com.alibaba.weex.WXPageActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wxpage); setCurrentWxPageActivity(this); WXSDKEngine.setActivityNavBarSetter(new NavigatorAdapter()); getWindow().setFormat(PixelFormat.TRANSLUCENT); mUri = getIntent().getData();//from w ww.jav a 2 s . c o m Bundle bundle = getIntent().getExtras(); if (mUri == null && bundle == null) { mUri = Uri.parse(Constants.BUNDLE_URL + Constants.WEEX_SAMPLES_KEY); } if (bundle != null) { String bundleUrl = bundle.getString("bundleUrl"); Log.i(TAG, "bundleUrl==" + bundleUrl); if (bundleUrl != null) { mConfigMap.put("bundleUrl", bundleUrl + Constants.WEEX_SAMPLES_KEY); mUri = Uri.parse(bundleUrl + Constants.WEEX_SAMPLES_KEY); } } else { mConfigMap.put("bundleUrl", mUri.toString() + Constants.WEEX_SAMPLES_KEY); // mUri = Uri.parse(mUri.toString() + Constants.WEEX_SAMPLES_KEY) } if (mUri == null) { Toast.makeText(this, "the uri is empty!", Toast.LENGTH_SHORT).show(); finish(); return; } Log.e("TestScript_Guide mUri==", mUri.toString()); initUIAndData(); if (WXPAGE.equals(mUri.getScheme())) { mUri = mUri.buildUpon().scheme("http").build(); loadWXfromService(mUri.toString()); startHotRefresh(); mWXHandler.removeCallbacks(mCollectIDMap); mWXHandler.postDelayed(mCollectIDMap, 2000); } else if (TextUtils.equals("http", mUri.getScheme()) || TextUtils.equals("https", mUri.getScheme())) { // if url has key "_wx_tpl" then get weex bundle js String weexTpl = mUri.getQueryParameter(Constants.WEEX_TPL_KEY); String url = TextUtils.isEmpty(weexTpl) ? mUri.toString() : weexTpl; loadWXfromService(url); startHotRefresh(); } else { loadWXfromLocal(false); } mInstance.onActivityCreate(); registerBroadcastReceiver(); mWxAnalyzerDelegate = new WXAnalyzerDelegate(this); mWxAnalyzerDelegate.onCreate(); }