Skip to content

Commit

Permalink
Added some new account icons, a helper for their names, updated the a…
Browse files Browse the repository at this point in the history
…ccount table view rows to use these, moved the splash info to a header view instead of a row, and made it all look a bit nicer.
  • Loading branch information
Harry Brundage committed Nov 13, 2010
1 parent 952925d commit 77e2d0f
Show file tree
Hide file tree
Showing 174 changed files with 322 additions and 119 deletions.
2 changes: 2 additions & 0 deletions Resources/app.js
Expand Up @@ -74,6 +74,8 @@ Ti.include('/vendor/spazcore/platforms/Titanium/helpers/sys.js');
// SpazCore setup // SpazCore setup
jQuery = Titanium.Network; jQuery = Titanium.Network;
sc.dumplevel = 999; sc.dumplevel = 999;
// Helpers
Ti.include('app/helpers/icons_helper.js');


// Citrus Specific Abstractions // Citrus Specific Abstractions
Ti.include('app/models/object.js'); Ti.include('app/models/object.js');
Expand Down
3 changes: 3 additions & 0 deletions Resources/app/controllers/main.coffee
@@ -1,3 +1,6 @@
# Helpers
Ti.include('app/helpers/icons_helper.js')

# Main controllers # Main controllers
Ti.include('app/controllers/accounts_controller.js') Ti.include('app/controllers/accounts_controller.js')
Ti.include('app/controllers/code_reader_controller.js') Ti.include('app/controllers/code_reader_controller.js')
Expand Down
1 change: 1 addition & 0 deletions Resources/app/controllers/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions Resources/app/controllers/splash_controller.coffee
Expand Up @@ -5,13 +5,14 @@ class SplashController extends Citrus.Controller
@store = accountStore @store = accountStore
@codeData = codeData @codeData = codeData
@window = new Citrus.SplashWindow(this) @window = new Citrus.SplashWindow(this)
root.tabGroup.activeTab.open @window.win, {animated:true}


this.tryToShow() root.tabGroup.activeTab.open @window.win, {animated:true}
this.tryToShow(false)


tryToShow: () -> tryToShow: (showLoading) ->
d("Trying to show "+@codeData) d("Trying to show "+@codeData)
@window.showLoading() showLoading ?= true
@window.showLoading() if showLoading


Citrus.Splash.newFromDecodedData(@codeData, (splash) => Citrus.Splash.newFromDecodedData(@codeData, (splash) =>
d("Found a splash in the decoded data, with shortcode "+splash.shortcode) d("Found a splash in the decoded data, with shortcode "+splash.shortcode)
Expand Down
9 changes: 6 additions & 3 deletions Resources/app/controllers/splash_controller.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Resources/app/helpers/icons_helper.coffee
@@ -0,0 +1,7 @@
_.extend Citrus, {
getIconPath: (name) ->
name = (name || "Generic").toLowerCase().replace("account", "").replace("action", "")
path = "images/account_icons/"+name+".png"
d(path)
return path
}
11 changes: 11 additions & 0 deletions Resources/app/helpers/icons_helper.js
@@ -0,0 +1,11 @@
(function() {
_.extend(Citrus, {
getIconPath: function(name) {
var path;
name = (name || "Generic").toLowerCase().replace("account", "").replace("action", "");
path = "images/account_icons/" + name + ".png";
d(path);
return path;
}
});
}).call(this);
2 changes: 1 addition & 1 deletion Resources/app/models/actions/action.coffee
Expand Up @@ -12,7 +12,7 @@ class Action extends Citrus.Object
@declares: [] @declares: []
@alwaysDeclared: ["actionText"] @alwaysDeclared: ["actionText"]
valid: false valid: false
icon: "images/account_icons/GenericAccount_16.png" icon: Citrus.getIconPath("generic")
actionText: "" actionText: ""


constructor: (attributes) -> constructor: (attributes) ->
Expand Down
2 changes: 1 addition & 1 deletion Resources/app/models/actions/action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -3,7 +3,7 @@ class FoursquareAction extends Citrus.AccountBasedAction
type: "FoursquareAction" type: "FoursquareAction"
buttonText: "Check In" buttonText: "Check In"
accountType: "FoursquareAccount" accountType: "FoursquareAccount"
tableViewRow: "FoursquareActionTableViewRow" tableViewRow: "AccountActionTableViewRow"


readyToRun: (account) -> readyToRun: (account) ->
unless account.isAuthorized() unless account.isAuthorized()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Resources/app/models/actions/platform/call_action.coffee
Expand Up @@ -3,6 +3,7 @@ class CallAction extends Citrus.PlatformAction


type: "PlatformCallAction" type: "PlatformCallAction"
buttonText: "Call" buttonText: "Call"
iconName: "phone"


action: (success, failure) -> action: (success, failure) ->
Titanium.Platform.openURL("tel:"+@phoneNumber) Titanium.Platform.openURL("tel:"+@phoneNumber)
Expand Down
1 change: 1 addition & 0 deletions Resources/app/models/actions/platform/call_action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Resources/app/models/actions/platform/platform_action.coffee
Expand Up @@ -2,8 +2,8 @@ class PlatformAction extends Citrus.AccountlessAction
@declares: [] @declares: []
type: "PlatformAction" type: "PlatformAction"
buttonText: "PlatformAction" buttonText: "PlatformAction"
tableViewRow: "ActionTableViewRow" tableViewRow: "PlatformActionTableViewRow"

readyToRun: () -> readyToRun: () ->
return true return true


Expand Down
2 changes: 1 addition & 1 deletion Resources/app/models/actions/platform/platform_action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -3,6 +3,7 @@ class VisitLinkAction extends Citrus.PlatformAction


type: "PlatformVisitLinkAction" type: "PlatformVisitLinkAction"
buttonText: "Safari" buttonText: "Safari"
iconName: "safari"


action: (success, failure) -> action: (success, failure) ->
Titanium.Platform.openURL(@url) Titanium.Platform.openURL(@url)
Expand Down
1 change: 1 addition & 0 deletions Resources/app/models/actions/platform/visit_link_action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Resources/app/models/actions/twitter/twitter_action.coffee
Expand Up @@ -3,7 +3,7 @@ class TwitterAction extends Citrus.AccountBasedAction
type: "TwitterAction" type: "TwitterAction"
buttonText: "TwitterAction" buttonText: "TwitterAction"
accountType: "TwitterAccount" accountType: "TwitterAccount"
tableViewRow: "TwitterActionTableViewRow" tableViewRow: "AccountActionTableViewRow"


readyToRun: (account) -> readyToRun: (account) ->
unless account.isAuthorized() unless account.isAuthorized()
Expand Down
2 changes: 1 addition & 1 deletion Resources/app/models/actions/twitter/twitter_action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Resources/app/views/accounts/account_table_view_row.coffee
Expand Up @@ -10,7 +10,7 @@ class AccountTableViewRow extends Citrus.Object
row.wrapper = this row.wrapper = this
# Add image # Add image
photo = Ti.UI.createView { photo = Ti.UI.createView {
backgroundImage: 'images/account_icons/'+@account.type+'_64.png' backgroundImage: Citrus.getIconPath(@account.type)
top:10 top:10
left:15 left:15
height: 40 height: 40
Expand Down
2 changes: 1 addition & 1 deletion Resources/app/views/accounts/account_table_view_row.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -11,7 +11,7 @@ class NewAccountSelectWindow extends Citrus.GenericWindow
data = for klass in Citrus.AccountTypes data = for klass in Citrus.AccountTypes
name = klass.prototype.type name = klass.prototype.type
item = Titanium.UI.createDashboardItem { item = Titanium.UI.createDashboardItem {
image: "images/account_icons/"+name+'_64.png' image: Citrus.getIconPath(name)
type: name type: name
label: name.replace("Account", "") label: name.replace("Account", "")
} }
Expand Down
2 changes: 1 addition & 1 deletion Resources/app/views/accounts/new_account_select_window.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,6 @@
class AccountActionTableViewRow extends Citrus.ActionRows.ActionTableViewRow
type: "AccountActionTableViewRow"
buttonText: ->
@action.buttonText

Citrus.registerActionViewRow AccountActionTableViewRow

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 14 additions & 9 deletions Resources/app/views/splash/actions/action_table_view_row.coffee
Expand Up @@ -38,10 +38,10 @@ class ActionTableViewRow extends Citrus.Object
# the style is the spinner type (which is proxied by a different object in titanium which # the style is the spinner type (which is proxied by a different object in titanium which
# barfs when it gets these option) # barfs when it gets these option)
opts = { opts = {
right:10 right:5
color: "#000" color: "#000"
width: 80 width: this.buttonWidth()
height: 20 height: 25
} }
unless shittyTI unless shittyTI
opts.style = style if style? opts.style = style if style?
Expand Down Expand Up @@ -77,16 +77,18 @@ class ActionTableViewRow extends Citrus.Object
color:'#000' color:'#000'
text: this.text() text: this.text()
font:{fontSize:16, fontWeight:'bold'} font:{fontSize:16, fontWeight:'bold'}
minimumFontSize: 12
width: (320 - 30 - this.textOffset() - this.buttonWidth())
} }
@row.add(text) @row.add(text)


displayPhoto: -> displayPhoto: ->
photo = Ti.UI.createView { photo = Ti.UI.createView {
backgroundImage: this.icon() backgroundImage: this.icon()
top: 4 top: 5
left: 4 left: 5
height: 32 height: 30
width: 32 width: 30
} }
@row.add(photo) @row.add(photo)


Expand Down Expand Up @@ -115,7 +117,7 @@ class ActionTableViewRow extends Citrus.Object
d("Error displayed") d("Error displayed")


icon: -> icon: ->
return "images/account_icons/GenericAccount_32.png" return Citrus.getIconPath(@action.accountType)


buttonText: -> buttonText: ->
return "Run" return "Run"
Expand All @@ -124,7 +126,10 @@ class ActionTableViewRow extends Citrus.Object
return @action.actionText return @action.actionText


textOffset: -> textOffset: ->
return 40 return 42
buttonWidth: ->
return 80

Citrus.ActionRows = {} Citrus.ActionRows = {}
Citrus.registerActionViewRow = (klass) -> Citrus.registerActionViewRow = (klass) ->
Citrus.ActionRows[klass::type] = klass Citrus.ActionRows[klass::type] = klass
Expand Down
25 changes: 15 additions & 10 deletions Resources/app/views/splash/actions/action_table_view_row.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1,7 +1,5 @@
class FacebookActionTableViewRow extends Citrus.ActionRows.ActionTableViewRow class FacebookActionTableViewRow extends Citrus.ActionRows.ActionTableViewRow
type: "FacebookActionTableViewRow" type: "FacebookActionTableViewRow"
icon: ->
"images/account_icons/FacebookAccount_32.png"


buttonText: -> buttonText: ->
@action.buttonText @action.buttonText
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 77e2d0f

Please sign in to comment.