Thursday, December 27, 2012

Tablet interface jQuery Mobile with Android Holo inspiration

In an earlier article of mine I laid out an Android Holo inspired theme for jQuery Mobile. This theme appropriate for smartphone form factors, but it lacks some support for tablets and TV-dongles running Android.

As of version 1.2.0 jQuery Mobile (JQM) still does not officially support tablet interfaces. There is a splitview plugin for JQM, but real support will only happen in version 1.2.1 of JQM. At this moment you will have to alter the JQM code base in order to make the splitview work. This is the reason that I used a different approach concerning the tablet interface. The source I used to make the solution I needed can be found on YouTube.

There is still one con to this solution. Although the interface looks like its splitted, you cannot scroll them separately. See the screenshots below to see the tablet and smartphone interface.





The screenshots are taken from my discontinued app called DroidPapers.

This is what you need (all will be included in the download below).

  • jQuery Mobile 1.2.0 framework.
  • Modified (minimum) stylesheet files.
  • Android Holo inspired theme for JQM.
  • Roboto Regular (normal text) and Roboto Thin (headers) fonts.
  • For the convenience i added PhoneGap (Cordova) 2.2.0. 
The download is complete and functional for web-apps that are deployed on the Android (2.3+) platform. I cannot guarantee that it will work in every browser or on Android versions lower than 2.3.

What does the download features?

  • Holo inspired theme, dark color (light also included, but you will have to adjust the title with Gimp, xcf file included).
  • More Android like titlebar.
  • Smartphone and tablet interface in one app (it detects screen size).
  • Android Roboto fonts for the headers and normal text.
  • Correct back-button behavior (Phonegap required for that one).
  • Example index.html (you can upload it to a webserver and test it with Google Chrome).

What did I change?

This is so you can secure it before upgrading to a newer platform of jQuery Mobile. The lines in the files that have /* Teusink.org */ are modified by me.
  • AndroidHoloDarkLight.css. It is a themeroller theme, but with some small modifications.
  • jqm-docs.css. CSS file copied from the source it self (JQM), but with small modifications.
  • jquery.mobile.structure-1.2.0.css. Official JQM css file, standard included in the framework.
So If you are curious what I changed, feel free to screen the code. I did not minify the files, so you can easily edit if needed. Want to minify the files? Check here.

And here is the download link to the interface package. Click here to get it from GitHub.

Thank you for reading my blog!


Copyright (c) 2015 Joram Teusink

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.