Code Monkey home page Code Monkey logo

android-week-view's Introduction

Build Status

Android Week View

Android library for displaying an overview of events for a week like in a schedule(us) or timetable(uk).

It's the week view initially used in Schedule Deluxe (https://play.google.com/store/apps/details?id=com.tobiasschuerg.stundenplan), which is now outsourced in favor of a better modularization.

Usage:

See SampleActivity.kt for how to use the week view.

In short:

  1. Attach the view to your layout:
<de.tobiasschuerg.weekview.view.WeekView android:id="@+id/week_view"
    android:layout_width="match_parent" android:layout_height="wrap_content"
    app:accent_color="@color/colorAccent" app:start_hour="8" app:end_hour="15" />
  1. Configure how events are displayed (optional):
val config = EventConfig(showSubtitle = false, showTimeEnd = false)
weekView.eventConfig = config
weekView.setShowNowIndicator(true)

3Add events:

val nowEvent = Event.Single(
    id = 1337,
    date = LocalDate.now(),
    title = "Dentist Appointment",
    shortTitle = "DENT",
    timeSpan = TimeSpan.of(LocalTime.of(10, 0), Duration.ofHours(1)),
    backgroundColor = Color.RED,
    textColor = Color.WHITE
)
weekView.addEvent(nowEvent)

Desugaring:

Starting from version 1.8.0, Android Week View has switched from JakeWharton's ThreeTen Backport to desugaring for java.time-API.

Get it

  1. Add it in your root build.gradle at the end of repositories:
allprojects {
  repositories {
  ...
  maven { url 'https://jitpack.io' }
  }
}
  1. Step 2. Add the dependency
dependencies {
  compile 'com.github.tobiasschuerg:android-week-view:-SNAPSHOT'
}

android-week-view's People

Contributors

tobiasschuerg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

android-week-view's Issues

Improve naming of fields in Event.kt

Perhaps I'm doing some implementation wrong, but here is my code:

AndroidThreeTen.init(getContext());

WeekView weekView = getView().findViewById(R.id.week_view_foo);
WeekData data = new WeekData();

Event.Single event = new Event.Single(
		1,
		LocalDate.now(),
		"title",
		"short",
		"sub",
		28,
		LocalTime.of(7,0),
		LocalTime.of(8,50),
		null,
		null,
		Color.WHITE,
		Color.BLACK
);

data.add(event);

weekView.addLessonsToTimetable(data);

The view is being properly adjusted for the event size, but no event is shown at the schedule.

Add support for showing only a single day

i tried to filter to show only 1 day using the method shown to filter the weekend but only hides the weekend , please try to fix it
image
also tried to filter using only to show 1
image
using the filter method only hides the weekend

Dependency Installation Error

I've added maven { url 'https://jitpack.io' } to the Project build.gradle file under repositories, and then added implementation 'com.github.tobiasschuerg:android-week-view:-SNAPSHOT' in the app build.gradle.

I was able to get the original repo running ( alamkanak), but I haven't been able to load in any forks of that repo whatsoever.

I keep getting,

Failed to resolve: com.github.tobiasschuerg:android-week-view:-SNAPSHOT

Any pointers to as why this is happening would be much appreciated.

Events that end later than 22:59 will "break" the view

If there is only 1 event in a week, that ends later than 22:59, it will cause the view to not have horizontal lines, and labels for the hours. Also the scrollView won't have an end on the bottom.

If there are multiple events in a week, and some of them ends after 22.59 some of them doesn't, then from the start of the one that ends after 22.59 the view will not have background and the vertical scroll stops too soon.

Ability to trigger redraw of the view

If you add more events to the weekview (using addLessonsToTimetable()) and they are out sight the view is not updated, thus the user needs to zoom in or out or reload the entire fragment in order to the event to be visible.

Bug: wrong order of days when switching to RTL locale (such as Hebrew)

When switching to an RTL locale (such as Hebrew), the order of the days should be from right to left.

This means that the first day of the week (Sunday) should be on the right, then Monday, then Tuesday, ... And Saturday on the left.

Here's how it looks like on Google Calendar:

image

And here's how it looks like on this library sample:

image

Sunday events are being displayed at Monday

If there's no event at monday, all the following events are actually displayed one day before its actual day.

Might have something to do with the fact that the library counts days with monday as day 1 but you're using several times Calendar.SUNDAY which takes SUNDAY as day 1.

EDIT:

I now realize that you count events with Sunday as day 1, so I adjusted my code for that. But now I notice that if I add an event as Sunday, it is actually displayed at Monday column, but your code is detecting it as a Sunday event because the Sunday column is being drawn.

WeekView library with database

wow, Great library,
however I can't really figure out how to connect to a database such that the weekview is populated with data from the database since i'm quite new to kotlin. Could you please share some source code or advise appropriately.Thanks sir

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.