XEN style! :D
|
@ -3,7 +3,7 @@
|
||||||
"shortName": null,
|
"shortName": null,
|
||||||
"longName": null,
|
"longName": null,
|
||||||
"companyName": null,
|
"companyName": null,
|
||||||
"versionLabel": null,
|
"versionLabel": "1.2",
|
||||||
"sdkVersion": "3",
|
"sdkVersion": "3",
|
||||||
"targetPlatforms": ["basalt"],
|
"targetPlatforms": ["basalt"],
|
||||||
"watchapp": {
|
"watchapp": {
|
||||||
|
@ -13,13 +13,23 @@
|
||||||
"media": [
|
"media": [
|
||||||
{
|
{
|
||||||
"type": "png",
|
"type": "png",
|
||||||
"name": "IMG_BACKGROUND",
|
"name": "IMG_BKG_CLASSIC_NARROW",
|
||||||
"file": "xen.png"
|
"file": "bkg_classic_narrow.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "png",
|
"type": "png",
|
||||||
"name": "IMG_BACKGROUND_WIDE",
|
"name": "IMG_BKG_CLASSIC_WIDE",
|
||||||
"file": "background_wide.png"
|
"file": "bkg_classic_wide.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "png",
|
||||||
|
"name": "IMG_BKG_XEN_NARROW",
|
||||||
|
"file": "bkg_xen_narrow.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "png",
|
||||||
|
"name": "IMG_BKG_XEN_WIDE",
|
||||||
|
"file": "bkg_xen_wide.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "png",
|
"type": "png",
|
||||||
|
@ -40,6 +50,7 @@
|
||||||
"KEY_SECONDS_HAND": 0,
|
"KEY_SECONDS_HAND": 0,
|
||||||
"KEY_BATTERY_INDICATOR": 1,
|
"KEY_BATTERY_INDICATOR": 1,
|
||||||
"KEY_DATE_FORMAT": 2,
|
"KEY_DATE_FORMAT": 2,
|
||||||
"KEY_WIDE_LAYOUT": 3
|
"KEY_WIDE_LAYOUT": 3,
|
||||||
|
"KEY_XEN_STYLE": 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,20 +11,12 @@
|
||||||
<body>
|
<body>
|
||||||
<form id="main-form">
|
<form id="main-form">
|
||||||
<div class="item-container">
|
<div class="item-container">
|
||||||
<div class="item-container-header">Features</div>
|
<div class="item-container-header">Time & Date</div>
|
||||||
<div class="item-container-content">
|
<div class="item-container-content">
|
||||||
<label class="item">
|
<label class="item">
|
||||||
Seconds Hand
|
Seconds Hand
|
||||||
<input id="input-seconds-hand" type="checkbox" class="item-toggle" name="seconds-hand" checked>
|
<input id="input-seconds-hand" type="checkbox" class="item-toggle" name="seconds-hand" checked>
|
||||||
</label>
|
</label>
|
||||||
<label class="item">
|
|
||||||
Battery Indicator
|
|
||||||
<input id="input-battery-indicator" type="checkbox" class="item-toggle" name="battery-indicator" checked>
|
|
||||||
</label>
|
|
||||||
<label class="item">
|
|
||||||
Wide Window
|
|
||||||
<input id="input-wide-layout" type="checkbox" class="item-toggle" name="wide-layout">
|
|
||||||
</label>
|
|
||||||
<label class="item">
|
<label class="item">
|
||||||
Date Format
|
Date Format
|
||||||
<select id="input-date-format" name="date-format" class="item-select">
|
<select id="input-date-format" name="date-format" class="item-select">
|
||||||
|
@ -37,6 +29,24 @@
|
||||||
<div class="item-container-footer">Disable the seconds hand to reduce battery use.</div>
|
<div class="item-container-footer">Disable the seconds hand to reduce battery use.</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="item-container">
|
||||||
|
<div class="item-container-header">Appearance</div>
|
||||||
|
<div class="item-container-content">
|
||||||
|
<label class="item">
|
||||||
|
Battery Indicator
|
||||||
|
<input id="input-battery-indicator" type="checkbox" class="item-toggle" name="battery-indicator" checked>
|
||||||
|
</label>
|
||||||
|
<label class="item">
|
||||||
|
Wide Window
|
||||||
|
<input id="input-wide-layout" type="checkbox" class="item-toggle" name="wide-layout">
|
||||||
|
</label>
|
||||||
|
<label class="item">
|
||||||
|
XEN Style
|
||||||
|
<input id="input-xen-style" type="checkbox" class="item-toggle" name="xen-style">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="item-container">
|
<div class="item-container">
|
||||||
<div class="button-container">
|
<div class="button-container">
|
||||||
<input id="button-submit" type="button" class="item-button" value="SAVE">
|
<input id="button-submit" type="button" class="item-button" value="SAVE">
|
||||||
|
@ -50,13 +60,15 @@
|
||||||
var input_seconds_hand = document.getElementById('input-seconds-hand'),
|
var input_seconds_hand = document.getElementById('input-seconds-hand'),
|
||||||
input_battery_indicator = document.getElementById('input-battery-indicator'),
|
input_battery_indicator = document.getElementById('input-battery-indicator'),
|
||||||
input_date_format = document.getElementById('input-date-format'),
|
input_date_format = document.getElementById('input-date-format'),
|
||||||
input_wide_layout = document.getElementById('input-wide-layout');
|
input_wide_layout = document.getElementById('input-wide-layout'),
|
||||||
|
input_xen_style = document.getElementById('input-xen-style');
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
'seconds_hand': input_seconds_hand.checked,
|
'seconds_hand': input_seconds_hand.checked,
|
||||||
'battery_indicator': input_battery_indicator.checked,
|
'battery_indicator': input_battery_indicator.checked,
|
||||||
'date_format': input_date_format.value,
|
'date_format': input_date_format.value,
|
||||||
'wide_layout': input_wide_layout.checked
|
'wide_layout': input_wide_layout.checked,
|
||||||
|
'xen_style': input_xen_style.checked
|
||||||
};
|
};
|
||||||
|
|
||||||
// Save for next launch
|
// Save for next launch
|
||||||
|
@ -64,8 +76,9 @@
|
||||||
localStorage['battery_indicator'] = options['battery_indicator'];
|
localStorage['battery_indicator'] = options['battery_indicator'];
|
||||||
localStorage['date_format'] = options['date_format'];
|
localStorage['date_format'] = options['date_format'];
|
||||||
localStorage['wide_layout'] = options['wide_layout'];
|
localStorage['wide_layout'] = options['wide_layout'];
|
||||||
|
localStorage['xen_style'] = options['xen_style'];
|
||||||
|
|
||||||
console.log('Got options: ' + JSON.stringify(options));
|
// console.log('Got options: ' + JSON.stringify(options));
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +98,7 @@
|
||||||
|
|
||||||
var button_submit = document.getElementById('button-submit');
|
var button_submit = document.getElementById('button-submit');
|
||||||
button_submit.addEventListener('click', function() {
|
button_submit.addEventListener('click', function() {
|
||||||
console.log('Submit');
|
// console.log('Submit');
|
||||||
|
|
||||||
// Set the return URL depending on the runtime environment
|
// Set the return URL depending on the runtime environment
|
||||||
var return_to = getQueryParam('return_to', 'pebblejs://close#');
|
var return_to = getQueryParam('return_to', 'pebblejs://close#');
|
||||||
|
@ -96,7 +109,8 @@
|
||||||
var input_seconds_hand = document.getElementById('input-seconds-hand'),
|
var input_seconds_hand = document.getElementById('input-seconds-hand'),
|
||||||
input_battery_indicator = document.getElementById('input-battery-indicator'),
|
input_battery_indicator = document.getElementById('input-battery-indicator'),
|
||||||
input_date_format = document.getElementById('input-date-format'),
|
input_date_format = document.getElementById('input-date-format'),
|
||||||
input_wide_layout = document.getElementById('input-wide-layout');
|
input_wide_layout = document.getElementById('input-wide-layout'),
|
||||||
|
input_xen_style = document.getElementById('input-xen-style');
|
||||||
|
|
||||||
if (localStorage['seconds_hand']) {
|
if (localStorage['seconds_hand']) {
|
||||||
input_seconds_hand.checked = JSON.parse(localStorage['seconds_hand']);
|
input_seconds_hand.checked = JSON.parse(localStorage['seconds_hand']);
|
||||||
|
@ -113,6 +127,10 @@
|
||||||
if (localStorage['wide_layout']) {
|
if (localStorage['wide_layout']) {
|
||||||
input_wide_layout.checked = JSON.parse(localStorage['wide_layout']);
|
input_wide_layout.checked = JSON.parse(localStorage['wide_layout']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (localStorage['xen_style']) {
|
||||||
|
input_xen_style.checked = JSON.parse(localStorage['xen_style']);
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB |
BIN
resources/bkg_classic_narrow.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/bkg_classic_wide.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
BIN
resources/bkg_xen_wide.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
|
@ -40,6 +40,7 @@ static bool hide_seconds_hand = false;
|
||||||
static bool hide_battery_indicator = false;
|
static bool hide_battery_indicator = false;
|
||||||
static char date_format[2];
|
static char date_format[2];
|
||||||
static bool use_wide_layout = false;
|
static bool use_wide_layout = false;
|
||||||
|
static bool use_xen_style = false;
|
||||||
|
|
||||||
static const GPathInfo MINUTE_HAND_POINTS = {
|
static const GPathInfo MINUTE_HAND_POINTS = {
|
||||||
4,
|
4,
|
||||||
|
@ -71,6 +72,7 @@ static const GPathInfo HOUR_HAND_POINTS = {
|
||||||
#define KEY_BATTERY_INDICATOR 1
|
#define KEY_BATTERY_INDICATOR 1
|
||||||
#define KEY_DATE_FORMAT 2
|
#define KEY_DATE_FORMAT 2
|
||||||
#define KEY_WIDE_LAYOUT 3
|
#define KEY_WIDE_LAYOUT 3
|
||||||
|
#define KEY_XEN_STYLE 4
|
||||||
|
|
||||||
static void update_date_text_layer() {
|
static void update_date_text_layer() {
|
||||||
static char date_text[DATE_TEXT_SIZE];
|
static char date_text[DATE_TEXT_SIZE];
|
||||||
|
@ -205,17 +207,27 @@ static void update_geometry() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_wide_layout == false) {
|
if (use_wide_layout == false) {
|
||||||
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMG_BACKGROUND);
|
if (use_xen_style == false) {
|
||||||
|
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMG_BKG_CLASSIC_NARROW);
|
||||||
|
} else {
|
||||||
|
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMG_BKG_XEN_NARROW);
|
||||||
|
}
|
||||||
|
|
||||||
layer_set_frame(text_layer_get_layer(s_title_layer), GRect(36, 2, 46, 18));
|
layer_set_frame(text_layer_get_layer(s_title_layer), GRect(36, 2, 46, 18));
|
||||||
layer_set_frame(text_layer_get_layer(s_date_layer), GRect(17, 130, 109, 16));
|
layer_set_frame(text_layer_get_layer(s_date_layer), GRect(17, 130, 109, 16));
|
||||||
layer_set_frame(text_layer_get_layer(s_ampm_layer), GRect(107, 26, 16, 16));
|
layer_set_frame(text_layer_get_layer(s_ampm_layer), GRect(108, 26, 16, 16));
|
||||||
layer_set_frame(bitmap_layer_get_layer(s_battery_icon_layer), GRect(20, 26, 16, 7));
|
layer_set_frame(bitmap_layer_get_layer(s_battery_icon_layer), GRect(20, 26, 16, 7));
|
||||||
layer_set_frame(s_battery_indicator_layer, GRect(21, 27, 13, 5));
|
layer_set_frame(s_battery_indicator_layer, GRect(21, 27, 13, 5));
|
||||||
} else {
|
} else {
|
||||||
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMG_BACKGROUND_WIDE);
|
if (use_xen_style == false) {
|
||||||
|
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMG_BKG_CLASSIC_WIDE);
|
||||||
|
} else {
|
||||||
|
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMG_BKG_XEN_WIDE);
|
||||||
|
}
|
||||||
|
|
||||||
layer_set_frame(text_layer_get_layer(s_title_layer), GRect(24, 2, 71, 18));
|
layer_set_frame(text_layer_get_layer(s_title_layer), GRect(24, 2, 71, 18));
|
||||||
layer_set_frame(text_layer_get_layer(s_date_layer), GRect(4, 130, 136, 16));
|
layer_set_frame(text_layer_get_layer(s_date_layer), GRect(4, 130, 136, 16));
|
||||||
layer_set_frame(text_layer_get_layer(s_ampm_layer), GRect(122, 25, 16, 16));
|
layer_set_frame(text_layer_get_layer(s_ampm_layer), GRect(123, 25, 16, 16));
|
||||||
layer_set_frame(bitmap_layer_get_layer(s_battery_icon_layer), GRect(7, 26, 16, 7));
|
layer_set_frame(bitmap_layer_get_layer(s_battery_icon_layer), GRect(7, 26, 16, 7));
|
||||||
layer_set_frame(s_battery_indicator_layer, GRect(8, 27, 13, 5));
|
layer_set_frame(s_battery_indicator_layer, GRect(8, 27, 13, 5));
|
||||||
}
|
}
|
||||||
|
@ -264,6 +276,18 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
persist_write_bool(KEY_WIDE_LAYOUT, use_wide_layout);
|
persist_write_bool(KEY_WIDE_LAYOUT, use_wide_layout);
|
||||||
|
|
||||||
|
// Handling xen_style setting.
|
||||||
|
Tuple *xen_style_t = dict_find(iter, KEY_XEN_STYLE);
|
||||||
|
if (xen_style_t && xen_style_t->value->int32 > 0) {
|
||||||
|
use_xen_style = true;
|
||||||
|
} else {
|
||||||
|
use_xen_style = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
persist_write_bool(KEY_XEN_STYLE, use_xen_style);
|
||||||
|
|
||||||
|
// Updating geometry according to settings.
|
||||||
update_geometry();
|
update_geometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,8 +346,9 @@ static void main_window_load(Window *window) {
|
||||||
layer_set_update_proc(s_battery_indicator_layer, s_battery_indicator_layer_update);
|
layer_set_update_proc(s_battery_indicator_layer, s_battery_indicator_layer_update);
|
||||||
layer_add_child(window_layer, s_battery_indicator_layer);
|
layer_add_child(window_layer, s_battery_indicator_layer);
|
||||||
|
|
||||||
// Update geometry according to wide_layout setting.
|
// Update geometry according to wide_layout and xen_style settings.
|
||||||
use_wide_layout = persist_read_bool(KEY_WIDE_LAYOUT);
|
use_wide_layout = persist_read_bool(KEY_WIDE_LAYOUT);
|
||||||
|
use_xen_style = persist_read_bool(KEY_XEN_STYLE);
|
||||||
update_geometry();
|
update_geometry();
|
||||||
|
|
||||||
// Read date_format setting from persistent storage.
|
// Read date_format setting from persistent storage.
|
||||||
|
|
|
@ -24,19 +24,21 @@
|
||||||
// });
|
// });
|
||||||
|
|
||||||
Pebble.addEventListener('showConfiguration', function(e) {
|
Pebble.addEventListener('showConfiguration', function(e) {
|
||||||
Pebble.openURL('http://127.0.0.1/u/bilbo/pebble/iclock/index.html');
|
Pebble.openURL('http://192.168.1.113/u/bilbo/pebble/iclock/index.html');
|
||||||
|
// Pebble.openURL('http://127.0.0.1/u/bilbo/pebble/iclock/index.html');
|
||||||
// Pebble.openURL('https://pconf.bthlabs.pl/intuiclock/index.html');
|
// Pebble.openURL('https://pconf.bthlabs.pl/intuiclock/index.html');
|
||||||
});
|
});
|
||||||
|
|
||||||
Pebble.addEventListener('webviewclosed', function(e) {
|
Pebble.addEventListener('webviewclosed', function(e) {
|
||||||
var config_data = JSON.parse(decodeURIComponent(e.response));
|
var config_data = JSON.parse(decodeURIComponent(e.response));
|
||||||
// console.log('Configuration page returned: ' + JSON.stringify(config_data));
|
console.log('Configuration page returned: ' + JSON.stringify(config_data));
|
||||||
|
|
||||||
var dict = {};
|
var dict = {};
|
||||||
dict['KEY_SECONDS_HAND'] = config_data['seconds_hand'];
|
dict['KEY_SECONDS_HAND'] = config_data['seconds_hand'];
|
||||||
dict['KEY_BATTERY_INDICATOR'] = config_data['battery_indicator'];
|
dict['KEY_BATTERY_INDICATOR'] = config_data['battery_indicator'];
|
||||||
dict['KEY_DATE_FORMAT'] = config_data['date_format'];
|
dict['KEY_DATE_FORMAT'] = config_data['date_format'];
|
||||||
dict['KEY_WIDE_LAYOUT'] = config_data['wide_layout'];
|
dict['KEY_WIDE_LAYOUT'] = config_data['wide_layout'];
|
||||||
|
dict['KEY_XEN_STYLE'] = config_data['xen_style'];
|
||||||
|
|
||||||
Pebble.sendAppMessage(dict, function() {
|
Pebble.sendAppMessage(dict, function() {
|
||||||
// console.log('Send successful!');
|
// console.log('Send successful!');
|
||||||
|
|