Skip to content

Commit 0375e96

Browse files
committed
Some cleaning and module renaming before developing the Radial Action.
1 parent 2768370 commit 0375e96

File tree

14 files changed

+85
-119
lines changed

14 files changed

+85
-119
lines changed

circulardemo/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repositories {
3030
}
3131

3232
dependencies {
33-
compile project(':circulartransform')
33+
compile project(':circulartools')
3434
compile 'com.android.support:design:22.2.0'
3535
compile 'com.android.support:appcompat-v7:22.2.0'
3636
compile 'com.android.support:cardview-v7:22.2.0'
File renamed without changes.
File renamed without changes.

circulartransform/proguard-rules.pro renamed to circulartools/proguard-rules.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# class:
1515
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
1616
# public *;
17-
#}
17+
#}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="hu.gordon.circulartools">
3+
4+
<application
5+
android:allowBackup="true"
6+
android:label="@string/app_name">
7+
8+
</application>
9+
10+
</manifest>

circulartransform/src/main/java/hu/aut/utillib/circular/animation/CircularAnimationUtils.java renamed to circulartools/src/main/java/hu/aut/utillib/circular/animation/CircularAnimationUtils.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
public class CircularAnimationUtils {
1414

15-
private static final String CLIP_RADIUS = "RevealRadius";
15+
private static final String RADIUS = "Radius";
1616
public static final int AUTOMATIC = 0;
1717
public static final int MANUAL = 1;
1818

@@ -88,13 +88,13 @@ public static ObjectAnimator createCircularTransform(View target, View source, i
8888
throw new IllegalArgumentException("View must be inside CircularFrameLayout");
8989
}
9090

91-
CircularAnimator transformLayout = (CircularAnimator) target.getParent();
91+
CircularFrameLayout transformLayout = (CircularFrameLayout) target.getParent();
9292
transformLayout.setTarget(target);
93-
transformLayout.setClipOutlines(true);
93+
transformLayout.setAnimated(true);
9494
transformLayout.setSource(source);
9595
transformLayout.setCenter(centerX, centerY);
9696

97-
ObjectAnimator transform = ObjectAnimator.ofFloat(transformLayout, CLIP_RADIUS, startRadius, endRadius);
97+
ObjectAnimator transform = ObjectAnimator.ofFloat(transformLayout, RADIUS, startRadius, endRadius);
9898

9999
if (source == null) {
100100
transform.addListener(new RevealListener(target, mode));
@@ -158,7 +158,7 @@ static class RevealListener implements AnimatorListener {
158158
RevealListener(View target, int mode) {
159159
targetReference = new WeakReference<>(target);
160160
parentReference = new WeakReference<>((CircularFrameLayout) targetReference.get().getParent());
161-
originalLayerType = ((CircularFrameLayout)target.getParent()).getLayerType();
161+
originalLayerType = ((CircularFrameLayout) target.getParent()).getLayerType();
162162
this.mode = mode;
163163
}
164164

@@ -167,7 +167,7 @@ public void onAnimationStart(Animator animation) {
167167
if (!isHWAsupported()) {
168168
parentReference.get().setLayerType(View.LAYER_TYPE_SOFTWARE, null);
169169
}
170-
if(mode == AUTOMATIC) {
170+
if (mode == AUTOMATIC) {
171171
targetReference.get().setVisibility(View.VISIBLE);
172172
}
173173
}
@@ -194,7 +194,7 @@ static class TransformListener extends RevealListener {
194194
WeakReference<View> sourceReference;
195195

196196
TransformListener(View target, View source, int mode) {
197-
super(target,mode);
197+
super(target, mode);
198198
sourceReference = new WeakReference<>(source);
199199
}
200200

@@ -204,7 +204,7 @@ public void onAnimationStart(Animator animation) {
204204
if (!isHWAsupported()) {
205205
parentReference.get().setLayerType(View.LAYER_TYPE_SOFTWARE, null);
206206
}
207-
if(mode == AUTOMATIC) {
207+
if (mode == AUTOMATIC) {
208208
targetReference.get().setVisibility(View.VISIBLE);
209209
}
210210
}
@@ -214,7 +214,7 @@ public void onAnimationEnd(Animator animation) {
214214
if (!isHWAsupported()) {
215215
parentReference.get().setLayerType(originalLayerType, null);
216216
}
217-
if(mode == AUTOMATIC) {
217+
if (mode == AUTOMATIC) {
218218
sourceReference.get().setVisibility(View.INVISIBLE);
219219
}
220220
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package hu.aut.utillib.circular.animation;
2+
3+
4+
public interface CircularAnimator {
5+
6+
7+
/**
8+
* Whether enable {@link android.graphics.Canvas} to clip
9+
* outlines of the certain or not
10+
*
11+
* @param isAnimated Whether it's animated or not
12+
* @see #setCenter(int, int)
13+
* @see #setRadius(float)
14+
*/
15+
void setAnimated(boolean isAnimated);
16+
17+
/**
18+
* Sets central points where to start clipping
19+
* certain child
20+
*
21+
* @param cx x point of child
22+
* @param cy y point of child
23+
* @see #setAnimated(boolean) (float, float)
24+
* @see #setRadius(float)
25+
*/
26+
void setCenter(int cx, int cy);
27+
28+
/**
29+
* Used with animator to animate view clipping
30+
*
31+
* @param value clip radius
32+
*/
33+
void setRadius(float value);
34+
35+
/**
36+
* Used with animator to animate view clipping
37+
*
38+
* @return current radius
39+
*/
40+
float getRadius();
41+
42+
}

circulartransform/src/main/java/hu/aut/utillib/circular/widget/CircularFrameLayout.java renamed to circulartools/src/main/java/hu/aut/utillib/circular/widget/CircularFrameLayout.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,23 @@ public CircularFrameLayout(Context context, AttributeSet attrs, int defStyle) {
3939
mRevealPath = new Path();
4040
}
4141

42+
4243
/**
43-
* Animation target to appear
44+
* Reference the target of circular animation to appear
45+
*
46+
* @param target View to clip outlines
4447
*/
45-
@Override
46-
public void setTarget(View view) {
47-
mTarget = view;
48+
public void setTarget(View target) {
49+
mTarget = target;
4850
}
4951

5052
/**
51-
* Animation target to disappear
53+
* Reference the target of circular animation to disappear
54+
*
55+
* @param source View to clip outlines
5256
*/
53-
@Override
54-
public void setSource(View view) {
55-
mSource = view;
57+
public void setSource(View source) {
58+
mSource = source;
5659
}
5760

5861
/**
@@ -65,18 +68,19 @@ public void setCenter(int centerX, int centerY) {
6568
}
6669

6770
/**
68-
* Flag that animation is enabled
71+
* Flag that animation is enabled (so the view should use the clipping)
72+
* Clipping won't work if it's not set to true
6973
*/
7074
@Override
71-
public void setClipOutlines(boolean clip) {
72-
mClipOutlines = clip;
75+
public void setAnimated(boolean isAnimated) {
76+
mClipOutlines = isAnimated;
7377
}
7478

7579
/**
7680
* Sets the clipping circle radius size. Radius won't be smaller than 1F
7781
*/
7882
@Override
79-
public void setRevealRadius(float radius) {
83+
public void setRadius(float radius) {
8084
mRadius = Math.max(1F, radius);
8185
invalidate();
8286
}
@@ -85,7 +89,7 @@ public void setRevealRadius(float radius) {
8589
* Returns the clipping circle radius size
8690
*/
8791
@Override
88-
public float getRevealRadius() {
92+
public float getRadius() {
8993
return mRadius;
9094
}
9195

@@ -106,11 +110,8 @@ protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long dr
106110
canvas.clipPath(mRevealPath, Region.Op.DIFFERENCE);
107111
}
108112

109-
110113
boolean isInvalided = super.drawChild(canvas, child, drawingTime);
111-
112114
canvas.restore();
113-
114115
return isInvalided;
115116
}
116117

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">CircularTools</string>
3+
</resources>

circulartransform/src/main/AndroidManifest.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

circulartransform/src/main/java/hu/aut/utillib/circular/animation/CircularAnimator.java

Lines changed: 0 additions & 63 deletions
This file was deleted.

circulartransform/src/main/res/values/strings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

gradle.properties

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,4 @@
1515
# When configured, Gradle will run in incubating parallel mode.
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18-
# org.gradle.parallel=true
19-
20-
VERSION_NAME=1.0.1
21-
VERSION_CODE=2
22-
GROUP=com.github.ozodrukh
23-
24-
POM_DESCRIPTION=Port of Lollipop circular reveal animation
25-
POM_URL=https://github.com/ozodrukh/CircularReveal
26-
POM_SCM_URL=https://github.com/ozodrukh/CircularReveal
27-
POM_SCM_CONNECTION=scm:[email protected]:ozodrukh/CircularReveal.git
28-
POM_SCM_DEV_CONNECTION=scm:[email protected]:ozodrukh/CircularReveal.git
29-
POM_LICENCE_NAME=The MIT License (MIT)
30-
POM_LICENCE_URL=http://opensource.org/licenses/MIT
31-
POM_LICENCE_DIST=repo
32-
POM_DEVELOPER_ID=ozodrukh
33-
POM_DEVELOPER_NAME=Abdullaev Ozodrukh
34-
POM_DEVELOPER_EMAIL=[email protected]
18+
# org.gradle.parallel=true

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include ':circulartransform', ':circulardemo'
1+
include ':circulartools', ':circulardemo'

0 commit comments

Comments
 (0)