SelectableRoundedImageView


Source link: https://github.com/pungrue26/SelectableRoundedImageView

SelectableRoundedImageView

Note that this project is no longer maintained.

Android ImageView that supports different radii on each corner. It also supports oval(and circle) shape and border. This would be especially useful for being used inside CardView which should be rounded only top left and top right corners(Don't forget to call setPreventCornerOverlap(false) on your cardview).

I referred to the RoundedImageView, developed by Vince, in developing this new one, and I really appreciate him. Also, I wrote a short article about how I made this library and my thoughts on CardView, check my blog post.

Get the sample app on Play Store.

Note: When using with Glide, be sure to add asBitmap() chain, like below.

Glide.with(context)
  .load(src)
  .asBitmap()
  .listener(l)
  .into(imageView) 

Note: When using with Android-Universal-Image-Loader, be sure to use SimpleBitmapDisplayer or FadeInBitmapDisplayer rather than RoundedBitmapDisplayer(or RoundedVignetteBitmapDisplayer) when building DisplayImageOptions. See below code.

options = new DisplayImageOptions.Builder()

  .showImageOnLoading(R.drawable.ic_stub)

  .showImageForEmptyUri(R.drawable.ic_empty)

  .showImageOnFail(R.drawable.ic_error)

  .cacheInMemory(true)

  .cacheOnDisk(true)

  .considerExifParams(true) //

  .displayer(new RoundedBitmapDisplayer(20)) //

  DO NOT USE RoundedBitmapDisplayer. Use SimpleBitmapDisplayer!

  .displayer(new SimpleBitmapDisplayer())

  .build();

Usage

Define in xml:

<com.joooonho.SelectableRoundedImageView

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

android:id="@+id/image"

android:src="@drawable/photo1"

android:scaleType="centerCrop"

app:sriv_left_top_corner_radius="16dip"

app:sriv_right_top_corner_radius="0dip"

app:sriv_left_bottom_corner_radius="48dip"

app:sriv_right_bottom_corner_radius="16dip"

app:sriv_border_width="2dip"

app:sriv_border_color="#008fea"

app:sriv_oval="true" />

Or in code:

SelectableRoundedImageView sriv = new SelectableRoundedImageView(context);
 sriv.setScaleType(ScaleType.CENTER_CROP);
 sriv.setCornerRadiiDP(4, 4, 0, 0);
 sriv.setBorderWidthDP(4);
 sriv.setBorderColor(Color.BLUE);
 sriv.setImageDrawable(drawable);
 sriv.setOval(true);

Including In Your Project

If you are using Android Studio, SelectableRoundedImageView is available through Gradle.

dependencies {

  compile 'com.joooonho:selectableroundedimageview:1.0.1' 
}
 

Also SelectableRoundedImageView is presented as a library project. You can include this project by referencing it as a library project in Eclipse or ant(A standalone JAR is not possible due to the custom attributes).

Developed By

License

Copyright 2014 Joonho Kim  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

ButtonMenu is an Android library created to build user interfaces based on buttons. This library has been implemented using Model View ViewModel pattern combined with an Android custom view that extends LinearLayout.

It works on Android 2.X or higher versions.

Effects for android notifications. It is based on Crouton.

custom-typeface is an Android library to apply custom typefaces directly from layouts, styles or themes.

EnhancedEditText allows you to simply add Iconify or text on each end of an EditText. It's awesome to get rid of TextView aligned with the component to say what's the purpose of the field, or to show value unit.

aSmack - build system for Smack on Android.

This repository contains a source fetching, patching and building script. As well as all the minor changes to make an Android version fly.

TextureVideoView is custom view based on android TextureView which gives you ability easily play and crop video. It's very similar to ImageView#setScaleType

Crop modes:

  • TOP
  • CENTER_CROP
  • BOTTOM

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