senchauser2010
6 Dec 2010, 2:42 PM
I would like to know how people handle the differences in Tablet and Phone layouts for the same app. We are starting to develop an app which pretty much uses the same components on both phone and tablet, but they are laid out differently. For example, on phone, clicking on a list item slides to the details view of that item, but on tablet both list and the detail views are shown side-by-side and clicking on an item simply updates the detail view.
So in this example, apart from layout differences, it also means that event handling needs to be done differently though at the same time a lot of things like models, stores, the individual components themselves are completely reusable.
My question is what's the best practices around handling such situations without having to rewrite the layout and event handling logic completely? Or even if some (most?) of this needs to be re-written, what's the recommended practices around organizing these two sets of code to not make it look like "if (tablet) {...} else {...}" in the every other line of the code?
Thanks for opinions/suggestions!
So in this example, apart from layout differences, it also means that event handling needs to be done differently though at the same time a lot of things like models, stores, the individual components themselves are completely reusable.
My question is what's the best practices around handling such situations without having to rewrite the layout and event handling logic completely? Or even if some (most?) of this needs to be re-written, what's the recommended practices around organizing these two sets of code to not make it look like "if (tablet) {...} else {...}" in the every other line of the code?
Thanks for opinions/suggestions!