GithubHelp home page GithubHelp logo

aweary / overlappingpanels Goto Github PK

View Code? Open in Web Editor NEW

This project forked from discord/overlappingpanels

2.0 2.0 0.0 12.79 MB

Overlapping Panels is a gestures-driven navigation UI library for Android

License: Apache License 2.0

Kotlin 100.00%

overlappingpanels's Introduction

alt text

Build Status

Overlapping Panels is a gestures-driven navigation UI library for Android. Compared to DrawerLayout gestures, Overlapping Panels gestures are much less likely to conflict with Android 10's system back gestures because OverlappingPanelsLayout handles swipe gestures across its entire layout and not only from the edges of the screen. Overlapping Panels can act as a secondary navigation component in apps that use a bottom navigation bar / tabs as a primary navigation component.

Overlapping Panels Examples

Overlapping Panels Sample App Discord Android App
alt text alt text

Installation

Add the JitPack repository to your root build.gradle file:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Then add the Overlapping Panels gradle dependency:

dependencies {
    implementation 'com.github.discord:OverlappingPanels:x.y.z'
}

Replace x, y, and z with the corresponding release version numbers in the Overlapping Panels release page.

Basic Usage

OverlappingPanelsLayout is a ViewGroup that expects exactly three child views that represent the start panel, center panel, and end panel. The simplest way to use OverlappingPanelsLayout is to wrap the panel content in XML:

<com.discord.panels.OverlappingPanelsLayout
    android:id="@+id/overlapping_panels"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <!-- Set layout_gravity on the start panel to "start" -->
    <FrameLayout
        android:id="@+id/start_panel"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start">
        ...
    </FrameLayout>

    <FrameLayout
        android:id="@+id/center_panel"
        android:layout_width="wrap_content"
        android:layout_height="match_parent">
        ...
    </FrameLayout>

    <!-- Set layout_gravity on the end panel to "end" -->
    <FrameLayout
        android:id="@+id/end_panel"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="end">
        ...
    </FrameLayout>

</com.discord.panels.OverlappingPanelsLayout>

Wrapping the panel content in OverlappingPanelsLayout automatically enables panel gestures where swiping left and right will open and close the corresponding side panels.

Core Features

Check out the Overlapping Panels sample app for examples on how to use the core features of OverlappingPanelsLayout:

  1. Panel gestures
  2. Programmatically opening side panels
  3. Maintaining panel state through device rotations
  4. Registering child gesture regions that handle their own horizontal scrolls

License

Copyright (C) 2020 Discord Inc.

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.

overlappingpanels's People

Contributors

donaldchen avatar mrkcsc avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.