[Guide] Listview Animations for Lollipop

tdunham

Recognized Contributor
Jun 21, 2008
13,686
36,462
0
TampaBay
Listview Animations for Lollipop - MM files added for compare

This guide is based on the Sprint Galaxy S5 OA6 Lollipop 5.0 firmware.

framework.jar smali edits
\smali_classes2\android\widget\AbsListView$FlingRunnable$1.smali
Delete the line in RED and add the new code in BLUE
Make sure the values in the new code match surrounding code.
Code:
.method public run()V
.
.
.
    :cond_2
    iget-object v4, p0, Landroid/widget/AbsListView$FlingRunnable$1;->this$1:Landroid/widget/AbsListView$FlingRunnable;

    [COLOR="Red"]invoke-virtual {v4}, Landroid/widget/AbsListView$FlingRunnable;->endFling()V
[/COLOR]
    [COLOR="Blue"]const/4 v5, 0x0

    invoke-virtual {v4, v5}, Landroid/widget/AbsListView$FlingRunnable;->endFling(Z)V
[/COLOR]
    iget-object v4, p0, Landroid/widget/AbsListView$FlingRunnable$1;->this$1:Landroid/widget/AbsListView$FlingRunnable;

    iget-object v4, v4, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;

    const/4 v5, 0x3

    iput v5, v4, Landroid/widget/AbsListView;->mTouchMode:I

    iget-object v4, p0, Landroid/widget/AbsListView$FlingRunnable$1;->this$1:Landroid/widget/AbsListView$FlingRunnable;

    iget-object v4, v4, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;

    const/4 v5, 0x1

    invoke-virtual {v4, v5}, Landroid/widget/AbsListView;->reportScrollStateChange(I)V

    goto :goto_0
.end method
\smali_classes2\android\widget\AbsListView$FlingRunnable.smali
Rename the following method header in RED to the new name in BLUE:
Code:
[COLOR="Red"].method endFling()V
[/COLOR]
[COLOR="Blue"].method endFling(Z)V[/COLOR]
Add new method right above the newly renamed method:
Code:
.method endFling()V
    .locals 1

    const/4 v0, 0x1

    invoke-virtual {p0, v0}, Landroid/widget/AbsListView$FlingRunnable;->endFling(Z)V

    return-void
.end method
Now, make the following edits in BLUE in that newly renamed method also.
Code:
.method endFling(Z)V
    .locals 2

    iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;

    const/4 v1, -0x1

    iput v1, v0, Landroid/widget/AbsListView;->mTouchMode:I

    iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;

    invoke-virtual {v0, p0}, Landroid/widget/AbsListView;->removeCallbacks(Ljava/lang/Runnable;)Z

    iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;

    iget-object v1, p0, Landroid/widget/AbsListView$FlingRunnable;->mCheckFlywheel:Ljava/lang/Runnable;

    invoke-virtual {v0, v1}, Landroid/widget/AbsListView;->removeCallbacks(Ljava/lang/Runnable;)Z

    iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/widget/AbsListView;->reportScrollStateChange(I)V

    [COLOR="blue"]if-eqz p1, :cond_td[/COLOR]

    iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;

    # invokes: Landroid/widget/AbsListView;->clearScrollingCache()V
    invoke-static {v0}, Landroid/widget/AbsListView;->access$3100(Landroid/widget/AbsListView;)V

    [COLOR="blue"]:cond_td[/COLOR]
Same smali, make the following edits in BLUE
and delete the lines in RED. Note the access$3100 in the following code in GREEN, we may need to change that right after this edit.
Code:
.method start(I)V
    .locals 9

    const v6, 0x7fffffff

    const/4 v1, 0x0

    [COLOR="Red"]if-gez p1, :cond_1[/COLOR]
    [COLOR="blue"]invoke-static {p1}, Ljava/lang/Math;->abs(I)I

    move-result v0

    iget-object v3, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;

    invoke-static {v3}, Landroid/widget/AbsListView;->access$1234(Landroid/widget/AbsListView;)I

    move-result v3

    if-le v0, v3, :cond_td

    iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;

    invoke-static {v0}, Landroid/widget/AbsListView;->[COLOR="Green"]access$3100[/COLOR](Landroid/widget/AbsListView;)V

    :cond_td
    if-gez p1, :cond_td1[/COLOR]
.
.
.
    :cond_0
    return-void

    [COLOR="Red"]:cond_1
[/COLOR]    [COLOR="Blue"]:cond_td1
[/COLOR]    move v2, v1

    goto :goto_0
.end method
Now lets go confirm that the access$3100 that is called from this smali is the correct one.
Look in and confirm that the following method matches, if it doesn't change the access$3100 in the previous edit so that it does.
\smali_classes2\android\widget\AbsListView.smali
Code:
.method static synthetic access$3100(Landroid/widget/AbsListView;)V
    .locals 0

    invoke-direct {p0}, Landroid/widget/AbsListView;->clearScrollingCache()V

    return-void
.end method
If it matches, perfect. We will continue working in this smali to add changes:
\smali_classes2\android\widget\AbsListView.smali
Add new code in BLUE to #instance fields.
Code:
# instance fields
[COLOR="blue"].field private mDecacheThreshold:I

.field mHeight:I

.field mIsGridView:Z

.field mIsScrolling:Z

.field mIsWidget:Z

.field mWidth:I

.field mvPosition:I
[/COLOR]
.field protected AIR_VIEW_WINSET:Z

.field private HOVERSCROLL_DELAY:I

.field private HOVERSCROLL_SPEED:F
Same smali, add new code in BLUE making sure values match surrounding code.
Code:
.method public constructor <init>(Landroid/content/Context;)V
.
.
.
    iput v5, p0, Landroid/widget/AbsListView;->mActivePointerId:I

    iput v4, p0, Landroid/widget/AbsListView;->mPointerCount:I

    iput-boolean v4, p0, Landroid/widget/AbsListView;->mHapticOverScroll:Z

    iput v4, p0, Landroid/widget/AbsListView;->mDirection:I

    [COLOR="blue"]iput v4, p0, Landroid/widget/AbsListView;->mHeight:I

    iput-boolean v4, p0, Landroid/widget/AbsListView;->mIsGridView:Z
[/COLOR]
    iput v4, p0, Landroid/widget/AbsListView;->mHoverTopAreaHeight:I

    iput v4, p0, Landroid/widget/AbsListView;->mHoverBottomAreaHeight:I

    iput-wide v8, p0, Landroid/widget/AbsListView;->mHoverRecognitionDurationTime:J
Add new method in BLUE
Code:
.method static synthetic access$000(Landroid/widget/AbsListView;Z)V
    .locals 0

    invoke-direct {p0, p1}, Landroid/widget/AbsListView;->setFastScrollerEnabledUiThread(Z)V

    return-void
.end method

[COLOR="Blue"].method static synthetic access$1234(Landroid/widget/AbsListView;)I
    .registers 1

    iget v0, p0, Landroid/widget/AbsListView;->mDecacheThreshold:I

    return v0
.end method[/COLOR]
Same smali, add new code in BLUE making sure new values match surrounding code
Code:
.method private initAbsListView()V
.
.
.
    iput v6, p0, Landroid/widget/AbsListView;->mTouchSlop:I

    invoke-virtual {v1}, Landroid/view/ViewConfiguration;->getScaledMinimumFlingVelocity()I

    move-result v6

    iput v6, p0, Landroid/widget/AbsListView;->mMinimumVelocity:I

    invoke-virtual {v1}, Landroid/view/ViewConfiguration;->getScaledMaximumFlingVelocity()I

    move-result v6

    iput v6, p0, Landroid/widget/AbsListView;->mMaximumVelocity:I

   [COLOR="blue"] iget v6, p0, Landroid/widget/AbsListView;->mMaximumVelocity:I

    div-int/lit8 v6, v6, 0x2

    iput v6, p0, Landroid/widget/AbsListView;->mDecacheThreshold:I[/COLOR]

    invoke-virtual {v1}, Landroid/view/ViewConfiguration;->getScaledOverscrollDistance()I

    move-result v6

    iput v6, p0, Landroid/widget/AbsListView;->mOverscrollDistance:I

    invoke-virtual {v1}, Landroid/view/ViewConfiguration;->getScaledOverflingDistance()I

    move-result v6

    iput v6, p0, Landroid/widget/AbsListView;->mOverflingDistance:I
.
.
.
    :cond_6

    [COLOR="blue"]const/4 v1, 0x3

    invoke-virtual {p0, v1}, Landroid/widget/AbsListView;->setPersistentDrawingCache(I)V
[/COLOR]
    return-void

    :catch_0
    move-exception v4

    goto :goto_0

    :catch_1
    move-exception v4

    goto :goto_0
.end method
Add new code in BLUE making sure values match surrounding code.
Code:
.method private scrollIfNeeded(IILandroid/view/MotionEvent;)V
.
.
.
    iget v3, v0, Landroid/widget/AbsListView;->mLastY:I

    sub-int v3, p2, v3

    add-int v21, v3, v34

    :goto_1
    const/16 v22, 0x0

    move-object/from16 v0, p0

    iget v3, v0, Landroid/widget/AbsListView;->mTouchMode:I

    const/4 v4, 0x3

    if-ne v3, v4, :cond_13

    [COLOR="blue"]const/4 v3, 0x0

    move-object/from16 v0, p0

    iput-boolean v3, v0, Landroid/widget/AbsListView;->mIsWidget:Z

[/COLOR]    move-object/from16 v0, p0

    iget-object v3, v0, Landroid/widget/AbsListView;->mScrollStrictSpan:Landroid/os/StrictMode$Span;

    if-nez v3, :cond_2

    const-string v3, "AbsListView-scroll"

    invoke-static {v3}, Landroid/os/StrictMode;->enterCriticalSpan(Ljava/lang/String;)Landroid/os/StrictMode$Span;
Add new line in BLUE making sure value matches surrounding code.
Code:
.method protected handleDataChanged()V
    .locals 15

    const/4 v14, 0x5

    const/4 v13, -0x1

    const/4 v8, 0x3

    const/4 v9, 0x1

    const/4 v12, 0x0

    [COLOR="blue"]iput-boolean v9, p0, Landroid/widget/AbsListView;->mIsWidget:Z
[/COLOR]
    iget v1, p0, Landroid/widget/AbsListView;->mItemCount:I
Add new code in BLUE making sure value matches surrounding code.
Code:
.method obtainView(I[Z)Landroid/view/View;
.
.
.
    :cond_4
    iget-object v7, p0, Landroid/widget/AbsListView;->mRecycler:Landroid/widget/AbsListView$RecycleBin;

    invoke-virtual {v7, p1}, Landroid/widget/AbsListView$RecycleBin;->getScrapView(I)Landroid/view/View;

    move-result-object v3

    iget-object v7, p0, Landroid/widget/AbsListView;->mAdapter:Landroid/widget/ListAdapter;

    invoke-interface {v7, p1, v3, p0}, Landroid/widget/ListAdapter;->getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v0

    [COLOR="blue"]iget-boolean v7, p0, Landroid/widget/AbsListView;->mIsScrolling:Z

    if-eqz v7, :cond_td

    iget-boolean v7, p0, Landroid/widget/AbsListView;->mIsWidget:Z

    if-nez v7, :cond_td

    invoke-virtual {p0, v0}, Landroid/widget/AbsListView;->setAnimation(Landroid/view/View;)Landroid/view/View;

    move-result-object v0

    :cond_td
[/COLOR]
    if-eqz v3, :cond_6

    if-eq v0, v3, :cond_7

    invoke-virtual {v3}, Landroid/view/View;->isAccessibilityFocused()Z

    move-result v7

    if-eqz v7, :cond_5

    invoke-virtual {v3}, Landroid/view/View;->clearAccessibilityFocus()V

    invoke-virtual {v0}, Landroid/view/View;->requestAccessibilityFocus()Z
Add new code in BLUE making sure value matches surrounding code.
Code:
.method protected onLayout(ZIIII)V
.
.
.
    :cond_1
    invoke-virtual {p0}, Landroid/widget/AbsListView;->layoutChildren()V

    const/4 v2, 0x0

    iput-boolean v2, p0, Landroid/widget/AbsListView;->mInLayout:Z

    sub-int v2, p5, p3

    div-int/lit8 v2, v2, 0x3

    iput v2, p0, Landroid/widget/AbsListView;->mOverscrollMax:I

    [COLOR="Blue"]invoke-virtual {p0}, Landroid/widget/AbsListView;->getHeight()I

    move-result v2

    iput v2, p0, Landroid/widget/AbsListView;->mHeight:I

    invoke-virtual {p0}, Landroid/widget/AbsListView;->getWidth()I

    move-result v2

    iput v2, p0, Landroid/widget/AbsListView;->mWidth:I
[/COLOR]
    iget-object v2, p0, Landroid/widget/AbsListView;->mFastScroll:Landroid/widget/FastScroller;

    if-eqz v2, :cond_2

    iget-object v2, p0, Landroid/widget/AbsListView;->mFastScroll:Landroid/widget/FastScroller;

    invoke-virtual {p0}, Landroid/widget/AbsListView;->getChildCount()I
Add new code in BLUE making sure value matches surrounding code.
Code:
.method reportScrollStateChange(I)V
.
.
.
    :goto_3
    iput v5, p0, Landroid/widget/AbsListView;->mDVFSCookie:I

    :cond_6
    invoke-static {v5}, Landroid/os/DVFSHelper;->onScrollEvent(Z)V

    iput-boolean v5, p0, Landroid/widget/AbsListView;->mDVFSLockAcquired:Z

    :cond_7
    iput p1, p0, Landroid/widget/AbsListView;->mLastScrollState:I

    [COLOR="blue"]if-eqz p1, :cond_td

    const/4 v0, 0x1

    :goto_td
    iput-boolean v0, p0, Landroid/widget/AbsListView;->mIsScrolling:Z
[/COLOR]
    iget-object v0, p0, Landroid/widget/AbsListView;->mOnScrollListener:Landroid/widget/AbsListView$OnScrollListener;

    if-eqz v0, :cond_8

    iget-boolean v0, p0, Landroid/widget/AbsListView;->mHoverAreaEnter:Z

    if-nez v0, :cond_8

    iget v0, p0, Landroid/widget/AbsListView;->mQCstate:I

    if-eq v0, v7, :cond_8

    iget-object v0, p0, Landroid/widget/AbsListView;->mOnScrollListener:Landroid/widget/AbsListView$OnScrollListener;

    invoke-interface {v0, p0, p1}, Landroid/widget/AbsListView$OnScrollListener;->onScrollStateChanged(Landroid/widget/AbsListView;I)V

    :cond_8
    return-void
    [COLOR="blue"]:cond_td
    const/4 v0, 0x0

    goto :goto_td
[/COLOR]
    :catch_0
    move-exception v0
Add new method above .method public setAirScrollEnable(Z)V (or at the bottom if this method does not exist)
Code:
.method setAnimation(Landroid/view/View;)Landroid/view/View;
    .locals 14

    const/4 v5, 0x1

    const/high16 v2, 0x3f800000

    const/high16 v1, 0x3f000000

    const/4 v4, 0x0

    iget-object v3, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;

    invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v6, "listview_animation"

    invoke-static {v3, v6, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v10

    const/4 v13, 0x0

    const/4 v11, 0x0

    :try_start_0
    invoke-virtual {p0}, Landroid/widget/AbsListView;->computeVerticalScrollOffset()I
    :try_end_0
    .catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v13

    :goto_0
    if-nez v10, :cond_1

    :cond_0
    :goto_1
    return-object p1

    :catch_0
    move-exception v9

    iget v13, p0, Landroid/widget/AbsListView;->mvPosition:I

    goto :goto_0

    :cond_1
    iget v3, p0, Landroid/widget/AbsListView;->mvPosition:I

    if-ge v3, v13, :cond_2

    const/4 v11, 0x1

    :cond_2
    iput v13, p0, Landroid/widget/AbsListView;->mvPosition:I

    const/4 v0, 0x0

    packed-switch v10, :pswitch_data_0

    :goto_2
    const-wide/16 v1, 0x1f4

    invoke-virtual {v0, v1, v2}, Landroid/view/animation/Animation;->setDuration(J)V

    iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const-string v2, "listview_interpolator"

    const/4 v3, 0x0

    invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v12

    packed-switch v12, :pswitch_data_1

    :goto_3
    if-eqz p1, :cond_0

    invoke-virtual {p1, v0}, Landroid/view/View;->startAnimation(Landroid/view/animation/Animation;)V

    goto :goto_1

    :pswitch_0
    new-instance v0, Landroid/view/animation/ScaleAnimation;

    invoke-direct {v0, v1, v2, v1, v2}, Landroid/view/animation/ScaleAnimation;-><init>(FFFF)V

    goto :goto_2

    :pswitch_1
    new-instance v0, Landroid/view/animation/ScaleAnimation;

    move v3, v1

    move v4, v2

    move v6, v2

    move v7, v5

    move v8, v2

    invoke-direct/range {v0 .. v8}, Landroid/view/animation/ScaleAnimation;-><init>(FFFFIFIF)V

    goto :goto_2

    :pswitch_2
    new-instance v0, Landroid/view/animation/ScaleAnimation;

    move v3, v1

    move v4, v2

    move v6, v1

    move v7, v5

    move v8, v1

    invoke-direct/range {v0 .. v8}, Landroid/view/animation/ScaleAnimation;-><init>(FFFFIFIF)V

    goto :goto_2

    :pswitch_3
    new-instance v0, Landroid/view/animation/AlphaAnimation;

    invoke-direct {v0, v4, v2}, Landroid/view/animation/AlphaAnimation;-><init>(FF)V

    goto :goto_2

    :pswitch_4
    new-instance v0, Landroid/view/animation/TranslateAnimation;

    iget v1, p0, Landroid/widget/AbsListView;->mHeight:I

    neg-int v1, v1

    int-to-float v1, v1

    invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V

    goto :goto_2

    :pswitch_5
    new-instance v0, Landroid/view/animation/TranslateAnimation;

    iget v1, p0, Landroid/widget/AbsListView;->mHeight:I

    int-to-float v1, v1

    invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V

    goto :goto_2

    :pswitch_6
    if-eqz v11, :cond_3

    new-instance v0, Landroid/view/animation/TranslateAnimation;

    iget v1, p0, Landroid/widget/AbsListView;->mHeight:I

    neg-int v1, v1

    int-to-float v1, v1

    invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V

    goto :goto_2

    :cond_3
    new-instance v0, Landroid/view/animation/TranslateAnimation;

    iget v1, p0, Landroid/widget/AbsListView;->mHeight:I

    int-to-float v1, v1

    invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V

    goto :goto_2

    :pswitch_7
    if-eqz v11, :cond_4

    new-instance v0, Landroid/view/animation/TranslateAnimation;

    iget v1, p0, Landroid/widget/AbsListView;->mHeight:I

    int-to-float v1, v1

    invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V

    goto :goto_2

    :cond_4
    new-instance v0, Landroid/view/animation/TranslateAnimation;

    iget v1, p0, Landroid/widget/AbsListView;->mHeight:I

    neg-int v1, v1

    int-to-float v1, v1

    invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V

    goto :goto_2

    :pswitch_8
    new-instance v0, Landroid/view/animation/TranslateAnimation;

    iget v1, p0, Landroid/widget/AbsListView;->mWidth:I

    neg-int v1, v1

    int-to-float v1, v1

    invoke-direct {v0, v1, v4, v4, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V

    goto/16 :goto_2

    :pswitch_9
    new-instance v0, Landroid/view/animation/TranslateAnimation;

    iget v1, p0, Landroid/widget/AbsListView;->mWidth:I

    int-to-float v1, v1

    invoke-direct {v0, v1, v4, v4, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V

    goto/16 :goto_2

    :pswitch_a
    new-instance v0, Landroid/view/animation/RotateAnimation;

    const/high16 v3, 0x43340000

    move-object v2, v0

    move v6, v1

    move v7, v5

    move v8, v1

    invoke-direct/range {v2 .. v8}, Landroid/view/animation/RotateAnimation;-><init>(FFIFIF)V

    goto/16 :goto_2

    :pswitch_b
    iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;

    const v2, 0x10a0005

    invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V

    goto/16 :goto_3

    :pswitch_c
    iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;

    const v2, 0x10a0006

    invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V

    goto/16 :goto_3

    :pswitch_d
    iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;

    const v2, 0x10a0004

    invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V

    goto/16 :goto_3

    :pswitch_e
    iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;

    const v2, 0x10a0007

    invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V

    goto/16 :goto_3

    :pswitch_f
    iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;

    const v2, 0x10a0008

    invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V

    goto/16 :goto_3

    :pswitch_10
    iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;

    const v2, 0x10a0009

    invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V

    goto/16 :goto_3

    :pswitch_11
    iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;

    const v2, 0x10a000a

    invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V

    goto/16 :goto_3

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_3
        :pswitch_4
        :pswitch_5
        :pswitch_6
        :pswitch_7
        :pswitch_8
        :pswitch_9
        :pswitch_a
    .end packed-switch

    :pswitch_data_1
    .packed-switch 0x1
        :pswitch_b
        :pswitch_c
        :pswitch_d
        :pswitch_e
        :pswitch_f
        :pswitch_10
        :pswitch_11
    .end packed-switch
.end method
Add new method in BLUE
Code:
.method public setFriction(F)V
    .locals 1

    iget-object v0, p0, Landroid/widget/AbsListView;->mFlingRunnable:Landroid/widget/AbsListView$FlingRunnable;

    if-nez v0, :cond_0

    new-instance v0, Landroid/widget/AbsListView$FlingRunnable;

    invoke-direct {v0, p0}, Landroid/widget/AbsListView$FlingRunnable;-><init>(Landroid/widget/AbsListView;)V

    iput-object v0, p0, Landroid/widget/AbsListView;->mFlingRunnable:Landroid/widget/AbsListView$FlingRunnable;

    :cond_0
    iget-object v0, p0, Landroid/widget/AbsListView;->mFlingRunnable:Landroid/widget/AbsListView$FlingRunnable;

    # getter for: Landroid/widget/AbsListView$FlingRunnable;->mScroller:Landroid/widget/OverScroller;
    invoke-static {v0}, Landroid/widget/AbsListView$FlingRunnable;->access$2100(Landroid/widget/AbsListView$FlingRunnable;)Landroid/widget/OverScroller;

    move-result-object v0

    invoke-virtual {v0, p1}, Landroid/widget/OverScroller;->setFriction(F)V

    return-void
.end method

[COLOR="blue"].method public setGridView(Z)V
    .locals 0

    iput-boolean p1, p0, Landroid/widget/AbsListView;->mIsGridView:Z

    return-void
.end method[/COLOR]
Framework files have been added to the bottom of this post for diffing.
If you have a Galaxy S5, you might be able to get away with just replacing the modified framework files for this modification, however there are no guarantees it wont cause other issues with your build.

Continue to Post #2 to add the menu items for the toggles

Addendum:
Listview disabled by default.
Some users were complaining about listview being active on a fresh flash to this how to disable it as default until they go in and make a choice.
Replace the line in RED with the code in BLUE
\smali_classes2\android\widget\AbsListView.smali
Code:
.method setAnimation(Landroid/view/View;)Landroid/view/View;
    .locals 14

    const/4 v5, 0x1

    const/high16 v2, 0x3f800000

    const/high16 v1, 0x3f000000

    const/4 v4, 0x0

    iget-object v3, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;

    invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v6, "listview_animation"

    [COLOR="Red"]invoke-static {v3, v6, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
[/COLOR]   [COLOR="Blue"] invoke-static {v3, v6, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
[/COLOR]
Full credits to @Adi Aisiteru Reborn for the original thread HERE
also credit to @lacoursiere18 for the updated KitKat guide HERE
 

Attachments

Last edited:

tdunham

Recognized Contributor
Jun 21, 2008
13,686
36,462
0
TampaBay
Adding Toggles/Menu Item for Listview

To add Listview Animations menu item to SecSettings, refer to the guide by @lacoursiere18 here:

[GUIDE][SMALI][4.4.2] How to port Mokee ListView Animation for TouchWiz 4.4.2

Note:
For lollipop, I believe the xml edit in res/xml the file to edit is going to be display_settings_2014.xml

_________________________________________________


To add Listview Animations menu item to CustomSettings.apk:
\res\values\arrays.xml
Add new items in BLUE
Code:
    [COLOR="blue"]<string-array name="listview_animation_entries">
        <item>@string/listview_off</item>
        <item>@string/listview_wave_left</item>
        <item>@string/listview_wave_right</item>
        <item>@string/listview_scale</item>
        <item>@string/listview_alpha</item>
        <item>@string/listview_stack_top</item>
        <item>@string/listview_stack_bottom</item>
        <item>@string/listview_unfold</item>
        <item>@string/listview_fold</item>
        <item>@string/listview_translate_left</item>
        <item>@string/listview_translate_right</item>
        <item>@string/listview_rotate</item>
    </string-array>
    <string-array name="listview_animation_values">
        <item>0</item>
        <item>1</item>
        <item>2</item>
        <item>3</item>
        <item>4</item>
        <item>5</item>
        <item>6</item>
        <item>7</item>
        <item>8</item>
        <item>9</item>
        <item>10</item>
        <item>11</item>
    </string-array>
    <string-array name="listview_interpolator_entries">
        <item>@string/listview_off</item>
        <item>@string/listview_accelerate_interpolator</item>
        <item>@string/listview_decelerate_interpolator</item>
        <item>@string/listview_accelerate_decelerate_interpolator</item>
        <item>@string/listview_anticipate_interpolator</item>
        <item>@string/listview_overshoot_interpolator</item>
        <item>@string/listview_anticipate_overshoot_interpolator</item>
        <item>@string/listview_bounce_interpolator</item>
    </string-array>
    <string-array name="listview_interpolator_values">
        <item>0</item>
        <item>1</item>
        <item>2</item>
        <item>3</item>
        <item>4</item>
        <item>5</item>
        <item>6</item>
        <item>7</item>
    </string-array>
[/COLOR]</resources>
\res\values\strings.xml
Add new items in BLUE
Code:
    [COLOR="blue"]<string name="listview_off">Off</string>
    <string name="listview_wave_left">Wave (left)</string>
    <string name="listview_wave_right">Wave (right)</string>
    <string name="listview_alpha">Alpha</string>
    <string name="listview_scale">Scale</string>
    <string name="listview_stack_top">Stack (top)</string>
    <string name="listview_stack_bottom">Stack (bottom)</string>
    <string name="listview_unfold">Unfold</string>
    <string name="listview_fold">Fold</string>
    <string name="listview_translate_left">Translate (left)</string>
    <string name="listview_translate_right">Translate (right)</string>
    <string name="listview_rotate">Rotate</string>
    <string name="listview_accelerate_interpolator">Accelerate</string>
    <string name="listview_decelerate_interpolator">Decelerate</string>
    <string name="listview_accelerate_decelerate_interpolator">Accelerate decelerate</string>
    <string name="listview_anticipate_interpolator">Anticipate</string>
    <string name="listview_overshoot_interpolator">Overshoot</string>
    <string name="listview_anticipate_overshoot_interpolator">Anticipate overshoot</string>
    <string name="listview_bounce_interpolator">Bounce</string>
[/COLOR]</resources>
\res\xml\preferences.xml
Code:
<PreferenceScreen android:title="Mokee Listview Animations">
    <ListPreference android:persistent="false" android:entries="@array/listview_animation_entries" android:title="Listview animation" android:key="listview_animation" android:summary="%s" android:dependency="listview_animation" android:entryValues="@array/listview_animation_values" />
    <ListPreference android:persistent="false" android:entries="@array/listview_interpolator_entries" android:title="Listview interpolator" android:key="listview_interpolator" android:summary="%s" android:dependency="listview_interpolator" android:entryValues="@array/listview_interpolator_values" />
</PreferenceScreen>
Rom Control V2 Entries:
Code:
    <string-array name="listview_animation_entries">
        <item>Off</item>
        <item>Wave Left</item>
        <item>Wave Right</item>
        <item>Scale</item>
        <item>Alpha</item>
        <item>Stack Top</item>
        <item>Stack Bottom</item>
        <item>Unfold</item>
        <item>Fold</item>
        <item>Translate Left</item>
        <item>Translate Right</item>
        <item>Rotate</item>
    </string-array>
    <string-array name="listview_animation_values">
        <item>0</item>
        <item>1</item>
        <item>2</item>
        <item>3</item>
        <item>4</item>
        <item>5</item>
        <item>6</item>
        <item>7</item>
        <item>8</item>
        <item>9</item>
        <item>10</item>
        <item>11</item>
    </string-array>
    <string-array name="listview_interpolator_entries">
        <item>Off</item>
        <item>Accelerate</item>
        <item>Decelerate</item>
        <item>Accelerate decelerate</item>
        <item>Anticipate</item>
        <item>Overshoot</item>
        <item>Anticipate overshoot</item>
        <item>Bounce</item>
    </string-array>
    <string-array name="listview_interpolator_values">
        <item>0</item>
        <item>1</item>
        <item>2</item>
        <item>3</item>
        <item>4</item>
        <item>5</item>
        <item>6</item>
        <item>7</item>
    </string-array>

    <PreferenceCategory
        android:title="Mokee Listview Animations">
        <com.wubydax.romcontrol.v2.prefs.MyListPreference
            android:entries="@array/listview_animation_entries"
            android:title="Listview animation"
            android:key="listview_animation"
            android:defaultValue="0"
            android:dependency="listview_animation"
            android:entryValues="@array/listview_animation_values" />
        <com.wubydax.romcontrol.v2.prefs.MyListPreference
            android:entries="@array/listview_interpolator_entries"
            android:title="Listview interpolator"
            android:key="listview_interpolator"
            android:defaultValue="0"
            android:dependency="listview_interpolator"
            android:entryValues="@array/listview_interpolator_values" />
    </PreferenceCategory>
 
Last edited:

tdunham

Recognized Contributor
Jun 21, 2008
13,686
36,462
0
TampaBay
Thanks for another great mod and guide. Works great. I wasn't sure what the animations looked like but figured I would try it out. Pretty cool options.
Yes it is pretty cool.
I'm still waiting for some feedback from some of the users that have a different phone to give the framework edits a try.
Its a big task but its worth it. ;)
 

tdunham

Recognized Contributor
Jun 21, 2008
13,686
36,462
0
TampaBay
@tdunham I am trying this mod on Note 3. it is stuck on boot logo, I attached my stock and modified smalis as well as log, If you could have time looking at my smalis and log and see what's the culprit I would be very thankful. :angel:
The smali you sent looks fine.
The log wasn't a lot of help so I look at the edit I did for AbsListView$FlingRunnable.smali and see new code for access$3100 where I ask you to check if yours matches the one I posted. I see your AbsListView;->access$3100 is for scrollingcache also. You didn't change that did you?
 
  • Like
Reactions: Kamy

tdunham

Recognized Contributor
Jun 21, 2008
13,686
36,462
0
TampaBay
And just for reference, try plugging in my smali files to see what happens.
Also, send me the other 2 smalis that you edited.
 
Last edited:
  • Like
Reactions: Kamy

Kamy

Senior Member
Aug 29, 2012
5,335
19,304
263
Beijing
And just for reference, try plugging in my smali files to see what happens.
Also, send me the other 2 smalis that you edited.
OK, let me check.

This is my method which shows the same access

Code:
.method static synthetic access$3100(Landroid/widget/AbsListView;)V
    .locals 0
    .param p0, "x0"    # Landroid/widget/AbsListView;

    .prologue
    .line 132
    invoke-direct {p0}, Landroid/widget/AbsListView;->clearScrollingCache()V

    return-void
.end method
I believe those samlis are identical but let's narrow it down the failure.
 

Attachments

tdunham

Recognized Contributor
Jun 21, 2008
13,686
36,462
0
TampaBay
OK, let me check.

This is my method which shows the same access

Code:
.method static synthetic access$3100(Landroid/widget/AbsListView;)V
    .locals 0
    .param p0, "x0"    # Landroid/widget/AbsListView;

    .prologue
    .line 132
    invoke-direct {p0}, Landroid/widget/AbsListView;->clearScrollingCache()V

    return-void
.end method
I believe those samlis are identical but let's narrow it down the failure.
Right away I see you did not do the edits to AbsListView$FlingRunnable$1.smali or to AbsListView$FlingRunnable.smali because the new method .method endFling(Z)V is missing I think. Read the first part a little more closely, maybe my wording is difficult to understand.
 
  • Like
Reactions: Kamy

Kamy

Senior Member
Aug 29, 2012
5,335
19,304
263
Beijing
Right away I see you did not do the edits to AbsListView$FlingRunnable$1.smali or to AbsListView$FlingRunnable.smali because the new method .method endFling(Z)V is missing I think. Read the first part a little more closely, maybe my wording is difficult to understand.
Yes I did, I thought you remembering me in mixing up stuff. I uploaded the stock ones. Here I attached the modded smalis. BTW, is this mod going to control or use those animation resources in framework. Because I compiled it successfully and booted fine but there is no animation changes, all I have is stock animation.
 
Last edited:

tdunham

Recognized Contributor
Jun 21, 2008
13,686
36,462
0
TampaBay
Yes I did, I thought you remembering me in mixing up stuff. I uploaded the stock ones. Here I attached the modded smalis. BTW, is this mod going to control or use those animation resources in framework. Because I compiled it successfully and booted fine but there is no animation changes, all I have is stock animation.
Yes, I got the new set and it looks good too.
Animations only take effect wherever you are scrolling through a list.
Did you add the toggles? Not sure, maybe check for the keys with a sql editor to see if they change on toggle.
 
  • Like
Reactions: Kamy

Kamy

Senior Member
Aug 29, 2012
5,335
19,304
263
Beijing
Yes, I got the new set and it looks good too.
Animations only take effect wherever you are scrolling through a list.
Did you add the toggles? Not sure, maybe check for the keys with a sql editor to see if they change on toggle.
Yes mate I am aware of that and confirming toggle works but no effect I guess there is something different on Note 3 smalis or resources, anyway thanks for help I think I should move on.
 

tdunham

Recognized Contributor
Jun 21, 2008
13,686
36,462
0
TampaBay
Yes mate I am aware of that and confirming toggle works but no effect I guess there is something different on Note 3 smalis or resources, anyway thanks for help I think I should move on.
Not sure. I think @lacoursiere18 has a note 4 but not sure if he's tried this yet for his build. Maybe he can share his smali.
Have you tried mine yet? Straight up replacing yours.