Git Product home page Git Product logo

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

aweary avatar charlesx2013 avatar donaldchen avatar mrkcsc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

overlappingpanels's Issues

Allow start panel (or end panel) to remain open on wider screens

I'm using this library to adapt a tablet layout that is split in 2 sections. It is now a ConstraintLayout, divided by a vertical guideline.
On phone I'd like to have the left section in the start panel and the right section in the center panel. I'd like to use Overlapping Panels on the tablet layout too, replacing the ContraintLayout+Guideline and locking the start panel open, without the center panel going offscreen (basically, adapt its width to width of screen - start panel width). It should also avoid the alpha thing on the center panel.
Is this currently possible?

How to disable the gestures on the panels ?

Thank you for this great library,!!!!!!!!!
I want to disable the gestures of the panel.
How do I do that ?
And I also want to keep the center panel's opacity as normal when the start or the end panel is opened.
Thanks

Not require two side panels, specify just [left | right]

I'm a huge fan of this library's UX as the Android 10 back gesture breaks most app's UX in regards to side "panels"/navigation drawers.

I'm curious if there are any plans to make it possible to only need one overlapped panel instead of the currently required Start and End panels. I'd like to use this as a drop in replacement for all my navigation drawers but rarely do I need both start + end panels/drawers.

Cheers!

Library is not resolvable on newer Gradle Plugin (7.0.0)?

Hi, I'm just starting to learn Android App Development, I forgot what Gradle and AGP version I used previously when I was using this library. I accidentaly upgraded Android Studio IDE (Arctic Fox) and the Gradle too. Now, the library is not resolvable and Android Studio won't let me to downgrade gradle's version, Is there any known workaround? Thank you.

iOS platform

Could you please open source iOS version OverlappingPanels

Is there anyway to update region listeners after start panel or end panel opened?

Hi, I'm trying to register the some regionobserver to the endpanel, however this ends up make the region above also does not react to swipe to the overlapping panels. Adding the regionobservers dynamically depending on the state of the panels also seems to not updating the regionobservers? Is there anyway I can achieve this? Thank you for your wonderful library!

PanelsChildGestureRegionObserver not working properly

Hey guys, first let me thank you for making this library opened sourced.

The problem I am facing is the following: one of my fargments is basically a full page recyclerview that every row of that recyclerview host another horizontal recyclerview, so my fragment is filled with horizontal scrollable recyclerviews.
As the suggestion and following the example app, I added view.addOnLayoutChangeListener(PanelsChildGestureRegionObserver.Provider.get()) to the entire fragment view.

The issues is that sometimes it works and sometimes it does not work, when it works everything is perfect, when it doesn't the horizontal recyclerview is un scrollable and the panels won't open.
The weird thing is that when it's not working, either locking the phones and opening it again will fix it (without closing the app), or even pressing the Home button and then going back to the app will fix it.

Any suggestiongs?

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.