ElasticViews


Source link: https://github.com/skydoves/ElasticViews

ElasticViews

Android views with touch Animation.

Including in your project

build.gradle

repositories {

mavenCentral() // or jcenter() works as well 
}
  dependencies {

compile 'com.github.skydoves:elasticviews:1.1.1' 
}

or Maven

<dependency>
<groupId>com.github.skydoves</groupId>
<artifactId>elasticviews</artifactId>
<version>1.1.1</version> </dependency>

Usage

You can use like using normal views and you can give all of Views or GroupViews touch effect very simply.

Add XML Namespace

First add below XML Namespace inside your XML layout file.

xmlns:app="http://schemas.android.com/apk/res-auto"

OnClick Method

All of ElasticViews need setOnClickListener - OnClick Method. If not, no Animation.

ElasticButton elasticButton = (ElasticButton)findViewById(R.id.elasticbutton);

elasticButton.setOnClickListener(new View.OnClickListener() {

 @Override

 public void onClick(View v) {

  // do something

 
}

}
);

or use butterknife

@OnClick(R.id.elasticbutton)
  public void onClick(View v){

// do something
  
}

ElasticButton

<com.skydoves.elasticviews.ElasticButton

android:id="@+id/elasticbutton"

android:layout_width="match_parent"

android:layout_height="50dp"

app:button_backgroundColor="#30354b"

app:button_round="20"

app:button_scale="0.7"

app:button_duration="400"

app:button_labelText="Elastic Button"

app:button_labelColor="#ffffff"

app:button_labelSize="16"

app:button_labelStyle="bold"/>

ElasticButton use like TextView

If button_backgroundColor attribute set as @android:color/transparent
you can use ElasticButton looks like TextView.

app:button_backgroundColor="@android:color/transparent"

ElasticCheckButton

<com.skydoves.elasticviews.ElasticCheckButton

android:id="@+id/elasticcheckbutton"

android:layout_width="match_parent"

android:layout_height="50dp"

app:checkbutton_backgroundColor="#30354b"

app:checkbutton_round="30"

app:checkbutton_scale="0.9"

app:checkbutton_duration="400"

app:checkbutton_labelText="Elastic CheckButton"

app:checkbutton_labelColor="#ffffff"

app:checkbutton_labelSize="16"

app:checkbutton_labelStyle="bold"

app:checkbutton_alpha="0.5"

app:checkbutton_ischecked="false"/>

ElasticImageView

<com.skydoves.elasticviews.ElasticImageView

 android:id="@+id/elasticimageview"

 android:layout_width="64dp"

 android:layout_height="64dp"

 android:scaleType="fitXY"

 android:src="@drawable/ic_question"

 app:imageview_duration="500"

 app:imageview_scale="0.7"/>

ElasticFloatingButton

<com.skydoves.elasticviews.ElasticFloatingActionButton

 android:id="@+id/elasticfab"

 android:layout_width="64dp"

 android:layout_height="64dp"

 android:src="@drawable/ic_add"

 app:fabSize="normal"

 app:fabutton_duration="400"

 app:fabutton_scale="0.85"/>

ElasticLayout

ElasticLayout don't animation for child views.
If you want give ViewGroup animation, then use ElasticAction.

<com.skydoves.elasticviews.ElasticLayout

android:id="@+id/elasticlayout"

android:layout_width="match_parent"

android:layout_height="80dp"

app:layout_backgroundColor="#30354b"

app:layout_duration="500"

app:layout_scale="0.85">

 <TextView

 android:id="@+id/textView0"

 android:layout_width="match_parent"

 android:layout_height="wrap_content"

 android:text="This is"

 android:textColor="#ffffff"

 android:textSize="18sp" />

 <TextView

 android:layout_below="@+id/textView1"

 android:layout_width="match_parent"

 android:layout_height="wrap_content"

 android:layout_alignParentBottom="true"

 android:text="ElasticLayout"

 android:textColor="#ffffff"

 android:textSize="18sp"

 android:gravity="end" />

</com.skydoves.elasticviews.ElasticLayout>

ElasticAction

you can give all of Views or GroupViews touch effect very simply.

// argument : View or ViewGroup, Animation duration, scaleX, scaleY ElasticAction.doAction(anyViews, duration, 0.9f, 0.9f);

Example : Normal Button

you can give all of Views touch effect.

@OnClick(R.id.button)
  public void addNewAlarm(View v){

// ElasticAction : doAction

ElasticAction.doAction(v, 400, 0.85f, 0.85f);
 // argument : View or ViewGroup, duration, scaleX, scaleY

 // PostDelayed : delay duration time

new Handler().postDelayed(new Runnable() {

 @Override

 public void run() {

  //Do something after duration time

 
}

}
, 400);

  
}

Example : ListView Item

you can give all of ViewGroups touch effect.

private class ListViewItemClickListener implements AdapterView.OnItemClickListener{

@Override

public void onItemClick(AdapterView<?> adapterView, View clickedView, final int pos, long id)

{

 // set your duration time

 int duration = 400;

  // ElasticAction : doAction

 ElasticAction.doAction(clickedView, duration, 0.9f, 0.9f);
 // argument : View or ViewGroup, duration, scaleX, scaleY

  // PostDelayed : delay duration time

 new Handler().postDelayed(new Runnable() {

  @Override

  public void run() {

//Do something after duration time

Toast.makeText(getBaseContext(), "ListViewItem" + pos, Toast.LENGTH_SHORT).show();

  
}

 
}
, duration);

}

  
}
;

ElasticAction Preview

License

The MIT License (MIT)  Copyright (c) 2017 skydoves  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Resources

RecyclerView-FlexibleDivider - Android library providing simple way to control divider items of RecyclerView.

JDeferred is a Java Deferred/Promise library similar to JQuery's Deferred Object.

android-deferred-object is a chainable utility object that can register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.

Android view with both path from constructed path or from SVG.

Selendroid is a test automation framework which drives of the UI of Android native and hybrid applications (apps) and the mobile web with Selendroid. Tests are written using the Selenium 2 client API and for testing the application under test must not be modified.

Selendroid can be used on emulators and real devices and can be integrated as a node into the Selenium Grid for scaling and parallel testing.

SwipyRefreshLayout is a SwipeRefreshLayout extension that allows to swipe in both directions.

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