Coder Social home page Coder Social logo

tallgeese-3 / colored-time-selector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ehsunshine/colored-time-selector

0.0 2.0 0.0 656 KB

A smart colored time selector. Users can select just free time with a handy colorful range selector.

License: GNU General Public License v3.0

Kotlin 98.51% Java 1.49%

colored-time-selector's Introduction

Download Android Arsenal GitHub license Build Status

Colored Time Range Selector

A smart colored time range selector. Users can select just free time with a handy colorful range selector.

Screen Shots

Colored Time Range Bar Selector

Colored Time Range Bar Selector

Features

  • Select a time range between 2 hours
  • Highlight available time range with your desire color
  • Select just free times in a range
  • Two different type of view, with Selector and without it

Use it

build.gradle

dependencies {
    implementation 'de.ehsun.coloredtimebar:coloredtimebar:1.0'
}

In your layout use the ColoredTimeBar as below:

<de.ehsun.coloredtimebar.TimelineView
            android:id="@+id/timelineView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:barColorAvailable="@color/available_time_default_color"
            app:barColorHighlight="@color/selector_default_color"
            app:barColorNotAvailable="@color/timeline_default_color"
            app:barWidth="16dp"
            app:fractionLineColor="@color/separatorDark"
            app:fractionLineLength="8dp"
            app:fractionLineWidth="1dp"
            app:fractionPrimaryTextColor="@color/fraction_default_color"
            app:fractionSecondaryTextColor="@color/fraction_default_color"
            app:fractionTextInterval="2"
            app:fractionTextSize="8sp"
            app:timeRange="07:00-19:00" />

In your code you can easily set the available time by passing an array of time range string as below:

timelineView.setAvailableTimeRange(listOf("07:00 - 10:15", "12:00 - 15:00"))

And to enable picker handles use it as below:

<de.ehsun.coloredtimebar.TimelinePickerView
                android:id="@+id/timelinePicker"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:barColorAvailable="@color/available_time_default_color"
                app:barColorHighlight="@color/selector_default_color"
                app:barColorNotAvailable="@color/timeline_default_color"
                app:barWidth="24dp"
                app:fractionLineColor="@color/separatorDark"
                app:fractionLineLength="8dp"
                app:fractionLineWidth="1dp"
                app:fractionPrimaryTextColor="@color/colorGrey900"
                app:fractionSecondaryTextColor="@color/colorBlueGrey500"
                app:fractionTextInterval="1"
                app:fractionTextSize="8sp"
                app:stepSize="15"
                app:timeRange="07:00-19:00" />
timelinePicker.setOnSelectedTimeRangeChangedListener { from, to ->
            selectedTimeTextView.text = getString(R.string.from_to, from.format(), to.format())
        }

Colored Time Range Bar Selector

Do you like it?

Use it and develop it as you like and buy me a cup of tea :)

Buy Me a Coffee at ko-fi.com

colored-time-selector's People

Contributors

ehsunshine avatar

Watchers

James Cloos avatar Ed Williams avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.