package com.google.android.material.appbar; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import androidx.appcompat.widget.Toolbar; import androidx.core.view.n0; import c3.i; import com.google.android.material.internal.f; import p3.g; import p3.h; /* loaded from: classes2.dex */ public class MaterialToolbar extends Toolbar { private static final int O = i.f3562l; public MaterialToolbar(Context context, AttributeSet attributeSet) { this(context, attributeSet, c3.a.f3466v); } private void O(Context context) { Drawable background = getBackground(); if (background == null || (background instanceof ColorDrawable)) { g gVar = new g(); gVar.R(ColorStateList.valueOf(background != null ? ((ColorDrawable) background).getColor() : 0)); gVar.J(context); gVar.Q(n0.v(this)); n0.q0(this, gVar); } } @Override // android.view.ViewGroup, android.view.View protected void onAttachedToWindow() { super.onAttachedToWindow(); h.e(this); } @Override // android.view.View public void setElevation(float f10) { super.setElevation(f10); h.d(this, f10); } public MaterialToolbar(Context context, AttributeSet attributeSet, int i10) { super(f.f(context, attributeSet, i10, O), attributeSet, i10); O(getContext()); } }