List of usage examples for android.animation ObjectAnimator ofInt
public static <T> ObjectAnimator ofInt(T target, Property<T, Integer> property, int... values)
From source file:com.gbozza.android.popularmovies.adapters.ReviewsAdapter.java
@Override public void onBindViewHolder(final ReviewsAdapterViewHolder reviewsAdapterViewHolder, int position) { Review review = mReviewList.get(position); reviewsAdapterViewHolder.mReviewAuthorTextView.append(SpannableUtilities.makeBold(mDetailReviewByLabel)); reviewsAdapterViewHolder.mReviewAuthorTextView.append(review.getAuthor()); reviewsAdapterViewHolder.mReviewContentTextView.setText(review.getContent()); reviewsAdapterViewHolder.mReviewShowMoreImageView.setOnClickListener(new View.OnClickListener() { @Override// w w w.j ava 2s. c o m public void onClick(View view) { int reviewContentLines = TextViewCompat .getMaxLines(reviewsAdapterViewHolder.mReviewContentTextView); int reviewCollapsedMaxLines = reviewsAdapterViewHolder.mContext.getResources() .getInteger(R.integer.review_collapsed_max_lines); if (reviewContentLines != reviewCollapsedMaxLines) { reviewsAdapterViewHolder.mReviewContentTextView.setMaxLines(reviewCollapsedMaxLines); reviewsAdapterViewHolder.mReviewShowMoreImageView.setImageResource(R.drawable.ic_expand_more); } else { ObjectAnimator animation = ObjectAnimator.ofInt(reviewsAdapterViewHolder.mReviewContentTextView, "maxLines", 9999); animation.setDuration(1000).start(); reviewsAdapterViewHolder.mReviewShowMoreImageView.setImageResource(R.drawable.ic_expand_less); } } }); }
From source file:com.appsummary.luoxf.myappsummary.recyclerView.fastscroll.Views.FastScroller.java
public FastScroller(Context context, FastScrollRecyclerView recyclerView, AttributeSet attrs) { Resources resources = context.getResources(); mRecyclerView = recyclerView;/*from w w w. j av a2 s .co m*/ mPopup = new FastScrollPopup(resources, recyclerView); mThumbHeight = Utils.toPixels(resources, 48); mWidth = Utils.toPixels(resources, 8); mTouchInset = Utils.toPixels(resources, -24); mThumb = new Paint(Paint.ANTI_ALIAS_FLAG); mTrack = new Paint(Paint.ANTI_ALIAS_FLAG); TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView, 0, 0); try { mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true); mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay, DEFAULT_AUTO_HIDE_DELAY); int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor, 0x1f000000); int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor, 0xff000000); int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor, 0xff000000); int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor, 0xffffffff); mTrack.setColor(trackColor); mThumb.setColor(thumbColor); mPopup.setBgColor(popupBgColor); mPopup.setTextColor(popupTextColor); } finally { typedArray.recycle(); } mHideRunnable = new Runnable() { @Override public void run() { if (!mIsDragging) { if (mAutoHideAnimator != null) { mAutoHideAnimator.cancel(); } mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller.this, "offsetX", (Utils.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth); mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator()); mAutoHideAnimator.setDuration(200); mAutoHideAnimator.start(); } } }; mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); show(); } }); if (mAutoHideEnabled) { postAutoHideDelayed(); } }
From source file:com.gxy.fastscrollrecyclerview.views.FastScroller.java
public FastScroller(Context context, FastScrollRecyclerView recyclerView, AttributeSet attrs) { Resources resources = context.getResources(); mRecyclerView = recyclerView;//from w ww. ja va 2s. co m mPopup = new FastScrollPopup(resources, recyclerView); mThumbHeight = Utils.toPixels(resources, 32); mWidth = Utils.toPixels(resources, 4); mWidthBg = Utils.toPixels(resources, 2); mTouchInset = Utils.toPixels(resources, -30); mThumb = new Paint(Paint.ANTI_ALIAS_FLAG); mTrack = new Paint(Paint.ANTI_ALIAS_FLAG); TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView, 0, 0); try { mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true); mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay, DEFAULT_AUTO_HIDE_DELAY); int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor, 0x1f000000); int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor, 0xff000000); int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor, 0xff000000); int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor, 0xffffffff); mTrack.setColor(trackColor); mThumb.setColor(thumbColor); mPopup.setBgColor(popupBgColor); mPopup.setTextColor(popupTextColor); } finally { typedArray.recycle(); } mHideRunnable = new Runnable() { @Override public void run() { if (!mIsDragging) { if (mAutoHideAnimator != null) { mAutoHideAnimator.cancel(); } mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller.this, "offsetX", (Utils.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth); mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator()); mAutoHideAnimator.setDuration(200); mAutoHideAnimator.start(); } } }; mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); show(); } }); if (mAutoHideEnabled) { postAutoHideDelayed(); } }
From source file:io.hefuyi.listener.widget.fastscroller.FastScroller.java
public FastScroller(Context context, FastScrollRecyclerView recyclerView, AttributeSet attrs) { Resources resources = context.getResources(); mRecyclerView = recyclerView;//www .jav a2 s. c om mPopup = new FastScrollPopup(resources, recyclerView); mThumbHeight = DensityUtil.dip2px(context, 48); mWidth = DensityUtil.dip2px(context, 8); mTouchInset = DensityUtil.dip2px(context, -24); mThumb = new Paint(Paint.ANTI_ALIAS_FLAG); mTrack = new Paint(Paint.ANTI_ALIAS_FLAG); TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView, 0, 0); try { mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true); mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay, DEFAULT_AUTO_HIDE_DELAY); int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor, 0x1f000000); int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor, ATEUtil.getThemePrimaryColor(context)); int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor, ATEUtil.getThemePrimaryColor(context)); int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor, 0xffffffff); int popupTextSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, DensityUtil.dip2sp(context, 56)); int popupBackgroundSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupBackgroundSize, DensityUtil.dip2px(context, 88)); mTrack.setColor(trackColor); mThumb.setColor(thumbColor); mPopup.setBgColor(popupBgColor); mPopup.setTextColor(popupTextColor); mPopup.setTextSize(popupTextSize); mPopup.setBackgroundSize(popupBackgroundSize); } finally { typedArray.recycle(); } mHideRunnable = new Runnable() { @Override public void run() { if (!mIsDragging) { if (mAutoHideAnimator != null) { mAutoHideAnimator.cancel(); } mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller.this, "offsetX", (ListenerUtil.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth); mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator()); mAutoHideAnimator.setDuration(200); mAutoHideAnimator.start(); } } }; mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); show(); } }); if (mAutoHideEnabled) { postAutoHideDelayed(); } }
From source file:com.ninghoo.beta17ma27.weydio2.FastScrollView.FastScroller.java
public FastScroller(Context context, FastScrollRecyclerView recyclerView, AttributeSet attrs) { Resources resources = context.getResources(); mRecyclerView = recyclerView;//from w ww .j ava 2s. c o m mPopup = new FastScrollPopup(resources, recyclerView); // fast? mThumbHeight = Utils.toPixels(resources, 310); mWidth = Utils.toPixels(resources, 3); // 2???fastscroll mTouchInset = Utils.toPixels(resources, -24); mThumb = new Paint(Paint.ANTI_ALIAS_FLAG); mTrack = new Paint(Paint.ANTI_ALIAS_FLAG); TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView, 0, 0); try { mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true); mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay, DEFAULT_AUTO_HIDE_DELAY); int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor, 0x1f000000); int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor, 0xff000000); int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor, 0xff000000); int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor, 0xffffffff); int popupTextSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, Utils.toScreenPixels(resources, 56)); int popupBackgroundSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupBackgroundSize, Utils.toPixels(resources, 88)); mTrack.setColor(trackColor); mThumb.setColor(thumbColor); mPopup.setBgColor(popupBgColor); mPopup.setTextColor(popupTextColor); mPopup.setTextSize(popupTextSize); mPopup.setBackgroundSize(popupBackgroundSize); } finally { typedArray.recycle(); } mHideRunnable = new Runnable() { @Override public void run() { if (!mIsDragging) { if (mAutoHideAnimator != null) { mAutoHideAnimator.cancel(); } mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller.this, "offsetX", (Utils.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth); mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator()); // mAutoHideAnimator.setDuration(200); mAutoHideAnimator.start(); } } }; mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); show(); } }); if (mAutoHideEnabled) { postAutoHideDelayed(); } }
From source file:io.github.marktony.espresso.component.FastScroller.java
public FastScroller(Context context, FastScrollRecyclerView recyclerView, AttributeSet attrs) { Resources resources = context.getResources(); mRecyclerView = recyclerView;// www . ja va2 s .c o m mPopup = new FastScrollPopup(resources, recyclerView); mThumbHeight = DensityUtil.dip2px(context, 48); mWidth = DensityUtil.dip2px(context, 8); mTouchInset = DensityUtil.dip2px(context, -24); mThumb = new Paint(Paint.ANTI_ALIAS_FLAG); mTrack = new Paint(Paint.ANTI_ALIAS_FLAG); TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView, 0, 0); try { mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true); mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay, DEFAULT_AUTO_HIDE_DELAY); int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor, 0x1f000000); int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor, ContextCompat.getColor(context, R.color.colorPrimary)); int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor, ContextCompat.getColor(context, R.color.colorPrimary)); int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor, 0xffffffff); int popupTextSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, DensityUtil.dip2sp(context, 56)); int popupBackgroundSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupBackgroundSize, DensityUtil.dip2px(context, 88)); mTrack.setColor(trackColor); mThumb.setColor(thumbColor); mPopup.setBgColor(popupBgColor); mPopup.setTextColor(popupTextColor); mPopup.setTextSize(popupTextSize); mPopup.setBackgroundSize(popupBackgroundSize); } finally { typedArray.recycle(); } mHideRunnable = new Runnable() { @Override public void run() { if (!mIsDragging) { if (mAutoHideAnimator != null) { mAutoHideAnimator.cancel(); } mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller.this, "offsetX", (mRecyclerView.getResources().getConfiguration() .getLayoutDirection() == View.LAYOUT_DIRECTION_RTL ? -1 : 1) * mWidth); mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator()); mAutoHideAnimator.setDuration(200); mAutoHideAnimator.start(); } } }; mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); show(); } }); if (mAutoHideEnabled) { postAutoHideDelayed(); } }
From source file:com.libs.golomb.extendedrecyclerview.Scroller.FastScroller2.java
public FastScroller2(Context context, FastScrollRecyclerView2 recyclerView, AttributeSet attrs) { Resources resources = context.getResources(); mRecyclerView = recyclerView;/*from www .jav a 2 s .c o m*/ mPopup = new FastScrollPopup2(resources, recyclerView); mThumbHeight = Utils.toPixels(resources, 48); mWidth = Utils.toPixels(resources, 8); mTouchInset = Utils.toPixels(resources, -24); mThumb = new Paint(Paint.ANTI_ALIAS_FLAG); mTrack = new Paint(Paint.ANTI_ALIAS_FLAG); TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView, 0, 0); try { mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true); mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay, DEFAULT_AUTO_HIDE_DELAY); int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor, 0x1f000000); int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor, 0xff000000); int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor, 0xff000000); int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor, 0xffffffff); int popupTextSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, Utils.toScreenPixels(resources, 56)); int popupBackgroundSize = typedArray.getDimensionPixelSize( R.styleable.FastScrollRecyclerView_fastScrollPopupBackgroundSize, Utils.toPixels(resources, 88)); mTrack.setColor(trackColor); mThumb.setColor(thumbColor); mPopup.setBgColor(popupBgColor); mPopup.setTextColor(popupTextColor); mPopup.setTextSize(popupTextSize); mPopup.setBackgroundSize(popupBackgroundSize); } finally { typedArray.recycle(); } mHideRunnable = new Runnable() { @Override public void run() { if (!mIsDragging) { if (mAutoHideAnimator != null) { mAutoHideAnimator.cancel(); } mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller2.this, "offsetX", (Utils.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth); mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator()); mAutoHideAnimator.setDuration(200); mAutoHideAnimator.start(); } } }; mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { //TODO Log.d("TGolomb", "onScrolled: " + scrollY.addAndGet(dy)); show(); } }); if (mAutoHideEnabled) { postAutoHideDelayed(); } }
From source file:io.plaidapp.ui.FilterAdapter.java
@Override public FilterViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { final FilterViewHolder holder = new FilterViewHolder( LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.filter_item, viewGroup, false)); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override//from w w w . j a v a2 s . c o m public void onClick(View v) { final int position = holder.getAdapterPosition(); if (position == RecyclerView.NO_POSITION) return; final Source filter = filters.get(position); if (isAuthorisedDribbbleSource(filter) && !DribbblePrefs.get(holder.itemView.getContext()).isLoggedIn()) { authoriser.requestDribbbleAuthorisation(holder.filterIcon, filter); } else { holder.itemView.setHasTransientState(true); ObjectAnimator fade = ObjectAnimator.ofInt(holder.filterIcon, ViewUtils.IMAGE_ALPHA, filter.active ? FILTER_ICON_DISABLED_ALPHA : FILTER_ICON_ENABLED_ALPHA); fade.setDuration(300); fade.setInterpolator(AnimationUtils.loadInterpolator(holder.itemView.getContext(), android.R.interpolator.fast_out_slow_in)); fade.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { holder.itemView.setHasTransientState(false); } }); fade.start(); filter.active = !filter.active; holder.filterName.setEnabled(filter.active); notifyItemChanged(position); SourceManager.updateSource(filter, holder.itemView.getContext()); dispatchFiltersChanged(filter); } } }); return holder; }
From source file:org.catrobat.paintroid.ui.BottomBar.java
private void startBottomBarAnimation() { final HorizontalScrollView horizontalScrollView = (HorizontalScrollView) mMainActivity .findViewById(R.id.bottom_bar_scroll_view); final ScrollView verticalScrollView = (ScrollView) mMainActivity .findViewById(R.id.bottom_bar_landscape_scroll_view); final int animationDuration = 1000; int orientation = mMainActivity.getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_PORTRAIT) { horizontalScrollView.post(new Runnable() { public void run() { int scrollToX = (int) (getToolButtonByToolType(mCurrentToolType).getX() - horizontalScrollView.getWidth() / 2.0f + mMainActivity.getResources().getDimension(R.dimen.bottom_bar_button_width) / 2.0f); int scrollFromX = PaintroidApplication.isRTL ? horizontalScrollView.getChildAt(0).getLeft() : horizontalScrollView.getChildAt(0).getRight(); horizontalScrollView.setScrollX(scrollFromX); ObjectAnimator.ofInt(horizontalScrollView, "scrollX", scrollToX).setDuration(animationDuration) .start();/*w ww . j a v a 2 s .c o m*/ } }); } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) { verticalScrollView.post(new Runnable() { public void run() { int scrollToY = (int) (getToolButtonByToolType(mCurrentToolType).getY() - verticalScrollView.getHeight() / 2.0f + mMainActivity.getResources().getDimension(R.dimen.bottom_bar_landscape_button_height) / 2.0f); int scrollFromY = verticalScrollView.getChildAt(0).getBottom(); verticalScrollView.setScrollY(scrollFromY); ObjectAnimator.ofInt(verticalScrollView, "scrollY", scrollToY).setDuration(animationDuration) .start(); } }); } delayedAnimateSelectedTool(animationDuration); }
From source file:com.github.shareme.gwsmaterialuikit.library.viewanimator.AnimationBuilder.java
/** * Background color animation builder./*from ww w.j a va 2s . c o m*/ * * @param colors the colors * @return the animation builder */ public AnimationBuilder backgroundColor(int... colors) { for (View view : views) { ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view, "backgroundColor", colors); objectAnimator.setEvaluator(new ArgbEvaluator()); this.animatorList.add(objectAnimator); } return this; }