MinTimetable

MinTimeTable is Customizable library to generate Timetable of University.
If you only add a course, the course time is automatically calculated and added to the timetable.
(default 09:00 ~ 16:00)

Screenshot

Portrait & Landscape Timetable

screenshot_1

Installation

JitPack

MinTimeTable is available through JitPack, to install it simply add the following line to your Gradle:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
Groovy
implementation 'com.github.islandparadise14:Mintable:x.y.z'
Groovy

Usage

Add View

<com.islandparadise14.mintable.MinTimeTableView
                android:id="@+id/table"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
XML

Day Symbol Definition

private val day = arrayOf("Mon", "Tue", "Wen", "Thu", "Fri")  
Kotlin

Make Table

override onWindowFocusChanged because we know the size of the view after onCreate is finished.
If you don't want to use this method, see the optimization options below.

override fun onWindowFocusChanged(hasFocus: Boolean) {
    super.onWindowFocusChanged(hasFocus)
    table.initTable(day)
}
Kotlin

screenshot_2

Add Schedules

private val scheduleList: ArrayList<ScheduleEntity> = ArrayList()
Kotlin
val schedule = ScheduleEntity(
                  32, //originId
                  "Database", //scheduleName
                  "IT Building 301", //roomInfo
                  ScheduleDay.TUESDAY, //ScheduleDay object (MONDAY ~ SUNDAY)
                  "8:20", //startTime format: "HH:mm"
                  "10:30", //endTime  format: "HH:mm"
                  "#73fcae68", //backgroundColor (optional)
                  "#000000" //textcolor (optional)
                )
Kotlin
scheduleList.add(schedule)
Kotlin
override fun onWindowFocusChanged(hasFocus: Boolean) {
    super.onWindowFocusChanged(hasFocus)
    table.initTable(day)
    table.updateSchedules(scheduleList)
}
Kotlin

screenshot_3

If you want to start on Sunday,
use 'ScheduleDayOption.${weekday}' (SUNDAY ~ SATURDAY)

Optimization Option

Make the view fullWidth

screenshot_4

add attribute 'isFullWidth' (default: false)

<com.islandparadise14.mintable.MinTimeTableView
                android:id="@+id/table"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:isFullWidth="true" />
XML

then you don't need override onWindowFocusChanged

if you want to add padding using optimization option, add attribute 'widthPadding' (default: 0)

<com.islandparadise14.mintable.MinTimeTableView
                android:id="@+id/table"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:isFullWidth="true"
                app:widthPadding="20" />
XML

More Options

Add Listener

ScheduleEntity has onClickListener

schedule.setOnClickListener(View.OnClickListener {
    //do something
})
Kotlin

MinTimeTableView has three kinds of Listener

When you click on a schedule,
if you need ScheduleEntity in Listener, you can use OnScheduleClickListener

table.setOnScheduleClickListener(
    object :OnScheduleClickListener {
        override fun scheduleClicked(entity: ScheduleEntity) {
            //do something
        }
    }
)
Kotlin

When you click on a timeCell,
if you need weekdayInfo and timeInfo, you can use OnTimeCellClickListener

table.setOnTimeCellClickListener(object :OnTimeCellClickListener{
    override fun timeCellClicked(scheduleDay: Int, time: Int) {
        //do something
    }
})
Kotlin

When you LongClick on a schedule,
if you need ScheduleEntity in Listener, you can use OnScheduleLongClickListener

table.setOnScheduleLongClickListener(
        object :OnScheduleLongClickListener{
            override fun scheduleLongClicked(entity: ScheduleEntity) {
                //do something
            }
        }
)
Kotlin

Length options

Length

baseSetting(topMenuHeight: Int, leftMenuWidth: Int, cellHeight: Int)

table.baseSetting(30, 40, 60) //default (20, 30, 50)
Kotlin

Rate

ratioCellSetting(topMenuHeight: Int, leftMenuWidth: Int, cellRatio: Float)

table.ratioCellSetting(20, 30, 1.5f)
Kotlin

Border Option

add attribute 'radius_option' ( none | left | right | round )

<com.islandparadise14.mintable.MinTimeTableView
                android:id="@+id/table"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:radius_option="left" />
XML

screenshot_5

Color options

add attribute 'cellColor', 'lineColor', 'menuColor'

<com.islandparadise14.mintable.MinTimeTableView
                android:id="@+id/table"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:cellColor="@color/black"
                app:lineColor="@color/colorAccent"
                app:menuColor="@color/colorPrimary" />
XML

screenshot_6

TwentyFourHourClock option

add attribute 'setTwentyFourHourClock' (default: true)

<com.islandparadise14.mintable.MinTimeTableView
                android:id="@+id/table"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:setTwentyFourHourClock="false" />
XML

screenshot_7

Border Option

screenshot_8
add attribute 'xEndLine'(blue), 'yEndLine'(red), 'border'(green)

(default: false)

<com.islandparadise14.mintable.MinTimeTableView
                android:id="@+id/table"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:border="true"
                app:xEndLine="true"
                app:yEndLine="true" />
XML

Author Information


Timetable Library for Android Development
Author : Mint Park / Seoul, South Korea
Email : nasamk3@gmail.com
Newest Version : 1.4.2 (JitPack)

GitHub