├── .gitignore ├── EdgeEffectOverride ├── build.gradle ├── gradle.properties └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── uk │ │ └── co │ │ └── androidalliance │ │ └── edgeeffectoverride │ │ ├── ContextWrapperEdgeEffect.java │ │ ├── ExpandableListView.java │ │ ├── GridView.java │ │ ├── HorizontalScrollView.java │ │ ├── ListView.java │ │ ├── MulticastOnScrollListener.java │ │ ├── ScrollView.java │ │ ├── Spinner.java │ │ ├── ViewPager.java │ │ └── WebView.java │ └── res │ ├── drawable-hdpi-v19 │ ├── overscroll_edge.png │ └── overscroll_glow.png │ ├── drawable-hdpi │ ├── overscroll_edge.png │ └── overscroll_glow.png │ ├── drawable-mdpi-v19 │ ├── overscroll_edge.png │ └── overscroll_glow.png │ ├── drawable-mdpi │ ├── overscroll_edge.png │ └── overscroll_glow.png │ ├── drawable-xhdpi-v19 │ ├── overscroll_edge.png │ └── overscroll_glow.png │ ├── drawable-xhdpi │ ├── overscroll_edge.png │ └── overscroll_glow.png │ ├── drawable-xxhdpi-v19 │ ├── overscroll_edge.png │ └── overscroll_glow.png │ ├── values-v19 │ └── defaults.xml │ └── values │ ├── attrs.xml │ └── defaults.xml ├── EdgeEffectOverrideSample ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ └── uk │ │ └── co │ │ └── androidalliance │ │ └── edgeeffectoverride │ │ └── sample │ │ ├── ExpandableListViewActivity.java │ │ ├── GridViewActivity.java │ │ ├── ListViewActivity.java │ │ ├── MainActivity.java │ │ ├── ScrollViewActivity.java │ │ ├── ViewPagerActivity.java │ │ └── WebViewActivity.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ ├── drawable-xxxhdpi │ └── ic_launcher.png │ ├── layout │ ├── activity_main.xml │ ├── expandablelistview_layout.xml │ ├── gridview_layout.xml │ ├── listview_layout.xml │ ├── scrollview_layout.xml │ ├── viewpager_layout.xml │ └── webview_layout.xml │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── maven_push.gradle └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse 2 | .project 3 | .classpath 4 | .settings 5 | .checkstyle 6 | 7 | # IntelliJ IDEA 8 | .idea 9 | *.iml 10 | *.ipr 11 | *.iws 12 | classes 13 | gen-external-apklibs 14 | 15 | # Gradle 16 | .gradle 17 | build 18 | 19 | # Maven 20 | target 21 | release.properties 22 | pom.xml.* 23 | 24 | # Ant 25 | bin 26 | gen 27 | build.xml 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | # Other 34 | .DS_Store 35 | tmp -------------------------------------------------------------------------------- /EdgeEffectOverride/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | repositories { 4 | mavenCentral() 5 | } 6 | 7 | android { 8 | compileSdkVersion 21 9 | buildToolsVersion '21.0.2' 10 | 11 | defaultConfig { 12 | minSdkVersion 10 13 | targetSdkVersion 16 14 | 15 | versionName project.VERSION_NAME 16 | versionCode Integer.parseInt(project.VERSION_CODE) 17 | } 18 | } 19 | 20 | dependencies { 21 | compile 'com.android.support:support-v4:18.0.+' 22 | } 23 | 24 | // directions for mvn-push: https://github.com/chrisbanes/gradle-mvn-push 25 | //apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' -------------------------------------------------------------------------------- /EdgeEffectOverride/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=Edge Effect Override - Library 2 | POM_ARTIFACT_ID=edgeeffectoverride 3 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/java/uk/co/androidalliance/edgeeffectoverride/ContextWrapperEdgeEffect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Android Alliance, LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package uk.co.androidalliance.edgeeffectoverride; 17 | 18 | import android.content.Context; 19 | import android.content.ContextWrapper; 20 | import android.content.res.AssetManager; 21 | import android.content.res.Configuration; 22 | import android.content.res.Resources; 23 | import android.graphics.PorterDuff; 24 | import android.graphics.drawable.Drawable; 25 | import android.util.DisplayMetrics; 26 | import android.util.Log; 27 | 28 | public class ContextWrapperEdgeEffect extends ContextWrapper { 29 | 30 | private ResourcesEdgeEffect mResourcesEdgeEffect; 31 | private int mColor; 32 | private Drawable mEdgeDrawable; 33 | private Drawable mGlowDrawable; 34 | 35 | public ContextWrapperEdgeEffect(Context context) { 36 | this(context, 0); 37 | } 38 | 39 | public ContextWrapperEdgeEffect(Context context, int color) { 40 | super(context); 41 | mColor = color; 42 | Resources resources = context.getResources(); 43 | mResourcesEdgeEffect = new ResourcesEdgeEffect(resources.getAssets(), resources.getDisplayMetrics(), resources.getConfiguration()); 44 | } 45 | 46 | public void setEdgeEffectColor(int color) { 47 | mColor = color; 48 | if (mEdgeDrawable != null) mEdgeDrawable.setColorFilter(color, PorterDuff.Mode.MULTIPLY); 49 | if (mGlowDrawable != null) mGlowDrawable.setColorFilter(color, PorterDuff.Mode.MULTIPLY); 50 | } 51 | 52 | @Override 53 | public Resources getResources() { 54 | return mResourcesEdgeEffect; 55 | } 56 | 57 | private class ResourcesEdgeEffect extends Resources { 58 | private int overscroll_edge = getPlatformDrawableId("overscroll_edge"); 59 | private int overscroll_glow = getPlatformDrawableId("overscroll_glow"); 60 | 61 | public ResourcesEdgeEffect(AssetManager assets, DisplayMetrics metrics, Configuration config) { 62 | //super(metrics, localConfiguration); 63 | super(assets, metrics, config); 64 | } 65 | 66 | private int getPlatformDrawableId(String name) { 67 | try { 68 | int i = ((Integer) Class.forName("com.android.internal.R$drawable").getField(name).get(null)).intValue(); 69 | return i; 70 | } catch (ClassNotFoundException e) { 71 | Log.e("[ContextWrapperEdgeEffect].getPlatformDrawableId()", "Cannot find internal resource class"); 72 | return 0; 73 | } catch (NoSuchFieldException e1) { 74 | Log.e("[ContextWrapperEdgeEffect].getPlatformDrawableId()", "Internal resource id does not exist: " + name); 75 | return 0; 76 | } catch (IllegalArgumentException e2) { 77 | Log.e("[ContextWrapperEdgeEffect].getPlatformDrawableId()", "Cannot access internal resource id: " + name); 78 | return 0; 79 | } catch (IllegalAccessException e3) { 80 | Log.e("[ContextWrapperEdgeEffect].getPlatformDrawableId()", "Cannot access internal resource id: " + name); 81 | } 82 | return 0; 83 | } 84 | 85 | @Override 86 | public Drawable getDrawable(int resId) throws Resources.NotFoundException { 87 | Drawable ret = null; 88 | if (resId == this.overscroll_edge) { 89 | mEdgeDrawable = ContextWrapperEdgeEffect.this.getBaseContext().getResources().getDrawable(R.drawable.overscroll_edge); 90 | ret = mEdgeDrawable; 91 | } else if (resId == this.overscroll_glow) { 92 | mGlowDrawable = ContextWrapperEdgeEffect.this.getBaseContext().getResources().getDrawable(R.drawable.overscroll_glow); 93 | ret = mGlowDrawable; 94 | } else return super.getDrawable(resId); 95 | 96 | if (ret != null) { 97 | ret.setColorFilter(mColor, PorterDuff.Mode.MULTIPLY); 98 | } 99 | 100 | return ret; 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/java/uk/co/androidalliance/edgeeffectoverride/ExpandableListView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Android Alliance, LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package uk.co.androidalliance.edgeeffectoverride; 17 | 18 | import android.content.Context; 19 | import android.content.res.TypedArray; 20 | import android.util.AttributeSet; 21 | 22 | public class ExpandableListView extends android.widget.ExpandableListView { 23 | 24 | public ExpandableListView(Context context) { 25 | this(context, null); 26 | } 27 | 28 | public ExpandableListView(Context context, AttributeSet attrs) { 29 | this(context, attrs, android.R.attr.expandableListViewStyle); 30 | } 31 | 32 | public ExpandableListView(Context context, AttributeSet attrs, int defStyle) { 33 | super(new ContextWrapperEdgeEffect(context), attrs, defStyle); 34 | init(context, attrs, defStyle); 35 | } 36 | 37 | private void init(Context context, AttributeSet attrs, int defStyle){ 38 | int color = context.getResources().getColor(R.color.default_edgeeffect_color); 39 | 40 | if (attrs != null) { 41 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EdgeEffectView, defStyle, 0); 42 | color = a.getColor(R.styleable.EdgeEffectView_edgeeffect_color, color); 43 | a.recycle(); 44 | } 45 | setEdgeEffectColor(color); 46 | } 47 | 48 | public void setEdgeEffectColor(int edgeEffectColor){ 49 | ((ContextWrapperEdgeEffect) getContext()).setEdgeEffectColor(edgeEffectColor); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/java/uk/co/androidalliance/edgeeffectoverride/GridView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Android Alliance, LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package uk.co.androidalliance.edgeeffectoverride; 17 | 18 | import android.content.Context; 19 | import android.content.res.TypedArray; 20 | import android.util.AttributeSet; 21 | 22 | public class GridView extends android.widget.GridView { 23 | 24 | private OnScrollListener mLegacyOnScrollListener; 25 | private final MulticastOnScrollListener mMulticastOnScrollListener = new MulticastOnScrollListener(); 26 | 27 | public GridView(Context context) { 28 | this(context, null); 29 | } 30 | 31 | public GridView(Context context, AttributeSet attrs) { 32 | this(context, attrs, android.R.attr.gridViewStyle); 33 | } 34 | 35 | public GridView(Context context, AttributeSet attrs, int defStyle) { 36 | super(new ContextWrapperEdgeEffect(context), attrs, defStyle); 37 | init(context, attrs, defStyle); 38 | } 39 | 40 | private void init(Context context, AttributeSet attrs, int defStyle) { 41 | int color = context.getResources().getColor(R.color.default_edgeeffect_color); 42 | 43 | if (attrs != null) { 44 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EdgeEffectView, defStyle, 0); 45 | color = a.getColor(R.styleable.EdgeEffectView_edgeeffect_color, color); 46 | a.recycle(); 47 | } 48 | setEdgeEffectColor(color); 49 | } 50 | 51 | public void setOnScrollListener(OnScrollListener listener) { 52 | if (listener != null) { 53 | checkPrecondition(mLegacyOnScrollListener == null); 54 | mLegacyOnScrollListener = listener; 55 | addOnScrollListener(mLegacyOnScrollListener); 56 | } else if (mLegacyOnScrollListener != null) { 57 | removeOnScrollListener(mLegacyOnScrollListener); 58 | mLegacyOnScrollListener = null; 59 | } 60 | } 61 | 62 | public void setEdgeEffectColor(int edgeEffectColor) { 63 | ((ContextWrapperEdgeEffect) getContext()).setEdgeEffectColor(edgeEffectColor); 64 | } 65 | 66 | public void addOnScrollListener(OnScrollListener listener) { 67 | mMulticastOnScrollListener.add(listener); 68 | } 69 | 70 | public void clearOnScrollListeners() { 71 | mMulticastOnScrollListener.clear(); 72 | } 73 | 74 | public void removeOnScrollListener(OnScrollListener listener) { 75 | mMulticastOnScrollListener.remove(listener); 76 | } 77 | 78 | void checkPrecondition(boolean state) { 79 | if (!state) { 80 | throw new IllegalStateException(); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/java/uk/co/androidalliance/edgeeffectoverride/HorizontalScrollView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Android Alliance, LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package uk.co.androidalliance.edgeeffectoverride; 17 | 18 | import android.annotation.TargetApi; 19 | import android.content.Context; 20 | import android.content.res.TypedArray; 21 | import android.os.Build; 22 | import android.util.AttributeSet; 23 | 24 | public class HorizontalScrollView extends android.widget.HorizontalScrollView { 25 | 26 | public static final int SCROLL_RIGHT = 1; 27 | public static final int SCROLL_LEFT = 2; 28 | private OnScrollChangedListener mOnScrollChangedListener; 29 | 30 | public HorizontalScrollView(Context context) { 31 | this(context, null); 32 | } 33 | 34 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 35 | public HorizontalScrollView(Context context, AttributeSet attrs) { 36 | super(new ContextWrapperEdgeEffect(context), attrs); 37 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { 38 | init(context, attrs, android.R.attr.horizontalScrollViewStyle); 39 | } else { 40 | init(context, attrs, 0); 41 | } 42 | } 43 | 44 | public HorizontalScrollView(Context context, AttributeSet attrs, int defStyle) { 45 | super(new ContextWrapperEdgeEffect(context), attrs, defStyle); 46 | init(context, attrs, defStyle); 47 | } 48 | 49 | private void init(Context context, AttributeSet attrs, int defStyle) { 50 | int color = context.getResources().getColor(R.color.default_edgeeffect_color); 51 | 52 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EdgeEffectView, defStyle, 0); 53 | 54 | setEdgeEffectColor(color = a.getColor(R.styleable.EdgeEffectView_edgeeffect_color, color)); 55 | 56 | a.recycle(); 57 | } 58 | 59 | public void setEdgeEffectColor(int edgeEffectColor) { 60 | ((ContextWrapperEdgeEffect) getContext()).setEdgeEffectColor(edgeEffectColor); 61 | } 62 | 63 | @Override 64 | protected void onScrollChanged(int scrollX, int scrollY, int oldScrollX, int oldScrollY) { 65 | super.onScrollChanged(scrollX, scrollY, oldScrollX, oldScrollY); 66 | if (mOnScrollChangedListener != null) { 67 | int scrollDirection; 68 | if (scrollX > oldScrollX) { 69 | scrollDirection = SCROLL_RIGHT; 70 | } else { 71 | scrollDirection = SCROLL_LEFT; 72 | } 73 | mOnScrollChangedListener.onScrollChanged(this, scrollDirection, scrollX, scrollY, oldScrollX, oldScrollY); 74 | } 75 | } 76 | 77 | public void setOnScrollChangedListener(OnScrollChangedListener listener) { 78 | mOnScrollChangedListener = listener; 79 | } 80 | 81 | public interface OnScrollChangedListener { 82 | void onScrollChanged(HorizontalScrollView scrollView, int scrollDirection, int scrollX, int scrollY, int oldScrollX, int oldScrollY); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/java/uk/co/androidalliance/edgeeffectoverride/ListView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Android Alliance, LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package uk.co.androidalliance.edgeeffectoverride; 17 | 18 | import android.content.Context; 19 | import android.content.res.TypedArray; 20 | import android.util.AttributeSet; 21 | 22 | public class ListView extends android.widget.ListView { 23 | 24 | private OnScrollListener mLegacyOnScrollListener; 25 | private final MulticastOnScrollListener mMulticastOnScrollListener = new MulticastOnScrollListener(); 26 | 27 | public ListView(Context context) { 28 | this(context, null); 29 | } 30 | 31 | public ListView(Context context, AttributeSet attrs) { 32 | this(context, attrs, android.R.attr.listViewStyle); 33 | } 34 | 35 | public ListView(Context context, AttributeSet attrs, int defStyle) { 36 | super(new ContextWrapperEdgeEffect(context), attrs, defStyle); 37 | init(context, attrs, defStyle); 38 | } 39 | 40 | private void init(Context context, AttributeSet attrs, int defStyle) { 41 | int color = context.getResources().getColor(R.color.default_edgeeffect_color); 42 | 43 | if (attrs != null) { 44 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EdgeEffectView, defStyle, 0); 45 | color = a.getColor(R.styleable.EdgeEffectView_edgeeffect_color, color); 46 | a.recycle(); 47 | } 48 | setEdgeEffectColor(color); 49 | } 50 | 51 | public void setOnScrollListener(OnScrollListener listener) { 52 | if (listener != null) { 53 | checkPrecondition(mLegacyOnScrollListener == null); 54 | mLegacyOnScrollListener = listener; 55 | addOnScrollListener(mLegacyOnScrollListener); 56 | } else if (mLegacyOnScrollListener != null) { 57 | removeOnScrollListener(mLegacyOnScrollListener); 58 | mLegacyOnScrollListener = null; 59 | } 60 | } 61 | 62 | public void setEdgeEffectColor(int edgeEffectColor) { 63 | ((ContextWrapperEdgeEffect) getContext()).setEdgeEffectColor(edgeEffectColor); 64 | } 65 | 66 | public void addOnScrollListener(OnScrollListener listener) { 67 | mMulticastOnScrollListener.add(listener); 68 | } 69 | 70 | public void clearOnScrollListeners() { 71 | mMulticastOnScrollListener.clear(); 72 | } 73 | 74 | public void removeOnScrollListener(OnScrollListener listener) { 75 | mMulticastOnScrollListener.remove(listener); 76 | } 77 | 78 | void checkPrecondition(boolean state) { 79 | if (!state) { 80 | throw new IllegalStateException(); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/java/uk/co/androidalliance/edgeeffectoverride/MulticastOnScrollListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Android Alliance, LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package uk.co.androidalliance.edgeeffectoverride; 17 | 18 | import android.widget.AbsListView; 19 | 20 | import java.util.HashSet; 21 | import java.util.Iterator; 22 | import java.util.Set; 23 | 24 | public class MulticastOnScrollListener implements AbsListView.OnScrollListener { 25 | 26 | private Set mListeners = new HashSet(); 27 | 28 | public MulticastOnScrollListener add(AbsListView.OnScrollListener scrollListener) { 29 | mListeners.add(scrollListener); 30 | return this; 31 | } 32 | 33 | public MulticastOnScrollListener clear() { 34 | mListeners.clear(); 35 | return this; 36 | } 37 | 38 | @Override 39 | public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { 40 | Iterator iterator = this.mListeners.iterator(); 41 | while (iterator.hasNext()) { 42 | ((AbsListView.OnScrollListener) iterator.next()).onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); 43 | } 44 | } 45 | 46 | @Override 47 | public void onScrollStateChanged(AbsListView view, int scrollState) { 48 | Iterator iterator = mListeners.iterator(); 49 | while (iterator.hasNext()) { 50 | ((AbsListView.OnScrollListener) iterator.next()).onScrollStateChanged(view, scrollState); 51 | } 52 | } 53 | 54 | public MulticastOnScrollListener remove(AbsListView.OnScrollListener scrollListener) { 55 | mListeners.remove(scrollListener); 56 | return this; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/java/uk/co/androidalliance/edgeeffectoverride/ScrollView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Android Alliance, LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package uk.co.androidalliance.edgeeffectoverride; 17 | 18 | import android.content.Context; 19 | import android.content.res.TypedArray; 20 | import android.util.AttributeSet; 21 | 22 | public class ScrollView extends android.widget.ScrollView { 23 | 24 | public static final int SCROLL_UP = 1; 25 | public static final int SCROLL_DOWN = 2; 26 | private OnScrollChangedListener mOnScrollChangedListener; 27 | 28 | 29 | public ScrollView(Context context) { 30 | this(context, null); 31 | } 32 | 33 | public ScrollView(Context context, AttributeSet attrs) { 34 | this(context, attrs, android.R.attr.scrollViewStyle); 35 | } 36 | 37 | public ScrollView(Context context, AttributeSet attrs, int defStyle) { 38 | super(new ContextWrapperEdgeEffect(context), attrs, defStyle); 39 | init(context, attrs, defStyle); 40 | } 41 | 42 | private void init(Context context, AttributeSet attrs, int defStyle) { 43 | int color = context.getResources().getColor(R.color.default_edgeeffect_color); 44 | 45 | if (attrs != null) { 46 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EdgeEffectView, defStyle, 0); 47 | color = a.getColor(R.styleable.EdgeEffectView_edgeeffect_color, color); 48 | a.recycle(); 49 | } 50 | setEdgeEffectColor(color); 51 | } 52 | 53 | public void setEdgeEffectColor(int edgeEffectColor) { 54 | ((ContextWrapperEdgeEffect) getContext()).setEdgeEffectColor(edgeEffectColor); 55 | } 56 | 57 | @Override 58 | protected void onScrollChanged(int scrollX, int scrollY, int oldScrollX, int oldScrollY) { 59 | super.onScrollChanged(scrollX, scrollY, oldScrollX, oldScrollY); 60 | if (mOnScrollChangedListener != null) { 61 | int scrollDirection; 62 | if (scrollY > oldScrollY) { 63 | scrollDirection = SCROLL_UP; 64 | } else { 65 | scrollDirection = SCROLL_DOWN; 66 | } 67 | mOnScrollChangedListener.onScrollChanged(this, scrollDirection, scrollX, scrollY, oldScrollX, oldScrollY); 68 | } 69 | } 70 | 71 | public void setOnScrollChangedListener(OnScrollChangedListener listener) { 72 | mOnScrollChangedListener = listener; 73 | } 74 | 75 | public interface OnScrollChangedListener { 76 | void onScrollChanged(ScrollView scrollView, int scrollDirection, int scrollX, int scrollY, int oldScrollX, int oldScrollY); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/java/uk/co/androidalliance/edgeeffectoverride/Spinner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Android Alliance, LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package uk.co.androidalliance.edgeeffectoverride; 17 | 18 | import android.content.Context; 19 | import android.content.res.TypedArray; 20 | import android.util.AttributeSet; 21 | 22 | public class Spinner extends android.widget.Spinner { 23 | 24 | public Spinner(Context context) { 25 | this(context, null); 26 | } 27 | 28 | public Spinner(Context context, AttributeSet attrs) { 29 | this(context, attrs, android.R.attr.dropDownSpinnerStyle); 30 | } 31 | 32 | public Spinner(Context context, AttributeSet attrs, int defStyle) { 33 | super(new ContextWrapperEdgeEffect(context), attrs, defStyle); 34 | init(context, attrs, defStyle); 35 | } 36 | 37 | private void init(Context context, AttributeSet attrs, int defStyle) { 38 | int color = context.getResources().getColor(R.color.default_edgeeffect_color); 39 | 40 | if (attrs != null) { 41 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EdgeEffectView, defStyle, 0); 42 | color = a.getColor(R.styleable.EdgeEffectView_edgeeffect_color, color); 43 | a.recycle(); 44 | } 45 | setEdgeEffectColor(color); 46 | } 47 | 48 | public void setEdgeEffectColor(int edgeEffectColor) { 49 | ((ContextWrapperEdgeEffect) getContext()).setEdgeEffectColor(edgeEffectColor); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/java/uk/co/androidalliance/edgeeffectoverride/ViewPager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Android Alliance, LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package uk.co.androidalliance.edgeeffectoverride; 17 | 18 | import android.content.Context; 19 | import android.content.res.TypedArray; 20 | import android.util.AttributeSet; 21 | 22 | public class ViewPager extends android.support.v4.view.ViewPager { 23 | 24 | public ViewPager(Context context) { 25 | this(context, null); 26 | } 27 | 28 | public ViewPager(Context context, AttributeSet attrs) { 29 | super(new ContextWrapperEdgeEffect(context), attrs); 30 | init(context, attrs, 0); 31 | } 32 | 33 | private void init(Context context, AttributeSet attrs, int defStyle) { 34 | int color = context.getResources().getColor(R.color.default_edgeeffect_color); 35 | 36 | if (attrs != null) { 37 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EdgeEffectView, defStyle, 0); 38 | color = a.getColor(R.styleable.EdgeEffectView_edgeeffect_color, color); 39 | a.recycle(); 40 | } 41 | setEdgeEffectColor(color); 42 | } 43 | 44 | public void setEdgeEffectColor(int edgeEffectColor) { 45 | ((ContextWrapperEdgeEffect) getContext()).setEdgeEffectColor(edgeEffectColor); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/java/uk/co/androidalliance/edgeeffectoverride/WebView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Android Alliance, LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package uk.co.androidalliance.edgeeffectoverride; 17 | 18 | import android.annotation.TargetApi; 19 | import android.content.Context; 20 | import android.content.res.TypedArray; 21 | import android.util.AttributeSet; 22 | 23 | public class WebView extends android.webkit.WebView { 24 | 25 | public WebView(Context context) { 26 | this(context, null); 27 | } 28 | 29 | public WebView(Context context, AttributeSet attrs) { 30 | this(context, attrs, android.R.attr.webViewStyle); 31 | } 32 | 33 | public WebView(Context context, AttributeSet attrs, int defStyle) { 34 | super(new ContextWrapperEdgeEffect(context), attrs, defStyle); 35 | init(context, attrs, defStyle); 36 | } 37 | 38 | @Deprecated 39 | @TargetApi(11) 40 | public WebView(Context context, AttributeSet attrs, int defStyle, boolean privateBrowsing) { 41 | super(new ContextWrapperEdgeEffect(context), attrs, defStyle, privateBrowsing); 42 | init(context, attrs, defStyle); 43 | } 44 | 45 | private void init(Context context, AttributeSet attrs, int defStyle) { 46 | int color = context.getResources().getColor(R.color.default_edgeeffect_color); 47 | 48 | if (attrs != null) { 49 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EdgeEffectView, defStyle, 0); 50 | color = a.getColor(R.styleable.EdgeEffectView_edgeeffect_color, color); 51 | a.recycle(); 52 | } 53 | setEdgeEffectColor(color); 54 | } 55 | 56 | public void setEdgeEffectColor(int edgeEffectColor) { 57 | ((ContextWrapperEdgeEffect) getContext()).setEdgeEffectColor(edgeEffectColor); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-hdpi-v19/overscroll_edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-hdpi-v19/overscroll_edge.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-hdpi-v19/overscroll_glow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-hdpi-v19/overscroll_glow.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-hdpi/overscroll_edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-hdpi/overscroll_edge.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-hdpi/overscroll_glow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-hdpi/overscroll_glow.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-mdpi-v19/overscroll_edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-mdpi-v19/overscroll_edge.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-mdpi-v19/overscroll_glow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-mdpi-v19/overscroll_glow.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-mdpi/overscroll_edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-mdpi/overscroll_edge.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-mdpi/overscroll_glow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-mdpi/overscroll_glow.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-xhdpi-v19/overscroll_edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-xhdpi-v19/overscroll_edge.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-xhdpi-v19/overscroll_glow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-xhdpi-v19/overscroll_glow.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-xhdpi/overscroll_edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-xhdpi/overscroll_edge.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-xhdpi/overscroll_glow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-xhdpi/overscroll_glow.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-xxhdpi-v19/overscroll_edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-xxhdpi-v19/overscroll_edge.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/drawable-xxhdpi-v19/overscroll_glow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverride/src/main/res/drawable-xxhdpi-v19/overscroll_glow.png -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/values-v19/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FF717171 4 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /EdgeEffectOverride/src/main/res/values/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FF33B5E5 4 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | ____ _ 3 | / ___| __ _ _ __ ___ _ __ | | ___ 4 | \___ \ / _` | '_ ` _ \| '_ \| |/ _ \ 5 | ___) | (_| | | | | | | |_) | | __/ 6 | |____/ \__,_|_| |_| |_| .__/|_|\___| 7 | |_| 8 | */ 9 | apply plugin: 'com.android.application' 10 | 11 | repositories { 12 | mavenCentral() 13 | } 14 | 15 | android { 16 | compileSdkVersion 21 17 | buildToolsVersion '21.0.2' 18 | 19 | defaultConfig { 20 | minSdkVersion 11 21 | targetSdkVersion 16 22 | } 23 | } 24 | 25 | dependencies { 26 | compile 'com.android.support:support-v4:18.0.+' 27 | compile project(':EdgeEffectOverride') 28 | } 29 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 33 | 34 | 37 | 38 | 41 | 42 | 45 | 46 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverrideSample/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/java/uk/co/androidalliance/edgeeffectoverride/sample/ExpandableListViewActivity.java: -------------------------------------------------------------------------------- 1 | package uk.co.androidalliance.edgeeffectoverride.sample; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.widget.SimpleExpandableListAdapter; 6 | 7 | import java.util.ArrayList; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | import uk.co.androidalliance.edgeeffectoverride.ExpandableListView; 13 | 14 | public class ExpandableListViewActivity extends Activity { 15 | 16 | private static final String NAME = "NAME"; 17 | private static final String IS_EVEN = "IS_EVEN"; 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.expandablelistview_layout); 23 | 24 | //this comes from android samples 25 | List> groupData = new ArrayList>(); 26 | List>> childData = new ArrayList>>(); 27 | for (int i = 0; i < 20; i++) { 28 | Map curGroupMap = new HashMap(); 29 | groupData.add(curGroupMap); 30 | curGroupMap.put(NAME, "Group " + i); 31 | curGroupMap.put(IS_EVEN, (i % 2 == 0) ? "This group is even" : "This group is odd"); 32 | 33 | List> children = new ArrayList>(); 34 | for (int j = 0; j < 15; j++) { 35 | Map curChildMap = new HashMap(); 36 | children.add(curChildMap); 37 | curChildMap.put(NAME, "Child " + j); 38 | curChildMap.put(IS_EVEN, (j % 2 == 0) ? "This child is even" : "This child is odd"); 39 | } 40 | childData.add(children); 41 | } 42 | 43 | // Set up our adapter 44 | ((ExpandableListView) findViewById(R.id.expandablelistview)).setAdapter(new SimpleExpandableListAdapter( 45 | this, 46 | groupData, 47 | android.R.layout.simple_expandable_list_item_1, 48 | new String[]{NAME, IS_EVEN}, 49 | new int[]{android.R.id.text1, android.R.id.text2}, 50 | childData, 51 | android.R.layout.simple_expandable_list_item_2, 52 | new String[]{NAME, IS_EVEN}, 53 | new int[]{android.R.id.text1, android.R.id.text2} 54 | )); 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/java/uk/co/androidalliance/edgeeffectoverride/sample/GridViewActivity.java: -------------------------------------------------------------------------------- 1 | package uk.co.androidalliance.edgeeffectoverride.sample; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.widget.ArrayAdapter; 6 | 7 | import uk.co.androidalliance.edgeeffectoverride.GridView; 8 | 9 | public class GridViewActivity extends Activity { 10 | 11 | @Override 12 | protected void onCreate(Bundle savedInstanceState) { 13 | super.onCreate(savedInstanceState); 14 | setContentView(R.layout.gridview_layout); 15 | 16 | ((GridView) findViewById(R.id.gridview)) 17 | .setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.stringarray))); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/java/uk/co/androidalliance/edgeeffectoverride/sample/ListViewActivity.java: -------------------------------------------------------------------------------- 1 | package uk.co.androidalliance.edgeeffectoverride.sample; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.widget.ArrayAdapter; 6 | 7 | import uk.co.androidalliance.edgeeffectoverride.ListView; 8 | 9 | public class ListViewActivity extends Activity { 10 | 11 | @Override 12 | protected void onCreate(Bundle savedInstanceState) { 13 | super.onCreate(savedInstanceState); 14 | setContentView(R.layout.listview_layout); 15 | 16 | ((ListView) findViewById(R.id.listview)) 17 | .setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.stringarray))); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/java/uk/co/androidalliance/edgeeffectoverride/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package uk.co.androidalliance.edgeeffectoverride.sample; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | import android.widget.AdapterView; 8 | import android.widget.ArrayAdapter; 9 | 10 | import uk.co.androidalliance.edgeeffectoverride.ListView; 11 | 12 | public class MainActivity extends Activity implements AdapterView.OnItemClickListener { 13 | 14 | private static final String[] STRINGS = { 15 | "ListView", 16 | "ExpandableListView", 17 | "GridView", 18 | "ScrollView", 19 | "ViewPager", 20 | "WebView", 21 | }; 22 | private static final Class[] ACTIVITIES = { 23 | ListViewActivity.class, 24 | ExpandableListViewActivity.class, 25 | GridViewActivity.class, 26 | ScrollViewActivity.class, 27 | ViewPagerActivity.class, 28 | WebViewActivity.class 29 | }; 30 | private ListView mListView; 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | setContentView(R.layout.activity_main); 36 | 37 | mListView = (ListView) findViewById(R.id.listview); 38 | mListView.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, STRINGS)); 39 | mListView.setOnItemClickListener(this); 40 | } 41 | 42 | @Override 43 | public void onItemClick(AdapterView parent, View view, int position, long id) { 44 | Intent intent = new Intent(this, ACTIVITIES[position]); 45 | startActivity(intent); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/java/uk/co/androidalliance/edgeeffectoverride/sample/ScrollViewActivity.java: -------------------------------------------------------------------------------- 1 | package uk.co.androidalliance.edgeeffectoverride.sample; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | public class ScrollViewActivity extends Activity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.scrollview_layout); 12 | 13 | 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/java/uk/co/androidalliance/edgeeffectoverride/sample/ViewPagerActivity.java: -------------------------------------------------------------------------------- 1 | package uk.co.androidalliance.edgeeffectoverride.sample; 2 | 3 | import android.os.Bundle; 4 | import android.app.Activity; 5 | import android.support.v4.view.PagerAdapter; 6 | import android.support.v4.view.ViewPager; 7 | import android.view.Gravity; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.TextView; 11 | 12 | public class ViewPagerActivity extends Activity { 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.viewpager_layout); 18 | 19 | ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); 20 | 21 | viewPager.setAdapter(new PagerAdapter() { 22 | 23 | @Override 24 | public Object instantiateItem(ViewGroup container, int position) { 25 | TextView textView = new TextView(ViewPagerActivity.this); 26 | textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 27 | textView.setGravity(Gravity.CENTER); 28 | textView.setText("Item " + position); 29 | container.addView(textView); 30 | return textView; 31 | } 32 | 33 | @Override 34 | public CharSequence getPageTitle(int position) { 35 | return "Item " + position; 36 | } 37 | 38 | @Override 39 | public int getCount() { 40 | return 2; 41 | } 42 | 43 | @Override 44 | public boolean isViewFromObject(View view, Object o) { 45 | return o instanceof View && view == o; 46 | } 47 | }); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/java/uk/co/androidalliance/edgeeffectoverride/sample/WebViewActivity.java: -------------------------------------------------------------------------------- 1 | package uk.co.androidalliance.edgeeffectoverride.sample; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Color; 5 | import android.os.Bundle; 6 | import android.webkit.WebChromeClient; 7 | import android.webkit.WebSettings; 8 | import android.webkit.WebView; 9 | import android.webkit.WebViewClient; 10 | 11 | public class WebViewActivity extends Activity { 12 | 13 | private WebView mWebView; 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.webview_layout); 19 | 20 | mWebView = ((WebView) findViewById(R.id.webview)); 21 | initWebView(); 22 | } 23 | 24 | private void initWebView() { 25 | mWebView.setWebViewClient(new WebViewClient()); 26 | mWebView.setWebChromeClient(new WebChromeClient()); 27 | WebSettings settings = mWebView.getSettings(); 28 | settings.setSavePassword(true); 29 | settings.setSaveFormData(true); 30 | settings.setJavaScriptEnabled(true); 31 | settings.setSupportZoom(false); 32 | settings.setCacheMode(WebSettings.LOAD_NO_CACHE); 33 | settings.setDomStorageEnabled(true); 34 | settings.setSupportMultipleWindows(false); 35 | 36 | 37 | mWebView.loadUrl("http://developer.android.com"); 38 | } 39 | 40 | @Override 41 | public void onBackPressed() { 42 | if (mWebView.canGoBack()) 43 | mWebView.goBack(); 44 | else 45 | super.onBackPressed(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverrideSample/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverrideSample/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverrideSample/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverrideSample/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/EdgeEffectOverrideSample/src/main/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/layout/expandablelistview_layout.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/layout/gridview_layout.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/layout/listview_layout.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/layout/scrollview_layout.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/layout/viewpager_layout.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/layout/webview_layout.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFFFF 4 | #AA66CC 5 | #ffff4444 6 | #ff99cc00 7 | #FFFFBB33 8 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Edge Effect Override Sample 5 | ListView 6 | GridView 7 | Settings 8 | 9 | 10 | Item 1 11 | Item 2 12 | Item 3 13 | Item 4 14 | Item 5 15 | Item 6 16 | Item 7 17 | Item 8 18 | Item 9 19 | Item 10 20 | Item 11 21 | Item 12 22 | Item 13 23 | Item 14 24 | Item 15 25 | Item 16 26 | Item 17 27 | Item 18 28 | Item 19 29 | Item 20 30 | Item 21 31 | Item 22 32 | Item 23 33 | Item 24 34 | Item 25 35 | Item 26 36 | Item 27 37 | Item 28 38 | Item 29 39 | Item 30 40 | Item 31 41 | Item 32 42 | Item 33 43 | Item 34 44 | Item 35 45 | Item 36 46 | Item 37 47 | Item 38 48 | Item 39 49 | Item 40 50 | Item 41 51 | Item 42 52 | Item 43 53 | Item 44 54 | Item 45 55 | Item 46 56 | Item 47 57 | Item 48 58 | Item 49 59 | Item 50 60 | Item 51 61 | Item 52 62 | Item 53 63 | Item 54 64 | Item 55 65 | Item 56 66 | Item 57 67 | Item 58 68 | Item 59 69 | Item 60 70 | 71 | 72 | ExpandableListView 73 | ScrollView 74 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis aliquam 75 | nec eros ut feugiat. In hac habitasse platea dictumst. Vivamus hendrerit, augue sed 76 | imperdiet sagittis, arcu quam tempus dolor, in consequat turpis tortor eget sapien. Cras 77 | condimentum nibh nisi, eget blandit nulla iaculis laoreet. Morbi condimentum sit amet lectus 78 | a commodo. Etiam accumsan adipiscing est, vel pellentesque massa ultricies at. Sed eget 79 | fermentum nunc. Proin in molestie orci. Praesent feugiat fermentum orci in placerat. Quisque 80 | gravida porttitor tellus condimentum porta. Phasellus tristique quam rhoncus, elementum 81 | ligula vitae, cursus purus. 82 | 83 | Maecenas a velit a dui viverra auctor. Sed at scelerisque diam, sit amet ornare massa. 84 | Phasellus sit amet libero ante. Praesent leo risus, gravida id justo in, ultrices accumsan 85 | tortor. Integer placerat erat sit amet feugiat eleifend. Mauris auctor egestas libero, eget 86 | congue erat pretium quis. Integer aliquam tristique orci quis tempus. Integer non tincidunt 87 | neque. Nunc nec adipiscing risus, in rutrum neque. Donec mollis ultricies enim vitae 88 | vulputate. Nam accumsan, tellus nec luctus consequat, nunc leo laoreet nisl, eget congue mi 89 | augue in nibh. Sed commodo, nulla non tempus tempor, lectus lacus interdum massa, in 90 | accumsan massa nunc a tortor. Nam nulla urna, semper id ullamcorper in, tempor sed neque. 91 | Praesent gravida ultricies augue, et bibendum velit tincidunt vel. 92 | 93 | Duis at justo auctor sem convallis iaculis. Vestibulum suscipit nibh suscipit, fermentum 94 | turpis non, vestibulum eros. Donec dui orci, interdum vitae nisi volutpat, porta ultricies 95 | orci. Donec in nibh magna. Fusce magna nibh, facilisis ut porttitor nec, sollicitudin et 96 | nunc. Proin at diam non ante aliquet ultrices a ullamcorper est. Donec malesuada dignissim 97 | lectus ut aliquet. Donec pellentesque lorem ut lorem pretium, ac ultricies dui condimentum. 98 | Proin sed sem nunc. Vivamus congue tellus ac enim vehicula eleifend. Pellentesque cursus 99 | sollicitudin justo, in tincidunt metus facilisis et. Nunc vel congue leo. Donec in urna 100 | egestas, tincidunt nibh ac, pretium diam. Mauris nec odio massa. 101 | 102 | Morbi rhoncus lacus eget consequat suscipit. Vestibulum ultricies nunc sed scelerisque 103 | varius. Proin ornare magna sit amet nibh euismod ultricies. Proin pharetra risus nunc, id 104 | molestie nisi suscipit in. Quisque tempor orci placerat odio malesuada hendrerit. Proin eu 105 | dapibus velit. Suspendisse imperdiet, lectus eu semper euismod, quam enim consequat nisi, 106 | non rhoncus diam libero et urna. Vestibulum ornare nulla at porttitor posuere. Sed elementum 107 | feugiat accumsan. Nam eu mauris sed leo tincidunt lacinia vitae at erat. 108 | 109 | Praesent auctor mi vitae ligula scelerisque sodales. Etiam ac gravida nisl. Ut accumsan 110 | lorem lobortis laoreet tempus. Sed placerat ut nibh ut viverra. Aliquam ullamcorper lacinia 111 | ultrices. Morbi a arcu leo. Donec vitae scelerisque nisi, pharetra placerat neque. Maecenas 112 | et nunc accumsan, faucibus purus eu, hendrerit neque. Vestibulum pharetra sem arcu, eu 113 | eleifend sapien molestie quis. Cras venenatis vehicula ante, sit amet rhoncus leo sagittis 114 | a. Quisque id nibh sed lectus congue euismod. 115 | ViewPager 116 | WebView 117 | 118 | 119 | -------------------------------------------------------------------------------- /EdgeEffectOverrideSample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | EdgeEffectOverride 2 | ================= 3 | 4 | EdgeEffectOverride is library designed to help override the blue *overscroll_edge* and *overscroll_glow* effects used by the the *EdgeEffect* class. 5 | 6 | ![http://i.imgur.com/6d5vV78.jpg](http://i.imgur.com/6d5vV78.jpg) 7 | 8 | Simply import the project into your library, replace existing 9 | references to ScrollView, ListView, ExpandableListView, GridView & ViewPager 10 | with references to the the classes found in this library. 11 | 12 | No need to edit any graphics, simply colorize the edge effect dynamically or via the layout xml, easy! 13 | 14 |

Dependency

15 | Adding it as a dependency to your project. 16 | 17 | Gradle: 18 | 19 | dependencies { 20 | compile 'uk.co.androidalliance:edgeeffectoverride:1.0.2' 21 | } 22 | 23 | 24 | 25 | 26 | Developed By 27 | ============ 28 | 29 | * Android Alliance - 30 | 31 | 32 | License 33 | ======= 34 | 35 | Copyright 2014 Android Alliance Ltd 36 | 37 | Licensed under the Apache License, Version 2.0 (the "License"); 38 | you may not use this file except in compliance with the License. 39 | You may obtain a copy of the License at 40 | 41 | http://www.apache.org/licenses/LICENSE-2.0 42 | 43 | Unless required by applicable law or agreed to in writing, software 44 | distributed under the License is distributed on an "AS IS" BASIS, 45 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 46 | See the License for the specific language governing permissions and 47 | limitations under the License. 48 | 49 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | mavenCentral() 5 | } 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:0.13.2' 8 | } 9 | } 10 | 11 | allprojects { 12 | version = VERSION_NAME 13 | group = GROUP 14 | 15 | repositories { 16 | mavenCentral() 17 | } 18 | } 19 | 20 | apply plugin: 'android-reporting' -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | VERSION_NAME=1.0.2 2 | VERSION_CODE=2 3 | GROUP=uk.co.androidalliance 4 | 5 | POM_DESCRIPTION=The Edge Effect Override is an Android Library designed to help override the overscroll_edge and overscroll_glow effects used by the EdgeEffect class. 6 | POM_URL=https://github.com/AndroidAlliance/EdgeEffectOverride 7 | POM_SCM_URL=https://github.com/AndroidAlliance/EdgeEffectOverride 8 | POM_SCM_CONNECTION=scm:git://androidalliance.github.com/AndroidAlliance/EdgeEffectOverride.git 9 | POM_SCM_DEV_CONNECTION=scm:git@androidalliance.github.com:AndroidAlliance/EdgeEffectOverride.git 10 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 11 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 12 | POM_LICENCE_DIST=repo 13 | POM_DEVELOPER_ID=androidalliance 14 | POM_DEVELOPER_NAME=Android Alliance 15 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndroidAlliance/EdgeEffectOverride/0c41dc3c867d7bf662f550acf028a635f04a83ba/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Nov 06 17:28:58 GMT 2014 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /maven_push.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Chris Banes 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'maven' 18 | apply plugin: 'signing' 19 | 20 | def isReleaseBuild() { 21 | return VERSION_NAME.contains("SNAPSHOT") == false 22 | } 23 | 24 | def getReleaseRepositoryUrl() { 25 | return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL 26 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" 27 | } 28 | 29 | def getSnapshotRepositoryUrl() { 30 | return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL 31 | : "https://oss.sonatype.org/content/repositories/snapshots/" 32 | } 33 | 34 | def getRepositoryUsername() { 35 | return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" 36 | } 37 | 38 | def getRepositoryPassword() { 39 | return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" 40 | } 41 | 42 | afterEvaluate { project -> 43 | uploadArchives { 44 | repositories { 45 | mavenDeployer { 46 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 47 | 48 | pom.groupId = GROUP 49 | pom.artifactId = POM_ARTIFACT_ID 50 | pom.version = VERSION_NAME 51 | 52 | repository(url: getReleaseRepositoryUrl()) { 53 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) 54 | } 55 | snapshotRepository(url: getSnapshotRepositoryUrl()) { 56 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) 57 | } 58 | 59 | pom.project { 60 | name POM_NAME 61 | packaging POM_PACKAGING 62 | description POM_DESCRIPTION 63 | url POM_URL 64 | 65 | scm { 66 | url POM_SCM_URL 67 | connection POM_SCM_CONNECTION 68 | developerConnection POM_SCM_DEV_CONNECTION 69 | } 70 | 71 | licenses { 72 | license { 73 | name POM_LICENCE_NAME 74 | url POM_LICENCE_URL 75 | distribution POM_LICENCE_DIST 76 | } 77 | } 78 | 79 | developers { 80 | developer { 81 | id POM_DEVELOPER_ID 82 | name POM_DEVELOPER_NAME 83 | } 84 | } 85 | } 86 | } 87 | } 88 | } 89 | 90 | signing { 91 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } 92 | sign configurations.archives 93 | } 94 | 95 | task androidJavadocs(type: Javadoc) { 96 | source = android.sourceSets.main.java.srcDirs 97 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 98 | } 99 | 100 | task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { 101 | classifier = 'javadoc' 102 | from androidJavadocs.destinationDir 103 | } 104 | 105 | task androidSourcesJar(type: Jar) { 106 | classifier = 'sources' 107 | from android.sourceSets.main.java.sourceFiles 108 | } 109 | 110 | artifacts { 111 | archives androidSourcesJar 112 | archives androidJavadocsJar 113 | } 114 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':EdgeEffectOverride', ':EdgeEffectOverrideSample' 2 | --------------------------------------------------------------------------------