FlipViewPager.Draco


Source link: https://github.com/Yalantis/FlipViewPager.Draco

Changes:

  • Made clickable views like a button clickable inside the FlipViewPager.
  • Use RecyclerView.
  • Updated to API 23.
  • Added support for close clicks on a MergePage e.g. to add a close button.

FlipViewPager.Draco

This project aims to provide a working page flip implementation for usage in ListView. Made in [Yalantis] ( https://yalantis.com/?utm_source=github)

#Usage

For a working implementation, Have a look at the Sample Project - sample

To achieve the same grid-looking view you should:

  1. Include the library as local library project:

    compile 'com.yalantis:flipviewpager:1.0.0'
  2. Create your main layout, it will be the view with 2 items merged together:

    <!-- ... -->  <ImageView
      android:id="@+id/first"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="0dp"
      android:layout_weight="1"
      android:contentDescription="left image"
      android:layout_height="wrap_content"
      android:scaleType="fitXY" />  <LinearLayout
      android:layout_width="1dp"
      android:layout_weight="0"
      android:background="#000000"
      android:layout_height="fill_parent"/>  <ImageView
      android:id="@+id/second"
      android:layout_width="0dp"
      android:layout_weight="1"
      android:contentDescription="right image"
      android:layout_height="wrap_content"
      android:scaleType="fitXY" />  <!-- ... -->
  3. Create layout for displaying an additional info for each merged item:

    <!-- ... -->  <com.yalantis.flip.sample.views.FontTextView
      style="@style/TextView.Nickname"
      android:id="@+id/nickname" />  <LinearLayout
      android:layout_below="@+id/nickname"
      android:id="@+id/interestsPrimary"
      style="@style/LinearLayout.Interests">
    
    <com.yalantis.flip.sample.views.FontTextView
    
    style="@style/TextView.Interest"
    
    android:id="@+id/interest_1" />
    
    <!-- ... -->  </LinearLayout> 
  4. Create your adapter and extend it from BaseFlipAdapter<T>

    class FriendsAdapter extends BaseFlipAdapter<Friend> {
    
    @Override  public View getPage(int position,
    
      View convertView,
    
      ViewGroup parent,
    
      Friend friend1,
    
      Friend friend2) {
    
    // ...  
    }
    
    class FriendsHolder {
    
    // ...
      
    }
     
    }
    
  5. Set your adapter in ListView

    final ListView friends = (ListView) findViewById(R.id.friends);
     friends.setAdapter(new FriendsAdapter(this, Utils.friends, settings));
    
  6. You can handle clicks just like in regular ListView

friends.setOnItemClickListener(new AdapterView.OnItemClickListener() {

  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

Friend friend = (Friend) friends.getAdapter().getItem(position);

Toast.makeText(FriendsActivity.this, friend.getNickname(), Toast.LENGTH_SHORT).show();

  
}
 
}
);

More options will be added soon :)

#Customization

To customize page will be shown first - create and pass FlipSettings object into adapter

FlipSettings settings = new FlipSettings.Builder().defaultPage(1).build();

#Compatibility

  • Android 4.0+

Changelog

Version: 1.0

  • Initial Build

Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding the animation.

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for Android (iOS) better than better. Stay tuned!

License

Copyright 2017, Yalantis  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

Shelf is an easy way to implement repository pattern in your project.

A utility class for converting between different Android display units.

You can manage your application's version update or get your market information more simply.

Simple and easy to use PlaySound.java file lets you generate tone of a particular frequency.

Android library makes using Shared Preference easier.

Features:

  • Support RxJava 2
  • Encrypt Data
  • Support Iterable
  • Build on top of repository design pattern

A RecyclerView extension for building list more easily.

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