// Path: FloatingSearchView/src/main/java/com/mypopsy/widget/internal/ViewUtils.java
// public class ViewUtils {
//     private static final int[] TEMP_ARRAY = new int[1];
// 
//     public static void showSoftKeyboardDelayed(final EditText editText, long delay) {
//         editText.postDelayed(new Runnable() {
//             @Override
//             public void run() {
//                 InputMethodManager inputMethodManager = (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
//                 inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
//             }
//         }, delay);
//     }
// 
//     public static void closeSoftKeyboard(Activity activity) {
//         View currentFocusView = activity.getCurrentFocus();
//         if (currentFocusView != null) {
//             InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
//             imm.hideSoftInputFromWindow(currentFocusView.getWindowToken(), 0);
//         }
//     }
// 
//     public static int dpToPx(int dp) {
//         DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
//         return (int) (dp * metrics.density);
//     }
// 
//     public static int pxToDp(int px) {
//         DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
//         return (int) (px / metrics.density);
//     }
// 
//     public static int getThemeAttrColor(Context context, @AttrRes int attr) {
//         TEMP_ARRAY[0] = attr;
//         TypedArray a = context.obtainStyledAttributes(null, TEMP_ARRAY);
//         try {
//             return a.getColor(0, 0);
//         } finally {
//             a.recycle();
//         }
//     }
// 
//     public static Drawable getTinted(Drawable icon, @ColorInt int color) {
//         if (icon == null) return null;
//         icon = DrawableCompat.wrap(icon);
//         DrawableCompat.setTint(icon, color);
//         return icon;
//     }
// }


import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.Canvas;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.annotation.MenuRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.view.MarginLayoutParamsCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.AppCompatEditText;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.InflateException;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.mypopsy.floatingsearchview.R;
import com.mypopsy.widget.internal.RoundRectDrawableWithShadow;
import com.mypopsy.widget.internal.SuggestionItemDecorator;
import com.mypopsy.widget.internal.ViewUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.mypopsy.widget.internal.RoundRectDrawableWithShadow.BOTTOM;
import static com.mypopsy.widget.internal.RoundRectDrawableWithShadow.LEFT;
import static com.mypopsy.widget.internal.RoundRectDrawableWithShadow.RIGHT;
import static com.mypopsy.widget.internal.RoundRectDrawableWithShadow.TOP;
    }

    public void setOnSearchFocusChangedListener(OnSearchFocusChangedListener focusListener) {
        mFocusListener = focusListener;
    }

    public void addTextChangedListener(TextWatcher textWatcher) {
        mSearchInput.addTextChangedListener(textWatcher);
    }

    public void removeTextChangedListener(TextWatcher textWatcher) {
        mSearchInput.removeTextChangedListener(textWatcher);
    }

    public void setAdapter(RecyclerView.Adapter<? extends RecyclerView.ViewHolder> adapter) {
        RecyclerView.Adapter<? extends RecyclerView.ViewHolder> old = getAdapter();
        if (old != null) old.unregisterAdapterDataObserver(mAdapterObserver);
        adapter.registerAdapterDataObserver(mAdapterObserver);
        mRecyclerView.setAdapter(adapter);
    }

    public void setItemAnimator(RecyclerView.ItemAnimator itemAnimator) {
        mRecyclerView.setItemAnimator(itemAnimator);
    }

    public void addItemDecoration(RecyclerView.ItemDecoration decoration) {
        mRecyclerView.addItemDecoration(decoration);
    }

    public void setLogo(Drawable drawable) {
// Path: FloatingSearchView/src/main/java/com/mypopsy/widget/internal/ViewUtils.java
// public class ViewUtils {
//     private static final int[] TEMP_ARRAY = new int[1];
// 
//     public static void showSoftKeyboardDelayed(final EditText editText, long delay) {
//         editText.postDelayed(new Runnable() {
//             @Override
//             public void run() {
//                 InputMethodManager inputMethodManager = (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
//                 inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
//             }
//         }, delay);
//     }
// 
//     public static void closeSoftKeyboard(Activity activity) {
//         View currentFocusView = activity.getCurrentFocus();
//         if (currentFocusView != null) {
//             InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
//             imm.hideSoftInputFromWindow(currentFocusView.getWindowToken(), 0);
//         }
//     }
// 
//     public static int dpToPx(int dp) {
//         DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
//         return (int) (dp * metrics.density);
//     }
// 
//     public static int pxToDp(int px) {
//         DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
//         return (int) (px / metrics.density);
//     }
// 
//     public static int getThemeAttrColor(Context context, @AttrRes int attr) {
//         TEMP_ARRAY[0] = attr;
//         TypedArray a = context.obtainStyledAttributes(null, TEMP_ARRAY);
//         try {
//             return a.getColor(0, 0);
//         } finally {
//             a.recycle();
//         }
//     }
// 
//     public static Drawable getTinted(Drawable icon, @ColorInt int color) {
//         if (icon == null) return null;
//         icon = DrawableCompat.wrap(icon);
//         DrawableCompat.setTint(icon, color);
//         return icon;
//     }
// }


// Path: FloatingSearchView/src/main/java/com/mypopsy/widget/FloatingSearchView.java
import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.Canvas;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.annotation.MenuRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.view.MarginLayoutParamsCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.AppCompatEditText;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.InflateException;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.mypopsy.floatingsearchview.R;
import com.mypopsy.widget.internal.RoundRectDrawableWithShadow;
import com.mypopsy.widget.internal.SuggestionItemDecorator;
import com.mypopsy.widget.internal.ViewUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.mypopsy.widget.internal.RoundRectDrawableWithShadow.BOTTOM;
import static com.mypopsy.widget.internal.RoundRectDrawableWithShadow.LEFT;
import static com.mypopsy.widget.internal.RoundRectDrawableWithShadow.RIGHT;
import static com.mypopsy.widget.internal.RoundRectDrawableWithShadow.TOP;

    }

    public void setOnSearchFocusChangedListener(OnSearchFocusChangedListener focusListener) {
        mFocusListener = focusListener;
    }

    public void addTextChangedListener(TextWatcher textWatcher) {
        mSearchInput.addTextChangedListener(textWatcher);
    }

    public void removeTextChangedListener(TextWatcher textWatcher) {
        mSearchInput.removeTextChangedListener(textWatcher);
    }

    public void setAdapter(RecyclerView.Adapter<? extends RecyclerView.ViewHolder> adapter) {
        RecyclerView.Adapter<? extends RecyclerView.ViewHolder> old = getAdapter();
        if (old != null) old.unregisterAdapterDataObserver(mAdapterObserver);
        adapter.registerAdapterDataObserver(mAdapterObserver);
        mRecyclerView.setAdapter(adapter);
    }

    public void setItemAnimator(RecyclerView.ItemAnimator itemAnimator) {
        mRecyclerView.setItemAnimator(itemAnimator);
    }

    public void addItemDecoration(RecyclerView.ItemDecoration decoration) {
        mRecyclerView.addItemDecoration(decoration);
    }

    public void setLogo(Drawable drawable) {
        mSearchInput.setLogo(drawable);