[android-developers] Re: Touch mode again (CRUD application context).

2009-01-28 Thread Mark Murphy

Andriy Zakharchuk wrote:
 I tried to implement it in a traditional way (the approach I described
 first). So I created a list screen, put 'Add', 'Edit', 'Delete'
 commands into menu. I couldn't get Edit and Delete menu commands
 working in touch mode, because I couldn't obtain selected item.

This is why Contacts has them in the context menu.

 The only solution I see here:
 - list screen options menu has only Add command;
 - click on a list item is equal to the Edit command;
 - Delete command is available only from the form screen (you can Save,
 Discard or Delete).

I don't know about it being the only solution, but it certainly is a
solution.

Another approach for one-data-item-only CRUD situations is for there to
be neither a view nor a form. Rather, the add option off of the main
menu pops a dialog to add the item, and one can edit (via a dialog) or
delete items from context menu choices. View in this case is simply
part of the list, since the list can readily show just the single data item.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Touch mode again (CRUD application context).

2009-01-28 Thread Peli

Android also supports lng-click, which is what you need.
(see the Notepad example).

Peli
www.openintents.org

On Jan 28, 5:29 pm, Andriy Zakharchuk andriy.zakharc...@gmail.com
wrote:
 Hello all,

 I have a question about touch mode (probably it was already asked,
 sorry if so, but I couldn't find a discussion like this). It's not
 about technical issues, everything more or less is clear here, it's
 more about philosophy. Hope Romain Guy will have chance to look into
 this.

 The simple task I'm working on is a CRUD application. I have several
 entities stored in a database. Lets say users and groups. I have to
 provide basic set of operations to a user: create, retrieve, update
 and delete entity (CRUD).

 Using usual approach I would create two forms for each entity list and
 form. List displays all records from the database and has commands
 (menu items, toolbar buttons or whatever else) to add, edit, delete
 records. Add command displays form to let user fill-in fields and add
 new record. Edit command displays form with attributes of currently
 selected record. Delete command removes currently selected record from
 the database. Pretty common, eh?

 Android applications offer another model. We have three screens. I
 call them: list, view and form. In Contacts application:
 - list - is a list of contacts;
 - view - is a screen with information and dial number/send sms
 command;
 - form - is a form for editing information about the contact.

 How CRUD commands are distributed (I don't consider other commands
 like dial, send SMS).

 - list has only Add command in menu (and all possible commands in
 context menu).
 - view has Edit and Delete commands in menu,
 - form is similar to the approach above.

 There is one thing that confuses me here. In the Contacts application
 this approach looks perfect. Usually we have contacts with a number of
 phone numbers assigned, so view screen is quite functional.

 But lets imagine that we need to work with an entity that has only one
 attribute, e.g. 'users group' has only 'name' attribute. In this case
 view screen is always almost empty, only group name is displayed in
 the screen header (contact with only name filled looks very similar,
 although you still have favourite flag set/unset action). Since I
 don't have other actions to be performed on gorup, the only function
 of this screen is to have edit and delete commands in options menu.
 This seems confusing to me.

 I tried to implement it in a traditional way (the approach I described
 first). So I created a list screen, put 'Add', 'Edit', 'Delete'
 commands into menu. I couldn't get Edit and Delete menu commands
 working in touch mode, because I couldn't obtain selected item.

 In case when click on a list item moves user to the form, Edit/Delete
 commands are not needed in the options menu (in touch mode), entering
 edit mode is implemented via click, but deletion is not possible.

 The only solution I see here:
 - list screen options menu has only Add command;
 - click on a list item is equal to the Edit command;
 - Delete command is available only from the form screen (you can Save,
 Discard or Delete).

 Yeah, it is Palm OS approach :) Using this approach I make my
 application inconsistent with other Android applications.

 With Android approach I get almost empty almost non-functional view
 screen, which makes me think that I'm doing something wrong.

 Any ideas on this?

 Thank you in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Touch mode again (CRUD application context).

2009-01-28 Thread Romain Guy

Hi,

Like Peli and Mark said, the preferred way to perform contextual
actions with Android is to use a long press associated with a context
menu. There are examples of this in various sample apps, including
code.google.com/p/apps-for-android or code.google.com/p/shelves.

Another way to do it, but I would not recommend it, is to use
ListView's single choice mode and have buttons on screen to act on the
selected element. The problem with this is that you always have one
item selected.

The menu, the one that comes up when one presses the menu key, is
meant for global actions only, actions that affect the entire
activity.

On Wed, Jan 28, 2009 at 8:51 AM, Peli peli0...@googlemail.com wrote:

 Android also supports lng-click, which is what you need.
 (see the Notepad example).

 Peli
 www.openintents.org

 On Jan 28, 5:29 pm, Andriy Zakharchuk andriy.zakharc...@gmail.com
 wrote:
 Hello all,

 I have a question about touch mode (probably it was already asked,
 sorry if so, but I couldn't find a discussion like this). It's not
 about technical issues, everything more or less is clear here, it's
 more about philosophy. Hope Romain Guy will have chance to look into
 this.

 The simple task I'm working on is a CRUD application. I have several
 entities stored in a database. Lets say users and groups. I have to
 provide basic set of operations to a user: create, retrieve, update
 and delete entity (CRUD).

 Using usual approach I would create two forms for each entity list and
 form. List displays all records from the database and has commands
 (menu items, toolbar buttons or whatever else) to add, edit, delete
 records. Add command displays form to let user fill-in fields and add
 new record. Edit command displays form with attributes of currently
 selected record. Delete command removes currently selected record from
 the database. Pretty common, eh?

 Android applications offer another model. We have three screens. I
 call them: list, view and form. In Contacts application:
 - list - is a list of contacts;
 - view - is a screen with information and dial number/send sms
 command;
 - form - is a form for editing information about the contact.

 How CRUD commands are distributed (I don't consider other commands
 like dial, send SMS).

 - list has only Add command in menu (and all possible commands in
 context menu).
 - view has Edit and Delete commands in menu,
 - form is similar to the approach above.

 There is one thing that confuses me here. In the Contacts application
 this approach looks perfect. Usually we have contacts with a number of
 phone numbers assigned, so view screen is quite functional.

 But lets imagine that we need to work with an entity that has only one
 attribute, e.g. 'users group' has only 'name' attribute. In this case
 view screen is always almost empty, only group name is displayed in
 the screen header (contact with only name filled looks very similar,
 although you still have favourite flag set/unset action). Since I
 don't have other actions to be performed on gorup, the only function
 of this screen is to have edit and delete commands in options menu.
 This seems confusing to me.

 I tried to implement it in a traditional way (the approach I described
 first). So I created a list screen, put 'Add', 'Edit', 'Delete'
 commands into menu. I couldn't get Edit and Delete menu commands
 working in touch mode, because I couldn't obtain selected item.

 In case when click on a list item moves user to the form, Edit/Delete
 commands are not needed in the options menu (in touch mode), entering
 edit mode is implemented via click, but deletion is not possible.

 The only solution I see here:
 - list screen options menu has only Add command;
 - click on a list item is equal to the Edit command;
 - Delete command is available only from the form screen (you can Save,
 Discard or Delete).

 Yeah, it is Palm OS approach :) Using this approach I make my
 application inconsistent with other Android applications.

 With Android approach I get almost empty almost non-functional view
 screen, which makes me think that I'm doing something wrong.

 Any ideas on this?

 Thank you in advance.
 




-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Touch mode again (CRUD application context).

2009-01-28 Thread Andriy Zakharchuk

Thank you for comments, guys.

Probably, I was not clear, but I'm still using context menus. However,
in my opinion, context menu is a secondary way to perform an action.
So, there should always be a primary way (options menu, item click,
toolbar button). Context menu is less obvious/intuitive than other
controls. It's OK for geeks (or guys who read documentation :)), but
not for typical users. Thus I think that context menus can be used
only as secondary shortcuts.

Do you think it's OK to provide some functions only via context menu
without alternative? Doesn't it make the application unclear, more
difficult to learn (at least when other applications in the system,
and other screens in this application have this alternative)?

 The menu, the one that comes up when one presses the menu key, is
 meant for global actions only, actions that affect the entire
 activity.

I understand this, I agree with it and that's why I'm asking the
question. All standard Android applications are using this approach.
I'd like my application to be consistent with them, and it looks
mostly cool... except one screen which discomforts me (I have 5
entities to be stored in the database and only one of them has only
one attribute and any actions can be performed on it).

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Touch mode again (CRUD application context).

2009-01-28 Thread Peli

 (I have 5
 entities to be stored in the database and only one of them has only
 one attribute and any actions can be performed on it).

If those actions are equally important, what about having a dialog pop
up with the different actions when you click on an item (instead of
going to 'edit')? (Similar to an activity chooser dialog).

Peli
www.openintents.org

PS: Romain, Shelves looks really cool :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---