Code Monkey home page Code Monkey logo

timelinepicker's Introduction

TimeLinePicker

English

Chinese

This is a library for people who want to show or pick up timelines on a table of 24 hours of a week, you could easily use it by default styles or you could diy your own colors and limitations. Thanks for using.

Examples

Default styles

Diy styles

Include

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

dependencies {
    implementation 'com.github.nigalinson:TimeLinePicker:release-1.0'
}

Using

Easily using

//xml
<cn.sloth.com.timepool.view.ChooserView
    android:id="@+id/chooser"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

//java
//listener
chooserView.setChooseDateListener(new ChooserView.ChooseDateListener() {
    @Override
    public void chooseDate(int inMess, Date date, int start, int end, int weekIndex) {
        //inMess: 0-normal / 1-mess with others / 2-out of time
        //start: picker start time. For example, 16 means 8 am, 17 means 8.30 am
    }
});

//destroy
chooserView.destroy();

Further using

//xml
 <cn.sloth.com.timepool.view.ChooserView
      android:id="@+id/chooser"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:weekPrimaryColor="#048074"
      app:weekSecondaryColor="#50ACA2"
      app:timelineChoosenColor="#79333333"
      app:timelineOutDateColor="#8B7E7E7E"
      app:pickerColor="#80009688"
      app:pickerMsgColor="#FFFFFE"
      app:pickerMessColor="#80C42828"
      app:pickerMessMsgColor="#FFFFFE"
      app:defaultCubeSize="2"
      app:minCubeSize="1"
      app:maxCubeSize="8"
      app:pickerString="Picking"
      app:pickerMessString="Has been used"
      app:pickerOutDateString="Out of date" />

//java
//listener
chooserView.setChooseDateListener(new ChooserView.ChooseDateListener() {
    @Override
    public void chooseDate(int inMess, Date date, int start, int end, int weekIndex) {
        //inMess: 0-normal / 1-mess with others / 2-out of time
        //start: picker start time. For example, 16 means 8 am, 17 means 8.30 am
    }
});

//set in showing dataset
 for(int i = 0; i < 7; i++){// must set 7 days
    //item of a day
    DayLine weekDataSet = new DayLine();
    //arrangements in a day
    SparseArray<TimeLineItem> arrangements = new SparseArray<>();
    TimeLineItem a1 = new TimeLineItem();
    a1.setId(1);
    a1.setName("阿里巴巴");
    a1.setStart(new Random().nextInt(24));
    a1.setEnd(a1.getStart() + new Random().nextInt(4) + 1);
    arrangements.append(arrangements.size(), a1);
    weekDataSet.setItems(arrangements);
    //set into picker
    chooserView.setTime(i, weekDataSet);
}

//destroy
chooserView.destroy();

timelinepicker's People

Contributors

nigalinson avatar

Watchers

 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.