Skip to content

Commit

Permalink
Merge remote-tracking branch 'official/master'
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
	library/build.gradle
  • Loading branch information
blinkseb committed Jan 12, 2014
2 parents be1549f + d929476 commit 9067047
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 20 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ gen
.DS_Store
target/

*.iml

# Gradle
.gradle
local.properties
gradle.properties
build/
build/
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ to use it all you want in your Android apps provided that you cite this project

SlidingMenu is currently used in some awesome Android apps. Here's a list of some of them:
* [Foursquare][15]
* [LinkedIn][19]
* [Zappos][20]
* [Rdio][8]
* [Evernote Food][18]
* [Plume][4]
Expand Down Expand Up @@ -180,3 +182,5 @@ License
[16]: https://play.google.com/store/apps/details?id=com.mlssoccer
[17]: https://play.google.com/store/apps/details?id=com.ninegag.android.app
[18]: https://play.google.com/store/apps/details?id=com.evernote.food
[19]: https://play.google.com/store/apps/details?id=com.linkedin.android
[20]: https://play.google.com/store/apps/details?id=com.zappos.android
17 changes: 9 additions & 8 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.+'
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android-library'
apply plugin: 'maven'


archivesBaseName = 'slidingmenu'
version = '1.3'
version = '1.3.1-SNAPSHOT'

repositories {
mavenCentral()
}

dependencies {
compile 'com.android.support:support-v4:13.0.0'
compile 'com.android.support:support-v4:19.0.1'
}

android {
Expand All @@ -30,23 +31,23 @@ android {
}
}

compileSdkVersion 17
buildToolsVersion "17.0.0"
compileSdkVersion 19
buildToolsVersion "19.0.1"

defaultConfig {
minSdkVersion 7
targetSdkVersion 17
targetSdkVersion 19
}
}

uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://maven.madalynn.eu:8081/nexus/content/repositories/androirc") {
repository(url: "http://nexus.madalynn.eu/nexus/content/repositories/androirc") {
authentication(userName: maven_user, password: maven_password)
pom.artifactId = 'slidingmenu'
pom.groupId = 'com.jeremyfeinstein.slidingmenu'
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,6 @@ public boolean onTouchEvent(MotionEvent ev) {
int initialVelocity = (int) VelocityTrackerCompat.getXVelocity(
velocityTracker, mActivePointerId);
final int scrollX = getScrollX();
// final int widthWithMargin = getWidth();
// final float pageOffset = (float) (scrollX % widthWithMargin) / widthWithMargin;
// TODO test this. should get better flinging behavior
final float pageOffset = (float) (scrollX - getDestScrollX(mCurItem)) / getBehindWidth();
final int activePointerIndex = getPointerIndex(ev, mActivePointerId);
if (mActivePointerId != INVALID_POINTER) {
Expand Down Expand Up @@ -781,7 +778,7 @@ public boolean onTouchEvent(MotionEvent ev) {
private void determineDrag(MotionEvent ev) {
final int activePointerId = mActivePointerId;
final int pointerIndex = getPointerIndex(ev, activePointerId);
if (activePointerId == INVALID_POINTER)
if (activePointerId == INVALID_POINTER || pointerIndex == INVALID_POINTER)
return;
final float x = MotionEventCompat.getX(ev, pointerIndex);
final float dx = x - mLastMotionX;
Expand Down
26 changes: 20 additions & 6 deletions library/src/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

public class SlidingMenu extends RelativeLayout {

private static final String TAG = "SlidingMenu";
private static final String TAG = SlidingMenu.class.getSimpleName();

public static final int SLIDING_WINDOW = 0;
public static final int SLIDING_CONTENT = 1;
Expand Down Expand Up @@ -69,6 +69,8 @@ public class SlidingMenu extends RelativeLayout {
private CustomViewBehind mViewBehind;

private OnOpenListener mOpenListener;

private OnOpenListener mSecondaryOpenListner;

private OnCloseListener mCloseListener;

Expand Down Expand Up @@ -213,6 +215,7 @@ public SlidingMenu(Context context, AttributeSet attrs, int defStyle) {
mViewAbove.setOnPageChangeListener(new OnPageChangeListener() {
public static final int POSITION_OPEN = 0;
public static final int POSITION_CLOSE = 1;
public static final int POSITION_SECONDARY_OPEN = 2;

public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) { }
Expand All @@ -222,6 +225,8 @@ public void onPageSelected(int position) {
mOpenListener.onOpen();
} else if (position == POSITION_CLOSE && mCloseListener != null) {
mCloseListener.onClose();
} else if (position == POSITION_SECONDARY_OPEN && mSecondaryOpenListner != null ) {
mSecondaryOpenListner.onOpen();
}
}
});
Expand Down Expand Up @@ -903,8 +908,19 @@ public void setOnOpenListener(OnOpenListener listener) {
mOpenListener = listener;
}


/**
* Sets the OnOpenListner for secondary menu {@link OnOpenListener#onOpen() OnOpenListener.onOpen()} will be called when the secondary SlidingMenu is opened
*
* @param listener the new OnOpenListener
*/

public void setSecondaryOnOpenListner(OnOpenListener listener) {
mSecondaryOpenListner = listener;
}

/**
* Sets the OnCloseListener. {@link OnCloseListener#onClose() OnCloseListener.onClose()} will be called when the SlidingMenu is closed
* Sets the OnCloseListener. {@link OnCloseListener#onClose() OnCloseListener.onClose()} will be called when any one of the SlidingMenu is closed
*
* @param listener the new setOnCloseListener
*/
Expand Down Expand Up @@ -1006,8 +1022,6 @@ protected boolean fitSystemWindows(Rect insets) {
}
return true;
}

private Handler mHandler = new Handler();

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void manageLayers(float percentOpen) {
Expand All @@ -1017,7 +1031,7 @@ public void manageLayers(float percentOpen) {
final int layerType = layer ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE;

if (layerType != getContent().getLayerType()) {
mHandler.post(new Runnable() {
getHandler().post(new Runnable() {
public void run() {
Log.v(TAG, "changing layerType. hardware? " + (layerType == View.LAYER_TYPE_HARDWARE));
getContent().setLayerType(layerType, null);
Expand All @@ -1030,4 +1044,4 @@ public void run() {
}
}

}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>

<configuration>
<sdk>
Expand Down

0 comments on commit 9067047

Please sign in to comment.