android.graphics.PixelFormat Java Examples
The following examples show how to use
android.graphics.PixelFormat.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Utils.java From RollSquareView with Apache License 2.0 | 6 votes |
/** * 确保drawable是能够拿到宽高的drawable * * @param drawable * @return */ public static Bitmap drawableToBitmap(Drawable drawable) { if (drawable == null && drawable.getIntrinsicWidth() > 0 && drawable.getIntrinsicHeight() > 0) { return null; } Bitmap bitmap = Bitmap .createBitmap( drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); Log.i("Utilities", "drawableToBitmap drawable.getIntrinsicWidth()=" + drawable.getIntrinsicWidth() + ",drawable.getIntrinsicHeight()=" + drawable.getIntrinsicHeight()); drawable.draw(canvas); return bitmap; }
Example #2
Source File: BubbleView.java From MainScreenShow with GNU General Public License v2.0 | 6 votes |
public BubbleView(Context context, BubbleSetting bs) { super(context); getHolder().setFormat(PixelFormat.TRANSPARENT); mSurfaceHolder = getHolder(); this.setFocusable(true); mHandler = new BubbleHandler(); this.bs = bs; mPaint = new Paint(); mPaint.setAlpha((int) (255 * bs.getAlpha())); getPX(); SharedPreferences sp_userinfo; sp_userinfo = context.getSharedPreferences("userinfo", 0); screenheight = sp_userinfo.getInt("screenheight", 0); screenwidth = sp_userinfo.getInt("screenwidth", 0); cb = new BubbleCount(screenheight, screenwidth, context, bs,px); mLoop = false; Bubble(); mSurfaceHolder.addCallback(this); }
Example #3
Source File: CameraManager.java From QrScan with Apache License 2.0 | 6 votes |
/** * A factory method to build the appropriate LuminanceSource object based on the format * of the preview buffers, as described by Camera.Parameters. * * @param data A preview frame. * @param width The width of the image. * @param height The height of the image. * @return A PlanarYUVLuminanceSource instance. */ public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) { Rect rect = getFramingRectInPreview(); int previewFormat = configManager.getPreviewFormat(); String previewFormatString = configManager.getPreviewFormatString(); switch (previewFormat) { // This is the standard Android format which all devices are REQUIRED to support. // In theory, it's the only one we should ever care about. case PixelFormat.YCbCr_420_SP: // This format has never been seen in the wild, but is compatible as we only care // about the Y channel, so allow it. case PixelFormat.YCbCr_422_SP: return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top, rect.width(), rect.height()); default: // The Samsung Moment incorrectly uses this variant instead of the 'sp' version. // Fortunately, it too has all the Y data up front, so we can read it. if ("yuv420p".equals(previewFormatString)) { return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top, rect.width(), rect.height()); } } throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/' + previewFormatString); }
Example #4
Source File: DragGridView.java From BaoKanAndroid with MIT License | 6 votes |
/** * 创建窗口对象、添加我们要移动的View * * @param dragBitmap * @param x * @param y */ public void startDrag(Bitmap dragBitmap, int x, int y) { stopDrag(); // 获取window界面的Params windowParams = new WindowManager.LayoutParams(); // Gravity.TOP|Gravity.START;这个必须加 windowParams.gravity = Gravity.TOP | Gravity.START; // 得到要移动的View左上角相对于屏幕的坐标 windowParams.x = x - win_view_x; windowParams.y = y - win_view_y; // 设置拖拽item的宽和高 windowParams.width = (int) (dragScale * dragBitmap.getWidth()); // 放大dragScale倍,可以设置拖动后的倍数 windowParams.height = (int) (dragScale * dragBitmap.getHeight()); // 放大dragScale倍,可以设置拖动后的倍数 this.windowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; this.windowParams.format = PixelFormat.TRANSLUCENT; this.windowParams.windowAnimations = 0; ImageView iv = new ImageView(getContext()); iv.setImageBitmap(dragBitmap); windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); windowManager.addView(iv, windowParams); dragImageView = iv; }
Example #5
Source File: UnlockActivity.java From Yahala-Messenger with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); // getActionBar().hide(); //setContentView(R.layout.splash); PasswordActivity passwordActivity = new PasswordActivity(this, null, false); passwordActivity.setDelegate(this); passwordActivity.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)); passwordActivity.setBackgroundColor(getResources().getColor(R.color.Red2)); setContentView(passwordActivity); ApplicationLoader.applicationContext = this.getApplicationContext(); getWindow().setBackgroundDrawableResource(R.drawable.transparent); getWindow().setFormat(PixelFormat.RGB_565); }
Example #6
Source File: Camera1Manager.java From phoenix with Apache License 2.0 | 6 votes |
private void setCameraPhotoQuality(Camera camera) { final Camera.Parameters parameters = camera.getParameters(); parameters.setPictureFormat(PixelFormat.JPEG); if (configurationProvider.getMediaQuality() == Configuration.MEDIA_QUALITY_LOW) { parameters.setJpegQuality(50); } else if (configurationProvider.getMediaQuality() == Configuration.MEDIA_QUALITY_MEDIUM) { parameters.setJpegQuality(75); } else if (configurationProvider.getMediaQuality() == Configuration.MEDIA_QUALITY_HIGH) { parameters.setJpegQuality(100); } else if (configurationProvider.getMediaQuality() == Configuration.MEDIA_QUALITY_HIGHEST) { parameters.setJpegQuality(100); } parameters.setPictureSize(photoSize.getWidth(), photoSize.getHeight()); camera.setParameters(parameters); }
Example #7
Source File: ClickableToast.java From Overchan-Android with GNU General Public License v3.0 | 6 votes |
public WindowManager.LayoutParams getWmParams(){ WindowManager.LayoutParams params = new WindowManager.LayoutParams(); params.height = WindowManager.LayoutParams.WRAP_CONTENT; params.width = WindowManager.LayoutParams.WRAP_CONTENT; params.alpha = 1; params.format = PixelFormat.RGBA_8888; if (gravityTop) { params.gravity = Gravity.TOP; } else { params.gravity = Gravity.BOTTOM; params.verticalMargin = isNarrow() ? 0.05f : 0.07f; } params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; //params.type = WindowManager.LayoutParams.LAST_SYSTEM_WINDOW + 30; try { if (internalResources == null) internalResources = Resources.getSystem(); params.windowAnimations = internalResources.getIdentifier("Animation.Toast", "style", "android"); params.y = getResources().getDimensionPixelSize(internalResources.getIdentifier("toast_y_offset", "dimen", "android")); } catch (Exception e) { Logger.e(TAG, e); } return params; }
Example #8
Source File: CameraManager.java From lunzi with Apache License 2.0 | 6 votes |
/** * A factory method to build the appropriate LuminanceSource object based on the format * of the preview buffers, as described by Camera.Parameters. * * @param data A preview frame. * @param width The width of the image. * @param height The height of the image. * @return A PlanarYUVLuminanceSource instance. */ public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) { Rect rect = getFramingRectInPreview(); int previewFormat = configManager.getPreviewFormat(); String previewFormatString = configManager.getPreviewFormatString(); switch (previewFormat) { // This is the standard Android format which all devices are REQUIRED to support. // In theory, it's the only one we should ever care about. case PixelFormat.YCbCr_420_SP: // This format has never been seen in the wild, but is compatible as we only care // about the Y channel, so allow it. case PixelFormat.YCbCr_422_SP: return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top, rect.width(), rect.height()); default: // The Samsung Moment incorrectly uses this variant instead of the 'sp' version. // Fortunately, it too has all the Y data up front, so we can read it. if ("yuv420p".equals(previewFormatString)) { return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top, rect.width(), rect.height()); } } throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/' + previewFormatString); }
Example #9
Source File: SlideFrameLayout.java From AccountBook with GNU General Public License v3.0 | 6 votes |
/** * 判断指定的View是否是不透明 * * @param v * @return */ private static boolean viewIsOpaque(View v) { if (ViewCompat.isOpaque(v)) { return true; } // View#isOpaque didn't take all valid opaque scrollbar modes into account // before API 18 (JB-MR2). On newer devices rely solely on isOpaque above and return false // here. On older devices, check the view's background drawable directly as a fallback. if (Build.VERSION.SDK_INT >= 18) { return false; } final Drawable bg = v.getBackground(); if (bg != null) { return bg.getOpacity() == PixelFormat.OPAQUE; } return false; }
Example #10
Source File: PictureWallView.java From MainScreenShow with GNU General Public License v2.0 | 6 votes |
public PictureWallView(Context context, PictureWallSetting pws) { super(context); alpha = pws.getAlpha(); // 这里除以0.8是因为有0.2的时间用来了渐变,目的是让时间还原 period = (int) ((float)pws.getPeriod()/0.8); onlyOne = pws.isOnlyOne(); scale = pws.getScaleV(); BITMAP_TYPE = pws.getBITMAP_TYPE(); mPaint = new Paint(); getHolder().setFormat(PixelFormat.TRANSPARENT); mSurfaceHolder = getHolder(); this.setFocusable(true); mPaint.setAlpha(alpha); mHandler = new mHandler(); periodHandler = new periodHandler(); SharedPreferences sp_userinfo; sp_userinfo = context.getSharedPreferences("userinfo", 0); int screenheight = sp_userinfo.getInt("screenheight", 0); int screenwidth = sp_userinfo.getInt("screenwidth", 0); pw = new PictureWall(screenwidth, screenheight, period, alpha, BITMAP_TYPE, scale); if (onlyOne) { pw.setRatio(pw.getPeriod() / 3 * 2); pw.setRationBL(1.1f); } mSurfaceHolder.addCallback(this); }
Example #11
Source File: FiamWindowManager.java From firebase-android-sdk with Apache License 2.0 | 6 votes |
private WindowManager.LayoutParams getLayoutParams( @NonNull InAppMessageLayoutConfig layoutConfig, @NonNull Activity activity) { final WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams( layoutConfig.windowWidth(), layoutConfig.windowHeight(), DEFAULT_TYPE, layoutConfig.windowFlag(), PixelFormat.TRANSLUCENT); // If the window gravity is TOP, we move down to avoid hitting the status bar (if shown). Rect insetDimensions = getInsetDimensions(activity); if ((layoutConfig.viewWindowGravity() & Gravity.TOP) == Gravity.TOP) { layoutParams.y = insetDimensions.top; } layoutParams.dimAmount = 0.3f; layoutParams.gravity = layoutConfig.viewWindowGravity(); layoutParams.windowAnimations = 0; return layoutParams; }
Example #12
Source File: ACache.java From Android-Application-ZJB with Apache License 2.0 | 6 votes |
private static Bitmap drawable2Bitmap(Drawable drawable) { if (drawable == null) { return null; } // 取 drawable 的长宽 int w = drawable.getIntrinsicWidth(); int h = drawable.getIntrinsicHeight(); // 取 drawable 的颜色格式 Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565; // 建立对应 bitmap Bitmap bitmap = Bitmap.createBitmap(w, h, config); // 建立对应 bitmap 的画布 Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, w, h); // 把 drawable 内容画到画布中 drawable.draw(canvas); return bitmap; }
Example #13
Source File: DragGridView.java From Modularity with Apache License 2.0 | 6 votes |
/** * 创建拖动的镜像 * * @param bitmap 镜像 * @param downX 按下的点相对父控件的X坐标 * @param downY 按下的点相对父控件的X坐标 */ private void createDragImage(Bitmap bitmap, int downX, int downY) { mWindowLayoutParams = new WindowManager.LayoutParams(); mWindowLayoutParams.format = PixelFormat.TRANSLUCENT; // 图片之外的其他地方透明 mWindowLayoutParams.gravity = Gravity.TOP | Gravity.START; mWindowLayoutParams.x = downX - mPoint2ItemLeft + mOffset2Left; mWindowLayoutParams.y = downY - mPoint2ItemTop + mOffset2Top - mStatusHeight; mWindowLayoutParams.alpha = 0.55f; // 透明度 mWindowLayoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT; mWindowLayoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT; mWindowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; mDragImageView = new ImageView(getContext()); mDragImageView.setImageBitmap(bitmap); mWindowManager.addView(mDragImageView, mWindowLayoutParams); }
Example #14
Source File: BubblesService.java From Andzu with MIT License | 5 votes |
private WindowManager.LayoutParams buildLayoutParamsForTrash() { int x = 0; int y = 0; WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT, Build.VERSION.SDK_INT > 25 ? WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY : WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT ); params.x = x; params.y = y; return params; }
Example #15
Source File: PopupIndicator.java From Genius-Android with Apache License 2.0 | 5 votes |
private WindowManager.LayoutParams createPopupLayout(IBinder token) { WindowManager.LayoutParams p = new WindowManager.LayoutParams(); p.gravity = Gravity.START | Gravity.TOP; p.width = ViewGroup.LayoutParams.MATCH_PARENT; p.height = ViewGroup.LayoutParams.MATCH_PARENT; p.format = PixelFormat.TRANSLUCENT; p.flags = computeFlags(p.flags); p.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL; p.token = token; p.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN; p.setTitle("DiscreteSeekBar Indicator:" + Integer.toHexString(hashCode())); return p; }
Example #16
Source File: CameraService.java From glass_snippets with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent.getExtras() != null) { Bundle e = intent.getExtras(); Log.d(TAG, e.keySet().toString()); mWidth = e.getInt(Parameters.WIDTH, mWidth); Log.e(TAG, String.format("mWidth is %d", mWidth)); mHeight = e.getInt(Parameters.HEIGHT, mHeight); mX = e.getInt(Parameters.X, mX); mY = e.getInt(Parameters.Y, mY); mOutFile = e.getString(Parameters.OUTFILE, mOutFile); mCaptureRate = e.getFloat(Parameters.RATE, mCaptureRate); } // Create new SurfaceView, and put on top of all other windows windowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE); surfaceView = new SurfaceView(this); LayoutParams layoutParams = new WindowManager.LayoutParams( mWidth, mHeight, mX, mY, WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSLUCENT ); layoutParams.gravity = Gravity.LEFT | Gravity.TOP; windowManager.addView(surfaceView, layoutParams); surfaceView.getHolder().addCallback(this); super.onStartCommand(intent, flags, startId); return START_NOT_STICKY; }
Example #17
Source File: ImageView.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public boolean isOpaque() { return super.isOpaque() || mDrawable != null && mXfermode == null && mDrawable.getOpacity() == PixelFormat.OPAQUE && mAlpha * mViewAlphaScale >> 8 == 255 && isFilledByImage(); }
Example #18
Source File: VodMainActivity.java From KSYMediaPlayer_Android with Apache License 2.0 | 5 votes |
private void createFloatingWindow(Context context) { if (context == null) return; WindowManager windowManager = getWindowManager(context); int screenWidth = windowManager.getDefaultDisplay().getWidth(); int screenHeight = windowManager.getDefaultDisplay().getHeight(); if (mFloatingView == null) { mFloatingView = new FloatWindowView(context); mFloatingView.addFloatingWindow(FloatingPlayer.getInstance().getKSYTextureView()); mFloatingView.setHandler(mHandler); if (mFloatingViewParams == null) { mFloatingViewParams = new WindowManager.LayoutParams(); mFloatingViewParams.type = WindowManager.LayoutParams.TYPE_TOAST; mFloatingViewParams.format = PixelFormat.RGBA_8888; mFloatingViewParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; mFloatingViewParams.gravity = Gravity.LEFT | Gravity.TOP; mFloatingViewParams.width = WindowManager.LayoutParams.WRAP_CONTENT; mFloatingViewParams.height = WindowManager.LayoutParams.WRAP_CONTENT; mFloatingViewParams.x = screenWidth; mFloatingViewParams.y = screenHeight; } mFloatingView.updateViewLayoutParams(mFloatingViewParams); windowManager.addView(mFloatingView, mFloatingViewParams); } }
Example #19
Source File: FloatbarService.java From CircleFloatBar with Apache License 2.0 | 5 votes |
private void createFloatBarView() { displayHeight = getResources().getDisplayMetrics().heightPixels; displayWidth = getResources().getDisplayMetrics().widthPixels; defaultX = displayWidth * 0.9f; defaultY = displayHeight / 2; thresholdX = (int)(getResources().getDisplayMetrics().widthPixels * 0.1f); thresholdY = (int)(getResources().getDisplayMetrics().heightPixels * 0.1f); wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE); params = new WindowManager.LayoutParams(); if(Build.VERSION.SDK_INT>=26){ params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; }else{ params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; } params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; params.gravity = Gravity.LEFT | Gravity.TOP; params.x = (int) (displayHeight * 0.9f); params.y = displayWidth / 2; params.width = WindowManager.LayoutParams.WRAP_CONTENT; params.height = WindowManager.LayoutParams.WRAP_CONTENT; params.format = PixelFormat.RGBA_8888; //for get showmenuview width & height wm.addView(showMenuView, params); wm.removeView(showMenuView); wm.addView(hideMenuView, params); }
Example #20
Source File: PLAListView.java From SimplifyReader with Apache License 2.0 | 5 votes |
/** * Sets the drawable that will be drawn between each item in the list. If the drawable does * not have an intrinsic height, you should also call {@link #setDividerHeight(int)} * * @param divider The drawable to use. */ public void setDivider(Drawable divider) { if (divider != null) { mDividerHeight = divider.getIntrinsicHeight(); mClipDivider = divider instanceof ColorDrawable; } else { mDividerHeight = 0; mClipDivider = false; } mDivider = divider; mDividerIsOpaque = divider == null || divider.getOpacity() == PixelFormat.OPAQUE; requestLayoutIfNecessary(); }
Example #21
Source File: DrawerLayout.java From guideshow with MIT License | 5 votes |
private static boolean hasOpaqueBackground(View v) { final Drawable bg = v.getBackground(); if (bg != null) { return bg.getOpacity() == PixelFormat.OPAQUE; } return false; }
Example #22
Source File: RecordService.java From screen-share-to-browser with Apache License 2.0 | 5 votes |
public boolean startRecord() { if (mediaProjection == null || running) { return false; } executorService = Executors.newFixedThreadPool(threadCount); imageReader = ImageReader.newInstance(width, height, PixelFormat.RGBA_8888, 2); createVirtualDisplayForImageReader(); running = true; if (recordServiceListener != null) { recordServiceListener.onRecorderStatusChanged(running); } return true; }
Example #23
Source File: GameActivity.java From Tanks with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); handler = new Handler(); renderer = new Renderer(); initializeContext(); initializeFactory(); // OpenGL init glView = new GLSurfaceView(this); glView.getHolder().setFormat(PixelFormat.RGBA_8888); glView.setEGLContextClientVersion(2); glView.setEGLConfigChooser(new ConfigChooser()); glView.setRenderer(renderer); glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); // Bind listener glView.setOnTouchListener(this); // Set view setContentView(glView); // Set menu and world initializeContent(); }
Example #24
Source File: DragGrid.java From TopGrid with Apache License 2.0 | 5 votes |
public void startDrag(Bitmap dragBitmap, int x, int y) { stopDrag(); windowParams = new WindowManager.LayoutParams();// 获取WINDOW界面的 //Gravity.TOP|Gravity.LEFT;这个必须加 windowParams.gravity = Gravity.TOP | Gravity.LEFT; // windowParams.x = x - (int)((itemWidth / 2) * dragScale); // windowParams.y = y - (int) ((itemHeight / 2) * dragScale); //得到preview左上角相对于屏幕的坐标 windowParams.x = x - win_view_x; windowParams.y = y - win_view_y; // this.windowParams.x = (x - this.win_view_x + this.viewX);//位置的x值 // this.windowParams.y = (y - this.win_view_y + this.viewY);//位置的y值 //设置拖拽item的宽和高 windowParams.width = (int) (dragScale * dragBitmap.getWidth());// 放大dragScale倍,可以设置拖动后的倍数 windowParams.height = (int) (dragScale * dragBitmap.getHeight());// 放大dragScale倍,可以设置拖动后的倍数 this.windowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; this.windowParams.format = PixelFormat.TRANSLUCENT; this.windowParams.windowAnimations = 0; ImageView iv = new ImageView(getContext()); iv.setImageBitmap(dragBitmap); windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);// "window" windowManager.addView(iv, windowParams); dragImageView = iv; }
Example #25
Source File: BaseKeyboard.java From actor-platform with GNU Affero General Public License v3.0 | 5 votes |
private void update() { if (emojiKeyboardView != null) { WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams.MATCH_PARENT, (keyboardHeight), WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT); params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; windowManager.updateViewLayout(emojiKeyboardView, params); } else { } }
Example #26
Source File: IconHintView.java From stynico with MIT License | 5 votes |
private Bitmap drawableToBitmap(Drawable drawable) { int width = drawable.getIntrinsicWidth(); int height = drawable.getIntrinsicHeight(); Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565; Bitmap bitmap = Bitmap.createBitmap(width, height, config); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, width, height); drawable.draw(canvas); return bitmap; }
Example #27
Source File: Vr2dDisplay.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Starts an ImageReader as a do-nothing Surface. The virtual display will not get fully * initialized within surface flinger unless it has a valid Surface associated with it. We use * the ImageReader as the default valid Surface. */ private void startImageReader() { if (mImageReader == null) { mImageReader = ImageReader.newInstance(mVirtualDisplayWidth, mVirtualDisplayHeight, PixelFormat.RGBA_8888, 2 /* maxImages */); Log.i(TAG, "VD startImageReader: res = " + mVirtualDisplayWidth + "X" + mVirtualDisplayHeight + ", dpi = " + mVirtualDisplayDpi); } synchronized (mVdLock) { setSurfaceLocked(mImageReader.getSurface()); } }
Example #28
Source File: VectorDrawableCompat.java From VectorChildFinder with Apache License 2.0 | 5 votes |
@Override public int getOpacity() { if (mDelegateDrawable != null) { return mDelegateDrawable.getOpacity(); } return PixelFormat.TRANSLUCENT; }
Example #29
Source File: PLA_ListView.java From EverMemo with MIT License | 5 votes |
/** * Sets the drawable that will be drawn between each item in the list. If the drawable does * not have an intrinsic height, you should also call {@link #setDividerHeight(int)} * * @param divider The drawable to use. */ public void setDivider(Drawable divider) { if (divider != null) { mDividerHeight = divider.getIntrinsicHeight(); mClipDivider = divider instanceof ColorDrawable; } else { mDividerHeight = 0; mClipDivider = false; } mDivider = divider; mDividerIsOpaque = divider == null || divider.getOpacity() == PixelFormat.OPAQUE; requestLayoutIfNecessary(); }
Example #30
Source File: DragFloatViewHelper.java From MultiItem with Apache License 2.0 | 5 votes |
private WindowManager.LayoutParams initParams(View floatView) { WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); layoutParams.token = floatView.getWindowToken(); layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION;// 程序提示window layoutParams.format = PixelFormat.TRANSLUCENT;// 支持透明 //params.format = PixelFormat.RGBA_8888; layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; layoutParams.gravity = Gravity.LEFT | Gravity.TOP; return layoutParams; }