Skip to content
This repository has been archived by the owner on Nov 22, 2017. It is now read-only.

Lockmode #72

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
<!--<module name="InnerAssignment"/>-->
<!--module name="MagicNumber"/-->
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

Expand All @@ -131,4 +130,4 @@
<!--module name="TodoComment"/-->
<module name="UpperEll"/>
</module>
</module>
</module>
2 changes: 1 addition & 1 deletion draggablepanel/res/layout/draggable_panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<FrameLayout
android:id="@+id/drag_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="200dip"
android:layout_alignParentTop="true"
android:orientation="vertical"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class DraggablePanel extends FrameLayout {
private boolean enableClickToMaximize;
private boolean enableClickToMinimize;
private boolean enableTouchListener;
private boolean initialised = false;

public DraggablePanel(Context context) {
super(context);
Expand Down Expand Up @@ -109,6 +110,15 @@ public void setTopViewHeight(int topFragmentHeight) {
this.topFragmentHeight = topFragmentHeight;
}

public void setFullScreen(boolean fullScreen) {
setLockDragMode(fullScreen);
if (fullScreen) {
draggableView.setTopViewHeight(getResources().getDisplayMetrics().heightPixels);
} else {
draggableView.setTopViewHeight(topFragmentHeight);
}
}

/**
* Return if user can maximize minimized view on click.
*/
Expand Down Expand Up @@ -146,7 +156,30 @@ public void setClickToMinimizeEnabled(boolean enableClickToMinimize) {
}

/**
* Disables dragging the view
*
* @param lock - true to disable, false to enable
*/
public void setLockDragMode(boolean lock) {
if (initialised) {
draggableView.setLockDragMode(lock);
} else {
throw new IllegalStateException("You have to initialise draggable panel first");
}
}

/**
* Return if dragging is locked or unlocked
*/
public boolean isLockDragMode() {
if (initialised) {
return draggableView.isLockDragMode();
} else {
throw new IllegalStateException("You have to initialise draggable panel first");
}
}

/**
* Slide the view based on scroll of the nav drawer.
* "setEnableTouch" user prevents click to expand while the drawer is moving.
* It's only possible to maximize the view when @slideOffset is equals to 0.0,
Expand Down Expand Up @@ -268,6 +301,7 @@ public void initializeView() {
draggableView.setClickToMaximizeEnabled(enableClickToMaximize);
draggableView.setClickToMinimizeEnabled(enableClickToMinimize);
draggableView.setTouchEnabled(enableTouchListener);
initialised = true;
}

/**
Expand Down
Loading