Skip to content

Commit a86cc4c

Browse files
authored
Merge pull request #19 from 75py/dev1.3.0
Add getX() and getY()
2 parents 93b1853 + 9a47c1e commit a86cc4c

4 files changed

Lines changed: 65 additions & 4 deletions

File tree

library/build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,28 @@ install {
111111
}
112112
}
113113
}
114+
115+
task sourcesJar(type: Jar) {
116+
from android.sourceSets.main.java.srcDirs
117+
classifier = 'sources'
118+
}
119+
120+
task javadoc(type: Javadoc) {
121+
source = android.sourceSets.main.java.srcDirs
122+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
123+
}
124+
125+
afterEvaluate {
126+
javadoc.classpath += files(android.libraryVariants.collect { variant ->
127+
variant.javaCompile.classpath.files
128+
})
129+
}
130+
131+
task javadocJar(type: Jar, dependsOn: javadoc) {
132+
classifier = 'javadoc'
133+
from javadoc.destinationDir
134+
}
135+
artifacts {
136+
archives javadocJar
137+
archives sourcesJar
138+
}

library/src/main/java/com/nagopy/android/overlayviewmanager/OverlayView.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,16 @@ public OverlayView<T> setX(int x) {
380380
return this;
381381
}
382382

383+
/**
384+
* Get the X position.
385+
*
386+
* @return X position. The unit is pixels.
387+
* @see WindowManager.LayoutParams#x
388+
*/
389+
public int getX() {
390+
return params.x;
391+
}
392+
383393
/**
384394
* Set the Y position.
385395
*
@@ -393,6 +403,16 @@ public OverlayView<T> setY(int y) {
393403
return this;
394404
}
395405

406+
/**
407+
* Get the Y position.
408+
*
409+
* @return Y position. The unit is pixels.
410+
* @see WindowManager.LayoutParams#y
411+
*/
412+
public int getY() {
413+
return params.y;
414+
}
415+
396416
/**
397417
* Set the brightness of the screen.
398418
*

library/src/test/java/com/nagopy/android/overlayviewmanager/OverlayViewTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,22 @@ public void setY() throws Exception {
266266
assertThat(overlayView.params.y, is(200));
267267
}
268268

269+
@Test
270+
public void getX() throws Exception {
271+
assertThat(overlayView.params.x, is(0));
272+
273+
overlayView.params.x = 100;
274+
assertThat(overlayView.getX(), is(100));
275+
}
276+
277+
@Test
278+
public void getY() throws Exception {
279+
assertThat(overlayView.params.y, is(0));
280+
281+
overlayView.params.y = 200;
282+
assertThat(overlayView.getY(), is(200));
283+
}
284+
269285
@Test
270286
public void setScreenBrightness() throws Exception {
271287
assertThat(overlayView.params.screenBrightness, is(BRIGHTNESS_OVERRIDE_NONE));

version.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#Sat, 06 Oct 2018 23:16:33 +0900
1+
#Sat, 13 Oct 2018 16:32:42 +0900
22
major=1
3-
minor=2
4-
patch=1
5-
id=7
3+
minor=3
4+
patch=0
5+
id=8

0 commit comments

Comments
 (0)