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

Commit 4998362

Browse files
committed
Merge branch 'release/RELEASE-1.0.3'
2 parents 53e230e + 6e87c62 commit 4998362

File tree

5 files changed

+41
-27
lines changed

5 files changed

+41
-27
lines changed

draggablepanel/pom.xml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<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">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45

56
<parent>
67
<groupId>com.github.pedrovgs</groupId>
78
<artifactId>draggablepanel-parent</artifactId>
8-
<version>1.0.2-SNAPSHOT</version>
9+
<version>1.0.4-SNAPSHOT</version>
910
</parent>
1011

1112
<artifactId>draggablepanel</artifactId>
12-
<version>1.0.3-SNAPSHOT</version>
13+
<version>1.0.4-SNAPSHOT</version>
1314
<packaging>apklib</packaging>
1415

1516
<name>DRAGGABLE PANEL - LIBRARY</name>

draggablepanel/src/main/java/com/github/pedrovgs/DraggableView.java

+27-16
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ public class DraggableView extends RelativeLayout {
4141
private static final int ZERO = 0;
4242
private static final int DEFAULT_SCALE_FACTOR = 2;
4343
private static final float DEFAULT_TOP_VIEW_HEIGHT = -1;
44-
private static final int DEFAULT_TOP_FRAGMENT_MARGIN = 30;
44+
private static final int DEFAULT_TOP_VIEW_MARGIN = 30;
4545
private static final float SLIDE_TOP = 0f;
4646
private static final float SLIDE_BOTTOM = 1f;
47-
private static final boolean DEFAULT_ENABLE_HORIZONTAL_ALPHA_EFECT = true;
47+
private static final boolean DEFAULT_ENABLE_HORIZONTAL_ALPHA_EFFECT = true;
4848
private static final int ONE_HUNDRED = 100;
4949
private static final float SENSITIVITY = 1f;
5050

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

5757
private float xScaleFactor = DEFAULT_SCALE_FACTOR;
5858
private float yScaleFactor = DEFAULT_SCALE_FACTOR;
59-
private float topFragmentMarginRight = DEFAULT_TOP_FRAGMENT_MARGIN;
60-
private float topFragmentMarginBottom = DEFAULT_TOP_FRAGMENT_MARGIN;
59+
private float topViewMarginRight = DEFAULT_TOP_VIEW_MARGIN;
60+
private float topViewMarginBottom = DEFAULT_TOP_VIEW_MARGIN;
6161
private float topViewHeight = DEFAULT_TOP_VIEW_HEIGHT;
6262
private boolean enableHorizontalAlphaEffect;
6363
private int dragViewId;
@@ -108,7 +108,7 @@ public void setYTopViewScaleFactor(float yScaleFactor) {
108108
* @param topFragmentMarginRight in pixels.
109109
*/
110110
public void setTopViewMarginRight(float topFragmentMarginRight) {
111-
this.topFragmentMarginRight = topFragmentMarginRight;
111+
this.topViewMarginRight = topFragmentMarginRight;
112112
}
113113

114114
/**
@@ -117,7 +117,7 @@ public void setTopViewMarginRight(float topFragmentMarginRight) {
117117
* @param topFragmentMarginBottom
118118
*/
119119
public void setTopViewMarginBottom(float topFragmentMarginBottom) {
120-
this.topFragmentMarginBottom = topFragmentMarginBottom;
120+
this.topViewMarginBottom = topFragmentMarginBottom;
121121
}
122122

123123
/**
@@ -201,7 +201,7 @@ public void closeToLeft() {
201201
}
202202

203203
/**
204-
* Checks if the top Fragment is minimized.
204+
* Checks if the top view is minimized.
205205
*
206206
* @return true if the view is minimized.
207207
*/
@@ -210,7 +210,7 @@ public boolean isMinimized() {
210210
}
211211

212212
/**
213-
* Checks if the top Fragment is maximized.
213+
* Checks if the top view is maximized.
214214
*
215215
* @return true if the view is maximized.
216216
*/
@@ -219,7 +219,7 @@ public boolean isMaximized() {
219219
}
220220

221221
/**
222-
* Checks if the top Fragment closed at the right place.
222+
* Checks if the top view closed at the right place.
223223
*
224224
* @return true if the view is closed at right.
225225
*/
@@ -228,14 +228,23 @@ public boolean isClosedAtRight() {
228228
}
229229

230230
/**
231-
* Checks if the top Fragment is closed at the left place.
231+
* Checks if the top view is closed at the left place.
232232
*
233233
* @return true if the view is closed at left.
234234
*/
235235
public boolean isClosedAtLeft() {
236236
return dragView.getRight() <= 0;
237237
}
238238

239+
/**
240+
* Checks if the top view is closed at the right or left place.
241+
*
242+
* @return true if the view is closed.
243+
*/
244+
public boolean isClosed() {
245+
return isClosedAtLeft() || isClosedAtRight();
246+
}
247+
239248
/**
240249
* Override method to intercept only touch events over the drag view and to cancel the drag when the action
241250
* associated to the MotionEvent is equals to ACTION_CANCEL or ACTION_UP.
@@ -264,7 +273,9 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
264273
@Override
265274
public boolean onTouchEvent(MotionEvent ev) {
266275
viewDragHelper.processTouchEvent(ev);
267-
276+
if (isClosed()) {
277+
return false;
278+
}
268279
boolean isDragViewHit = isViewHit(dragView, (int) ev.getX(), (int) ev.getY());
269280
boolean isSecondViewHit = isViewHit(secondView, (int) ev.getX(), (int) ev.getY());
270281
if (isMaximized()) {
@@ -505,9 +516,9 @@ private void initializeAttributes(AttributeSet attrs) {
505516
this.topViewHeight = attributes.getDimension(R.styleable.draggable_view_top_view_height, DEFAULT_TOP_VIEW_HEIGHT);
506517
this.xScaleFactor = attributes.getFloat(R.styleable.draggable_view_top_view_x_scale_factor, DEFAULT_SCALE_FACTOR);
507518
this.yScaleFactor = attributes.getFloat(R.styleable.draggable_view_top_view_y_scale_factor, DEFAULT_SCALE_FACTOR);
508-
this.topFragmentMarginRight = attributes.getDimension(R.styleable.draggable_view_top_view_margin_right, DEFAULT_TOP_FRAGMENT_MARGIN);
509-
this.topFragmentMarginBottom = attributes.getDimension(R.styleable.draggable_view_top_view_margin_bottom, DEFAULT_TOP_FRAGMENT_MARGIN);
510-
this.enableHorizontalAlphaEffect = attributes.getBoolean(R.styleable.draggable_view_enable_minimized_horizontal_alpha_effect, DEFAULT_ENABLE_HORIZONTAL_ALPHA_EFECT);
519+
this.topViewMarginRight = attributes.getDimension(R.styleable.draggable_view_top_view_margin_right, DEFAULT_TOP_VIEW_MARGIN);
520+
this.topViewMarginBottom = attributes.getDimension(R.styleable.draggable_view_top_view_margin_bottom, DEFAULT_TOP_VIEW_MARGIN);
521+
this.enableHorizontalAlphaEffect = attributes.getBoolean(R.styleable.draggable_view_enable_minimized_horizontal_alpha_effect, DEFAULT_ENABLE_HORIZONTAL_ALPHA_EFFECT);
511522
attributes.recycle();
512523

513524
}
@@ -534,14 +545,14 @@ private boolean smoothSlideTo(float slideOffset) {
534545
* @return configured dragged view margin right configured.
535546
*/
536547
private float getDragViewMarginRight() {
537-
return topFragmentMarginRight;
548+
return topViewMarginRight;
538549
}
539550

540551
/**
541552
* @return configured dragged view margin bottom.
542553
*/
543554
private float getDragViewMarginBottom() {
544-
return topFragmentMarginBottom;
555+
return topViewMarginBottom;
545556
}
546557

547558
/**

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VERSION_NAME=1.0.3-SNAPSHOT
2-
VERSION_CODE=2
1+
VERSION_NAME=1.0.4-SNAPSHOT
2+
VERSION_CODE=4
33
GROUP=com.github.pedrovgs
44

55
POM_DESCRIPTION=Android library created to create a draggable user interface similar to the last YouTube draggable video component.

pom.xml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<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">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45

56
<groupId>com.github.pedrovgs</groupId>
67
<artifactId>draggablepanel-parent</artifactId>
7-
<version>1.0.2-SNAPSHOT</version>
8+
<version>1.0.4-SNAPSHOT</version>
89
<packaging>pom</packaging>
910

1011
<parent>
@@ -137,7 +138,7 @@
137138
<artifactId>google-play-services-jar</artifactId>
138139
<version>7</version>
139140
</dependency>
140-
141+
141142
<dependency>
142143
<groupId>com.actionbarsherlock</groupId>
143144
<artifactId>actionbarsherlock</artifactId>

sample/pom.xml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<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">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45

56
<parent>
67
<groupId>com.github.pedrovgs</groupId>
78
<artifactId>draggablepanel-parent</artifactId>
8-
<version>1.0.2-SNAPSHOT</version>
9+
<version>1.0.4-SNAPSHOT</version>
910
</parent>
1011

1112
<artifactId>sample</artifactId>
12-
<version>1.0.2-SNAPSHOT</version>
13+
<version>1.0.4-SNAPSHOT</version>
1314
<packaging>apk</packaging>
1415

1516
<name>DRAGGABLE PANEL - SAMPLE</name>

0 commit comments

Comments
 (0)