plain-pie


Source link: https://github.com/zurche/plain-pie

plain-pie

Add to your project build.gradle

allprojects {
  repositories {

...
maven {
 url "https://jitpack.io" 
}
  
}
 
}

Add to your app module build.gradle

dependencies {

compile 'com.github.zurche:plain-pie:v0.2.2' 
}

Add the widget to your layout

<az.plainpie.PieView
  android:id="@+id/pieView"
  android:layout_width="200dp"
  android:layout_height="200dp"
  plainpie:inner_pie_padding="30"
  plainpie:percentage="75"
  plainpie:percentage_size="70"
  plainpie:inner_text_visibility="true"/>

Remember to add a namespace for the library in your layout:

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

You can customize the widget from the layout file, or from the activity once you obtain a reference to it:

PieView pieView = (PieView) findViewById(R.id.pieView);
 pieView.setPercentageBackgroundColor(getResources().getColor(R.color.customColor2));
 pieView.setInnerText("A");

You can animate the fill of the percentage bar:

PieView animatedPie = (PieView) findViewById(R.id.animated_pie_view_1);
  PieAngleAnimation animation = new PieAngleAnimation(animatedPie);
 animation.setDuration(5000);
 //This is the duration of the animation in millis animatedPie.startAnimation(animation);

You can update any color of the widget:

PieView pieView = (PieView) findViewById(R.id.pieView);
  // Change the color fill of the bar representing the current percentage pieView.setPercentageBackgroundColor(getResources().getColor(R.color.customColor1));
  // Change the color fill of the background of the widget, by default is transparent pieView.setMainBackgroundColor(getResources().getColor(R.color.customColor5));
  // Change the color of the text of the widget pieView.setTextColor(getResources().getColor(R.color.customColor12));

If required you can also change the area covered by the inner circle of the widget to change its appearence:

PieView pieView = (PieView) findViewById(R.id.pieView);
  // Change the thickness of the percentage bar pieView.setPieInnerPadding(50);

And finally update the text if you want the widget to represent other thing or even toggle the visibility of its center text:

PieView pieView = (PieView) findViewById(R.id.pieView);
  // Update the visibility of the widget text pieView.setInnerTextVisibility(View.VISIBLE);
  // Change the text of the widget pieView.setInnerText("A");
  // Change the text size of the widget pieView.setPercentageTextSize(35);
Without inner text With a label instead of a percentage

License

Copyright 2016 Alejandro Zürcher  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

Convert between RxJava and Agera reactive base types.

Simple Android SharedPreferences wrapper.

IntelliJ plugin for supporting PermissionsDispatcher.

PermissionsDispatcher is wonderful library for Runtime Permissions. However, it asks developers "attach annotations" and "delegate to generated class" and then after that "rebuild". It's hard to follow all steps correctly. This plugin generates the skeleton of methods for "attach annotations" and "delegate to generated class" using GUI.

RecyclerViewHelper provides the most common functions around recycler view like Swipe to dismiss, Drag and Drop, Divider in the ui, events for when item selected and when not selected, on-click listener for items.

Reactive Billing is a lightweight reactive wrapper around In App Billing API v3 for Android.

Easy splash screen library allows you to generate beautiful and customizable Splash screens with less effort.

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