Blur the given bitmap and add it to the activity.

@param bkg  should be a bitmap of the background.
@param view background view.
968501
private void blur(Bitmap bkg, View view) {
        long startMs = System.currentTimeMillis();
        //define layout params to the previous imageView in order to match its parent
        mBlurredBackgroundLayoutParams = new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.MATCH_PARENT
        );

        //overlay used to build scaled preview and blur background
        Bitmap overlay = null;

        //evaluate top offset due to action bar, 0 if the actionBar should be blurred.
        int actionBarHeight;
        if (mBlurredActionBar) {
            actionBarHeight = 0;
        } else {
            actionBarHeight = getActionBarHeight();
        }

        //evaluate top offset due to status bar
        int statusBarHeight = 0;
        if ((mHoldingActivity.getWindow().getAttributes().flags
            & WindowManager.LayoutParams.FLAG_FULLSCREEN) == 0) {
            //not in fullscreen mode
            statusBarHeight = getStatusBarHeight();
        }

        // check if status bar is translucent to remove status bar offset in order to provide blur
        // on content bellow the status.
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
            && isStatusBarTranslucent()) {
            statusBarHeight = 0;
        }

        final int topOffset = actionBarHeight + statusBarHeight;
        // evaluate bottom or right offset due to navigation bar.
        int bottomOffset = 0;
        int rightOffset = 0;
        final int navBarSize = getNavigationBarOffset();

        if (mHoldingActivity.getResources().getBoolean(R.bool.blur_dialog_has_bottom_navigation_bar)) {
            bottomOffset = navBarSize;
        } else {
            rightOffset = navBarSize;
        }

        //add offset to the source boundaries since we don't want to blur actionBar pixels
        Rect srcRect = new Rect(
            0,
            topOffset,
            bkg.getWidth() - rightOffset,
            bkg.getHeight() - bottomOffset
        );

        //in order to keep the same ratio as the one which will be used for rendering, also
        //add the offset to the overlay.
        double height = Math.ceil((view.getHeight() - topOffset - bottomOffset) / mDownScaleFactor);
        double width = Math.ceil(((view.getWidth() - rightOffset) * height
            / (view.getHeight() - topOffset - bottomOffset)));

        // Render script doesn't work with RGB_565
        if (mUseRenderScript) {
            overlay = Bitmap.createBitmap((int) width, (int) height, Bitmap.Config.ARGB_8888);
        } else {
            overlay = Bitmap.createBitmap((int) width, (int) height, Bitmap.Config.RGB_565);
        }
        try {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
                || mHoldingActivity instanceof ActionBarActivity
                || mHoldingActivity instanceof AppCompatActivity) {
                //add offset as top margin since actionBar height must also considered when we display
                // the blurred background. Don't want to draw on the actionBar.
                mBlurredBackgroundLayoutParams.setMargins(0, actionBarHeight, 0, 0);
                mBlurredBackgroundLayoutParams.gravity = Gravity.TOP;
            }
        } catch (NoClassDefFoundError e) {
            // no dependency to appcompat, that means no additional top offset due to actionBar.
            mBlurredBackgroundLayoutParams.setMargins(0, 0, 0, 0);
        }
        //scale and draw background view on the canvas overlay
        Canvas canvas = new Canvas(overlay);
        Paint paint = new Paint();
        paint.setFlags(Paint.FILTER_BITMAP_FLAG);

        //build drawing destination boundaries
        final RectF destRect = new RectF(0, 0, overlay.getWidth(), overlay.getHeight());

        //draw background from source area in source background to the destination area on the overlay
        canvas.drawBitmap(bkg, srcRect, destRect, paint);

        //apply fast blur on overlay
        if (mUseRenderScript) {
            overlay = RenderScriptBlurHelper.doBlur(overlay, mBlurRadius, true, mHoldingActivity);
        } else {
            overlay = FastBlurHelper.doBlur(overlay, mBlurRadius, true);
        }
        if (mDebugEnable) {
            String blurTime = (System.currentTimeMillis() - startMs) + " ms";
            Log.d(TAG, "Blur method : " + (mUseRenderScript ? "RenderScript" : "FastBlur"));
            Log.d(TAG, "Radius : " + mBlurRadius);
            Log.d(TAG, "Down Scale Factor : " + mDownScaleFactor);
            Log.d(TAG, "Blurred achieved in : " + blurTime);
            Log.d(TAG, "Allocation : " + bkg.getRowBytes() + "ko (screen capture) + "
                + overlay.getRowBytes() + "ko (blurred bitmap)"
                + (!mUseRenderScript ? " + temp buff " + overlay.getRowBytes() + "ko." : "."));
            Rect bounds = new Rect();
            Canvas canvas1 = new Canvas(overlay);
            paint.setColor(Color.BLACK);
            paint.setAntiAlias(true);
            paint.setTextSize(20.0f);
            paint.getTextBounds(blurTime, 0, blurTime.length(), bounds);
            canvas1.drawText(blurTime, 2, bounds.height(), paint);
        }
        //set bitmap in an image view for final rendering
        mBlurredBackgroundView = new ImageView(mHoldingActivity);
        mBlurredBackgroundView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        mBlurredBackgroundView.setImageDrawable(new BitmapDrawable(mHoldingActivity.getResources(), overlay));
    }
702289
public void setContentView(View view) {
        setContentView(view, new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    }
803410
public void setMenuView(View view) {
        setMenuView(view, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    }
95329
@UiThread
  public void removeMarker(@NonNull MarkerView markerView) {
    if (mapView.isDestroyed() || !markers.contains(markerView)) {
      return;
    }

    mapView.removeView(markerView.getView());
    markers.remove(markerView);
  }
653045
private static void enableView(final View view, final boolean enable) {
    view.setEnabled(enable);
    view.setAlpha(enable ? 1f : 0.1f);
  }
1142366
public void addFooterView(View view) {
        mFooterViewList.add(view);
        if (mAdapterWrapper != null) {
            mAdapterWrapper.addFooterViewAndNotify(view);
        }
    }
19161
protected final void invokeOnLayout(View view, boolean changed, int l, int t, int r, int b) {
        final ViewProxy proxy = (ViewProxy) view;
        proxy.invokeOnLayout(changed, l, t, r, b);
    }
294760
public BottomSheetDialog contentView(View v){
        mContentView = v;
        mContainer.removeAllViews();
        mContainer.addView(v);
        return this;
    }
578580
public synchronized void returnBitmap(Bitmap bitmap) {
        if (bitmap == null || bitmapsBySize.contains(bitmap) ) {
            return;
        } else if(getBitmapSize(bitmap) > sizeLimit || !canBePooled(bitmap)) {
            return;
        }
        bitmapsByLastUse.add(bitmap);
        int pos = Collections.binarySearch(bitmapsBySize, bitmap, BITMAP_COMPARATOR);
        if (pos < 0) {
            pos = -pos - 1;
        }
        bitmapsBySize.add(pos, bitmap);
        currentSize += getBitmapSize(bitmap);
        trim();
    }
428400
public static void setBackground(View v, int drawableRes) {
        setBackground(v, getCompatDrawable(v.getContext(), drawableRes));
    }
794675
public static void hideSoftKeyboard(Context context, View view) {
		InputMethodManager imm = (InputMethodManager) context
				.getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
	}
1374255
public void setDragView(View dragView) {
        if (mDragView != null) {
            mDragView.setOnClickListener(null);
        }
        mDragView = dragView;
        if (mDragView != null) {
            mDragView.setClickable(true);
            mDragView.setFocusable(false);
            mDragView.setFocusableInTouchMode(false);
            mDragView.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (!isEnabled()) return;
                    if (!isPanelExpanded()) {
                        expandPanel(mAnchorPoint);
                    } else {
                        collapsePanel();
                    }
                }
            });;
        }
    }
778565
@SuppressWarnings("deprecation")
	@SuppressLint("NewApi")
	private void setBackground(View view, Drawable drawable) {
        if (Build.VERSION.SDK_INT >= SET_DRAWABLE_MIN_SDK)
        	view.setBackground(drawable);
        else
        	view.setBackgroundDrawable(drawable);
	}
896428
public static void setBackground(View v, @DrawableRes int drawableRes) {
        ViewCompat.setBackground(v, ContextCompat.getDrawable(v.getContext(), drawableRes));
    }
1190696
public void setView(boolean view) {
        PdfDictionary usage = getUsage();
        PdfDictionary dic = new PdfDictionary();
        dic.put(PdfName.VIEWSTATE, view ? PdfName.ON : PdfName.OFF);
        usage.put(PdfName.VIEW, dic);
    }
355777
public void onResume(boolean retainedInstance) {
        if (mBlurredBackgroundView == null || retainedInstance) {
            if (mHoldingActivity.getWindow().getDecorView().isShown()) {
                mBluringTask = new BlurAsyncTask();
                mBluringTask.execute();
            } else {
                mHoldingActivity.getWindow().getDecorView().getViewTreeObserver().addOnPreDrawListener(
                    new ViewTreeObserver.OnPreDrawListener() {
                        @Override
                        public boolean onPreDraw() {
                            // dialog can have been closed before being drawn
                            if (mHoldingActivity != null) {
                                mHoldingActivity.getWindow().getDecorView()
                                    .getViewTreeObserver().removeOnPreDrawListener(this);
                                mBluringTask = new BlurAsyncTask();
                                mBluringTask.execute();
                            }
                            return true;
                        }
                    }
                );
            }
        }
    }
1052266
public void onBlur (BlurEvent event)
    {
        if (_target.getText().trim().equals("")) {
            _target.setText(_defaultText);
        }
    }