AndroidWaterGauge


Source link: https://github.com/mhmtk/Android-Water-Gauge

Android Water Gauge

A customizable water gauge to display devices orientation

Using the Android Water Gauge

Add it into and .xml file like:

<com.mhmt.library.view.OrientationFeedbackView

 android:layout_width="50dp"

 android:layout_height="300dp"

 android:layout_alignParentStart="true"

 android:layout_centerVertical="true"

 app:gauge_plane="YZ"

 app:gauge_orientation="vertical"

 app:gauge_range="60"

 app:gauge_threshold="20.0"

 app:gauge_ball_accept_color="@android:color/holo_green_dark"

 app:gauge_show_degrees="true"

 app:gauge_degree_display_text_color="@android:color/holo_red_light"
/>

If you want to be notified when the threshold is passed in either way, add a OnAcceptabilityChangedListener to your water gauge like :

waterGauge.setOnAcceptabilityChangedListener(new OnAcceptabilityChangedListener() {

 @Override public void acceptabilityChanged(final OrientationFeedbackView view, final boolean acceptable) {

// do something!

 
}

  
}
);

It's highy customizable, give it a go with the following attributes

attribute Explanation
gauge_plane The device plane this water gauge responds to
gauge_orientation The orientation of the water gauge, can be horizontal or vertical
gauge_range The amount of angle this gauge will span, in degrees. This is the total of two sides
gauge_threshold After what displacement from the origin the gauge will change color
gauge_ball_accept_color The color of the ball in it's natural state
gauge_ball_reject_color The color of the ball when it passes the threshold
gauge_line_width The width of the line in the middle of the water gauge
gauge_line_color The color of the line in the middle of the water gauge
gauge_background_color The background color of the water gauge
gauge_corner_radio How much the corners of the water gauge curve
gauge_show_degrees Whether the current orientation should be shown, in degrees
gauge_degree_display_text_color The color of the degree text

Adding to your App

This library is available through jitpack central. Just add the following to your app-level gradle file:

dependencies {

compile 'com.github.mhmtk:androidwatergauge:0.6.0' 
}

and, the following to your top-level gradle file if you don't already have it:

allprojects {
  repositories {

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

For adding it using other ways, check out https://jitpack.io/#mhmtk/androidwatergauge/0.6.0

Feel free to leave any comments/suggestions!

Resources

RxDownloader is an RxWrapped Download Manager.

Simple JUnit rule for overriding RxJava/RxAndroid schedulers during unit tests.

A MultiScreen-Support-Library for Android.

A raised button that lowers down to 0dp of elevation.

Typer/writer TextView component.

Android app built with MVP architectural approach and uses Marvel Comics API that allows developers everywhere to access information about Marvel's vast library of comics.

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