CountdownView


Source link: https://github.com/iwgang/CountdownView

??

CountdownView

Android countdown view?use canvas draw?supports multiple styles

Download demo apk

Screenshot

Gradle

compile 'com.github.iwgang:countdownview:2.1.6' 

Code

CountdownView mCvCountdownView = (CountdownView)findViewById(R.id.cv_countdownViewTest1);
 mCvCountdownView.start(995550000);
 // Millisecond  // or for (int time=0; time<1000; time++) {

  mCvCountdownView.updateShow(time);
 
}
 

Layout

<cn.iwgang.countdownview.CountdownView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  app:isHideTimeBackground="true"
  app:isShowDay="true"
  app:isShowHour="true"
  app:isShowMinute="true"
  app:isShowSecond="true"
  app:isShowMillisecond="true"
  app:timeTextColor="#000000"
  app:timeTextSize="22sp"
  app:isTimeTextBold="true"
  app:suffixGravity="bottom"
  app:suffixTextColor="#000000"
  app:suffixTextSize="12sp"
  app:suffixHour="?"
  app:suffixMinute="?"
  app:suffixSecond="?"
  app:suffixMillisecond="??" />

Customization

attr type default
isHideTimeBackground boolean true
timeBgColor color #444444
timeBgSize dimension timeSize + 2dp * 4
timeBgRadius dimension 0
isShowTimeBgDivisionLine boolean true
timeBgDivisionLineColor color #30FFFFFF
timeBgDivisionLineSize dimension 0.5dp
timeTextSize dimension 12sp
timeTextColor color #000000
isTimeTextBold boolean false
isShowDay boolean auto show (has value show if not hide)
isShowHour boolean auto show (has value show if not hide)
isShowMinute boolean true
isShowSecond boolean true
isShowMillisecond boolean false
isConvertDaysToHours boolean false
suffixTextSize dimension 12sp
suffixTextColor color #000000
isSuffixTextBold boolean false
suffixGravity 'top' or 'center' or 'bottom' 'center'
suffix string ':'
suffixDay string null
suffixHour string null
suffixMinute string null
suffixSecond string null
suffixMillisecond string null
suffixLRMargin dimension left 3dp right 3dp
suffixDayLeftMargin dimension 0
suffixDayRightMargin dimension 0
suffixHourLeftMargin dimension 0
suffixHourRightMargin dimension 0
suffixMinuteLeftMargin dimension 0
suffixMinuteRightMargin dimension 0
suffixSecondLeftMargin dimension 0
suffixSecondRightMargin dimension 0
suffixMillisecondLeftMargin dimension 0
isShowTimeBgBorder boolean false
timeBgBorderColor color #000000
timeBgBorderSize dimension 1dp
timeBgBorderRadius dimension 0

Other

  • Multiple countdownView specified value

 // step 1
  mCvCountdownView.setTag(R.id.name, uid);

  // step 2
  @Override
  public void onEnd(CountdownView cv) {

Object nameTag = cv.getTag(R.id.uid);

if (null != nameTag) {

 Log.i(TAG, "name = " + nameTag.toString());

}

  
}
 
  • Dynamic show

 dynamicShow(DynamicConfig dynamicConfig) 
  • Countdown complete callback

 setOnCountdownEndListener(OnCountdownEndListener onCountdownEndListener);
 
  • Interval callback

 setOnCountdownIntervalListener(long interval, OnCountdownIntervalListener onCountdownIntervalListener);
 

Resources

A demo project which has FlowLayout to work with tags.

A lot of utility classes for Android development.

A Java fluent assertion wrapper to improve readability of RxJava's TestSubscriber assertions.

Standalone ZXing barcode/qrcode scanner library so that you don't have to install the ZXing Barcode Scanner app explicitly.

Android geographic visualization for UNHCR data.

A simple library to pick images from the gallery and camera.

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