TickTock Widget


Source link: https://github.com/BCGDV-ASIA/android-widget-ticktock

TickTock Widget

This is a circular widget that can be used to display a count down timer or a count up timer.

How to include

compile 'com.bcgdv.asia.lib:ticktock:1.3'

Usage

 <com.bcgdv.asia.lib.ticktock.TickTockView

android:layout_width="200dp"

android:layout_height="200dp"

android:layout_marginTop="16dp"

android:layout_gravity="center_horizontal"
app:tickAutoFitText="true"

app:tickMiddleColor="#333333"

app:tickMoveCounterClockwise="true"

app:tickTextColor="#CCCCCC"

app:tickDotRadius="6dp"

app:tickEmptyRingColor="@android:color/white"

app:tickFillRingColor="@color/colorPrimary"

app:tickRingThickness="3dp" />
  • tickCircleDuration - minute|total_time the circle completes a full circle every minute or the total time different between startTime and endTime. Default minute.
  • tickAutoFitText - boolean default true. The text will be automatically resized to fit in the available space.
  • tickText - Optional String static text to display in the middle.
  • tickTextColor - Optional color
  • tickTextSize - Optional dimension text size if tickAutoFitText is not used.
  • tickMiddleColor - Optional color the color of the center of the color. Color transparent by default.
  • tickFillRingColor - Optional color the color of the ring when filled. Color white by default.
  • tickEmptyRingColor - Optional color the color of the ring when empty. Color blue by default.
  • tickRingThickness - Optional dimension the tickness of the ring in DIP. 3dp by default.
  • tickDotRadius - Optional dimension the radious in DIP of the dot. 6dp by default.
  • tickMoveCounterClockwise Optional boolean false by default.
public void onCreate(Bundle savedInstanceState) {
 ...
  mCountDown = (TickTockView) findViewById(R.id.view_ticktock_countdown);

  mCountUp = (TickTockView) findViewById(R.id.view_ticktock_countup);

  if (mCountDown != null) {

mCountDown.setOnTickListener(new TickTockView.OnTickListener() {

 @Override

 public String getText(long timeRemaining) {

  int seconds = (int) (timeRemaining / 1000) % 60;

  int minutes = (int) ((timeRemaining / (1000 * 60)) % 60);

  int hours = (int) ((timeRemaining / (1000 * 60 * 60)) % 24);

  int days = (int) (timeRemaining / (1000 * 60 * 60 * 24));

  boolean hasDays = days > 0;

  return String.format("%1$02d%4$s %2$02d%5$s %3$02d%6$s",

 hasDays ? days : hours,

 hasDays ? hours : minutes,

 hasDays ? minutes : seconds,

 hasDays ? "d" : "h",

 hasDays ? "h" : "m",

 hasDays ? "m" : "s");

 
}

}
);

  
}

if (mCountUp != null) {

mCountUp.setOnTickListener(new TickTockView.OnTickListener() {

 SimpleDateFormat format = new SimpleDateFormat("hh:mm:ss");

 Date date = new Date();

 @Override

 public String getText(long timeRemaining) {

  date.setTime(System.currentTimeMillis());

  return format.format(date);

 
}

}
);

  
}
 ... 
}
  @Override protected void onStart() {

  super.onStart();

  Calendar end = Calendar.getInstance();

  end.add(Calendar.MINUTE, 4);

  end.add(Calendar.SECOND, 5);

Calendar start = Calendar.getInstance();

  start.add(Calendar.MINUTE, -1);

  if (mCountDown != null) {

mCountDown.start(start, end);

  
}

Calendar c2= Calendar.getInstance();

  c2.add(Calendar.HOUR, 2);

  c2.set(Calendar.MINUTE, 0);

  c2.set(Calendar.SECOND, 0);

  c2.set(Calendar.MILLISECOND, 0);

  if (mCountUp != null) {

mCountUp.start(c2);

  
}
 
}
  @Override protected void onStop() {

  super.onStop();

  mCountDown.stop();

  mCountUp.stop();
 
}

Known Issues

  • Please report any through GitHub issue tracker.

License

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

Simplify your code to its minimum expression with this set of Kotlin extensions for Realm. Forget about all boilerplate related with Realm API and performs database operations in one line of code.

This library allows to use Material steppers inside Android applications.

This library provides you a beautiful Persian Date picker dialog with easy API.

This is a library, that fetches uploaded music files from social network VK. It can load audio of users, groups and search.

FixMath it's mathematical game in which your task is to fix math calculations by entering the numbers to figures. Remember each kind of figure always has the same value.

FixMath offers:

  • Two modes: Arcade (beat levels without haste) and Time Attack (play against time and collect as many points!)
  • It has 60 levels which can be a good challenge!
  • Collect achievements
  • Compete with people around the world in Time Attack mode!

Lemniscate is a library that will help you to make your progress view nice and sleek.

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