Skip to content

Separate tile loading and storing #5

@tehmou

Description

@tehmou

This is a bit of an academic feature, but necessary for demonstrating a proper way of building more complex applications.

The loader:

  • Only loads tiles and puts them into the content provider (the bitmaps to disk through bitmap cache)
  • Provides an observable of error events
  • Does not necessary give an observable of successes at all!

The store:

  • Does not directly know about the loader, only connects to the content provider and detects loaded data through it
  • Memory cache optional, though not needed

The bitmap cache:

  • Remembers which bitmaps were already loaded and stores them in memory with a file path
  • For performance the loader can insert the loaded bitmaps to the bitmap cache without interfering with the separation of responsibilities

The flow of loading a bitmap should be something like

  • Get bitmap for tile x
  • Is x in content provider?
    • No: ask loader to load it (unless loader is already loading the specific tile)
    • Yes: load bitmap from the bitmap cache
  • Return the combined observable of bitmaps from the store and errors from loader. This either needs a wrapper class or we can use the RxJava Notification

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions