Skip to content
This repository was archived by the owner on Feb 20, 2021. It is now read-only.

Added a Toggle Method #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Library/src/com/slidinglayer/SlidingLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,24 @@ private void closeLayer(boolean smoothAnim, boolean forceClose) {
private void switchLayer(boolean open, boolean smoothAnim, boolean forceSwitch) {
switchLayer(open, smoothAnim, forceSwitch, 0, 0);
}

/**
* Simple Toggle Method.
* If layer is open the Layer will close.
* If the layer is closed it will open.
* It's just that simple.
* @param smoothAnim
* @author adfleshner
*/
public void toggleLayer(boolean smoothAnim) {
if (isOpened()) {
closeLayer(smoothAnim, false);
} else {
openLayer(smoothAnim, false);
}
}



private void switchLayer(final boolean open, final boolean smoothAnim, final boolean forceSwitch,
final int velocityX, final int velocityY) {
Expand Down