Compare commits

..

3 Commits

2 changed files with 17 additions and 16 deletions
+1
View File
@@ -6,6 +6,7 @@ A customizable replacement for the built-in Pebble action bar.
- Floating mode
- Rectangular mode on round watches
- Adjustable spread (distance between icons)
- New max icon size (unlimited width; 25px height)
- Custom corner radius
- Custom width
- Custom height
+16 -16
View File
@@ -6,24 +6,24 @@
#if PBL_DISPLAY_WIDTH >= 260 && PBL_ROUND
const int8_t ICON_X_OFFSET = -1;
const uint16_t UP_Y = 80;
const uint16_t SELECT_Y = 121;
const uint16_t DOWN_Y = 162;
const uint16_t UP_Y = 76;
const uint16_t SELECT_Y = 118;
const uint16_t DOWN_Y = 158;
#elif PBL_DISPLAY_WIDTH >= 200 && PBL_RECT
const int8_t ICON_X_OFFSET = 0;
const uint16_t UP_Y = 45;
const uint16_t SELECT_Y = 105;
const uint16_t DOWN_Y = 165;
const uint16_t UP_Y = 41;
const uint16_t SELECT_Y = 102;
const uint16_t DOWN_Y = 161;
#elif PBL_DISPLAY_WIDTH >= 180 && PBL_ROUND
const int8_t ICON_X_OFFSET = -1;
const uint16_t UP_Y = 53;
const uint16_t SELECT_Y = 81;
const uint16_t DOWN_Y = 109;
const uint16_t UP_Y = 49;
const uint16_t SELECT_Y = 78;
const uint16_t DOWN_Y = 105;
#else // all 144x168 watches
const int8_t ICON_X_OFFSET = 0;
const uint16_t UP_Y = 30;
const uint16_t SELECT_Y = 75;
const uint16_t DOWN_Y = 121;
const uint16_t UP_Y = 26;
const uint16_t SELECT_Y = 72;
const uint16_t DOWN_Y = 117;
#endif
static const GRect s_base_grect_rect = GRect(PBL_DISPLAY_WIDTH - ACTION_BAR_WIDTH, 0, ACTION_BAR_WIDTH, PBL_DISPLAY_HEIGHT);
@@ -126,15 +126,15 @@ static void s_recenter_icons(NeatBarLayer *neat_bar) {
int8_t spread = neat_bar->spread;
if (neat_bar->up_layer) {
layer_set_frame(bitmap_layer_get_layer(neat_bar->up_layer),
GRect(ICON_X_OFFSET, UP_Y - spread - y_offset, neat_bar->main_grect.size.w, 18));
GRect(ICON_X_OFFSET, UP_Y - spread - y_offset, neat_bar->main_grect.size.w, 25));
}
if (neat_bar->select_layer) {
layer_set_frame(bitmap_layer_get_layer(neat_bar->select_layer),
GRect(ICON_X_OFFSET, SELECT_Y - y_offset, neat_bar->main_grect.size.w, 18));
GRect(ICON_X_OFFSET, SELECT_Y - y_offset, neat_bar->main_grect.size.w, 25));
}
if (neat_bar->down_layer) {
layer_set_frame(bitmap_layer_get_layer(neat_bar->down_layer),
GRect(ICON_X_OFFSET, DOWN_Y + spread - y_offset, neat_bar->main_grect.size.w, 18));
GRect(ICON_X_OFFSET, DOWN_Y + spread - y_offset, neat_bar->main_grect.size.w, 25));
}
}
@@ -257,7 +257,7 @@ void neat_bar_layer_set_icon(NeatBarLayer *neat_bar, ButtonId button_id, GBitmap
int16_t adjusted_y = (button_id == BUTTON_ID_UP) ? y_pos - neat_bar->spread
: (button_id == BUTTON_ID_DOWN) ? y_pos + neat_bar->spread
: y_pos;
current_bitmap_layer = bitmap_layer_create(GRect(ICON_X_OFFSET, adjusted_y, neat_bar->main_grect.size.w, 18));
current_bitmap_layer = bitmap_layer_create(GRect(ICON_X_OFFSET, adjusted_y, neat_bar->main_grect.size.w, 25));
layer_add_child(neat_bar->main_layer, bitmap_layer_get_layer(current_bitmap_layer));
switch (button_id) {
case BUTTON_ID_UP: