multiline-collapsingtoolbar


Source link: https://github.com/opacapp/multiline-collapsingtoolbar

multiline-collapsingtoolbar

multiline-collapsingtoolbar is a replacement for CollapsingToolbarLayout from the Android Design Support Library which can deal with multiline titles (with a customizable maximum number of lines) in the expanded state. When collapsing the toolbar, the lower lines of the title fade away to leave only the top line visible.

There are two issues ( 180736, 215056) in the Android Issue Tracker which request this and/or similar features to be added to the official Design Support Library. We encourage you to star these issues to help make this library obsolete (and relieve us of the burden of updating it with every new Support Library version) in the future.

Example

Here you can see the library in action in the included demo app:

Installation

If you are using Gradle and the JCenter Maven Repository, installing the library is as simple as adding a new dependency statement.

dependencies {

  compile 'net.opacapp:multiline-collapsingtoolbar:1.6.0' 
}

The current version 1.6.0 of the library is based on the code and tested with the Design Support Library version 27.0.0. We'll try to keep up to date with new support library versions as soon as possible, but please do not expect this library to run with support versions other than that.

Usage

The library's public API is nearly identical to the version from the support library, so you can use it as a drop-in replacement. We only added a maxLines attribute and corresponding getter and setter functions to the CollapsingToolbarLayout to make it possible to change the maximum number of lines, which is set to 3 by default.

As the Design Support Library, it should be compatible with API 14 (Android 4.0) and above.

XML layout example:

<android.support.design.widget.AppBarLayout

android:layout_height="192dp"

android:layout_width="match_parent">
  <net.opacapp.multilinecollapsingtoolbar.CollapsingToolbarLayout

 android:layout_width="match_parent"

 android:layout_height="match_parent"

 app:layout_scrollFlags="scroll|exitUntilCollapsed"

 app:maxLines="3">

<android.support.v7.widget.Toolbar

  android:layout_height="?attr/actionBarSize"

  android:layout_width="match_parent"

  app:layout_collapseMode="pin"/>
  </net.opacapp.multilinecollapsingtoolbar.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout>

You can find a simple demo application in the demo module.

Implementation details

Most of the code is copied from the original Support Library classes, the only changes (apart from the package name, imports and automatic code reformatting) are in the CollapsingTextHelper and CollapsingToolbarLayout classes. The changes there are marked with comments.

Contributing

This library is probably not complete and might contain bugs that only occur in constellations we did not yet test. Please do not hesitate to create an issue on GitHub for any problems that cross your way. Please understand that we cannot afford to spend time fixing problems that do not affect our products, but we'll be happy to merge pull requests if you or someone else is able to improve this library.

If you get stuck anywhere in the process, please do not hestitate to ask us anytime at [email protected].

Please note that we have a Code of Conduct in place that applies to all project-related communication.

Contributors

Resources

A line chart library.

A library that uses technologies like artificial Intelligence, machine learning, and deep learning to make developers understand the content that they are displaying in their app.

A simple client for the Clarifai image and video recognition API.

ReactiveAwareness lets you use the Android Awareness API with RxJava and without handling all those GoogleApiClients yourself.

Android (f/w 1.5+) on screen keyboard for multiple languages.

Custom SoftKeyboard example.

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