SublimeNavigationView


Source link: https://github.com/vikramkakkar/SublimeNavigationView

SublimeNavigationView

... is a complete rewrite of NavigationView (from Design Support library) that enables usage of Checkboxes, Switches & Badges in/as menu items. Menus are defined in good-old XML, and parsed using a custom MenuInflater. SublimeNavigationView works with Parcelable menus which means that state retention is built-in. Moreover, it can support multiple menus while preserving their respective states. Groups added to the menu have the added feature of being collapsible/expandable. Along with this, SublimeNavigationView allows a few options for custom styling.

Gradle dependency

compile 'com.appeaser.sublimenavigationviewlibrary:sublimenavigationviewlibrary:0.0.1' 

Walkthrough

Screenshots have been taken from the sample application available here:

How the menu looks:

SublimeNavigationView can work with any number of menus. As an example of this, the sample application shows how to handle two of them:

Switching between menus:

First Menu Second Menu

SublimeMenu supports grouping of menu items. In addition to the standard features such as defining a checkable policy, ordering etc., a SublimeGroup can be expanded/collapsed - on user input, through XML definition, or programmatically:

Collapsed Expanded

XML definitions are quite straight-forward. An example:

<Text
  android:id="@+id/text_item_1"
  android:title="Independent item"
  android:hint="(Optional) hint for this item"/> 

This would translate to:

A Text item with an icon - and another, that shows icon space, but doesn't display an icon:

<Text
  android:id="@+id/text_item_2"
  android:title="Independent item with icon"
  android:icon="@drawable/archive" />  <Text
  android:id="@+id/text_item_5"
  android:title="Indented item"
  android:hint="Show icon space on-demand"
  app:showIconSpace="true"/> 

Output:

TextWithBadge menu items can be presented in two forms - initialized & uninitialized. In uninitialized form, the item will display an indeterminate ProgressBar in place of badgeText:

<TextWithBadge
  android:id="@+id/text_with_badge_item_1"
  android:title="Text with badge item"
  app:valueProvidedAsync="true"/> 

In initialized form, the item will have its badgeText set in XML:

<TextWithBadge
  android:id="@+id/text_with_badge_item_1"
  android:title="Text with badge item"
  app:badgeText="25"/> 

This feature can be used if the badgeText is being retrieved through a network call, or if some computation needs to be performed before it can be displayed. Once the text is available, you can display it using:

((SublimeTextWithBadgeMenuItem)snv.getMenu().getMenuItem(R.id.text_with_badge_item_1))

.setBadgeText("25").setValueProvidedAsync(false);
 

SublimeNavigationView also supports a few styling options. As an example, the sample application uses a custom typeface spicified in the view's xml definition:

<com.appeaser.sublimenavigationviewlibrary.SublimeNavigationView
  ....
  ....
  app:snvHeaderLayout="@layout/nav_header"
  app:snvMenu="@menu/test_nav_menu_1"
  app:snvItemTypefaceFilename="planer_bold_webfont.ttf"
  app:snvHintTypefaceFilename="planer_reg_webfont.ttf"
  app:snvSubheaderItemTypefaceFilename="planer_bold_webfont.ttf"/> 

Styling info can also be set programmatically by providing a initialized SublimeThemer.

There were some features that were left out on purpose. One of them was the option to define sub-menus. This feature is essential when used within the ActionBar design pattern, but its importance in a navigation view is lost on me.

The NavigationView from design library adds separators automatically. SublimeNavigationView takes a different approach, and lets you decide where the separators should go. So, to create a divider, add a Separator menu item:

<Separator
  android:id="@+id/separator_item_1" /> 

Since there are no space concerns, orderInCategory & menuCategory have also been left out.

License

Copyright (c) 2015 Vikram Kakkar  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

Android library written in kotlin that add noise effect to image.

Bottom Navigation Bar Icons morphing.

Dr.Vector automatically process the vector drawable file - it converts all float numbers declared without 0 before point.

How to use it

  • Option 1: Edit - Doctor Vector - Fix Floating Points
  • Option 2: Ctrl + Alt + D

An Android library automatically adds scroll up button to RecyclerView.

It is hard to use parallax effect in your app when you are using fresco image loader library.

But if you use this library, you can use parallax effect while using fresco.

Concept

  • It supports only vertical parallax effect.
  • It cannot support image crop.
  • Actual Image's ratio must be larger than DraweeView ratio.
  • Scroll offset is between 0 and 1 float value.

Add custom font classes easily for TextView, EditText & Buttons.

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