aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Häggqvist <[email protected]>2015-05-29 13:02:00 +0200
committerVictor Häggqvist <[email protected]>2015-05-29 13:04:37 +0200
commite75a98aff3f12bb737d4683a2e2d2d8730f0dba9 (patch)
tree72544df402069c011c1a7a203b74c43f95f90c8d
parent23abe36fb2b9a08f86d935e50f1dcb9cb19ecebd (diff)
1.3 dump
-rw-r--r--appinfo.json6
-rw-r--r--src/battery.c23
2 files changed, 26 insertions, 3 deletions
diff --git a/appinfo.json b/appinfo.json
index 32a272f..73f3113 100644
--- a/appinfo.json
+++ b/appinfo.json
@@ -3,8 +3,8 @@
"shortName": "Battery",
"longName": "Battery Monitor",
"companyName": "Snilius",
- "versionCode": 3,
- "versionLabel": "1.2",
+ "versionCode": 4,
+ "versionLabel": "1.3",
"watchapp": {
"watchface": false
},
@@ -24,4 +24,4 @@
"basalt"
],
"sdkVersion": "3"
-} \ No newline at end of file
+}
diff --git a/src/battery.c b/src/battery.c
index 50a4d4c..390f3aa 100644
--- a/src/battery.c
+++ b/src/battery.c
@@ -1,6 +1,8 @@
#include "pebble.h"
#define TEXT_HIDDEN_KEY 1
+#define ENABLE_COLOR_KEY 2
+//#define PBL_COLOR
Window *window;
TextLayer *battery_percentage;
@@ -23,6 +25,12 @@ void battery_state_receiver(BatteryChargeState chargeState){
}
#ifdef PBL_COLOR
+// if (persist_read_bool(ENABLE_COLOR_KEY)) {
+// APP_LOG(APP_LOG_LEVEL_DEBUG, "No color setting");
+// return;
+// }
+
+
if (percent > 40) {
window_set_background_color(window, GColorDarkGreen);
@@ -46,8 +54,23 @@ void click_handler(ClickRecognizerRef recognizer, void *context) {
}
}
+void long_click_handler(ClickRecognizerRef recognizer, void *context) {
+
+ if (persist_read_bool(ENABLE_COLOR_KEY)) {
+ persist_write_bool(ENABLE_COLOR_KEY, false);
+ battery_state_receiver(battery_state_service_peek());
+ } else {
+ persist_write_bool(ENABLE_COLOR_KEY, true);
+ battery_state_receiver(battery_state_service_peek());
+ }
+
+}
+
void click_config_provider(void *context) {
window_single_click_subscribe(BUTTON_ID_SELECT, click_handler);
+//#ifdef PBL_COLOR
+// window_long_click_subscribe(BUTTON_ID_SELECT, 0, long_click_handler, NULL);
+// #endif
}
void window_load(Window *window) {