Infinity Menu


Source link: https://github.com/desnyki/InfinityMenu

InfinityMenu

InfinityMenu is an Android Library implementing an accordion style menu. You can place any view with any size in the menu. To close the menu you can drag to close or tap outside the menu. You can have only one menu open at a time.

Add it to your build.gradle with:

allprojects {

  repositories {

maven {
 url "https://jitpack.io" 
}

  
}
 
}

and:

dependencies {

  compile 'com.github.desnyki:InfinityMenu:1.0.3' 
}

How to use:

You can look at the sample app to see how to use this library in detail.

In your layout create a FrameLayout which will hold the RootScrollView that contains the menu title bars. As well as the ChildScrollView that holds the menu item. It is important to set fillViewport for RootScrollView, and to set ChildScrollView as invisible.

 <FrameLayout
  android:layout_width="match_parent"
  android:layout_height="match_parent">
  <com.desnyki.library.infinitymenu.RootScrollView

android:id="@+id/menu_scroll_view"

android:layout_height="match_parent"

android:layout_width="match_parent"

android:fillViewport="true"

>  </com.desnyki.library.infinitymenu.RootScrollView>  <com.desnyki.library.infinitymenu.ChildScrollView

android:id="@+id/child_scroll_view"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:visibility="invisible"

>
  </com.desnyki.library.infinitymenu.ChildScrollView>
  </FrameLayout>

You can style and place menu title bars as children of the RootScrollView. If you want to animate the arrow like in the gif, you will need to have an element with tag "arrow" which will then spin 90 degrees based on state.

<RelativeLayout android:id="@+id/bar1" android:background="@drawable/bar"
  android:layout_width="match_parent" android:layout_height="64dp" android:orientation="horizontal">

 <ImageView

android:scaleType="fitCenter"

android:layout_width="16dp"

android:layout_height="16dp"

android:layout_centerVertical="true"

android:src="@drawable/arrow_right"

android:layout_alignParentEnd="true"

android:tag="arrow"

android:layout_marginRight="8dp"

/> </RelativeLayout> 

In your main Activity you will have to get a reference to both the ChildScrollView and RootScrollView as well as the bar views.

childScrollView.setBackgroundScrollView(rootScrollView);
 childScrollView.setCloseDistance(50);
  RelativeLayout bar1 = (RelativeLayout) findViewById(R.id.bar1);

bar1.setOnClickListener(new View.OnClickListener() {

 @Override

 public void onClick(View view) {

  childScrollView.addView((LinearLayout) getLayoutInflater().inflate(R.layout.my_menu_item, null), 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));

  childScrollView.openWithAnim(bar1,true,false);

 
}

}
);

.openWithAnim(param 1: title bar object, param 2: is child full screen, param 3: do you want to show the title bar if full screen) is the call that opens your accordion.

License

Copyright 2016 Marcin Deszczynski  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. 

Resources

A simple material design app intro with cool animations and a simple API.

An Android Library for common network operations with a fluent and easy to use API.

An Android library for cycling through views using animations. The library provides 2 animations as built in animations: a flip animation and a fade animation.

A light but powerful ORM and SQL query generator for Java/Android with RxJava and Java 8 support.

Automated localized screenshots of your Android app on every device.

NoseyExplorer is a simple explorer that lets you see the data that Realm.io has saved for your models.

Simply register your models and your ready to start browsing your data from within your app.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes