Skip to content

Commit d199205

Browse files
committed
Add maven support and update README
1 parent 8cc7fca commit d199205

File tree

7 files changed

+221
-91
lines changed

7 files changed

+221
-91
lines changed

README.md

+53-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,60 @@
11
# FullDraggableDrawer
22

3-
```java
4-
// TODO
3+
Make the `DrawerLayout` can be dragged/pulled out in real-time within the range of fullscreen, like [Pure Writer](https://play.google.com/store/apps/details?id=com.drakeet.purewriter)
4+
5+
<img src="snapshot.jpg" width=360></img>
6+
7+
_* Full demo video: https://t.me/PureWriter/549_
8+
9+
## Getting started
10+
11+
In your `build.gradle`:
12+
13+
```groovy
14+
dependencies {
15+
implementation 'com.drakeet.drawer:drawer:0.9.0'
16+
}
517
```
618

19+
## Usage
20+
21+
Replace the main Layout of `DrawerLayout` with the `FullDraggableContainer`:
22+
23+
```xml
24+
<androidx.drawerlayout.widget.DrawerLayout
25+
xmlns:android="http://schemas.android.com/apk/res/android"
26+
android:id="@+id/drawer"
27+
android:layout_width="match_parent"
28+
android:layout_height="match_parent">
29+
30+
<!-- here 👇 -->
31+
<com.drakeet.drawer.FullDraggableContainer
32+
android:layout_width="match_parent"
33+
android:layout_height="match_parent">
34+
35+
<!-- ... -->
36+
37+
</com.drakeet.drawer.FullDraggableContainer>
38+
39+
<FrameLayout
40+
android:layout_width="match_parent"
41+
android:layout_height="match_parent"
42+
android:layout_gravity="left">
43+
44+
<!-- ... -->
45+
46+
</FrameLayout>
47+
48+
</androidx.drawerlayout.widget.DrawerLayout>
49+
```
50+
51+
**That's all, you're good to go!**
52+
53+
## TODO
54+
55+
- [ ] Add support for the right drawer / RTL
56+
- [ ] Add support for other kinds of drawer
57+
758
License
859
-------
960

gradle/gradle-mvn-push.gradle

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/*
2+
* Copyright 2013 Chris Banes
3+
* Copyright 2016 drakeet
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
apply plugin: 'maven'
19+
apply plugin: 'signing'
20+
21+
version = buildConfig.versionName
22+
group = GROUP
23+
24+
def isReleaseBuild() {
25+
return version.contains("SNAPSHOT") == false
26+
}
27+
28+
def getReleaseRepositoryUrl() {
29+
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
30+
}
31+
32+
def getSnapshotRepositoryUrl() {
33+
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL : "https://oss.sonatype.org/content/repositories/snapshots/"
34+
}
35+
36+
def getRepositoryUsername() {
37+
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
38+
}
39+
40+
def getRepositoryPassword() {
41+
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
42+
}
43+
44+
afterEvaluate { project ->
45+
uploadArchives {
46+
repositories {
47+
mavenDeployer {
48+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
49+
50+
pom.groupId = GROUP
51+
pom.artifactId = POM_ARTIFACT_ID
52+
pom.version = version
53+
54+
repository(url: getReleaseRepositoryUrl()) {
55+
authentication(userName: getRepositoryUsername(),
56+
password: getRepositoryPassword())
57+
}
58+
snapshotRepository(url: getSnapshotRepositoryUrl()) {
59+
authentication(userName: getRepositoryUsername(),
60+
password: getRepositoryPassword())
61+
}
62+
63+
pom.project {
64+
name POM_NAME
65+
packaging POM_PACKAGING
66+
description POM_DESCRIPTION
67+
url POM_URL
68+
69+
scm {
70+
url POM_SCM_URL
71+
connection POM_SCM_CONNECTION
72+
developerConnection POM_SCM_DEV_CONNECTION
73+
}
74+
75+
licenses {
76+
license {
77+
name POM_LICENCE_NAME
78+
url POM_LICENCE_URL
79+
distribution POM_LICENCE_DIST
80+
}
81+
}
82+
83+
developers {
84+
developer {
85+
id POM_DEVELOPER_ID
86+
name POM_DEVELOPER_NAME
87+
}
88+
}
89+
}
90+
}
91+
}
92+
}
93+
94+
signing {
95+
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
96+
sign configurations.archives
97+
}
98+
99+
android.libraryVariants.all { variant ->
100+
task("${variant.name}Javadoc", type: Javadoc) {
101+
description "Generates Javadoc for $variant.name."
102+
source = variant.javaCompile.source
103+
classpath = files(variant.javaCompile.classpath.files,
104+
project.android.getBootClasspath())
105+
exclude '**/BuildConfig.java'
106+
exclude '**/R.java'
107+
}
108+
}
109+
110+
task javadocJar(type: Jar, dependsOn: 'releaseJavadoc') {
111+
classifier = 'javadoc'
112+
from {
113+
releaseJavadoc.destinationDir
114+
}
115+
}
116+
117+
task androidSourcesJar(type: Jar) {
118+
classifier = 'sources'
119+
from android.sourceSets.main.java.sourceFiles
120+
}
121+
122+
artifacts {
123+
archives androidSourcesJar
124+
archives javadocJar
125+
}
126+
}

library/build.gradle

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
plugins {
18-
id 'com.android.library'
19-
}
17+
apply plugin: 'com.android.library'
18+
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
2019

2120
android {
2221
compileSdkVersion 30

library/gradle.properties

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#
2+
# Copyright (c) 2021. Drakeet Xu
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
POM_NAME=FullDraggableDrawer
18+
POM_ARTIFACT_ID=drawer
19+
POM_PACKAGING=aar
20+
21+
GROUP=com.drakeet.drawer
22+
23+
POM_DESCRIPTION=Easier and more flexible to create multiple types for Android RecyclerView.
24+
POM_URL=https://github.com/PureWriter/FullDraggableDrawer
25+
POM_SCM_URL=https://github.com/PureWriter/FullDraggableDrawer
26+
POM_SCM_CONNECTION=scm:git@github.com:PureWriter/FullDraggableDrawer.git
27+
POM_SCM_DEV_CONNECTION=scm:git@github.com:PureWriter/FullDraggableDrawer.git
28+
POM_LICENCE_NAME=The Apache Software License, Version 2.0
29+
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
30+
POM_LICENCE_DIST=repo
31+
POM_DEVELOPER_ID=drakeet
32+
POM_DEVELOPER_NAME=Drakeet Xu
33+
POM_DEVELOPER_URL=https://drakeet.com

sample/src/main/res/layout/activity_main.xml

+6-85
Original file line numberDiff line numberDiff line change
@@ -17,104 +17,25 @@
1717

1818
<androidx.drawerlayout.widget.DrawerLayout
1919
xmlns:android="http://schemas.android.com/apk/res/android"
20-
xmlns:app="http://schemas.android.com/apk/res-auto"
21-
xmlns:tools="http://schemas.android.com/tools"
2220
android:id="@+id/drawer"
2321
android:layout_width="match_parent"
24-
android:layout_height="match_parent"
25-
android:fitsSystemWindows="true"
26-
tools:context=".MainActivity"
27-
tools:ignore="HardcodedText">
22+
android:layout_height="match_parent">
2823

24+
<!-- here👇 -->
2925
<com.drakeet.drawer.FullDraggableContainer
3026
android:layout_width="match_parent"
31-
android:layout_height="match_parent"
32-
android:background="#F0F4C3">
33-
34-
<LinearLayout
35-
android:layout_width="match_parent"
36-
android:layout_height="match_parent"
37-
android:orientation="vertical">
38-
39-
<TextView
40-
android:layout_width="match_parent"
41-
android:layout_height="wrap_content"
42-
android:gravity="center"
43-
android:paddingVertical="64dp"
44-
android:text="TextView:\n com.drakeet.drawer.FullDraggableContainer"
45-
android:textColor="@color/black"
46-
android:typeface="monospace" />
47-
48-
<HorizontalScrollView
49-
android:layout_width="match_parent"
50-
android:layout_height="200dp"
51-
android:background="#12000000">
52-
53-
<TextView
54-
android:layout_width="wrap_content"
55-
android:layout_height="match_parent"
56-
android:gravity="center"
57-
android:padding="64dp"
58-
android:text="HorizontalScrollView HorizontalScrollView HorizontalScrollView HorizontalScrollView"
59-
android:textColor="@color/black"
60-
android:typeface="monospace" />
61-
62-
</HorizontalScrollView>
63-
64-
<androidx.viewpager.widget.ViewPager
65-
android:id="@+id/viewPager"
66-
android:layout_width="match_parent"
67-
android:layout_height="0dp"
68-
android:layout_weight="1">
69-
70-
<TextView
71-
android:layout_width="match_parent"
72-
android:layout_height="match_parent"
73-
android:gravity="center"
74-
android:paddingVertical="64dp"
75-
android:text="ViewPage1"
76-
android:textColor="@color/black"
77-
android:typeface="monospace" />
78-
79-
<TextView
80-
android:layout_width="match_parent"
81-
android:layout_height="match_parent"
82-
android:gravity="center"
83-
android:paddingVertical="64dp"
84-
android:text="ViewPage2"
85-
android:textColor="@color/black"
86-
android:typeface="monospace" />
87-
88-
</androidx.viewpager.widget.ViewPager>
89-
90-
<androidx.recyclerview.widget.RecyclerView
91-
android:id="@+id/recyclerView"
92-
android:layout_width="match_parent"
93-
android:layout_height="200dp"
94-
android:background="#12000000"
95-
android:orientation="horizontal"
96-
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
27+
android:layout_height="match_parent">
9728

98-
</LinearLayout>
29+
<!-- ... -->
9930

10031
</com.drakeet.drawer.FullDraggableContainer>
10132

10233
<FrameLayout
10334
android:layout_width="match_parent"
10435
android:layout_height="match_parent"
105-
android:layout_gravity="left"
106-
android:layout_marginRight="28dp"
107-
android:background="#C5CAE9"
108-
android:fitsSystemWindows="false"
109-
tools:ignore="RtlHardcoded">
36+
android:layout_gravity="left">
11037

111-
<TextView
112-
android:layout_width="match_parent"
113-
android:layout_height="wrap_content"
114-
android:layout_gravity="center"
115-
android:gravity="center"
116-
android:text="Left drawer"
117-
android:textColor="@color/black" />
38+
<!-- ... -->
11839

11940
</FrameLayout>
12041

settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
*/
1616

1717
rootProject.name = "FullDraggableDrawer"
18-
include ':sample'
18+
// include ':sample'
1919
include ':library'

snapshot.jpg

476 KB
Loading

0 commit comments

Comments
 (0)