Awesome Image Effects in Android using Okulus - Droidcon 2014

14
okulus - Awesome Image Effects Vinay S Shenoy Android App Developer at flipkart.com [email protected] @vinaysshenoy http://github.com/vinaysshenoy

description

Use Okulus to make images in your app stand out

Transcript of Awesome Image Effects in Android using Okulus - Droidcon 2014

Page 1: Awesome Image Effects in Android using Okulus - Droidcon 2014

okulus - Awesome Image Effects

Vinay S Shenoy Android App Developer at flipkart.com [email protected] @vinaysshenoy http://github.com/vinaysshenoy

Page 2: Awesome Image Effects in Android using Okulus - Droidcon 2014

Upcoming trends

• Faster and cheaper internet => Richer content

• Images, Images, Images!

• Visual treatment for images can make your app stand out

Page 3: Awesome Image Effects in Android using Okulus - Droidcon 2014

Prettify images - Most common ways

• Circles & Rounded corner shapes

• Borders

• Shadows

Page 4: Awesome Image Effects in Android using Okulus - Droidcon 2014

Cropping

• Various techniques are available when you search

• But are they the best?

• CPU Usage, Memory usage, Overdraw problems arise

Page 5: Awesome Image Effects in Android using Okulus - Droidcon 2014

What is okulus?• Custom ImageView widget

• Comes with a bunch of great effects which can be used without any hassle

• ZERO Overdraw, NO excess CPU or Memory usage

• New effects and features will be added constantly

Page 6: Awesome Image Effects in Android using Okulus - Droidcon 2014
Page 7: Awesome Image Effects in Android using Okulus - Droidcon 2014

In your Layouts<com.vinaysshenoy.okulus.OkulusImageView

android:id="@+id/avatarImage"

app:okulus_borderColor=“@color/darkYellow"

app:okulus_borderWidth="1dp"

app:okulus_fullCircle="true" />

Page 8: Awesome Image Effects in Android using Okulus - Droidcon 2014

In your Code

OkulusImageView imageView = findViewById(R.id.avatarImage);

imageView.setImageBitmap(bitmap);

Page 9: Awesome Image Effects in Android using Okulus - Droidcon 2014

• All of these can be achieved by setting a few

attributes in your layout XMLs

• cornerRadius to set the strength of the

rounded corners

• borderWidth and borderColor to define

image borders

• fullCircle to force the image to be drawn

with a circular shape

• shadowColor, shadowWidth and

shadowRadius to configure shadows

• touchSelectorEnabled and

touchSelectorColor to draw selectors

when the View is touched

Page 10: Awesome Image Effects in Android using Okulus - Droidcon 2014

What does okulus support?

• Rounded rectangles

• Circles

• Customizable borders

• Shadows

• Custom touch selectors

Page 11: Awesome Image Effects in Android using Okulus - Droidcon 2014

Compatibility• How does it play with Image Loading libraries

• If your image loading library calls setImageBitmap() to actually set the image, you’re golden

• Tested with popular libraries - Picasso, Glide, Volley and UniversalImageLoader

• Integration examples are available in the sample application

Page 12: Awesome Image Effects in Android using Okulus - Droidcon 2014

Limitations

• Bitmap needs to resized to the view dimensions before getting set

• Center Crop, FitXY are fully supported, others are coming soon

• Limitations are temporary only!

Page 13: Awesome Image Effects in Android using Okulus - Droidcon 2014

Awesome! Where do I get it?

• Add compile ‘com.vinaysshenoy:okulus:0.9.1@aar’ to your gradle script

• Make a library project for Eclipse

• Apache License, Version 2.0

Page 14: Awesome Image Effects in Android using Okulus - Droidcon 2014

http://okulus.vinaysshenoy.com