Skip to content

Commit

Permalink
Loading as needed scenes.
Browse files Browse the repository at this point in the history
  • Loading branch information
inlineblock committed Dec 14, 2010
1 parent 6f89a81 commit 8bb7cd1
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/lib/Twee.List.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Twee.List = Class.create({
}

this.element.widget = this;
if (this.useStorage)
if (this.useStorage && id != "messages-view") // hack no cache
{
this.getTweets();
}
Expand Down
31 changes: 29 additions & 2 deletions app/lib/Twee.MyAccountView.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ Twee.MyAccountView = Class.create({
setup: function(id)
{
this.element = this.controller.get(id);
this.element.widget = this;
return this;
},

doSetup: function(id)
{
//this.element = this.controller.get(id);

this.myAccountActions = this.element.down('#my-account-actions');
this.myAccountActions.observe(Mojo.Event.tap , this.myAccountActionsClick);
Expand All @@ -27,16 +34,36 @@ Twee.MyAccountView = Class.create({

this.listFooter = this.element.down('#lists-list-footer');

this.element.widget = this;
//this.element.widget = this;
return this;
},

cleanup: function()
doCleanup: function()
{
this.myAccountActions.stopObserving(Mojo.Event.tap , this.myAccountActionsClick);
this.listElement.stopObserving(Mojo.Event.tap , this.listsClick);
},

cleanup: function()
{

if (this.hasBeenSetup)
{
this.doCleanup();
this.hasBeenSetup = false;
}
},

aboutToActivate: function()
{
if (!this.hasBeenSetup)
{
this.doSetup();
this.hasBeenSetup = true;
}

},

activate: function()
{
this.readjustScrollTop();
Expand Down
32 changes: 27 additions & 5 deletions app/lib/Twee.SearchView.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ Twee.SearchView = Class.create({
setup: function(id)
{
this.element = this.controller.get(id);

this.element.widget = this;
return this;
},

doSetup: function()
{
this.searchModel = {value: ""};
this.controller.controller.setupWidget('searchTerms' , {hintText: "Search Terms" , multiline: false, focus: false , textCase: Mojo.Widget.steModeLowerCase , changeOnKeyPress: true , requiresEnterKey: true} , this.searchModel);

Expand All @@ -33,8 +38,6 @@ Twee.SearchView = Class.create({
{
this.refreshIcon.observe(Mojo.Event.tap , this.refreshIconClick);
}


this.searchButton = this.controller.get('search-button');
this.searchButton.observe(Mojo.Event.tap , this.searchButtonClick);

Expand All @@ -51,11 +54,11 @@ Twee.SearchView = Class.create({
this.savedSearchesList.observe(Mojo.Event.tap , this.savedSearchesListClick);
this.savedSearchesListFooter = this.element.down('.saved-searches-list-footer');

this.element.widget = this;
this.controller.controller.instantiateChildWidgets(this.element);
return this;
},

cleanup: function(id)
doCleanup: function(id)
{
if (this.refreshIcon)
{
Expand All @@ -69,6 +72,25 @@ Twee.SearchView = Class.create({

},

cleanup: function()
{
if (this.hasBeenSetup)
{
this.doCleanup();
this.hasBeenSetup = false;
}
},

aboutToActivate: function()
{
if (!this.hasBeenSetup)
{
this.doSetup();
this.hasBeenSetup = true;
}

},

activate: function()
{
this.readjustScrollTop();
Expand Down
30 changes: 28 additions & 2 deletions app/lib/Twee.TrendView.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ Twee.TrendView = Class.create({
setup: function(id)
{
this.element = this.controller.get(id);
this.element.widget = this;
return this;
},

doSetup: function(id)
{
// this.element = this.controller.get(id);
this.refreshIcon = this.element.down('.refresh-icon');
this.refreshIcon.observe(Mojo.Event.tap , this.refreshIconClick);

Expand All @@ -40,17 +47,27 @@ Twee.TrendView = Class.create({
this.trendList.observe(Mojo.Event.tap , this.trendListClick);
this.urlTrendList.observe(Mojo.Event.tap , this.urlTrendListClick);

this.element.widget = this;
// this.element.widget = this;
return this;
},

cleanup: function()
doCleanup: function()
{
this.refreshIcon.stopObserving(Mojo.Event.tap , this.refreshIconClick);
this.trendList.stopObserving(Mojo.Event.tap , this.trendListClick);
this.urlTrendList.stopObserving(Mojo.Event.tap , this.urlTrendListClick);
},

cleanup: function()
{

if (this.hasBeenSetup)
{
this.doCleanup();
this.hasBeenSetup = false;
}
},

activate: function()
{
this.readjustScrollTop();
Expand All @@ -65,6 +82,15 @@ Twee.TrendView = Class.create({
this.setOptions();
},

aboutToActivate: function()
{
if (!this.hasBeenSetup)
{
this.doSetup();
this.hasBeenSetup = true;
}
},

refreshLists: function()
{
if (!this.element.hasClassName(this.loadingTweetsClassName))
Expand Down

0 comments on commit 8bb7cd1

Please sign in to comment.