Skip to content
This repository was archived by the owner on Nov 7, 2020. It is now read-only.

Commit d83a2f5

Browse files
author
Matthew Tole
committed
Add ContentIndicator to Basalt and Chalk
1 parent 214b206 commit d83a2f5

File tree

4 files changed

+47
-5
lines changed

4 files changed

+47
-5
lines changed

appinfo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"shortName": "Hearts",
44
"longName": "Hearts",
55
"companyName": "Matthew Tole",
6-
"targetPlatforms": ["aplite", "basalt", "chalk"],
6+
"targetPlatforms": ["basalt", "chalk"],
77
"sdkVersion": "3",
88
"versionCode": 1,
99
"versionLabel": "5.0",

src/js/pebble-js-app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ module.exports = {
17781778
"shortName": "Hearts",
17791779
"longName": "Hearts",
17801780
"companyName": "Matthew Tole",
1781-
"targetPlatforms": ["aplite", "basalt", "chalk"],
1781+
"targetPlatforms": ["basalt", "chalk"],
17821782
"sdkVersion": "3",
17831783
"versionCode": 1,
17841784
"versionLabel": "5.0",

src/js/src/generated/appinfo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports = {
4040
"shortName": "Hearts",
4141
"longName": "Hearts",
4242
"companyName": "Matthew Tole",
43-
"targetPlatforms": ["aplite", "basalt", "chalk"],
43+
"targetPlatforms": ["basalt", "chalk"],
4444
"sdkVersion": "3",
4545
"versionCode": 1,
4646
"versionLabel": "5.0",

src/windows/win-main.c

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ static Window* s_window;
6868
static Layer* s_layer_count;
6969
static Layer* s_layer_name;
7070
static Layer* s_layer_dots;
71+
static Layer* s_indicator_up_layer;
72+
static Layer* s_indicator_down_layer;
7173
static AppInfo* s_app_info;
7274
static uint8_t s_app_position = 0;
7375
static uint8_t s_app_position_new = 0;
@@ -83,7 +85,8 @@ static uint16_t s_name_offset = 0;
8385
static uint8_t s_animation_direction;
8486
static uint16_t s_dot_current_x = 0;
8587
static GSize s_window_size;
86-
88+
static ContentIndicator* s_indicator_up;
89+
static ContentIndicator* s_indicator_down;
8790

8891
void win_main_init(void) {
8992
s_window = window_create();
@@ -136,9 +139,45 @@ static void window_load(Window* window) {
136139
layer_set_update_proc(s_layer_count, layer_update_count);
137140
layer_add_to_window(s_layer_count, window);
138141

139-
s_layer_dots = layer_create(GRect(0, 140, s_window_size.w, 12));
142+
s_layer_dots = layer_create(GRect(0, 120, s_window_size.w, 12));
140143
layer_set_update_proc(s_layer_dots, layer_update_dots);
141144
layer_add_to_window(s_layer_dots, window);
145+
146+
s_indicator_up_layer = layer_create(GRect(0, 0,
147+
s_window_size.w, STATUS_BAR_LAYER_HEIGHT));
148+
s_indicator_down_layer = layer_create(GRect(0, s_window_size.h - STATUS_BAR_LAYER_HEIGHT,
149+
s_window_size.w, STATUS_BAR_LAYER_HEIGHT));
150+
layer_add_child(window_get_root_layer(window), s_indicator_up_layer);
151+
layer_add_child(window_get_root_layer(window), s_indicator_down_layer);
152+
153+
s_indicator_up = content_indicator_create();
154+
const ContentIndicatorConfig up_config = (ContentIndicatorConfig) {
155+
.layer = s_indicator_up_layer,
156+
.times_out = true,
157+
.alignment = GAlignCenter,
158+
.colors = {
159+
.foreground = GColorWhite,
160+
.background = COLOR_FALLBACK(GColorDarkCandyAppleRed, GColorBlack)
161+
}
162+
};
163+
content_indicator_configure_direction(s_indicator_up, ContentIndicatorDirectionUp,
164+
&up_config);
165+
166+
s_indicator_down = content_indicator_create();
167+
const ContentIndicatorConfig down_config = (ContentIndicatorConfig) {
168+
.layer = s_indicator_down_layer,
169+
.times_out = true,
170+
.alignment = GAlignCenter,
171+
.colors = {
172+
.foreground = GColorWhite,
173+
.background = COLOR_FALLBACK(GColorDarkCandyAppleRed, GColorBlack)
174+
}
175+
};
176+
content_indicator_configure_direction(s_indicator_down, ContentIndicatorDirectionDown,
177+
&down_config);
178+
179+
content_indicator_set_content_available(s_indicator_down, ContentIndicatorDirectionDown, true);
180+
content_indicator_set_content_available(s_indicator_up, ContentIndicatorDirectionUp, false);
142181
}
143182

144183
static void window_unload(Window* window) {
@@ -161,6 +200,9 @@ static void do_transition(void) {
161200

162201
transition_animation_implementation.update = transition_animation_update;
163202
transition_animation_run(ANIMATION_DURATION, 0, &transition_animation_implementation, true);
203+
204+
content_indicator_set_content_available(s_indicator_down, ContentIndicatorDirectionDown, s_app_position < (app_info_count - 1));
205+
content_indicator_set_content_available(s_indicator_up, ContentIndicatorDirectionUp, s_app_position > 0);
164206
}
165207

166208
static void up_click_handler(ClickRecognizerRef recognizer, void *context) {

0 commit comments

Comments
 (0)