本文整理汇总了Java中android.view.animation.AnimationUtils.loadInterpolator方法的典型用法代码示例。如果您正苦于以下问题:Java AnimationUtils.loadInterpolator方法的具体用法?Java AnimationUtils.loadInterpolator怎么用?Java AnimationUtils.loadInterpolator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.animation.AnimationUtils
的用法示例。
在下文中一共展示了AnimationUtils.loadInterpolator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ResolverDrawerLayout
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
public ResolverDrawerLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ResolverDrawerLayout,
defStyleAttr, 0);
mMaxWidth = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_android_maxWidth, -1);
mMaxCollapsedHeight = a.getDimensionPixelSize(
R.styleable.ResolverDrawerLayout_maxCollapsedHeight, 0);
mMaxCollapsedHeightSmall = a.getDimensionPixelSize(
R.styleable.ResolverDrawerLayout_maxCollapsedHeightSmall,
mMaxCollapsedHeight);
a.recycle();
mScrollIndicatorDrawable = context.getDrawable(R.drawable.scroll_indicator_material);
mScroller = new OverScroller(context, AnimationUtils.loadInterpolator(context,
android.R.interpolator.decelerate_quint));
mVelocityTracker = VelocityTracker.obtain();
final ViewConfiguration vc = ViewConfiguration.get(context);
mTouchSlop = vc.getScaledTouchSlop();
mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
示例2: initAttrs
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
private void initAttrs(Context context, AttributeSet attrs) {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RollSquareView);
mLineCount = typedArray.getInteger(R.styleable.RollSquareView_line_count, 3);
mRollRoundCornor = typedArray.getFloat(R.styleable.RollSquareView_roll_round_cornor, 10);
mFixRoundCornor = typedArray.getFloat(R.styleable.RollSquareView_fix_round_cornor, 10);
int rollInterpolatorResId = typedArray.getResourceId(R.styleable.RollSquareView_roll_interpolator,
android.R.anim.linear_interpolator);
mRollInterpolator = AnimationUtils.loadInterpolator(context, rollInterpolatorResId);
int defaultColor = context.getResources().getColor(R.color.default_color);
mSquareColor = typedArray.getColor(R.styleable.RollSquareView_square_color, defaultColor);
mSpeed = typedArray.getInteger(R.styleable.RollSquareView_roll_speed, 250);
if (mLineCount < 2) {
mLineCount = 2;//至少要四个方块
}
mHalfSquareWidth = typedArray.getDimension(R.styleable.RollSquareView_half_rect_width, 30);
mDividerWidth = typedArray.getDimension(R.styleable.RollSquareView_rect_divier_width, 10);
mIsClockwise = typedArray.getBoolean(R.styleable.RollSquareView_is_clockwise, true);
mStartEmptyPosition = typedArray.getInteger(R.styleable.RollSquareView_start_empty_position, 0);
if (isInsideTheRect(mStartEmptyPosition, mLineCount)) {
mStartEmptyPosition = 0;
}
mCurrEmptyPosition = mStartEmptyPosition;
typedArray.recycle();
}
示例3: initView
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
private void initView() {
setClickable(true);
mPathPaint = new Paint();
mPathPaint.setAntiAlias(true);
mPathPaint.setDither(true);
mPathPaint.setColor(mNormalStateColor);
mPathPaint.setStyle(Paint.Style.STROKE);
mPathPaint.setStrokeJoin(Paint.Join.ROUND);
mPathPaint.setStrokeCap(Paint.Cap.ROUND);
mPathPaint.setStrokeWidth(mPathWidth);
mDotPaint = new Paint();
mDotPaint.setAntiAlias(true);
mDotPaint.setDither(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& !isInEditMode()) {
mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(
getContext(), android.R.interpolator.fast_out_slow_in);
mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(
getContext(), android.R.interpolator.linear_out_slow_in);
}
}
示例4: setupSharedEelementTransitions2
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
/**
* 使用方式二:调用setupSharedEelementTransitions2方法
* 使用这种方式的话需要的类是 MorphDrawable, MorphTransition
*/
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void setupSharedEelementTransitions2() {
ArcMotion arcMotion = new ArcMotion();
arcMotion.setMinimumHorizontalAngle(50f);
arcMotion.setMinimumVerticalAngle(50f);
Interpolator easeInOut = AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in);
//hujiawei 100是随意给的一个数字,可以修改,需要注意的是这里调用container.getHeight()结果为0
MorphTransition sharedEnter = new MorphTransition(ContextCompat.getColor(this, R.color.colorPrimary),
ContextCompat.getColor(this, R.color.white), 100, getResources().getDimensionPixelSize(R.dimen.dialog_corners), true);
sharedEnter.setPathMotion(arcMotion);
sharedEnter.setInterpolator(easeInOut);
MorphTransition sharedReturn = new MorphTransition(ContextCompat.getColor(this, R.color.colorPrimary),
ContextCompat.getColor(this, R.color.white), getResources().getDimensionPixelSize(R.dimen.dialog_corners), 100, false);
sharedReturn.setPathMotion(arcMotion);
sharedReturn.setInterpolator(easeInOut);
if (container != null) {
sharedEnter.addTarget(container);
sharedReturn.addTarget(container);
}
getWindow().setSharedElementEnterTransition(sharedEnter);
getWindow().setSharedElementReturnTransition(sharedReturn);
}
示例5: getFastOutSlowInInterpolator
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
public static Interpolator getFastOutSlowInInterpolator(Context context) {
if (fastOutSlowIn == null) {
fastOutSlowIn = AnimationUtils.loadInterpolator(context,
android.R.interpolator.fast_out_slow_in);
}
return fastOutSlowIn;
}
示例6: init
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
/**
* Called from one of constructors of this view to perform its initialization.
* <p>
* Initialization is done via parsing of the specified <var>attrs</var> set and obtaining for
* this view specific data from it that can be used to configure this new view instance. The
* specified <var>defStyleAttr</var> and <var>defStyleRes</var> are used to obtain default data
* from the current theme provided by the specified <var>context</var>.
*/
@SuppressWarnings("ResourceType")
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
this.mContext = context;
setOrientation(LinearLayout.HORIZONTAL);
setGravity(Gravity.CENTER_VERTICAL);
this.inflateHierarchy(context, R.layout.ui_search_view);
this.mProgressBarAnimator = createProgressBarAnimator();
this.mDefaultRevealAnimationHandler = createRevealAnimationHandler();
ColorStateList tintList = null;
PorterDuff.Mode tintMode = PorterDuff.Mode.SRC_IN;
final TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.Ui_SearchView, defStyleAttr, defStyleRes);
for (int i = 0; i < attributes.getIndexCount(); i++) {
final int index = attributes.getIndex(i);
if (index == R.styleable.Ui_SearchView_android_queryHint) {
setQueryHint(attributes.getText(index));
} else if (index == R.styleable.Ui_SearchView_uiTint) {
tintList = attributes.getColorStateList(index);
} else if (index == R.styleable.Ui_SearchView_uiTintMode) {
tintMode = TintManager.parseTintMode(
attributes.getInt(R.styleable.Ui_SearchView_uiTintMode, 0),
tintList != null ? PorterDuff.Mode.SRC_IN : null
);
} else if (index == R.styleable.Ui_SearchView_uiRevealDuration) {
mDefaultRevealAnimationHandler.revealDuration = attributes.getInt(index, 0);
} else if (index == R.styleable.Ui_SearchView_uiConcealDuration) {
mDefaultRevealAnimationHandler.concealDuration = attributes.getInt(index, 0);
} else if (index == R.styleable.Ui_SearchView_uiRevealInterpolator) {
final int resId = attributes.getResourceId(index, 0);
if (resId != 0) {
mDefaultRevealAnimationHandler.interpolator = AnimationUtils.loadInterpolator(context, resId);
}
}
}
attributes.recycle();
if (tintList != null || tintMode != null) {
this.mTintInfo = new SearchTintInfo();
this.mTintInfo.tintList = tintList;
this.mTintInfo.hasTintList = tintList != null;
this.mTintInfo.tintMode = tintMode;
this.mTintInfo.hasTintMode = tintMode != null;
}
final Resources.Theme theme = context.getTheme();
final TypedValue typedValue = new TypedValue();
if (theme.resolveAttribute(R.attr.uiSearchSelectHandleColor, typedValue, true)) {
if (mTintInfo == null) {
this.mTintInfo = new SearchTintInfo();
}
if (typedValue.resourceId > 0) {
mTintInfo.textSelectHandleTintList = ResourceUtils.getColorStateList(
getResources(),
typedValue.resourceId,
theme
);
} else {
mTintInfo.textSelectHandleTintList = ColorStateList.valueOf(typedValue.data);
}
mTintInfo.hasTextSelectHandleTintList = mTintInfo.textSelectHandleTintList != null;
}
this.applyTint();
this.mRevealAnimationHandler = mDefaultRevealAnimationHandler;
}
示例7: getFastOutSlowInInterpolator
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static Interpolator getFastOutSlowInInterpolator(Context context) {
if (fastOutSlowIn == null) {
fastOutSlowIn = AnimationUtils.loadInterpolator(context,
android.R.interpolator.fast_out_slow_in);
}
return fastOutSlowIn;
}
示例8: getFastOutSlowInInterpolator
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
public static Interpolator getFastOutSlowInInterpolator(Context context) {
if (fastOutSlowIn == null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
fastOutSlowIn = AnimationUtils.loadInterpolator(context,
android.R.interpolator.fast_out_slow_in);
}
}
return fastOutSlowIn;
}
示例9: getFastOutLinearInInterpolator
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
public static Interpolator getFastOutLinearInInterpolator(Context context) {
if (fastOutLinearIn == null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
fastOutLinearIn = AnimationUtils.loadInterpolator(context,
android.R.interpolator.fast_out_linear_in);
}
}
return fastOutLinearIn;
}
示例10: getLinearOutSlowInInterpolator
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
public static Interpolator getLinearOutSlowInInterpolator(Context context) {
if (linearOutSlowIn == null) {
linearOutSlowIn = AnimationUtils.loadInterpolator(context,
android.R.interpolator.linear_out_slow_in);
}
return linearOutSlowIn;
}
示例11: buildWrapDrawable
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
private Drawable buildWrapDrawable(Drawable original, boolean isWrap, int duration, int resID) {
if (isWrap) {
final Interpolator interpolator = (resID > 0)
? AnimationUtils.loadInterpolator(getContext(), resID)
: null;
final ShiftDrawable wrappedDrawable = new ShiftDrawable(original, duration, interpolator);
return wrappedDrawable;
} else {
return original;
}
}
示例12: getFastOutSlowInInterpolator
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
public static Interpolator getFastOutSlowInInterpolator(Context context)
{
if (fastOutSlowIn == null)
{
fastOutSlowIn = AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_slow_in);
}
return fastOutSlowIn;
}
示例13: FloatLabelLayout
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
public FloatLabelLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setOrientation(VERTICAL);
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.FloatLabelLayout);
int leftPadding =
a.getDimensionPixelSize(R.styleable.FloatLabelLayout_floatLabelPaddingLeft,
dipsToPix(DEFAULT_LABEL_PADDING_LEFT));
int topPadding = a.getDimensionPixelSize(R.styleable.FloatLabelLayout_floatLabelPaddingTop,
dipsToPix(DEFAULT_LABEL_PADDING_TOP));
int rightPadding =
a.getDimensionPixelSize(R.styleable.FloatLabelLayout_floatLabelPaddingRight,
dipsToPix(DEFAULT_LABEL_PADDING_RIGHT));
int bottomPadding =
a.getDimensionPixelSize(R.styleable.FloatLabelLayout_floatLabelPaddingBottom,
dipsToPix(DEFAULT_LABEL_PADDING_BOTTOM));
mHint = a.getText(R.styleable.FloatLabelLayout_floatLabelHint);
mLabel = new TextView(context);
mLabel.setPadding(leftPadding, topPadding, rightPadding, bottomPadding);
mLabel.setVisibility(INVISIBLE);
mLabel.setText(mHint);
ViewCompat.setPivotX(mLabel, 0f);
ViewCompat.setPivotY(mLabel, 0f);
mLabel.setTextAppearance(context,
a.getResourceId(R.styleable.FloatLabelLayout_floatLabelTextAppearance,
android.R.style.TextAppearance_Small));
a.recycle();
addView(mLabel, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
mInterpolator = AnimationUtils.loadInterpolator(context,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
? android.R.interpolator.fast_out_slow_in
: android.R.anim.decelerate_interpolator);
}
示例14: getFastOutLinearInInterpolator
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
public static Interpolator getFastOutLinearInInterpolator(Context context) {
if (fastOutLinearIn == null) {
fastOutLinearIn = AnimationUtils.loadInterpolator(context,
android.R.interpolator.fast_out_linear_in);
}
return fastOutLinearIn;
}
示例15: processAttributeSet
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
public void processAttributeSet(final AttributeSet attributeSet) {
if (attributeSet == null) return;
final TypedArray typedArray = mContext.obtainStyledAttributes(
attributeSet, mIsVertical ? R.styleable.VerticalInfiniteCycleViewPager :
R.styleable.HorizontalInfiniteCycleViewPager
);
try {
setMinPageScaleOffset(
typedArray.getDimension(
mIsVertical ? R.styleable.VerticalInfiniteCycleViewPager_icvp_min_page_scale_offset :
R.styleable.HorizontalInfiniteCycleViewPager_icvp_min_page_scale_offset,
DEFAULT_MIN_PAGE_SCALE_OFFSET
)
);
setCenterPageScaleOffset(
typedArray.getDimension(
mIsVertical ? R.styleable.VerticalInfiniteCycleViewPager_icvp_center_page_scale_offset :
R.styleable.HorizontalInfiniteCycleViewPager_icvp_center_page_scale_offset,
DEFAULT_CENTER_PAGE_SCALE_OFFSET
)
);
setMinPageScale(
typedArray.getFloat(
mIsVertical ? R.styleable.VerticalInfiniteCycleViewPager_icvp_min_page_scale :
R.styleable.HorizontalInfiniteCycleViewPager_icvp_min_page_scale,
DEFAULT_MIN_SCALE
)
);
setMaxPageScale(
typedArray.getFloat(
mIsVertical ? R.styleable.VerticalInfiniteCycleViewPager_icvp_max_page_scale :
R.styleable.HorizontalInfiniteCycleViewPager_icvp_max_page_scale,
DEFAULT_MAX_SCALE
)
);
setMediumScaled(
typedArray.getBoolean(
mIsVertical ? R.styleable.VerticalInfiniteCycleViewPager_icvp_medium_scaled :
R.styleable.HorizontalInfiniteCycleViewPager_icvp_medium_scaled,
DEFAULT_IS_MEDIUM_SCALED
)
);
setScrollDuration(
typedArray.getInteger(
mIsVertical ? R.styleable.VerticalInfiniteCycleViewPager_icvp_scroll_duration :
R.styleable.HorizontalInfiniteCycleViewPager_icvp_scroll_duration,
DEFAULT_SCROLL_DURATION
)
);
setPageDuration(
typedArray.getInteger(
mIsVertical ? R.styleable.VerticalInfiniteCycleViewPager_icvp_page_duration :
R.styleable.HorizontalInfiniteCycleViewPager_icvp_page_duration,
DEFAULT_SCROLL_DURATION
)
);
// Retrieve interpolator
Interpolator interpolator = null;
try {
final int interpolatorId = typedArray.getResourceId(
mIsVertical ? R.styleable.VerticalInfiniteCycleViewPager_icvp_interpolator :
R.styleable.HorizontalInfiniteCycleViewPager_icvp_interpolator, 0
);
interpolator = interpolatorId == 0 ? null :
AnimationUtils.loadInterpolator(mContext, interpolatorId);
} catch (Resources.NotFoundException exception) {
interpolator = null;
exception.printStackTrace();
} finally {
setInterpolator(interpolator);
}
} finally {
typedArray.recycle();
}
}