Skip to content

Commit bd8eefc

Browse files
committed
SDK updated, minor fixes, some code and apk removed
1 parent 5dae55b commit bd8eefc

File tree

7 files changed

+67
-42
lines changed

7 files changed

+67
-42
lines changed

app/app-release.apk

-4.32 MB
Binary file not shown.

app/build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ repositories {
99

1010
dependencies {
1111
compile project(':dragger')
12-
compile 'com.android.support:appcompat-v7:22.2.0'
12+
compile 'com.android.support:appcompat-v7:23.1.0'
1313
compile 'com.github.ksoichiro:android-observablescrollview:1.5.1'
1414
compile 'com.github.ppamorim:recyclerrenderers:1.2.2'
1515
compile 'com.jakewharton:butterknife:6.1.0'
16-
compile 'com.facebook.fresco:fresco:0.5.1+'
16+
compile 'com.facebook.fresco:fresco:0.8.1'
1717
}
1818

1919
android {
20+
2021
packagingOptions {
2122
exclude 'META-INF/services/javax.annotation.processing.Processor'
2223
}
24+
2325
compileSdkVersion Integer.parseInt(project.ANDROID_COMPILE_SDK_VERSION)
2426
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
2527
defaultConfig {
@@ -29,17 +31,19 @@ android {
2931
minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK)
3032
targetSdkVersion Integer.parseInt(project.ANDROID_TARGET_SDK_VERSION)
3133
}
34+
3235
sourceSets {
3336
main {
3437
manifest.srcFile 'AndroidManifest.xml'
3538
java.srcDirs = ['src/main/java']
3639
res.srcDirs = ['res']
3740
}
3841
}
42+
3943
lintOptions {
4044
abortOnError false
4145
}
42-
productFlavors {}
46+
4347
}
4448

4549
task checkstyle(type: Checkstyle) {

app/src/main/java/com/github/ppamorim/dragger/ImageActivity.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ public class ImageActivity extends AbstractActivity {
3939
configIntents();
4040
}
4141

42-
@Override protected void onSaveInstanceState(Bundle outState) {
43-
super.onSaveInstanceState(outState);
44-
outState.putBoolean(CAN_ANIMATE, draggerView.getCanAnimate());
45-
}
46-
4742
@Override public boolean onOptionsItemSelected(MenuItem item) {
4843
switch (item.getItemId()) {
4944
case android.R.id.home:

build.gradle

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
mavenCentral()
44
}
55
dependencies {
6-
classpath 'com.android.tools.build:gradle:1.2.3'
6+
classpath 'com.android.tools.build:gradle:1.3.0'
77
}
88
}
99

@@ -12,8 +12,4 @@ allprojects {
1212
mavenCentral()
1313
mavenLocal()
1414
}
15-
}
16-
17-
def isReleaseBuild() {
18-
return version.contains("SNAPSHOT") == false
19-
}
15+
}

dragger/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
22
apply plugin: 'checkstyle'
33

44
dependencies {
5-
compile 'com.android.support:appcompat-v7:22.1.1'
5+
compile 'com.android.support:appcompat-v7:23.1.0'
66
compile 'com.facebook.rebound:rebound:0.3.8'
77
}
88

dragger/src/main/java/com/github/ppamorim/dragger/DraggerView.java

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,18 @@ public class DraggerView extends FrameLayout {
5454
private static final int INVALID_POINTER = -1;
5555

5656
private boolean runAnimationOnFinishInflate = true;
57-
private boolean animationFinish = false;
5857
private boolean canSlide = true;
5958
private int activePointerId = INVALID_POINTER;
6059
private float verticalDragRange;
6160
private float horizontalDragRange;
6261
private float dragLimit;
6362
private float tension;
6463
private float friction;
65-
private float progress;
66-
private double val;
6764

6865
private TypedArray attributes;
6966
private DraggerPosition dragPosition;
7067

7168
private DraggerCallback draggerCallback;
72-
private DraggerHelperCallback dragHelperCallback;
7369
private ViewDragHelper dragHelper;
7470
private View dragView;
7571
private View shadowView;
@@ -90,6 +86,10 @@ public DraggerView(Context context, AttributeSet attrs, int defStyle) {
9086
initializeAttributes(attrs);
9187
}
9288

89+
/**
90+
* Bind the attributes of the view and config
91+
* the DraggerView with these params.
92+
*/
9393
@Override protected void onFinishInflate() {
9494
super.onFinishInflate();
9595
if (!isInEditMode()) {
@@ -100,17 +100,28 @@ public DraggerView(Context context, AttributeSet attrs, int defStyle) {
100100
}
101101
}
102102

103+
/**
104+
* Add the spring listener when the view is attached.
105+
*/
103106
@Override protected void onAttachedToWindow() {
104107
super.onAttachedToWindow();
105108
getSpring().addListener(springListener);
106109
}
107110

108-
@Override
109-
protected void onDetachedFromWindow() {
110-
super.onDetachedFromWindow();
111+
/**
112+
* Remove the spring listener when the view is detached.
113+
*/
114+
@Override protected void onDetachedFromWindow() {
111115
getSpring().removeListener(springListener);
116+
super.onDetachedFromWindow();
112117
}
113118

119+
/**
120+
* Configure the width and height of the DraggerView.
121+
*
122+
* @param widthMeasureSpec Spec value of width, not represent the real width.
123+
* @param heightMeasureSpec Spec value of height, not represent the real height.
124+
*/
114125
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
115126
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
116127
int measureWidth = MeasureSpec.makeMeasureSpec(
@@ -125,12 +136,27 @@ protected void onDetachedFromWindow() {
125136

126137
}
127138

139+
/**
140+
* Updates the view size if needed.
141+
* @param width The new width size.
142+
* @param height The new height size.
143+
* @param oldWidth The old width size, useful the calculate the diff.
144+
* @param oldHeight The old height size, useful the calculate the diff.
145+
*/
128146
@Override protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
129147
super.onSizeChanged(width, height, oldWidth, oldHeight);
130148
setVerticalDragRange(height);
131149
setHorizontalDragRange(width);
132150
}
133151

152+
/**
153+
* Detect the type of motion event (like touch)
154+
* at the DraggerView, this can be a simple
155+
* detector of the touch, not the listener ifself.
156+
*
157+
* @param ev Event of MotionEvent
158+
* @return View is touched
159+
*/
134160
@Override public boolean onInterceptTouchEvent(MotionEvent ev) {
135161
if (!isEnabled() || !canSlide()) {
136162
return false;
@@ -152,6 +178,15 @@ protected void onDetachedFromWindow() {
152178
}
153179
}
154180

181+
/**
182+
* Handle the touch event intercepted from onInterceptTouchEvent
183+
* method, this method valid if the touch listener
184+
* is a valid pointer(like fingers) or the touch
185+
* is inside of the DraggerView.
186+
*
187+
* @param ev MotionEvent instance, can be used to detect the type of touch.
188+
* @return Touched area is a valid position.
189+
*/
155190
@Override public boolean onTouchEvent(MotionEvent ev) {
156191
int actionMasked = MotionEventCompat.getActionMasked(ev);
157192
if ((actionMasked & MotionEventCompat.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
@@ -165,6 +200,11 @@ protected void onDetachedFromWindow() {
165200
|| isViewHit(shadowView, (int) ev.getX(), (int) ev.getY());
166201
}
167202

203+
/**
204+
* This method is needed to calculate the auto scroll
205+
* when the user slide the view to the max limit, this
206+
* starts a animation to finish the view.
207+
*/
168208
@Override public void computeScroll() {
169209
if (!isInEditMode() && dragHelper.continueSettling(true)) {
170210
ViewCompat.postInvalidateOnAnimation(this);
@@ -179,10 +219,6 @@ public void setRunAnimationOnFinishInflate(boolean runAnimationOnFinishInflate)
179219
this.runAnimationOnFinishInflate = runAnimationOnFinishInflate;
180220
}
181221

182-
public boolean getCanAnimate() {
183-
return !animationFinish;
184-
}
185-
186222
private float getVerticalDragRange() {
187223
return verticalDragRange;
188224
}
@@ -243,8 +279,8 @@ private void initializeAttributes(AttributeSet attrs) {
243279
}
244280

245281
private void configDragViewHelper() {
246-
dragHelperCallback = new DraggerHelperCallback(this, dragView, draggerListener);
247-
dragHelper = ViewDragHelper.create(this, SENSITIVITY, dragHelperCallback);
282+
dragHelper = ViewDragHelper.create(this, SENSITIVITY,
283+
new DraggerHelperCallback(this, dragView, draggerListener));
248284
}
249285

250286
public void setDraggerCallback(DraggerCallback draggerCallback) {
@@ -417,9 +453,7 @@ private void finish() {
417453
activity.overridePendingTransition(0, android.R.anim.fade_out);
418454
activity.finish();
419455
}
420-
activity = null;
421456
}
422-
context = null;
423457
}
424458

425459
public void setAnimationDuration(int baseSettleDuration, int maxSettleDuration) {
@@ -435,23 +469,19 @@ public void setAnimationDuration(int miliseconds, float multipler) {
435469
private SpringListener springListener = new SpringListener() {
436470
@Override public void onSpringUpdate(Spring spring) {
437471

438-
val = spring.getCurrentValue();
472+
double val = spring.getCurrentValue();
439473
switch (dragPosition) {
440474
case LEFT:
441-
progress = (float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, -dragView.getWidth());
442-
ViewCompat.setTranslationX(dragView, progress);
475+
ViewCompat.setTranslationX(dragView, (float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, -dragView.getWidth()));
443476
break;
444477
case RIGHT:
445-
progress = (float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, dragView.getWidth());
446-
ViewCompat.setTranslationX(dragView, progress);
478+
ViewCompat.setTranslationX(dragView, (float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, dragView.getWidth()));
447479
break;
448480
case TOP:
449-
progress = (float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, dragView.getHeight());
450-
ViewCompat.setTranslationY(dragView, progress);
481+
ViewCompat.setTranslationY(dragView, (float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, dragView.getHeight()));
451482
break;
452483
case BOTTOM:
453-
progress = (float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, -dragView.getHeight());
454-
ViewCompat.setTranslationY(dragView, progress);
484+
ViewCompat.setTranslationY(dragView, (float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, -dragView.getHeight()));
455485
break;
456486
default:
457487
break;

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ POM_LICENCE_DIST=repo
1313
POM_DEVELOPER_ID=ppamorim
1414
POM_DEVELOPER_NAME=Pedro Paulo de Amorim
1515

16-
ANDROID_BUILD_TOOLS_VERSION=22.0.1
17-
ANDROID_COMPILE_SDK_VERSION=22
18-
ANDROID_TARGET_SDK_VERSION=22
16+
ANDROID_BUILD_TOOLS_VERSION=23.0.1
17+
ANDROID_COMPILE_SDK_VERSION=23
18+
ANDROID_TARGET_SDK_VERSION=23
1919
ANDROID_MIN_SDK=10

0 commit comments

Comments
 (0)