Permalink
Browse files

Showing off shims

  • Loading branch information...
1 parent 1249b51 commit 7dd4c0d56991916ae2470ed87e2daa019f10deda Jacob Waller committed Sep 18, 2011
View
@@ -2,14 +2,22 @@ Ti.include("/kranium/lib/kranium.js");
K.initBackbone();
+K.settings.useCustomAndroidNavBar = true;
+
K({
type: 'tabgroup',
tabs: [{
- title: 'Backbone',
+ title: 'Shims',
window: {
- type: 'backbonedemo2'
+ type: 'shims'
}
},{
+ title: 'Backbone',
+ window: {
+ type: 'backbonedemo'
+ }
+ },
+ {
title: 'Coffee',
window: {
title: 'Coffee Demo',
@@ -18,21 +26,21 @@ K({
text: 'What goes around'
}]
}
- },{
- title: 'Jade',
- window: {
- title: 'Jade Demo',
- children: [
- K.jade('test.jade', {
- users: {
- jacob: 'yeah',
- david: 'what',
- conny: 'hi',
- aida: 'hello',
- calle: 'yup'
- }
- })
- ]
- }
- }]
+ }].concat(K.is.ios ? [{
+ title: 'Jade',
+ window: {
+ title: 'Jade Demo',
+ children: [
+ K.jade('test.jade', {
+ users: {
+ jacob: 'yeah',
+ david: 'what',
+ conny: 'hi',
+ aida: 'hello',
+ calle: 'yup'
+ }
+ })
+ ]
+ }
+ }] : [])
}).open();
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -3301,7 +3301,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/
/*** ANDROIDSHIM ***/
(function(){
-if(K.is.android){
+if(true || K.is.android){
K.style('kranium/lib/kss/androidshim.kss');
View
@@ -1,7 +1,13 @@
window {
background-color: #fff;
+ bar-color: #23aaff;
}
+.toolbar {
+ background-color: #555;
+}
+
+
.board {
top: 10;
left: 10;
File renamed without changes.
@@ -1,74 +1,65 @@
+exports.Class = Window.extend({
+ navBarHidden: true,
+ init: function(o){
+
+ RowModel = Backbone.Model.extend({
+ type: 'tableviewrow'
+ });
+ RowCollection = Backbone.Collection.extend({
+ // Reference to this collection's model.
+ model: RowModel,
+ comparator: function(model) {
+ return model.get("title");
+ }
+ });
+ // Global on purpose since Titanium cannot handle collections on elements
+ todos = new RowCollection();
+ todos.add([
+ { title: "An example todo" },
+ { title: "Another example todo" },
+ ]);
-//todos.fetch();
-
-exports.Class = BackboneView.extend({
- type: 'tableview',
- //editing:true,
- editable: true,
- //moveable:false,
- //data: []
+ var todolist = this.todolist = K.create({
+ type: 'todolist',
+ collection: todos
+ });
- events: {
- "delete": function(e){
- K.log('delete', e);
- var model = todos.get(e.rowData._modelId) || todos.getByCid(e.rowData._modelCid);
- K.log(['modeeel', !!model]);
- todos.remove(model);
- //model.destroy();
- }
- }
-
- //collection: todos
- /*collection: todos,
- data: [],
- onAddClick: function(e){
- var todo = new RowModel({
- title: 'test',
- created: Date.now()
+ this.titleLabel = K.createLabel({
+ className: 'titleLabel'
});
- todos.add(todo);
- todo.save();
- },
- click: function(e){
- K.log(e.rowData._modelId)
- var model = todos.get(e.rowData._modelId);
- //K.log('clickety', model.attributes);
- model.set({ hasCheck: !model.get('hasCheck') });
- model.save();
-
- },
- events: {
- app: {
- backbonewindowadd: 'onAddClick'
- },
+ todos.bind('all', this.updateTitleLabel.bind(this));
+ this.updateTitleLabel();
+
+ this.children = [{
+ type: 'toolbar',
+ className: 'todoToolbar',
+ items: [{
+ type: 'textfield',
+ className: 'todoInputTextField',
+ events: {
+ "return": function(e){
+ todos.add({
+ title: e.value
+ });
+ }
+ }
+ },
+ 'spacer',
+ this.titleLabel]
+ }, todolist];
- "delete": function(e){
- K.log('delete', e);
- var model = todos.get(e.rowData._modelId);
- todos.remove(model);
- //model.destroy();
- },
- "move": function(e){
- if(e.fromIndex == e.index){ return; }
- var r,
- row = e.row,
- rows = this.data[0].rows,
- index = e.index,
- between = ((after = ((r = rows[index+1]) ? r.order : row.order+1)) - (before = ((r = rows[index-1]) ? r.order : row.order-1)))/2,
- model = todos.get(e.rowData._modelId);
-
- K.log([index, before, between, after])
-
- model.set({ order: between });
- model.save();
- //K.log(_(rows).pluck('order'), between);
-
- }
- }*/
+ this._super(o);
+ },
+
+ updateTitleLabel: function(){
+ var completed = todos.pluck('hasCheck').filter(function(val){ return !!val }).length;
+ this.titleLabel.text = completed + ' / ' + todos.length + ' todos';
+ }
+
});
@@ -1,65 +0,0 @@
-
-exports.Class = Window.extend({
- navBarHidden: true,
- init: function(o){
-
- RowModel = Backbone.Model.extend({
- type: 'tableviewrow'
- });
-
- RowCollection = Backbone.Collection.extend({
- // Reference to this collection's model.
- model: RowModel,
- comparator: function(model) {
- return model.get("title");
- }
- });
-
- // Global on purpose since Titanium cannot handle collections on elements
- todos = new RowCollection();
- todos.add([
- { title: "An example todo" },
- { title: "Another example todo" },
- ]);
-
- var todolist = this.todolist = K.create({
- type: 'todolist',
- collection: todos
- });
-
- this.titleLabel = K.createLabel({
- className: 'titleLabel'
- });
-
- todos.bind('all', this.updateTitleLabel.bind(this));
- this.updateTitleLabel();
-
- this.children = [{
- type: 'toolbar',
- className: 'todoToolbar',
- items: [{
- type: 'textfield',
- className: 'todoInputTextField',
- events: {
- "return": function(e){
- todos.add({
- title: e.value
- });
- }
- }
- },
- 'spacer',
- this.titleLabel]
- }, todolist];
-
-
- this._super(o);
- },
-
- updateTitleLabel: function(){
- var completed = todos.pluck('hasCheck').filter(function(val){ return !!val }).length;
- this.titleLabel.text = completed + ' / ' + todos.length + ' todos';
- }
-
-});
-
View
@@ -0,0 +1,60 @@
+exports.Class = Window.extend({
+ title: 'Shims',
+ navBarHidden: false,
+ init: function(o){
+
+ this.leftNavButton = {
+ title: 'Lefty',
+ click: function(e){
+ K.log(e);
+ }
+ };
+
+ this.rightNavButton = {
+ title: 'Righty',
+ click: function(e){
+ K.log(e);
+ }
+ };
+
+ this.children = [{
+ top: 10,
+ type: 'tabbedbar',
+ backgroundColor: '#0a0',
+ labels: ['one', 'two', 'three'],
+ click: function(e){
+ K.log(e);
+ }
+ },
+
+ {
+ top: 80,
+ type: 'buttonbar',
+ labels: ['one', 'two', 'three'],
+ click: function(e){
+ K.log(e);
+ }
+ },
+
+ {
+ type: 'toolbar',
+ items: [
+ 'spacer',
+ {
+ type: 'button',
+ title: 'a button'
+ },
+ 'spacer',
+ {
+ type: 'label',
+ text: 'hello'
+ },
+ 'spacer'
+ ]
+ }
+
+ ];
+
+ this._super(o);
+ }
+});
@@ -4,7 +4,6 @@ exports.Class = BackboneView.extend({
events: {
click: function(e){
- //K.log(e);
var model = todos.get(e.rowData._modelId) || todos.getByCid(e.rowData._modelCid);
model.set({ hasCheck: !model.get('hasCheck') });
},
View
@@ -34,7 +34,12 @@
<orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
</orientations>
</iphone>
- <android xmlns:android="http://schemas.android.com/apk/res/android"/>
+ <android xmlns:android="http://schemas.android.com/apk/res/android">
+ <manifest>
+ <supports-screens android:anyDensity="true"
+ android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
+ </manifest>
+ </android>
<modules/>
<property name="ti.android.threadstacksize" type="int">32768</property>
</ti:app>

0 comments on commit 7dd4c0d

Please sign in to comment.