ProgressProfileView


Source link: https://github.com/kuassivi/ProgressProfileView

ProgressProfileView

Android custom view to load an avatar or profile image with a progress indicator.

                 

Preview also on Android Studio!

Background

ProgressProfileView inherits from ImageView, so you can set any xml attributes as usual.

Measured both on landscape and portrait.

No need to crop to rounded images!

ProgressProfileView will clip proportionally all images loaded.

Remember to set android:scaleType="centerCrop" and android:adjustViewBounds="true"

Dependency

Latest stable version:

If you are working with gradle, add the dependency to your build.gradle file:

dependencies{

  compile 'com.kuassivi.view:progressprofile:?.?.?' 
}

If you are working with maven, do it into your pom.xml

<dependency>
  <groupId>com.kuassivi.view</groupId>
  <artifactId>progressprofile</artifactId>
  <version>?.?.?</version>
  <type>aar</type> </dependency>

How to:

Add the ProgressProfileView component in the layout.
Set your preferred ImageView attributes on it.

<com.kuassivi.view.ProgressProfileView

android:id="@+id/profile"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:scaleType="centerCrop"

android:adjustViewBounds="true"

android:src="@drawable/my_avatar"

app:progress="42"

app:progressRingSize="10dp"

app:progressRingCorner="ROUND"

app:progressRingOutline="true"/>

Get the object on your activity or fragment.

ProgressProfileView profile = (ProgressProfileView) findViewById(R.id.profile);

Set your desired progress.

profile.setProgress(59.5f);

To animate the ring, call #startAnimation()

profile.startAnimation();

If you need to handle the progress animation update or listen to the end of the animation, just get the ObjectAnimator calling the getAnimator() method from your ProgressProfileView object.

profile.getAnimator().addListener(new AnimatorListener());
profile.getAnimator().addUpdateListener(new AnimatorUpdateListener());
profile.getAnimator().setInterpolator(new AccelerateDecelerateInterpolator());

If you are loading images with Glide or Picasso, do it as usual

// Using Glide as usual Glide.with(this)
  .load("http://your/server/path")
  .placeholder(R.drawable.ic_icon_user_default)
  .into(profile);

Be careful when using fitCenter() method of Glide, Picasso, or any other similar kind of method, because it will re-scale the bitmap, and the Progress Profile component will loose its original bounds!

Features:

  • `app:max="100"` - Max value for progress indicator 
  • `app:progress="50"` - Current progress value 
  • `app:backgroundRingSize="20dp"` - The size of the background ring (not set, means use the same as the <i>progressRingSize</i>) 
  • `app:progressRingSize="20dp"` - The size of the progress ring 
  • `app:backgroundRingColor="@color/my_color"` - The color of the background ring (it can be an hex color as well) 
  • `app:progressRingColor="@color/my_color"` - The color of the progress ring (it can be an hex color as well) 
  • `app:progressGradient="@array/colors"` - An array of colors for a gradient ring (you must provide an array resource reference) [#23](https://github.com/kuassivi/ProgressProfileView/issues/23) 
  • `app:joinGradient="true"` - Enabling this you get a gradient smooth on the ring corners 
  • `app:gradientFactor="1.0"` - Adjust the gradient factor of the ring 
  • `app:progressRingOutline="true"` - Sets the ring as an Outline based on the padding of the ImageView, by default is `false`. 
  • `app:progressRingCorner="ROUND"` - Sets the corner style of the progress ring (by default is RECT) 

License

Copyright 2015 Francisco Gonzalez-Armijo Riádigos

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

� A polished and flexible ProgressView, fully customizable with animations.
A ContactPicker library for Android, written in pure Kotlin.
Small Android library to show PDF files
A library to dynamically format your EditTexts to take currency inputs
Lightweight Android library for a new way to create toasts in Android, similar to Bootstrap alerts.
for check required text in EditText

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