content: package com.google.android.material.internal;
  
  import android.content.Context;
  import android.content.res.TypedArray;
  import android.graphics.Canvas;
  import android.graphics.Rect;
  import android.graphics.drawable.Drawable;
  import android.util.AttributeSet;
  import android.view.View;
  import android.widget.FrameLayout;
  import androidx.core.view.OnApplyWindowInsetsListener;
  import androidx.core.view.ViewCompat;
  import androidx.core.view.WindowInsetsCompat;
  import com.google.android.material.R;
  
  public class ScrimInsetsFrameLayout extends FrameLayout {
      private boolean drawBottomInsetForeground;
      private boolean drawTopInsetForeground;
      Drawable insetForeground;
      Rect insets;
      private Rect tempRect;
  
      public ScrimInsetsFrameLayout(Context context) {
          this(context, (AttributeSet) null);
      }
  
      public ScrimInsetsFrameLayout(Context context, AttributeSet attrs) {
          this(context, attrs, 0);
      }
  
      public ScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
          super(context, attrs, defStyleAttr);
          this.tempRect = new Rect();
          this.drawTopInsetForeground = true;
          this.drawBottomInsetForeground = true;
          TypedArray obtainStyledAttributes = ThemeEnforcement.obtainStyledAttributes(context, attrs, R.styleable.ScrimInsetsFrameLayout, defStyleAttr, R.style.Widget_Design_ScrimInsetsFrameLayout, new int[0]);
          this.insetForeground = obtainStyledAttributes.getDrawable(R.styleable.ScrimInsetsFrameLayout_insetForeground);
          obtainStyledAttributes.recycle();
          setWillNotDraw(true);
          ViewCompat.setOnApplyWindowInsetsListener(this, new OnApplyWindowInsetsListener() {
              public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {
                  if (ScrimInsetsFrameLayout.this.insets == null) {
                      ScrimInsetsFrameLayout.this.insets = new Rect();
                  }
                  ScrimInsetsFrameLayout.this.insets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom());
                  ScrimInsetsFrameLayout.this.onInsetsChanged(insets);
                  ScrimInsetsFrameLayout.this.setWillNotDraw(!insets.hasSystemWindowInsets() || ScrimInsetsFrameLayout.this.insetForeground == null);
                  ViewCompat.postInvalidateOnAnimation(ScrimInsetsFrameLayout.this);
                  return insets.consumeSystemWindowInsets();
              }
          });
      }
  
      public void draw(Canvas canvas) {
          super.draw(canvas);
          int width = getWidth();
          int height = getHeight();
          if (this.insets != null && this.insetForeground != null) {
              int save = canvas.save();
              canvas.translate((float) getScrollX(), (float) getScrollY());
              if (this.drawTopInsetForeground) {
                  this.tempRect.set(0, 0, width, this.insets.top);
                  this.insetForeground.setBounds(this.tempRect);
                  this.insetForeground.draw(canvas);
              }
              if (this.drawBottomInsetForeground) {
                  this.tempRect.set(0, height - this.insets.bottom, width, height);
                  this.insetForeground.setBounds(this.tempRect);
                  this.insetForeground.draw(canvas);
              }
              this.tempRect.set(0, this.insets.top, this.insets.left, height - this.insets.bottom);
              this.insetForeground.setBounds(this.tempRect);
              this.insetForeground.draw(canvas);
              this.tempRect.set(width - this.insets.right, this.insets.top, width, height - this.insets.bottom);
              this.insetForeground.setBounds(this.tempRect);
              this.insetForeground.draw(canvas);
              canvas.restoreToCount(save);
          }
      }
  
      /* access modifiers changed from: protected */
      public void onAttachedToWindow() {
          super.onAttachedToWindow();
          Drawable drawable = this.insetForeground;
          if (drawable != null) {
              drawable.setCallback(this);
          }
      }
  
      /* access modifiers changed from: protected */
      public void onDetachedFromWindow() {
          super.onDetachedFromWindow();
          Drawable drawable = this.insetForeground;
          if (drawable != null) {
              drawable.setCallback((Drawable.Callback) null);
          }
      }
  
      /* access modifiers changed from: protected */
      public void onInsetsChanged(WindowInsetsCompat insets2) {
      }
  
      public void setDrawBottomInsetForeground(boolean drawBottomInsetForeground2) {
          this.drawBottomInsetForeground = drawBottomInsetForeground2;
      }
  
      public void setDrawTopInsetForeground(boolean drawTopInsetForeground2) {
          this.drawTopInsetForeground = drawTopInsetForeground2;
      }
  
      public void setScrimInsetForeground(Drawable drawable) {
          this.insetForeground = drawable;
      }
  }
  