bluepotion icon indicating copy to clipboard operation
bluepotion copied to clipboard

PMListScreen table_data return value

Open skellock opened this issue 9 years ago • 6 comments

This is just for discussion.

On iOS, the return value for table_data is an [] of sections. Each containing {cells:[]} to get to the goods. Make sense.

On Android, we have the same interface, but we don't have sections over here, so I feel like the interface isn't quite right.

Our current implementation says [] -> PMBaseAdapter and {adapter: ...} -> PMCursorAdapter.

It'd be super cool if {cells: []} could invoke the base adapter too.

I'm creating a lot of [{cells: cells}] return values from my table_data screens. It'd be nice if it were just {cells: cells} or even just [{cell 1},{cell2}].

Just wanted to throw it out there because sections won't be a native thing on Android.

Holy crap this is so not a big deal. I'm cool with a wontfix label of shame. Just my $0.02 (Canadian).

skellock avatar Aug 05 '15 13:08 skellock

I've had a similar thought, and came up with this: What about the idea of eventually supporting sections in Android? It's not a native concept, but the support would be there so copypasta projects would behave the same. There would be a lot of mechanics going on under the covers, but ACTUALLY, there's a lot of mechanics going on in iOS to do this anyhow! I guess what I"m saying is, we're supporting an API, so I think we'll have to wrap the concept on both sides nomatter what we settle.

GantMan avatar Aug 05 '15 14:08 GantMan

how do I spend this $0.02 cents Canadian? The drink machine isn't fooled at all.

GantMan avatar Aug 05 '15 14:08 GantMan

Agreed. This is a polishing detail we can work out later.

I think a bit of my angst stems from the iOS platform too. Even if my TableScreen doesn't have sections, I still must define them in table_data. Seems like RP and BP could both figure out my intentions in this scenario.

The question then becomes: would supporting this shortcut cripple future growth of the table_data api?

Yes.

Closing.

But I'll get you next time gadget. next time......

skellock avatar Aug 06 '15 12:08 skellock

I actually agree with your angst here. Re-opening for future discussion.

jamonholmgren avatar Aug 09 '15 00:08 jamonholmgren

class MyScreen < PM::TableScreen

  def table_data
    {
      sections: [{
        title: "My section",
        cells: [{ ... }]
      }]
    }
  end
end
class MyScreen < PM::TableScreen

  def table_data
    {
      cells: [{ ... }]
    }
  end
end

jamonholmgren avatar Aug 09 '15 00:08 jamonholmgren

I like the idea of creating a PM::ListScreen subclass that doesn't allow section headers, and changing both the RedPotion and BluePotion versions to list_data rather than table_data.

class MyScreen < PM::ListScreen
  def list_data
    [
      { ... cell ... },
    ]
  end
end

jamonholmgren avatar Aug 09 '15 00:08 jamonholmgren