Amazing Dynamic Time UI :clock1030: :hourglass: and More

Overview

FlatTimeCollection

Amazing Dynamic Time UI 🕥 for Android To help you design your Layout. it is Not just a UI, But it contains a CountDownTimer with pause() and resume() methods 😉 .

minSdkVersion=11

Library Size ~ 13 Kb.


Android Arsenal

note: this Library doesn't use any drawable file (png, jpge ...), it just uses Path class to draw canvas.

dependencies

add this line to build.gradle

dependencies {
	    compile 'com.github.anastr:flattimelib:1.0.3'
}

for maven

<dependency>
  <groupId>com.github.anastr</groupId>
  <artifactId>flattimelib</artifactId>
  <version>1.0.3</version>
  <type>pom</type>
</dependency>

FlatClockView

Clock View with Dynamic colors, themes, and time -see correct time in preview-. The time can be adjusted By using setTime() method. And You can change the color of everything as well.

in layout

<com.github.anastr.flattimelib.FlatClockView
        android:id="@+id/mFlatClock"
        android:layout_width="150dp"
        android:layout_height="150dp"
        app:hourIndicatorColor="#ef2f2f" />

control in your code

// you can change Theme in your code By this simple line :
// enum values (Themes.DefaultTheme, Themes.LightTheme, Themes.DarkTheme)
mFlatClock.setTheme(Themes.DarkTheme);

// set your custom time (hh:mm:ss)
mFlatClock.setTime(5, 30, 0);
mFlatClock.setTime("1:00:40");

// Listener to be called every second
mFlatClock.setOnClockTick(new OnClockTick() {
            @Override
            public void onTick() {
                // TODO do something evry second.
            }
        });

/*
 * and also see setHourIndicatorColor(), getSecIndicatorColor(), getBigMarkColor(), setWithBackground() .......
 **/

Attributes

minIndicatorColor=""
hourIndicatorColor=""
secIndicatorColor=""
bigMarkColor=""
smallMarkColor=""
backgroundCircleColor=""
time="11:30:00"
withBackground="true"

CountDownTimerView

it is UI CountDownTimer with pause() and resume() methods, also with Success and Failure Animations. You can change the color of everything.

add view to layout

<com.github.anastr.flattimelib.CountDownTimerView
        android:id="@+id/mCountDownTimer"
        android:layout_width="150dp"
        android:layout_height="150dp" />

control in your code

// to start CountDownTimer "time in millisecond"
mCountDownTimer.start(11000);

// to pause CountDownTimer
mCountDownTimer.pause();

// Resumes a paused CountDownTimer
mCountDownTimer.resume();

// Success
mCountDownTimer.success();

// Failure
mCountDownTimer.failure();

// on time finish
mCountDownTimer.setOnTimeFinish(new OnTimeFinish() {
            @Override
            public void onFinish() {
                Toast.makeText(getApplicationContext(), "finish", Toast.LENGTH_SHORT).show();
            }
        });

// on (success, failed) animation finish
mCountDownTimer.setOnEndAnimationFinish(new OnTimeFinish() {
            @Override
            public void onFinish() {
                // ---
            }
        }); 

Attributes

indicatorColor=""
remainingTimeColor=""
strokeColor=""
elapsedTimeColor=""
strokeWidth="10"

HourGlassView

it is special UI CountDownTimer with flip() method.

add view to layout

<!-- do not change layout_height
     it should always be "wrap_content" -->
<com.github.anastr.flattimelib.HourGlassView
        android:id="@+id/mHourGlass"
        android:layout_width="160dp"
        android:layout_height="wrap_content" />

control in your code

// to start CountDownTimer "time in millisecond"
mHourGlass.start(11000);

// to flip HourGlass.
mHourGlass.flip();

// on time finish
mHourGlass.setOnTimeFinish(new OnTimeFinish() {
            @Override
            public void onFinish() {
                Toast.makeText(getApplicationContext(), "finished", Toast.LENGTH_SHORT).show();
            }
        });

Attributes

hourGlassColor=""
sandColor=""

LICENSE


Copyright 2016 Anas ALtair

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.

Comments
  • Attempt to read from field 'float android.graphics.RectF.bottom' on a null object reference

    Attempt to read from field 'float android.graphics.RectF.bottom' on a null object reference

    Hello,

    I use FlatTimeCollection but When I make run, It shows me the message: Attempt to read from field 'float android.graphics.RectF.bottom' on a null object reference

    My code is here:

    @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.my_activity_layout);
    
           mHourGlass = (HourGlassView) findViewById(R.id.mHourGlass);
    
           try{
               mHourGlass.start(2000);
           } catch (Exception e) {
               time.setError(e.getMessage());
           }
    
           mHourGlass.flip();
    
           mHourGlass.setOnTimeFinish(new OnTimeFinish() {
               @Override
               public void onFinish() {
                   Toast.makeText(getApplicationContext(), "finished", Toast.LENGTH_SHORT).show();
               }
           });
    
       }
    
    
    
    bug 
    opened by muhammedcobanoglu 4
  • how to disable startEndAnimation ?

    how to disable startEndAnimation ?

    Thanks for the awesome library !

    I'm trying alter the library, I want continues rotation of the time for fixes time.

    what I have tried:

    1> I'm repeatedly calling start on CountDownTimer's setOnEndAnimationFinish

      mCountDownTimer.setOnEndAnimationFinish(new OnTimeFinish() {
                   @Override
                   public void onFinish() {
                       mCountDownTimer.setFinishMode(CountDownTimerView.FinishMode.NoAnimation);
                         mCountDownTimer.start(5000);
    }
    }
    

    2> also removed created FinishMode.NoAnimation enum for finish without animation

    3> commented the CountDownTimerView startEndAnimation() implementation to avoid end animation

      private void startEndAnimation() {
    //        animatorSet = new AnimatorSet();
    //        ObjectAnimator scaleX = ObjectAnimator.ofFloat(this, "scaleX", 1f);
    //        ObjectAnimator scaleY = ObjectAnimator.ofFloat(this, "scaleY", 1f);
    //        scaleX.setDuration(0);
    //        scaleY.setDuration(0);
    //
    //        ObjectAnimator scaleX2 = ObjectAnimator.ofFloat(this, "scaleX", 1f);
    //        ObjectAnimator scaleY2 = ObjectAnimator.ofFloat(this, "scaleY", 1f);
    //        scaleX2.setDuration(0);
    //        scaleY2.setDuration(0);
    //        scaleX2.addListener(new Animator.AnimatorListener() {
    //            @Override
    //            public void onAnimationStart(Animator animation) {
    //                stop();
    //                drawFinish = true;
    //                postInvalidate();
    //            }
    //
    //            @Override
    //            public void onAnimationEnd(Animator animation) {
    //                if (onEndAnimationFinish != null)
    //                    onEndAnimationFinish.onFinish();
    //            }
    //
    //            @Override
    //            public void onAnimationCancel(Animator animation) {
    //            }
    //
    //            @Override
    //            public void onAnimationRepeat(Animator animation) {
    //            }
    //        });
    //       // animatorSet.play(scaleX2).with(scaleY2).after(scaleX).after(scaleY);
    //        animatorSet.start();
    
            stop();
            drawFinish = true;
            isFinished=false;
           onEndAnimationFinish.onFinish();
            isFinished=false;
    //above code only generates  2 time rotation
        }
    

    startEndAnimation stopped but timer repeating only two times, actually I want continues rotation, without end animation !

    Not able to find where I'm missing !

    opened by LOG-TAG 2
  • custom option for CountDown repeat

    custom option for CountDown repeat

    Thanks for the awesome library !

    I want to alter the CountDown timer by repeating it!!

    if I set timer for 500 it finishes on OnTimeFinish

    I want to repeat the same timer again and again !!

    the below logic fails !!

      mCountDownTimer.setOnTimeFinish(new OnTimeFinish() {
                @Override
                public void onFinish() {
                    mCountDownTimer.start(500);
    
    
                }
            });
    

    any tips available?

    opened by LOG-TAG 1
  • Hourglass view: Vertical line of sand not showing on first call of start.

    Hourglass view: Vertical line of sand not showing on first call of start.

    I am seeing an issue where the vertical line of falling sand is not showing on the first call to start. On subsequent calls to start, the line is showing. Is this a known issue?

    screenshot_20180331-120308_01 screenshot_20180331-120357_01

    bug 
    opened by olabhrad 0
  • Attribute has already been defined error

    Attribute has already been defined error

    I use the library but when i make build, AS shows me the message:

    Attribute "strokeWidth" has already been defined Attribute "strokeColor" has already been defined

    I think that the names of these attributes are too generic and conflict with other popular libraries and can not use yours.

    I hope that solutions soon, greetings.

    opened by NarenderNagpal 1
Releases(1.0.3)
Owner
Anas Altair
Dentist, Android Developer.
Anas Altair
A customizable, easy-to-use, and functional circular time range picker library for Android

A customizable, easy-to-use, and functional circular time range picker library for Android. Use this library to mimic Apple's iOS or Samsung's bedtime picker.

Joery Droppers 251 Dec 30, 2022
Pick a date or time on Android in style

Material DateTime Picker - Select a time/date in style Material DateTime Picker tries to offer you the date and time pickers as shown in the Material

null 4.7k Jan 4, 2023
Android time range picker

TimeRangePicker TimeRangePicker is a library which can be used to select a time range. WARNING Requires android-support-v4 Description This library pr

Titto Jose 422 Nov 10, 2022
A material-styled android view that provisions picking of a date, time & recurrence option, all from a single user-interface.

SublimePicker A customizable view that provisions picking of a date, time & recurrence option, all from a single user-interface. You can also view 'Su

Vikram 2.3k Jan 4, 2023
A date time range picker for android written in Kotlin

DateTimeRangePicker A date time range picker for android Usage Firstly, grab latest release of the library via JitPack. And note that, it utilizes Jod

SkedGo 501 Dec 31, 2022
Material3 themed Jetpack Compose date & time pickers.

Compose material3 Date1 and Time pickers Highly customizable Jetpack Compose components with material3 support for date & time picking. Contents Lates

Maroš Šeleng 35 Jan 31, 2023
Android calendar view inspired by Sunrise calendar and iOS7 stock calendar

SilkCal Android calendar view inspired by Sunrise calendar and iOS7 stock calendar. Usage Add compile 'me.nlmartian.silkcal:library:0.1.1' to your dep

JunGuan Zhu 385 Nov 25, 2022
Android interval timer app using compose + compose navigation, dagger hilt, room, kotlin coroutines + flow and mvvm design pattern.

What's InTime? ⏳ InTime is an interval timer application using android jetpack components and a long running service. The purpose of this project is t

P. 46 Oct 10, 2022
Android DatePicker with month and year build with Compose UI

Compose Date Picker - Select month and year Compose Date Picker tries to offer you the year and month pickers which you can customize for your require

Doğuş Teknoloji 48 Jan 7, 2023
Appleader707 1 Aug 9, 2022
CalEF (Calendar Entry Formatter) : Select an entry in Android-Kalender and send/share the entry's content as human readable text.

CalEF (Calendar Entry Formatter) Select an entry in Android-Kalender and send/share the entry's content as human readable text. Usually calendar entri

k3b 6 Aug 17, 2022
Android Compose wheel picker library based on LazyColumn in vertical and LazyRow in horizontal.

About Android Compose wheel picker library based on LazyColumn in vertical and LazyRow in horizontal. Gradle Sample Default Item size Unfocused count

null 6 Dec 22, 2022
Nepali Date Picker library in Jetpack compose for android with Date conversion from BS to AD and vice-versa

Nepali Date picker Converter - Re in Compose This is a re-work of Nepali Date Picker Converter in jetpack compose and kotlin. English Locale Nepali Lo

Kiran Gyawali 4 Dec 23, 2022
Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:

SpeedView Dynamic Speedometer, Gauge for Android. amazing, powerful, and multi shape ⚡ , you can change (colors, bar width, shape, text, font ...every

Anas Altair 1.2k Jan 7, 2023
Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:

SpeedView Dynamic Speedometer, Gauge for Android. amazing, powerful, and multi shape ⚡ , you can change (colors, bar width, shape, text, font ...every

Anas Altair 1.2k Jan 3, 2023
Flux is a dynamic weather that communicates the weather throughout a landscape whose details vary according to the time and the weather at that particular time.

Flux ?? Description Flux is a dynamic weather that communicates the weather throughout a landscape whose details vary according to the time and the we

null 415 Jan 4, 2023
Dynamic-UI-From-JSON - A Sample Android app to show dynamic UI generation from Json

Dynamic UI from JSON Functionality The app's functionality includes: The app gen

Rafsan Ahmad 12 Dec 16, 2022
Dynamic Badge with customizable features as max number before displaying with +, color, shadow, border, corner radius, font properties and more written with Jetpack Compose

✏️?? Dynamic Badge with customizable features as max number before displaying with +, color, shadow, border, corner radius, font properties and more written with Jetpack Compose. Displays numbers either in circle or rounded rectangle shape based on badge count and selected threshold to transform from circle to rounded rectangle.

Smart Tool Factory 4 Jul 27, 2022
Android Package Inspector - dynamic analysis with api hooks, start unexported activities and more. (Xposed Module)

Inspeckage - Android Package Inspector Inspeckage is a tool developed to offer dynamic analysis of Android applications. By applying hooks to function

acpm 2.5k Jan 8, 2023
TaggerString is very light library which allows to build dynamic string resource in much more readable way.

TaggerString TaggerString is very light library which allows to build dynamic string resource in much more readable way. I guess that every Android de

polok 241 Jun 3, 2022