simple-view-behavior


Source link: https://github.com/zoonooz/simple-view-behavior

simple-view-behavior

Simple View Behavior for Android CoordinatorLayout.

This library provide you easy ways to config and setup the view behavior without creating subclass of Behavior

Installation

compile 'com.zoonref:simple-view-behavior:1.0' 

Usage

You can setup behavior effect by using only xml option.

  1. set the layout behavior to this library class app:layout_behavior="com.zoonref.SimpleViewBehavior"
  2. set the dependency view by specify resource id by app:dependsOn="@+id/{ your view id } "
  3. set the type of dependency app:dependType="{ x,y,width,height } "
  4. set the dependency view target value according to the type you choose app:dependTargetXXX="{ value } "
  5. set the target appearance that you want your view to animate to

There are two ways to specify the animation when the dependency view changed.

1. xml

<View

android:layout_width="40dp"

android:layout_height="40dp"

android:layout_marginTop="8dp"

android:layout_marginLeft="20dp"

android:rotationX="90"

android:elevation="10dp"

android:background="@android:color/holo_blue_bright"

android:alpha="0"

app:layout_behavior="com.zoonref.SimpleViewBehavior"

app:dependsOn="@+id/app_bar"

app:dependType="y"

app:dependTargetY="-156dp"

app:targetAlpha="1"

app:targetRotateX="0"/> 

This View will depend on the y positon of @+id/app_bar which is AppBarLayout. View will animation from current state of AppBarLayout until y position of AppBarLayout is -156dp with the animation, View will animate alpha to app:targetAlpha="1" rotate x to app:targetRotateX="0"

Don't forget to add xmlns:app="http://schemas.android.com/apk/res-auto"

The output will be

2. view animation resource file

When you use animation, all of animate target option from xml will be ignored.

for example

<View

android:layout_width="100dp"

android:layout_height="100dp"

android:layout_gravity="center|top"

android:layout_marginTop="80dp"

android:elevation="10dp"

android:background="@android:color/holo_orange_dark"

app:layout_behavior="com.zoonref.SimpleViewBehavior"

app:dependsOn="@+id/app_bar"

app:dependType="y"

app:dependTargetY="-156dp"

app:animation="@anim/rotate"/> 
<set xmlns:android="http://schemas.android.com/apk/res/android">
  <scale

android:duration="100"

android:fromXScale="1"

android:fromYScale="1"

android:pivotX="50%"

android:pivotY="50%"

android:toXScale="40dp"

android:toYScale="40dp"/>
  <rotate

android:duration="100"

android:fromDegrees="0"

android:pivotX="50%"

android:pivotY="50%"

android:toDegrees="360"/>
  <alpha

android:duration="100"

android:toAlpha="0"/> </set> 

The output will be

Options

You can see all available option at attrs.xml

Author

Amornchai Kanokpullwad, @zoonref

License

simple-view-behavior is available under the MIT license. See the LICENSE file for more info.

Resources

A delightful progress animation that you'll fall in love with, very easily.

Play store downloads/updates app in sequence because of the performance issues but still there are the cases when you need to download/upload things in parallel like AppStore or WhatsApp.

Configurable custom crop widget for Android.

AndStatus is an Open Source low traffic social networking client with tree-like threaded conversations. It supports different Social networks, including GNU social (e.g. Quitter.se, LoadAverage, etc.), Twitter and Pump.io.

AndStatus can combine your feeds from all networks into one Timeline, and it allows you to read and post even when you are offline.

Simple Ringtone Picker dialog which allows you to pick different sounds from ringtone, alarm tone, notification tone and music from external storage.

Define the fonts of your Android project directly from the build.gradle.

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