mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-15 10:27:17 +01:00
70 lines
2 KiB
Java
70 lines
2 KiB
Java
package com.google.android.material.expandable;
|
|
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
import android.view.ViewParent;
|
|
import androidx.annotation.IdRes;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes7.dex */
|
|
public final class ExpandableWidgetHelper {
|
|
private boolean expanded = false;
|
|
|
|
@IdRes
|
|
private int expandedComponentIdHint = 0;
|
|
|
|
@NonNull
|
|
private final View widget;
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public ExpandableWidgetHelper(ExpandableWidget expandableWidget) {
|
|
this.widget = (View) expandableWidget;
|
|
}
|
|
|
|
private void dispatchExpandedStateChanged() {
|
|
ViewParent parent = this.widget.getParent();
|
|
if (parent instanceof CoordinatorLayout) {
|
|
((CoordinatorLayout) parent).dispatchDependentViewsChanged(this.widget);
|
|
}
|
|
}
|
|
|
|
@IdRes
|
|
public int getExpandedComponentIdHint() {
|
|
return this.expandedComponentIdHint;
|
|
}
|
|
|
|
public boolean isExpanded() {
|
|
return this.expanded;
|
|
}
|
|
|
|
public void onRestoreInstanceState(@NonNull Bundle bundle) {
|
|
this.expanded = bundle.getBoolean("expanded", false);
|
|
this.expandedComponentIdHint = bundle.getInt("expandedComponentIdHint", 0);
|
|
if (this.expanded) {
|
|
dispatchExpandedStateChanged();
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
public Bundle onSaveInstanceState() {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putBoolean("expanded", this.expanded);
|
|
bundle.putInt("expandedComponentIdHint", this.expandedComponentIdHint);
|
|
return bundle;
|
|
}
|
|
|
|
public boolean setExpanded(boolean z) {
|
|
if (this.expanded == z) {
|
|
return false;
|
|
}
|
|
this.expanded = z;
|
|
dispatchExpandedStateChanged();
|
|
return true;
|
|
}
|
|
|
|
public void setExpandedComponentIdHint(@IdRes int i) {
|
|
this.expandedComponentIdHint = i;
|
|
}
|
|
}
|