Example usage for android.widget EdgeEffect setColor

List of usage examples for android.widget EdgeEffect setColor

Introduction

In this page you can find the example usage for android.widget EdgeEffect setColor.

Prototype

public void setColor(@ColorInt int color) 

Source Link

Document

Set the color of this edge effect in argb.

Usage

From source file:Main.java

public static void setListViewEdgeEffectColor(AbsListView listView, int color) {
    if (Build.VERSION.SDK_INT >= 21) {
        try {// ww w. ja  v a  2  s .co  m
            Field field = AbsListView.class.getDeclaredField("mEdgeGlowTop");
            field.setAccessible(true);
            EdgeEffect mEdgeGlowTop = (EdgeEffect) field.get(listView);
            if (mEdgeGlowTop != null) {
                mEdgeGlowTop.setColor(color);
            }

            field = AbsListView.class.getDeclaredField("mEdgeGlowBottom");
            field.setAccessible(true);
            EdgeEffect mEdgeGlowBottom = (EdgeEffect) field.get(listView);
            if (mEdgeGlowBottom != null) {
                mEdgeGlowBottom.setColor(color);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

From source file:Main.java

public static void setListViewEdgeEffectColor(AbsListView listView, int color) {
    if (Build.VERSION.SDK_INT >= 21) {
        try {//from ww  w. j  av a2 s .c  om
            Field field = AbsListView.class.getDeclaredField("mEdgeGlowTop");
            field.setAccessible(true);
            EdgeEffect mEdgeGlowTop = (EdgeEffect) field.get(listView);
            if (mEdgeGlowTop != null) {
                mEdgeGlowTop.setColor(color);
            }

            field = AbsListView.class.getDeclaredField("mEdgeGlowBottom");
            field.setAccessible(true);
            EdgeEffect mEdgeGlowBottom = (EdgeEffect) field.get(listView);
            if (mEdgeGlowBottom != null) {
                mEdgeGlowBottom.setColor(color);
            }
        } catch (Exception e) {
            //                FileLog.e("tmessages", e);
        }
    }
}

From source file:kr.wdream.storyshop.AndroidUtilities.java

public static void setListViewEdgeEffectColor(AbsListView listView, int color) {
    if (Build.VERSION.SDK_INT >= 21) {
        try {// w w  w .j  a  v  a2  s .  c o  m
            Field field = AbsListView.class.getDeclaredField("mEdgeGlowTop");
            field.setAccessible(true);
            EdgeEffect mEdgeGlowTop = (EdgeEffect) field.get(listView);
            if (mEdgeGlowTop != null) {
                mEdgeGlowTop.setColor(color);
            }

            field = AbsListView.class.getDeclaredField("mEdgeGlowBottom");
            field.setAccessible(true);
            EdgeEffect mEdgeGlowBottom = (EdgeEffect) field.get(listView);
            if (mEdgeGlowBottom != null) {
                mEdgeGlowBottom.setColor(color);
            }
        } catch (Exception e) {
            FileLog.e("tmessages", e);
        }
    }
}

From source file:com.ferdi2005.secondgram.AndroidUtilities.java

public static void setScrollViewEdgeEffectColor(ScrollView scrollView, int color) {
    if (Build.VERSION.SDK_INT >= 21) {
        try {//  ww  w .j ava  2  s  .  c o  m
            Field field = ScrollView.class.getDeclaredField("mEdgeGlowTop");
            field.setAccessible(true);
            EdgeEffect mEdgeGlowTop = (EdgeEffect) field.get(scrollView);
            if (mEdgeGlowTop != null) {
                mEdgeGlowTop.setColor(color);
            }

            field = ScrollView.class.getDeclaredField("mEdgeGlowBottom");
            field.setAccessible(true);
            EdgeEffect mEdgeGlowBottom = (EdgeEffect) field.get(scrollView);
            if (mEdgeGlowBottom != null) {
                mEdgeGlowBottom.setColor(color);
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    }
}

From source file:com.ferdi2005.secondgram.AndroidUtilities.java

public static void setViewPagerEdgeEffectColor(ViewPager viewPager, int color) {
    if (Build.VERSION.SDK_INT >= 21) {
        try {//from   w w  w . ja va  2  s  .  c  om
            Field field = ViewPager.class.getDeclaredField("mLeftEdge");
            field.setAccessible(true);
            EdgeEffectCompat mLeftEdge = (EdgeEffectCompat) field.get(viewPager);
            if (mLeftEdge != null) {
                field = EdgeEffectCompat.class.getDeclaredField("mEdgeEffect");
                field.setAccessible(true);
                EdgeEffect mEdgeEffect = (EdgeEffect) field.get(mLeftEdge);
                if (mEdgeEffect != null) {
                    mEdgeEffect.setColor(color);
                }
            }

            field = ViewPager.class.getDeclaredField("mRightEdge");
            field.setAccessible(true);
            EdgeEffectCompat mRightEdge = (EdgeEffectCompat) field.get(viewPager);
            if (mRightEdge != null) {
                field = EdgeEffectCompat.class.getDeclaredField("mEdgeEffect");
                field.setAccessible(true);
                EdgeEffect mEdgeEffect = (EdgeEffect) field.get(mRightEdge);
                if (mEdgeEffect != null) {
                    mEdgeEffect.setColor(color);
                }
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    }
}

From source file:com.goftagram.telegram.messenger.support.widget.RecyclerView.java

void applyEdgeEffectColor(EdgeEffectCompat edgeEffectCompat) {
    if (Build.VERSION.SDK_INT >= 21 && glowColor != 0) {
        try {//from   ww  w  .j  a va2 s .  co m
            Field field = EdgeEffectCompat.class.getDeclaredField("mEdgeEffect");
            field.setAccessible(true);
            EdgeEffect edgeEffect = (EdgeEffect) field.get(edgeEffectCompat);
            if (edgeEffect != null) {
                edgeEffect.setColor(glowColor);
            }
        } catch (Exception e) {
            FileLog.e("tmessages", e);
        }
    }
}

From source file:com.b44t.messenger.support.widget.RecyclerView.java

void applyEdgeEffectColor(EdgeEffectCompat edgeEffectCompat) {
    if (Build.VERSION.SDK_INT >= 21 && glowColor != 0) {
        try {/*from w  w  w  .j  a va 2  s  . c o  m*/
            Field field = EdgeEffectCompat.class.getDeclaredField("mEdgeEffect");
            field.setAccessible(true);
            EdgeEffect edgeEffect = (EdgeEffect) field.get(edgeEffectCompat);
            if (edgeEffect != null) {
                edgeEffect.setColor(glowColor);
            }
        } catch (Exception e) {
            FileLog.e("messenger", e);
        }
    }
}

From source file:com.ferdi2005.secondgram.support.widget.RecyclerView.java

void applyEdgeEffectColor(EdgeEffectCompat edgeEffectCompat) {
    if (Build.VERSION.SDK_INT >= 21 && glowColor != 0) {
        try {//from   w  w  w.  j  a v a  2s .c o m
            Field field = EdgeEffectCompat.class.getDeclaredField("mEdgeEffect");
            field.setAccessible(true);
            EdgeEffect edgeEffect = (EdgeEffect) field.get(edgeEffectCompat);
            if (edgeEffect != null) {
                edgeEffect.setColor(glowColor);
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    }
}