Dewey


Source link: https://github.com/TippingCanoe/Dewey

Dewey

Introduction

Dewey is an android widget designed to hold an unlimited number of tabs, making it ideal for allowing pagination through a list, hence it being named after The Dewey Decimal System. Most other implementations of this style of widget don't recycle their child views, leading to performance issues even on modern devices for large data-sets.

A demo application included with this repository shows an example of this functionality;

Installing

  1. Add the repository;

    repositories {
      maven {
    
    url 'https://jitpack.io'  
    }
     
    }
    
  2. Add the dependency;

    dependencies {
      compile 'com.TippingCanoe.Dewey:library:0.0.1' 
    }
    

Creating layout

The com.tippingcanoe.dewey.Dewey view is the core of this project. Simply add one to your view;

<com.tippingcanoe.dewey.Dewey  android:layout_width="match_parent"  android:layout_height="wrap_content" />

You can also customize certain properties of the view, more on what those properties control later;

<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:custom="http://schemas.android.com/apk/res-auto"  android:layout_width="match_parent"
  android:layout_height="match_parent">

<com.tippingcanoe.dewey.Dewey

android:layout_width="match_parent"

android:layout_height="wrap_content"

custom:stripColor="@color/accent_material_light"

custom:animationDurationMs="@integer/animation_duration_ms"

custom:cloakColor="@color/background_floating_material_dark"

custom:minCloakPercentage="@integer/min_cloak_percentage"

custom:stripHeight="@dimen/strip_height" />  </RelativeLayout>

Setting up views

Once you've got your layout setup, you'll need to find your view;

Dewey dewey = (Dewey) findViewById(R.id.dewey);

Dewey extends android.support.v7.widget.RecyclerView, so you'll need to create and add a new RecyclerView.Adapter. This works the same as any other implementation, so take a look at the example code in the :app module of this repository or familiarize yourself with Google's Documentation;

dewey.setAdapter(new MyAdapter());
  public class MyAdapter extends RecyclerView.Adapter<MyViewHolder> {
  ... 
}
  public class MyViewHolder extends RecyclerView.ViewHolder {
  ... 
}

You can also setup a listener on the view to receive notifications when a new page is selected;

dewey.setOnFocusedPositionChangedListener(new Dewey.OnFocusedPositionChangedListener() {
  @Override  public void onFocusedPositionChanged ( int previousFocusedPosition, int newFocusedPosition ) {

...  
}
 
}
);

Customizing

This library provides plenty of customization touch points to ensure the effect is right for your application;

  • cloakColor
    • The first and last "page" of the list are always visible to the user, pinned at the beginning and end of the list. The "cloak" is rendered behind them to ensure they are legible.
  • minCloakPercentage
    • Sets the minimum amount, between 0 and 100 percent, of the background "cloak"s transparency. From this point, it is calculated on a curve.
  • stripHeight
    • Sets the height dimension for the current page indication strip.
  • stripColor
    • Sets the colour for the current page indication strip.
  • animationDurationMs
    • Sets the speed of the animation for changing pages, in milliseconds.

Contact

Love it? Hate it? Want to make changes to it? Contact me at @iainconnor or [email protected].

Resources

Typewriter is a pull-to-refsresh android animation library that support multiple collection views.

Encrypted logging made great again.

Specialized Logger is an Android library that provides you flexibility and reliability when logging. It comes with a simple to use logger as well as an encrypted logger for commercial products.

Android library for EditText. Easy way for add phone readability in your project.

KotlinPoet is a Kotlin and Java API for generating .kt source files.

Source file generation can be useful when doing things such as annotation processing or interacting with metadata files (e.g., database schemas, protocol formats). By generating code, you eliminate the need to write boilerplate while also keeping a single source of truth for the metadata.

An awesome and customizable search dialog with built-in search options.

The Fuze project is an example of MVVM design pattern in full functional reactive programming RxJava2 with Dagger2.

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