Browse Source

android studio升級|Gradle升級 gradle and studio update 3.5 3.0

SpringBoots 8 years ago
parent
commit
6f5bb6d240
35 changed files with 14 additions and 6433 deletions
  1. 14 11
      WeiChat/build.gradle
  2. 0 1
      libpsectionlistview/.gitignore
  3. 0 96
      libpsectionlistview/build.gradle
  4. 0 17
      libpsectionlistview/proguard-rules.pro
  5. 0 4
      libpsectionlistview/src/main/AndroidManifest.xml
  6. 0 523
      libpsectionlistview/src/main/java/com/hb/views/pinnedsection/PinnedSectionListView.java
  7. 0 3
      libpsectionlistview/src/main/res/values/strings.xml
  8. 0 1
      librarymenudrawer/.gitignore
  9. 0 24
      librarymenudrawer/build.gradle
  10. 0 17
      librarymenudrawer/proguard-rules.pro
  11. 0 5
      librarymenudrawer/src/main/AndroidManifest.xml
  12. 0 99
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/BuildLayerFrameLayout.java
  13. 0 170
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/ColorDrawable.java
  14. 0 624
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/DraggableDrawer.java
  15. 0 175
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/FloatScroller.java
  16. 0 1652
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/MenuDrawer.java
  17. 0 28
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/NoClickThroughFrameLayout.java
  18. 0 791
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/OverlayDrawer.java
  19. 0 28
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/PeekInterpolator.java
  20. 0 50
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/Position.java
  21. 0 505
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/Scroller.java
  22. 0 15
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/SinusoidalInterpolator.java
  23. 0 187
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/SlideDrawable.java
  24. 0 707
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/SlidingDrawer.java
  25. 0 12
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/SmoothInterpolator.java
  26. 0 218
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/StaticDrawer.java
  27. 0 50
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/ViewHelper.java
  28. 0 83
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/compat/ActionBarHelper.java
  29. 0 107
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/compat/ActionBarHelperCompat.java
  30. 0 114
      librarymenudrawer/src/main/java/net/simonvt/menudrawer/compat/ActionBarHelperNative.java
  31. 0 65
      librarymenudrawer/src/main/res/values/attrs.xml
  32. 0 6
      librarymenudrawer/src/main/res/values/colors.xml
  33. 0 24
      librarymenudrawer/src/main/res/values/ids.xml
  34. 0 8
      librarymenudrawer/src/main/res/values/strings.xml
  35. 0 13
      librarymenudrawer/src/main/res/values/styles.xml

+ 14 - 11
WeiChat/build.gradle

@@ -2,12 +2,10 @@ apply plugin: 'com.android.application'
 apply plugin: 'com.getkeepsafe.dexcount'
 
 android {
-   
-    useLibrary 'org.apache.http.legacy'
-    lintOptions {
-        abortOnError false
-    }
     
+    compileSdkVersion 24
+    buildToolsVersion "25.0.0"
+
     signingConfigs {
         config {
             storeFile file('C:/sigin/applicationsignname[20150409]')
@@ -16,8 +14,6 @@ android {
             keyPassword '13237658359'
         }
     }
-    compileSdkVersion 24
-    buildToolsVersion "25.0.0"
     defaultConfig {
         applicationId "com.xzjmyk.pm.activity"
         minSdkVersion 11
@@ -29,10 +25,19 @@ android {
         multiDexEnabled true
         signingConfig signingConfigs.config
     }
+    
+    useLibrary 'org.apache.http.legacy'
+    lintOptions {
+        abortOnError false
+    }
+    
+    
+    
     packagingOptions {
         exclude 'META-INF/LICENSE.txt'
         exclude 'META-INF/NOTICE.txt'
     }
+    
     buildTypes {
         release {
             minifyEnabled false
@@ -72,9 +77,8 @@ dexcount {
 }
 
 dependencies {
-
+    
     compile project(':pullToRefershLibraryMy')
-   
     compile project(':MPAndroidChart')
     compile project(':libedittextformlibrary')
     compile project(':libfloatingactionbutton')
@@ -120,8 +124,7 @@ dependencies {
     compile 'de.hdodenhof:circleimageview:2.1.0'
     compile 'joda-time:joda-time:2.9.4'
     compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
-   
- 
+    
     compile 'com.android.support:appcompat-v7:24.2.1'
     compile 'com.android.support:cardview-v7:24.2.1'
     compile 'com.android.support:design:24.2.1'

+ 0 - 1
libpsectionlistview/.gitignore

@@ -1 +0,0 @@
-/build

+ 0 - 96
libpsectionlistview/build.gradle

@@ -1,96 +0,0 @@
-apply plugin: 'com.android.library'
-
-android {
-    compileSdkVersion 22
-    buildToolsVersion "22.0.1"
-    resourcePrefix "swipemenulistview"
-
-    defaultConfig {
-        minSdkVersion 8
-        targetSdkVersion 22
-        versionCode 1
-        versionName "1.0"
-    }
-    buildTypes {
-        release {
-            minifyEnabled false
-            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
-        }
-    }
-}
-
-dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
-    compile 'com.android.support:support-v4:22.1.1'
-}
-
-apply plugin: 'com.github.dcendents.android-maven'
-apply plugin: 'com.jfrog.bintray'
-
-version = "1.3.0"
-
-def siteUrl = 'https://github.com/baoyongzhang/SwipeMenuListView'
-def gitUrl = 'https://github.com/baoyongzhang/SwipeMenuListView.git'
-group = "com.baoyz.swipemenulistview"
-install {
-    repositories.mavenInstaller {
-        pom {
-            project {
-                packaging 'aar'
-                // Add your description here
-                name 'SwipeMenuListView' 	//项目描述
-                url siteUrl
-                // Set your license
-                licenses {
-                    license {
-                        name 'The MIT License (MIT)'
-                        url 'http://baoyz.com/licenses/LICENSE.txt'
-                    }
-                }
-                developers {
-                    developer {
-                        id 'baoyongzhang'		//填写的一些基本信息
-                        name 'baoyongzhang'
-                        email 'baoyz94@gmail.com'
-                    }
-                }
-                scm {
-                    connection gitUrl
-                    developerConnection gitUrl
-                    url siteUrl
-                }
-            }
-        }
-    }
-}
-task sourcesJar(type: Jar) {
-    from android.sourceSets.main.java.srcDirs
-    classifier = 'sources'
-}
-task javadoc(type: Javadoc) {
-    source = android.sourceSets.main.java.srcDirs
-    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
-}
-task javadocJar(type: Jar, dependsOn: javadoc) {
-    classifier = 'javadoc'
-    from javadoc.destinationDir
-}
-artifacts {
-    archives javadocJar
-    archives sourcesJar
-}
-Properties properties = new Properties()
-properties.load(project.rootProject.file('local.properties').newDataInputStream())
-bintray {
-    user = properties.getProperty("bintray.user")
-    key = properties.getProperty("bintray.apikey")
-    configurations = ['archives']
-    pkg {
-        repo = "maven"
-        name = "SwipeMenuListView"	//发布到JCenter上的项目名字
-        websiteUrl = siteUrl
-        vcsUrl = gitUrl
-        licenses = ["MIT"]
-        publish = true
-    }
-}

+ 0 - 17
libpsectionlistview/proguard-rules.pro

@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in C:\Android\sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-#   http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-#   public *;
-#}

+ 0 - 4
libpsectionlistview/src/main/AndroidManifest.xml

@@ -1,4 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.hb.views.pinnedsection">
-
-</manifest>

+ 0 - 523
libpsectionlistview/src/main/java/com/hb/views/pinnedsection/PinnedSectionListView.java

@@ -1,523 +0,0 @@
-/*
- * Copyright (C) 2013 Sergej Shafarenka, halfbit.de
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file kt in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.hb.views.pinnedsection;
-
-import android.content.Context;
-import android.database.DataSetObserver;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.PointF;
-import android.graphics.Rect;
-import android.graphics.drawable.GradientDrawable;
-import android.graphics.drawable.GradientDrawable.Orientation;
-import android.os.Parcelable;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.SoundEffectConstants;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.accessibility.AccessibilityEvent;
-import android.widget.AbsListView;
-import android.widget.HeaderViewListAdapter;
-import android.widget.ListAdapter;
-import android.widget.ListView;
-import android.widget.SectionIndexer;
-
-
-/**
- * ListView, which is capable to pin section views at its top while the rest is still scrolled.
- */
-public class PinnedSectionListView extends ListView {
-
-    //-- inner classes
-
-	/** List adapter to be implemented for being used with PinnedSectionListView adapter. */
-	public static interface PinnedSectionListAdapter extends ListAdapter {
-		/** This method shall return 'true' if views of given type has to be pinned. */
-		boolean isItemViewTypePinned(int viewType);
-	}
-
-	/** Wrapper class for pinned section view and its position in the list. */
-	static class PinnedSection {
-		public View view;
-		public int position;
-		public long id;
-	}
-
-	//-- class fields
-
-    // fields used for handling touch events
-    private final Rect mTouchRect = new Rect();
-    private final PointF mTouchPoint = new PointF();
-    private int mTouchSlop;
-    private View mTouchTarget;
-    private MotionEvent mDownEvent;
-
-    // fields used for drawing shadow under a pinned section
-    private GradientDrawable mShadowDrawable;
-    private int mSectionsDistanceY;
-    private int mShadowHeight;
-
-    /** Delegating listener, can be null. */
-    OnScrollListener mDelegateOnScrollListener;
-
-    /** Shadow for being recycled, can be null. */
-    PinnedSection mRecycleSection;
-
-    /** shadow instance with a pinned view, can be null. */
-    PinnedSection mPinnedSection;
-
-    /** Pinned view Y-translation. We use it to stick pinned view to the next section. */
-    int mTranslateY;
-
-	/** Scroll listener which does the magic */
-	private final OnScrollListener mOnScrollListener = new OnScrollListener() {
-
-		@Override public void onScrollStateChanged(AbsListView view, int scrollState) {
-			if (mDelegateOnScrollListener != null) { // delegate
-				mDelegateOnScrollListener.onScrollStateChanged(view, scrollState);
-			}
-		}
-
-		@Override
-        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
-
-            if (mDelegateOnScrollListener != null) { // delegate
-                mDelegateOnScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
-            }
-
-            // get expected adapter or fail fast
-            ListAdapter adapter = getAdapter();
-            if (adapter == null || visibleItemCount == 0) return; // nothing to do
-
-            final boolean isFirstVisibleItemSection =
-                    isItemViewTypePinned(adapter, adapter.getItemViewType(firstVisibleItem));
-
-            if (isFirstVisibleItemSection) {
-                View sectionView = getChildAt(0);
-                if (sectionView.getTop() == getPaddingTop()) { // view sticks to the top, no need for pinned shadow
-                    destroyPinnedShadow();
-                } else { // section doesn't stick to the top, make sure we have a pinned shadow
-                    ensureShadowForPosition(firstVisibleItem, firstVisibleItem, visibleItemCount);
-                }
-
-            } else { // section is not at the first visible position
-                int sectionPosition = findCurrentSectionPosition(firstVisibleItem);
-                if (sectionPosition > -1) { // we have section position
-                    ensureShadowForPosition(sectionPosition, firstVisibleItem, visibleItemCount);
-                } else { // there is no section for the first visible item, destroy shadow
-                    destroyPinnedShadow();
-                }
-            }
-		};
-
-	};
-
-	/** Default change observer. */
-    private final DataSetObserver mDataSetObserver = new DataSetObserver() {
-        @Override public void onChanged() {
-            recreatePinnedShadow();
-        };
-        @Override public void onInvalidated() {
-            recreatePinnedShadow();
-        }
-    };
-
-	//-- constructors
-
-    public PinnedSectionListView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        initView();
-    }
-
-    public PinnedSectionListView(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-        initView();
-    }
-
-    private void initView() {
-        setOnScrollListener(mOnScrollListener);
-        mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
-        initShadow(true);
-    }
-
-    //-- public API methods
-
-    public void setShadowVisible(boolean visible) {
-        initShadow(visible);
-        if (mPinnedSection != null) {
-            View v = mPinnedSection.view;
-            invalidate(v.getLeft(), v.getTop(), v.getRight(), v.getBottom() + mShadowHeight);
-        }
-    }
-
-    //-- pinned section drawing methods
-
-    public void initShadow(boolean visible) {
-        if (visible) {
-            if (mShadowDrawable == null) {
-                mShadowDrawable = new GradientDrawable(Orientation.TOP_BOTTOM,
-                        new int[] { Color.parseColor("#ffa0a0a0"), Color.parseColor("#50a0a0a0"), Color.parseColor("#00a0a0a0")});
-                mShadowHeight = (int) (8 * getResources().getDisplayMetrics().density);
-            }
-        } else {
-            if (mShadowDrawable != null) {
-                mShadowDrawable = null;
-                mShadowHeight = 0;
-            }
-        }
-    }
-
-	/** Create shadow wrapper with a pinned view for a view at given position */
-	void createPinnedShadow(int position) {
-
-		// try to recycle shadow
-		PinnedSection pinnedShadow = mRecycleSection;
-		mRecycleSection = null;
-
-		// create new shadow, if needed
-		if (pinnedShadow == null) pinnedShadow = new PinnedSection();
-		// request new view using recycled view, if such
-		View pinnedView = getAdapter().getView(position, pinnedShadow.view, PinnedSectionListView.this);
-
-		// read layout parameters
-		LayoutParams layoutParams = (LayoutParams) pinnedView.getLayoutParams();
-		if (layoutParams == null) {
-		    layoutParams = (LayoutParams) generateDefaultLayoutParams();
-		    pinnedView.setLayoutParams(layoutParams);
-		}
-
-		int heightMode = MeasureSpec.getMode(layoutParams.height);
-		int heightSize = MeasureSpec.getSize(layoutParams.height);
-
-		if (heightMode == MeasureSpec.UNSPECIFIED) heightMode = MeasureSpec.EXACTLY;
-
-		int maxHeight = getHeight() - getListPaddingTop() - getListPaddingBottom();
-		if (heightSize > maxHeight) heightSize = maxHeight;
-
-		// measure & layout
-		int ws = MeasureSpec.makeMeasureSpec(getWidth() - getListPaddingLeft() - getListPaddingRight(), MeasureSpec.EXACTLY);
-		int hs = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
-		pinnedView.measure(ws, hs);
-		pinnedView.layout(0, 0, pinnedView.getMeasuredWidth(), pinnedView.getMeasuredHeight());
-		mTranslateY = 0;
-
-		// initialize pinned shadow
-		pinnedShadow.view = pinnedView;
-		pinnedShadow.position = position;
-		pinnedShadow.id = getAdapter().getItemId(position);
-
-		// store pinned shadow
-		mPinnedSection = pinnedShadow;
-	}
-
-	/** Destroy shadow wrapper for currently pinned view */
-	void destroyPinnedShadow() {
-	    if (mPinnedSection != null) {
-	        // keep shadow for being recycled later
-	        mRecycleSection = mPinnedSection;
-	        mPinnedSection = null;
-	    }
-	}
-
-	/** Makes sure we have an actual pinned shadow for given position. */
-    void ensureShadowForPosition(int sectionPosition, int firstVisibleItem, int visibleItemCount) {
-        if (visibleItemCount < 2) { // no need for creating shadow at all, we have a single visible item
-            destroyPinnedShadow();
-            return;
-        }
-
-        if (mPinnedSection != null
-                && mPinnedSection.position != sectionPosition) { // invalidate shadow, if required
-            destroyPinnedShadow();
-        }
-
-        if (mPinnedSection == null) { // create shadow, if empty
-            createPinnedShadow(sectionPosition);
-        }
-
-        // align shadow according to next section position, if needed
-        int nextPosition = sectionPosition + 1;
-        if (nextPosition < getCount()) {
-            int nextSectionPosition = findFirstVisibleSectionPosition(nextPosition,
-                    visibleItemCount - (nextPosition - firstVisibleItem));
-            if (nextSectionPosition > -1) {
-                View nextSectionView = getChildAt(nextSectionPosition - firstVisibleItem);
-                final int bottom = mPinnedSection.view.getBottom() + getPaddingTop();
-                mSectionsDistanceY = nextSectionView.getTop() - bottom;
-                if (mSectionsDistanceY < 0) {
-                    // next section overlaps pinned shadow, move it up
-                    mTranslateY = mSectionsDistanceY;
-                } else {
-                    // next section does not overlap with pinned, stick to top
-                    mTranslateY = 0;
-                }
-            } else {
-                // no other sections are visible, stick to top
-                mTranslateY = 0;
-                mSectionsDistanceY = Integer.MAX_VALUE;
-            }
-        }
-
-    }
-
-	int findFirstVisibleSectionPosition(int firstVisibleItem, int visibleItemCount) {
-		ListAdapter adapter = getAdapter();
-
-        int adapterDataCount = adapter.getCount();
-        if (getLastVisiblePosition() >= adapterDataCount) return -1; // dataset has changed, no candidate
-
-        if (firstVisibleItem+visibleItemCount >= adapterDataCount){//added to prevent index Outofbound (in case)
-            visibleItemCount = adapterDataCount-firstVisibleItem;
-        }
-
-		for (int childIndex = 0; childIndex < visibleItemCount; childIndex++) {
-			int position = firstVisibleItem + childIndex;
-			int viewType = adapter.getItemViewType(position);
-			if (isItemViewTypePinned(adapter, viewType)) return position;
-		}
-		return -1;
-	}
-
-	int findCurrentSectionPosition(int fromPosition) {
-		ListAdapter adapter = getAdapter();
-
-		if (fromPosition >= adapter.getCount()) return -1; // dataset has changed, no candidate
-		
-		if (adapter instanceof SectionIndexer) {
-			// try fast way by asking section indexer
-			SectionIndexer indexer = (SectionIndexer) adapter;
-			int sectionPosition = indexer.getSectionForPosition(fromPosition);
-			int itemPosition = indexer.getPositionForSection(sectionPosition);
-			int typeView = adapter.getItemViewType(itemPosition);
-			if (isItemViewTypePinned(adapter, typeView)) {
-				return itemPosition;
-			} // else, no luck
-		}
-
-		// try slow way by looking through to the next section item above
-		for (int position=fromPosition; position>=0; position--) {
-			int viewType = adapter.getItemViewType(position);
-			if (isItemViewTypePinned(adapter, viewType)) return position;
-		}
-		return -1; // no candidate found
-	}
-
-	void recreatePinnedShadow() {
-	    destroyPinnedShadow();
-        ListAdapter adapter = getAdapter();
-        if (adapter != null && adapter.getCount() > 0) {
-            int firstVisiblePosition = getFirstVisiblePosition();
-            int sectionPosition = findCurrentSectionPosition(firstVisiblePosition);
-            if (sectionPosition == -1) return; // no views to pin, exit
-            ensureShadowForPosition(sectionPosition,
-                    firstVisiblePosition, getLastVisiblePosition() - firstVisiblePosition);
-        }
-	}
-
-	@Override
-	public void setOnScrollListener(OnScrollListener listener) {
-		if (listener == mOnScrollListener) {
-			super.setOnScrollListener(listener);
-		} else {
-			mDelegateOnScrollListener = listener;
-		}
-	}
-
-	@Override
-	public void onRestoreInstanceState(Parcelable state) {
-		super.onRestoreInstanceState(state);
-		post(new Runnable() {
-			@Override public void run() { // restore pinned view after configuration change
-			    recreatePinnedShadow();
-			}
-		});
-	}
-
-	@Override
-	public void setAdapter(ListAdapter adapter) {
-
-	    // assert adapter in debug mode
-		if ( adapter != null) {
-			if (!(adapter instanceof PinnedSectionListAdapter))
-				throw new IllegalArgumentException("Does your adapter implement PinnedSectionListAdapter?");
-			if (adapter.getViewTypeCount() < 2)
-				throw new IllegalArgumentException("Does your adapter handle at least two types" +
-						" of views in getViewTypeCount() method: items and sections?");
-		}
-
-		// unregister observer at old adapter and register on new one
-		ListAdapter oldAdapter = getAdapter();
-		if (oldAdapter != null) oldAdapter.unregisterDataSetObserver(mDataSetObserver);
-		if (adapter != null) adapter.registerDataSetObserver(mDataSetObserver);
-
-		// destroy pinned shadow, if new adapter is not same as old one
-		if (oldAdapter != adapter) destroyPinnedShadow();
-
-		super.setAdapter(adapter);
-	}
-
-	@Override
-	protected void onLayout(boolean changed, int l, int t, int r, int b) {
-	    super.onLayout(changed, l, t, r, b);
-        if (mPinnedSection != null) {
-            int parentWidth = r - l - getPaddingLeft() - getPaddingRight();
-            int shadowWidth = mPinnedSection.view.getWidth();
-            if (parentWidth != shadowWidth) {
-                recreatePinnedShadow();
-            }
-        }
-	}
-
-	@Override
-	protected void dispatchDraw(Canvas canvas) {
-		super.dispatchDraw(canvas);
-
-		if (mPinnedSection != null) {
-
-			// prepare variables
-			int pLeft = getListPaddingLeft();
-			int pTop = getListPaddingTop();
-			View view = mPinnedSection.view;
-
-			// draw child
-			canvas.save();
-
-			int clipHeight = view.getHeight() +
-			        (mShadowDrawable == null ? 0 : Math.min(mShadowHeight, mSectionsDistanceY));
-			canvas.clipRect(pLeft, pTop, pLeft + view.getWidth(), pTop + clipHeight);
-
-			canvas.translate(pLeft, pTop + mTranslateY);
-			drawChild(canvas, mPinnedSection.view, getDrawingTime());
-
-			if (mShadowDrawable != null && mSectionsDistanceY > 0) {
-			    mShadowDrawable.setBounds(mPinnedSection.view.getLeft(),
-			            mPinnedSection.view.getBottom(),
-			            mPinnedSection.view.getRight(),
-			            mPinnedSection.view.getBottom() + mShadowHeight);
-			    mShadowDrawable.draw(canvas);
-			}
-
-			canvas.restore();
-		}
-	}
-
-	//-- touch handling methods
-
-    @Override
-    public boolean dispatchTouchEvent(MotionEvent ev) {
-
-        final float x = ev.getX();
-        final float y = ev.getY();
-        final int action = ev.getAction();
-
-        if (action == MotionEvent.ACTION_DOWN
-                && mTouchTarget == null
-                && mPinnedSection != null
-                && isPinnedViewTouched(mPinnedSection.view, x, y)) { // create touch target
-
-            // user touched pinned view
-            mTouchTarget = mPinnedSection.view;
-            mTouchPoint.x = x;
-            mTouchPoint.y = y;
-
-            // copy down event for eventually be used later
-            mDownEvent = MotionEvent.obtain(ev);
-        }
-
-        if (mTouchTarget != null) {
-            if (isPinnedViewTouched(mTouchTarget, x, y)) { // forward event to pinned view
-                mTouchTarget.dispatchTouchEvent(ev);
-            }
-
-            if (action == MotionEvent.ACTION_UP) { // perform onClick on pinned view
-                super.dispatchTouchEvent(ev);
-                performPinnedItemClick();
-                clearTouchTarget();
-
-            } else if (action == MotionEvent.ACTION_CANCEL) { // cancel
-                clearTouchTarget();
-
-            } else if (action == MotionEvent.ACTION_MOVE) {
-                if (Math.abs(y - mTouchPoint.y) > mTouchSlop) {
-
-                    // cancel sequence on touch target
-                    MotionEvent event = MotionEvent.obtain(ev);
-                    event.setAction(MotionEvent.ACTION_CANCEL);
-                    mTouchTarget.dispatchTouchEvent(event);
-                    event.recycle();
-
-                    // provide correct sequence to super class for further handling
-                    super.dispatchTouchEvent(mDownEvent);
-                    super.dispatchTouchEvent(ev);
-                    clearTouchTarget();
-
-                }
-            }
-
-            return true;
-        }
-
-        // call super if this was not our pinned view
-        return super.dispatchTouchEvent(ev);
-    }
-
-    private boolean isPinnedViewTouched(View view, float x, float y) {
-        view.getHitRect(mTouchRect);
-
-        // by taping top or bottom padding, the list performs on click on a border item.
-        // we don't add top padding here to keep behavior consistent.
-        mTouchRect.top += mTranslateY;
-
-        mTouchRect.bottom += mTranslateY + getPaddingTop();
-        mTouchRect.left += getPaddingLeft();
-        mTouchRect.right -= getPaddingRight();
-        return mTouchRect.contains((int)x, (int)y);
-    }
-
-    private void clearTouchTarget() {
-        mTouchTarget = null;
-        if (mDownEvent != null) {
-            mDownEvent.recycle();
-            mDownEvent = null;
-        }
-    }
-
-    private boolean performPinnedItemClick() {
-        if (mPinnedSection == null) return false;
-
-        OnItemClickListener listener = getOnItemClickListener();
-        if (listener != null && getAdapter().isEnabled(mPinnedSection.position)) {
-            View view =  mPinnedSection.view;
-            playSoundEffect(SoundEffectConstants.CLICK);
-            if (view != null) {
-                view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
-            }
-            listener.onItemClick(this, view, mPinnedSection.position, mPinnedSection.id);
-            return true;
-        }
-        return false;
-    }
-
-    public static boolean isItemViewTypePinned(ListAdapter adapter, int viewType) {
-        if (adapter instanceof HeaderViewListAdapter) {
-            adapter = ((HeaderViewListAdapter)adapter).getWrappedAdapter();
-        }
-        return ((PinnedSectionListAdapter) adapter).isItemViewTypePinned(viewType);
-    }
-
-}

+ 0 - 3
libpsectionlistview/src/main/res/values/strings.xml

@@ -1,3 +0,0 @@
-<resources>
-    <string name="app_name">libpSectionListview</string>
-</resources>

+ 0 - 1
librarymenudrawer/.gitignore

@@ -1 +0,0 @@
-/build

+ 0 - 24
librarymenudrawer/build.gradle

@@ -1,24 +0,0 @@
-apply plugin: 'com.android.library'
-
-android {
-    compileSdkVersion 22
-    buildToolsVersion "22.0.1"
-
-    defaultConfig {
-        minSdkVersion 8
-        targetSdkVersion 22
-        versionCode 1
-        versionName "1.0"
-    }
-    buildTypes {
-        release {
-            minifyEnabled false
-            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
-        }
-    }
-}
-
-dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
-    compile 'com.android.support:appcompat-v7:22.2.0'
-}

+ 0 - 17
librarymenudrawer/proguard-rules.pro

@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in C:\Android\sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-#   http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-#   public *;
-#}

+ 0 - 5
librarymenudrawer/src/main/AndroidManifest.xml

@@ -1,5 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="net.simonvt.menudrawer">
-
-
-</manifest>

+ 0 - 99
librarymenudrawer/src/main/java/net/simonvt/menudrawer/BuildLayerFrameLayout.java

@@ -1,99 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.util.AttributeSet;
-import android.widget.FrameLayout;
-
-/**
- * FrameLayout which caches the hardware layer if available.
- * <p/>
- * If it's not posted twice the layer either wont be built on start, or it'll be built twice.
- */
-class BuildLayerFrameLayout extends FrameLayout {
-
-    private boolean mChanged;
-
-    private boolean mHardwareLayersEnabled = true;
-
-    private boolean mAttached;
-
-    private boolean mFirst = true;
-
-    public BuildLayerFrameLayout(Context context) {
-        super(context);
-        if (MenuDrawer.USE_TRANSLATIONS) {
-            setLayerType(LAYER_TYPE_HARDWARE, null);
-        }
-    }
-
-    public BuildLayerFrameLayout(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        if (MenuDrawer.USE_TRANSLATIONS) {
-            setLayerType(LAYER_TYPE_HARDWARE, null);
-        }
-    }
-
-    public BuildLayerFrameLayout(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-        if (MenuDrawer.USE_TRANSLATIONS) {
-            setLayerType(LAYER_TYPE_HARDWARE, null);
-        }
-    }
-
-    void setHardwareLayersEnabled(boolean enabled) {
-        mHardwareLayersEnabled = enabled;
-    }
-
-    @Override
-    protected void onAttachedToWindow() {
-        super.onAttachedToWindow();
-        mAttached = true;
-    }
-
-    @Override
-    protected void onDetachedFromWindow() {
-        super.onDetachedFromWindow();
-        mAttached = false;
-    }
-
-    @Override
-    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
-        super.onSizeChanged(w, h, oldw, oldh);
-
-        if (MenuDrawer.USE_TRANSLATIONS && mHardwareLayersEnabled) {
-            post(new Runnable() {
-                @Override
-                public void run() {
-                    mChanged = true;
-                    invalidate();
-                }
-            });
-        }
-    }
-
-    @Override
-    protected void dispatchDraw(Canvas canvas) {
-        super.dispatchDraw(canvas);
-
-        if (mChanged && MenuDrawer.USE_TRANSLATIONS) {
-            post(new Runnable() {
-                @Override
-                public void run() {
-                    if (mAttached) {
-                        final int layerType = getLayerType();
-                        // If it's already a hardware layer, it'll be built anyway.
-                        if (layerType != LAYER_TYPE_HARDWARE || mFirst) {
-                            mFirst = false;
-                            setLayerType(LAYER_TYPE_HARDWARE, null);
-                            buildLayer();
-                            setLayerType(LAYER_TYPE_NONE, null);
-                        }
-                    }
-                }
-            });
-
-            mChanged = false;
-        }
-    }
-}

+ 0 - 170
librarymenudrawer/src/main/java/net/simonvt/menudrawer/ColorDrawable.java

@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.simonvt.menudrawer;
-
-import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.Paint;
-import android.graphics.PixelFormat;
-import android.graphics.drawable.Drawable;
-
-/**
- * A specialized Drawable that fills the Canvas with a specified color.
- * Note that a ColorDrawable ignores the ColorFilter.
- * <p/>
- * <p>It can be defined in an XML file with the <code>&lt;color></code> element.</p>
- *
- * @attr ref android.R.styleable#ColorDrawable_color
- */
-class ColorDrawable extends Drawable {
-
-    private ColorState mState;
-    private final Paint mPaint = new Paint();
-
-    /** Creates a new black ColorDrawable. */
-    public ColorDrawable() {
-        this(null);
-    }
-
-    /**
-     * Creates a new ColorDrawable with the specified color.
-     *
-     * @param color The color to draw.
-     */
-    public ColorDrawable(int color) {
-        this(null);
-        setColor(color);
-    }
-
-    private ColorDrawable(ColorState state) {
-        mState = new ColorState(state);
-    }
-
-    @Override
-    public int getChangingConfigurations() {
-        return super.getChangingConfigurations() | mState.mChangingConfigurations;
-    }
-
-    @Override
-    public void draw(Canvas canvas) {
-        if ((mState.mUseColor >>> 24) != 0) {
-            mPaint.setColor(mState.mUseColor);
-            canvas.drawRect(getBounds(), mPaint);
-        }
-    }
-
-    /**
-     * Gets the drawable's color value.
-     *
-     * @return int The color to draw.
-     */
-    public int getColor() {
-        return mState.mUseColor;
-    }
-
-    /**
-     * Sets the drawable's color value. This action will clobber the results of prior calls to
-     * {@link #setAlpha(int)} on this object, which side-affected the underlying color.
-     *
-     * @param color The color to draw.
-     */
-    public void setColor(int color) {
-        if (mState.mBaseColor != color || mState.mUseColor != color) {
-            invalidateSelf();
-            mState.mBaseColor = mState.mUseColor = color;
-        }
-    }
-
-    /**
-     * Returns the alpha value of this drawable's color.
-     *
-     * @return A value between 0 and 255.
-     */
-    public int getAlpha() {
-        return mState.mUseColor >>> 24;
-    }
-
-    /**
-     * Sets the color's alpha value.
-     *
-     * @param alpha The alpha value to set, between 0 and 255.
-     */
-    public void setAlpha(int alpha) {
-        alpha += alpha >> 7;   // make it 0..256
-        int baseAlpha = mState.mBaseColor >>> 24;
-        int useAlpha = baseAlpha * alpha >> 8;
-        int oldUseColor = mState.mUseColor;
-        mState.mUseColor = (mState.mBaseColor << 8 >>> 8) | (useAlpha << 24);
-        if (oldUseColor != mState.mUseColor) {
-            invalidateSelf();
-        }
-    }
-
-    /**
-     * Setting a color filter on a ColorDrawable has no effect.
-     *
-     * @param colorFilter Ignore.
-     */
-    public void setColorFilter(ColorFilter colorFilter) {
-    }
-
-    public int getOpacity() {
-        switch (mState.mUseColor >>> 24) {
-            case 255:
-                return PixelFormat.OPAQUE;
-            case 0:
-                return PixelFormat.TRANSPARENT;
-        }
-        return PixelFormat.TRANSLUCENT;
-    }
-
-    @Override
-    public ConstantState getConstantState() {
-        mState.mChangingConfigurations = getChangingConfigurations();
-        return mState;
-    }
-
-    static final class ColorState extends ConstantState {
-
-        int mBaseColor; // base color, independent of setAlpha()
-        int mUseColor;  // basecolor modulated by setAlpha()
-        int mChangingConfigurations;
-
-        ColorState(ColorState state) {
-            if (state != null) {
-                mBaseColor = state.mBaseColor;
-                mUseColor = state.mUseColor;
-            }
-        }
-
-        @Override
-        public Drawable newDrawable() {
-            return new ColorDrawable(this);
-        }
-
-        @Override
-        public Drawable newDrawable(Resources res) {
-            return new ColorDrawable(this);
-        }
-
-        @Override
-        public int getChangingConfigurations() {
-            return mChangingConfigurations;
-        }
-    }
-}

+ 0 - 624
librarymenudrawer/src/main/java/net/simonvt/menudrawer/DraggableDrawer.java

@@ -1,624 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Parcelable;
-import android.os.SystemClock;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.VelocityTracker;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-import android.view.animation.Interpolator;
-
-public abstract class DraggableDrawer extends MenuDrawer {
-
-    /**
-     * Key used when saving menu visibility state.
-     */
-    private static final String STATE_MENU_VISIBLE = "net.simonvt.menudrawer.MenuDrawer.menuVisible";
-
-    /**
-     * Interpolator used for peeking at the drawer.
-     */
-    private static final Interpolator PEEK_INTERPOLATOR = new PeekInterpolator();
-
-    /**
-     * The maximum alpha of the dark menu overlay used for dimming the menu.
-     */
-    protected static final int MAX_MENU_OVERLAY_ALPHA = 185;
-
-    /**
-     * Default delay from {@link #peekDrawer()} is called until first animation is run.
-     */
-    private static final long DEFAULT_PEEK_START_DELAY = 5000;
-
-    /**
-     * Default delay between each subsequent animation, after {@link #peekDrawer()} has been called.
-     */
-    private static final long DEFAULT_PEEK_DELAY = 10000;
-
-    /**
-     * The duration of the peek animation.
-     */
-    protected static final int PEEK_DURATION = 5000;
-
-    /**
-     * Distance in dp from closed position from where the drawer is considered closed with regards to touch events.
-     */
-    private static final int CLOSE_ENOUGH = 3;
-
-    protected static final int INVALID_POINTER = -1;
-
-    /**
-     * Slop before starting a drag.
-     */
-    protected int mTouchSlop;
-
-    /**
-     * Runnable used when the peek animation is running.
-     */
-    protected final Runnable mPeekRunnable = new Runnable() {
-        @Override
-        public void run() {
-            peekDrawerInvalidate();
-        }
-    };
-
-    /**
-     * Runnable used when animating the drawer open/closed.
-     */
-    private final Runnable mDragRunnable = new Runnable() {
-        @Override
-        public void run() {
-            postAnimationInvalidate();
-        }
-    };
-
-    /**
-     * Indicates whether the drawer is currently being dragged.
-     */
-    protected boolean mIsDragging;
-
-    /**
-     * The current pointer id.
-     */
-    protected int mActivePointerId = INVALID_POINTER;
-
-    /**
-     * The initial X position of a drag.
-     */
-    protected float mInitialMotionX;
-
-    /**
-     * The initial Y position of a drag.
-     */
-    protected float mInitialMotionY;
-
-    /**
-     * The last X position of a drag.
-     */
-    protected float mLastMotionX = -1;
-
-    /**
-     * The last Y position of a drag.
-     */
-    protected float mLastMotionY = -1;
-
-    /**
-     * Default delay between each subsequent animation, after {@link #peekDrawer()} has been called.
-     */
-    protected long mPeekDelay;
-
-    /**
-     * Scroller used for the peek drawer animation.
-     */
-    protected Scroller mPeekScroller;
-
-    /**
-     * Velocity tracker used when animating the drawer open/closed after a drag.
-     */
-    protected VelocityTracker mVelocityTracker;
-
-    /**
-     * Maximum velocity allowed when animating the drawer open/closed.
-     */
-    protected int mMaxVelocity;
-
-    /**
-     * Indicates whether the menu should be offset when dragging the drawer.
-     */
-    protected boolean mOffsetMenu = true;
-
-    /**
-     * Distance in px from closed position from where the drawer is considered closed with regards to touch events.
-     */
-    protected int mCloseEnough;
-
-    /**
-     * Runnable used for first call to {@link #startPeek()} after {@link #peekDrawer()}  has been called.
-     */
-    private Runnable mPeekStartRunnable;
-
-    protected boolean mIsPeeking;
-
-    /**
-     * Scroller used when animating the drawer open/closed.
-     */
-    private Scroller mScroller;
-
-    /**
-     * Indicates whether the current layer type is {@link View#LAYER_TYPE_HARDWARE}.
-     */
-    protected boolean mLayerTypeHardware;
-
-    DraggableDrawer(Activity activity, int dragMode) {
-        super(activity, dragMode);
-    }
-
-    public DraggableDrawer(Context context) {
-        super(context);
-    }
-
-    public DraggableDrawer(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public DraggableDrawer(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-    }
-
-    @Override
-    protected void initDrawer(Context context, AttributeSet attrs, int defStyle) {
-        super.initDrawer(context, attrs, defStyle);
-
-        final ViewConfiguration configuration = ViewConfiguration.get(context);
-        mTouchSlop = configuration.getScaledTouchSlop();
-        mMaxVelocity = configuration.getScaledMaximumFlingVelocity();
-
-        mScroller = new Scroller(context, MenuDrawer.SMOOTH_INTERPOLATOR);
-        mPeekScroller = new Scroller(context, DraggableDrawer.PEEK_INTERPOLATOR);
-
-        mCloseEnough = dpToPx(DraggableDrawer.CLOSE_ENOUGH);
-    }
-
-    public void toggleMenu(boolean animate) {
-        if (mDrawerState == STATE_OPEN || mDrawerState == STATE_OPENING) {
-            closeMenu(animate);
-        } else if (mDrawerState == STATE_CLOSED || mDrawerState == STATE_CLOSING) {
-            openMenu(animate);
-        }
-    }
-
-    public boolean isMenuVisible() {
-        return mMenuVisible;
-    }
-
-    public void setMenuSize(final int size) {
-        mMenuSize = size;
-        if (mDrawerState == STATE_OPEN || mDrawerState == STATE_OPENING) {
-            setOffsetPixels(mMenuSize);
-        }
-        requestLayout();
-        invalidate();
-    }
-
-    public void setOffsetMenuEnabled(boolean offsetMenu) {
-        if (offsetMenu != mOffsetMenu) {
-            mOffsetMenu = offsetMenu;
-            requestLayout();
-            invalidate();
-        }
-    }
-
-    public boolean getOffsetMenuEnabled() {
-        return mOffsetMenu;
-    }
-
-    public void peekDrawer() {
-        peekDrawer(DEFAULT_PEEK_START_DELAY, DEFAULT_PEEK_DELAY);
-    }
-
-    public void peekDrawer(long delay) {
-        peekDrawer(DEFAULT_PEEK_START_DELAY, delay);
-    }
-
-    public void peekDrawer(final long startDelay, final long delay) {
-        if (startDelay < 0) {
-            throw new IllegalArgumentException("startDelay must be zero or larger.");
-        }
-        if (delay < 0) {
-            throw new IllegalArgumentException("delay must be zero or larger");
-        }
-
-        removeCallbacks(mPeekRunnable);
-        removeCallbacks(mPeekStartRunnable);
-
-        mPeekDelay = delay;
-        mPeekStartRunnable = new Runnable() {
-            @Override
-            public void run() {
-                startPeek();
-            }
-        };
-        postDelayed(mPeekStartRunnable, startDelay);
-    }
-
-    public void setHardwareLayerEnabled(boolean enabled) {
-        if (enabled != mHardwareLayersEnabled) {
-            mHardwareLayersEnabled = enabled;
-            mMenuContainer.setHardwareLayersEnabled(enabled);
-            mContentContainer.setHardwareLayersEnabled(enabled);
-            stopLayerTranslation();
-        }
-    }
-
-    public int getTouchMode() {
-        return mTouchMode;
-    }
-
-    public void setTouchMode(int mode) {
-        if (mTouchMode != mode) {
-            mTouchMode = mode;
-            updateTouchAreaSize();
-        }
-    }
-
-    public void setTouchBezelSize(int size) {
-        mTouchBezelSize = size;
-    }
-
-    public int getTouchBezelSize() {
-        return mTouchBezelSize;
-    }
-
-    /**
-     * If possible, set the layer type to {@link View#LAYER_TYPE_HARDWARE}.
-     */
-    protected void startLayerTranslation() {
-        if (USE_TRANSLATIONS && mHardwareLayersEnabled && !mLayerTypeHardware) {
-            mLayerTypeHardware = true;
-            mContentContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
-            mMenuContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
-        }
-    }
-
-    /**
-     * If the current layer type is {@link View#LAYER_TYPE_HARDWARE}, this will set it to
-     * {@link View#LAYER_TYPE_NONE}.
-     */
-    protected void stopLayerTranslation() {
-        if (mLayerTypeHardware) {
-            mLayerTypeHardware = false;
-            mContentContainer.setLayerType(View.LAYER_TYPE_NONE, null);
-            mMenuContainer.setLayerType(View.LAYER_TYPE_NONE, null);
-        }
-    }
-
-    /**
-     * Called when a drag has been ended.
-     */
-    protected void endDrag() {
-        mIsDragging = false;
-
-        if (mVelocityTracker != null) {
-            mVelocityTracker.recycle();
-            mVelocityTracker = null;
-        }
-    }
-
-    /**
-     * Stops ongoing animation of the drawer.
-     */
-    protected void stopAnimation() {
-        removeCallbacks(mDragRunnable);
-        mScroller.abortAnimation();
-        stopLayerTranslation();
-    }
-
-    /**
-     * Called when a drawer animation has successfully completed.
-     */
-    private void completeAnimation() {
-        mScroller.abortAnimation();
-        final int finalX = mScroller.getFinalX();
-        setOffsetPixels(finalX);
-        setDrawerState(finalX == 0 ? STATE_CLOSED : STATE_OPEN);
-        stopLayerTranslation();
-    }
-
-    protected void cancelContentTouch() {
-        final long now = SystemClock.uptimeMillis();
-        final MotionEvent cancelEvent = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0.0f, 0.0f, 0);
-        final int childCount = getChildCount();
-        for (int i = 0; i < childCount; i++) {
-            getChildAt(i).dispatchTouchEvent(cancelEvent);
-        }
-        mContentContainer.dispatchTouchEvent(cancelEvent);
-        cancelEvent.recycle();
-    }
-
-    /**
-     * Moves the drawer to the position passed.
-     *
-     * @param position The position the content is moved to.
-     * @param velocity Optional velocity if called by releasing a drag event.
-     * @param animate  Whether the move is animated.
-     */
-    protected void animateOffsetTo(int position, int velocity, boolean animate) {
-        endDrag();
-        endPeek();
-
-        final int startX = (int) mOffsetPixels;
-        final int dx = position - startX;
-        if (dx == 0 || !animate) {
-            setOffsetPixels(position);
-            setDrawerState(position == 0 ? STATE_CLOSED : STATE_OPEN);
-            stopLayerTranslation();
-            return;
-        }
-
-        int duration;
-
-        velocity = Math.abs(velocity);
-        if (velocity > 0) {
-            duration = 4 * Math.round(1000.f * Math.abs((float) dx / velocity));
-        } else {
-            duration = (int) (600.f * Math.abs((float) dx / mMenuSize));
-        }
-
-        duration = Math.min(duration, mMaxAnimationDuration);
-        animateOffsetTo(position, duration);
-    }
-
-    protected void animateOffsetTo(int position, int duration) {
-        final int startX = (int) mOffsetPixels;
-        final int dx = position - startX;
-
-        if (dx > 0) {
-            setDrawerState(STATE_OPENING);
-            mScroller.startScroll(startX, 0, dx, 0, duration);
-        } else {
-            setDrawerState(STATE_CLOSING);
-            mScroller.startScroll(startX, 0, dx, 0, duration);
-        }
-
-        startLayerTranslation();
-
-        postAnimationInvalidate();
-    }
-
-    /**
-     * Callback when each frame in the drawer animation should be drawn.
-     */
-    private void postAnimationInvalidate() {
-        if (mScroller.computeScrollOffset()) {
-            final int oldX = (int) mOffsetPixels;
-            final int x = mScroller.getCurrX();
-
-            if (x != oldX) setOffsetPixels(x);
-            if (x != mScroller.getFinalX()) {
-                postOnAnimation(mDragRunnable);
-                return;
-            }
-        }
-
-        completeAnimation();
-    }
-
-    /**
-     * Starts peek drawer animation.
-     */
-    protected void startPeek() {
-        mIsPeeking = true;
-        initPeekScroller();
-
-        startLayerTranslation();
-        peekDrawerInvalidate();
-    }
-
-    protected abstract void initPeekScroller();
-
-    /**
-     * Callback when each frame in the peek drawer animation should be drawn.
-     */
-    private void peekDrawerInvalidate() {
-        if (mPeekScroller.computeScrollOffset()) {
-            final int oldX = (int) mOffsetPixels;
-            final int x = mPeekScroller.getCurrX();
-            if (x != oldX) setOffsetPixels(x);
-
-            if (!mPeekScroller.isFinished()) {
-                postOnAnimation(mPeekRunnable);
-                return;
-
-            } else if (mPeekDelay > 0) {
-                mPeekStartRunnable = new Runnable() {
-                    @Override
-                    public void run() {
-                        startPeek();
-                    }
-                };
-                postDelayed(mPeekStartRunnable, mPeekDelay);
-            }
-        }
-
-        completePeek();
-    }
-
-    /**
-     * Called when the peek drawer animation has successfully completed.
-     */
-    private void completePeek() {
-        mPeekScroller.abortAnimation();
-
-        setOffsetPixels(0);
-
-        setDrawerState(STATE_CLOSED);
-        stopLayerTranslation();
-        mIsPeeking = false;
-    }
-
-    /**
-     * Stops ongoing peek drawer animation.
-     */
-    protected void endPeek() {
-        removeCallbacks(mPeekStartRunnable);
-        removeCallbacks(mPeekRunnable);
-        stopLayerTranslation();
-        mIsPeeking = false;
-    }
-
-    protected boolean isCloseEnough() {
-        return Math.abs(mOffsetPixels) <= mCloseEnough;
-    }
-
-    protected boolean canChildrenScroll(int dx, int dy, int x, int y) {
-        boolean canScroll = false;
-
-        switch (getPosition()) {
-            case LEFT:
-            case RIGHT:
-                if (!mMenuVisible) {
-                    canScroll = canChildScrollHorizontally(mContentContainer, false, dx,
-                            x - ViewHelper.getLeft(mContentContainer), y - ViewHelper.getTop(mContentContainer));
-                } else {
-                    canScroll = canChildScrollHorizontally(mMenuContainer, false, dx,
-                            x - ViewHelper.getLeft(mMenuContainer), y - ViewHelper.getTop(mContentContainer));
-                }
-                break;
-
-            case TOP:
-            case BOTTOM:
-                if (!mMenuVisible) {
-                    canScroll = canChildScrollVertically(mContentContainer, false, dy,
-                            x - ViewHelper.getLeft(mContentContainer), y - ViewHelper.getTop(mContentContainer));
-                } else {
-                    canScroll = canChildScrollVertically(mMenuContainer, false, dy,
-                            x - ViewHelper.getLeft(mMenuContainer), y - ViewHelper.getTop(mContentContainer));
-                }
-        }
-
-        return canScroll;
-    }
-
-    /**
-     * Tests scrollability within child views of v given a delta of dx.
-     *
-     * @param v      View to test for horizontal scrollability
-     * @param checkV Whether the view should be checked for draggability
-     * @param dx     Delta scrolled in pixels
-     * @param x      X coordinate of the active touch point
-     * @param y      Y coordinate of the active touch point
-     * @return true if child views of v can be scrolled by delta of dx.
-     */
-    protected boolean canChildScrollHorizontally(View v, boolean checkV, int dx, int x, int y) {
-        if (v instanceof ViewGroup) {
-            final ViewGroup group = (ViewGroup) v;
-
-            final int count = group.getChildCount();
-            // Count backwards - let topmost views consume scroll distance first.
-            for (int i = count - 1; i >= 0; i--) {
-                final View child = group.getChildAt(i);
-
-                final int childLeft = child.getLeft() + supportGetTranslationX(child);
-                final int childRight = child.getRight() + supportGetTranslationX(child);
-                final int childTop = child.getTop() + supportGetTranslationY(child);
-                final int childBottom = child.getBottom() + supportGetTranslationY(child);
-
-                if (x >= childLeft && x < childRight && y >= childTop && y < childBottom
-                        && canChildScrollHorizontally(child, true, dx, x - childLeft, y - childTop)) {
-                    return true;
-                }
-            }
-        }
-
-        return checkV && mOnInterceptMoveEventListener.isViewDraggable(v, dx, x, y);
-    }
-
-    /**
-     * Tests scrollability within child views of v given a delta of dx.
-     *
-     * @param v      View to test for horizontal scrollability
-     * @param checkV Whether the view should be checked for draggability
-     * @param dx     Delta scrolled in pixels
-     * @param x      X coordinate of the active touch point
-     * @param y      Y coordinate of the active touch point
-     * @return true if child views of v can be scrolled by delta of dx.
-     */
-    protected boolean canChildScrollVertically(View v, boolean checkV, int dx, int x, int y) {
-        if (v instanceof ViewGroup) {
-            final ViewGroup group = (ViewGroup) v;
-
-            final int count = group.getChildCount();
-            // Count backwards - let topmost views consume scroll distance first.
-            for (int i = count - 1; i >= 0; i--) {
-                final View child = group.getChildAt(i);
-
-                final int childLeft = child.getLeft() + supportGetTranslationX(child);
-                final int childRight = child.getRight() + supportGetTranslationX(child);
-                final int childTop = child.getTop() + supportGetTranslationY(child);
-                final int childBottom = child.getBottom() + supportGetTranslationY(child);
-
-                if (x >= childLeft && x < childRight && y >= childTop && y < childBottom
-                        && canChildScrollVertically(child, true, dx, x - childLeft, y - childTop)) {
-                    return true;
-                }
-            }
-        }
-
-        return checkV && mOnInterceptMoveEventListener.isViewDraggable(v, dx, x, y);
-    }
-
-    protected float getXVelocity(VelocityTracker velocityTracker) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
-            return velocityTracker.getXVelocity(mActivePointerId);
-        }
-
-        return velocityTracker.getXVelocity();
-    }
-
-    protected float getYVelocity(VelocityTracker velocityTracker) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
-            return velocityTracker.getYVelocity(mActivePointerId);
-        }
-
-        return velocityTracker.getYVelocity();
-    }
-
-    private int supportGetTranslationY(View v) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
-            return (int) v.getTranslationY();
-        }
-
-        return 0;
-    }
-
-    private int supportGetTranslationX(View v) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
-            return (int) v.getTranslationX();
-        }
-
-        return 0;
-    }
-
-    void saveState(Bundle state) {
-        final boolean menuVisible = mDrawerState == STATE_OPEN || mDrawerState == STATE_OPENING;
-        state.putBoolean(STATE_MENU_VISIBLE, menuVisible);
-    }
-
-    public void restoreState(Parcelable in) {
-        super.restoreState(in);
-        Bundle state = (Bundle) in;
-        final boolean menuOpen = state.getBoolean(STATE_MENU_VISIBLE);
-        if (menuOpen) {
-            openMenu(false);
-        } else {
-            setOffsetPixels(0);
-        }
-        mDrawerState = menuOpen ? STATE_OPEN : STATE_CLOSED;
-    }
-}

+ 0 - 175
librarymenudrawer/src/main/java/net/simonvt/menudrawer/FloatScroller.java

@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.simonvt.menudrawer;
-
-import android.view.animation.AnimationUtils;
-import android.view.animation.Interpolator;
-
-/**
- * This class encapsulates scrolling.  The duration of the scroll
- * can be passed in the constructor and specifies the maximum time that
- * the scrolling animation should take.  Past this time, the scrolling is
- * automatically moved to its final stage and computeScrollOffset()
- * will always return false to indicate that scrolling is over.
- */
-class FloatScroller {
-
-    private float mStart;
-    private float mFinal;
-
-    private float mCurr;
-    private long mStartTime;
-    private int mDuration;
-    private float mDurationReciprocal;
-    private float mDeltaX;
-    private boolean mFinished;
-    private Interpolator mInterpolator;
-
-    /**
-     * Create a Scroller with the specified interpolator. If the interpolator is
-     * null, the default (viscous) interpolator will be used. Specify whether or
-     * not to support progressive "flywheel" behavior in flinging.
-     */
-    public FloatScroller(Interpolator interpolator) {
-        mFinished = true;
-        mInterpolator = interpolator;
-    }
-
-    /**
-     * Returns whether the scroller has finished scrolling.
-     *
-     * @return True if the scroller has finished scrolling, false otherwise.
-     */
-    public final boolean isFinished() {
-        return mFinished;
-    }
-
-    /**
-     * Force the finished field to a particular value.
-     *
-     * @param finished The new finished value.
-     */
-    public final void forceFinished(boolean finished) {
-        mFinished = finished;
-    }
-
-    /**
-     * Returns how long the scroll event will take, in milliseconds.
-     *
-     * @return The duration of the scroll in milliseconds.
-     */
-    public final int getDuration() {
-        return mDuration;
-    }
-
-    /**
-     * Returns the current offset in the scroll.
-     *
-     * @return The new offset as an absolute distance from the origin.
-     */
-    public final float getCurr() {
-        return mCurr;
-    }
-
-    /**
-     * Returns the start offset in the scroll.
-     *
-     * @return The start offset as an absolute distance from the origin.
-     */
-    public final float getStart() {
-        return mStart;
-    }
-
-    /**
-     * Returns where the scroll will end. Valid only for "fling" scrolls.
-     *
-     * @return The final offset as an absolute distance from the origin.
-     */
-    public final float getFinal() {
-        return mFinal;
-    }
-
-    public boolean computeScrollOffset() {
-        if (mFinished) {
-            return false;
-        }
-
-        int timePassed = (int) (AnimationUtils.currentAnimationTimeMillis() - mStartTime);
-
-        if (timePassed < mDuration) {
-            float x = timePassed * mDurationReciprocal;
-            x = mInterpolator.getInterpolation(x);
-            mCurr = mStart + x * mDeltaX;
-
-        } else {
-            mCurr = mFinal;
-            mFinished = true;
-        }
-        return true;
-    }
-
-    public void startScroll(float start, float delta, int duration) {
-        mFinished = false;
-        mDuration = duration;
-        mStartTime = AnimationUtils.currentAnimationTimeMillis();
-        mStart = start;
-        mFinal = start + delta;
-        mDeltaX = delta;
-        mDurationReciprocal = 1.0f / (float) mDuration;
-    }
-
-    /**
-     * Stops the animation. Contrary to {@link #forceFinished(boolean)},
-     * aborting the animating cause the scroller to move to the final x and y
-     * position
-     *
-     * @see #forceFinished(boolean)
-     */
-    public void abortAnimation() {
-        mCurr = mFinal;
-        mFinished = true;
-    }
-
-    /**
-     * Extend the scroll animation. This allows a running animation to scroll
-     * further and longer, when used with {@link #setFinal(float)}.
-     *
-     * @param extend Additional time to scroll in milliseconds.
-     * @see #setFinal(float)
-     */
-    public void extendDuration(int extend) {
-        int passed = timePassed();
-        mDuration = passed + extend;
-        mDurationReciprocal = 1.0f / mDuration;
-        mFinished = false;
-    }
-
-    /**
-     * Returns the time elapsed since the beginning of the scrolling.
-     *
-     * @return The elapsed time in milliseconds.
-     */
-    public int timePassed() {
-        return (int) (AnimationUtils.currentAnimationTimeMillis() - mStartTime);
-    }
-
-    public void setFinal(float newVal) {
-        mFinal = newVal;
-        mDeltaX = mFinal - mStart;
-        mFinished = false;
-    }
-}

+ 0 - 1652
librarymenudrawer/src/main/java/net/simonvt/menudrawer/MenuDrawer.java

@@ -1,1652 +0,0 @@
-package net.simonvt.menudrawer;
-
-import net.simonvt.menudrawer.compat.ActionBarHelper;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.GradientDrawable;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewParent;
-import android.view.ViewTreeObserver;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.Interpolator;
-
-public abstract class MenuDrawer extends ViewGroup {
-
-    /**
-     * Callback interface for changing state of the drawer.
-     */
-    public interface OnDrawerStateChangeListener {
-
-        /**
-         * Called when the drawer state changes.
-         *
-         * @param oldState The old drawer state.
-         * @param newState The new drawer state.
-         */
-        void onDrawerStateChange(int oldState, int newState);
-
-        /**
-         * Called when the drawer slides.
-         *
-         * @param openRatio    Ratio for how open the menu is.
-         * @param offsetPixels Current offset of the menu in pixels.
-         */
-        void onDrawerSlide(float openRatio, int offsetPixels);
-    }
-
-    /**
-     * Callback that is invoked when the drawer is in the process of deciding whether it should intercept the touch
-     * event. This lets the listener decide if the pointer is on a view that would disallow dragging of the drawer.
-     * This is only called when the touch mode is {@link #TOUCH_MODE_FULLSCREEN}.
-     */
-    public interface OnInterceptMoveEventListener {
-
-        /**
-         * Called for each child the pointer i on when the drawer is deciding whether to intercept the touch event.
-         *
-         * @param v     View to test for draggability
-         * @param delta Delta drag in pixels
-         * @param x     X coordinate of the active touch point
-         * @param y     Y coordinate of the active touch point
-         * @return true if view is draggable by delta dx.
-         */
-        boolean isViewDraggable(View v, int delta, int x, int y);
-    }
-
-    public enum Type {
-        /**
-         * Positions the drawer behind the content.
-         */
-        BEHIND,
-
-        /**
-         * A static drawer that can not be dragged.
-         */
-        STATIC,
-
-        /**
-         * Positions the drawer on top of the content.
-         */
-        OVERLAY,
-    }
-
-    /**
-     * Tag used when logging.
-     */
-    private static final String TAG = "MenuDrawer";
-
-    /**
-     * Indicates whether debug code should be enabled.
-     */
-    private static final boolean DEBUG = false;
-
-    /**
-     * The time between each frame when animating the drawer.
-     */
-    protected static final int ANIMATION_DELAY = 1000 / 60;
-
-    /**
-     * The default touch bezel size of the drawer in dp.
-     */
-    private static final int DEFAULT_DRAG_BEZEL_DP = 24;
-
-    /**
-     * The default drop shadow size in dp.
-     */
-    private static final int DEFAULT_DROP_SHADOW_DP = 6;
-
-    /**
-     * Drag mode for sliding only the content view.
-     */
-    public static final int MENU_DRAG_CONTENT = 0;
-
-    /**
-     * Drag mode for sliding the entire window.
-     */
-    public static final int MENU_DRAG_WINDOW = 1;
-
-    /**
-     * Disallow opening the drawer by dragging the screen.
-     */
-    public static final int TOUCH_MODE_NONE = 0;
-
-    /**
-     * Allow opening drawer only by dragging on the edge of the screen.
-     */
-    public static final int TOUCH_MODE_BEZEL = 1;
-
-    /**
-     * Allow opening drawer by dragging anywhere on the screen.
-     */
-    public static final int TOUCH_MODE_FULLSCREEN = 2;
-
-    /**
-     * Indicates that the drawer is currently closed.
-     */
-    public static final int STATE_CLOSED = 0;
-
-    /**
-     * Indicates that the drawer is currently closing.
-     */
-    public static final int STATE_CLOSING = 1;
-
-    /**
-     * Indicates that the drawer is currently being dragged by the user.
-     */
-    public static final int STATE_DRAGGING = 2;
-
-    /**
-     * Indicates that the drawer is currently opening.
-     */
-    public static final int STATE_OPENING = 4;
-
-    /**
-     * Indicates that the drawer is currently open.
-     */
-    public static final int STATE_OPEN = 8;
-
-    /**
-     * Indicates whether to use {@link View#setTranslationX(float)} when positioning views.
-     */
-    static final boolean USE_TRANSLATIONS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
-
-    /**
-     * Time to animate the indicator to the new active view.
-     */
-    static final int INDICATOR_ANIM_DURATION = 800;
-
-    /**
-     * The maximum animation duration.
-     */
-    private static final int DEFAULT_ANIMATION_DURATION = 600;
-
-    /**
-     * Interpolator used when animating the drawer open/closed.
-     */
-    protected static final Interpolator SMOOTH_INTERPOLATOR = new SmoothInterpolator();
-
-    /**
-     * Interpolator used for stretching/retracting the active indicator.
-     */
-    protected static final Interpolator INDICATOR_INTERPOLATOR = new AccelerateInterpolator();
-
-    /**
-     * Drawable used as menu overlay.
-     */
-    protected Drawable mMenuOverlay;
-
-    /**
-     * Defines whether the drop shadow is enabled.
-     */
-    protected boolean mDropShadowEnabled;
-
-    /**
-     * The color of the drop shadow.
-     */
-    protected int mDropShadowColor;
-
-    /**
-     * Drawable used as content drop shadow onto the menu.
-     */
-    protected Drawable mDropShadowDrawable;
-
-    private boolean mCustomDropShadow;
-
-    /**
-     * The size of the content drop shadow.
-     */
-    protected int mDropShadowSize;
-
-    /**
-     * Bitmap used to indicate the active view.
-     */
-    protected Bitmap mActiveIndicator;
-
-    /**
-     * The currently active view.
-     */
-    protected View mActiveView;
-
-    /**
-     * Position of the active view. This is compared to View#getTag(R.id.mdActiveViewPosition) when drawing the
-     * indicator.
-     */
-    protected int mActivePosition;
-
-    /**
-     * Whether the indicator should be animated between positions.
-     */
-    private boolean mAllowIndicatorAnimation;
-
-    /**
-     * Used when reading the position of the active view.
-     */
-    protected final Rect mActiveRect = new Rect();
-
-    /**
-     * Temporary {@link Rect} used for deciding whether the view should be invalidated so the indicator can be redrawn.
-     */
-    private final Rect mTempRect = new Rect();
-
-    /**
-     * The custom menu view set by the user.
-     */
-    private View mMenuView;
-
-    /**
-     * The parent of the menu view.
-     */
-    protected BuildLayerFrameLayout mMenuContainer;
-
-    /**
-     * The parent of the content view.
-     */
-    protected BuildLayerFrameLayout mContentContainer;
-
-    /**
-     * The size of the menu (width or height depending on the gravity).
-     */
-    protected int mMenuSize;
-
-    /**
-     * Indicates whether the menu is currently visible.
-     */
-    protected boolean mMenuVisible;
-
-    /**
-     * The drag mode of the drawer. Can be either {@link #MENU_DRAG_CONTENT} or {@link #MENU_DRAG_WINDOW}.
-     */
-    private int mDragMode = MENU_DRAG_CONTENT;
-
-    /**
-     * The current drawer state.
-     *
-     * @see #STATE_CLOSED
-     * @see #STATE_CLOSING
-     * @see #STATE_DRAGGING
-     * @see #STATE_OPENING
-     * @see #STATE_OPEN
-     */
-    protected int mDrawerState = STATE_CLOSED;
-
-    /**
-     * The touch bezel size of the drawer in px.
-     */
-    protected int mTouchBezelSize;
-
-    /**
-     * The touch area size of the drawer in px.
-     */
-    protected int mTouchSize;
-
-    /**
-     * Listener used to dispatch state change events.
-     */
-    private OnDrawerStateChangeListener mOnDrawerStateChangeListener;
-
-    /**
-     * Touch mode for the Drawer.
-     * Possible values are {@link #TOUCH_MODE_NONE}, {@link #TOUCH_MODE_BEZEL} or {@link #TOUCH_MODE_FULLSCREEN}
-     * Default: {@link #TOUCH_MODE_BEZEL}
-     */
-    protected int mTouchMode = TOUCH_MODE_BEZEL;
-
-    /**
-     * Indicates whether to use {@link View#LAYER_TYPE_HARDWARE} when animating the drawer.
-     */
-    protected boolean mHardwareLayersEnabled = true;
-
-    /**
-     * The Activity the drawer is attached to.
-     */
-    private Activity mActivity;
-
-    /**
-     * Scroller used when animating the indicator to a new position.
-     */
-    private FloatScroller mIndicatorScroller;
-
-    /**
-     * Runnable used when animating the indicator to a new position.
-     */
-    private Runnable mIndicatorRunnable = new Runnable() {
-        @Override
-        public void run() {
-            animateIndicatorInvalidate();
-        }
-    };
-
-    /**
-     * The start position of the indicator when animating it to a new position.
-     */
-    protected int mIndicatorStartPos;
-
-    /**
-     * [0..1] value indicating the current progress of the animation.
-     */
-    protected float mIndicatorOffset;
-
-    /**
-     * Whether the indicator is currently animating.
-     */
-    protected boolean mIndicatorAnimating;
-
-    /**
-     * Bundle used to hold the drawers state.
-     */
-    protected Bundle mState;
-
-    /**
-     * The maximum duration of open/close animations.
-     */
-    protected int mMaxAnimationDuration = DEFAULT_ANIMATION_DURATION;
-
-    /**
-     * Callback that lets the listener override intercepting of touch events.
-     */
-    protected OnInterceptMoveEventListener mOnInterceptMoveEventListener;
-
-    protected SlideDrawable mSlideDrawable;
-
-    protected Drawable mThemeUpIndicator;
-
-    protected boolean mDrawerIndicatorEnabled;
-
-    private ActionBarHelper mActionBarHelper;
-
-    private int mCurrentUpContentDesc;
-
-    private int mDrawerOpenContentDesc;
-
-    private int mDrawerClosedContentDesc;
-
-    /**
-     * The position of the drawer.
-     */
-    private Position mPosition;
-
-    private Position mResolvedPosition;
-
-    private final Rect mIndicatorClipRect = new Rect();
-
-    protected boolean mIsStatic;
-
-    protected final Rect mDropShadowRect = new Rect();
-
-    /**
-     * Current offset.
-     */
-    protected float mOffsetPixels;
-
-    /**
-     * Whether an overlay should be drawn as the drawer is opened and closed.
-     */
-    protected boolean mDrawOverlay;
-
-    /**
-     * Attaches the MenuDrawer to the Activity.
-     *
-     * @param activity The activity that the MenuDrawer will be attached to.
-     * @return The created MenuDrawer instance.
-     */
-    public static MenuDrawer attach(Activity activity) {
-        return attach(activity, Type.BEHIND);
-    }
-
-    /**
-     * Attaches the MenuDrawer to the Activity.
-     *
-     * @param activity The activity the menu drawer will be attached to.
-     * @param type     The {@link Type} of the drawer.
-     * @return The created MenuDrawer instance.
-     */
-    public static MenuDrawer attach(Activity activity, Type type) {
-        return attach(activity, type, Position.START);
-    }
-
-    /**
-     * Attaches the MenuDrawer to the Activity.
-     *
-     * @param activity The activity the menu drawer will be attached to.
-     * @param position Where to position the menu.
-     * @return The created MenuDrawer instance.
-     */
-    public static MenuDrawer attach(Activity activity, Position position) {
-        return attach(activity, Type.BEHIND, position);
-    }
-
-    /**
-     * Attaches the MenuDrawer to the Activity.
-     *
-     * @param activity The activity the menu drawer will be attached to.
-     * @param type     The {@link Type} of the drawer.
-     * @param position Where to position the menu.
-     * @return The created MenuDrawer instance.
-     */
-    public static MenuDrawer attach(Activity activity, Type type, Position position) {
-        return attach(activity, type, position, MENU_DRAG_CONTENT);
-    }
-
-    /**
-     * Attaches the MenuDrawer to the Activity.
-     *
-     * @param activity The activity the menu drawer will be attached to.
-     * @param type     The {@link Type} of the drawer.
-     * @param position Where to position the menu.
-     * @param dragMode The drag mode of the drawer. Can be either {@link MenuDrawer#MENU_DRAG_CONTENT}
-     *                 or {@link MenuDrawer#MENU_DRAG_WINDOW}.
-     * @return The created MenuDrawer instance.
-     */
-    public static MenuDrawer attach(Activity activity, Type type, Position position, int dragMode) {
-        MenuDrawer menuDrawer = createMenuDrawer(activity, dragMode, position, type);
-        menuDrawer.setId(R.id.md__drawer);
-
-        switch (dragMode) {
-            case MenuDrawer.MENU_DRAG_CONTENT:
-                attachToContent(activity, menuDrawer);
-                break;
-
-            case MenuDrawer.MENU_DRAG_WINDOW:
-                attachToDecor(activity, menuDrawer);
-                break;
-
-            default:
-                throw new RuntimeException("Unknown menu mode: " + dragMode);
-        }
-
-        return menuDrawer;
-    }
-
-    /**
-     * Constructs the appropriate MenuDrawer based on the position.
-     */
-    private static MenuDrawer createMenuDrawer(Activity activity, int dragMode, Position position, Type type) {
-        MenuDrawer drawer;
-
-        if (type == Type.STATIC) {
-            drawer = new StaticDrawer(activity);
-
-        } else if (type == Type.OVERLAY) {
-            drawer = new OverlayDrawer(activity, dragMode);
-            if (position == Position.LEFT || position == Position.START) {
-                drawer.setupUpIndicator(activity);
-            }
-
-        } else {
-            drawer = new SlidingDrawer(activity, dragMode);
-            if (position == Position.LEFT || position == Position.START) {
-                drawer.setupUpIndicator(activity);
-            }
-        }
-
-        drawer.mDragMode = dragMode;
-        drawer.setPosition(position);
-
-        return drawer;
-    }
-
-    /**
-     * Attaches the menu drawer to the content view.
-     */
-    private static void attachToContent(Activity activity, MenuDrawer menuDrawer) {
-        /**
-         * Do not call mActivity#setContentView.
-         * E.g. if using with a ListActivity, Activity#setContentView is overridden and dispatched to
-         * MenuDrawer#setContentView, which then again would call Activity#setContentView.
-         */
-        ViewGroup content = (ViewGroup) activity.findViewById(android.R.id.content);
-        content.removeAllViews();
-        content.addView(menuDrawer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
-    }
-
-    /**
-     * Attaches the menu drawer to the window.
-     */
-    private static void attachToDecor(Activity activity, MenuDrawer menuDrawer) {
-        ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
-        ViewGroup decorChild = (ViewGroup) decorView.getChildAt(0);
-
-        decorView.removeAllViews();
-        decorView.addView(menuDrawer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
-
-        menuDrawer.mContentContainer.addView(decorChild, decorChild.getLayoutParams());
-    }
-
-    MenuDrawer(Activity activity, int dragMode) {
-        this(activity);
-
-        mActivity = activity;
-        mDragMode = dragMode;
-    }
-
-    public MenuDrawer(Context context) {
-        this(context, null);
-    }
-
-    public MenuDrawer(Context context, AttributeSet attrs) {
-        this(context, attrs, R.attr.menuDrawerStyle);
-    }
-
-    public MenuDrawer(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-        initDrawer(context, attrs, defStyle);
-    }
-
-    protected void initDrawer(Context context, AttributeSet attrs, int defStyle) {
-        setWillNotDraw(false);
-        setFocusable(false);
-
-        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MenuDrawer, R.attr.menuDrawerStyle,
-                R.style.Widget_MenuDrawer);
-
-        final Drawable contentBackground = a.getDrawable(R.styleable.MenuDrawer_mdContentBackground);
-        final Drawable menuBackground = a.getDrawable(R.styleable.MenuDrawer_mdMenuBackground);
-
-        mMenuSize = a.getDimensionPixelSize(R.styleable.MenuDrawer_mdMenuSize, dpToPx(240));
-
-        final int indicatorResId = a.getResourceId(R.styleable.MenuDrawer_mdActiveIndicator, 0);
-        if (indicatorResId != 0) {
-            mActiveIndicator = BitmapFactory.decodeResource(getResources(), indicatorResId);
-        }
-
-        mDropShadowEnabled = a.getBoolean(R.styleable.MenuDrawer_mdDropShadowEnabled, true);
-
-        mDropShadowDrawable = a.getDrawable(R.styleable.MenuDrawer_mdDropShadow);
-
-        if (mDropShadowDrawable == null) {
-            mDropShadowColor = a.getColor(R.styleable.MenuDrawer_mdDropShadowColor, 0xFF000000);
-        } else {
-            mCustomDropShadow = true;
-        }
-
-        mDropShadowSize = a.getDimensionPixelSize(R.styleable.MenuDrawer_mdDropShadowSize,
-                dpToPx(DEFAULT_DROP_SHADOW_DP));
-
-        mTouchBezelSize = a.getDimensionPixelSize(R.styleable.MenuDrawer_mdTouchBezelSize,
-                dpToPx(DEFAULT_DRAG_BEZEL_DP));
-
-        mAllowIndicatorAnimation = a.getBoolean(R.styleable.MenuDrawer_mdAllowIndicatorAnimation, false);
-
-        mMaxAnimationDuration = a.getInt(R.styleable.MenuDrawer_mdMaxAnimationDuration, DEFAULT_ANIMATION_DURATION);
-
-        final int slideDrawableResId = a.getResourceId(R.styleable.MenuDrawer_mdSlideDrawable, -1);
-        if (slideDrawableResId != -1) {
-            setSlideDrawable(slideDrawableResId);
-        }
-
-        mDrawerOpenContentDesc = a.getResourceId(R.styleable.MenuDrawer_mdDrawerOpenUpContentDescription, 0);
-        mDrawerClosedContentDesc = a.getResourceId(R.styleable.MenuDrawer_mdDrawerClosedUpContentDescription, 0);
-
-        mDrawOverlay = a.getBoolean(R.styleable.MenuDrawer_mdDrawOverlay, true);
-
-        final int position = a.getInt(R.styleable.MenuDrawer_mdPosition, 0);
-        setPosition(Position.fromValue(position));
-
-        a.recycle();
-
-        mMenuContainer = new NoClickThroughFrameLayout(context);
-        mMenuContainer.setId(R.id.md__menu);
-        mMenuContainer.setBackgroundDrawable(menuBackground);
-
-        mContentContainer = new NoClickThroughFrameLayout(context);
-        mContentContainer.setId(R.id.md__content);
-        mContentContainer.setBackgroundDrawable(contentBackground);
-
-        mMenuOverlay = new ColorDrawable(0xFF000000);
-
-        mIndicatorScroller = new FloatScroller(SMOOTH_INTERPOLATOR);
-    }
-
-    @Override
-    protected void onFinishInflate() {
-        super.onFinishInflate();
-        View menu = findViewById(R.id.mdMenu);
-        if (menu != null) {
-            removeView(menu);
-            setMenuView(menu);
-        }
-
-        View content = findViewById(R.id.mdContent);
-        if (content != null) {
-            removeView(content);
-            setContentView(content);
-        }
-
-        if (getChildCount() > 2) {
-            throw new IllegalStateException(
-                    "Menu and content view added in xml must have id's @id/mdMenu and @id/mdContent");
-        }
-    }
-
-    protected int dpToPx(int dp) {
-        return (int) (getResources().getDisplayMetrics().density * dp + 0.5f);
-    }
-
-    protected boolean isViewDescendant(View v) {
-        ViewParent parent = v.getParent();
-        while (parent != null) {
-            if (parent == this) {
-                return true;
-            }
-
-            parent = parent.getParent();
-        }
-
-        return false;
-    }
-
-    @Override
-    protected void onAttachedToWindow() {
-        super.onAttachedToWindow();
-        getViewTreeObserver().addOnScrollChangedListener(mScrollListener);
-    }
-
-    @Override
-    protected void onDetachedFromWindow() {
-        getViewTreeObserver().removeOnScrollChangedListener(mScrollListener);
-        super.onDetachedFromWindow();
-    }
-
-    private boolean shouldDrawIndicator() {
-        return mActiveView != null && mActiveIndicator != null && isViewDescendant(mActiveView);
-    }
-
-    @Override
-    protected void dispatchDraw(Canvas canvas) {
-        super.dispatchDraw(canvas);
-        final int offsetPixels = (int) mOffsetPixels;
-
-        if (mDrawOverlay && offsetPixels != 0) {
-            drawOverlay(canvas);
-        }
-        if (mDropShadowEnabled && (offsetPixels != 0 || mIsStatic)) {
-            drawDropShadow(canvas);
-        }
-        if (shouldDrawIndicator() && (offsetPixels != 0 || mIsStatic)) {
-            drawIndicator(canvas);
-        }
-    }
-
-    protected abstract void drawOverlay(Canvas canvas);
-
-    private void drawDropShadow(Canvas canvas) {
-        // Can't pass the position to the constructor, so wait with loading the drawable until the drop shadow is
-        // actually drawn.
-        if (mDropShadowDrawable == null) {
-            setDropShadowColor(mDropShadowColor);
-        }
-
-        updateDropShadowRect();
-        mDropShadowDrawable.setBounds(mDropShadowRect);
-        mDropShadowDrawable.draw(canvas);
-    }
-
-    protected void updateDropShadowRect() {
-        // This updates the rect for the static and sliding drawer. The overlay drawer has its own implementation.
-        switch (getPosition()) {
-            case LEFT:
-                mDropShadowRect.top = 0;
-                mDropShadowRect.bottom = getHeight();
-                mDropShadowRect.right = ViewHelper.getLeft(mContentContainer);
-                mDropShadowRect.left = mDropShadowRect.right - mDropShadowSize;
-                break;
-
-            case TOP:
-                mDropShadowRect.left = 0;
-                mDropShadowRect.right = getWidth();
-                mDropShadowRect.bottom = ViewHelper.getTop(mContentContainer);
-                mDropShadowRect.top = mDropShadowRect.bottom - mDropShadowSize;
-                break;
-
-            case RIGHT:
-                mDropShadowRect.top = 0;
-                mDropShadowRect.bottom = getHeight();
-                mDropShadowRect.left = ViewHelper.getRight(mContentContainer);
-                mDropShadowRect.right = mDropShadowRect.left + mDropShadowSize;
-                break;
-
-            case BOTTOM:
-                mDropShadowRect.left = 0;
-                mDropShadowRect.right = getWidth();
-                mDropShadowRect.top = ViewHelper.getBottom(mContentContainer);
-                mDropShadowRect.bottom = mDropShadowRect.top + mDropShadowSize;
-                break;
-        }
-    }
-
-    private void drawIndicator(Canvas canvas) {
-        Integer position = (Integer) mActiveView.getTag(R.id.mdActiveViewPosition);
-        final int pos = position == null ? 0 : position;
-        if (pos == mActivePosition) {
-            updateIndicatorClipRect();
-            canvas.save();
-            canvas.clipRect(mIndicatorClipRect);
-
-            int drawLeft = 0;
-            int drawTop = 0;
-            switch (getPosition()) {
-                case LEFT:
-                case TOP:
-                    drawLeft = mIndicatorClipRect.left;
-                    drawTop = mIndicatorClipRect.top;
-                    break;
-
-                case RIGHT:
-                    drawLeft = mIndicatorClipRect.right - mActiveIndicator.getWidth();
-                    drawTop = mIndicatorClipRect.top;
-                    break;
-
-                case BOTTOM:
-                    drawLeft = mIndicatorClipRect.left;
-                    drawTop = mIndicatorClipRect.bottom - mActiveIndicator.getHeight();
-            }
-
-            canvas.drawBitmap(mActiveIndicator, drawLeft, drawTop, null);
-            canvas.restore();
-        }
-    }
-
-    /**
-     * Update the {@link Rect} where the indicator is drawn.
-     */
-    protected void updateIndicatorClipRect() {
-        mActiveView.getDrawingRect(mActiveRect);
-        offsetDescendantRectToMyCoords(mActiveView, mActiveRect);
-
-        final float openRatio = mIsStatic ? 1.0f : Math.abs(mOffsetPixels) / mMenuSize;
-
-        final float interpolatedRatio = 1.f - INDICATOR_INTERPOLATOR.getInterpolation((1.f - openRatio));
-
-        final int indicatorWidth = mActiveIndicator.getWidth();
-        final int indicatorHeight = mActiveIndicator.getHeight();
-
-        final int interpolatedWidth = (int) (indicatorWidth * interpolatedRatio);
-        final int interpolatedHeight = (int) (indicatorHeight * interpolatedRatio);
-
-        final int startPos = mIndicatorStartPos;
-
-        int left = 0;
-        int top = 0;
-        int right = 0;
-        int bottom = 0;
-
-        switch (getPosition()) {
-            case LEFT:
-            case RIGHT:
-                final int finalTop = mActiveRect.top + ((mActiveRect.height() - indicatorHeight) / 2);
-                if (mIndicatorAnimating) {
-                    top = (int) (startPos + ((finalTop - startPos) * mIndicatorOffset));
-                } else {
-                    top = finalTop;
-                }
-                bottom = top + indicatorHeight;
-                break;
-
-            case TOP:
-            case BOTTOM:
-                final int finalLeft = mActiveRect.left + ((mActiveRect.width() - indicatorWidth) / 2);
-                if (mIndicatorAnimating) {
-                    left = (int) (startPos + ((finalLeft - startPos) * mIndicatorOffset));
-                } else {
-                    left = finalLeft;
-                }
-                right = left + indicatorWidth;
-                break;
-        }
-
-        switch (getPosition()) {
-            case LEFT: {
-                right = ViewHelper.getLeft(mContentContainer);
-                left = right - interpolatedWidth;
-                break;
-            }
-
-            case TOP: {
-                bottom = ViewHelper.getTop(mContentContainer);
-                top = bottom - interpolatedHeight;
-                break;
-            }
-
-            case RIGHT: {
-                left = ViewHelper.getRight(mContentContainer);
-                right = left + interpolatedWidth;
-                break;
-            }
-
-            case BOTTOM: {
-                top = ViewHelper.getBottom(mContentContainer);
-                bottom = top + interpolatedHeight;
-                break;
-            }
-        }
-
-        mIndicatorClipRect.left = left;
-        mIndicatorClipRect.top = top;
-        mIndicatorClipRect.right = right;
-        mIndicatorClipRect.bottom = bottom;
-    }
-
-    private void setPosition(Position position) {
-        mPosition = position;
-        mResolvedPosition = getPosition();
-    }
-
-    protected Position getPosition() {
-        final int layoutDirection = ViewHelper.getLayoutDirection(this);
-
-        switch (mPosition) {
-            case START:
-                if (layoutDirection == LAYOUT_DIRECTION_RTL) {
-                    return Position.RIGHT;
-                } else {
-                    return Position.LEFT;
-                }
-
-            case END:
-                if (layoutDirection == LAYOUT_DIRECTION_RTL) {
-                    return Position.LEFT;
-                } else {
-                    return Position.RIGHT;
-                }
-        }
-
-        return mPosition;
-    }
-
-    @Override
-    public void onRtlPropertiesChanged(int layoutDirection) {
-        super.onRtlPropertiesChanged(layoutDirection);
-
-        if (!mCustomDropShadow) setDropShadowColor(mDropShadowColor);
-
-        if (getPosition() != mResolvedPosition) {
-            mResolvedPosition = getPosition();
-            setOffsetPixels(mOffsetPixels * -1);
-        }
-
-        if (mSlideDrawable != null) mSlideDrawable.setIsRtl(layoutDirection == LAYOUT_DIRECTION_RTL);
-
-        requestLayout();
-        invalidate();
-    }
-
-    /**
-     * Sets the number of pixels the content should be offset.
-     *
-     * @param offsetPixels The number of pixels to offset the content by.
-     */
-    protected void setOffsetPixels(float offsetPixels) {
-        final int oldOffset = (int) mOffsetPixels;
-        final int newOffset = (int) offsetPixels;
-
-        mOffsetPixels = offsetPixels;
-
-        if (mSlideDrawable != null) {
-            final float offset = Math.abs(mOffsetPixels) / mMenuSize;
-            mSlideDrawable.setOffset(offset);
-            updateUpContentDescription();
-        }
-
-        if (newOffset != oldOffset) {
-            onOffsetPixelsChanged(newOffset);
-            mMenuVisible = newOffset != 0;
-
-            // Notify any attached listeners of the current open ratio
-            final float openRatio = ((float) Math.abs(newOffset)) / mMenuSize;
-            dispatchOnDrawerSlide(openRatio, newOffset);
-        }
-    }
-
-    /**
-     * Called when the number of pixels the content should be offset by has changed.
-     *
-     * @param offsetPixels The number of pixels to offset the content by.
-     */
-    protected abstract void onOffsetPixelsChanged(int offsetPixels);
-
-    /**
-     * Toggles the menu open and close with animation.
-     */
-    public void toggleMenu() {
-        toggleMenu(true);
-    }
-
-    /**
-     * Toggles the menu open and close.
-     *
-     * @param animate Whether open/close should be animated.
-     */
-    public abstract void toggleMenu(boolean animate);
-
-    /**
-     * Animates the menu open.
-     */
-    public void openMenu() {
-        openMenu(true);
-    }
-
-    /**
-     * Opens the menu.
-     *
-     * @param animate Whether open/close should be animated.
-     */
-    public abstract void openMenu(boolean animate);
-
-    /**
-     * Animates the menu closed.
-     */
-    public void closeMenu() {
-        closeMenu(true);
-    }
-
-    /**
-     * Closes the menu.
-     *
-     * @param animate Whether open/close should be animated.
-     */
-    public abstract void closeMenu(boolean animate);
-
-    /**
-     * Indicates whether the menu is currently visible.
-     *
-     * @return True if the menu is open, false otherwise.
-     */
-    public abstract boolean isMenuVisible();
-
-    /**
-     * Set the size of the menu drawer when open.
-     *
-     * @param size The size of the menu.
-     */
-    public abstract void setMenuSize(int size);
-
-    /**
-     * Returns the size of the menu.
-     *
-     * @return The size of the menu.
-     */
-    public int getMenuSize() {
-        return mMenuSize;
-    }
-
-    /**
-     * Set the active view.
-     * If the mdActiveIndicator attribute is set, this View will have the indicator drawn next to it.
-     *
-     * @param v The active view.
-     */
-    public void setActiveView(View v) {
-        setActiveView(v, 0);
-    }
-
-    /**
-     * Set the active view.
-     * If the mdActiveIndicator attribute is set, this View will have the indicator drawn next to it.
-     *
-     * @param v        The active view.
-     * @param position Optional position, usually used with ListView. v.setTag(R.id.mdActiveViewPosition, position)
-     *                 must be called first.
-     */
-    public void setActiveView(View v, int position) {
-        final View oldView = mActiveView;
-        mActiveView = v;
-        mActivePosition = position;
-
-        if (mAllowIndicatorAnimation && oldView != null) {
-            startAnimatingIndicator();
-        }
-
-        invalidate();
-    }
-
-    /**
-     * Sets whether the indicator should be animated between active views.
-     *
-     * @param animate Whether the indicator should be animated between active views.
-     */
-    public void setAllowIndicatorAnimation(boolean animate) {
-        if (animate != mAllowIndicatorAnimation) {
-            mAllowIndicatorAnimation = animate;
-            completeAnimatingIndicator();
-        }
-    }
-
-    /**
-     * Indicates whether the indicator should be animated between active views.
-     *
-     * @return Whether the indicator should be animated between active views.
-     */
-    public boolean getAllowIndicatorAnimation() {
-        return mAllowIndicatorAnimation;
-    }
-
-    /**
-     * Scroll listener that checks whether the active view has moved before the drawer is invalidated.
-     */
-    private ViewTreeObserver.OnScrollChangedListener mScrollListener = new ViewTreeObserver.OnScrollChangedListener() {
-        @Override
-        public void onScrollChanged() {
-            if (mActiveView != null && isViewDescendant(mActiveView)) {
-                mActiveView.getDrawingRect(mTempRect);
-                offsetDescendantRectToMyCoords(mActiveView, mTempRect);
-                if (mTempRect.left != mActiveRect.left || mTempRect.top != mActiveRect.top
-                        || mTempRect.right != mActiveRect.right || mTempRect.bottom != mActiveRect.bottom) {
-                    invalidate();
-                }
-            }
-        }
-    };
-
-    /**
-     * Starts animating the indicator to a new position.
-     */
-    private void startAnimatingIndicator() {
-        mIndicatorStartPos = getIndicatorStartPos();
-        mIndicatorAnimating = true;
-        mIndicatorScroller.startScroll(0.0f, 1.0f, INDICATOR_ANIM_DURATION);
-
-        animateIndicatorInvalidate();
-    }
-
-    /**
-     * Returns the start position of the indicator.
-     *
-     * @return The start position of the indicator.
-     */
-    private int getIndicatorStartPos() {
-        switch (getPosition()) {
-            case TOP:
-                return mIndicatorClipRect.left;
-            case RIGHT:
-                return mIndicatorClipRect.top;
-            case BOTTOM:
-                return mIndicatorClipRect.left;
-            default:
-                return mIndicatorClipRect.top;
-        }
-    }
-
-    /**
-     * Compute the touch area based on the touch mode.
-     */
-    protected void updateTouchAreaSize() {
-        if (mTouchMode == TOUCH_MODE_BEZEL) {
-            mTouchSize = mTouchBezelSize;
-        } else if (mTouchMode == TOUCH_MODE_FULLSCREEN) {
-            mTouchSize = getMeasuredWidth();
-        } else {
-            mTouchSize = 0;
-        }
-    }
-
-    /**
-     * Callback when each frame in the indicator animation should be drawn.
-     */
-    private void animateIndicatorInvalidate() {
-        if (mIndicatorScroller.computeScrollOffset()) {
-            mIndicatorOffset = mIndicatorScroller.getCurr();
-            invalidate();
-
-            if (!mIndicatorScroller.isFinished()) {
-                postOnAnimation(mIndicatorRunnable);
-                return;
-            }
-        }
-
-        completeAnimatingIndicator();
-    }
-
-    /**
-     * Called when the indicator animation has completed.
-     */
-    private void completeAnimatingIndicator() {
-        mIndicatorOffset = 1.0f;
-        mIndicatorAnimating = false;
-        invalidate();
-    }
-
-    /**
-     * Enables or disables offsetting the menu when dragging the drawer.
-     *
-     * @param offsetMenu True to offset the menu, false otherwise.
-     */
-    public abstract void setOffsetMenuEnabled(boolean offsetMenu);
-
-    /**
-     * Indicates whether the menu is being offset when dragging the drawer.
-     *
-     * @return True if the menu is being offset, false otherwise.
-     */
-    public abstract boolean getOffsetMenuEnabled();
-
-    /**
-     * Get the current state of the drawer.
-     *
-     * @return The state of the drawer.
-     */
-    public int getDrawerState() {
-        return mDrawerState;
-    }
-
-    /**
-     * Register a callback to be invoked when the drawer state changes.
-     *
-     * @param listener The callback that will run.
-     */
-    public void setOnDrawerStateChangeListener(OnDrawerStateChangeListener listener) {
-        mOnDrawerStateChangeListener = listener;
-    }
-
-    /**
-     * Register a callback that will be invoked when the drawer is about to intercept touch events.
-     *
-     * @param listener The callback that will be invoked.
-     */
-    public void setOnInterceptMoveEventListener(OnInterceptMoveEventListener listener) {
-        mOnInterceptMoveEventListener = listener;
-    }
-
-    /**
-     * Defines whether the drop shadow is enabled.
-     *
-     * @param enabled Whether the drop shadow is enabled.
-     */
-    public void setDropShadowEnabled(boolean enabled) {
-        mDropShadowEnabled = enabled;
-        invalidate();
-    }
-
-    protected GradientDrawable.Orientation getDropShadowOrientation() {
-        // Gets the orientation for the static and sliding drawer. The overlay drawer provides its own implementation.
-        switch (getPosition()) {
-            case TOP:
-                return GradientDrawable.Orientation.BOTTOM_TOP;
-
-            case RIGHT:
-                return GradientDrawable.Orientation.LEFT_RIGHT;
-
-            case BOTTOM:
-                return GradientDrawable.Orientation.TOP_BOTTOM;
-
-            default:
-                return GradientDrawable.Orientation.RIGHT_LEFT;
-        }
-    }
-
-    /**
-     * Sets the color of the drop shadow.
-     *
-     * @param color The color of the drop shadow.
-     */
-    public void setDropShadowColor(int color) {
-        GradientDrawable.Orientation orientation = getDropShadowOrientation();
-
-        final int endColor = color & 0x00FFFFFF;
-        mDropShadowDrawable = new GradientDrawable(orientation,
-                new int[] {
-                        color,
-                        endColor,
-                });
-        invalidate();
-    }
-
-    /**
-     * Sets the drawable of the drop shadow.
-     *
-     * @param drawable The drawable of the drop shadow.
-     */
-    public void setDropShadow(Drawable drawable) {
-        mDropShadowDrawable = drawable;
-        mCustomDropShadow = drawable != null;
-        invalidate();
-    }
-
-    /**
-     * Sets the drawable of the drop shadow.
-     *
-     * @param resId The resource identifier of the the drawable.
-     */
-    public void setDropShadow(int resId) {
-        setDropShadow(getResources().getDrawable(resId));
-    }
-
-    /**
-     * Returns the drawable of the drop shadow.
-     */
-    public Drawable getDropShadow() {
-        return mDropShadowDrawable;
-    }
-
-    /**
-     * Sets the size of the drop shadow.
-     *
-     * @param size The size of the drop shadow in px.
-     */
-    public void setDropShadowSize(int size) {
-        mDropShadowSize = size;
-        invalidate();
-    }
-
-    /**
-     * Animates the drawer slightly open until the user opens the drawer.
-     */
-    public abstract void peekDrawer();
-
-    /**
-     * Animates the drawer slightly open. If delay is larger than 0, this happens until the user opens the drawer.
-     *
-     * @param delay The delay (in milliseconds) between each run of the animation. If 0, this animation is only run
-     *              once.
-     */
-    public abstract void peekDrawer(long delay);
-
-    /**
-     * Animates the drawer slightly open. If delay is larger than 0, this happens until the user opens the drawer.
-     *
-     * @param startDelay The delay (in milliseconds) until the animation is first run.
-     * @param delay      The delay (in milliseconds) between each run of the animation. If 0, this animation is only run
-     *                   once.
-     */
-    public abstract void peekDrawer(long startDelay, long delay);
-
-    /**
-     * Enables or disables the user of {@link View#LAYER_TYPE_HARDWARE} when animations views.
-     *
-     * @param enabled Whether hardware layers are enabled.
-     */
-    public abstract void setHardwareLayerEnabled(boolean enabled);
-
-    /**
-     * Sets the maximum duration of open/close animations.
-     *
-     * @param duration The maximum duration in milliseconds.
-     */
-    public void setMaxAnimationDuration(int duration) {
-        mMaxAnimationDuration = duration;
-    }
-
-    /**
-     * Sets whether an overlay should be drawn when sliding the drawer.
-     *
-     * @param drawOverlay Whether an overlay should be drawn when sliding the drawer.
-     */
-    public void setDrawOverlay(boolean drawOverlay) {
-        mDrawOverlay = drawOverlay;
-    }
-
-    /**
-     * Gets whether an overlay is drawn when sliding the drawer.
-     *
-     * @return Whether an overlay is drawn when sliding the drawer.
-     */
-    public boolean getDrawOverlay() {
-        return mDrawOverlay;
-    }
-
-    protected void updateUpContentDescription() {
-        final int upContentDesc = isMenuVisible() ? mDrawerOpenContentDesc : mDrawerClosedContentDesc;
-        if (mDrawerIndicatorEnabled && mActionBarHelper != null && upContentDesc != mCurrentUpContentDesc) {
-            mCurrentUpContentDesc = upContentDesc;
-            mActionBarHelper.setActionBarDescription(upContentDesc);
-        }
-    }
-
-    /**
-     * Sets the drawable used as the drawer indicator.
-     *
-     * @param drawable The drawable used as the drawer indicator.
-     */
-    public void setSlideDrawable(int drawableRes) {
-        setSlideDrawable(getResources().getDrawable(drawableRes));
-    }
-
-    /**
-     * Sets the drawable used as the drawer indicator.
-     *
-     * @param drawable The drawable used as the drawer indicator.
-     */
-    public void setSlideDrawable(Drawable drawable) {
-        mSlideDrawable = new SlideDrawable(drawable);
-        mSlideDrawable.setIsRtl(ViewHelper.getLayoutDirection(this) == LAYOUT_DIRECTION_RTL);
-
-        if (mActionBarHelper != null) {
-            mActionBarHelper.setDisplayShowHomeAsUpEnabled(true);
-
-            if (mDrawerIndicatorEnabled) {
-                mActionBarHelper.setActionBarUpIndicator(mSlideDrawable,
-                        isMenuVisible() ? mDrawerOpenContentDesc : mDrawerClosedContentDesc);
-            }
-        }
-    }
-
-    /**
-     * Sets up the drawer indicator. It cna then be shown with {@link #setDrawerIndicatorEnabled(boolean)}.
-     *
-     * @param activity The activity the drawer is attached to.
-     */
-    public void setupUpIndicator(Activity activity) {
-        if (mActionBarHelper == null) {
-            mActionBarHelper = new ActionBarHelper(activity);
-            mThemeUpIndicator = mActionBarHelper.getThemeUpIndicator();
-
-            if (mDrawerIndicatorEnabled) {
-                mActionBarHelper.setActionBarUpIndicator(mSlideDrawable,
-                        isMenuVisible() ? mDrawerOpenContentDesc : mDrawerClosedContentDesc);
-            }
-        }
-    }
-
-    /**
-     * Sets whether the drawer indicator should be enabled. {@link #setupUpIndicator(Activity)} must be
-     * called first.
-     *
-     * @param enabled Whether the drawer indicator should enabled.
-     */
-    public void setDrawerIndicatorEnabled(boolean enabled) {
-        if (mActionBarHelper == null) {
-            throw new IllegalStateException("setupUpIndicator(Activity) has not been called");
-        }
-
-        mDrawerIndicatorEnabled = enabled;
-        if (enabled) {
-            mActionBarHelper.setActionBarUpIndicator(mSlideDrawable,
-                    isMenuVisible() ? mDrawerOpenContentDesc : mDrawerClosedContentDesc);
-        } else {
-            mActionBarHelper.setActionBarUpIndicator(mThemeUpIndicator, 0);
-        }
-    }
-
-    /**
-     * Indicates whether the drawer indicator is currently enabled.
-     *
-     * @return Whether the drawer indicator is enabled.
-     */
-    public boolean isDrawerIndicatorEnabled() {
-        return mDrawerIndicatorEnabled;
-    }
-
-    /**
-     * Returns the ViewGroup used as a parent for the menu view.
-     *
-     * @return The menu view's parent.
-     */
-    public ViewGroup getMenuContainer() {
-        return mMenuContainer;
-    }
-
-    /**
-     * Returns the ViewGroup used as a parent for the content view.
-     *
-     * @return The content view's parent.
-     */
-    public ViewGroup getContentContainer() {
-        if (mDragMode == MENU_DRAG_CONTENT) {
-            return mContentContainer;
-        } else {
-            return (ViewGroup) findViewById(android.R.id.content);
-        }
-    }
-
-    /**
-     * Set the menu view from a layout resource.
-     *
-     * @param layoutResId Resource ID to be inflated.
-     */
-    public void setMenuView(int layoutResId) {
-        mMenuContainer.removeAllViews();
-        mMenuView = LayoutInflater.from(getContext()).inflate(layoutResId, mMenuContainer, false);
-        mMenuContainer.addView(mMenuView);
-    }
-
-    /**
-     * Set the menu view to an explicit view.
-     *
-     * @param view The menu view.
-     */
-    public void setMenuView(View view) {
-        setMenuView(view, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
-    }
-
-    /**
-     * Set the menu view to an explicit view.
-     *
-     * @param view   The menu view.
-     * @param params Layout parameters for the view.
-     */
-    public void setMenuView(View view, LayoutParams params) {
-        mMenuView = view;
-        mMenuContainer.removeAllViews();
-        mMenuContainer.addView(view, params);
-    }
-
-    /**
-     * Returns the menu view.
-     *
-     * @return The menu view.
-     */
-    public View getMenuView() {
-        return mMenuView;
-    }
-
-    /**
-     * Set the content from a layout resource.
-     *
-     * @param layoutResId Resource ID to be inflated.
-     */
-    public void setContentView(int layoutResId) {
-        switch (mDragMode) {
-            case MenuDrawer.MENU_DRAG_CONTENT:
-                mContentContainer.removeAllViews();
-                LayoutInflater.from(getContext()).inflate(layoutResId, mContentContainer, true);
-                break;
-
-            case MenuDrawer.MENU_DRAG_WINDOW:
-                mActivity.setContentView(layoutResId);
-                break;
-        }
-    }
-
-    /**
-     * Set the content to an explicit view.
-     *
-     * @param view The desired content to display.
-     */
-    public void setContentView(View view) {
-        setContentView(view, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
-    }
-
-    /**
-     * Set the content to an explicit view.
-     *
-     * @param view   The desired content to display.
-     * @param params Layout parameters for the view.
-     */
-    public void setContentView(View view, LayoutParams params) {
-        switch (mDragMode) {
-            case MenuDrawer.MENU_DRAG_CONTENT:
-                mContentContainer.removeAllViews();
-                mContentContainer.addView(view, params);
-                break;
-
-            case MenuDrawer.MENU_DRAG_WINDOW:
-                mActivity.setContentView(view, params);
-                break;
-        }
-    }
-
-    protected void setDrawerState(int state) {
-        if (state != mDrawerState) {
-            final int oldState = mDrawerState;
-            mDrawerState = state;
-            if (mOnDrawerStateChangeListener != null) mOnDrawerStateChangeListener.onDrawerStateChange(oldState, state);
-            if (DEBUG) logDrawerState(state);
-        }
-    }
-
-    protected void logDrawerState(int state) {
-        switch (state) {
-            case STATE_CLOSED:
-                Log.d(TAG, "[DrawerState] STATE_CLOSED");
-                break;
-
-            case STATE_CLOSING:
-                Log.d(TAG, "[DrawerState] STATE_CLOSING");
-                break;
-
-            case STATE_DRAGGING:
-                Log.d(TAG, "[DrawerState] STATE_DRAGGING");
-                break;
-
-            case STATE_OPENING:
-                Log.d(TAG, "[DrawerState] STATE_OPENING");
-                break;
-
-            case STATE_OPEN:
-                Log.d(TAG, "[DrawerState] STATE_OPEN");
-                break;
-
-            default:
-                Log.d(TAG, "[DrawerState] Unknown: " + state);
-        }
-    }
-
-    /**
-     * Returns the touch mode.
-     */
-    public abstract int getTouchMode();
-
-    /**
-     * Sets the drawer touch mode. Possible values are {@link #TOUCH_MODE_NONE}, {@link #TOUCH_MODE_BEZEL} or
-     * {@link #TOUCH_MODE_FULLSCREEN}.
-     *
-     * @param mode The touch mode.
-     */
-    public abstract void setTouchMode(int mode);
-
-    /**
-     * Sets the size of the touch bezel.
-     *
-     * @param size The touch bezel size in px.
-     */
-    public abstract void setTouchBezelSize(int size);
-
-    /**
-     * Returns the size of the touch bezel in px.
-     */
-    public abstract int getTouchBezelSize();
-
-    @Override
-    public void postOnAnimation(Runnable action) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
-            super.postOnAnimation(action);
-        } else {
-            postDelayed(action, ANIMATION_DELAY);
-        }
-    }
-
-    @Override
-    protected boolean fitSystemWindows(Rect insets) {
-        if (mDragMode == MENU_DRAG_WINDOW && mPosition != Position.BOTTOM) {
-            mMenuContainer.setPadding(0, insets.top, 0, 0);
-        }
-        return super.fitSystemWindows(insets);
-    }
-
-    protected void dispatchOnDrawerSlide(float openRatio, int offsetPixels) {
-        if (mOnDrawerStateChangeListener != null) {
-            mOnDrawerStateChangeListener.onDrawerSlide(openRatio, offsetPixels);
-        }
-    }
-
-    /**
-     * Saves the state of the drawer.
-     *
-     * @return Returns a Parcelable containing the drawer state.
-     */
-    public final Parcelable saveState() {
-        if (mState == null) mState = new Bundle();
-        saveState(mState);
-        return mState;
-    }
-
-    void saveState(Bundle state) {
-        // State saving isn't required for subclasses.
-    }
-
-    /**
-     * Restores the state of the drawer.
-     *
-     * @param in A parcelable containing the drawer state.
-     */
-    public void restoreState(Parcelable in) {
-        mState = (Bundle) in;
-    }
-
-    @Override
-    protected Parcelable onSaveInstanceState() {
-        Parcelable superState = super.onSaveInstanceState();
-        SavedState state = new SavedState(superState);
-
-        if (mState == null) mState = new Bundle();
-        saveState(mState);
-
-        state.mState = mState;
-        return state;
-    }
-
-    @Override
-    protected void onRestoreInstanceState(Parcelable state) {
-        SavedState savedState = (SavedState) state;
-        super.onRestoreInstanceState(savedState.getSuperState());
-
-        restoreState(savedState.mState);
-    }
-
-    static class SavedState extends BaseSavedState {
-
-        Bundle mState;
-
-        public SavedState(Parcelable superState) {
-            super(superState);
-        }
-
-        public SavedState(Parcel in) {
-            super(in);
-            mState = in.readBundle();
-        }
-
-        @Override
-        public void writeToParcel(Parcel dest, int flags) {
-            super.writeToParcel(dest, flags);
-            dest.writeBundle(mState);
-        }
-
-        @SuppressWarnings("UnusedDeclaration")
-        public static final Creator<SavedState> CREATOR = new Creator<SavedState>() {
-            @Override
-            public SavedState createFromParcel(Parcel in) {
-                return new SavedState(in);
-            }
-
-            @Override
-            public SavedState[] newArray(int size) {
-                return new SavedState[size];
-            }
-        };
-    }
-}

+ 0 - 28
librarymenudrawer/src/main/java/net/simonvt/menudrawer/NoClickThroughFrameLayout.java

@@ -1,28 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-
-/**
- * FrameLayout which doesn't let touch events propagate to views positioned behind it in the view hierarchy.
- */
-class NoClickThroughFrameLayout extends BuildLayerFrameLayout {
-
-    public NoClickThroughFrameLayout(Context context) {
-        super(context);
-    }
-
-    public NoClickThroughFrameLayout(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public NoClickThroughFrameLayout(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent event) {
-        return true;
-    }
-}

+ 0 - 791
librarymenudrawer/src/main/java/net/simonvt/menudrawer/OverlayDrawer.java

@@ -1,791 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.app.Activity;
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.drawable.GradientDrawable;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.VelocityTracker;
-import android.view.View;
-
-public class OverlayDrawer extends DraggableDrawer {
-
-    private static final String TAG = "OverlayDrawer";
-
-    private int mPeekSize;
-
-    private Runnable mRevealRunnable = new Runnable() {
-        @Override
-        public void run() {
-            cancelContentTouch();
-            int animateTo = 0;
-            switch (getPosition()) {
-                case RIGHT:
-                case BOTTOM:
-                    animateTo = -mPeekSize;
-                    break;
-
-                default:
-                    animateTo = mPeekSize;
-                    break;
-            }
-            animateOffsetTo(animateTo, 250);
-        }
-    };
-
-    OverlayDrawer(Activity activity, int dragMode) {
-        super(activity, dragMode);
-    }
-
-    public OverlayDrawer(Context context) {
-        super(context);
-    }
-
-    public OverlayDrawer(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public OverlayDrawer(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-    }
-
-    @Override
-    protected void initDrawer(Context context, AttributeSet attrs, int defStyle) {
-        super.initDrawer(context, attrs, defStyle);
-        super.addView(mContentContainer, -1, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
-        if (USE_TRANSLATIONS) {
-            mContentContainer.setLayerType(View.LAYER_TYPE_NONE, null);
-        }
-        mContentContainer.setHardwareLayersEnabled(false);
-        super.addView(mMenuContainer, -1, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
-        mPeekSize = dpToPx(20);
-    }
-
-    @Override
-    protected void drawOverlay(Canvas canvas) {
-        final int width = getWidth();
-        final int height = getHeight();
-        final int offsetPixels = (int) mOffsetPixels;
-        final float openRatio = Math.abs(mOffsetPixels) / mMenuSize;
-
-        switch (getPosition()) {
-            case LEFT:
-                mMenuOverlay.setBounds(offsetPixels, 0, width, height);
-                break;
-
-            case RIGHT:
-                mMenuOverlay.setBounds(0, 0, width + offsetPixels, height);
-                break;
-
-            case TOP:
-                mMenuOverlay.setBounds(0, offsetPixels, width, height);
-                break;
-
-            case BOTTOM:
-                mMenuOverlay.setBounds(0, 0, width, height + offsetPixels);
-                break;
-        }
-
-        mMenuOverlay.setAlpha((int) (MAX_MENU_OVERLAY_ALPHA * openRatio));
-        mMenuOverlay.draw(canvas);
-    }
-
-    @Override
-    public void openMenu(boolean animate) {
-        int animateTo = 0;
-        switch (getPosition()) {
-            case LEFT:
-            case TOP:
-                animateTo = mMenuSize;
-                break;
-
-            case RIGHT:
-            case BOTTOM:
-                animateTo = -mMenuSize;
-                break;
-        }
-
-        animateOffsetTo(animateTo, 0, animate);
-    }
-
-    @Override
-    public void closeMenu(boolean animate) {
-        animateOffsetTo(0, 0, animate);
-    }
-
-    @Override
-    protected void onOffsetPixelsChanged(int offsetPixels) {
-        if (USE_TRANSLATIONS) {
-            switch (getPosition()) {
-                case LEFT:
-                    mMenuContainer.setTranslationX(offsetPixels - mMenuSize);
-                    break;
-
-                case TOP:
-                    mMenuContainer.setTranslationY(offsetPixels - mMenuSize);
-                    break;
-
-                case RIGHT:
-                    mMenuContainer.setTranslationX(offsetPixels + mMenuSize);
-                    break;
-
-                case BOTTOM:
-                    mMenuContainer.setTranslationY(offsetPixels + mMenuSize);
-                    break;
-            }
-        } else {
-            switch (getPosition()) {
-                case TOP:
-                    mMenuContainer.offsetTopAndBottom(offsetPixels - mMenuContainer.getBottom());
-                    break;
-
-                case BOTTOM:
-                    mMenuContainer.offsetTopAndBottom(offsetPixels - (mMenuContainer.getTop() - getHeight()));
-                    break;
-
-                case LEFT:
-                    mMenuContainer.offsetLeftAndRight(offsetPixels - mMenuContainer.getRight());
-                    break;
-
-                case RIGHT:
-                    mMenuContainer.offsetLeftAndRight(offsetPixels - (mMenuContainer.getLeft() - getWidth()));
-                    break;
-            }
-        }
-
-        invalidate();
-    }
-
-    @Override
-    protected void initPeekScroller() {
-        switch (getPosition()) {
-            case RIGHT:
-            case BOTTOM: {
-                final int dx = -mPeekSize;
-                mPeekScroller.startScroll(0, 0, dx, 0, PEEK_DURATION);
-                break;
-            }
-
-            default: {
-                final int dx = mPeekSize;
-                mPeekScroller.startScroll(0, 0, dx, 0, PEEK_DURATION);
-                break;
-            }
-        }
-    }
-
-    @Override
-    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
-        super.onSizeChanged(w, h, oldw, oldh);
-        onOffsetPixelsChanged((int) mOffsetPixels);
-    }
-
-    @Override
-    protected GradientDrawable.Orientation getDropShadowOrientation() {
-        switch (getPosition()) {
-            case TOP:
-                return GradientDrawable.Orientation.TOP_BOTTOM;
-
-            case RIGHT:
-                return GradientDrawable.Orientation.RIGHT_LEFT;
-
-            case BOTTOM:
-                return GradientDrawable.Orientation.BOTTOM_TOP;
-
-            default:
-                return GradientDrawable.Orientation.LEFT_RIGHT;
-        }
-    }
-
-    @Override
-    protected void updateDropShadowRect() {
-        final float openRatio = Math.abs(mOffsetPixels) / mMenuSize;
-        final int dropShadowSize = (int) (mDropShadowSize * openRatio);
-
-        switch (getPosition()) {
-            case LEFT:
-                mDropShadowRect.top = 0;
-                mDropShadowRect.bottom = getHeight();
-                mDropShadowRect.left = ViewHelper.getRight(mMenuContainer);
-                mDropShadowRect.right = mDropShadowRect.left + dropShadowSize;
-                break;
-
-            case TOP:
-                mDropShadowRect.left = 0;
-                mDropShadowRect.right = getWidth();
-                mDropShadowRect.top = ViewHelper.getBottom(mMenuContainer);
-                mDropShadowRect.bottom = mDropShadowRect.top + dropShadowSize;
-                break;
-
-            case RIGHT:
-                mDropShadowRect.top = 0;
-                mDropShadowRect.bottom = getHeight();
-                mDropShadowRect.right = ViewHelper.getLeft(mMenuContainer);
-                mDropShadowRect.left = mDropShadowRect.right - dropShadowSize;
-                break;
-
-            case BOTTOM:
-                mDropShadowRect.left = 0;
-                mDropShadowRect.right = getWidth();
-                mDropShadowRect.bottom = ViewHelper.getTop(mMenuContainer);
-                mDropShadowRect.top = mDropShadowRect.bottom - dropShadowSize;
-                break;
-        }
-    }
-
-    @Override
-    protected void startLayerTranslation() {
-        if (USE_TRANSLATIONS && mHardwareLayersEnabled && !mLayerTypeHardware) {
-            mLayerTypeHardware = true;
-            mMenuContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
-        }
-    }
-
-    @Override
-    protected void stopLayerTranslation() {
-        if (mLayerTypeHardware) {
-            mLayerTypeHardware = false;
-            mMenuContainer.setLayerType(View.LAYER_TYPE_NONE, null);
-        }
-    }
-
-    @Override
-    protected void onLayout(boolean changed, int l, int t, int r, int b) {
-        final int width = r - l;
-        final int height = b - t;
-
-        mContentContainer.layout(0, 0, width, height);
-
-        if (USE_TRANSLATIONS) {
-            switch (getPosition()) {
-                case LEFT:
-                    mMenuContainer.layout(0, 0, mMenuSize, height);
-                    break;
-
-                case RIGHT:
-                    mMenuContainer.layout(width - mMenuSize, 0, width, height);
-                    break;
-
-                case TOP:
-                    mMenuContainer.layout(0, 0, width, mMenuSize);
-                    break;
-
-                case BOTTOM:
-                    mMenuContainer.layout(0, height - mMenuSize, width, height);
-                    break;
-            }
-
-        } else {
-            final int offsetPixels = (int) mOffsetPixels;
-            final int menuSize = mMenuSize;
-
-            switch (getPosition()) {
-                case LEFT:
-                    mMenuContainer.layout(-menuSize + offsetPixels, 0, offsetPixels, height);
-                    break;
-
-                case RIGHT:
-                    mMenuContainer.layout(width + offsetPixels, 0, width + menuSize + offsetPixels, height);
-                    break;
-
-                case TOP:
-                    mMenuContainer.layout(0, -menuSize + offsetPixels, width, offsetPixels);
-                    break;
-
-                case BOTTOM:
-                    mMenuContainer.layout(0, height + offsetPixels, width, height + menuSize + offsetPixels);
-                    break;
-            }
-        }
-    }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
-        final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
-
-        if (widthMode == MeasureSpec.UNSPECIFIED || heightMode == MeasureSpec.UNSPECIFIED) {
-            throw new IllegalStateException("Must measure with an exact size");
-        }
-
-        final int width = MeasureSpec.getSize(widthMeasureSpec);
-        final int height = MeasureSpec.getSize(heightMeasureSpec);
-
-        if (mOffsetPixels == -1) openMenu(false);
-
-        int menuWidthMeasureSpec;
-        int menuHeightMeasureSpec;
-        switch (getPosition()) {
-            case TOP:
-            case BOTTOM:
-                menuWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, width);
-                menuHeightMeasureSpec = getChildMeasureSpec(heightMeasureSpec, 0, mMenuSize);
-                break;
-
-            default:
-                // LEFT/RIGHT
-                menuWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, mMenuSize);
-                menuHeightMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, height);
-        }
-        mMenuContainer.measure(menuWidthMeasureSpec, menuHeightMeasureSpec);
-
-        final int contentWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, width);
-        final int contentHeightMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, height);
-        mContentContainer.measure(contentWidthMeasureSpec, contentHeightMeasureSpec);
-
-        setMeasuredDimension(width, height);
-
-        updateTouchAreaSize();
-    }
-
-    private boolean isContentTouch(int x, int y) {
-        boolean contentTouch = false;
-
-        switch (getPosition()) {
-            case LEFT:
-                contentTouch = ViewHelper.getRight(mMenuContainer) < x;
-                break;
-
-            case RIGHT:
-                contentTouch = ViewHelper.getLeft(mMenuContainer) > x;
-                break;
-
-            case TOP:
-                contentTouch = ViewHelper.getBottom(mMenuContainer) < y;
-                break;
-
-            case BOTTOM:
-                contentTouch = ViewHelper.getTop(mMenuContainer) > y;
-                break;
-        }
-
-        return contentTouch;
-    }
-
-    protected boolean onDownAllowDrag(int x, int y) {
-        switch (getPosition()) {
-            case LEFT:
-                return (!mMenuVisible && mInitialMotionX <= mTouchSize)
-                        || (mMenuVisible && mInitialMotionX <= mOffsetPixels);
-
-            case RIGHT:
-                final int width = getWidth();
-                final int initialMotionX = (int) mInitialMotionX;
-
-                return (!mMenuVisible && initialMotionX >= width - mTouchSize)
-                        || (mMenuVisible && initialMotionX >= width + mOffsetPixels);
-
-            case TOP:
-                return (!mMenuVisible && mInitialMotionY <= mTouchSize)
-                        || (mMenuVisible && mInitialMotionY <= mOffsetPixels);
-
-            case BOTTOM:
-                final int height = getHeight();
-                return (!mMenuVisible && mInitialMotionY >= height - mTouchSize)
-                        || (mMenuVisible && mInitialMotionY >= height + mOffsetPixels);
-        }
-
-        return false;
-    }
-
-    protected boolean onMoveAllowDrag(int x, int y, float dx, float dy) {
-        if (mMenuVisible && mTouchMode == TOUCH_MODE_FULLSCREEN) {
-            return true;
-        }
-
-        switch (getPosition()) {
-            case LEFT:
-                return (!mMenuVisible && mInitialMotionX <= mTouchSize && (dx > 0)) // Drawer closed
-                        || (mMenuVisible && x <= mOffsetPixels) // Drawer open
-                        || (Math.abs(mOffsetPixels) <= mPeekSize && mMenuVisible); // Drawer revealed
-
-            case RIGHT:
-                final int width = getWidth();
-                return (!mMenuVisible && mInitialMotionX >= width - mTouchSize && (dx < 0))
-                        || (mMenuVisible && x >= width - mOffsetPixels)
-                        || (Math.abs(mOffsetPixels) <= mPeekSize && mMenuVisible);
-
-            case TOP:
-                return (!mMenuVisible && mInitialMotionY <= mTouchSize && (dy > 0))
-                        || (mMenuVisible && x <= mOffsetPixels)
-                        || (Math.abs(mOffsetPixels) <= mPeekSize && mMenuVisible);
-
-            case BOTTOM:
-                final int height = getHeight();
-                return (!mMenuVisible && mInitialMotionY >= height - mTouchSize && (dy < 0))
-                        || (mMenuVisible && x >= height - mOffsetPixels)
-                        || (Math.abs(mOffsetPixels) <= mPeekSize && mMenuVisible);
-        }
-
-        return false;
-    }
-
-    protected void onMoveEvent(float dx, float dy) {
-        switch (getPosition()) {
-            case LEFT:
-                setOffsetPixels(Math.min(Math.max(mOffsetPixels + dx, 0), mMenuSize));
-                break;
-
-            case RIGHT:
-                setOffsetPixels(Math.max(Math.min(mOffsetPixels + dx, 0), -mMenuSize));
-                break;
-
-            case TOP:
-                setOffsetPixels(Math.min(Math.max(mOffsetPixels + dy, 0), mMenuSize));
-                break;
-
-            case BOTTOM:
-                setOffsetPixels(Math.max(Math.min(mOffsetPixels + dy, 0), -mMenuSize));
-                break;
-        }
-    }
-
-    protected void onUpEvent(int x, int y) {
-        final int offsetPixels = (int) mOffsetPixels;
-
-        switch (getPosition()) {
-            case LEFT: {
-                if (mIsDragging) {
-                    mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
-                    final int initialVelocity = (int) getXVelocity(mVelocityTracker);
-                    mLastMotionX = x;
-                    animateOffsetTo(initialVelocity > 0 ? mMenuSize : 0, initialVelocity, true);
-
-                    // Close the menu when content is clicked while the menu is visible.
-                } else if (mMenuVisible) {
-                    closeMenu();
-                }
-                break;
-            }
-
-            case TOP: {
-                if (mIsDragging) {
-                    mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
-                    final int initialVelocity = (int) getYVelocity(mVelocityTracker);
-                    mLastMotionY = y;
-                    animateOffsetTo(initialVelocity > 0 ? mMenuSize : 0, initialVelocity, true);
-
-                    // Close the menu when content is clicked while the menu is visible.
-                } else if (mMenuVisible) {
-                    closeMenu();
-                }
-                break;
-            }
-
-            case RIGHT: {
-                final int width = getWidth();
-
-                if (mIsDragging) {
-                    mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
-                    final int initialVelocity = (int) getXVelocity(mVelocityTracker);
-                    mLastMotionX = x;
-                    animateOffsetTo(initialVelocity > 0 ? 0 : -mMenuSize, initialVelocity, true);
-
-                    // Close the menu when content is clicked while the menu is visible.
-                } else if (mMenuVisible) {
-                    closeMenu();
-                }
-                break;
-            }
-
-            case BOTTOM: {
-                if (mIsDragging) {
-                    mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
-                    final int initialVelocity = (int) getYVelocity(mVelocityTracker);
-                    mLastMotionY = y;
-                    animateOffsetTo(initialVelocity < 0 ? -mMenuSize : 0, initialVelocity, true);
-
-                    // Close the menu when content is clicked while the menu is visible.
-                } else if (mMenuVisible) {
-                    closeMenu();
-                }
-                break;
-            }
-        }
-    }
-
-    protected boolean checkTouchSlop(float dx, float dy) {
-        switch (getPosition()) {
-            case TOP:
-            case BOTTOM:
-                return Math.abs(dy) > mTouchSlop && Math.abs(dy) > Math.abs(dx);
-
-            default:
-                return Math.abs(dx) > mTouchSlop && Math.abs(dx) > Math.abs(dy);
-        }
-    }
-
-    @Override
-    protected void stopAnimation() {
-        super.stopAnimation();
-        removeCallbacks(mRevealRunnable);
-    }
-
-    @Override
-    public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
-        super.requestDisallowInterceptTouchEvent(disallowIntercept);
-        removeCallbacks(mRevealRunnable);
-        if (mIsPeeking) {
-            endPeek();
-            animateOffsetTo(0, PEEK_DURATION);
-        }
-    }
-
-    public boolean onInterceptTouchEvent(MotionEvent ev) {
-        final int action = ev.getAction() & MotionEvent.ACTION_MASK;
-
-        if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
-            removeCallbacks(mRevealRunnable);
-            mActivePointerId = INVALID_POINTER;
-            mIsDragging = false;
-            if (mVelocityTracker != null) {
-                mVelocityTracker.recycle();
-                mVelocityTracker = null;
-            }
-
-            if (Math.abs(mOffsetPixels) > mMenuSize / 2) {
-                openMenu();
-            } else {
-                closeMenu();
-            }
-
-            return false;
-        }
-
-        if (action == MotionEvent.ACTION_DOWN && mMenuVisible && isCloseEnough()) {
-            setOffsetPixels(0);
-            stopAnimation();
-            endPeek();
-            setDrawerState(STATE_CLOSED);
-            mIsDragging = false;
-        }
-
-        // Always intercept events over the content while menu is visible.
-        if (mMenuVisible) {
-            int index = 0;
-            if (mActivePointerId != INVALID_POINTER) {
-                index = ev.findPointerIndex(mActivePointerId);
-                index = index == -1 ? 0 : index;
-            }
-
-            final int x = (int) ev.getX(index);
-            final int y = (int) ev.getY(index);
-            if (isContentTouch(x, y)) {
-                return true;
-            }
-        }
-
-        if (!mMenuVisible && !mIsDragging && mTouchMode == TOUCH_MODE_NONE) {
-            return false;
-        }
-
-        if (action != MotionEvent.ACTION_DOWN && mIsDragging) {
-            return true;
-        }
-
-        switch (action) {
-            case MotionEvent.ACTION_DOWN: {
-                mLastMotionX = mInitialMotionX = ev.getX();
-                mLastMotionY = mInitialMotionY = ev.getY();
-                final boolean allowDrag = onDownAllowDrag((int) mLastMotionX, (int) mLastMotionY);
-                mActivePointerId = ev.getPointerId(0);
-
-                if (allowDrag) {
-                    setDrawerState(mMenuVisible ? STATE_OPEN : STATE_CLOSED);
-                    stopAnimation();
-                    endPeek();
-
-                    if (!mMenuVisible && mInitialMotionX <= mPeekSize) {
-                        postDelayed(mRevealRunnable, 160);
-                    }
-
-                    mIsDragging = false;
-                }
-                break;
-            }
-
-            case MotionEvent.ACTION_MOVE: {
-                final int activePointerId = mActivePointerId;
-                if (activePointerId == INVALID_POINTER) {
-                    // If we don't have a valid id, the touch down wasn't on content.
-                    break;
-                }
-
-                final int pointerIndex = ev.findPointerIndex(activePointerId);
-                if (pointerIndex == -1) {
-                    mIsDragging = false;
-                    mActivePointerId = INVALID_POINTER;
-                    endDrag();
-                    closeMenu(true);
-                    return false;
-                }
-
-                final float x = ev.getX(pointerIndex);
-                final float dx = x - mLastMotionX;
-                final float y = ev.getY(pointerIndex);
-                final float dy = y - mLastMotionY;
-
-                if (Math.abs(dx) >= mTouchSlop || Math.abs(dy) >= mTouchSlop) {
-                    removeCallbacks(mRevealRunnable);
-                    endPeek();
-                }
-
-                if (checkTouchSlop(dx, dy)) {
-                    if (mOnInterceptMoveEventListener != null && (mTouchMode == TOUCH_MODE_FULLSCREEN || mMenuVisible)
-                            && canChildrenScroll((int) dx, (int) dy, (int) x, (int) y)) {
-                        endDrag(); // Release the velocity tracker
-                        requestDisallowInterceptTouchEvent(true);
-                        return false;
-                    }
-
-                    final boolean allowDrag = onMoveAllowDrag((int) x, (int) y, dx, dy);
-
-                    if (allowDrag) {
-                        endPeek();
-                        stopAnimation();
-                        setDrawerState(STATE_DRAGGING);
-                        mIsDragging = true;
-                        mLastMotionX = x;
-                        mLastMotionY = y;
-                    }
-                }
-                break;
-            }
-
-            case MotionEvent.ACTION_POINTER_UP:
-                onPointerUp(ev);
-                mLastMotionX = ev.getX(ev.findPointerIndex(mActivePointerId));
-                mLastMotionY = ev.getY(ev.findPointerIndex(mActivePointerId));
-                break;
-        }
-
-        if (mVelocityTracker == null) mVelocityTracker = VelocityTracker.obtain();
-        mVelocityTracker.addMovement(ev);
-
-        return mIsDragging;
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent ev) {
-        if (!mMenuVisible && !mIsDragging && mTouchMode == TOUCH_MODE_NONE) {
-            return false;
-        }
-        final int action = ev.getAction() & MotionEvent.ACTION_MASK;
-
-        if (mVelocityTracker == null) mVelocityTracker = VelocityTracker.obtain();
-        mVelocityTracker.addMovement(ev);
-
-        switch (action) {
-            case MotionEvent.ACTION_DOWN: {
-                mLastMotionX = mInitialMotionX = ev.getX();
-                mLastMotionY = mInitialMotionY = ev.getY();
-                final boolean allowDrag = onDownAllowDrag((int) mLastMotionX, (int) mLastMotionY);
-
-                mActivePointerId = ev.getPointerId(0);
-
-                if (allowDrag) {
-                    stopAnimation();
-                    endPeek();
-
-                    if (!mMenuVisible && mLastMotionX <= mPeekSize) {
-                        postDelayed(mRevealRunnable, 160);
-                    }
-
-                    startLayerTranslation();
-                }
-                break;
-            }
-
-            case MotionEvent.ACTION_MOVE: {
-                final int pointerIndex = ev.findPointerIndex(mActivePointerId);
-                if (pointerIndex == -1) {
-                    mIsDragging = false;
-                    mActivePointerId = INVALID_POINTER;
-                    endDrag();
-                    closeMenu(true);
-                    return false;
-                }
-
-                if (!mIsDragging) {
-                    final float x = ev.getX(pointerIndex);
-                    final float dx = x - mLastMotionX;
-                    final float y = ev.getY(pointerIndex);
-                    final float dy = y - mLastMotionY;
-
-                    if (checkTouchSlop(dx, dy)) {
-                        final boolean allowDrag = onMoveAllowDrag((int) x, (int) y, dx, dy);
-
-                        if (allowDrag) {
-                            endPeek();
-                            stopAnimation();
-                            setDrawerState(STATE_DRAGGING);
-                            mIsDragging = true;
-                            mLastMotionX = x;
-                            mLastMotionY = y;
-                        } else {
-                            mInitialMotionX = x;
-                            mInitialMotionY = y;
-                        }
-                    }
-                }
-
-                if (mIsDragging) {
-                    startLayerTranslation();
-
-                    final float x = ev.getX(pointerIndex);
-                    final float dx = x - mLastMotionX;
-                    final float y = ev.getY(pointerIndex);
-                    final float dy = y - mLastMotionY;
-
-                    mLastMotionX = x;
-                    mLastMotionY = y;
-                    onMoveEvent(dx, dy);
-                }
-                break;
-            }
-
-            case MotionEvent.ACTION_CANCEL:
-            case MotionEvent.ACTION_UP: {
-                removeCallbacks(mRevealRunnable);
-                int index = ev.findPointerIndex(mActivePointerId);
-                index = index == -1 ? 0 : index;
-                final int x = (int) ev.getX(index);
-                final int y = (int) ev.getY(index);
-                onUpEvent(x, y);
-                mActivePointerId = INVALID_POINTER;
-                mIsDragging = false;
-                break;
-            }
-
-            case MotionEvent.ACTION_POINTER_DOWN:
-                final int index = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK)
-                        >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
-                mLastMotionX = ev.getX(index);
-                mLastMotionY = ev.getY(index);
-                mActivePointerId = ev.getPointerId(index);
-                break;
-
-            case MotionEvent.ACTION_POINTER_UP:
-                onPointerUp(ev);
-                mLastMotionX = ev.getX(ev.findPointerIndex(mActivePointerId));
-                mLastMotionY = ev.getY(ev.findPointerIndex(mActivePointerId));
-                break;
-        }
-
-        return true;
-    }
-
-    private void onPointerUp(MotionEvent ev) {
-        final int pointerIndex = ev.getActionIndex();
-        final int pointerId = ev.getPointerId(pointerIndex);
-        if (pointerId == mActivePointerId) {
-            final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
-            mLastMotionX = ev.getX(newPointerIndex);
-            mActivePointerId = ev.getPointerId(newPointerIndex);
-            if (mVelocityTracker != null) {
-                mVelocityTracker.clear();
-            }
-        }
-    }
-}

+ 0 - 28
librarymenudrawer/src/main/java/net/simonvt/menudrawer/PeekInterpolator.java

@@ -1,28 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.view.animation.Interpolator;
-
-class PeekInterpolator implements Interpolator {
-
-    private static final String TAG = "PeekInterpolator";
-
-    private static final SinusoidalInterpolator SINUSOIDAL_INTERPOLATOR = new SinusoidalInterpolator();
-
-    @Override
-    public float getInterpolation(float input) {
-        float result;
-
-        if (input < 1.f / 3.f) {
-            result = SINUSOIDAL_INTERPOLATOR.getInterpolation(input * 3);
-
-        } else if (input > 2.f / 3.f) {
-            final float val = ((input + 1.f / 3.f) - 1.f) * 3.f;
-            result = 1.f - SINUSOIDAL_INTERPOLATOR.getInterpolation(val);
-
-        } else {
-            result = 1.f;
-        }
-
-        return result;
-    }
-}

+ 0 - 50
librarymenudrawer/src/main/java/net/simonvt/menudrawer/Position.java

@@ -1,50 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.util.SparseArray;
-
-/**
- * Enums used for positioning the drawer.
- */
-public enum Position {
-    // Positions the drawer to the left of the content.
-    LEFT(0),
-
-    // Positions the drawer above the content.
-    TOP(1),
-
-    // Positions the drawer to the right of the content.
-    RIGHT(2),
-
-    // Positions the drawer below the content.
-    BOTTOM(3),
-
-    /**
-     * Position the drawer at the start edge. This will position the drawer to the {@link #LEFT} with LTR languages and
-     * {@link #RIGHT} with RTL languages.
-     */
-    START(4),
-
-    /**
-     * Position the drawer at the end edge. This will position the drawer to the {@link #RIGHT} with LTR languages and
-     * {@link #LEFT} with RTL languages.
-     */
-    END(5);
-
-    final int mValue;
-
-    Position(int value) {
-        mValue = value;
-    }
-
-    private static final SparseArray<Position> STRING_MAPPING = new SparseArray<Position>();
-
-    static {
-        for (Position via : Position.values()) {
-            STRING_MAPPING.put(via.mValue, via);
-        }
-    }
-
-    public static Position fromValue(int value) {
-        return STRING_MAPPING.get(value);
-    }
-}

+ 0 - 505
librarymenudrawer/src/main/java/net/simonvt/menudrawer/Scroller.java

@@ -1,505 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.simonvt.menudrawer;
-
-import android.content.Context;
-import android.hardware.SensorManager;
-import android.os.Build;
-import android.util.FloatMath;
-import android.view.ViewConfiguration;
-import android.view.animation.AnimationUtils;
-import android.view.animation.Interpolator;
-
-
-/**
- * This class encapsulates scrolling.  The duration of the scroll
- * can be passed in the constructor and specifies the maximum time that
- * the scrolling animation should take.  Past this time, the scrolling is
- * automatically moved to its final stage and computeScrollOffset()
- * will always return false to indicate that scrolling is over.
- */
-class Scroller  {
-    private int mMode;
-
-    private int mStartX;
-    private int mStartY;
-    private int mFinalX;
-    private int mFinalY;
-
-    private int mMinX;
-    private int mMaxX;
-    private int mMinY;
-    private int mMaxY;
-
-    private int mCurrX;
-    private int mCurrY;
-    private long mStartTime;
-    private int mDuration;
-    private float mDurationReciprocal;
-    private float mDeltaX;
-    private float mDeltaY;
-    private boolean mFinished;
-    private Interpolator mInterpolator;
-    private boolean mFlywheel;
-
-    private float mVelocity;
-
-    private static final int DEFAULT_DURATION = 250;
-    private static final int SCROLL_MODE = 0;
-    private static final int FLING_MODE = 1;
-
-    private static final float DECELERATION_RATE = (float) (Math.log(0.75) / Math.log(0.9));
-    private static final float ALPHA = 800; // pixels / seconds
-    private static final float START_TENSION = 0.4f; // Tension at start: (0.4 * total T, 1.0 * Distance)
-    private static final float END_TENSION = 1.0f - START_TENSION;
-    private static final int NB_SAMPLES = 100;
-    private static final float[] SPLINE = new float[NB_SAMPLES + 1];
-
-    private float mDeceleration;
-    private final float mPpi;
-
-    static {
-        float xMin = 0.0f;
-        for (int i = 0; i <= NB_SAMPLES; i++) {
-            final float t = (float) i / NB_SAMPLES;
-            float xMax = 1.0f;
-            float x, tx, coef;
-            while (true) {
-                x = xMin + (xMax - xMin) / 2.0f;
-                coef = 3.0f * x * (1.0f - x);
-                tx = coef * ((1.0f - x) * START_TENSION + x * END_TENSION) + x * x * x;
-                if (Math.abs(tx - t) < 1E-5) break;
-                if (tx > t) xMax = x;
-                else xMin = x;
-            }
-            final float d = coef + x * x * x;
-            SPLINE[i] = d;
-        }
-        SPLINE[NB_SAMPLES] = 1.0f;
-
-        // This controls the viscous fluid effect (how much of it)
-        sViscousFluidScale = 8.0f;
-        // must be set to 1.0 (used in viscousFluid())
-        sViscousFluidNormalize = 1.0f;
-        sViscousFluidNormalize = 1.0f / viscousFluid(1.0f);
-    }
-
-    private static float sViscousFluidScale;
-    private static float sViscousFluidNormalize;
-
-    /**
-     * Create a Scroller with the default duration and interpolator.
-     */
-    public Scroller(Context context) {
-        this(context, null);
-    }
-
-    /**
-     * Create a Scroller with the specified interpolator. If the interpolator is
-     * null, the default (viscous) interpolator will be used. "Flywheel" behavior will
-     * be in effect for apps targeting Honeycomb or newer.
-     */
-    public Scroller(Context context, Interpolator interpolator) {
-        this(context, interpolator,
-                context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.HONEYCOMB);
-    }
-
-    /**
-     * Create a Scroller with the specified interpolator. If the interpolator is
-     * null, the default (viscous) interpolator will be used. Specify whether or
-     * not to support progressive "flywheel" behavior in flinging.
-     */
-    public Scroller(Context context, Interpolator interpolator, boolean flywheel) {
-        mFinished = true;
-        mInterpolator = interpolator;
-        mPpi = context.getResources().getDisplayMetrics().density * 160.0f;
-        mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction());
-        mFlywheel = flywheel;
-    }
-
-    /**
-     * The amount of friction applied to flings. The default value
-     * is {@link ViewConfiguration#getScrollFriction}.
-     *
-     * @param friction A scalar dimension-less value representing the coefficient of
-     *         friction.
-     */
-    public final void setFriction(float friction) {
-        mDeceleration = computeDeceleration(friction);
-    }
-
-    private float computeDeceleration(float friction) {
-        return SensorManager.GRAVITY_EARTH   // g (m/s^2)
-                      * 39.37f               // inch/meter
-                      * mPpi                 // pixels per inch
-                      * friction;
-    }
-
-    /**
-     *
-     * Returns whether the scroller has finished scrolling.
-     *
-     * @return True if the scroller has finished scrolling, false otherwise.
-     */
-    public final boolean isFinished() {
-        return mFinished;
-    }
-
-    /**
-     * Force the finished field to a particular value.
-     *
-     * @param finished The new finished value.
-     */
-    public final void forceFinished(boolean finished) {
-        mFinished = finished;
-    }
-
-    /**
-     * Returns how long the scroll event will take, in milliseconds.
-     *
-     * @return The duration of the scroll in milliseconds.
-     */
-    public final int getDuration() {
-        return mDuration;
-    }
-
-    /**
-     * Returns the current X offset in the scroll.
-     *
-     * @return The new X offset as an absolute distance from the origin.
-     */
-    public final int getCurrX() {
-        return mCurrX;
-    }
-
-    /**
-     * Returns the current Y offset in the scroll.
-     *
-     * @return The new Y offset as an absolute distance from the origin.
-     */
-    public final int getCurrY() {
-        return mCurrY;
-    }
-
-    /**
-     * Returns the current velocity.
-     *
-     * @return The original velocity less the deceleration. Result may be
-     * negative.
-     */
-    public float getCurrVelocity() {
-        return mVelocity - mDeceleration * timePassed() / 2000.0f;
-    }
-
-    /**
-     * Returns the start X offset in the scroll.
-     *
-     * @return The start X offset as an absolute distance from the origin.
-     */
-    public final int getStartX() {
-        return mStartX;
-    }
-
-    /**
-     * Returns the start Y offset in the scroll.
-     *
-     * @return The start Y offset as an absolute distance from the origin.
-     */
-    public final int getStartY() {
-        return mStartY;
-    }
-
-    /**
-     * Returns where the scroll will end. Valid only for "fling" scrolls.
-     *
-     * @return The final X offset as an absolute distance from the origin.
-     */
-    public final int getFinalX() {
-        return mFinalX;
-    }
-
-    /**
-     * Returns where the scroll will end. Valid only for "fling" scrolls.
-     *
-     * @return The final Y offset as an absolute distance from the origin.
-     */
-    public final int getFinalY() {
-        return mFinalY;
-    }
-
-    /**
-     * Call this when you want to know the new location.  If it returns true,
-     * the animation is not yet finished.  loc will be altered to provide the
-     * new location.
-     */
-    public boolean computeScrollOffset() {
-        if (mFinished) {
-            return false;
-        }
-
-        int timePassed = (int) (AnimationUtils.currentAnimationTimeMillis() - mStartTime);
-
-        if (timePassed < mDuration) {
-            switch (mMode) {
-            case SCROLL_MODE:
-                float x = timePassed * mDurationReciprocal;
-
-                if (mInterpolator == null)
-                    x = viscousFluid(x);
-                else
-                    x = mInterpolator.getInterpolation(x);
-
-                mCurrX = mStartX + Math.round(x * mDeltaX);
-                mCurrY = mStartY + Math.round(x * mDeltaY);
-                break;
-            case FLING_MODE:
-                final float t = (float) timePassed / mDuration;
-                final int index = (int) (NB_SAMPLES * t);
-                final float tInf = (float) index / NB_SAMPLES;
-                final float tSup = (float) (index + 1) / NB_SAMPLES;
-                final float dInf = SPLINE[index];
-                final float dSup = SPLINE[index + 1];
-                final float distanceCoef = dInf + (t - tInf) / (tSup - tInf) * (dSup - dInf);
-
-                mCurrX = mStartX + Math.round(distanceCoef * (mFinalX - mStartX));
-                // Pin to mMinX <= mCurrX <= mMaxX
-                mCurrX = Math.min(mCurrX, mMaxX);
-                mCurrX = Math.max(mCurrX, mMinX);
-
-                mCurrY = mStartY + Math.round(distanceCoef * (mFinalY - mStartY));
-                // Pin to mMinY <= mCurrY <= mMaxY
-                mCurrY = Math.min(mCurrY, mMaxY);
-                mCurrY = Math.max(mCurrY, mMinY);
-
-                if (mCurrX == mFinalX && mCurrY == mFinalY) {
-                    mFinished = true;
-                }
-
-                break;
-            }
-        } else {
-            mCurrX = mFinalX;
-            mCurrY = mFinalY;
-            mFinished = true;
-        }
-        return true;
-    }
-
-    /**
-     * Start scrolling by providing a starting point and the distance to travel.
-     * The scroll will use the default value of 250 milliseconds for the
-     * duration.
-     *
-     * @param startX Starting horizontal scroll offset in pixels. Positive
-     *        numbers will scroll the content to the left.
-     * @param startY Starting vertical scroll offset in pixels. Positive numbers
-     *        will scroll the content up.
-     * @param dx Horizontal distance to travel. Positive numbers will scroll the
-     *        content to the left.
-     * @param dy Vertical distance to travel. Positive numbers will scroll the
-     *        content up.
-     */
-    public void startScroll(int startX, int startY, int dx, int dy) {
-        startScroll(startX, startY, dx, dy, DEFAULT_DURATION);
-    }
-
-    /**
-     * Start scrolling by providing a starting point and the distance to travel.
-     *
-     * @param startX Starting horizontal scroll offset in pixels. Positive
-     *        numbers will scroll the content to the left.
-     * @param startY Starting vertical scroll offset in pixels. Positive numbers
-     *        will scroll the content up.
-     * @param dx Horizontal distance to travel. Positive numbers will scroll the
-     *        content to the left.
-     * @param dy Vertical distance to travel. Positive numbers will scroll the
-     *        content up.
-     * @param duration Duration of the scroll in milliseconds.
-     */
-    public void startScroll(int startX, int startY, int dx, int dy, int duration) {
-        mMode = SCROLL_MODE;
-        mFinished = false;
-        mDuration = duration;
-        mStartTime = AnimationUtils.currentAnimationTimeMillis();
-        mStartX = startX;
-        mStartY = startY;
-        mFinalX = startX + dx;
-        mFinalY = startY + dy;
-        mDeltaX = dx;
-        mDeltaY = dy;
-        mDurationReciprocal = 1.0f / (float) mDuration;
-    }
-
-    /**
-     * Start scrolling based on a fling gesture. The distance travelled will
-     * depend on the initial velocity of the fling.
-     *
-     * @param startX Starting point of the scroll (X)
-     * @param startY Starting point of the scroll (Y)
-     * @param velocityX Initial velocity of the fling (X) measured in pixels per
-     *        second.
-     * @param velocityY Initial velocity of the fling (Y) measured in pixels per
-     *        second
-     * @param minX Minimum X value. The scroller will not scroll past this
-     *        point.
-     * @param maxX Maximum X value. The scroller will not scroll past this
-     *        point.
-     * @param minY Minimum Y value. The scroller will not scroll past this
-     *        point.
-     * @param maxY Maximum Y value. The scroller will not scroll past this
-     *        point.
-     */
-    public void fling(int startX, int startY, int velocityX, int velocityY,
-            int minX, int maxX, int minY, int maxY) {
-        // Continue a scroll or fling in progress
-        if (mFlywheel && !mFinished) {
-            float oldVel = getCurrVelocity();
-
-            float dx = (float) (mFinalX - mStartX);
-            float dy = (float) (mFinalY - mStartY);
-            float hyp = FloatMath.sqrt(dx * dx + dy * dy);
-
-            float ndx = dx / hyp;
-            float ndy = dy / hyp;
-
-            float oldVelocityX = ndx * oldVel;
-            float oldVelocityY = ndy * oldVel;
-            if (Math.signum(velocityX) == Math.signum(oldVelocityX)
-                    && Math.signum(velocityY) == Math.signum(oldVelocityY)) {
-                velocityX += oldVelocityX;
-                velocityY += oldVelocityY;
-            }
-        }
-
-        mMode = FLING_MODE;
-        mFinished = false;
-
-        float velocity = FloatMath.sqrt(velocityX * velocityX + velocityY * velocityY);
-
-        mVelocity = velocity;
-        final double l = Math.log(START_TENSION * velocity / ALPHA);
-        mDuration = (int) (1000.0 * Math.exp(l / (DECELERATION_RATE - 1.0)));
-        mStartTime = AnimationUtils.currentAnimationTimeMillis();
-        mStartX = startX;
-        mStartY = startY;
-
-        float coeffX = velocity == 0 ? 1.0f : velocityX / velocity;
-        float coeffY = velocity == 0 ? 1.0f : velocityY / velocity;
-
-        int totalDistance =
-                (int) (ALPHA * Math.exp(DECELERATION_RATE / (DECELERATION_RATE - 1.0) * l));
-
-        mMinX = minX;
-        mMaxX = maxX;
-        mMinY = minY;
-        mMaxY = maxY;
-
-        mFinalX = startX + Math.round(totalDistance * coeffX);
-        // Pin to mMinX <= mFinalX <= mMaxX
-        mFinalX = Math.min(mFinalX, mMaxX);
-        mFinalX = Math.max(mFinalX, mMinX);
-
-        mFinalY = startY + Math.round(totalDistance * coeffY);
-        // Pin to mMinY <= mFinalY <= mMaxY
-        mFinalY = Math.min(mFinalY, mMaxY);
-        mFinalY = Math.max(mFinalY, mMinY);
-    }
-
-    static float viscousFluid(float x) {
-        x *= sViscousFluidScale;
-        if (x < 1.0f) {
-            x -= (1.0f - (float) Math.exp(-x));
-        } else {
-            float start = 0.36787944117f;   // 1/e == exp(-1)
-            x = 1.0f - (float) Math.exp(1.0f - x);
-            x = start + x * (1.0f - start);
-        }
-        x *= sViscousFluidNormalize;
-        return x;
-    }
-
-    /**
-     * Stops the animation. Contrary to {@link #forceFinished(boolean)},
-     * aborting the animating cause the scroller to move to the final x and y
-     * position
-     *
-     * @see #forceFinished(boolean)
-     */
-    public void abortAnimation() {
-        mCurrX = mFinalX;
-        mCurrY = mFinalY;
-        mFinished = true;
-    }
-
-    /**
-     * Extend the scroll animation. This allows a running animation to scroll
-     * further and longer, when used with {@link #setFinalX(int)} or {@link #setFinalY(int)}.
-     *
-     * @param extend Additional time to scroll in milliseconds.
-     * @see #setFinalX(int)
-     * @see #setFinalY(int)
-     */
-    public void extendDuration(int extend) {
-        int passed = timePassed();
-        mDuration = passed + extend;
-        mDurationReciprocal = 1.0f / mDuration;
-        mFinished = false;
-    }
-
-    /**
-     * Returns the time elapsed since the beginning of the scrolling.
-     *
-     * @return The elapsed time in milliseconds.
-     */
-    public int timePassed() {
-        return (int) (AnimationUtils.currentAnimationTimeMillis() - mStartTime);
-    }
-
-    /**
-     * Sets the final position (X) for this scroller.
-     *
-     * @param newX The new X offset as an absolute distance from the origin.
-     * @see #extendDuration(int)
-     * @see #setFinalY(int)
-     */
-    public void setFinalX(int newX) {
-        mFinalX = newX;
-        mDeltaX = mFinalX - mStartX;
-        mFinished = false;
-    }
-
-    /**
-     * Sets the final position (Y) for this scroller.
-     *
-     * @param newY The new Y offset as an absolute distance from the origin.
-     * @see #extendDuration(int)
-     * @see #setFinalX(int)
-     */
-    public void setFinalY(int newY) {
-        mFinalY = newY;
-        mDeltaY = mFinalY - mStartY;
-        mFinished = false;
-    }
-
-    /**
-     * @hide
-     */
-    public boolean isScrollingInDirection(float xvel, float yvel) {
-        return !mFinished && Math.signum(xvel) == Math.signum(mFinalX - mStartX)
-                && Math.signum(yvel) == Math.signum(mFinalY - mStartY);
-    }
-}

+ 0 - 15
librarymenudrawer/src/main/java/net/simonvt/menudrawer/SinusoidalInterpolator.java

@@ -1,15 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.view.animation.Interpolator;
-
-/**
- * Interpolator which, when drawn from 0 to 1, looks like half a sine-wave. Used for smoother opening/closing when
- * peeking at the drawer.
- */
-class SinusoidalInterpolator implements Interpolator {
-
-    @Override
-    public float getInterpolation(float input) {
-        return (float) (0.5f + 0.5f * Math.sin(input * Math.PI - Math.PI / 2.f));
-    }
-}

+ 0 - 187
librarymenudrawer/src/main/java/net/simonvt/menudrawer/SlideDrawable.java

@@ -1,187 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.PorterDuff;
-import android.graphics.Rect;
-import android.graphics.Region;
-import android.graphics.drawable.Drawable;
-
-public class SlideDrawable extends Drawable implements Drawable.Callback {
-
-    private Drawable mWrapped;
-    private float mOffset;
-
-    private final Rect mTmpRect = new Rect();
-
-    private boolean mIsRtl;
-
-    public SlideDrawable(Drawable wrapped) {
-        mWrapped = wrapped;
-    }
-
-    public void setOffset(float offset) {
-        mOffset = offset;
-        invalidateSelf();
-    }
-
-    public float getOffset() {
-        return mOffset;
-    }
-
-    void setIsRtl(boolean isRtl) {
-        mIsRtl = isRtl;
-        invalidateSelf();
-    }
-
-    @Override
-    public void draw(Canvas canvas) {
-        mWrapped.copyBounds(mTmpRect);
-        canvas.save();
-        if (mIsRtl) {
-            canvas.translate(1.f / 3 * mTmpRect.width() * mOffset, 0);
-        } else {
-            canvas.translate(1.f / 3 * mTmpRect.width() * -mOffset, 0);
-        }
-        mWrapped.draw(canvas);
-        canvas.restore();
-    }
-
-    @Override
-    public void setChangingConfigurations(int configs) {
-        mWrapped.setChangingConfigurations(configs);
-    }
-
-    @Override
-    public int getChangingConfigurations() {
-        return mWrapped.getChangingConfigurations();
-    }
-
-    @Override
-    public void setDither(boolean dither) {
-        mWrapped.setDither(dither);
-    }
-
-    @Override
-    public void setFilterBitmap(boolean filter) {
-        mWrapped.setFilterBitmap(filter);
-    }
-
-    @Override
-    public void setAlpha(int alpha) {
-        mWrapped.setAlpha(alpha);
-    }
-
-    @Override
-    public void setColorFilter(ColorFilter cf) {
-        mWrapped.setColorFilter(cf);
-    }
-
-    @Override
-    public void setColorFilter(int color, PorterDuff.Mode mode) {
-        mWrapped.setColorFilter(color, mode);
-    }
-
-    @Override
-    public void clearColorFilter() {
-        mWrapped.clearColorFilter();
-    }
-
-    @Override
-    public boolean isStateful() {
-        return mWrapped.isStateful();
-    }
-
-    @Override
-    public boolean setState(int[] stateSet) {
-        return mWrapped.setState(stateSet);
-    }
-
-    @Override
-    public int[] getState() {
-        return mWrapped.getState();
-    }
-
-    @Override
-    public Drawable getCurrent() {
-        return mWrapped.getCurrent();
-    }
-
-    @Override
-    public boolean setVisible(boolean visible, boolean restart) {
-        return super.setVisible(visible, restart);
-    }
-
-    @Override
-    public int getOpacity() {
-        return mWrapped.getOpacity();
-    }
-
-    @Override
-    public Region getTransparentRegion() {
-        return mWrapped.getTransparentRegion();
-    }
-
-    @Override
-    protected boolean onStateChange(int[] state) {
-        mWrapped.setState(state);
-        return super.onStateChange(state);
-    }
-
-    @Override
-    protected void onBoundsChange(Rect bounds) {
-        super.onBoundsChange(bounds);
-        mWrapped.setBounds(bounds);
-    }
-
-    @Override
-    public int getIntrinsicWidth() {
-        return mWrapped.getIntrinsicWidth();
-    }
-
-    @Override
-    public int getIntrinsicHeight() {
-        return mWrapped.getIntrinsicHeight();
-    }
-
-    @Override
-    public int getMinimumWidth() {
-        return mWrapped.getMinimumWidth();
-    }
-
-    @Override
-    public int getMinimumHeight() {
-        return mWrapped.getMinimumHeight();
-    }
-
-    @Override
-    public boolean getPadding(Rect padding) {
-        return mWrapped.getPadding(padding);
-    }
-
-    @Override
-    public ConstantState getConstantState() {
-        return super.getConstantState();
-    }
-
-    @Override
-    public void invalidateDrawable(Drawable who) {
-        if (who == mWrapped) {
-            invalidateSelf();
-        }
-    }
-
-    @Override
-    public void scheduleDrawable(Drawable who, Runnable what, long when) {
-        if (who == mWrapped) {
-            scheduleSelf(what, when);
-        }
-    }
-
-    @Override
-    public void unscheduleDrawable(Drawable who, Runnable what) {
-        if (who == mWrapped) {
-            unscheduleSelf(what);
-        }
-    }
-}

+ 0 - 707
librarymenudrawer/src/main/java/net/simonvt/menudrawer/SlidingDrawer.java

@@ -1,707 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.app.Activity;
-import android.content.Context;
-import android.graphics.Canvas;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.VelocityTracker;
-
-public class SlidingDrawer extends DraggableDrawer {
-
-    private static final String TAG = "OverlayDrawer";
-
-    SlidingDrawer(Activity activity, int dragMode) {
-        super(activity, dragMode);
-    }
-
-    public SlidingDrawer(Context context) {
-        super(context);
-    }
-
-    public SlidingDrawer(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public SlidingDrawer(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-    }
-
-    @Override
-    protected void initDrawer(Context context, AttributeSet attrs, int defStyle) {
-        super.initDrawer(context, attrs, defStyle);
-        super.addView(mMenuContainer, -1, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
-        super.addView(mContentContainer, -1, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
-    }
-
-    @Override
-    public void openMenu(boolean animate) {
-        int animateTo = 0;
-        switch (getPosition()) {
-            case LEFT:
-            case TOP:
-                animateTo = mMenuSize;
-                break;
-
-            case RIGHT:
-            case BOTTOM:
-                animateTo = -mMenuSize;
-                break;
-        }
-
-        animateOffsetTo(animateTo, 0, animate);
-    }
-
-    @Override
-    public void closeMenu(boolean animate) {
-        animateOffsetTo(0, 0, animate);
-    }
-
-    @Override
-    protected void onOffsetPixelsChanged(int offsetPixels) {
-        if (USE_TRANSLATIONS) {
-            switch (getPosition()) {
-                case TOP:
-                case BOTTOM:
-                    mContentContainer.setTranslationY(offsetPixels);
-                    break;
-
-                default:
-                    mContentContainer.setTranslationX(offsetPixels);
-                    break;
-            }
-        } else {
-            switch (getPosition()) {
-                case TOP:
-                case BOTTOM:
-                    mContentContainer.offsetTopAndBottom(offsetPixels - mContentContainer.getTop());
-                    break;
-
-                default:
-                    mContentContainer.offsetLeftAndRight(offsetPixels - mContentContainer.getLeft());
-                    break;
-            }
-        }
-
-        offsetMenu(offsetPixels);
-        invalidate();
-    }
-
-    @Override
-    protected void initPeekScroller() {
-        switch (getPosition()) {
-            case RIGHT:
-            case BOTTOM: {
-                final int dx = -mMenuSize / 3;
-                mPeekScroller.startScroll(0, 0, dx, 0, PEEK_DURATION);
-                break;
-            }
-
-            default: {
-                final int dx = mMenuSize / 3;
-                mPeekScroller.startScroll(0, 0, dx, 0, PEEK_DURATION);
-                break;
-            }
-        }
-    }
-
-    @Override
-    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
-        super.onSizeChanged(w, h, oldw, oldh);
-        onOffsetPixelsChanged((int) mOffsetPixels);
-    }
-
-    @Override
-    protected void drawOverlay(Canvas canvas) {
-        final int width = getWidth();
-        final int height = getHeight();
-        final int offsetPixels = (int) mOffsetPixels;
-        final float openRatio = Math.abs(mOffsetPixels) / mMenuSize;
-
-        switch (getPosition()) {
-            case LEFT:
-                mMenuOverlay.setBounds(0, 0, offsetPixels, height);
-                break;
-
-            case RIGHT:
-                mMenuOverlay.setBounds(width + offsetPixels, 0, width, height);
-                break;
-
-            case TOP:
-                mMenuOverlay.setBounds(0, 0, width, offsetPixels);
-                break;
-
-            case BOTTOM:
-                mMenuOverlay.setBounds(0, height + offsetPixels, width, height);
-                break;
-        }
-
-        mMenuOverlay.setAlpha((int) (MAX_MENU_OVERLAY_ALPHA * (1.f - openRatio)));
-        mMenuOverlay.draw(canvas);
-    }
-
-    @Override
-    protected void onLayout(boolean changed, int l, int t, int r, int b) {
-        final int width = r - l;
-        final int height = b - t;
-
-        if (USE_TRANSLATIONS) {
-            mContentContainer.layout(0, 0, width, height);
-        } else {
-            final int offsetPixels = (int) mOffsetPixels;
-            if (getPosition() == Position.LEFT || getPosition() == Position.RIGHT) {
-                mContentContainer.layout(offsetPixels, 0, width + offsetPixels, height);
-            } else {
-                mContentContainer.layout(0, offsetPixels, width, height + offsetPixels);
-            }
-        }
-
-        switch (getPosition()) {
-            case LEFT:
-                mMenuContainer.layout(0, 0, mMenuSize, height);
-                break;
-
-            case RIGHT:
-                mMenuContainer.layout(width - mMenuSize, 0, width, height);
-                break;
-
-            case TOP:
-                mMenuContainer.layout(0, 0, width, mMenuSize);
-                break;
-
-            case BOTTOM:
-                mMenuContainer.layout(0, height - mMenuSize, width, height);
-                break;
-        }
-    }
-
-    /**
-     * Offsets the menu relative to its original position based on the position of the content.
-     *
-     * @param offsetPixels The number of pixels the content if offset.
-     */
-    private void offsetMenu(int offsetPixels) {
-        if (!mOffsetMenu || mMenuSize == 0) {
-            return;
-        }
-
-        final int width = getWidth();
-        final int height = getHeight();
-
-        final int menuSize = mMenuSize;
-        final int sign = (int) (mOffsetPixels / Math.abs(mOffsetPixels));
-        final float openRatio = Math.abs(mOffsetPixels) / menuSize;
-        final int offset = (int) (-0.25f * ((1.0f - openRatio) * menuSize) * sign);
-
-        switch (getPosition()) {
-            case LEFT: {
-                if (USE_TRANSLATIONS) {
-                    if (offsetPixels > 0) {
-                        mMenuContainer.setTranslationX(offset);
-                    } else {
-                        mMenuContainer.setTranslationX(-menuSize);
-                    }
-
-                } else {
-                    mMenuContainer.offsetLeftAndRight(offset - mMenuContainer.getLeft());
-                    mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE);
-                }
-                break;
-            }
-
-            case RIGHT: {
-                if (USE_TRANSLATIONS) {
-                    if (offsetPixels != 0) {
-                        mMenuContainer.setTranslationX(offset);
-                    } else {
-                        mMenuContainer.setTranslationX(menuSize);
-                    }
-
-                } else {
-                    final int oldOffset = mMenuContainer.getRight() - width;
-                    final int offsetBy = offset - oldOffset;
-                    mMenuContainer.offsetLeftAndRight(offsetBy);
-                    mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE);
-                }
-                break;
-            }
-
-            case TOP: {
-                if (USE_TRANSLATIONS) {
-                    if (offsetPixels > 0) {
-                        mMenuContainer.setTranslationY(offset);
-                    } else {
-                        mMenuContainer.setTranslationY(-menuSize);
-                    }
-
-                } else {
-                    mMenuContainer.offsetTopAndBottom(offset - mMenuContainer.getTop());
-                    mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE);
-                }
-                break;
-            }
-
-            case BOTTOM: {
-                if (USE_TRANSLATIONS) {
-                    if (offsetPixels != 0) {
-                        mMenuContainer.setTranslationY(offset);
-                    } else {
-                        mMenuContainer.setTranslationY(menuSize);
-                    }
-
-                } else {
-                    final int oldOffset = mMenuContainer.getBottom() - height;
-                    final int offsetBy = offset - oldOffset;
-                    mMenuContainer.offsetTopAndBottom(offsetBy);
-                    mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE);
-                }
-                break;
-            }
-        }
-
-    }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
-        final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
-
-        if (widthMode == MeasureSpec.UNSPECIFIED || heightMode == MeasureSpec.UNSPECIFIED) {
-            throw new IllegalStateException("Must measure with an exact size");
-        }
-
-        final int width = MeasureSpec.getSize(widthMeasureSpec);
-        final int height = MeasureSpec.getSize(heightMeasureSpec);
-
-        if (mOffsetPixels == -1) openMenu(false);
-
-        int menuWidthMeasureSpec;
-        int menuHeightMeasureSpec;
-        switch (getPosition()) {
-            case TOP:
-            case BOTTOM:
-                menuWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, width);
-                menuHeightMeasureSpec = getChildMeasureSpec(heightMeasureSpec, 0, mMenuSize);
-                break;
-
-            default:
-                // LEFT/RIGHT
-                menuWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, mMenuSize);
-                menuHeightMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, height);
-        }
-        mMenuContainer.measure(menuWidthMeasureSpec, menuHeightMeasureSpec);
-
-        final int contentWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, width);
-        final int contentHeightMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, height);
-        mContentContainer.measure(contentWidthMeasureSpec, contentHeightMeasureSpec);
-
-        setMeasuredDimension(width, height);
-
-        updateTouchAreaSize();
-    }
-
-    private boolean isContentTouch(int x, int y) {
-        boolean contentTouch = false;
-
-        switch (getPosition()) {
-            case LEFT:
-                contentTouch = ViewHelper.getLeft(mContentContainer) < x;
-                break;
-
-            case RIGHT:
-                contentTouch = ViewHelper.getRight(mContentContainer) > x;
-                break;
-
-            case TOP:
-                contentTouch = ViewHelper.getTop(mContentContainer) < y;
-                break;
-
-            case BOTTOM:
-                contentTouch = ViewHelper.getBottom(mContentContainer) > y;
-                break;
-        }
-
-        return contentTouch;
-    }
-
-    protected boolean onDownAllowDrag(int x, int y) {
-        switch (getPosition()) {
-            case LEFT:
-                return (!mMenuVisible && mInitialMotionX <= mTouchSize)
-                        || (mMenuVisible && mInitialMotionX >= mOffsetPixels);
-
-            case RIGHT:
-                final int width = getWidth();
-                final int initialMotionX = (int) mInitialMotionX;
-
-                return (!mMenuVisible && initialMotionX >= width - mTouchSize)
-                        || (mMenuVisible && initialMotionX <= width + mOffsetPixels);
-
-            case TOP:
-                return (!mMenuVisible && mInitialMotionY <= mTouchSize)
-                        || (mMenuVisible && mInitialMotionY >= mOffsetPixels);
-
-            case BOTTOM:
-                final int height = getHeight();
-                return (!mMenuVisible && mInitialMotionY >= height - mTouchSize)
-                        || (mMenuVisible && mInitialMotionY <= height + mOffsetPixels);
-        }
-
-        return false;
-    }
-
-    protected boolean onMoveAllowDrag(int x, int y, float dx, float dy) {
-        switch (getPosition()) {
-            case LEFT:
-                return (!mMenuVisible && mInitialMotionX <= mTouchSize && (dx > 0))
-                        || (mMenuVisible && x >= mOffsetPixels);
-
-            case RIGHT:
-                final int width = getWidth();
-                return (!mMenuVisible && mInitialMotionX >= width - mTouchSize && (dx < 0))
-                        || (mMenuVisible && x <= width + mOffsetPixels);
-
-            case TOP:
-                return (!mMenuVisible && mInitialMotionY <= mTouchSize && (dy > 0))
-                        || (mMenuVisible && y >= mOffsetPixels);
-
-            case BOTTOM:
-                final int height = getHeight();
-                return (!mMenuVisible && mInitialMotionY >= height - mTouchSize && (dy < 0))
-                        || (mMenuVisible && y <= height + mOffsetPixels);
-        }
-
-        return false;
-    }
-
-    protected void onMoveEvent(float dx, float dy) {
-        switch (getPosition()) {
-            case LEFT:
-                setOffsetPixels(Math.min(Math.max(mOffsetPixels + dx, 0), mMenuSize));
-                break;
-
-            case RIGHT:
-                setOffsetPixels(Math.max(Math.min(mOffsetPixels + dx, 0), -mMenuSize));
-                break;
-
-            case TOP:
-                setOffsetPixels(Math.min(Math.max(mOffsetPixels + dy, 0), mMenuSize));
-                break;
-
-            case BOTTOM:
-                setOffsetPixels(Math.max(Math.min(mOffsetPixels + dy, 0), -mMenuSize));
-                break;
-        }
-    }
-
-    protected void onUpEvent(int x, int y) {
-        final int offsetPixels = (int) mOffsetPixels;
-
-        switch (getPosition()) {
-            case LEFT: {
-                if (mIsDragging) {
-                    mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
-                    final int initialVelocity = (int) getXVelocity(mVelocityTracker);
-                    mLastMotionX = x;
-                    animateOffsetTo(initialVelocity > 0 ? mMenuSize : 0, initialVelocity, true);
-
-                    // Close the menu when content is clicked while the menu is visible.
-                } else if (mMenuVisible && x > offsetPixels) {
-                    closeMenu();
-                }
-                break;
-            }
-
-            case TOP: {
-                if (mIsDragging) {
-                    mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
-                    final int initialVelocity = (int) getYVelocity(mVelocityTracker);
-                    mLastMotionY = y;
-                    animateOffsetTo(initialVelocity > 0 ? mMenuSize : 0, initialVelocity, true);
-
-                    // Close the menu when content is clicked while the menu is visible.
-                } else if (mMenuVisible && y > offsetPixels) {
-                    closeMenu();
-                }
-                break;
-            }
-
-            case RIGHT: {
-                final int width = getWidth();
-
-                if (mIsDragging) {
-                    mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
-                    final int initialVelocity = (int) getXVelocity(mVelocityTracker);
-                    mLastMotionX = x;
-                    animateOffsetTo(initialVelocity > 0 ? 0 : -mMenuSize, initialVelocity, true);
-
-                    // Close the menu when content is clicked while the menu is visible.
-                } else if (mMenuVisible && x < width + offsetPixels) {
-                    closeMenu();
-                }
-                break;
-            }
-
-            case BOTTOM: {
-                if (mIsDragging) {
-                    mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
-                    final int initialVelocity = (int) getYVelocity(mVelocityTracker);
-                    mLastMotionY = y;
-                    animateOffsetTo(initialVelocity < 0 ? -mMenuSize : 0, initialVelocity, true);
-
-                    // Close the menu when content is clicked while the menu is visible.
-                } else if (mMenuVisible && y < getHeight() + offsetPixels) {
-                    closeMenu();
-                }
-                break;
-            }
-        }
-    }
-
-    protected boolean checkTouchSlop(float dx, float dy) {
-        switch (getPosition()) {
-            case TOP:
-            case BOTTOM:
-                return Math.abs(dy) > mTouchSlop && Math.abs(dy) > Math.abs(dx);
-
-            default:
-                return Math.abs(dx) > mTouchSlop && Math.abs(dx) > Math.abs(dy);
-        }
-    }
-
-    public boolean onInterceptTouchEvent(MotionEvent ev) {
-        final int action = ev.getAction() & MotionEvent.ACTION_MASK;
-
-        if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
-            mActivePointerId = INVALID_POINTER;
-            mIsDragging = false;
-            if (mVelocityTracker != null) {
-                mVelocityTracker.recycle();
-                mVelocityTracker = null;
-            }
-
-            if (Math.abs(mOffsetPixels) > mMenuSize / 2) {
-                openMenu();
-            } else {
-                closeMenu();
-            }
-
-            return false;
-        }
-
-        if (action == MotionEvent.ACTION_DOWN && mMenuVisible && isCloseEnough()) {
-            setOffsetPixels(0);
-            stopAnimation();
-            endPeek();
-            setDrawerState(STATE_CLOSED);
-            mIsDragging = false;
-        }
-
-        // Always intercept events over the content while menu is visible.
-        if (mMenuVisible) {
-            int index = 0;
-            if (mActivePointerId != INVALID_POINTER) {
-                index = ev.findPointerIndex(mActivePointerId);
-                index = index == -1 ? 0 : index;
-            }
-
-            final int x = (int) ev.getX(index);
-            final int y = (int) ev.getY(index);
-            if (isContentTouch(x, y)) {
-                return true;
-            }
-        }
-
-        if (!mMenuVisible && !mIsDragging && mTouchMode == TOUCH_MODE_NONE) {
-            return false;
-        }
-
-        if (action != MotionEvent.ACTION_DOWN && mIsDragging) {
-            return true;
-        }
-
-        switch (action) {
-            case MotionEvent.ACTION_DOWN: {
-                mLastMotionX = mInitialMotionX = ev.getX();
-                mLastMotionY = mInitialMotionY = ev.getY();
-                final boolean allowDrag = onDownAllowDrag((int) mLastMotionX, (int) mLastMotionY);
-                mActivePointerId = ev.getPointerId(0);
-
-                if (allowDrag) {
-                    setDrawerState(mMenuVisible ? STATE_OPEN : STATE_CLOSED);
-                    stopAnimation();
-                    endPeek();
-                    mIsDragging = false;
-                }
-                break;
-            }
-
-            case MotionEvent.ACTION_MOVE: {
-                final int activePointerId = mActivePointerId;
-                if (activePointerId == INVALID_POINTER) {
-                    // If we don't have a valid id, the touch down wasn't on content.
-                    break;
-                }
-
-                final int pointerIndex = ev.findPointerIndex(activePointerId);
-                if (pointerIndex == -1) {
-                    mIsDragging = false;
-                    mActivePointerId = INVALID_POINTER;
-                    endDrag();
-                    closeMenu(true);
-                    return false;
-                }
-
-                final float x = ev.getX(pointerIndex);
-                final float dx = x - mLastMotionX;
-                final float y = ev.getY(pointerIndex);
-                final float dy = y - mLastMotionY;
-
-                if (checkTouchSlop(dx, dy)) {
-                    if (mOnInterceptMoveEventListener != null && (mTouchMode == TOUCH_MODE_FULLSCREEN || mMenuVisible)
-                            && canChildrenScroll((int) dx, (int) dy, (int) x, (int) y)) {
-                        endDrag(); // Release the velocity tracker
-                        requestDisallowInterceptTouchEvent(true);
-                        return false;
-                    }
-
-                    final boolean allowDrag = onMoveAllowDrag((int) x, (int) y, dx, dy);
-
-                    if (allowDrag) {
-                        setDrawerState(STATE_DRAGGING);
-                        mIsDragging = true;
-                        mLastMotionX = x;
-                        mLastMotionY = y;
-                    }
-                }
-                break;
-            }
-
-            case MotionEvent.ACTION_POINTER_UP:
-                onPointerUp(ev);
-                mLastMotionX = ev.getX(ev.findPointerIndex(mActivePointerId));
-                mLastMotionY = ev.getY(ev.findPointerIndex(mActivePointerId));
-                break;
-        }
-
-        if (mVelocityTracker == null) mVelocityTracker = VelocityTracker.obtain();
-        mVelocityTracker.addMovement(ev);
-
-        return mIsDragging;
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent ev) {
-        if (!mMenuVisible && !mIsDragging && mTouchMode == TOUCH_MODE_NONE) {
-            return false;
-        }
-        final int action = ev.getAction() & MotionEvent.ACTION_MASK;
-
-        if (mVelocityTracker == null) mVelocityTracker = VelocityTracker.obtain();
-        mVelocityTracker.addMovement(ev);
-
-        switch (action) {
-            case MotionEvent.ACTION_DOWN: {
-                mLastMotionX = mInitialMotionX = ev.getX();
-                mLastMotionY = mInitialMotionY = ev.getY();
-                final boolean allowDrag = onDownAllowDrag((int) mLastMotionX, (int) mLastMotionY);
-
-                mActivePointerId = ev.getPointerId(0);
-
-                if (allowDrag) {
-                    stopAnimation();
-                    endPeek();
-                    startLayerTranslation();
-                }
-                break;
-            }
-
-            case MotionEvent.ACTION_MOVE: {
-                final int pointerIndex = ev.findPointerIndex(mActivePointerId);
-                if (pointerIndex == -1) {
-                    mIsDragging = false;
-                    mActivePointerId = INVALID_POINTER;
-                    endDrag();
-                    closeMenu(true);
-                    return false;
-                }
-
-                if (!mIsDragging) {
-                    final float x = ev.getX(pointerIndex);
-                    final float dx = x - mLastMotionX;
-                    final float y = ev.getY(pointerIndex);
-                    final float dy = y - mLastMotionY;
-
-                    if (checkTouchSlop(dx, dy)) {
-                        final boolean allowDrag = onMoveAllowDrag((int) x, (int) y, dx, dy);
-
-                        if (allowDrag) {
-                            setDrawerState(STATE_DRAGGING);
-                            mIsDragging = true;
-                            mLastMotionX = x;
-                            mLastMotionY = y;
-                        } else {
-                            mInitialMotionX = x;
-                            mInitialMotionY = y;
-                        }
-                    }
-                }
-
-                if (mIsDragging) {
-                    startLayerTranslation();
-
-                    final float x = ev.getX(pointerIndex);
-                    final float dx = x - mLastMotionX;
-                    final float y = ev.getY(pointerIndex);
-                    final float dy = y - mLastMotionY;
-
-                    mLastMotionX = x;
-                    mLastMotionY = y;
-                    onMoveEvent(dx, dy);
-                }
-                break;
-            }
-
-            case MotionEvent.ACTION_CANCEL:
-            case MotionEvent.ACTION_UP: {
-                int index = ev.findPointerIndex(mActivePointerId);
-                index = index == -1 ? 0 : index;
-                final int x = (int) ev.getX(index);
-                final int y = (int) ev.getY(index);
-                onUpEvent(x, y);
-                mActivePointerId = INVALID_POINTER;
-                mIsDragging = false;
-                break;
-            }
-
-            case MotionEvent.ACTION_POINTER_DOWN:
-                final int index = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK)
-                        >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
-                mLastMotionX = ev.getX(index);
-                mLastMotionY = ev.getY(index);
-                mActivePointerId = ev.getPointerId(index);
-                break;
-
-            case MotionEvent.ACTION_POINTER_UP:
-                onPointerUp(ev);
-                mLastMotionX = ev.getX(ev.findPointerIndex(mActivePointerId));
-                mLastMotionY = ev.getY(ev.findPointerIndex(mActivePointerId));
-                break;
-        }
-
-        return true;
-    }
-
-    private void onPointerUp(MotionEvent ev) {
-        final int pointerIndex = ev.getActionIndex();
-        final int pointerId = ev.getPointerId(pointerIndex);
-        if (pointerId == mActivePointerId) {
-            final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
-            mLastMotionX = ev.getX(newPointerIndex);
-            mActivePointerId = ev.getPointerId(newPointerIndex);
-            if (mVelocityTracker != null) {
-                mVelocityTracker.clear();
-            }
-        }
-    }
-}

+ 0 - 12
librarymenudrawer/src/main/java/net/simonvt/menudrawer/SmoothInterpolator.java

@@ -1,12 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.view.animation.Interpolator;
-
-class SmoothInterpolator implements Interpolator {
-
-    @Override
-    public float getInterpolation(float t) {
-        t -= 1.0f;
-        return t * t * t * t * t + 1.0f;
-    }
-}

+ 0 - 218
librarymenudrawer/src/main/java/net/simonvt/menudrawer/StaticDrawer.java

@@ -1,218 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.app.Activity;
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-
-public class StaticDrawer extends MenuDrawer {
-
-    public StaticDrawer(Context context) {
-        super(context);
-    }
-
-    public StaticDrawer(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public StaticDrawer(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-    }
-
-    @Override
-    protected void initDrawer(Context context, AttributeSet attrs, int defStyle) {
-        super.initDrawer(context, attrs, defStyle);
-        super.addView(mMenuContainer, -1, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
-        super.addView(mContentContainer, -1, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
-
-        mIsStatic = true;
-    }
-
-    @Override
-    protected void drawOverlay(Canvas canvas) {
-        // NO-OP
-    }
-
-    @Override
-    protected void onOffsetPixelsChanged(int offsetPixels) {
-        // NO-OP
-    }
-
-    @Override
-    protected void onLayout(boolean changed, int l, int t, int r, int b) {
-        final int width = r - l;
-        final int height = b - t;
-
-        switch (getPosition()) {
-            case LEFT:
-                mMenuContainer.layout(0, 0, mMenuSize, height);
-                mContentContainer.layout(mMenuSize, 0, width, height);
-                break;
-
-            case RIGHT:
-                mMenuContainer.layout(width - mMenuSize, 0, width, height);
-                mContentContainer.layout(0, 0, width - mMenuSize, height);
-                break;
-
-            case TOP:
-                mMenuContainer.layout(0, 0, width, mMenuSize);
-                mContentContainer.layout(0, mMenuSize, width, height);
-                break;
-
-            case BOTTOM:
-                mMenuContainer.layout(0, height - mMenuSize, width, height);
-                mContentContainer.layout(0, 0, width, height - mMenuSize);
-                break;
-        }
-    }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
-        final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
-
-        if (widthMode == MeasureSpec.UNSPECIFIED || heightMode == MeasureSpec.UNSPECIFIED) {
-            throw new IllegalStateException("Must measure with an exact size");
-        }
-
-        final int width = MeasureSpec.getSize(widthMeasureSpec);
-        final int height = MeasureSpec.getSize(heightMeasureSpec);
-
-        switch (getPosition()) {
-            case LEFT:
-            case RIGHT: {
-                final int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
-
-                final int menuWidth = mMenuSize;
-                final int menuWidthMeasureSpec = MeasureSpec.makeMeasureSpec(menuWidth, MeasureSpec.EXACTLY);
-
-                final int contentWidth = width - menuWidth;
-                final int contentWidthMeasureSpec = MeasureSpec.makeMeasureSpec(contentWidth, MeasureSpec.EXACTLY);
-
-                mContentContainer.measure(contentWidthMeasureSpec, childHeightMeasureSpec);
-                mMenuContainer.measure(menuWidthMeasureSpec, childHeightMeasureSpec);
-                break;
-            }
-
-            case TOP:
-            case BOTTOM: {
-                final int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
-
-                final int menuHeight = mMenuSize;
-                final int menuHeightMeasureSpec = MeasureSpec.makeMeasureSpec(menuHeight, MeasureSpec.EXACTLY);
-
-                final int contentHeight = height - menuHeight;
-                final int contentHeightMeasureSpec = MeasureSpec.makeMeasureSpec(contentHeight, MeasureSpec.EXACTLY);
-
-                mContentContainer.measure(childWidthMeasureSpec, contentHeightMeasureSpec);
-                mMenuContainer.measure(childWidthMeasureSpec, menuHeightMeasureSpec);
-                break;
-            }
-        }
-
-        setMeasuredDimension(width, height);
-    }
-
-    @Override
-    public void toggleMenu(boolean animate) {
-        // NO-OP
-    }
-
-    @Override
-    public void openMenu(boolean animate) {
-        // NO-OP
-    }
-
-    @Override
-    public void closeMenu(boolean animate) {
-        // NO-OP
-    }
-
-    @Override
-    public boolean isMenuVisible() {
-        return true;
-    }
-
-    @Override
-    public void setMenuSize(int size) {
-        mMenuSize = size;
-        requestLayout();
-        invalidate();
-    }
-
-    @Override
-    public void setOffsetMenuEnabled(boolean offsetMenu) {
-        // NO-OP
-    }
-
-    @Override
-    public boolean getOffsetMenuEnabled() {
-        return false;
-    }
-
-    @Override
-    public void peekDrawer() {
-        // NO-OP
-    }
-
-    @Override
-    public void peekDrawer(long delay) {
-        // NO-OP
-    }
-
-    @Override
-    public void peekDrawer(long startDelay, long delay) {
-        // NO-OP
-    }
-
-    @Override
-    public void setHardwareLayerEnabled(boolean enabled) {
-        // NO-OP
-    }
-
-    @Override
-    public int getTouchMode() {
-        return TOUCH_MODE_NONE;
-    }
-
-    @Override
-    public void setTouchMode(int mode) {
-        // NO-OP
-    }
-
-    @Override
-    public void setTouchBezelSize(int size) {
-        // NO-OP
-    }
-
-    @Override
-    public int getTouchBezelSize() {
-        return 0;
-    }
-
-    @Override
-    public void setSlideDrawable(int drawableRes) {
-        // NO-OP
-    }
-
-    @Override
-    public void setSlideDrawable(Drawable drawable) {
-        // NO-OP
-    }
-
-    @Override
-    public void setupUpIndicator(Activity activity) {
-        // NO-OP
-    }
-
-    @Override
-    public void setDrawerIndicatorEnabled(boolean enabled) {
-        // NO-OP
-    }
-
-    @Override
-    public boolean isDrawerIndicatorEnabled() {
-        return false;
-    }
-}

+ 0 - 50
librarymenudrawer/src/main/java/net/simonvt/menudrawer/ViewHelper.java

@@ -1,50 +0,0 @@
-package net.simonvt.menudrawer;
-
-import android.os.Build;
-import android.view.View;
-
-final class ViewHelper {
-
-    private ViewHelper() {
-    }
-
-    public static int getLeft(View v) {
-        if (MenuDrawer.USE_TRANSLATIONS) {
-            return (int) (v.getLeft() + v.getTranslationX());
-        }
-
-        return v.getLeft();
-    }
-
-    public static int getTop(View v) {
-        if (MenuDrawer.USE_TRANSLATIONS) {
-            return (int) (v.getTop() + v.getTranslationY());
-        }
-
-        return v.getTop();
-    }
-
-    public static int getRight(View v) {
-        if (MenuDrawer.USE_TRANSLATIONS) {
-            return (int) (v.getRight() + v.getTranslationX());
-        }
-
-        return v.getRight();
-    }
-
-    public static int getBottom(View v) {
-        if (MenuDrawer.USE_TRANSLATIONS) {
-            return (int) (v.getBottom() + v.getTranslationY());
-        }
-
-        return v.getBottom();
-    }
-
-    public static int getLayoutDirection(View v) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
-            return v.getLayoutDirection();
-        }
-
-        return View.LAYOUT_DIRECTION_LTR;
-    }
-}

+ 0 - 83
librarymenudrawer/src/main/java/net/simonvt/menudrawer/compat/ActionBarHelper.java

@@ -1,83 +0,0 @@
-package net.simonvt.menudrawer.compat;
-
-import android.app.Activity;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
-import android.util.Log;
-
-import java.lang.reflect.Method;
-
-public final class ActionBarHelper {
-
-    private static final String TAG = "ActionBarHelper";
-
-    static final boolean DEBUG = false;
-
-    private Activity mActivity;
-
-    private Object mIndicatorInfo;
-
-    private boolean mUsesCompat;
-
-    public ActionBarHelper(Activity activity) {
-        mActivity = activity;
-
-        try {
-            Class clazz = activity.getClass();
-            Method m = clazz.getMethod("getSupportActionBar");
-            mUsesCompat = true;
-        } catch (NoSuchMethodException e) {
-            if (DEBUG) {
-                Log.e(TAG,
-                        "Activity " + activity.getClass().getSimpleName() + " does not use a compatibility action bar",
-                        e);
-            }
-        }
-
-        mIndicatorInfo = getIndicatorInfo();
-    }
-
-    private Object getIndicatorInfo() {
-        if (mUsesCompat && Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
-            return ActionBarHelperCompat.getIndicatorInfo(mActivity);
-        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
-            return ActionBarHelperNative.getIndicatorInfo(mActivity);
-        }
-
-        return null;
-    }
-
-    public void setActionBarUpIndicator(Drawable drawable, int contentDesc) {
-        if (mUsesCompat && Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
-            ActionBarHelperCompat.setActionBarUpIndicator(mIndicatorInfo, mActivity, drawable, contentDesc);
-        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
-            ActionBarHelperNative.setActionBarUpIndicator(mIndicatorInfo, mActivity, drawable, contentDesc);
-        }
-    }
-
-    public void setActionBarDescription(int contentDesc) {
-        if (mUsesCompat && Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
-            ActionBarHelperCompat.setActionBarDescription(mIndicatorInfo, mActivity, contentDesc);
-        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
-            ActionBarHelperNative.setActionBarDescription(mIndicatorInfo, mActivity, contentDesc);
-        }
-    }
-
-    public Drawable getThemeUpIndicator() {
-        if (mUsesCompat && Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
-            return ActionBarHelperCompat.getThemeUpIndicator(mIndicatorInfo);
-        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
-            return ActionBarHelperNative.getThemeUpIndicator(mIndicatorInfo, mActivity);
-        }
-
-        return null;
-    }
-
-    public void setDisplayShowHomeAsUpEnabled(boolean enabled) {
-        if (mUsesCompat && Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
-            ActionBarHelperCompat.setDisplayHomeAsUpEnabled(mIndicatorInfo, enabled);
-        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
-            ActionBarHelperNative.setDisplayHomeAsUpEnabled(mActivity, enabled);
-        }
-    }
-}

+ 0 - 107
librarymenudrawer/src/main/java/net/simonvt/menudrawer/compat/ActionBarHelperCompat.java

@@ -1,107 +0,0 @@
-package net.simonvt.menudrawer.compat;
-
-import android.app.Activity;
-import android.graphics.drawable.Drawable;
-import android.util.Log;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-
-import java.lang.reflect.Method;
-
-final class ActionBarHelperCompat {
-
-    private static final String TAG = "ActionBarHelperCompat";
-
-    private ActionBarHelperCompat() {
-    }
-
-    public static void setActionBarUpIndicator(Object info, Activity activity, Drawable drawable, int contentDescRes) {
-        final SetIndicatorInfo sii = (SetIndicatorInfo) info;
-        if (sii.mUpIndicatorView != null) {
-            sii.mUpIndicatorView.setImageDrawable(drawable);
-            final String contentDescription = contentDescRes == 0 ? null : activity.getString(contentDescRes);
-            sii.mUpIndicatorView.setContentDescription(contentDescription);
-        }
-    }
-
-    public static void setActionBarDescription(Object info, Activity activity, int contentDescRes) {
-        final SetIndicatorInfo sii = (SetIndicatorInfo) info;
-        if (sii.mUpIndicatorView != null) {
-            final String contentDescription = contentDescRes == 0 ? null : activity.getString(contentDescRes);
-            sii.mUpIndicatorView.setContentDescription(contentDescription);
-        }
-    }
-
-    public static Drawable getThemeUpIndicator(Object info) {
-        final SetIndicatorInfo sii = (SetIndicatorInfo) info;
-        if (sii.mUpIndicatorView != null) {
-            return sii.mUpIndicatorView.getDrawable();
-        }
-        return null;
-    }
-
-    public static Object getIndicatorInfo(Activity activity) {
-        return new SetIndicatorInfo(activity);
-    }
-
-    public static void setDisplayHomeAsUpEnabled(Object info, boolean enabled) {
-        final SetIndicatorInfo sii = (SetIndicatorInfo) info;
-        if (sii.mHomeAsUpEnabled != null) {
-            try {
-                sii.mHomeAsUpEnabled.invoke(sii.mActionBar, enabled);
-            } catch (Throwable t) {
-                if (ActionBarHelper.DEBUG) {
-                    Log.e(TAG, "Unable to call setHomeAsUpEnabled", t);
-                }
-            }
-        }
-    }
-
-    private static class SetIndicatorInfo {
-
-        public ImageView mUpIndicatorView;
-        public Object mActionBar;
-        public Method mHomeAsUpEnabled;
-
-        SetIndicatorInfo(Activity activity) {
-            try {
-                String appPackage = activity.getPackageName();
-
-                try {
-                    // Attempt to find ActionBarSherlock up indicator
-                    final int homeId = activity.getResources().getIdentifier("abs__home", "id", appPackage);
-                    View v = activity.findViewById(homeId);
-                    ViewGroup parent = (ViewGroup) v.getParent();
-                    final int upId = activity.getResources().getIdentifier("abs__up", "id", appPackage);
-                    mUpIndicatorView = (ImageView) parent.findViewById(upId);
-                } catch (Throwable t) {
-                    if (ActionBarHelper.DEBUG) {
-                        Log.e(TAG, "ABS action bar not found", t);
-                    }
-                }
-
-                if (mUpIndicatorView == null) {
-                    // Attempt to find AppCompat up indicator
-                    final int homeId = activity.getResources().getIdentifier("home", "id", appPackage);
-                    View v = activity.findViewById(homeId);
-                    ViewGroup parent = (ViewGroup) v.getParent();
-                    final int upId = activity.getResources().getIdentifier("up", "id", appPackage);
-                    mUpIndicatorView = (ImageView) parent.findViewById(upId);
-                }
-
-                Class supportActivity = activity.getClass();
-                Method getActionBar = supportActivity.getMethod("getSupportActionBar");
-
-                mActionBar = getActionBar.invoke(activity, null);
-                Class supportActionBar = mActionBar.getClass();
-                mHomeAsUpEnabled = supportActionBar.getMethod("setDisplayHomeAsUpEnabled", Boolean.TYPE);
-
-            } catch (Throwable t) {
-                if (ActionBarHelper.DEBUG) {
-                    Log.e(TAG, "Unable to init SetIndicatorInfo for ABS", t);
-                }
-            }
-        }
-    }
-}

+ 0 - 114
librarymenudrawer/src/main/java/net/simonvt/menudrawer/compat/ActionBarHelperNative.java

@@ -1,114 +0,0 @@
-package net.simonvt.menudrawer.compat;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
-import android.util.Log;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-
-import java.lang.reflect.Method;
-
-final class ActionBarHelperNative {
-
-    private static final String TAG = "ActionBarHelperNative";
-
-    private ActionBarHelperNative() {
-    }
-
-    private static final int[] THEME_ATTRS = new int[] {
-            android.R.attr.homeAsUpIndicator
-    };
-
-    public static void setActionBarUpIndicator(Object info, Activity activity, Drawable drawable, int contentDescRes) {
-
-        final SetIndicatorInfo sii = (SetIndicatorInfo) info;
-        if (sii.setHomeAsUpIndicator != null) {
-            try {
-                final ActionBar actionBar = activity.getActionBar();
-                sii.setHomeAsUpIndicator.invoke(actionBar, drawable);
-                sii.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
-            } catch (Throwable t) {
-                if (ActionBarHelper.DEBUG) Log.e(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", t);
-            }
-        } else if (sii.upIndicatorView != null) {
-            sii.upIndicatorView.setImageDrawable(drawable);
-        } else {
-            if (ActionBarHelper.DEBUG) Log.e(TAG, "Couldn't set home-as-up indicator");
-        }
-    }
-
-    public static void setActionBarDescription(Object info, Activity activity, int contentDescRes) {
-        final SetIndicatorInfo sii = (SetIndicatorInfo) info;
-        if (sii.setHomeAsUpIndicator != null) {
-            try {
-                final ActionBar actionBar = activity.getActionBar();
-                sii.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
-            } catch (Throwable t) {
-                if (ActionBarHelper.DEBUG) Log.e(TAG, "Couldn't set content description via JB-MR2 API", t);
-            }
-        }
-    }
-
-    public static Drawable getThemeUpIndicator(Object info, Activity activity) {
-        final TypedArray a = activity.obtainStyledAttributes(THEME_ATTRS);
-        final Drawable result = a.getDrawable(0);
-        a.recycle();
-        return result;
-    }
-
-    public static Object getIndicatorInfo(Activity activity) {
-        return new SetIndicatorInfo(activity);
-    }
-
-    public static void setDisplayHomeAsUpEnabled(Activity activity, boolean b) {
-        ActionBar actionBar = activity.getActionBar();
-        if (actionBar != null) {
-            actionBar.setDisplayHomeAsUpEnabled(b);
-        }
-    }
-
-    private static class SetIndicatorInfo {
-
-        public Method setHomeAsUpIndicator;
-        public Method setHomeActionContentDescription;
-        public ImageView upIndicatorView;
-
-        SetIndicatorInfo(Activity activity) {
-            try {
-                setHomeAsUpIndicator = ActionBar.class.getDeclaredMethod("setHomeAsUpIndicator", Drawable.class);
-                setHomeActionContentDescription = ActionBar.class.getDeclaredMethod(
-                        "setHomeActionContentDescription", Integer.TYPE);
-
-                // If we got the method we won't need the stuff below.
-                return;
-            } catch (Throwable t) {
-                // Oh well. We'll use the other mechanism below instead.
-            }
-
-            final View home = activity.findViewById(android.R.id.home);
-            if (home == null) {
-                // Action bar doesn't have a known configuration, an OEM messed with things.
-                return;
-            }
-
-            final ViewGroup parent = (ViewGroup) home.getParent();
-            final int childCount = parent.getChildCount();
-            if (childCount != 2) {
-                // No idea which one will be the right one, an OEM messed with things.
-                return;
-            }
-
-            final View first = parent.getChildAt(0);
-            final View second = parent.getChildAt(1);
-            final View up = first.getId() == android.R.id.home ? second : first;
-
-            if (up instanceof ImageView) {
-                // Jackpot! (Probably...)
-                upIndicatorView = (ImageView) up;
-            }
-        }
-    }
-}

+ 0 - 65
librarymenudrawer/src/main/res/values/attrs.xml

@@ -1,65 +0,0 @@
-<resources>
-
-    <!-- Reference to a style for the menu drawer. -->
-    <attr name="menuDrawerStyle" format="reference" />
-
-    <!-- Styleables used for styling the menu drawer. -->
-    <declare-styleable name="MenuDrawer">
-
-        <!-- Drawable to use for the background of the content. -->
-        <attr name="mdContentBackground" format="reference" />
-
-        <!-- Drawable to use for the background of the menu. -->
-        <attr name="mdMenuBackground" format="reference" />
-
-        <!-- The size of the menu. -->
-        <attr name="mdMenuSize" format="dimension" />
-
-        <!-- Drawable used as indicator for the active view. -->
-        <attr name="mdActiveIndicator" format="reference" />
-
-        <!-- Defines whether the content will have a dropshadow onto the menu. Default is true. -->
-        <attr name="mdDropShadowEnabled" format="boolean" />
-
-        <!-- The size of the drop shadow. Default is 6dp -->
-        <attr name="mdDropShadowSize" format="dimension" />
-
-        <!-- The color of the drop shadow. Default is #FF000000. -->
-        <attr name="mdDropShadowColor" format="color" />
-
-        <!-- Drawable used for the drop shadow. -->
-        <attr name="mdDropShadow" format="reference" />
-
-        <!-- The touch bezel size. -->
-        <attr name="mdTouchBezelSize" format="dimension" />
-
-        <!-- Whether the indicator should be animated between active views. -->
-        <attr name="mdAllowIndicatorAnimation" format="boolean" />
-
-        <!-- The maximum animation duration -->
-        <attr name="mdMaxAnimationDuration" format="integer" />
-
-        <!-- Drawable that replaces the up indicator -->
-        <attr name="mdSlideDrawable" format="reference" />
-
-        <!-- String to use as the up indicators content description when the drawer is open -->
-        <attr name="mdDrawerOpenUpContentDescription" format="string" />
-
-        <!-- String to use as the up indicators content description when the drawer is closed -->
-        <attr name="mdDrawerClosedUpContentDescription" format="string" />
-
-        <!-- Whether an overlay should be drawn as the drawer is opened and closed -->
-        <attr name="mdDrawOverlay" format="boolean" />
-
-        <!-- The position of the drawer -->
-        <attr name="mdPosition" format="enum">
-            <enum name="left" value="0" />
-            <enum name="top" value="1" />
-            <enum name="right" value="2" />
-            <enum name="bottom" value="3" />
-            <enum name="start" value="4" />
-            <enum name="end" value="5" />
-        </attr>
-    </declare-styleable>
-
-</resources>

+ 0 - 6
librarymenudrawer/src/main/res/values/colors.xml

@@ -1,6 +0,0 @@
-<resources>
-
-    <!-- The default background of the menu. -->
-    <color name="md__defaultBackground">#FF555555</color>
-
-</resources>

+ 0 - 24
librarymenudrawer/src/main/res/values/ids.xml

@@ -1,24 +0,0 @@
-<resources>
-
-    <!-- ID used when defining the content layout in XML. -->
-    <item name="mdContent" type="id" />
-
-    <!-- ID used when defining the menu layout in XML. -->
-    <item name="mdMenu" type="id" />
-
-    <!-- The ID of the content container. -->
-    <item name="md__content" type="id" />
-
-    <!-- The ID of the menu container. -->
-    <item name="md__menu" type="id" />
-
-    <!-- The ID of the drawer. -->
-    <item name="md__drawer" type="id" />
-
-    <!-- Used with View#setTag(int) to specify a position for the active view. -->
-    <item name="mdActiveViewPosition" type="id" />
-
-    <item name="md__translationX" type="id" />
-
-    <item name="md__translationY" type="id" />
-</resources>

+ 0 - 8
librarymenudrawer/src/main/res/values/strings.xml

@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
-    <string name="md__drawerOpenIndicatorDesc">Close drawer</string>
-
-    <string name="md__drawerClosedIndicatorDesc">Open drawer</string>
-
-</resources>

+ 0 - 13
librarymenudrawer/src/main/res/values/styles.xml

@@ -1,13 +0,0 @@
-<resources>
-
-    <style name="Widget" />
-
-    <!-- Base theme for the menu drawer. -->
-    <style name="Widget.MenuDrawer">
-        <item name="mdMenuBackground">@color/md__defaultBackground</item>
-        <item name="mdContentBackground">?android:attr/windowBackground</item>
-        <item name="mdDrawerOpenUpContentDescription">@string/md__drawerOpenIndicatorDesc</item>
-        <item name="mdDrawerClosedUpContentDescription">@string/md__drawerClosedIndicatorDesc</item>
-    </style>
-
-</resources>