Implement per-album shuffling
This commit is contained in:
1 parent
edd6c8fec3
commit
cd4f5eebb1
1 file changed
+19
-4
+19
-4
@@ -33,8 +33,9 @@ typedef struct {
|
||||
#define MARGIN_Y 5
|
||||
#endif
|
||||
#endif
|
||||
#define SHUFFLE_SONGS "Shuffle Songs"
|
||||
static const GRect s_menu_grect = GRect(MARGIN_X, BAR_HEIGHT + MARGIN_Y, PBL_DISPLAY_WIDTH - (MARGIN_X * 2), PBL_DISPLAY_HEIGHT - (MARGIN_Y * 2));
|
||||
static const char *s_main_menu_options[4] = {"Shuffle Songs", "Shuffle Artists", "> All Artists", "> Search Artists"};
|
||||
static const char *s_main_menu_options[4] = {SHUFFLE_SONGS, "Shuffle Artists", "> All Artists", "> Search Artists"};
|
||||
|
||||
// layer-age
|
||||
static Window *s_main_window;
|
||||
@@ -238,7 +239,9 @@ static uint16_t menu_get_num_rows(MenuLayer *menu_layer, uint16_t section_index,
|
||||
case NAV_SCOPE_MAIN:
|
||||
return 4;
|
||||
case NAV_SCOPE_ALBUMS:
|
||||
return s_menu_items_count + 2;
|
||||
return s_menu_items_count + 2; // account for shuffle buttons insertion
|
||||
case NAV_SCOPE_ALBUM_TRACKS:
|
||||
return s_menu_items_count + 1; // account for shuffle button insertion
|
||||
default:
|
||||
return s_menu_items_count;
|
||||
}
|
||||
@@ -252,7 +255,7 @@ static void menu_draw_row(GContext *ctx, const Layer *cell_layer, MenuIndex *cel
|
||||
case NAV_SCOPE_ALBUMS:
|
||||
switch (cell_index->row) {
|
||||
case 0:
|
||||
custom_menu_cell_title_draw(ctx, cell_layer, "Shuffle Songs", NULL, s_font_chicago, MARGIN_X);
|
||||
custom_menu_cell_title_draw(ctx, cell_layer, SHUFFLE_SONGS, NULL, s_font_chicago, MARGIN_X);
|
||||
break;
|
||||
case 1:
|
||||
custom_menu_cell_title_draw(ctx, cell_layer, "Shuffle Albums", NULL, s_font_chicago, MARGIN_X);
|
||||
@@ -261,6 +264,13 @@ static void menu_draw_row(GContext *ctx, const Layer *cell_layer, MenuIndex *cel
|
||||
custom_menu_cell_title_draw(ctx, cell_layer, s_current_menu_vanity[cell_index->row - 2], NULL, s_font_chicago, MARGIN_X);
|
||||
}
|
||||
break;
|
||||
case NAV_SCOPE_ALBUM_TRACKS:
|
||||
if (cell_index->row == 0) {
|
||||
custom_menu_cell_title_draw(ctx, cell_layer, SHUFFLE_SONGS, NULL, s_font_chicago, MARGIN_X);
|
||||
} else {
|
||||
custom_menu_cell_title_draw(ctx, cell_layer, s_current_menu_vanity[cell_index->row - 1], NULL, s_font_chicago, MARGIN_X);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
custom_menu_cell_title_draw(ctx, cell_layer, s_current_menu_vanity[cell_index->row], NULL, s_font_chicago, MARGIN_X);
|
||||
}
|
||||
@@ -303,7 +313,12 @@ static void menu_select_click(struct MenuLayer *menu_layer, MenuIndex *clicked_i
|
||||
}
|
||||
break;
|
||||
case NAV_SCOPE_ALBUM_TRACKS:
|
||||
to_pkjs_play_from_track(s_current_menu_seq_ids[clicked_index->row]);
|
||||
if (clicked_index->row == 0) {
|
||||
to_pkjs_shuffle_in_scope(s_current_menu_scope, true, false);
|
||||
} else {
|
||||
uint16_t track_row = clicked_index->row - 1;
|
||||
to_pkjs_play_from_track(s_current_menu_seq_ids[track_row]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user