Permalink
Browse files

Livestyle basics now working even on device

  • Loading branch information...
1 parent 8a52ef7 commit d4ec5d0fc758e5de9cd13bb4d5c879fe288dd725 @krawaller committed Nov 12, 2010
View
@@ -1,4 +1,4 @@
-Ti.UI.setBackgroundColor('#000');
+Ti.UI.setBackgroundColor('#fff');
var tabGroup = Ti.UI.createTabGroup();
var win = Ti.UI.createWindow({
@@ -68,3 +68,33 @@ K.reg(my, 'myclass');
Ti.App.Properties.setBool('_watching', false);
Ti.include('tools/livestyle/livestyle.js');
K.watch(win);
+
+
+// Force load
+function forceLoad(){
+ Ti.UI.createActivityIndicator();
+ Ti.UI.createAlertDialog();
+ Ti.UI.createAnimation();
+ Ti.UI.createButton();
+ Ti.UI.createButtonBar();
+ Ti.UI.createCoverFlowView();
+ Ti.UI.createEmailDialog();
+ Ti.UI.createImageView();
+ Ti.UI.createLabel();
+ Ti.UI.createOptionDialog();
+ Ti.UI.createScrollableView();
+ Ti.UI.createSlider();
+ Ti.UI.createSwitch();
+ Ti.UI.createTab();
+ Ti.UI.createTabGroup();
+ Ti.UI.createTabbedBar();
+ Ti.UI.createTableView();
+ Ti.UI.createTableViewRow();
+ Ti.UI.createTableViewSection();
+ Ti.UI.createTextArea();
+ Ti.UI.createTextField();
+ Ti.UI.createToolbar();
+ Ti.UI.createView();
+ Ti.UI.createWebView();
+ Ti.UI.createWindow();
+};
View
@@ -85,4 +85,4 @@ var server = net.createServer(function (stream) {
fs.unwatchFile('livestyle.js');
});
});
-server.listen(8128, 'localhost');
+server.listen(8128);
@@ -1,14 +1,18 @@
Ti.include('livestyle.js');
K.style('/tools/livestyle/test.jss');
-
var win = Ti.UI.currentWindow;
-K.createButton({ title: 'hej', className: 'button1' }).appendTo(win);
-K.createButton('button2').appendTo(win);
-K.createLabel('label1');
-
-
+K.createButton({ title: 'Nice button!', className: 'button1' }).appendTo(win);
+K.createLabel({ text: 'A label' }).appendTo(win);
+K.createTableView({
+ className: 'tableView1',
+ data: [K.createTableViewRow({
+ title: 'row1',
+ className: 'row1'
+ }),
+ K.createTableViewRow({
+ title: 'row2'
+ })]
+}).appendTo(win);
-/*setTimeout(function(){
- socket.write(JSON.stringify({ action: 'watch', file: 'livestyle.js' }));
-},1000);*/
+var img = K.createImageView({ className: 'image1', image: "http://www.krawaller.se/logo_mini.png"}).appendTo(win);
@@ -1,5 +1,10 @@
Ti.API.log('including livestyle');
+var rtrim = /^\s+|\s+$/g;
+String.prototype.trim = function(){
+ return this.replace(rtrim, "");
+};
+
(function(d){var a,c={},f=0,b=this,e=Object.prototype.toString;a=d.K=d.K||{};a.isFunc=function(g){return e.call(g)==="[object Function]"};a.reg=function(i,g){var h="_"+g;i.call=function(j,m,k,l){if(a.isFunc(k)&&typeof l==="undefined"){l=k;k=null}f++;c[f]=l;Ti.App.fireEvent("_"+j,{method:m,cid:l?f:false,source:g,data:k})};Ti.App.addEventListener(h,function(q){if(!q.method){if(c[q.cid]){c[q.cid](q.data);delete c[q.cid]}}else{var l=0,j=q.method.split("."),k,s,r=i,p=[],n=function(m){if(q.cid){Ti.App.fireEvent(q.source,{cid:q.cid,data:m,source:h})}};while((k=r[j[l++]])&&(r=k)&&p.push(r)){}(r&&(a.isFunc(r)))?((typeof(s=r.apply?r.apply((p[p.length-2]||i),((k=(q.data?(q.data instanceof Array?q.data:[q.data]):[]))&&k.push(n)&&k.push(q)&&k)):r(q.data[0],q.data[1],q.data[2]))!=="undefined")&&n(s)):n(r)}})}})(this);
(function(global){
var K = global.K = global.K || {};
@@ -35,7 +40,10 @@ function appendTo(el){
return this;
}
-var els = K._els = K._els || [];
+var thisWindow = Ti.UI.currentWindow || win || {};
+thisWindow._type = 'window';
+
+var els = K._els = K._els || [thisWindow];
var styleCache = {};
var getStyle = K.getStyle = function(opts, type){
if(typeof opts === 'string'){ opts = { className: opts }; }
@@ -96,14 +104,20 @@ K.watch = function(win){
};
K.reg(Watcher, '_watcher');
+ Ti.API.log('init socket');
+
var socket = Titanium.Network.createTCPSocket({
- hostName: Titanium.Network.INADDR_ANY,
+ hostName: "192.168.10.236",
port: 8128,
mode: Titanium.Network.READ_WRITE_MODE
});
+
+ Ti.API.log('socket', socket.isValid);
socket.addEventListener('read', function(e) {
+
var t = e.data.text;
+ Ti.API.log('read', t);
var o = JSON.parse(t);
switch(o.action){
case 'filechange':
@@ -121,6 +135,8 @@ K.watch = function(win){
});
socket.connect();
+ Ti.API.log('connect', socket.isValid);
+
};
var watching = {};
@@ -188,7 +204,7 @@ var WHITESPACE_CHARACTERS = /\t|\n|\r/g,
function buildSelectorTree(text) {
var rules = [], ruletext, rule,
- match, selector, proptext, splitprop, properties;
+ match, selector, proptext, splitprop, properties, sidx, prop, val;
// Tabs, Returns
text = text.replace(WHITESPACE_CHARACTERS, EMPTY_STRING);
@@ -210,12 +226,14 @@ function buildSelectorTree(text) {
properties = [];
forEach(proptext, function (i, x) {
- splitprop = x.split(":");
-
- if (splitprop.length && splitprop[1]) {
+ sidx = x.indexOf(":");
+ prop = x.substring(0, sidx).trim();
+ val = x.substring(sidx+1).trim();
+
+ if (prop) {
properties.push({
- property : splitprop[0],
- value : splitprop[1]
+ property : prop,
+ value : val
});
}
});
@@ -1,11 +1,48 @@
+window {
+ barColor: #f00;
+ title: wow;
+}
+
button {
width: 100;
height: 30;
}
.button1 {
- width: 100;
- height: 40;
- top: 20;
- backgroundColor: #f00;
+ right: 10;
+ top: 160;
+ title: hu;
+}
+
+label {
+ top: 160;
+ left: 10;
+ width: auto;
+ height: auto;
+}
+
+.tableView1 {
+ height: 150;
+ top: 0;
+}
+
+tableViewRow {
+ color: #00f;
+}
+
+.row1 {
+ color: #f00;
+}
+
+imageView {
+ width: 300;
+ height: 100;
+ border: 1;
+ borderColor: #f00;
+ image: http://developer.appcelerator.com/assets/img/HELP_support85.png;
+}
+
+.image1 {
+ bottom: 10;
+ right: 10;
}
View
@@ -9,11 +9,11 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
- <string>appicon.png</string>
+ <string>default_app_logo.png</string>
<key>CFBundleIconFiles</key>
<array>
- <string>appicon.png</string>
- <string>appicon@2x.png</string>
+ <string>default_app_logo.png</string>
+ <string>default_app_logo@2x.png</string>
</array>
<key>CFBundleURLTypes</key>
<array>
@@ -1 +1 @@
-/Library/Application Support/Titanium/mobilesdk/osx/1.4.1.1/iphone,fcb6c65a-6821-41b5-b411-9350388aefb9,576375ac78cf2fd2c3e0319d5b5d90e3,8a222e
+/Library/Application Support/Titanium/mobilesdk/osx/1.4.2/iphone,fcb6c65a-6821-41b5-b411-9350388aefb9,247db298bdd7a25ea8ba24b96b26b6dc,bf53f9
View
@@ -7,19 +7,19 @@
#define _QUOTEME(x) #x
#define STRING(x) _QUOTEME(x)
-NSString * const TI_APPLICATION_DEPLOYTYPE = @"__DEPLOYTYPE__";
-NSString * const TI_APPLICATION_ID = @"__APP_ID__";
-NSString * const TI_APPLICATION_PUBLISHER = @"__APP_PUBLISHER__";
-NSString * const TI_APPLICATION_URL = @"__APP_URL__";
-NSString * const TI_APPLICATION_NAME = @"__APP_NAME__";
-NSString * const TI_APPLICATION_VERSION = @"__APP_VERSION__";
-NSString * const TI_APPLICATION_DESCRIPTION = @"__APP_DESCRIPTION__";
-NSString * const TI_APPLICATION_COPYRIGHT = @"__APP_COPYRIGHT__";
-NSString * const TI_APPLICATION_GUID = @"__APP_GUID__";
-BOOL const TI_APPLICATION_ANALYTICS = __APP_ANALYTICS__;
+NSString * const TI_APPLICATION_DEPLOYTYPE = @"test";
+NSString * const TI_APPLICATION_ID = @"se.krawaller.kra";
+NSString * const TI_APPLICATION_PUBLISHER = @"jacob";
+NSString * const TI_APPLICATION_URL = @"http://www.krawaller.se";
+NSString * const TI_APPLICATION_NAME = @"Kra";
+NSString * const TI_APPLICATION_VERSION = @"1.0";
+NSString * const TI_APPLICATION_DESCRIPTION = @"No description provided";
+NSString * const TI_APPLICATION_COPYRIGHT = @"2010 by jacob";
+NSString * const TI_APPLICATION_GUID = @"fcb6c65a-6821-41b5-b411-9350388aefb9";
+BOOL const TI_APPLICATION_ANALYTICS = true;
#ifdef TARGET_IPHONE_SIMULATOR
-NSString * const TI_APPLICATION_RESOURCE_DIR = @"__APP_RESOURCE_DIR__";
+NSString * const TI_APPLICATION_RESOURCE_DIR = @"";
#endif
int main(int argc, char *argv[]) {
@@ -1,4 +1,4 @@
-TI_VERSION=1.4.1.1
+TI_VERSION=1.4.2
TI_SDK_DIR=/Library/Application Support/Titanium/mobilesdk/osx/$(TI_VERSION)/iphone
TI_APPID=se.krawaller.kra
OTHER_LDFLAGS[sdk=iphoneos4*]=$(inherited) -weak_framework iAd
View
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
- <id>se.krawaller.kra</id>
- <name>Kra</name>
- <version>1.0</version>
- <publisher>not specified</publisher>
- <url>not specified</url>
- <description>not specified</description>
- <copyright>not specified</copyright>
- <icon>appicon.png</icon>
+<id>se.krawaller.kra</id>
+<name>Kra</name>
+<version>1.0</version>
+<publisher>jacob</publisher>
+<url>http://www.krawaller.se</url>
+<description>No description provided</description>
+<copyright>2010 by jacob</copyright>
+<icon>default_app_logo.png</icon>
<persistent-wifi>false</persistent-wifi>
<prerendered-icon>false</prerendered-icon>
<statusbar-style>default</statusbar-style>

0 comments on commit d4ec5d0

Please sign in to comment.