Wednesday, August 2, 2017

As from today watchmis.com is using the Google Search Product markup for its product pages.

Here is a screen-shot of the Structured Data Testing Tool loaded with a random page from the website:


Tuesday, March 14, 2017

watchmis.com has always been a responsive website.  Now it also became an installable web application.

Choose 'Add to Homescreen' in Chrome and a launcher icon will be added to the Homescreen. When you click on the launcher icon the web app will run in full screen mode, very similar to a native mobile application.



How it was made:
1. Created a simple icon in Inkscape and exported is as a 144x144 png. The icon is shown on the Home Screen of the device and in the center of the splash screen:




2. Added a manifest.json file to the /static/ folder of the Django project:

{
  "name": "Find the perfect watch on Amazon",
  "short_name": "Amazon Watches",
  "icons": [
    {
      "src": "/static/manifest/android-chrome-192x192.png",
      "sizes": "192x192",
      "type": "image/png"    },
    {
      "src": "/static/manifest/android-chrome-512x512.png",
      "sizes": "512x512",
      "type": "image/png"    },
    {
      "src": "/static/manifest/icon_144_144.png",
      "sizes": "144x144",
      "type": "image/png"    }
  ],
  "theme_color": "#ffffff",
  "background_color": "#ffffff",
  "display": "standalone"}
 
3. Added a linktag to serve the manifest:
<link rel="manifest" href="{% static 'manifest/manifest.json' %}" /> 










Thursday, March 2, 2017

SpeakIt version v5.1 is out (just two days after releasing v5.0).

- Added a sound recorder. 
- The UI has been rewritten.
- Latest versions of all of the third party libs.
- A bunch of maintenance fixes.

Thursday, January 19, 2017

Android enums are out of fashion (again)

Back in 2011 Google removed from its Performance Tips the advice to avoid enums. Today I've been rewriting an older app and wanted to add a feature that allows you to change the EditTexts' size using a PreferenceFragmentCompat at runtime. It would have a low, medium and big setting and the sizes would be resolution independent. A low, medium and big trio is asking for an enum and apparently enums were already ok with Android SDK.

But then I decided yet to check this again. And it turns out that nowadays using an @IntDef is the kosher way of doing things.

So here is the final version of the function:

@Retention(SOURCE)
@IntDef({EDIT_SMALL, EDIT_MEDIUM, EDIT_LARGE})
public @interface EditSize {}
public static final int EDIT_SMALL = 12;
public static final int EDIT_MEDIUM = 24;
public static final int EDIT_LARGE = 38;


public static int getScaledPixels(Context context, @EditSize int dps) {
    final float scale = context.getResources().getDisplayMetrics().density;
    return (int) (dps * scale + 0.5f);
}