sliding clock: separated out v1 and v2 faces

master
adrian w kirk 2022-10-08 23:02:18 +01:00
parent 804f308af1
commit c3cccde249
3 changed files with 26 additions and 11 deletions

View File

@ -625,8 +625,7 @@ const Locale = require('locale');
* clock working in the emulator * clock working in the emulator
*/ */
class DigitDateTimeFormatter { class DigitDateTimeFormatter {
constructor() { constructor() {}
}
format00(num){ format00(num){
const value = (num | 0); const value = (num | 0);

View File

@ -24,7 +24,7 @@ class EnglishDateFormatter extends DateFormatter {
} }
defaultRowDefs(){ defaultRowDefs(){
return [ const row_defs = [
{ {
type: 'large', type: 'large',
init_coords: [0.05,0.07], init_coords: [0.05,0.07],
@ -36,14 +36,20 @@ class EnglishDateFormatter extends DateFormatter {
init_coords: [0.05,0.31], init_coords: [0.05,0.31],
row_direction: [0.0,1.0], row_direction: [0.0,1.0],
rows: 2 rows: 2
}, }
];
const bangleVersion = (g.getHeight()>200)? 1 : 2;
if(bangleVersion > 1){
row_defs.push(
{ {
type: 'small', type: 'small',
init_coords: [0.05,0.75], init_coords: [0.05,0.75],
row_direction: [0.0,1.0], row_direction: [0.0,1.0],
rows: 2 rows: 2
} }
]; )
};
return row_defs;
} }
} }

View File

@ -2,12 +2,13 @@
const PREFERENCE_FILE = "slidingtext.settings.json"; const PREFERENCE_FILE = "slidingtext.settings.json";
const settings = Object.assign({}, const settings = Object.assign({},
require('Storage').readJSON(PREFERENCE_FILE, true) || {}); 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 // the screen controls are defaulted on for a bangle 1 and off for a bangle 2
if(settings.enable_live_controls == null){ 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)); console.log("loaded:" + JSON.stringify(settings));
const locale_mappings = { const locale_mappings = (bangleVersion > 1)? {
'en' : { date_formatter: 'en' }, 'en' : { date_formatter: 'en' },
'en p': { 'en p': {
date_formatter: 'en', date_formatter: 'en',
@ -109,7 +110,16 @@
'es': { date_formatter: 'es'}, 'es': { date_formatter: 'es'},
'jp': { date_formatter: 'jp'}, 'jp': { date_formatter: 'jp'},
'dgt': { date_formatter: 'dgt'}, '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); const locales = Object.keys(locale_mappings);
function writeSettings() { function writeSettings() {