{"id":751,"date":"2016-02-15T23:32:16","date_gmt":"2016-02-15T21:32:16","guid":{"rendered":"http:\/\/mattiesworld.gotdns.org\/weblog\/?p=751"},"modified":"2016-02-16T00:13:09","modified_gmt":"2016-02-15T22:13:09","slug":"new-android-app-onscreenclock","status":"publish","type":"post","link":"https:\/\/mattiesworld.gotdns.org\/weblog\/2016\/02\/15\/new-android-app-onscreenclock\/","title":{"rendered":"New Android app: OnScreenClock"},"content":{"rendered":"<h1>And why it took me so long<\/h1>\n<h3>Disclaimer: please don&#8217;t take this post too serious as I wrote it on a ranting spree, failing to keep consistence or structural coherence, using hyperboles to keep you entertained. You&#8217;ve been warned \ud83d\ude1b As with many funny things, there&#8217;s some truth in there though \ud83d\ude09<\/h3>\n<p>&nbsp;<\/p>\n<p>About a year ago, I bought an Android TV device: Nexus Player. That fact alone I could talk about for an hour, but\u00a0let&#8217;s stay on-topic. \ud83d\ude09 Being introduced to Netflix and the concept of binge-watching, I had to protect myself from wasting all my time. Although I never used a clock on my tv before, its existence and use now became blatantly obvious to me. Unfortunately, neither my tv set nor the nexus player\/android tv provide this! Android TV apps were (and still are) scarce so I took on the burden of the app dev and decided to try it myself, can&#8217;t be too difficult, riiight? \ud83d\ude09<\/p>\n<p>After having taken the standard android and android tv specific hurdles, I quite quickly had something running that worked sufficiently for me. But what about &#8220;all&#8221; these other android Tv users? Being the empatic man I am, I put it on the app store, hoping to help others. As most often is the case, it turns out every user has different needs \ud83d\ude09 People want to use it\u00a0on tablets, phones,.. So it had to become the super OSD clock app! Of course.<\/p>\n<p>The requirements were boldly defined:<\/p>\n<ol>\n<li>Show a clock<\/li>\n<li>Be available on all android devices, from api level 10 (gingerbread) and up<\/li>\n<li>Provide easy positioning with predefined anchors for each corner<\/li>\n<li>Configurable font size<\/li>\n<li>Optional background to make the clock readable on all surfaces<\/li>\n<li>Configurable\u00a0color (everybody likes colors, no?)<\/li>\n<li>Android TV specific UI&#8217;s (leanback interfaces). The Nexus Player comes with a D-pad remote. All user interfaces should be as intuitive as possible using the D-pad.<\/li>\n<li>Choose between digital or analog clock.<\/li>\n<\/ol>\n<p>One year later, I can safely say that any of these features turned out to be much more complicated than anticipated. \ud83d\ude42<\/p>\n<h3>1. Show a clock<\/h3>\n<p>Sounds simple, right? The problem is, it&#8217;s not just a clock. It should be an on-screen clock, meaning: on top of EVERYTHING at ANY TIME. I wasn&#8217;t sure if it was possible on Android. When I found out how to do it, I wasn&#8217;t sure it would work on Android TV (didn&#8217;t at first). But with some perseverance, the hurdle was taken. After that first achievement, I celebrated for a few months (ie I was lazy, development stalled and I preferred to binge-watch instead ;)). Picking it up again, I realized the journey had just begun.<\/p>\n<h3>2. Be available on all android devices, from api level 10 (gingerbread) and up<\/h3>\n<p>If you ever tried making an app that works well on every device from api level 10 to 23, you know this is no mean feat. I learned compatibility layers the hard way, thinking it would be easy. \ud83d\ude09 Tip: use compatibility lib from the start.<\/p>\n<h3>3. Provide easy positioning with predefined anchors for each corner<\/h3>\n<p>So it turns out there are tons of ways to define the available screen estate in android, what&#8217;s next&#8230; I want my clock in the upper right corner. Can&#8217;t everybody else offset from that one corner? On tablets you want to be able to drag the clock to position it? Of course, anything is possible. But I had to narrow the scope down to be able to release. Instead of providing touch on tablets and and a DPAD nav on android TV, I just put 4 simple buttons. It&#8217;s ugly but it does the job, for now. At least I made the button press repeatable so the user\u00a0doesn&#8217;t have to click it like a crazy monkey (also, I felt like the standard NP remote wouldn&#8217;t survive it ;)).<\/p>\n<h3>4. Configurable font size<\/h3>\n<p>Here too, I had some nice ideas. Preview text of different size, seeing the right size instantly without having to increase\/decrease until desired. But then I realized: if you can get a live preview of the clock position (no3), why not keep it consistent and provide a live preview of the size. Done. Wait.. configurable fonts? Naaaah<\/p>\n<h3>5. Optional background to make the clock readable on all surfaces<\/h3>\n<p>I thought I would make the clock more readable on light surfaces by putting it on a semi-transparent background. One day I implemented an outline instead and never looked back. It gives nice contrast and is nicely anti-aliased. It&#8217;s perfect, right? Of course not,\u00a0read next.<\/p>\n<h3>6. Configurable\u00a0color<\/h3>\n<p>If your app has colors, people want to customize that. I can&#8217;t really blame them for not liking my green on black clock. I&#8217;m color blind after all. \ud83d\ude09 The problem is, if I want to provide nice TV interfaces for my app, how does one choose a color using a TV remote? I&#8217;m still not entirely sure about that but I have a few ideas. Stay tuned.<\/p>\n<h3>7.\u00a0Android TV specific UI&#8217;s (leanback interfaces)<\/h3>\n<p>I actually just explained the challenge in no6, I know bad article structure. But hey, I&#8217;m actually on a rant and just brain dumping \ud83d\ude1b<br \/>\nIf you want a TV app to be user friendly, you have to redefine its interface. There are several reasons why my attempts failed to this date.<br \/>\na) Android TV dev was (is) in its infancy, so standard components are barely available and the compat lib only recently saw a release containing reusable\u00a0preference items.<br \/>\nb) I had already so many hurdles to tackle, I thought: **** it, I&#8217;ll make a phone interface until the app is more functional and the UI is used only once anyway: just one time to configure the app! Nevertheless, it remains high on my todolist as a TV app should have a TV user interface, period.<\/p>\n<h3>8. Choose between digital or analog clock.<\/h3>\n<p>Aha, I kept the easiest one for last \ud83d\ude42 Thinking about all the configuration options, I thought, the user should be able to choose the clock&#8217;s appearance, of course! Be it digital, analog, binary, what-have-you&#8230; I implemented an analog clock, and while I&#8217;ll admit it was fun, I doubt anyone uses it. \ud83d\ude42 Development of the analog clock stalled (missing outline for example) in favor of more pressing features. Although, in the upcoming release, it kinda works..<\/p>\n<p>This is only the high level overview of why it kept me so long from releasing this app. I stumbled upon all kinds of trouble from the\u00a0service that was\u00a0killed\u00a0because android OS deemed\u00a0it\u00a0unactive to trying to obfuscate my publisher&#8217;s key.<\/p>\n<p>On top of that, I complicated things by wanting to develop 2 apps in tandem AND\u00a0reuse common code. Software development is all about reusable components, riiiiight? \ud83d\ude09 Unfortunately, up until recently I had absolutely no experience with either a) modular androids app or b) modularising code in git.<br \/>\na) If you have never used gradle and maven before, you&#8217;re in for a treat. Try to keep it simple and you&#8217;ll get there \ud83d\ude09<br \/>\nb) I went from submodules to subtrees to strees. Enjoy <a href=\"https:\/\/medium.com\/@porteneuve\/mastering-git-subtrees-943d29a798ec#.bnz2aj89s\" target=\"_blank\">this read<\/a>, thank me later \ud83d\ude09<\/p>\n<p>So yeah, this post is rather tongue-in-cheek and while touching some pain points,\u00a0fails to offer clear solutions or solutions at all. That&#8217;s because this post is already long enough and I&#8217;m too tired to pump up the quality. Sorry if I lured anyone\u00a0into reading this, hoping to learn something. You had been warned though \ud83d\ude1b<\/p>\n<p>So without further ado (queue drum roll), the one and only (literally!), on-screen display (OSD) clock, without ads (but with ads if you care about the developer), for Android TV ! (*cymbal*)<\/p>\n<figure id=\"attachment_754\" aria-describedby=\"caption-attachment-754\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/play.google.com\/store\/apps\/details?id=mattiesworld.gotdns.org.onscreenclock\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-754\" src=\"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-content\/uploads\/2016\/02\/feature-300x146.png\" alt=\"OnScreenClock OSD clock on Google Play store\" width=\"300\" height=\"146\" srcset=\"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-content\/uploads\/2016\/02\/feature-300x146.png 300w, https:\/\/mattiesworld.gotdns.org\/weblog\/wp-content\/uploads\/2016\/02\/feature.png 1024w, https:\/\/mattiesworld.gotdns.org\/weblog\/wp-content\/uploads\/2016\/02\/feature-500x244.png 500w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-754\" class=\"wp-caption-text\">OnScreenClock OSD clock on Google Play store<\/figcaption><\/figure>\n<p>Note: &#8220;Box art may deviate from actual in-app visuals.&#8221; \ud83d\ude09 The slick font is actually a residu of a dropped feature &#8220;configurable clock font&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>And why it took me so long Disclaimer: please don&#8217;t take this post too serious as I wrote it on a ranting spree, failing to keep consistence or structural coherence, using hyperboles to keep you entertained. You&#8217;ve been warned \ud83d\ude1b As with many funny things, there&#8217;s some truth in there though \ud83d\ude09 &nbsp; About a &hellip; <a href=\"https:\/\/mattiesworld.gotdns.org\/weblog\/2016\/02\/15\/new-android-app-onscreenclock\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">New Android app: OnScreenClock<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,15,40,5],"tags":[],"class_list":["post-751","post","type-post","status-publish","format-standard","hentry","category-android","category-mobile","category-onscreenclock","category-programming"],"_links":{"self":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts\/751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/comments?post=751"}],"version-history":[{"count":6,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts\/751\/revisions"}],"predecessor-version":[{"id":760,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts\/751\/revisions\/760"}],"wp:attachment":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/media?parent=751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/categories?post=751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/tags?post=751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}