SlideShare a Scribd company logo
1 of 47
Simple XML Animation
●

●

Create an xml file which defines type of
animation to perform
This file should be located under anim folder
under res directory
Please make one
if there is no
anim folder
Important XML animation attributes
●

android:duration
Duration of the animation
android:startOffset
–

●

Waiting time before the animation starts
android:interpolator
–

●

–

The rate of change in animation
●

android:fillAfter
–

Do we apply the animation transformation after the
animation?

If set false, the previous state of the element is restored
after the animation
android:repeatMode
–

●

Do we need to repeat the animation?
android:repeatCount
–

●

–

How many times do we want to repeat the animation?
Simple fade out effect
fade_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true" >

<alpha
android:duration="1000"

Because we are
dealing with
fade transitions
alpha is used

android:fromAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:toAlpha="0.0" />

</set>

To create a fade in effect
we just switch the
from alpha and to alpha values
●

android:fromAlpha
Float. Starting opacity offset, where 0.0 is
transparent and 1.0 is opaque.
android:toAlpha
–

●

–

Float. Ending opacity offset, where 0.0 is
transparent and 1.0 is opaque.
Load the animation
// load the animation
animFadeout =
AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.fade_out);
btn.setOnClickListener(new …
...
{
textView.startAnimation(animFadeout);
}
Adding animation listeners(optional)
●

If you want to listen to animation events like
start, end or repeat implement the
AnimationListener

●

●

●

onAnimationStart – This will be triggered once the
animation started
onAnimationEnd – This will be triggered once the
animation is over
onAnimationRepeat – This will be triggered if the
animation repeats
public class MainActivity extends Activity implements
AnimationListener{
@Override
public void onAnimationEnd(Animation animation) {
// Take any action after completing the animation
// check for fade in animation
if (animation == animFadein) {
Stopped",

Toast.makeText(getApplicationContext(), "Animation
Toast.LENGTH_SHORT).show();

}

}

For implementation:
animFadeout.setAnimationListenter(this)
●

For more cool animations, refer to:
http://bit.ly/13g76Fu

●

For the original documentation:
http://bit.ly/96ZVW0
Animation
●

Using the ViewPropertyAnimator
–

This class enables automatic and optimized
animation of select properties on View objects

–

Introduced in Android 3.1 (API 12)
●

–
●

Please use API 12 to use this project

Formerly we would use the ObjectAnimator

Easy use and implementation
ViewPropertyAnimator
●

animate()
–

●

Auto-start
–

●

The magic of the system begins with a call to the
new method animate() on the View object.
We do not actually have to start() the animation

Fluent
–

Smooth when dealing with multiple animations
●

Fade
myView.animate().alpha(1); //fade in
myView.animate().alpha(0); //fade out

●

Move
myView.animate().x(0).y(0);

●

Rotate
myView.animate().rotationYBy(720);

Full code: http://bit.ly/HU5wzC
Styles and Themes
●

●

A style is a collection of properties that specify
the look and format for a View.
A style can specify properties such as height,
padding, font color, font size, background
color, and much more.
Styling
●

The CSS to your application

●

Defined in XML with the <style> tag

Located under your values.
Creating and referencing to a single
styles.xml is enough but if required
can be further declared.
<style name= “...” parent= “...”>
…
</style>

The parent attribute is
similar to extends in Java

<item> tag is used here
Styling example
<style name="textSmall" >
<item name = "android:textSize">@dimen/small</item>
<item name =
"android:layout_marginTop">@dimen/gap</item>
</style>
<style name="textLarge" parent="@style/textSmall">
<item name = "android:textSize">@dimen/large</item>
</style>
Referencing the style
●

Referenced through the layout file
<TextView
style= “@style/textSmall”
android:layout_width= “fill_parent”
android:layout_height= “wrap_content” />
Referencing the style
●

Referenced in the manifest

●

<activity>

or <application> through the android:theme

attribute.
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
OR
<activity
android:name=".MainActivity"
android:theme="@style/Apptheme"/ >
Some useful styling
●

Giving your background gradients
<shape
xmlns:android="http://schemas.android.com/apk/res/andro
id" >
<gradient android:startColor="#FF0000"
android:endColor="#8C0000"
android:angle="270"/>
</shape>
●

Buttons with curvy edges
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:padding="10dp">
<solid android:color="@color/homePageButton"/>
<corners android:bottomRightRadius="10dp"
android:bottomLeftRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp"/>
</shape>
●

Backgrounds with patterns
<bitmap xmlns:android =
"http://schemas.android.com/apk/res/android"
android:tileMode="repeat"
android:src="@drawable/your_pattern" >
</bitmap>
Adding touch feedback
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
<item android:drawable="@drawable/button"
android:state_focused="false"
android:state_pressed="false"
android:state_selected="false"/>
<!-- Pressed -->
<item android:drawable="@drawable/button_pressed"
android:state_focused="false"
android:state_pressed="true"
android:state_selected="false"/>
</selector>
Styling the Action Bar

Some default themes
If we want to create a custom theme
we need to override the following attributes
Custom ActionBar themes:
Background
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="@style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="@style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background"> @color/background </item>
</style>

Where we actually set the background color
Custom ActionBar themes:
Background
●

Same thing programatically:
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new
ColorDrawable(Color.parseColor("#FFF")));
Custom ActionBar themes:
Text Color
<style name="CustomTheme" parent="@style/Theme.Holo">
<item name="android:actionBarStyle">
@style/MyActionBar </item>
<item name="android:actionBarTabTextStyle">
@style/MyActionBarTabText </item>
<item name="android:actionMenuTextColor">
@color/actionbar_text </item>
</style>
TabTextColor
<style name="MyActionBarTabText"
parent=
"@style/Widget.Holo.ActionBar.TabText">
<item name= "android:textColor">
@color/actionbar_text </item>
</style>
MyActionBar
<style name="MyActionBar"
parent="@style/Widget.Holo.ActionBar">
<item name="android:titleTextStyle">
@style/MyActionBarTitleText</item>
</style>
Defined right before
MenuTextColor
<style name="MyActionBarTitleText"
parent=
"@style/TextAppearance.Holo.Widget.Acti
onBar.Title">
<item name= "android:textColor">
@color/actionbar_text</item>
</style>

For more on theming: http://bit.ly/PkUz8k
ActionBar Text Color
●
●

Simple hack:
getActionBar().setTitle(Html.fromHtml("<font
color="red">" + Title + "</font>"));
Super custom action bar ?
●

Define a custom layout for the action bar.
getActionBar.setDisplayShowCustomEnabled(true);
getActionBar.setDisplayShowTitleEnabled(false);
LayoutInflater inflater =(LayoutInflater)
this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.custom, null);
getActionBar.setCustomView(view);
Android Facts
●

●

1st commercially available Android phone:
HTC Dream – 2008 – Android 1.0
Naming Conventions
–

●

Cupcake, Donut, Eclair, Froyo, Gingerbread, …
noticed something ???

Android not only for phones and tablets.
Version Features
●

Version 1.0 : Android Market

●

Version 1.5: Support for widgets

●

Version 1.6: Quick Search Box
...

●

Version 3.0: New virtual & “holographic UI”

●

Version 4.0: Recent apps multitasking

●

Version 4.1: Google Now search app

●

Version 4.2: LockScreen widgets & Multiple Users

●

Version 4.3: Restricted Profiles & Wireless + Bluetooth Optimization

●

Version 4.4: Android for all – Streamlined Android & Google Now
Extracting the .apk file
●

Right click on project
→ Select Android tools
→ Export Signed Application Package
●
●
●
●

Project Checks
Keystore selection*
Key Creation*
Destination and key/certificate checks
Project Checks

Name of the project
that is to be
converted
Keystore Selection
Key Creation
Android system
requires that
all installed
applications be
digitally signed
with a certificate
whose private key
is held by
the application's
developer
Destination and key/certificate
checks

After setting the
destination file for the
APK file, YOU
NOW HAVE
YOUR FIRST APK
External Libraries and Tools
●

●

A library is a collection of implementations of
behavior that has a well-defined interface by
which the behavior can be invoked.
In short, libraries are really helpful tools !
Popular Android Libraries
●

ActionBarSherlock : Support ActionBars on
lower Android versions
●

Android-PullToRefresh : Re-load, refresh
content while the user drags your content
●

Sherlock Navigation Drawer : Supports
Navigation Drawer functionality on lower
Android versions
●

Satellite Menu : A variation on the traditional
menu display. Cool animations and transitions
Libraries for developers

More Related Content

What's hot

Styling recipes for Angular components
Styling recipes for Angular componentsStyling recipes for Angular components
Styling recipes for Angular componentsNir Kaufman
 
Android training day 3
Android training day 3Android training day 3
Android training day 3Vivek Bhusal
 
Filters in AngularJS
Filters in AngularJSFilters in AngularJS
Filters in AngularJSBrajesh Yadav
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On RailsWen-Tien Chang
 
Learning Appcelerator® Alloy™
Learning Appcelerator® Alloy™Learning Appcelerator® Alloy™
Learning Appcelerator® Alloy™Ricardo Alcocer
 
React native introduction
React native introductionReact native introduction
React native introductionInnerFood
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseEPAM Systems
 
Design for succcess with react and storybook.js
Design for succcess with react and storybook.jsDesign for succcess with react and storybook.js
Design for succcess with react and storybook.jsChris Saylor
 
Violet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole TeamViolet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole TeamAnton Caceres
 
Workshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideWorkshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideVisual Engineering
 
Academy PRO: React native - navigation
Academy PRO: React native - navigationAcademy PRO: React native - navigation
Academy PRO: React native - navigationBinary Studio
 
Sencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptSencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptRohan Chandane
 

What's hot (20)

Extend sdk
Extend sdkExtend sdk
Extend sdk
 
Angular Js Basics
Angular Js BasicsAngular Js Basics
Angular Js Basics
 
Styling recipes for Angular components
Styling recipes for Angular componentsStyling recipes for Angular components
Styling recipes for Angular components
 
Android training day 3
Android training day 3Android training day 3
Android training day 3
 
Ui 5
Ui   5Ui   5
Ui 5
 
Filters in AngularJS
Filters in AngularJSFilters in AngularJS
Filters in AngularJS
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
 
Learning Appcelerator® Alloy™
Learning Appcelerator® Alloy™Learning Appcelerator® Alloy™
Learning Appcelerator® Alloy™
 
React native introduction
React native introductionReact native introduction
React native introduction
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University - Exploring Angular 2
Commit University - Exploring Angular 2
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
 
Design for succcess with react and storybook.js
Design for succcess with react and storybook.jsDesign for succcess with react and storybook.js
Design for succcess with react and storybook.js
 
Angular2 + rxjs
Angular2 + rxjsAngular2 + rxjs
Angular2 + rxjs
 
Violet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole TeamViolet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole Team
 
Angular JS
Angular JSAngular JS
Angular JS
 
Workshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideWorkshop 26: React Native - The Native Side
Workshop 26: React Native - The Native Side
 
Academy PRO: React native - navigation
Academy PRO: React native - navigationAcademy PRO: React native - navigation
Academy PRO: React native - navigation
 
Android L01 - Warm Up
Android L01 - Warm UpAndroid L01 - Warm Up
Android L01 - Warm Up
 
Workshop 17: EmberJS parte II
Workshop 17: EmberJS parte IIWorkshop 17: EmberJS parte II
Workshop 17: EmberJS parte II
 
Sencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptSencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScript
 

Viewers also liked

Android android layouts
Android android layoutsAndroid android layouts
Android android layoutsperpetrotech
 
Detroit Lions Digital Strategy- NMDL
Detroit Lions Digital Strategy- NMDLDetroit Lions Digital Strategy- NMDL
Detroit Lions Digital Strategy- NMDLSammy Bowers
 
Android training day 1
Android training day 1Android training day 1
Android training day 1Vivek Bhusal
 
Android Layout
Android LayoutAndroid Layout
Android Layoutmcanotes
 
Android Training (Android UI)
Android Training (Android UI)Android Training (Android UI)
Android Training (Android UI)Khaled Anaqwa
 

Viewers also liked (6)

Android android layouts
Android android layoutsAndroid android layouts
Android android layouts
 
Detroit Lions Digital Strategy- NMDL
Detroit Lions Digital Strategy- NMDLDetroit Lions Digital Strategy- NMDL
Detroit Lions Digital Strategy- NMDL
 
Android training day 1
Android training day 1Android training day 1
Android training day 1
 
Android Layout
Android LayoutAndroid Layout
Android Layout
 
Android Training (Android UI)
Android Training (Android UI)Android Training (Android UI)
Android Training (Android UI)
 
Basic Android Layout
Basic Android LayoutBasic Android Layout
Basic Android Layout
 

Similar to XML Animation Basics

Android animation
Android animationAndroid animation
Android animationKrazy Koder
 
Chapter 2 lesson-2 styling the action bar
Chapter 2 lesson-2 styling the action barChapter 2 lesson-2 styling the action bar
Chapter 2 lesson-2 styling the action barKalluri Vinay Reddy
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgetsSiva Kumar reddy Vasipally
 
Top Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on TabletsTop Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on TabletsMotorola Mobility - MOTODEV
 
Android 2D Drawing and Animation Framework
Android 2D Drawing and Animation FrameworkAndroid 2D Drawing and Animation Framework
Android 2D Drawing and Animation FrameworkJussi Pohjolainen
 
Android Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatAndroid Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatcbeyls
 
Android Development with Flash Builder Burrito
Android Development with Flash Builder BurritoAndroid Development with Flash Builder Burrito
Android Development with Flash Builder BurritoJeff Bollinger
 
Android App Development - 12 animations
Android App Development - 12 animationsAndroid App Development - 12 animations
Android App Development - 12 animationsDiego Grancini
 
Getting Started With Material Design
Getting Started With Material DesignGetting Started With Material Design
Getting Started With Material DesignYasin Yildirim
 
Getting Started with jQuery
Getting Started with jQueryGetting Started with jQuery
Getting Started with jQueryLaila Buncab
 
Basic Android Animation
Basic Android Animation Basic Android Animation
Basic Android Animation Shilu Shrestha
 
Android ui tips & tricks
Android ui tips & tricksAndroid ui tips & tricks
Android ui tips & tricksShem Magnezi
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsRomain Guy
 
Demystifying Angular Animations
Demystifying Angular AnimationsDemystifying Angular Animations
Demystifying Angular AnimationsGil Fink
 

Similar to XML Animation Basics (20)

Supercharge your ui
Supercharge your uiSupercharge your ui
Supercharge your ui
 
Material Design Android
Material Design AndroidMaterial Design Android
Material Design Android
 
Android view animation in android-chapter18
Android view animation in android-chapter18Android view animation in android-chapter18
Android view animation in android-chapter18
 
Android animation
Android animationAndroid animation
Android animation
 
Chapter 2 lesson-2 styling the action bar
Chapter 2 lesson-2 styling the action barChapter 2 lesson-2 styling the action bar
Chapter 2 lesson-2 styling the action bar
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgets
 
Top Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on TabletsTop Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on Tablets
 
Angular animate
Angular animateAngular animate
Angular animate
 
Android 2D Drawing and Animation Framework
Android 2D Drawing and Animation FrameworkAndroid 2D Drawing and Animation Framework
Android 2D Drawing and Animation Framework
 
Android Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatAndroid Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompat
 
Android Development with Flash Builder Burrito
Android Development with Flash Builder BurritoAndroid Development with Flash Builder Burrito
Android Development with Flash Builder Burrito
 
Android App Development - 12 animations
Android App Development - 12 animationsAndroid App Development - 12 animations
Android App Development - 12 animations
 
Getting Started With Material Design
Getting Started With Material DesignGetting Started With Material Design
Getting Started With Material Design
 
Getting Started with jQuery
Getting Started with jQueryGetting Started with jQuery
Getting Started with jQuery
 
Basic Android Animation
Basic Android Animation Basic Android Animation
Basic Android Animation
 
Android ui tips & tricks
Android ui tips & tricksAndroid ui tips & tricks
Android ui tips & tricks
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb Highlights
 
Demystifying Angular Animations
Demystifying Angular AnimationsDemystifying Angular Animations
Demystifying Angular Animations
 
Revolver
RevolverRevolver
Revolver
 
html5_css3
html5_css3html5_css3
html5_css3
 

More from Vivek Bhusal

Training Session 2
Training Session 2 Training Session 2
Training Session 2 Vivek Bhusal
 
Stores munk presentation_aug10 (1)
Stores munk presentation_aug10 (1)Stores munk presentation_aug10 (1)
Stores munk presentation_aug10 (1)Vivek Bhusal
 
Wisevote - opendataweek @
Wisevote - opendataweek @Wisevote - opendataweek @
Wisevote - opendataweek @Vivek Bhusal
 
Android training at GDG kathmandu Startup weekend bootcamp
Android training at GDG kathmandu Startup weekend bootcampAndroid training at GDG kathmandu Startup weekend bootcamp
Android training at GDG kathmandu Startup weekend bootcampVivek Bhusal
 

More from Vivek Bhusal (6)

Training Session 2
Training Session 2 Training Session 2
Training Session 2
 
Stores munk presentation_aug10 (1)
Stores munk presentation_aug10 (1)Stores munk presentation_aug10 (1)
Stores munk presentation_aug10 (1)
 
Mybudget
MybudgetMybudget
Mybudget
 
Wisevote - opendataweek @
Wisevote - opendataweek @Wisevote - opendataweek @
Wisevote - opendataweek @
 
Android training at GDG kathmandu Startup weekend bootcamp
Android training at GDG kathmandu Startup weekend bootcampAndroid training at GDG kathmandu Startup weekend bootcamp
Android training at GDG kathmandu Startup weekend bootcamp
 
My medical info
My medical infoMy medical info
My medical info
 

Recently uploaded

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Recently uploaded (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

XML Animation Basics

  • 1. Simple XML Animation ● ● Create an xml file which defines type of animation to perform This file should be located under anim folder under res directory
  • 2. Please make one if there is no anim folder
  • 3. Important XML animation attributes ● android:duration Duration of the animation android:startOffset – ● Waiting time before the animation starts android:interpolator – ● – The rate of change in animation
  • 4. ● android:fillAfter – Do we apply the animation transformation after the animation? If set false, the previous state of the element is restored after the animation android:repeatMode – ● Do we need to repeat the animation? android:repeatCount – ● – How many times do we want to repeat the animation?
  • 5. Simple fade out effect fade_out.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true" > <alpha android:duration="1000" Because we are dealing with fade transitions alpha is used android:fromAlpha="1.0" android:interpolator="@android:anim/accelerate_interpolator" android:toAlpha="0.0" /> </set> To create a fade in effect we just switch the from alpha and to alpha values
  • 6. ● android:fromAlpha Float. Starting opacity offset, where 0.0 is transparent and 1.0 is opaque. android:toAlpha – ● – Float. Ending opacity offset, where 0.0 is transparent and 1.0 is opaque.
  • 7. Load the animation // load the animation animFadeout = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_out); btn.setOnClickListener(new … ... { textView.startAnimation(animFadeout); }
  • 8. Adding animation listeners(optional) ● If you want to listen to animation events like start, end or repeat implement the AnimationListener ● ● ● onAnimationStart – This will be triggered once the animation started onAnimationEnd – This will be triggered once the animation is over onAnimationRepeat – This will be triggered if the animation repeats
  • 9. public class MainActivity extends Activity implements AnimationListener{ @Override public void onAnimationEnd(Animation animation) { // Take any action after completing the animation // check for fade in animation if (animation == animFadein) { Stopped", Toast.makeText(getApplicationContext(), "Animation Toast.LENGTH_SHORT).show(); } } For implementation: animFadeout.setAnimationListenter(this)
  • 10. ● For more cool animations, refer to: http://bit.ly/13g76Fu ● For the original documentation: http://bit.ly/96ZVW0
  • 11. Animation ● Using the ViewPropertyAnimator – This class enables automatic and optimized animation of select properties on View objects – Introduced in Android 3.1 (API 12) ● – ● Please use API 12 to use this project Formerly we would use the ObjectAnimator Easy use and implementation
  • 12. ViewPropertyAnimator ● animate() – ● Auto-start – ● The magic of the system begins with a call to the new method animate() on the View object. We do not actually have to start() the animation Fluent – Smooth when dealing with multiple animations
  • 13. ● Fade myView.animate().alpha(1); //fade in myView.animate().alpha(0); //fade out ● Move myView.animate().x(0).y(0); ● Rotate myView.animate().rotationYBy(720); Full code: http://bit.ly/HU5wzC
  • 14. Styles and Themes ● ● A style is a collection of properties that specify the look and format for a View. A style can specify properties such as height, padding, font color, font size, background color, and much more.
  • 15. Styling ● The CSS to your application ● Defined in XML with the <style> tag Located under your values. Creating and referencing to a single styles.xml is enough but if required can be further declared.
  • 16. <style name= “...” parent= “...”> … </style> The parent attribute is similar to extends in Java <item> tag is used here
  • 17. Styling example <style name="textSmall" > <item name = "android:textSize">@dimen/small</item> <item name = "android:layout_marginTop">@dimen/gap</item> </style> <style name="textLarge" parent="@style/textSmall"> <item name = "android:textSize">@dimen/large</item> </style>
  • 18. Referencing the style ● Referenced through the layout file <TextView style= “@style/textSmall” android:layout_width= “fill_parent” android:layout_height= “wrap_content” />
  • 19. Referencing the style ● Referenced in the manifest ● <activity> or <application> through the android:theme attribute. <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > OR <activity android:name=".MainActivity" android:theme="@style/Apptheme"/ >
  • 20. Some useful styling ● Giving your background gradients <shape xmlns:android="http://schemas.android.com/apk/res/andro id" > <gradient android:startColor="#FF0000" android:endColor="#8C0000" android:angle="270"/> </shape>
  • 21. ● Buttons with curvy edges <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid android:color="@color/homePageButton"/> <corners android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp" android:topLeftRadius="10dp" android:topRightRadius="10dp"/> </shape>
  • 22. ● Backgrounds with patterns <bitmap xmlns:android = "http://schemas.android.com/apk/res/android" android:tileMode="repeat" android:src="@drawable/your_pattern" > </bitmap>
  • 23. Adding touch feedback <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Non focused states --> <item android:drawable="@drawable/button" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/> <!-- Pressed --> <item android:drawable="@drawable/button_pressed" android:state_focused="false" android:state_pressed="true" android:state_selected="false"/> </selector>
  • 24. Styling the Action Bar Some default themes
  • 25. If we want to create a custom theme we need to override the following attributes
  • 26. Custom ActionBar themes: Background <!-- the theme applied to the application or activity --> <style name="CustomActionBarTheme" parent="@style/Theme.Holo.Light.DarkActionBar"> <item name="android:actionBarStyle">@style/MyActionBar</item> </style> <!-- ActionBar styles --> <style name="MyActionBar" parent="@style/Widget.Holo.Light.ActionBar.Solid.Inverse"> <item name="android:background"> @color/background </item> </style> Where we actually set the background color
  • 27. Custom ActionBar themes: Background ● Same thing programatically: ActionBar bar = getActionBar(); bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#FFF")));
  • 28. Custom ActionBar themes: Text Color <style name="CustomTheme" parent="@style/Theme.Holo"> <item name="android:actionBarStyle"> @style/MyActionBar </item> <item name="android:actionBarTabTextStyle"> @style/MyActionBarTabText </item> <item name="android:actionMenuTextColor"> @color/actionbar_text </item> </style>
  • 31. MenuTextColor <style name="MyActionBarTitleText" parent= "@style/TextAppearance.Holo.Widget.Acti onBar.Title"> <item name= "android:textColor"> @color/actionbar_text</item> </style> For more on theming: http://bit.ly/PkUz8k
  • 32. ActionBar Text Color ● ● Simple hack: getActionBar().setTitle(Html.fromHtml("<font color="red">" + Title + "</font>"));
  • 33. Super custom action bar ? ● Define a custom layout for the action bar. getActionBar.setDisplayShowCustomEnabled(true); getActionBar.setDisplayShowTitleEnabled(false); LayoutInflater inflater =(LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.custom, null); getActionBar.setCustomView(view);
  • 34. Android Facts ● ● 1st commercially available Android phone: HTC Dream – 2008 – Android 1.0 Naming Conventions – ● Cupcake, Donut, Eclair, Froyo, Gingerbread, … noticed something ??? Android not only for phones and tablets.
  • 35. Version Features ● Version 1.0 : Android Market ● Version 1.5: Support for widgets ● Version 1.6: Quick Search Box ... ● Version 3.0: New virtual & “holographic UI” ● Version 4.0: Recent apps multitasking ● Version 4.1: Google Now search app ● Version 4.2: LockScreen widgets & Multiple Users ● Version 4.3: Restricted Profiles & Wireless + Bluetooth Optimization ● Version 4.4: Android for all – Streamlined Android & Google Now
  • 36.
  • 37. Extracting the .apk file ● Right click on project → Select Android tools → Export Signed Application Package ● ● ● ● Project Checks Keystore selection* Key Creation* Destination and key/certificate checks
  • 38. Project Checks Name of the project that is to be converted
  • 40. Key Creation Android system requires that all installed applications be digitally signed with a certificate whose private key is held by the application's developer
  • 41. Destination and key/certificate checks After setting the destination file for the APK file, YOU NOW HAVE YOUR FIRST APK
  • 42. External Libraries and Tools ● ● A library is a collection of implementations of behavior that has a well-defined interface by which the behavior can be invoked. In short, libraries are really helpful tools !
  • 43. Popular Android Libraries ● ActionBarSherlock : Support ActionBars on lower Android versions
  • 44. ● Android-PullToRefresh : Re-load, refresh content while the user drags your content
  • 45. ● Sherlock Navigation Drawer : Supports Navigation Drawer functionality on lower Android versions
  • 46. ● Satellite Menu : A variation on the traditional menu display. Cool animations and transitions