end-hunger-durham / pantries-android

An android app that directs Durham, NC residents to nearby, open food pantries
2 stars 1 forks source link

Make Details screen scrollable and allow arbitrary number of detail TextViews #29

Open robert-w-gries opened 5 years ago

robert-w-gries commented 5 years ago

Implementation

JSON changes

I think we should change the layout of the json data so it looks as follows:

[
  Organization: Pantry1
  Address: 123 Pantry1 Drive
  LatLng: 0,0
  Details: [
    Phone: 123-45678
    Availability: Monday
  ]

This way, we can require the name, address, and LatLng of the pantry and make all details optional.

DetailsFragment changes

We will create a RecyclerView that will make a scrollable list of the pantry name, address, and all pantry details.

Note: We will need to make multiple ViewHolders to support custom Views for phone and availability

To loop over the details in Pantry model, let's use Kotlin Reflection

Pantry Model changes

Instead of parsing pantry.phone into a String, let's create objects Phone and Availability so in our new DetailsFragment code, we can treat the phone and availability data as special cases.