Date post: | 26-Jun-2015 |
Category: |
Engineering |
Upload: | vinay-shenoy |
View: | 620 times |
Download: | 4 times |
okulus - Awesome Image Effects
Vinay S Shenoy Android App Developer at flipkart.com [email protected] @vinaysshenoy http://github.com/vinaysshenoy
Upcoming trends
• Faster and cheaper internet => Richer content
• Images, Images, Images!
• Visual treatment for images can make your app stand out
Prettify images - Most common ways
• Circles & Rounded corner shapes
• Borders
• Shadows
Cropping
• Various techniques are available when you search
• But are they the best?
• CPU Usage, Memory usage, Overdraw problems arise
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
In your Layouts<com.vinaysshenoy.okulus.OkulusImageView
android:id="@+id/avatarImage"
app:okulus_borderColor=“@color/darkYellow"
app:okulus_borderWidth="1dp"
app:okulus_fullCircle="true" />
In your Code
OkulusImageView imageView = findViewById(R.id.avatarImage);
imageView.setImageBitmap(bitmap);
• 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
What does okulus support?
• Rounded rectangles
• Circles
• Customizable borders
• Shadows
• Custom touch selectors
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
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!
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