Giter Site home page Giter Site logo

calendar's Introduction

My Calendar

Simple event calendar, with agenda view.

Requirements

  • Android SDK 24
  • Android SDK Tools 25.1.7
  • Android SDK Build-tools 24.0.0
  • Android Support Library 23.4.0

Build & Test

Build

./gradlew :app:assembleDebug

Test & Coverage Build Status Coverage Status

./gradlew :app:lintDebug
./gradlew :app:testDebug
./gradlew :app:jacocoTestCoverage

Screenshots

Discussions

Scope and conventions:

  • Assume local time zone (device time zone) for UI display
  • No recurring events supported
  • No attendees information
  • Events can span multiple days
  • All day events should end at midnight the next day, or any day after that, e.g.:
    • Mon 12:00 AM - Tue 12:00 AM for 1-day event
    • Mon 12:00 AM - Thu 12:AM for multi-day event
  • A local calendar will be created if none exists, no functionality to edit or add calendars
  • Simple coloring of events based on their calendar ID, from a pool of predefined colors
  • Only sync weather for today and tomorrow (from forecast.io)
    • Sync once every 24h
    • Rely on last known location for simplicity
    • Cache using SharedPreferences for simplicity

Custom views:

  • EventCalendarView: custom calendar view - extends ViewPager
    • mimic the look and feel of android.widget.CalendarView
    • each page is a custom RecyclerView view with a GridLayoutManager
    • shuffle and reuse pages as users swipe to minimize number of pages in memory
    • provide APIs for android.provider.CalendarContract.Events cursor binding for each page
    • provide APIs for controlling UI and interaction callbacks
  • AgendaView: custom agenda view - extends RecyclerView
    • automatically prepend/append rows via scroll events
    • automatically prune adapter items to keep its size from growing infinitely
    • provide APIs for android.provider.CalendarContract.Events cursor binding for each row
    • provide APIs for controlling UI and interaction callbacks
  • EventEditView: custom form view to create/edit event
  • CalendarSelectionView: custom list view for calendar selection
  • Content provider operations and coordination among views are handled by Activity

Layout arrangement:

  • Portrait: more vertical space
    • Stack calendar view and agenda view
  • Landscape: limited vertical space
    • For smaller devices, moderate horizontal space: overlap calendar view and agenda view. In this case the calendar view becomes more of a 'pop-up' picker
    • For larger devices e.g. tablets, more horizontal space: put calendar view and agenda view side-by-side

Data source:

  • Use Calendar Provider, required API 14
  • Pros:
    • Zero setup efforts needed for local storage
    • Can sync with other calendar apps that make use of the same provider
    • Work with a SyncAdapter to periodically sync to a remote data source
    • Inherit a well-defined model for calendars, events, attendees etc
  • Cons:
    • Inflexible content observation, e.g. unable to set custom notification URI for individual observations
    • Become much more complex when having to join multiple tables, e.g. calendars, events, attendees
    • Tricky handling of all-day events, which are stored in UTC
  • Some ideas (not implemented):
    • Create a custom content provider that wrap Calendar Provider
    • Abstract complex join queries, by creating SQL Views that get updated when underlying data from Calendar Provider change
    • Design a schema that is more tailored to UI design requirements

Testing:

  • Chose Robolectric as I am already familiar and comfortable with it.
  • Relax visibilities of several fields for testing convenience. These can be avoided with dependency injection but I just keep it simple here.

Weather icons are from Meteocons set by Alessio Atzeni

calendar's People

Contributors

hidroh 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.