Android UI home screen design - android-listview

I am up to create a section on my Android Home screen similar to this one,
but cannot really figuring out where to start. I mean is this a ListView I should go with? or are these simple images that are placed as different objects surrounded by straight lines? In either case, how to put these things together, is a question that I am wondering..

You can either use:
a GridLayout (for API < 14, there is a support library available somewhere on GitHub)
a vertical LinearLayout containing two horizontal LinearLayouts
a single RelativeLayout
For the buttons, use TextView or Button with a top drawable.
Please note that the dashboard pattern is now discouraged (link 1, link 2) (you should present useful information to the user on first screen such as there latest trips, friend's news, ...).
Instead of that, you could put your buttons in a sliding menu (jfeinstein has a nice implementation on github which can be integrated within an hour)

Related

Titanium - Custom Map Annotation Bubbles?

Is there any way to customize the map annotation bubbles in Appcelerator Titanium? Specifically, I'd like them to be able to display more text than what they show (ideally, by expanding to fit the text). I know I can make them clickable and take the user to a page with more info, but I simply don't have enough information to warrant that. It's basically just the title text is too long (and I can't change the text itself, it comes from sources I have no control over).
Alternatively (if customizing what's there isn't an option), is there an easy way to do custom bubbles? I don't really want to have to reinvent the wheel and rewrite the pins themselves and their event handlers, but if it comes down to it (and someone can point me to some code that can get me started, since I know if it's required, someone's done it), then so be it.
iPhone-specific options are fine.
At this moment the latest Titanium SDK gives you such possibilities for annotation bubble customization:
Add subtitle for the bubble (subtitle option). You will see additional text under the title. On Android subtitle can be multiline (using '\n').
Add left and right view to the bubble (leftView\rightView options). You can add custom view to the left or right part of the bubble. And view can consist of different elements (label, image...).
Read more here.
If this is enough for your task - you can use it. But for deeper customization you must create your own view and show it on annotation click event.

What UI elements (objects) are used in livingsocial iPhone app?

I am new to iPhone development. I am using Titanium for developing but I guess that hardly concerns my question.
What UI elements where used to develop the certain pages of livingsocial? There are hardly 5-6 windows in the whole app.
a) For eg: if you see the main page(daily deals,escapes,purchases,settings) - did they use a window with a black background image & then added tableview to it for the four options? each tableviewrow has different images. Is that how it could be done?
Also if you notice the four options are scrollable but the heading livingsocial stays static & looks different from the native UI. How was that done?
b) If you look at sign in page (in settings) - they have two textfields & a sign in button inside a window. For the last element (Don't have an account?), is that again a tableview inside a scrollableview?
It would be great if someone can give a general outline as to how they developed their app & what UI objects we used.
edit: please find the screen shots :
a)http://dl.dropbox.com/u/9556373/IMG_0616.PNG b)http://dl.dropbox.com/u/9556373/IMG_0620.PNG
a) For eg: if you see the main page(daily deals,escapes,purchases,settings) - did they use a window with a black background image & then added tableview to it for the four options? each tableviewrow has different images. Is that how it could be done?
Also if you notice the four options are scrollable but the heading livingsocial stays static & looks different from the native UI. How was that done?
That app uses a custom made UINavigationController (for the static bar at the top, that can accommodate the title of the view and different buttons depending on the view currently showing, namely a back button for returning to the main view) and UITableView with custom made cells.
b) If you look at sign in page (in settings) - they have two textfields & a sign in button inside a window. For the last element (Don't have an account?), is that again a tableview inside a scrollableview?
No, I think that's a UIButton, that just happens to look like an isolated cell. Also, that view doesn't look like its scrollable.
I'm not familiarized with Titanium, so I can't give you any directions there. But keep in mind that using custom controls usually takes more effort than simply using apple's own default.
In answer to your first question:
I'd use a tableview for that, with custom made cells to create that look. If it is not a main window on your tab you'll have to remove the 'back' button, otherwise it'll be fine.
In answer to your second question
The first 2 are textfields. The rest are all buttons (and the text above facebook button is a label).
If you're using titanium you could take a look at the kitchensink example.
Hope this helps!
Tjellekes

Mobile Safari iPhone Development - Multiple buttons in a row

I'm an iPhone developer, but new to web development. I've done some basic HTML websites and made one in iWeb as well. I'm trying to branch out to mobile web development now, so I checked out Dashcode.
Anyway, I'm trying to put a Call Button, Mail Button, and Map Button in horizontal alignment. I realize that I can add a Column Layout and have two buttons in a row, but that's the most I've gotten.
Any ideas? Thanks!
Thomas
Edit: I still haven't figured this out yet. I was given advice about a fixed position button bar, but I am not sure how to implement it. I've been looking at code, but haven't gotten it yet. Still trying though. Any help is appreciated!
What i do usually is to select the element you can't align horizontally and then go to the inspector -> dimension tab and in disposition you select fixed absolute.
This should work but beware because if you've the intention to change element's place dynamically you may have some surprise...
I think you are looking for something like this.
A fixed position button bar is created with several buttons side by side.
/Mogens

Arrange GUI elements in WPF in a similar way to the applications on the iPhone

I would like to arrange UIControls in WPF in a similar way to the applications on the iPhone. They should be positioned on a grid, but a user should be able to drag them somewhere else, after releasing the mouse button (or the finger in case of an iPhone) the selected UIControl should snap back to the next position in the grid. The other UIElements should be rearranged automatically.
Further the user should also be connect two elements with a line or something.
I'm not experienced with WPF. The first question is if there is a container which is suitable for something (System.Windows.Controls.Grid ?) or if I have to extend canvas or somethig else for this.
I would like to know which elements from the WPF framework can be used and which elements I have to write myself.
For people who do not own an iPhone: http://www.youtube.com/watch?v=3omhu2AUWC8
Update
I've looked at AnimatedTilePanel in the BangOTricks examples (see below), this one explains how to create your own Panel and how to let it arrange things there.. However I still need an idea how to implement drag and drop correctly in this example..
Unfortunately, you'll have to write a lot of things yourself, as WPF doesn't automatically do what you're looking for.
For positioning the controls, you can use either UniformGrid or Grid. Assuming it's much like the iPhone video you showed, you can just use the UniformGrid with 4 columns and however many rows you need.
For the dragging animation, layout-wise, you could start by manipulating the RenderTransform property on whatever is being dragged, but you'll have to set a handler to check once you've met whatever threshold necessary to move into the another "cell" -- and at that point, you'll have to changed the order of the items in the tree.
Take a look at AnimatedTilePanel from Kevin's Bag-o-Tricks at:
http://j832.com/bagotricks/
It doesn't do everything you want but it will show you how to write a panel that animates its children when changing size or order.
New input to this old post in 09. Earlier this year (2012) someone has wrote a FluidWrapPanel and open sourced it. I tried it and it works like a charm - just like that on the iPhone menu.
You can also apply to other UI Elements or UserControl.

Easy way to scroll overflow text on a button?

Does anyone have any examples or resources where i might find information on scrolling text which is too long to display in a button control? I'm thinking something along these lines.
Display as much text will fit within the current rect with a '...' at the end to signify overflow.
Pause for say 1 second then slowly scroll the text to the right edge displaying the right part of the string.
Display as much text will fit within the current rect with a '...' at the beginning to signify overflow.
Start the whole thing over in reverse.
Is there an easy way to do this using the "core" or built in "animation" frameworks on a certain mobile device?
[edit]
Iwanted to add some more details as i think people are more focused on wether or not what i'm trying to accomplish is appropriate. The button is for the answers on a trivia game. It does not perform any speciffic UI function but is for displaying the answer. Apple themselves is doing this in their iQuiz trivia game on the iPod Nano and i think its a pretty elegant solution to answers that are longer than the width of my button.
In case its the '...' that is the difficult part of this. Lets say i removed this requirement. Could i have the label for the button be full sized but clipped to the client rect of the button and use some animation methods to scroll it within the clipping rect? This would give me almost the same effect minus the ellipses.
Here's an idea: instead of ellipses (...), use a gradient on each side, so the extra text fades away into the background color. Then you could do this with three CALayers: one for the text and two for fade effect.
The fade masks would just be rectangles with a gradient that goes from transparent to the background color. They should be positioned above the text layer. The text would be drawn on the text layer, and then you just animate it sliding back and forth in the manner you describe. You can create a CGPath object describing the path and add it to a CAKeyframeAnimation object which you add to the text layer.
As for whether you think this is "easy" depends on how well you know Core Animation, but I think once you learn the API you'll find this isn't too bad and would be worth the trouble.
Without wishing to be obtuse, maybe you should rethink your problem. A button should have a clear and predictable function. It's not a place to store and display text. Perhaps you could have a description show on screen with a nice standard button below?
Update with source code example:
Here is some ready to use source code example (actually a full zipped Xcode project with image and nib files and some source code), not for the iPhone, not using Core Animation, just using a couple of simple NSImages and a NSImageView. It is just a cheap hack, it does not implement the full functionality you requested (sorry, but I don't feel like writing your source code for you :-P), horrible code layout (hey, I just hacked this together within a couple of minutes, so you can't expect any better ;-)) and it's just a demonstration how this can be done. It can be done with Core Animation, too, but this approach is simpler. Composing the button animation into a NSImageView is not as nice as subclassing a NSView and directly paint to its context, but it's much simpler (I just wanted to hack together the simplest solution possible). It will also not scroll back once it scrolled all the way to the right. Therefor you just need another method to scroll back and start another NSTimer that fires 2 seconds after you drew the dots to the left.
Just open the project in Xcode and hit run, that's all there is to do. Then have a look at the source code. It's really not that complicated (however, you may have to reformat it first, the layout sucks).
Update because of comment to my answer:
If you don't use Apple UI elements at all, I fail to see the problem. In that case your button is not even a button, it's just a clickable View (NSView if you use Cocoa). You can just sub-class NSView as MyAnswerView and overwrite the paint method to paint into the view whatever you wish. Multiline text, scrolling text, 3D text animated, it's completely up to your imagination.
Here's an example, showing how someone subclassed NSView to create a complete custom control that does not exist by default. The control looks like this:
See the funny thing in the upper left corner? That is a control. Here's how it works:
I hate to say that, as it is no answer to your question, but "Don't do that!". Apple has guidelines how to implement a user interface. While you are free to ignore them, Apple users are used to have UIs following these guidelines and not following them will create applications that Apple users find ugly and little appealing.
Here are Apple's Human Interface Guidelines
Let me quote from there
Push Button Contents and Labeling
A push button always contains text, it
does not contain an image. If you need
to display an icon or other image on a
button, use instead a bevel button,
described in “Bevel Buttons.”
The label on a push button should be a
verb or verb phrase that describes the
action it performs—Save, Close, Print,
Delete, Change Password, and so on. If
a push button acts on a single
setting, label the button as
specifically as possible; “Choose
Picture…,” for example, is more
helpful than “Choose…” Because buttons
initiate an immediate action, it
shouldn’t be necessary to use “now”
(Scan Now, for example) in the label.
Push button labels should have
title-style capitalization, as
described in “Capitalization of
Interface Element Labels and Text.” If
the push button immediately opens
another window, dialog, or application
to perform its action, you can use an
ellipsis in the label. For example,
Mail preferences displays a push
button that includes an ellipsis
because it opens .Mac system
preferences, as shown in Figure 15-8.
Buttons should contain a single verb or a verb phrase, not answers to trivia game! If you have between 2 and 5 answers, you should use Radio Buttons to have the user select the answer and an OK button to have the user accept the answer. For more than 5 answers, you should consider a Pop-up Selector instead according to guidelines, though I guess that would be rather ugly in this case.
You could consider using a table with just one column, one row per answer and each cell being multiline if the answer is very long and needs to break. So the user selects a table row by clicking on it, which highlights the table cell and then clicks on an OK button to finish. Alternatively, you can directly continue, as soon as the user selects any table cell (but that way you take the user any chance to correct an accidental click). On the other hand, tables with multiline cells are rather rare on MacOS X. The iPhone uses some, but usually with very little text (at most two lines).
Pretty sure you can't do that using the standard API, certainly not with UILineBreakMode. In addition, the style guide says that an ellipsis indicates that the button when pressed will ask you for more information -for example Open File... will ask for the name of a file. Your proposed use of ellipsis violates this guideline.
You'd need some custom logic to implement the behaviour you describe, but I don't think it's the way to go anyway.
This is not a very good UI practice, but if you still want to do it, your best bet is to do so via a clickable div styled to look like a button.
Set the width of the div to an explicit value, and its overflow to hidden, then use a script executing on an interval to adjust the scrollLeft property of this div.