Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMListScreen table_data return value #63

Open
skellock opened this issue Aug 5, 2015 · 6 comments
Open

PMListScreen table_data return value #63

skellock opened this issue Aug 5, 2015 · 6 comments
Labels

Comments

@skellock
Copy link
Contributor

skellock commented Aug 5, 2015

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 skellock changed the title PMListView table_data return value PMListScreen table_data return value Aug 5, 2015
@GantMan
Copy link
Member

GantMan commented Aug 5, 2015

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
Copy link
Member

GantMan commented Aug 5, 2015

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

@skellock
Copy link
Contributor Author

skellock commented Aug 6, 2015

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 skellock closed this as completed Aug 6, 2015
@jamonholmgren jamonholmgren reopened this Aug 9, 2015
@jamonholmgren
Copy link
Member

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

@jamonholmgren
Copy link
Member

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants