Skip to content

Commit

Permalink
pages wrap around
Browse files Browse the repository at this point in the history
Ex. clicking down on last page takes you to first page
  • Loading branch information
Str8AWay committed May 13, 2015
1 parent 9d900c6 commit 9de192c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ static void window_down_click_handler(ClickRecognizerRef recognizer, void *conte
uint8_t num_cards = 0;
persist_read_data(STORAGE_NUMBER_OF_CARDS, &num_cards, sizeof(num_cards));

if (num_cards > 0 && current_page < num_cards - 1) {
current_page++;
if (num_cards > 0) {
current_page = (current_page + 1) % num_cards;
update_visible_layers();
}
}
Expand All @@ -139,8 +139,11 @@ static void window_down_click_handler(ClickRecognizerRef recognizer, void *conte
static void window_up_click_handler(ClickRecognizerRef recognizer, void *context) {
if (updating) return;

if (current_page > 0) {
current_page--;
uint8_t num_cards = 0;
persist_read_data(STORAGE_NUMBER_OF_CARDS, &num_cards, sizeof(num_cards));

if (num_cards > 0) {
current_page = (current_page - 1) % num_cards;
update_visible_layers();
}
}
Expand Down

0 comments on commit 9de192c

Please sign in to comment.