★ wanayoo — archive 1999 https://github.com/Coder698/TimetableLayoutNouvelle recherche | Portail wanayoo
Skip to content
master
Go to file
Code
This branch is 1 commit ahead, 11 commits behind MoyuruAizawa:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
app
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

TimetableLayout

Platform API License Download Build Status
TimetableLayout is a layout manager and item decorations to display the timetable.

sample01 sample02

Usage

Dependency

implementation 'io.moyuru:timetablelayout:1.0.0-alpha01'

LayoutManager

recyclerView.layoutManager = TimetableLayoutManager(columnWidth, heightPerMin) { position ->
  val period = periods[position]
  TimetableLayoutManager.PeriodInfo(period.startAt, period.endAt, period.stageNumber)
}

ItemDecoration

recyclerView.addItemDecoration(ProgramTimeLabelDecoration(context, periods, heightPerMin))
recyclerView.addItemDecoration(StageNameDecoration(context, periods, columnCount))

class ProgramTimeLabelDecoration(private val periods: List<Period>, ...) : TimeLabelDecoration(...) {

  private val formatter = DateTimeFormatter.ofPattern("HH:mm")

  override fun canDecorate(position: Int): Boolean = periods.getOrNull(position) is Program

  override fun getStartUnixMillis(position: Int): Long = periods.getOrNull(position)?.startAt ?: 0

  override fun formatUnixMillis(unixMillis: Long): String =
    LocalDateTime.ofEpochSecond(unixMillis / 1000, 0, ZoneOffset.UTC).format(formatter)
}

class StageNameDecoration(private val periods: List<Period>, ...) : ColumnNameDecoration(...) {

  override fun getColumnNumber(position: Int): Int {
    return periods.getOrNull(position)?.stageNumber ?: 0
  }

  override fun getColumnName(columnNumber: Int): String {
    return when (columnNumber) {
      0 -> "Melodic Hardcore"
      1 -> "Metalcore"
      2 -> "Hardcore"
      3 -> "Deathcore"
      else -> "Djent"
    }
  }
}

Sample

Features

  • Vertical Scroll
  • Horizontal Scroll
  • Horizontal Loop
  • Non Horizontal Loop
  • Column Name Decoration
  • Time Decoration
  • Current Time Decoration
  • Multi Column
  • Scrollbar
  • Pinch To Zoom

License

Copyright 2019 Moyuru Aizawa

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.

About

TimetableLayout is a RecyclerView.LayoutManager to display the timetable for Android.

Resources

License

Packages

No packages published

Languages

You can’t perform that action at this time.