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

Commit

Permalink
Merge branch 'release/RELEASE-1.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrovgs committed Apr 26, 2014
2 parents 53e230e + 6e87c62 commit 4998362
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 27 deletions.
7 changes: 4 additions & 3 deletions draggablepanel/pom.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.github.pedrovgs</groupId>
<artifactId>draggablepanel-parent</artifactId>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.4-SNAPSHOT</version>
</parent>

<artifactId>draggablepanel</artifactId>
<version>1.0.3-SNAPSHOT</version>
<version>1.0.4-SNAPSHOT</version>
<packaging>apklib</packaging>

<name>DRAGGABLE PANEL - LIBRARY</name>
Expand Down
43 changes: 27 additions & 16 deletions draggablepanel/src/main/java/com/github/pedrovgs/DraggableView.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public class DraggableView extends RelativeLayout {
private static final int ZERO = 0;
private static final int DEFAULT_SCALE_FACTOR = 2;
private static final float DEFAULT_TOP_VIEW_HEIGHT = -1;
private static final int DEFAULT_TOP_FRAGMENT_MARGIN = 30;
private static final int DEFAULT_TOP_VIEW_MARGIN = 30;
private static final float SLIDE_TOP = 0f;
private static final float SLIDE_BOTTOM = 1f;
private static final boolean DEFAULT_ENABLE_HORIZONTAL_ALPHA_EFECT = true;
private static final boolean DEFAULT_ENABLE_HORIZONTAL_ALPHA_EFFECT = true;
private static final int ONE_HUNDRED = 100;
private static final float SENSITIVITY = 1f;

Expand All @@ -56,8 +56,8 @@ public class DraggableView extends RelativeLayout {

private float xScaleFactor = DEFAULT_SCALE_FACTOR;
private float yScaleFactor = DEFAULT_SCALE_FACTOR;
private float topFragmentMarginRight = DEFAULT_TOP_FRAGMENT_MARGIN;
private float topFragmentMarginBottom = DEFAULT_TOP_FRAGMENT_MARGIN;
private float topViewMarginRight = DEFAULT_TOP_VIEW_MARGIN;
private float topViewMarginBottom = DEFAULT_TOP_VIEW_MARGIN;
private float topViewHeight = DEFAULT_TOP_VIEW_HEIGHT;
private boolean enableHorizontalAlphaEffect;
private int dragViewId;
Expand Down Expand Up @@ -108,7 +108,7 @@ public void setYTopViewScaleFactor(float yScaleFactor) {
* @param topFragmentMarginRight in pixels.
*/
public void setTopViewMarginRight(float topFragmentMarginRight) {
this.topFragmentMarginRight = topFragmentMarginRight;
this.topViewMarginRight = topFragmentMarginRight;
}

/**
Expand All @@ -117,7 +117,7 @@ public void setTopViewMarginRight(float topFragmentMarginRight) {
* @param topFragmentMarginBottom
*/
public void setTopViewMarginBottom(float topFragmentMarginBottom) {
this.topFragmentMarginBottom = topFragmentMarginBottom;
this.topViewMarginBottom = topFragmentMarginBottom;
}

/**
Expand Down Expand Up @@ -201,7 +201,7 @@ public void closeToLeft() {
}

/**
* Checks if the top Fragment is minimized.
* Checks if the top view is minimized.
*
* @return true if the view is minimized.
*/
Expand All @@ -210,7 +210,7 @@ public boolean isMinimized() {
}

/**
* Checks if the top Fragment is maximized.
* Checks if the top view is maximized.
*
* @return true if the view is maximized.
*/
Expand All @@ -219,7 +219,7 @@ public boolean isMaximized() {
}

/**
* Checks if the top Fragment closed at the right place.
* Checks if the top view closed at the right place.
*
* @return true if the view is closed at right.
*/
Expand All @@ -228,14 +228,23 @@ public boolean isClosedAtRight() {
}

/**
* Checks if the top Fragment is closed at the left place.
* Checks if the top view is closed at the left place.
*
* @return true if the view is closed at left.
*/
public boolean isClosedAtLeft() {
return dragView.getRight() <= 0;
}

/**
* Checks if the top view is closed at the right or left place.
*
* @return true if the view is closed.
*/
public boolean isClosed() {
return isClosedAtLeft() || isClosedAtRight();
}

/**
* Override method to intercept only touch events over the drag view and to cancel the drag when the action
* associated to the MotionEvent is equals to ACTION_CANCEL or ACTION_UP.
Expand Down Expand Up @@ -264,7 +273,9 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
@Override
public boolean onTouchEvent(MotionEvent ev) {
viewDragHelper.processTouchEvent(ev);

if (isClosed()) {
return false;
}
boolean isDragViewHit = isViewHit(dragView, (int) ev.getX(), (int) ev.getY());
boolean isSecondViewHit = isViewHit(secondView, (int) ev.getX(), (int) ev.getY());
if (isMaximized()) {
Expand Down Expand Up @@ -505,9 +516,9 @@ private void initializeAttributes(AttributeSet attrs) {
this.topViewHeight = attributes.getDimension(R.styleable.draggable_view_top_view_height, DEFAULT_TOP_VIEW_HEIGHT);
this.xScaleFactor = attributes.getFloat(R.styleable.draggable_view_top_view_x_scale_factor, DEFAULT_SCALE_FACTOR);
this.yScaleFactor = attributes.getFloat(R.styleable.draggable_view_top_view_y_scale_factor, DEFAULT_SCALE_FACTOR);
this.topFragmentMarginRight = attributes.getDimension(R.styleable.draggable_view_top_view_margin_right, DEFAULT_TOP_FRAGMENT_MARGIN);
this.topFragmentMarginBottom = attributes.getDimension(R.styleable.draggable_view_top_view_margin_bottom, DEFAULT_TOP_FRAGMENT_MARGIN);
this.enableHorizontalAlphaEffect = attributes.getBoolean(R.styleable.draggable_view_enable_minimized_horizontal_alpha_effect, DEFAULT_ENABLE_HORIZONTAL_ALPHA_EFECT);
this.topViewMarginRight = attributes.getDimension(R.styleable.draggable_view_top_view_margin_right, DEFAULT_TOP_VIEW_MARGIN);
this.topViewMarginBottom = attributes.getDimension(R.styleable.draggable_view_top_view_margin_bottom, DEFAULT_TOP_VIEW_MARGIN);
this.enableHorizontalAlphaEffect = attributes.getBoolean(R.styleable.draggable_view_enable_minimized_horizontal_alpha_effect, DEFAULT_ENABLE_HORIZONTAL_ALPHA_EFFECT);
attributes.recycle();

}
Expand All @@ -534,14 +545,14 @@ private boolean smoothSlideTo(float slideOffset) {
* @return configured dragged view margin right configured.
*/
private float getDragViewMarginRight() {
return topFragmentMarginRight;
return topViewMarginRight;
}

/**
* @return configured dragged view margin bottom.
*/
private float getDragViewMarginBottom() {
return topFragmentMarginBottom;
return topViewMarginBottom;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=1.0.3-SNAPSHOT
VERSION_CODE=2
VERSION_NAME=1.0.4-SNAPSHOT
VERSION_CODE=4
GROUP=com.github.pedrovgs

POM_DESCRIPTION=Android library created to create a draggable user interface similar to the last YouTube draggable video component.
Expand Down
7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.pedrovgs</groupId>
<artifactId>draggablepanel-parent</artifactId>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.4-SNAPSHOT</version>
<packaging>pom</packaging>

<parent>
Expand Down Expand Up @@ -137,7 +138,7 @@
<artifactId>google-play-services-jar</artifactId>
<version>7</version>
</dependency>

<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
Expand Down
7 changes: 4 additions & 3 deletions sample/pom.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.github.pedrovgs</groupId>
<artifactId>draggablepanel-parent</artifactId>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.4-SNAPSHOT</version>
</parent>

<artifactId>sample</artifactId>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.4-SNAPSHOT</version>
<packaging>apk</packaging>

<name>DRAGGABLE PANEL - SAMPLE</name>
Expand Down

0 comments on commit 4998362

Please sign in to comment.