Skip to content

Commit

Permalink
Change to not animate when showing the first window
Browse files Browse the repository at this point in the history
  • Loading branch information
Meiguro committed Jun 3, 2014
1 parent 569a369 commit c098006
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 67 deletions.
10 changes: 0 additions & 10 deletions src/simply/simply_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,6 @@ void simply_menu_clear(SimplyMenu *self) {
mark_dirty(self);
}

void simply_menu_show(SimplyMenu *self) {
if (!self->window.window) {
return;
}
if (!window_stack_contains_window(self->window.window)) {
bool animated = !self->window.simply->splash;
window_stack_push(self->window.window, animated);
}
}

SimplyMenu *simply_menu_create(Simply *simply) {
SimplyMenu *self = malloc(sizeof(*self));
*self = (SimplyMenu) {
Expand Down
1 change: 0 additions & 1 deletion src/simply/simply_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ struct SimplyMenuItem {
SimplyMenu *simply_menu_create(Simply *simply);
void simply_menu_destroy(SimplyMenu *self);

void simply_menu_show(SimplyMenu *self);
void simply_menu_clear(SimplyMenu *self);

void simply_menu_set_num_sections(SimplyMenu *self, uint16_t num_sections);
Expand Down
10 changes: 2 additions & 8 deletions src/simply/simply_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,6 @@ bool simply_msg_has_communicated() {
return s_has_communicated;
}

static void check_splash(Simply *simply) {
if (simply->splash) {
simply_ui_show(simply->ui);
}
}

static SimplyWindow *get_top_simply_window(Simply *simply) {
Window *base_window = window_stack_get_top_window();
SimplyWindow *window = window_get_user_data(base_window);
Expand Down Expand Up @@ -595,10 +589,10 @@ static void sent_callback(DictionaryIterator *iter, void *context) {
static void failed_callback(DictionaryIterator *iter, AppMessageResult reason, Simply *simply) {
SimplyUi *ui = simply->ui;
if (reason == APP_MSG_NOT_CONNECTED) {
simply_ui_clear(ui, ~0);
simply_ui_set_text(ui, UiSubtitle, "Disconnected");
simply_ui_set_text(ui, UiBody, "Run the Pebble Phone App");

check_splash(simply);
simply_window_stack_show(simply->window_stack, &ui->window, true);
}
}

Expand Down
10 changes: 0 additions & 10 deletions src/simply/simply_stage.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,6 @@ static void window_unload(Window *window) {
simply_window_unload(&self->window);
}

void simply_stage_show(SimplyStage *self) {
if (!self->window.window) {
return;
}
if (!window_stack_contains_window(self->window.window)) {
bool animated = !self->window.simply->splash;
window_stack_push(self->window.window, animated);
}
}

void simply_stage_update(SimplyStage *self) {
if (self->stage_layer.layer) {
layer_mark_dirty(self->stage_layer.layer);
Expand Down
1 change: 0 additions & 1 deletion src/simply/simply_stage.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ struct SimplyAnimation {
SimplyStage *simply_stage_create(Simply *simply);
void simply_stage_destroy(SimplyStage *self);

void simply_stage_show(SimplyStage *self);
void simply_stage_clear(SimplyStage *self);

void simply_stage_update(SimplyStage *self);
Expand Down
18 changes: 3 additions & 15 deletions src/simply/simply_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ static void show_welcome_text(SimplyUi *self) {
return;
}

simply_ui_set_text(self, UiTitle, "Simply.js");
simply_ui_set_text(self, UiTitle, "Pebble.js");
simply_ui_set_text(self, UiSubtitle, "Write apps with JS!");
simply_ui_set_text(self, UiBody, "Visit simplyjs.io for details.");
simply_ui_set_text(self, UiBody, "pebble.github.io/pebblejs");

simply_ui_show(self);
simply_window_stack_show(self->window.simply->window_stack, &self->window, true);
}

static void window_load(Window *window) {
Expand Down Expand Up @@ -261,8 +261,6 @@ static void window_appear(Window *window) {
static void window_disappear(Window *window) {
SimplyUi *self = window_get_user_data(window);
simply_window_stack_send_hide(self->window.simply->window_stack, &self->window);

simply_ui_clear(self, ~0);
}

static void window_unload(Window *window) {
Expand All @@ -274,16 +272,6 @@ static void window_unload(Window *window) {
simply_window_unload(&self->window);
}

void simply_ui_show(SimplyUi *self) {
if (!self->window.window) {
return;
}
if (!window_stack_contains_window(self->window.window)) {
bool animated = !self->window.simply->splash;
window_stack_push(self->window.window, animated);
}
}

SimplyUi *simply_ui_create(Simply *simply) {
SimplyUi *self = malloc(sizeof(*self));
*self = (SimplyUi) { .window.layer = NULL };
Expand Down
2 changes: 0 additions & 2 deletions src/simply/simply_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ struct SimplyUi {
};

SimplyUi *simply_ui_create(Simply *simply);

void simply_ui_destroy(SimplyUi *self);
void simply_ui_show(SimplyUi *self);

void simply_ui_clear(SimplyUi *self, uint32_t clear_mask);

Expand Down
17 changes: 0 additions & 17 deletions src/simply/simply_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,6 @@ void simply_window_unload(SimplyWindow *self) {
self->scroll_layer = NULL;
}

void simply_window_hide(SimplyWindow *self) {
if (self->window == window_stack_get_top_window()) {
bool animated = true;
window_stack_pop(animated);
}
}

void simply_window_show(SimplyWindow *self) {
if (!self->window) {
return;
}
if (!window_stack_contains_window(self->window)) {
bool animated = true;
window_stack_push(self->window, animated);
}
}

SimplyWindow *simply_window_init(SimplyWindow *self, Simply *simply) {
self->simply = simply;

Expand Down
11 changes: 8 additions & 3 deletions src/simply/simply_window_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
#include <pebble.h>

void simply_window_stack_show(SimplyWindowStack *self, SimplyWindow *window, bool is_push) {
bool animated = (self->simply->splash == NULL);

self->is_showing = true;
window_stack_pop_all(true);
window_stack_pop_all(false);
self->is_showing = false;

Window *temp_window = NULL;
Expand All @@ -18,7 +20,7 @@ void simply_window_stack_show(SimplyWindowStack *self, SimplyWindow *window, boo
window_stack_push(temp_window, false);
}

simply_window_show(window);
window_stack_push(window->window, animated);

if (is_push) {
window_stack_remove(temp_window, false);
Expand All @@ -28,7 +30,10 @@ void simply_window_stack_show(SimplyWindowStack *self, SimplyWindow *window, boo

void simply_window_stack_pop(SimplyWindowStack *self, SimplyWindow *window) {
self->is_hiding = true;
simply_window_hide(window);
if (window->window == window_stack_get_top_window()) {
bool animated = true;
window_stack_pop(animated);
}
self->is_hiding = false;
}

Expand Down

0 comments on commit c098006

Please sign in to comment.