Skip to content

Commit

Permalink
Renaming behind to menu and above to content
Browse files Browse the repository at this point in the history
  • Loading branch information
jfeinstein10 committed Nov 28, 2012
1 parent 2e6b8b7 commit 18dec7b
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 59 deletions.
4 changes: 2 additions & 2 deletions example/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=Google Inc.:Google APIs:16
target=android-17
android.library=false
android.library.reference.1=../library
android.library.reference.2=../ABS
proguard.config=proguard-project.txt
proguard.config=proguard-project.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void switchContent(Fragment fragment) {
.beginTransaction()
.replace(R.id.content_frame, fragment)
.commit();
getSlidingMenu().showAbove();
getSlidingMenu().showContent();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void switchContent(final Fragment fragment) {
Handler h = new Handler();
h.postDelayed(new Runnable() {
public void run() {
getSlidingMenu().showAbove();
getSlidingMenu().showContent();
}
}, 50);
}
Expand Down
50 changes: 34 additions & 16 deletions library/src/com/slidingmenu/lib/SlidingMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public void setContent(int res) {
public void setContent(View view) {
mViewAbove.setContent(view);
mViewAbove.invalidate();
showAbove();
showContent();
}

/**
Expand Down Expand Up @@ -433,34 +433,52 @@ public void setStatic(boolean b) {
}

/**
* Opens the menu and shows the behind view.
* Opens the menu and shows the menu view.
*/
public void showBehind() {
showBehind(true);
public void showMenu() {
showMenu(true);
}

/**
* Opens the menu and shows the behind view.
* Opens the menu and shows the menu view.
*
* @param animate true to animate the transition, false to ignore animation
*/
public void showBehind(boolean animate) {
public void showMenu(boolean animate) {
mViewAbove.setCurrentItem(0, animate);
}

/**
* Opens the menu and shows the secondary menu view. Will default to the regular menu
* if there is only one.
*/
public void showSecondaryMenu() {
showSecondaryMenu(true);
}

/**
* Opens the menu and shows the secondary (right) menu view. Will default to the regular menu
* if there is only one.
*
* @param animate true to animate the transition, false to ignore animation
*/
public void showSecondaryMenu(boolean animate) {
mViewAbove.setCurrentItem(2, animate);
}

/**
* Closes the menu and shows the above view.
*/
public void showAbove() {
showAbove(true);
public void showContent() {
showContent(true);
}

/**
* Closes the menu and shows the above view.
*
* @param animate true to animate the transition, false to ignore animation
*/
public void showAbove(boolean animate) {
public void showContent(boolean animate) {
mViewAbove.setCurrentItem(1, animate);
}

Expand All @@ -477,10 +495,10 @@ public void toggle() {
* @param animate true to animate the transition, false to ignore animation
*/
public void toggle(boolean animate) {
if (isBehindShowing()) {
showAbove(animate);
if (isMenuShowing()) {
showContent(animate);
} else {
showBehind(animate);
showMenu(animate);
}
}

Expand All @@ -489,7 +507,7 @@ public void toggle(boolean animate) {
*
* @return Whether or not the behind view is showing
*/
public boolean isBehindShowing() {
public boolean isMenuShowing() {
return mViewAbove.getCurrentItem() == 0 || mViewAbove.getCurrentItem() == 2;
}

Expand Down Expand Up @@ -810,7 +828,7 @@ private SavedState(Parcel in) {
@Override
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState, isBehindShowing());
SavedState ss = new SavedState(superState, isMenuShowing());
return ss;
}

Expand All @@ -828,9 +846,9 @@ protected void onRestoreInstanceState(Parcelable state) {
super.onRestoreInstanceState(ss.getSuperState());

if (ss.mBehindShowing) {
showBehind();
showMenu();
} else {
showAbove();
showContent();
}
}

Expand Down
15 changes: 11 additions & 4 deletions library/src/com/slidingmenu/lib/app/SlidingActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,22 @@ public void toggle() {
/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showAbove()
*/
public void showAbove() {
mHelper.showAbove();
public void showContent() {
mHelper.showContent();
}

/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showBehind()
*/
public void showBehind() {
mHelper.showBehind();
public void showMenu() {
mHelper.showMenu();
}

/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
*/
public void showSecondaryMenu() {
mHelper.showSecondaryMenu();
}

/* (non-Javadoc)
Expand Down
14 changes: 10 additions & 4 deletions library/src/com/slidingmenu/lib/app/SlidingActivityBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ public interface SlidingActivityBase {
public void toggle();

/**
* Close the SlidingMenu and show the above view.
* Close the SlidingMenu and show the content view.
*/
public void showAbove();
public void showContent();

/**
* Open the SlidingMenu and show the behind view.
* Open the SlidingMenu and show the menu view.
*/
public void showBehind();
public void showMenu();

/**
* Open the SlidingMenu and show the secondary (right) menu view. Will default to the regular menu
* if there is only one.
*/
public void showSecondaryMenu();

/**
* Controls whether the ActionBar slides along with the above view when the menu is opened,
Expand Down
34 changes: 19 additions & 15 deletions library/src/com/slidingmenu/lib/app/SlidingActivityHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void onPostCreate(Bundle savedInstanceState) {
mSlidingMenu.setContent(mViewAbove);
parent.addView(mSlidingMenu, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}
this.showAbove();
this.showContent();
}

/**
Expand Down Expand Up @@ -126,7 +126,7 @@ public View findViewById(int id) {
* @param outState Bundle in which to place your saved state.
*/
public void onSaveInstanceState(Bundle outState) {
outState.putBoolean("menuOpen", mSlidingMenu.isBehindShowing());
outState.putBoolean("menuOpen", mSlidingMenu.isMenuShowing());
}

/**
Expand Down Expand Up @@ -179,25 +179,29 @@ public SlidingMenu getSlidingMenu() {
* Toggle the SlidingMenu. If it is open, it will be closed, and vice versa.
*/
public void toggle() {
if (mSlidingMenu.isBehindShowing()) {
showAbove();
} else {
showBehind();
}
mSlidingMenu.toggle();
}

/**
* Close the SlidingMenu and show the above view.
* Close the SlidingMenu and show the content view.
*/
public void showAbove() {
mSlidingMenu.showAbove();
public void showContent() {
mSlidingMenu.showContent();
}

/**
* Open the SlidingMenu and show the behind view.
* Open the SlidingMenu and show the menu view.
*/
public void showMenu() {
mSlidingMenu.showMenu();
}

/**
* Open the SlidingMenu and show the secondary menu view. Will default to the regular menu
* if there is only one.
*/
public void showBehind() {
mSlidingMenu.showBehind();
public void showSecondaryMenu() {
mSlidingMenu.showSecondaryMenu();
}

/**
Expand All @@ -208,8 +212,8 @@ public void showBehind() {
* @return true, if successful
*/
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && mSlidingMenu.isBehindShowing()) {
showAbove();
if (keyCode == KeyEvent.KEYCODE_BACK && mSlidingMenu.isMenuShowing()) {
showContent();
return true;
}
return false;
Expand Down
15 changes: 11 additions & 4 deletions library/src/com/slidingmenu/lib/app/SlidingFragmentActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,22 @@ public void toggle() {
/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showAbove()
*/
public void showAbove() {
mHelper.showAbove();
public void showContent() {
mHelper.showContent();
}

/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showBehind()
*/
public void showBehind() {
mHelper.showBehind();
public void showMenu() {
mHelper.showMenu();
}

/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
*/
public void showSecondaryMenu() {
mHelper.showSecondaryMenu();
}

/* (non-Javadoc)
Expand Down
16 changes: 12 additions & 4 deletions library/src/com/slidingmenu/lib/app/SlidingListActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,23 @@ public void toggle() {
/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showAbove()
*/
public void showAbove() {
mHelper.showAbove();
public void showContent() {
mHelper.showContent();
}

/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showBehind()
*/
public void showBehind() {
mHelper.showBehind();
public void showMenu() {
mHelper.showMenu();
}

/*
* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
*/
public void showSecondaryMenu() {
mHelper.showSecondaryMenu();
}

/* (non-Javadoc)
Expand Down
15 changes: 11 additions & 4 deletions library/src/com/slidingmenu/lib/app/SlidingMapActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,22 @@ public void toggle() {
/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showAbove()
*/
public void showAbove() {
mHelper.showAbove();
public void showContent() {
mHelper.showContent();
}

/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showBehind()
*/
public void showBehind() {
mHelper.showBehind();
public void showMenu() {
mHelper.showMenu();
}

/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
*/
public void showSecondaryMenu() {
mHelper.showSecondaryMenu();
}

/* (non-Javadoc)
Expand Down
15 changes: 11 additions & 4 deletions library/src/com/slidingmenu/lib/app/SlidingPreferenceActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,22 @@ public void toggle() {
/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showAbove()
*/
public void showAbove() {
mHelper.showAbove();
public void showContent() {
mHelper.showContent();
}

/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showBehind()
*/
public void showBehind() {
mHelper.showBehind();
public void showMenu() {
mHelper.showMenu();
}

/* (non-Javadoc)
* @see com.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
*/
public void showSecondaryMenu() {
mHelper.showSecondaryMenu();
}

/* (non-Javadoc)
Expand Down

0 comments on commit 18dec7b

Please sign in to comment.