@@ -0,0 +1,3116 @@
+package com.daksh.tmdbsample.util;%0A%0Aimport android.content.Context;%0Aimport android.os.Parcel;%0Aimport android.os.Parcelable;%0Aimport android.support.annotation.IdRes;%0Aimport android.util.AttributeSet;%0Aimport android.view.View;%0Aimport android.widget.ViewAnimator;%0A%0A/**%0A * ViewAnimator helper which allows setting the selected child by ID rather than index.%0A */%0Apublic class IdViewAnimator extends ViewAnimator %7B%0A%0A    public IdViewAnimator(Context context) %7B%0A        super(context);%0A    %7D%0A%0A    public IdViewAnimator(Context context, AttributeSet attrs) %7B%0A        super(context, attrs);%0A    %7D%0A%0A    @Override%0A    protected void onFinishInflate() %7B%0A        super.onFinishInflate();%0A        setInAnimation(getContext(), android.R.anim.fade_in);%0A        setOutAnimation(getContext(), android.R.anim.fade_out);%0A    %7D%0A%0A    /**%0A     * Get the view ID of the currently displayed child.%0A     */%0A    @IdRes%0A    public int getDisplayedChildId() %7B%0A        return getChildAt(getDisplayedChild()).getId();%0A    %7D%0A%0A    /**%0A     * Set the currently displayed child by its ID.%0A     *%0A     * @param id ID of child.%0A     * @throws IllegalArgumentException If child with specified ID does not exist.%0A     */%0A    public void setDisplayedChildId(@IdRes int id) %7B%0A        for (int i = getChildCount() - 1; i %3E= 0; i--) %7B%0A            View child = getChildAt(i);%0A            if (child.getId() == id) %7B%0A                if (i != getDisplayedChild()) %7B%0A                    setDisplayedChild(i);%0A                %7D%0A                return;%0A            %7D%0A        %7D%0A        throw new IllegalArgumentException(%22View with ID %22 + id + %22 not found.%22);%0A    %7D%0A%0A    @Override%0A    protected Parcelable onSaveInstanceState() %7B%0A        Parcelable superState = super.onSaveInstanceState();%0A        SavedState ss = new SavedState(superState);%0A        ss.mDisplayedChild = getDisplayedChild();%0A        return ss;%0A    %7D%0A%0A    @Override%0A    protected void onRestoreInstanceState(Parcelable state) %7B%0A        if (!(state instanceof SavedState)) %7B%0A            super.onRestoreInstanceState(state);%0A            return;%0A        %7D%0A        SavedState ss = (SavedState) state;%0A        super.onRestoreInstanceState(ss.getSuperState());%0A        setDisplayedChild(ss.mDisplayedChild);%0A    %7D%0A%0A    static class SavedState extends BaseSavedState %7B%0A%0A        public static final Parcelable.Creator%3CSavedState%3E CREATOR = new Parcelable.Creator%3CSavedState%3E() %7B%0A%0A            @Override%0A            public SavedState createFromParcel(Parcel source) %7B%0A                return new SavedState(source);%0A            %7D%0A%0A            @Override%0A            public SavedState%5B%5D newArray(int size) %7B%0A                return new SavedState%5Bsize%5D;%0A            %7D%0A        %7D;%0A        int mDisplayedChild;%0A%0A        public SavedState(Parcel source) %7B%0A            super(source);%0A            mDisplayedChild = source.readInt();%0A        %7D%0A%0A        public SavedState(Parcelable superState) %7B%0A            super(superState);%0A        %7D%0A%0A        @Override%0A        public void writeToParcel(Parcel out, int flags) %7B%0A            super.writeToParcel(out, flags);%0A            out.writeInt(mDisplayedChild);%0A        %7D%0A    %7D%0A%7D%0A

Add IdViewAnimator