From c3cccde2499cf6761d2a492d168794a4183178cb Mon Sep 17 00:00:00 2001 From: adrian w kirk Date: Sat, 8 Oct 2022 23:02:18 +0100 Subject: [PATCH] sliding clock: separated out v1 and v2 faces --- apps/slidingtext/slidingtext.js | 3 +-- apps/slidingtext/slidingtext.locale.en.js | 20 +++++++++++++------- apps/slidingtext/slidingtext.settings.js | 14 ++++++++++++-- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/apps/slidingtext/slidingtext.js b/apps/slidingtext/slidingtext.js index a7d0ba05f..b945a85f4 100644 --- a/apps/slidingtext/slidingtext.js +++ b/apps/slidingtext/slidingtext.js @@ -625,8 +625,7 @@ const Locale = require('locale'); * clock working in the emulator */ class DigitDateTimeFormatter { - constructor() { - } + constructor() {} format00(num){ const value = (num | 0); diff --git a/apps/slidingtext/slidingtext.locale.en.js b/apps/slidingtext/slidingtext.locale.en.js index 73e3d23b0..140f3bb27 100644 --- a/apps/slidingtext/slidingtext.locale.en.js +++ b/apps/slidingtext/slidingtext.locale.en.js @@ -24,7 +24,7 @@ class EnglishDateFormatter extends DateFormatter { } defaultRowDefs(){ - return [ + const row_defs = [ { type: 'large', init_coords: [0.05,0.07], @@ -36,14 +36,20 @@ class EnglishDateFormatter extends DateFormatter { init_coords: [0.05,0.31], row_direction: [0.0,1.0], rows: 2 - }, - { - type: 'small', - init_coords: [0.05,0.75], - row_direction: [0.0,1.0], - rows: 2 } ]; + const bangleVersion = (g.getHeight()>200)? 1 : 2; + if(bangleVersion > 1){ + row_defs.push( + { + type: 'small', + init_coords: [0.05,0.75], + row_direction: [0.0,1.0], + rows: 2 + } + ) + }; + return row_defs; } } diff --git a/apps/slidingtext/slidingtext.settings.js b/apps/slidingtext/slidingtext.settings.js index 55b547d64..59c9ac595 100644 --- a/apps/slidingtext/slidingtext.settings.js +++ b/apps/slidingtext/slidingtext.settings.js @@ -2,12 +2,13 @@ const PREFERENCE_FILE = "slidingtext.settings.json"; const settings = Object.assign({}, require('Storage').readJSON(PREFERENCE_FILE, true) || {}); + const bangleVersion = (g.getHeight()>200)? 1 : 2; // the screen controls are defaulted on for a bangle 1 and off for a bangle 2 if(settings.enable_live_controls == null){ - settings.enable_live_controls = (g.getHeight()> 200); + settings.enable_live_controls = bangleVersion < 2; } console.log("loaded:" + JSON.stringify(settings)); - const locale_mappings = { + const locale_mappings = (bangleVersion > 1)? { 'en' : { date_formatter: 'en' }, 'en p': { date_formatter: 'en', @@ -109,7 +110,16 @@ 'es': { date_formatter: 'es'}, 'jp': { date_formatter: 'jp'}, 'dgt': { date_formatter: 'dgt'}, + } : { + 'en' : { date_formatter: 'en' }, + 'en2' : { date_formatter: 'en2' }, + 'fr': { date_formatter:'fr'}, + 'de': { date_formatter: 'de'}, + 'es': { date_formatter: 'es'}, + 'jp': { date_formatter: 'jp'}, + 'dgt': { date_formatter: 'dgt'}, } + const locales = Object.keys(locale_mappings); function writeSettings() {