mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-18 03:47:18 +01:00
47 lines
2.3 KiB
Java
47 lines
2.3 KiB
Java
package com.google.android.material.appbar;
|
|
|
|
import android.R;
|
|
import android.animation.AnimatorInflater;
|
|
import android.animation.ObjectAnimator;
|
|
import android.animation.StateListAnimator;
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.util.AttributeSet;
|
|
import android.view.View;
|
|
import android.view.ViewOutlineProvider;
|
|
import androidx.annotation.NonNull;
|
|
import com.google.android.material.internal.ThemeEnforcement;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes7.dex */
|
|
class ViewUtilsLollipop {
|
|
private static final int[] STATE_LIST_ANIM_ATTRS = {R.attr.stateListAnimator};
|
|
|
|
public static void setBoundsViewOutlineProvider(@NonNull View view) {
|
|
view.setOutlineProvider(ViewOutlineProvider.BOUNDS);
|
|
}
|
|
|
|
public static void setDefaultAppBarLayoutStateListAnimator(@NonNull View view, float f) {
|
|
int integer = view.getResources().getInteger(com.google.android.material.R.integer.app_bar_elevation_anim_duration);
|
|
StateListAnimator stateListAnimator = new StateListAnimator();
|
|
long j = integer;
|
|
stateListAnimator.addState(new int[]{R.attr.state_enabled, com.google.android.material.R.attr.state_liftable, -com.google.android.material.R.attr.state_lifted}, ObjectAnimator.ofFloat(view, "elevation", 0.0f).setDuration(j));
|
|
stateListAnimator.addState(new int[]{R.attr.state_enabled}, ObjectAnimator.ofFloat(view, "elevation", f).setDuration(j));
|
|
stateListAnimator.addState(new int[0], ObjectAnimator.ofFloat(view, "elevation", 0.0f).setDuration(0L));
|
|
view.setStateListAnimator(stateListAnimator);
|
|
}
|
|
|
|
public static void setStateListAnimatorFromAttrs(@NonNull View view, AttributeSet attributeSet, int i, int i2) {
|
|
Context context = view.getContext();
|
|
TypedArray obtainStyledAttributes = ThemeEnforcement.obtainStyledAttributes(context, attributeSet, STATE_LIST_ANIM_ATTRS, i, i2, new int[0]);
|
|
try {
|
|
if (obtainStyledAttributes.hasValue(0)) {
|
|
view.setStateListAnimator(AnimatorInflater.loadStateListAnimator(context, obtainStyledAttributes.getResourceId(0, 0)));
|
|
}
|
|
obtainStyledAttributes.recycle();
|
|
} catch (Throwable th) {
|
|
obtainStyledAttributes.recycle();
|
|
throw th;
|
|
}
|
|
}
|
|
}
|