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)
Timetable Library for Android Development
Author : Mint Park / Seoul, South Korea
Email : nasamk3@gmail.com
MinTimeTable is available through JitPack, to install it simply add the following line to your Gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
implementation 'com.github.islandparadise14:Mintable:x.y.z'
<com.islandparadise14.mintable.MinTimeTableView
android:id="@+id/table"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
private val day = arrayOf("Mon", "Tue", "Wen", "Thu", "Fri")
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)
}
private val scheduleList: ArrayList<ScheduleEntity> = ArrayList()
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)
)
scheduleList.add(schedule)
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
table.initTable(day)
table.updateSchedules(scheduleList)
}
If you want to start on Sunday, use 'ScheduleDayOption.${weekday}' (SUNDAY ~ SATURDAY)
Make the view fullWidth
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" />
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" />
ScheduleEntity has onClickListener
schedule.setOnClickListener(View.OnClickListener {
//do something
})
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
}
}
)
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
}
})
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
}
}
)
baseSetting(topMenuHeight: Int, leftMenuWidth: Int, cellHeight: Int)
table.baseSetting(30, 40, 60) //default (20, 30, 50)
ratioCellSetting(topMenuHeight: Int, leftMenuWidth: Int, cellRatio: Float)
table.ratioCellSetting(20, 30, 1.5f)
add attribute 'radiusOption' ( none | left | right | round )
<com.islandparadise14.mintable.MinTimeTableView
android:id="@+id/table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:radiusOption="left" />
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" />
add attribute 'isTwentyFourHourClock' (default: true)
<com.islandparadise14.mintable.MinTimeTableView
android:id="@+id/table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:isTwentyFourHourClock="false" />
(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" />
add attribute 'menuTextSize'(float) 'menuTextColor'(color)