package com.google.android.material.tabs;

import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.tabs.TabLayout;
import com.google.errorprone.annotations.CanIgnoreReturnValue;

/* JADX INFO: loaded from: classes2.dex */
public final class h {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f23336a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public TabLayout.TabView f23337b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f23338c;

    @Nullable
    private CharSequence contentDesc;

    @Nullable
    private View customView;

    @Nullable
    private Drawable icon;

    @Nullable
    public TabLayout parent;

    @Nullable
    private Object tag;

    @Nullable
    private CharSequence text;

    public final void c() {
        this.parent = null;
        this.f23337b = null;
        this.tag = null;
        this.icon = null;
        this.f23338c = -1;
        this.text = null;
        this.contentDesc = null;
        this.f23336a = -1;
        this.customView = null;
    }

    @Nullable
    public z8.a getBadge() {
        return this.f23337b.getBadge();
    }

    @Nullable
    public CharSequence getContentDescription() {
        TabLayout.TabView tabView = this.f23337b;
        if (tabView == null) {
            return null;
        }
        return tabView.getContentDescription();
    }

    @Nullable
    public View getCustomView() {
        return this.customView;
    }

    @Nullable
    public Drawable getIcon() {
        return this.icon;
    }

    @Nullable
    public Object getTag() {
        return this.tag;
    }

    @Nullable
    public CharSequence getText() {
        return this.text;
    }

    @NonNull
    @CanIgnoreReturnValue
    public h setContentDescription(@Nullable CharSequence charSequence) {
        this.contentDesc = charSequence;
        TabLayout.TabView tabView = this.f23337b;
        if (tabView != null) {
            tabView.f();
        }
        return this;
    }

    @NonNull
    @CanIgnoreReturnValue
    public h setCustomView(@Nullable View view) {
        this.customView = view;
        TabLayout.TabView tabView = this.f23337b;
        if (tabView != null) {
            tabView.f();
        }
        return this;
    }

    @NonNull
    @CanIgnoreReturnValue
    public h setIcon(@Nullable Drawable drawable) {
        this.icon = drawable;
        TabLayout tabLayout = this.parent;
        if (tabLayout.f23296f0 == 1 || tabLayout.f23302i0 == 2) {
            tabLayout.i(true);
        }
        TabLayout.TabView tabView = this.f23337b;
        if (tabView != null) {
            tabView.f();
        }
        return this;
    }

    @NonNull
    @CanIgnoreReturnValue
    public h setTag(@Nullable Object obj) {
        this.tag = obj;
        return this;
    }

    @NonNull
    @CanIgnoreReturnValue
    public h setText(@Nullable CharSequence charSequence) {
        if (TextUtils.isEmpty(this.contentDesc) && !TextUtils.isEmpty(charSequence)) {
            this.f23337b.setContentDescription(charSequence);
        }
        this.text = charSequence;
        TabLayout.TabView tabView = this.f23337b;
        if (tabView != null) {
            tabView.f();
        }
        return this;
    }
}
