Showing posts with label winphone7. Show all posts
Showing posts with label winphone7. Show all posts

Monday, 11 April 2011

MIX11... the mobile app collection

It's that time of year again - MIX11 conference time - and although last year there was just one mobile app (MIX10 for iPhone), this year conference delegates are spoilt for choice!

This year there are Conf-powered apps on the three biggest mobile platforms: iPhone, Windows Phone 7 and Android...

All are pure .NET projects - the Windows Phone 7 app uses the Microsoft Windows Phone SDK while the iOS and Android versions are bought to you via power of Mono: MonoTouch and Mono for Android

The official 'site' for these apps is mix11.confapp.com - it also lists a couple of 'other' options for Windows Phone users. Download one or all of them - and have a great time at MIX!

Aside: for those working on cross-mobile-platform UI, the primary navigation mechanism is quite different across the three platforms (my thoughts):
  • iOS uses a 'tab bar', familiar to all users as it features in most iOS apps. The benefits are that it's always visible and the icon appearance is consistent and attractive. Only five options fit before they get hidden behind a 'More...' link.
  • Windows Phone 7 uses the 'panorama' control. While it encourages discovery by panning across pages, not all options are immediately obvious to the user. Microsoft suggests a maximum of seven pages, so beyond that limit you need to think of other navigation paths.
  • Android uses the operating-system provided 'hardware menu'; it is not visible until the user presses the button however it can then display a number of options at once (similar to iOS). Because it can be context-sensitive the user doesn't really know what options to expect until they press the button (although the MIX11 app uses a consistent menu from all pages to get around this confusion).

Saturday, 5 March 2011

"M"osetta Stone

Some more thoughts on cross-platform mobile development (MonoTouch, MonoDroid and Windows Phone 7) from yesterday's post - a 'rosetta stone' (not this one) to translate between the three platforms (Not that each of these things is exactly equivalent - they're matched up where the concept/role/function seems similar to me).
iOSWP7Android
"View"XIB (Interface Builder)Xamlaxml
UIViewControllerPhoneApplicationPage (codebehind)Activity
n/a (UIAutoResizing)StackPanelLinearLayout
UITableViewListBoxListView
UITableViewCellListBox.ItemTemplaten/a (any view)
UITableViewSourcen/a (binding, IEnumerable)BaseAdapter
Navigation "Controller"NavigationController. PushViewController()NavigationService.
Navigate()
StartActivity()
n/a (object)Xaml UriIntent.SetClass()
n/a (object properties)Xaml Uri querystring paramsIntent.PutExtra() .AddFlags()
n/a (object properties)NavigationContext
.QueryString
.TryGetValue()
Intent .GetXXXExtra()
ThreadingInvokeOnMainThreadDispatcher.BeginInvokeRunOnUiThread
"Model"C# .NET objects - shared thanks to Mono on iOS & Android. Also WebClient, Linq, Generics, Xml, Serialization, etc... :-)

One major difference between iOS and the other two (both in terms of coding and also UI design) is the presence of hardware buttons and the back-stack.

Hardware buttons
The most important hardware button is Back (covered next) however Android's Menu button is also significant for the impact is has on UI design compared to iOS and WP7. Both Apple and Microsoft's designers like the application menu (UITabBarController, ApplicationBar) to be permanently visible. Google, on the other hand, provides the Menu button to show the menu, meaning that most of the time it is hidden. This means your Android app UI might need to provide other visual clues so that navigation/features/options are more discoverable.

Back stack
Both Android and WindowsPhone7 devices have a hardware Back button supported by the respective SDKs via the 'back-stack' which is analogous to your web-browser History: each "View" has an "address" (a Xaml Uri in WP7, an Intent in Android) which is stored as the user navigates through your application. At any time (unless you intercept it) the hardware Back button allows the user to cycle back through previous views until they have exited your app.

iOS utilises a similar navigation metaphor in its UINavigationController - however the back button is 'soft' (displayed in the top-left corner of the screen) and the scope is limited to the set of views that the developer chose to include in that navigation context.

Sunday, 7 November 2010

Conf mobile schedule for TechEd Berlin & Øredev

Europe is awash with conference attendees this week - for TechEd Berlin and Øredev.

If you are attending either conference, you might want to download Conf to your iPhone or Windows Phone 7 (no Android for now, but coming...).

One warning for Øredev - the 'unusual' session starting times (eg. 10 after the hour) were not catered for in the code, so the "up next" algorithm doesn't really work. To be fixed in the next release!


Hopefully no such issues occur with the TechEd Europe schedule, bought to you by the power of OData!

If you're reading this, you must be interested in these conferences, so you probably want to know about these other mobile schedule apps too*:
* DISCLAIMER: I had nothing to do with either of these apps - just mentioning them FYI...

Tuesday, 26 October 2010

Conf for PDC10 on Windows Phone 7

A first-cut of the PDC10 schedule can now be downloaded for the Windows Phone 7 version of Conf - now available on Marketplace (Zune link).

To download new conference data in Conf
  • Start on the first panel of the Panorama
  • Scroll down to other conferences... and touch Download more...
  • When the list downloads from the server, touch PDC10
  • PDC10 should appear in the list - if not, switch between the conferences until it does :-s
This is what the app looks like with PDC10 data loaded:

The iPhone version of Conf is currently awaiting AppStore approval - fingers crossed for Thursday!

Thursday, 14 October 2010

MonoTouch & WindowsPhone7: indexed lists

One interesting aspect of building cross-platform apps is how to adopt the 'standard' UI elements so that each app looks 'native'. A basic iPhone/MonoTouch and WindowsPhone7 application was introduced in a previous post. Each app uses the 'default' list representation.

This post is about making those apps easier to use, adding each platform's default "list index" to help select from long, sorted lists. The images below hardly need captions:
  • on the left is the iPhone app with alphabetic index down the right side of the screen
  • on the right is the WindowsPhone7 app showing the alphabet tiles 'in' the list, and the grid that is displayed when you touch one of those tiles

Implementing the two different solutions highlights the difference in the two platforms (referring of course to C#/MonoTouch on the iPhone, and C#/Silverlight on the WindowsPhone7). Get the complete code from github - the main changes for each platform are highlighted below:

iPhone (MonoTouch) UITableView sections

The following code was added to the UITableViewSource subclass to break up the list into sections, identify the section labels and wire up the alphabetic navigation. The GetCell and RowSelected methods also required a minor change.

List<string> sectionTitles;
Dictionary<int, <restaurant>> sectionElements = new Dictionary<int,restaurant>>();
public TableViewSource (List<restaurant> list, MainViewController controller)
{
   this.list = list;
   mvc = controller;
   sectionTitles = (from r in list
            orderby r.StartsWith
            select r.StartsWith).Distinct().ToList();
   foreach (var restaurant in list)
   {   // group elements together into 'alphabet'
      int sectionNumber = sectionTitles.IndexOf(restaurant.Name[0].ToString());
      if (sectionElements.ContainsKey(sectionNumber))
         sectionElements[sectionNumber].Add(restaurant);
      else
         sectionElements.Add(sectionNumber, new List<restaurant> {restaurant});
   }
}
public override int NumberOfSections (UITableView tableView)
{
   return sectionTitles.Count;
}
public override string TitleForHeader (UITableView tableView, int section)
{
   return sectionTitles[section];
}
public override string[] SectionIndexTitles (UITableView tableView)
{
   return sectionTitles.ToArray();
}
public override int RowsInSection (UITableView tableview, int section)
{
   return sectionElements[section].Count(); //list.Count;
}


Windows Phone 7 'quick jump grid'

Although you'll see this kind of navigation in the 'built-in' applications, it isn't actually part of the default SDK. Thankfully Kevin Marshall has posted a quick jump grid sample which has been integrated into the RestGuide app - just add the relevant Assembly References then update the XAML to use the QuickJumpGrid (don't forget to add the relevant xmlns: declarations)

<cc:QuickJumpGrid DataSource="{Binding}"
      IsAlphaNumeric="True"
      Margin="12,0,0,0"
      SelectionChanged="MainListBox_SelectionChanged"
      x:Name="MainListBox"
      OverlayTileBackground="#8CBF26">
    <cc:QuickJumpGrid.QuickJumpGridSelector>
        <local:RestaurantNameSelector />
    </cc:QuickJumpGrid.QuickJumpGridSelector>
    <cc:QuickJumpGrid.ItemTemplate>
        <DataTemplate>
           <StackPanel Margin="0,0,0,17" Width="432">
               <TextBlock Text="{Binding Name}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
               <TextBlock Text="{Binding Cuisine}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
           </StackPanel>
        </DataTemplate>
    </cc:QuickJumpGrid.ItemTemplate>
</cc:QuickJumpGrid>

and implement this 'helper' class (which is referenced from the XAML)

namespace RestGuide
{
    public class RestaurantNameSelector : IQuickJumpGridSelector
    {
        public Func<object, IComparable> GetGroupBySelector()
        {
            return (p) => ((Restaurant)p).Name.FirstOrDefault();
        }
        public Func<object, string> GetOrderByKeySelector()
        {
            return (p) => ((Restaurant)p).Name;
        }
        public Func<object, string> GetThenByKeySelector()
        {
            return (p) => (string.Empty);
        }
    }
}

Saturday, 25 September 2010

MonoTouch meet WindowsPhone7

This is a very basic example of how you can share data and code between the iPhone platform (using MonoTouch) and recently RTM'd Windows Phone 7.

iPhone and Windows Phone 7 screenshots : click to enlarge

The code is available on github... notice that the source data (restaurants.xml file) and class file (Objects.cs) are identical on both platforms, as is the XmlSerialization code that parses the data into memory for display.

You will see there is a lot more 'user code' in the MonoTouch project for iPhone - this is due to the laborious way that UITableViews must be coded*; whereas the WP7's Silverlight heritage allows some very neat databinding scenarios.

* the excellent MonoTouch.Dialog project significantly reduces this code overhead on MonoTouch - definitely give it a try!

...now I just need to put the MonoDroid version together... :-)