android-clockseekbar


Source link: https://github.com/tripadvisor/android-clockseekbar

TripAdvisor Android ClockSeekbar

Tested against API level 14+.

Standalone Android widget for picking a single time or range from a clock view.

Usage

Include ClockView in your layout XML.

 <com.tripadvisor.seekbar.ClockView

android:id="@+id/calendar_view"

android:layout_width="match_parent"

android:layout_height="match_parent"/>

or

 <com.tripadvisor.seekbar.CircularClockSeekBar

android:id="@+id/clock_seek_bar_view"

android:layout_width="match_parent"

android:layout_height="match_parent"/>

This is a fairly large control so it is wise to give it ample space in your layout. On small devices it is recommended to use a dialog, full-screen fragment, or dedicated activity. On larger devices like tablets, displaying full-screen is not recommended. A fragment occupying part of the layout or a dialog is a better choice.

If using ClockView , Then in onCreate of your activity/dialog or the onCreateView of your fragment, initialize the view with a range of valid dates.

 final ClockView minDepartTime = (ClockView) rootView.findViewById(R.id.min_depart_time_clock_view);

  DateTime minTime = new DateTime(2014, 4, 25, 7, 0);

  DateTime maxTime = new DateTime(2014, 4, 26, 4, 0);

  minDepartTime.setBounds(minTime, maxTime, false);

The ClockView does not allow the user to exceed the date ranges. It animates the hands back if user scrolls beyond the valid time range.

If using CircularClockSeekBar, Then in onCreate of your activity/dialog or the onCreateView of your fragment, You don't have to initialize it with anything. The max progress value is defaults to 120 this can be changed as per requirement.

User can add OnSeekBarChangeListener that has callbacks for various events.

 /** 
  * A callback that notifies clients when the progress level has been 
  * changed. This includes changes that were initiated by the user through a 
  * touch gesture or arrow key/trackball as well as changes that were initiated 
  * programmatically. 
  */
  public interface OnSeekBarChangeListener {

/** 

* Notification that the progress level has changed. Clients can use the fromUser parameter 

* to distinguish user-initiated changes from those that occurred programmatically. 

* 

* @param seekBar  The CircularClockSeekBar whose progress has changed 

* @param progress The current progress level. This will be in the range 0..max where max 

*

  was set by {
@link android.widget.ProgressBar#setMax(int)
}
. (The default value for max is 100.) 

* @param fromUser True if the progress change was initiated by the user. 

*/

void onProgressChanged(CircularClockSeekBar seekBar, int progress, boolean fromUser);

 /** 

* Notification that the user has started a touch gesture. Clients may want to use this 

* to disable advancing the seekbar. 

* 

* @param seekBar The CircularClockSeekBar in which the touch gesture began 

*/

void onStartTrackingTouch(CircularClockSeekBar seekBar);

 /** 

* Notification that the user has finished a touch gesture. Clients may want to use this 

* to re-enable advancing the seekbar. 

* 

* @param seekBar The CircularClockSeekBar in which the touch gesture began 

*/

void onStopTrackingTouch(CircularClockSeekBar seekBar);

 /** 

* Notification that all the animations in this seekbar are finished. Clients may use this to trigger 

* future events within their code. 

* 

* @param seekBar The CircularClockSeekBar for which animations are complete. 

*/

void onAnimationComplete(CircularClockSeekBar seekBar);

  
}

License

Copyright 2014 TripAdvisor, Inc.  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. 

Inspiration

http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/1.6_r2/android/widget/AnalogClock.java

https://github.com/RaghavSood/AndroidCircularSeekBar

Resources

Gradle plugin for creating fat/uber JARs with support for package relocation.

Easily add "New Post" popup button with the feeds (RecyclerView) of your app.

A nice breathing progress component.

Lightweight Android MVP library with easy implementation.

It's just an example of material transition.

A contextual actionbar library with many customization options.

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