Skip to content

Commit 5db272d

Browse files
committed
Add deployment script
1 parent c9d299d commit 5db272d

File tree

7 files changed

+187
-15
lines changed

7 files changed

+187
-15
lines changed

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,41 @@ This code is a showcase of a foldable animation I created for Worldline. The cod
44
with java APIs from the Android SDK, without the use of any external library. This code is a demo and not a library.
55
The foldable layout is a layout (strictly a RelativeLayout), which can have two child layouts, one for the cover, and
66
one for the details. The foldable layout takes care of the folding animation between those two layouts.
7-
7+
88
In the demo the foldable layout is used in a RecyclerView, to show that it can manage well its size even during animation.
99

1010
![](https://raw.githubusercontent.com/worldline/FoldableLayout/dev/screenshots/demo.gif)
1111
<a href="http://www.youtube.com/watch?feature=player_embedded&v=XOAcNW82dl8
12-
" target="_blank"><img src="http://img.youtube.com/vi/XOAcNW82dl8/0.jpg"
12+
" target="_blank"><img src="http://img.youtube.com/vi/XOAcNW82dl8/0.jpg"
1313
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
1414

15-
[Update] Is a library available ?
16-
=================================
17-
[Update] Since a lot of people seems to endorse this code, I am considering to release the `foldablelayout` on Sonatype as is.
18-
19-
However, this code is very much specific (even if it is working from a separate gradle module).
20-
This is more a showcase, and if you want to use it, I greatly recommend you to understand the code from the `foldablelayout` and adapt it
21-
to your usage.
2215

2316
Under the hood
2417
==============
2518
Work in progress.
2619

20+
Is a library available ?
21+
========================
22+
The library is available as is. No support guarantied. This is more a showcase, and if you want to use it, I greatly recommend you to understand the code from the `foldablelayout` and adapt it
23+
to your usage.
24+
25+
- Add to your repositories the following url :
26+
27+
```gradle
28+
maven {
29+
url 'https://oss.sonatype.org/content/groups/public/'
30+
}
31+
```
32+
33+
and to your module gradle file :
34+
35+
```gradle
36+
dependencies {
37+
compile 'com.vincentbrison.openlibraries.android:foldablelayout:0.0.1@aar'
38+
}
39+
}
40+
```
41+
2742
License
2843
=======
2944

app/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ android {
2020
}
2121

2222
dependencies {
23-
compile project (":foldablelayout")
23+
//compile project (":foldablelayout")
24+
compile ('com.vincentbrison.openlibraries.android:foldablelayout:0.0.1-SNAPSHOT@aar') {
25+
transitive = true
26+
}
2427
testCompile 'junit:junit:4.12'
2528
compile 'com.jakewharton:butterknife:7.0.1'
2629
compile 'com.squareup.picasso:picasso:2.5.2'

build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,25 @@ allprojects {
1818
}
1919
}
2020

21+
def isReleaseBuild() {
22+
println("current VERSION_NAME : " + version)
23+
return version.contains("SNAPSHOT") == false
24+
}
25+
26+
allprojects {
27+
version = VERSION_NAME
28+
group = GROUP
29+
repositories {
30+
maven {
31+
url 'https://oss.sonatype.org/content/groups/public/'
32+
}
33+
maven {
34+
url 'https://oss.sonatype.org/content/repositories/snapshots/'
35+
}
36+
mavenCentral()
37+
}
38+
}
39+
2140
task clean(type: Delete) {
2241
delete rootProject.buildDir
2342
}

foldablelayout/build.gradle

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
apply plugin: 'com.android.library'
2+
apply from: 'maven_push.gradle'
23

34
android {
45
compileSdkVersion 23
56
buildToolsVersion "22.0.0"
67

78
defaultConfig {
8-
minSdkVersion 16
9+
minSdkVersion 14
910
targetSdkVersion 23
1011
versionCode 1
1112
versionName "1.0"
@@ -19,7 +20,17 @@ android {
1920
}
2021

2122
dependencies {
22-
compile fileTree(dir: 'libs', include: ['*.jar'])
2323
testCompile 'junit:junit:4.12'
2424
compile 'com.android.support:appcompat-v7:23.1.0'
2525
}
26+
27+
android.libraryVariants.all { variant ->
28+
def name = variant.buildType.name
29+
if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
30+
return; // Skip debug builds.
31+
}
32+
def task = project.tasks.create "jar${name.capitalize()}", Jar
33+
task.dependsOn variant.javaCompile
34+
task.from variant.javaCompile.destinationDir
35+
artifacts.add('archives', task);
36+
}

foldablelayout/maven_push.gradle

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
apply plugin: 'maven'
2+
apply plugin: 'signing'
3+
4+
def ask(param) {
5+
def console = System.console()
6+
def userInput
7+
if (console && !project.hasProperty("travis")) {
8+
userInput = console.readPassword('> ' + param.toString() + ' : ')
9+
} else {
10+
logger.error "Cannot get console. Please execute 'gradle uploadArchives' from CLI."
11+
}
12+
return userInput
13+
}
14+
15+
16+
def sonatypeRepositoryUrl
17+
if (isReleaseBuild()) {
18+
println 'RELEASE BUILD'
19+
sonatypeRepositoryUrl = hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
20+
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
21+
} else {
22+
println 'SNAPSHOT BUILD'
23+
sonatypeRepositoryUrl = hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
24+
: "https://oss.sonatype.org/content/repositories/snapshots/"
25+
26+
}
27+
28+
afterEvaluate { project ->
29+
uploadArchives {
30+
repositories {
31+
mavenDeployer {
32+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
33+
34+
pom.groupId = GROUP
35+
pom.artifactId = POM_ARTIFACT_ID
36+
pom.version = VERSION_NAME
37+
38+
repository(url: sonatypeRepositoryUrl) {
39+
authentication(userName: "vbrison", password: ask("Please provide your oss nexus password").toString())
40+
}
41+
42+
pom.project {
43+
name POM_NAME
44+
packaging POM_PACKAGING
45+
description POM_DESCRIPTION
46+
url POM_URL
47+
48+
scm {
49+
url POM_SCM_URL
50+
connection POM_SCM_CONNECTION
51+
developerConnection POM_SCM_DEV_CONNECTION
52+
}
53+
54+
licenses {
55+
license {
56+
name POM_LICENCE_NAME
57+
url POM_LICENCE_URL
58+
distribution POM_LICENCE_DIST
59+
}
60+
}
61+
62+
developers {
63+
developer {
64+
id POM_DEVELOPER_ID
65+
name POM_DEVELOPER_NAME
66+
}
67+
}
68+
}
69+
}
70+
}
71+
}
72+
73+
signing {
74+
allprojects {
75+
ext."signing.password" = ask("Please provide your key password")
76+
ext."signing.keyId" = "D376F8F6"
77+
//ext."signing.secretKeyRingFile" = "C:/Users/Brize/AppData/Roaming/gnupg/secring.gpg"
78+
ext."signing.secretKeyRingFile" = "/Users/vincentbrison/.gnupg/secring.gpg"
79+
}
80+
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
81+
sign configurations.archives
82+
}
83+
84+
task androidJavadocs(type: Javadoc) {
85+
source = android.sourceSets.main.java.srcDirs
86+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
87+
}
88+
89+
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
90+
classifier = 'javadoc'
91+
from androidJavadocs.destinationDir
92+
}
93+
94+
task androidSourcesJar(type: Jar) {
95+
classifier = 'sources'
96+
from android.sourceSets.main.java.sourceFiles
97+
}
98+
99+
artifacts {
100+
archives androidSourcesJar
101+
archives androidJavadocsJar
102+
}
103+
}
104+

foldablelayout/src/main/java/worldline/com/foldablelayout/FoldableLayout.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040

4141

4242
/**
43-
* Layout which allow a foldable animation between two other layouts.
43+
* Layout which allow a foldable animation between two other layouts. The only limitation of this
44+
* layout is than the big view should be exactly twice bigger in height than the small view {@link #setupViews(int, int, int, Context)}.
4445
*/
4546
public class FoldableLayout extends RelativeLayout {
4647

@@ -161,11 +162,12 @@ public boolean isFolded() {
161162
}
162163

163164
/**
164-
* Init the two views which will compose the foldable sides.
165+
* Init the two views which will compose the foldable sides. To ensure nice animations,
166+
* the big view height should be exactly twice bigger than the small view height.
165167
*
166168
* @param coverLayoutId is the "small" view which is used as the cover.
167169
* @param detailLayoutId is the "big" view which is used as the detail.
168-
* @param coverHeight is the hight of the cover view.
170+
* @param coverHeight is the height of the cover view.
169171
* @param context is a valid context.
170172
*/
171173
public void setupViews(@LayoutRes int coverLayoutId, @LayoutRes int detailLayoutId, @DimenRes int coverHeight, Context context) {

gradle.properties

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
VERSION_NAME=0.0.1-SNAPSHOT
2+
VERSION_CODE=1
3+
4+
GROUP=com.vincentbrison.openlibraries.android
5+
POM_DESCRIPTION=FoldableLayout is an Android layout allowing nice foldable animations.
6+
POM_URL=https://github.com/worldline/FoldableLayout
7+
POM_SCM_URL=https://github.com/worldline/FoldableLayout
8+
POM_SCM_CONNECTION=scm:[email protected]:worldline/FoldableLayout.git
9+
POM_SCM_DEV_CONNECTION=scm:[email protected]:worldline/FoldableLayout.git
10+
POM_LICENCE_NAME=The Apache Software License, Version 2.0
11+
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
12+
POM_LICENCE_DIST=repo
13+
POM_DEVELOPER_ID=vbrison
14+
POM_DEVELOPER_NAME=Vincent Brison
15+
POM_NAME=FoldableLayout
16+
POM_ARTIFACT_ID=foldablelayout
17+
POM_PACKAGING=aar
18+

0 commit comments

Comments
 (0)