46 lines
1.8 KiB
Java
46 lines
1.8 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 com.google.android.material.R$attr;
|
|
import com.google.android.material.R$integer;
|
|
import com.google.android.material.internal.ThemeEnforcement;
|
|
|
|
/* loaded from: classes.dex */
|
|
class ViewUtilsLollipop {
|
|
private static final int[] a = {R.attr.stateListAnimator};
|
|
|
|
static void a(View view) {
|
|
view.setOutlineProvider(ViewOutlineProvider.BOUNDS);
|
|
}
|
|
|
|
static void a(View view, AttributeSet attributeSet, int i, int i2) {
|
|
Context context = view.getContext();
|
|
TypedArray c = ThemeEnforcement.c(context, attributeSet, a, i, i2, new int[0]);
|
|
try {
|
|
if (c.hasValue(0)) {
|
|
view.setStateListAnimator(AnimatorInflater.loadStateListAnimator(context, c.getResourceId(0, 0)));
|
|
}
|
|
} finally {
|
|
c.recycle();
|
|
}
|
|
}
|
|
|
|
static void a(View view, float f) {
|
|
int integer = view.getResources().getInteger(R$integer.app_bar_elevation_anim_duration);
|
|
StateListAnimator stateListAnimator = new StateListAnimator();
|
|
long j = integer;
|
|
stateListAnimator.addState(new int[]{R.attr.enabled, R$attr.state_liftable, -R$attr.state_lifted}, ObjectAnimator.ofFloat(view, "elevation", 0.0f).setDuration(j));
|
|
stateListAnimator.addState(new int[]{R.attr.enabled}, ObjectAnimator.ofFloat(view, "elevation", f).setDuration(j));
|
|
stateListAnimator.addState(new int[0], ObjectAnimator.ofFloat(view, "elevation", 0.0f).setDuration(0L));
|
|
view.setStateListAnimator(stateListAnimator);
|
|
}
|
|
}
|