Skip to content

Commit

Permalink
Add maven support and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
drakeet committed Jan 2, 2021
1 parent 8cc7fca commit d199205
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 91 deletions.
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,60 @@
# FullDraggableDrawer

```java
// TODO
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)

<img src="snapshot.jpg" width=360></img>

_* Full demo video: https://t.me/PureWriter/549_

## Getting started

In your `build.gradle`:

```groovy
dependencies {
implementation 'com.drakeet.drawer:drawer:0.9.0'
}
```

## Usage

Replace the main Layout of `DrawerLayout` with the `FullDraggableContainer`:

```xml
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- here 👇 -->
<com.drakeet.drawer.FullDraggableContainer
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- ... -->

</com.drakeet.drawer.FullDraggableContainer>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left">

<!-- ... -->

</FrameLayout>

</androidx.drawerlayout.widget.DrawerLayout>
```

**That's all, you're good to go!**

## TODO

- [ ] Add support for the right drawer / RTL
- [ ] Add support for other kinds of drawer

License
-------

Expand Down
126 changes: 126 additions & 0 deletions gradle/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
* Copyright 2013 Chris Banes
* Copyright 2016 drakeet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'maven'
apply plugin: 'signing'

version = buildConfig.versionName
group = GROUP

def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL : "https://oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}

def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = version

repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(),
password: getRepositoryPassword())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(),
password: getRepositoryPassword())
}

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

android.libraryVariants.all { variant ->
task("${variant.name}Javadoc", type: Javadoc) {
description "Generates Javadoc for $variant.name."
source = variant.javaCompile.source
classpath = files(variant.javaCompile.classpath.files,
project.android.getBootClasspath())
exclude '**/BuildConfig.java'
exclude '**/R.java'
}
}

task javadocJar(type: Jar, dependsOn: 'releaseJavadoc') {
classifier = 'javadoc'
from {
releaseJavadoc.destinationDir
}
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}

artifacts {
archives androidSourcesJar
archives javadocJar
}
}
5 changes: 2 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
* limitations under the License.
*/

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

android {
compileSdkVersion 30
Expand Down
33 changes: 33 additions & 0 deletions library/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright (c) 2021. Drakeet Xu
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

POM_NAME=FullDraggableDrawer
POM_ARTIFACT_ID=drawer
POM_PACKAGING=aar

GROUP=com.drakeet.drawer

POM_DESCRIPTION=Easier and more flexible to create multiple types for Android RecyclerView.
POM_URL=https://github.com/PureWriter/FullDraggableDrawer
POM_SCM_URL=https://github.com/PureWriter/FullDraggableDrawer
POM_SCM_CONNECTION=scm:[email protected]:PureWriter/FullDraggableDrawer.git
POM_SCM_DEV_CONNECTION=scm:[email protected]:PureWriter/FullDraggableDrawer.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=drakeet
POM_DEVELOPER_NAME=Drakeet Xu
POM_DEVELOPER_URL=https://drakeet.com
91 changes: 6 additions & 85 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,104 +17,25 @@

<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity"
tools:ignore="HardcodedText">
android:layout_height="match_parent">

<!-- here👇 -->
<com.drakeet.drawer.FullDraggableContainer
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F0F4C3">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingVertical="64dp"
android:text="TextView:\n com.drakeet.drawer.FullDraggableContainer"
android:textColor="@color/black"
android:typeface="monospace" />

<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="#12000000">

<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:padding="64dp"
android:text="HorizontalScrollView HorizontalScrollView HorizontalScrollView HorizontalScrollView"
android:textColor="@color/black"
android:typeface="monospace" />

</HorizontalScrollView>

<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:paddingVertical="64dp"
android:text="ViewPage1"
android:textColor="@color/black"
android:typeface="monospace" />

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:paddingVertical="64dp"
android:text="ViewPage2"
android:textColor="@color/black"
android:typeface="monospace" />

</androidx.viewpager.widget.ViewPager>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="#12000000"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
android:layout_height="match_parent">

</LinearLayout>
<!-- ... -->

</com.drakeet.drawer.FullDraggableContainer>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left"
android:layout_marginRight="28dp"
android:background="#C5CAE9"
android:fitsSystemWindows="false"
tools:ignore="RtlHardcoded">
android:layout_gravity="left">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="Left drawer"
android:textColor="@color/black" />
<!-- ... -->

</FrameLayout>

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
*/

rootProject.name = "FullDraggableDrawer"
include ':sample'
// include ':sample'
include ':library'
Binary file added snapshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d199205

Please sign in to comment.