Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Timob 8458 2.0.1 PR #1939

Closed
wants to merge 57 commits into from
@nebrius

No description provided.

hal-gh and others added some commits
@hal-gh hal-gh TIDOC-458 APIDoc Database.ResultSet.fieldCount property not documented d4f7847
Allen Yeung TIMOB-8056: Android: Error when resolving modules in Linux 2c70e66
@vishalduggal vishalduggal [TIMOB-8030] Use a flag to track if window was opened with animation f37877a
@hal-gh hal-gh TIDOC-458 APIDoc Database.ResultSet.fieldCount property not documente…
…d - rev1
480ff8d
@hal-gh hal-gh TIDOC-458 TIDOC-473 APIDoc Database.ResultSet.fieldCount property not…
… documented - rev2
0e83499
@CPep22 CPep22 Added hasText() method, still need to get drillbit test going. b6e4d22
@CPep22 CPep22 Merge branch 'master' of git://github.com/appcelerator/titanium_mobil…
…e into timob-996
c642ce2
@CPep22 CPep22 The hasText() method has been added, and a drillbit test for it has b…
…een added to ui.controls.
1fcfe21
@CPep22 CPep22 Merge branch 'master' of git://github.com/appcelerator/titanium_mobil…
…e into timob-996
6aed59f
@Shalom Shalom Fix https://jira.appcelerator.org/browse/TIMOB-6839 46bc9ff
@marshall marshall bumping master to 2.1.0 57c772a
@marshall marshall Merge pull request #1796 from ayeung/timob-8056
TIMOB-8056: Android: Error when resolving modules in Linux
770a423
@srahim srahim Merge pull request #1798 from vishalduggal/timob-8030
[TIMOB-8030] Use a flag to track if window was opened with animation
094885e
Bryan Hughes [TIMOB-7799] Removed flex box from Label. 79d62e0
@joshthecoder joshthecoder Merge pull request #1852 from Shalom/patch-1 acb3dd5
Bryan Hughes [TIMOB-7799] Removed flexbox from tab. 110ecb7
@cb1kenobi cb1kenobi [TIMOB-8341] Fixed typo in compiler with facebook loginbutton name. a1c8a80
Opie Cyrus Merge pull request #1822 from CPep22/timob-996
hasText() method added to TextField and TextArea along with Drillbit test -Timob 996
d8c09f1
Bryan Hughes Merge pull request #1861 from cb1kenobi/timob-8341
[TIMOB-8341] Fixed typo in compiler with facebook loginbutton name.
7e00334
@hieupham007 hieupham007 timob-8340: use the correct current activity. e4db9b0
Bryan Hughes Merge branch 'master' of git://github.com/appcelerator/titanium_mobil…
…e into timob-7799
87cc51a
@cb1kenobi cb1kenobi [TIMOB-8348] Fixed the hiding of the openurl iframe. 12f20d1
Bryan Hughes Merge pull request #1871 from cb1kenobi/timob-8348
[TIMOB-8348] Fixed the hiding of the openurl iframe.
dac132a
Bryan Hughes Merge branch 'master' into timob-7799 da5a087
Opie Cyrus Merge pull request #1863 from hieupham007/timob-8340
timob-8340: use the correct current activity.
3da3bd8
Opie Cyrus Merge pull request #1860 from JeffEnglish/MOD-577
[MOD-577] Updated version numbers to 2.0.0
be029a6
Allen Yeung TIMOB-8324: Android: Animation: V8/Rhino: The window background gets …
…transparent when animated object is set up
69431c3
Allen Yeung Only apply previous fix to android versions below 3.0 d107c9e
ayeung Merge pull request #1742 from hal-gh/TIDOC-458
TIDOC-458 TIDOC-473 APIDoc Database.ResultSet.fieldCount property not documented
76520a5
Allen Yeung Moved clear animation logic to ticompositelayout e2faf96
Allen Yeung Move clear animation in tianimationbuilder 8b1aab1
Allen Yeung Added comments for invalidate a301c85
Allen Yeung Added ticket number in comment 75a779f
Opie Cyrus Merge pull request #1878 from ayeung/timob-8324
TIMOB-8324: Android: Animation: V8/Rhino: The window background gets transparent when animated object is set up
ac3852d
Bryan Hughes [TIMOB-7799] Removed flex box from button and fixed some bugs. 5f77441
Bryan Hughes [TIMOB-7799] Added vertical alignment to labels 7bb4184
@cb1kenobi cb1kenobi [TIMOB-8410] Fixed unescape issue with i18n strings. b7d3b70
@cb1kenobi cb1kenobi [TIMOB-8410] Fixed string escaping for utf-8 strings. 3549fbe
Bryan Hughes [TIMOB-7799] Removed flex box from switch and fixed some bugs. d9748eb
Bryan Hughes [TIMOB-7799] Removed flex box from activity indicator. 3e9e1a2
Bryan Hughes Merge branch 'master' into timob-7799 1481177
Bryan Hughes Merge pull request #1884 from cb1kenobi/timob-8410
[TIMOB-8410] Fixed unescape issue with i18n strings.
4e136f1
Bryan Hughes Merge branch 'master' into timob-7799 13f9cc9
@dizzymonkey dizzymonkey TIMOB-8380-2_0_X use the root activity for accessing the window manager 3df84ef
@joshthecoder joshthecoder Merge pull request #1887 from dizzymonkey/timob-8380
TIMOB-8380-2_0_X use the root activity for accessing the window manager
2803b7d
@cb1kenobi cb1kenobi [TIMOB-8438] Moved deployType in the require.config so that it was av…
…ailable from Ti.App.
1e3dd95
Bryan Hughes [TIMOB-7799] Bug fixes. 4a27bc6
Bryan Hughes [TIMOB-7799] Bug fixes. f07232b
Bryan Hughes [TIMOB-8440] Added checks for non-existent xhr.upload. fa9b05e
Bryan Hughes Merge pull request #1889 from cb1kenobi/timob-8438
[TIMOB-8438] Moved deployType in the require.config so that it was available from Ti.App
5efc8e1
Bryan Hughes [TIMOB-7799] Removed trailing comma. 9f98105
Bryan Hughes [TIMOB-7799] Code cleanup and bug fix. 711f613
Bryan Hughes Merge branch 'master' into timob-7799 7eed610
Bryan Hughes Merge branch 'master' into timob-8440 05e19b3
Bryan Hughes [TIMOB-8458] Replaced all internal console.* calls with API.* calls a…
…nd fixed the shim to work on WP7
586bdb3
Bryan Hughes Merge branch 'timob-8440' into timob-7799 3d2455e
Bryan Hughes Merge branch 'timob-7799' into timob-8458 f50475d
@cb1kenobi
Owner

Decided to not merge these changes into 2.0.X branch at this time.

@cb1kenobi cb1kenobi closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 19, 2012
  1. @hal-gh
Commits on Mar 22, 2012
  1. @vishalduggal
Commits on Mar 23, 2012
  1. @hal-gh
  2. @hal-gh
  3. @CPep22
  4. @CPep22
  5. @CPep22

    The hasText() method has been added, and a drillbit test for it has b…

    CPep22 authored
    …een added to ui.controls.
  6. @CPep22
Commits on Mar 27, 2012
  1. @Shalom
  2. @marshall

    bumping master to 2.1.0

    marshall authored
  3. @marshall

    Merge pull request #1796 from ayeung/timob-8056

    marshall authored
    TIMOB-8056: Android: Error when resolving modules in Linux
  4. @srahim

    Merge pull request #1798 from vishalduggal/timob-8030

    srahim authored
    [TIMOB-8030] Use a flag to track if window was opened with animation
  5. [TIMOB-7799] Removed flex box from Label.

    Bryan Hughes authored
  6. @joshthecoder
  7. [TIMOB-7799] Removed flexbox from tab.

    Bryan Hughes authored
Commits on Mar 28, 2012
  1. @cb1kenobi
  2. Merge pull request #1822 from CPep22/timob-996

    Opie Cyrus authored
    hasText() method added to TextField and TextArea along with Drillbit test -Timob 996
  3. Merge pull request #1861 from cb1kenobi/timob-8341

    Bryan Hughes authored
    [TIMOB-8341] Fixed typo in compiler with facebook loginbutton name.
  4. @hieupham007
  5. Merge branch 'master' of git://github.com/appcelerator/titanium_mobil…

    Bryan Hughes authored
    …e into timob-7799
  6. @cb1kenobi
  7. Merge pull request #1871 from cb1kenobi/timob-8348

    Bryan Hughes authored
    [TIMOB-8348] Fixed the hiding of the openurl iframe.
  8. Merge branch 'master' into timob-7799

    Bryan Hughes authored
Commits on Mar 29, 2012
  1. Merge pull request #1863 from hieupham007/timob-8340

    Opie Cyrus authored
    timob-8340: use the correct current activity.
  2. Merge pull request #1860 from JeffEnglish/MOD-577

    Opie Cyrus authored
    [MOD-577] Updated version numbers to 2.0.0
  3. TIMOB-8324: Android: Animation: V8/Rhino: The window background gets …

    Allen Yeung authored
    …transparent when animated object is set up
  4. Only apply previous fix to android versions below 3.0

    Allen Yeung authored
  5. Merge pull request #1742 from hal-gh/TIDOC-458

    ayeung authored
    TIDOC-458 TIDOC-473 APIDoc Database.ResultSet.fieldCount property not documented
  6. Moved clear animation logic to ticompositelayout

    Allen Yeung authored
  7. Move clear animation in tianimationbuilder

    Allen Yeung authored
  8. Added comments for invalidate

    Allen Yeung authored
  9. Added ticket number in comment

    Allen Yeung authored
  10. Merge pull request #1878 from ayeung/timob-8324

    Opie Cyrus authored
    TIMOB-8324: Android: Animation: V8/Rhino: The window background gets transparent when animated object is set up
  11. [TIMOB-7799] Added vertical alignment to labels

    Bryan Hughes authored
  12. @cb1kenobi
  13. @cb1kenobi
  14. [TIMOB-7799] Removed flex box from activity indicator.

    Bryan Hughes authored
  15. Merge branch 'master' into timob-7799

    Bryan Hughes authored
  16. Merge pull request #1884 from cb1kenobi/timob-8410

    Bryan Hughes authored
    [TIMOB-8410] Fixed unescape issue with i18n strings.
  17. Merge branch 'master' into timob-7799

    Bryan Hughes authored
Commits on Mar 30, 2012
  1. @dizzymonkey
  2. @joshthecoder

    Merge pull request #1887 from dizzymonkey/timob-8380

    joshthecoder authored
    TIMOB-8380-2_0_X use the root activity for accessing the window manager
  3. @cb1kenobi
  4. [TIMOB-7799] Bug fixes.

    Bryan Hughes authored
  5. [TIMOB-7799] Bug fixes.

    Bryan Hughes authored
  6. [TIMOB-8440] Added checks for non-existent xhr.upload.

    Bryan Hughes authored
  7. Merge pull request #1889 from cb1kenobi/timob-8438

    Bryan Hughes authored
    [TIMOB-8438] Moved deployType in the require.config so that it was available from Ti.App
  8. [TIMOB-7799] Removed trailing comma.

    Bryan Hughes authored
  9. [TIMOB-7799] Code cleanup and bug fix.

    Bryan Hughes authored
  10. Merge branch 'master' into timob-7799

    Bryan Hughes authored
  11. Merge branch 'master' into timob-8440

    Bryan Hughes authored
Commits on Apr 2, 2012
  1. [TIMOB-8458] Replaced all internal console.* calls with API.* calls a…

    Bryan Hughes authored
    …nd fixed the shim to work on WP7
Commits on Apr 5, 2012
  1. Merge branch 'timob-8440' into timob-7799

    Bryan Hughes authored
  2. Merge branch 'timob-7799' into timob-8458

    Bryan Hughes authored
This page is out of date. Refresh to see the latest.
Showing with 488 additions and 461 deletions.
  1. +4 −1 android/modules/platform/src/java/ti/modules/titanium/platform/DisplayCapsProxy.java
  2. +10 −0 android/modules/ui/src/java/ti/modules/titanium/ui/TextAreaProxy.java
  3. +10 −0 android/modules/ui/src/java/ti/modules/titanium/ui/TextFieldProxy.java
  4. +1 −1  android/modules/ui/src/java/ti/modules/titanium/ui/UIModule.java
  5. +3 −1 android/titanium/src/java/org/appcelerator/titanium/util/TiAnimationBuilder.java
  6. +10 −1 android/titanium/src/java/org/appcelerator/titanium/view/TiCompositeLayout.java
  7. +26 −18 apidoc/Titanium/Database/DB.yml
  8. +41 −16 apidoc/Titanium/Database/ResultSet.yml
  9. +1 −1  apidoc/Titanium/Media/VideoPlayer.yml
  10. +11 −0 apidoc/Titanium/UI/Label.yml
  11. +1 −2  build/titanium_version.py
  12. +34 −1 drillbit/tests/ui.controls.js
  13. +5 −2 iphone/Classes/TiWindowProxy.m
  14. +1 −1  mobileweb/src/config.js
  15. +1 −17 mobileweb/themes/common.css
  16. +8 −23 mobileweb/titanium/Ti.js
  17. +6 −3 mobileweb/titanium/Ti/API.js
  18. +5 −5 mobileweb/titanium/Ti/Locale.js
  19. +5 −5 mobileweb/titanium/Ti/Network/HTTPClient.js
  20. +1 −1  mobileweb/titanium/Ti/Platform.js
  21. +7 −6 mobileweb/titanium/Ti/UI.js
  22. +47 −55 mobileweb/titanium/Ti/UI/ActivityIndicator.js
  23. +46 −55 mobileweb/titanium/Ti/UI/Button.js
  24. +42 −41 mobileweb/titanium/Ti/UI/Label.js
  25. +35 −101 mobileweb/titanium/Ti/UI/Switch.js
  26. +20 −24 mobileweb/titanium/Ti/UI/Tab.js
  27. +2 −2 mobileweb/titanium/Ti/_/Layouts/Base.js
  28. +25 −15 mobileweb/titanium/Ti/_/Layouts/Horizontal.js
  29. +25 −14 mobileweb/titanium/Ti/_/Layouts/Vertical.js
  30. +46 −42 mobileweb/titanium/Ti/_/UI/Element.js
  31. +1 −1  mobileweb/titanium/Ti/_/analytics.js
  32. +2 −2 mobileweb/titanium/Ti/_/dom.js
  33. +2 −2 support/mobileweb/compiler.py
  34. +3 −1 support/module/android/android.py
  35. +1 −1  support/titanium.py
View
5 android/modules/platform/src/java/ti/modules/titanium/platform/DisplayCapsProxy.java
@@ -10,6 +10,7 @@
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.annotations.Kroll;
+import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiContext;
import android.util.DisplayMetrics;
@@ -34,7 +35,9 @@ public DisplayCapsProxy(TiContext tiContext)
private Display getDisplay() {
if (softDisplay == null || softDisplay.get() == null) {
- softDisplay = new SoftReference<Display>(getActivity().getWindowManager().getDefaultDisplay());
+ // we only need the window manager so it doesn't matter if the root or current activity is used
+ // for accessing it
+ softDisplay = new SoftReference<Display>(TiApplication.getAppRootOrCurrentActivity().getWindowManager().getDefaultDisplay());
}
return softDisplay.get();
}
View
10 android/modules/ui/src/java/ti/modules/titanium/ui/TextAreaProxy.java
@@ -58,4 +58,14 @@ public TiUIView createView(Activity activity)
{
return new TiUIText(this, false);
}
+
+ @Kroll.method
+ public Boolean hasText()
+ {
+ Object text = getProperty(TiC.PROPERTY_VALUE);
+ if (text != null && text instanceof String) {
+ return (((String)text).length() > 0);
+ }
+ return false;
+ }
}
View
10 android/modules/ui/src/java/ti/modules/titanium/ui/TextFieldProxy.java
@@ -57,4 +57,14 @@ public TiUIView createView(Activity activity)
{
return new TiUIText(this, true);
}
+
+ @Kroll.method
+ public Boolean hasText()
+ {
+ Object text = getProperty(TiC.PROPERTY_VALUE);
+ if (text != null && text instanceof String) {
+ return (((String)text).length() > 0);
+ }
+ return false;
+ }
}
View
2  android/modules/ui/src/java/ti/modules/titanium/ui/UIModule.java
@@ -205,7 +205,7 @@ public int convertUnits(String convertFromValue, String convertToUnits)
TiDimension dimension = new TiDimension(convertFromValue, TiDimension.TYPE_UNDEFINED);
// TiDimension needs a view to grab the window manager, so we'll just use the decorview of the current window
- View view = getActivity().getWindow().getDecorView();
+ View view = TiApplication.getAppCurrentActivity().getWindow().getDecorView();
if (view != null) {
if (convertToUnits.equals(UNIT_PX)) {
View
4 android/titanium/src/java/org/appcelerator/titanium/util/TiAnimationBuilder.java
@@ -502,6 +502,7 @@ protected void applyTransformation(float interpolatedTime, Transformation t)
{
public void onAnimationEnd(Animation a)
{
+
if (relayoutChild) {
LayoutParams params = (LayoutParams) view.getLayoutParams();
TiConvert.fillLayout(options, params);
@@ -511,7 +512,8 @@ public void onAnimationEnd(Animation a)
}
if (applyOpacity) {
- //There is an android bug where animations still occur after this method. We clear it from the view to correct this.
+ // There is an android bug where animations still occur after this method. We clear it from the view to
+ // correct this.
view.clearAnimation();
if (toOpacity.floatValue() == 0) {
view.setVisibility(View.INVISIBLE);
View
11 android/titanium/src/java/org/appcelerator/titanium/view/TiCompositeLayout.java
@@ -17,6 +17,7 @@
import org.appcelerator.titanium.proxy.TiViewProxy;
import android.content.Context;
+import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.OnHierarchyChangeListener;
@@ -536,7 +537,15 @@ protected void onLayout(boolean changed, int l, int t, int r, int b)
protected void onAnimationEnd()
{
super.onAnimationEnd();
- invalidate();
+ if (Build.VERSION.SDK_INT < TiC.API_LEVEL_HONEYCOMB) {
+ // There is an android bug where animations still occur after this method. We clear it from the view to
+ // correct this. This fixes TIMOB-8324
+ // (http://stackoverflow.com/questions/4750939/android-animation-is-not-finished-in-onanimationend)
+ clearAnimation();
+ // We have to force an invalidate here for TIMOB-7412 (only for 3.0 and below). This is to prevent a
+ // background color of a view from being transparent after an animation.
+ invalidate();
+ }
}
// option0 is left/top, option1 is right/bottom
View
44 apidoc/Titanium/Database/DB.yml
@@ -5,11 +5,14 @@ extends: Titanium.Proxy
since: "0.1"
createable: false
platforms: [android, iphone, ipad]
+
methods:
- name: close
summary: |
- Closes the database and releases resources from memory. Once closed, this
- instance is no longer valid and should not be used.
+ Closes the database and releases resources from memory. Once closed, this instance is no
+ longer valid and should not be used. On iOS, also closes all <Titanium.Database.ResultSet>
+ instances that exist.
+
- name: execute
summary: |
Executes an SQL statement against the database and returns a `ResultSet`.
@@ -19,6 +22,7 @@ methods:
- name: sql
summary: SQL to execute. May include placeholders for parameter substitution.
type: String
+
- name: vararg
summary: |
Either a variable ordered list of zero or more values, or an array of values,
@@ -28,55 +32,59 @@ methods:
examples:
- title: Executing a Query
example: |
- The following code will install a database using [Titanium.Database.install](Titanium.Database.install)
- and execute SQL statements that will create a table, insert data
- and query the table.
-
+ The following code will install a database using
+ [Titanium.Database.install](Titanium.Database.install) and execute SQL statements that will
+ create a table, insert data and query the table.
+
var db = Ti.Database.install('mydb1', 'mydb1Installed');
db.execute('DELETE FROM people');
db.execute('CREATE TABLE IF NOT EXISTS people (name TEXT, phone_number TEXT, city TEXT)');
-
+
var thisName = 'Arthur';
var thisPhoneNo = '1-617-000-0000';
var thisCity = 'Mountain View';
db.execute('INSERT INTO people (name, phone_number, city) VALUES (?, ?, ?)', thisName, thisPhoneNo, thisCity);
-
+
var personArray = ['Paul','020 7000 0000', 'London'];
db.execute('INSERT INTO people (name, phone_number, city) VALUES (?, ?, ?)', personArray);
-
+
var rows = db.execute('SELECT rowid,name,phone_number,city FROM people');
db.close();
-
+
while (rows.isValidRow())
{
Ti.API.info('Person ---> ROWID: ' + rows.fieldByName('rowid') + ', name:' + rows.field(1) + ', phone_number: ' + rows.fieldByName('phone_number') + ', city: ' + rows.field(3));
rows.next();
}
rows.close();
-
+
Note that the above `SELECT` query contains the [rowid](http://www.sqlite.org/lang_createtable.html#rowid)
column, which is a SQLite-specific column that stores the unique identifier for each row.
+
- name: remove
- platforms: [android]
summary: |
- Removes the database files for this instance from disk. WARNING: this is
- a destructive operation and cannot be reversed. All data in the database
- will be lost; use with caution.
+ Removes the database files for this instance from disk. WARNING: this is a destructive
+ operation and cannot be reversed. All data in the database will be lost; use with caution.
+ platforms: [android]
+
properties:
- name: file
summary: |
- A `File` object representing the file where this database is stored. Must
- only be used for setting file properties.
+ A `File` object representing the file where this database is stored. Must only be used for
+ setting file properties.
type: Titanium.Filesystem.File
+ permission: read-only
platforms: [iphone,ipad]
since: "1.9"
- permission: read-only
+
- name: lastInsertRowId
summary: The identifier of the last populated row.
type: Number
+
- name: name
summary: The name of the database.
type: String
+
- name: rowsAffected
summary: The number of rows affected by the last query.
type: Number
View
57 apidoc/Titanium/Database/ResultSet.yml
@@ -5,6 +5,7 @@ extends: Titanium.Proxy
since: "0.1"
createable: false
platforms: [android, iphone, ipad]
+
methods:
- name: close
summary: |
@@ -17,16 +18,16 @@ methods:
and casts it to the specified type (String, Integer, Float or Double.)
description: |
All of the numeric types (Integer, Float or Double) are returned as JavaScript Number objects.
-
+
If no `type` parameter is specified, the returned data type depends on the data in the column.
-
+
* If the data in the column is TEXT, the data is returned as a String.
* If the data in the column is any kind of number, the data is returned as a Number.
* If the data in the column is a BLOB, the data is returned as a <Titanium.Blob> object.
-
+
When a `type` is specified and the data cannot be converted to the specified type, an
exception is thrown.
-
+
Returns null if the value in the table is NULL.
returns:
- type: String
@@ -50,16 +51,16 @@ methods:
and casts it to the specified type (String, Integer, Float or Double.)
description: |
All of the numeric types (Integer, Float or Double) are returned as JavaScript Number objects.
-
+
If no `type` parameter is specified, the returned data type depends on the data in the column.
-
+
* If the data in the column is TEXT, the data is returned as a String.
* If the data in the column is any kind of number, the data is returned as a Number.
* If the data in the column is a BLOB, the data is returned as a <Titanium.Blob> object.
-
+
When a `type` is specified and the data cannot be converted to the specified type, an
exception is thrown.
-
+
Returns null if the value in the table is NULL.
returns:
- type: String
@@ -80,6 +81,7 @@ methods:
summary: Returns the number of columns in this result set.
returns:
type: Number
+ platforms: [iphone, ipad]
- name: fieldName
summary: Returns the field name for the specified field index.
@@ -89,7 +91,21 @@ methods:
- name: index
summary: A zero-based column index for the field.
type: Number
-
+
+ - name: getFieldCount
+ summary: Returns the number of columns in this result set.
+ returns:
+ type: Number
+
+ - name: getFieldName
+ summary: Returns the field name for the specified field index.
+ returns:
+ type: String
+ parameters:
+ - name: index
+ summary: A zero-based column index for the field.
+ type: Number
+
- name: isValidRow
summary: Returns whether the current row is valid.
returns:
@@ -101,7 +117,14 @@ methods:
or `false` otherwise.
returns:
type: Boolean
+
properties:
+ - name: fieldCount
+ summary: The number of columns in this result set.
+ type: Number
+ permission: read-only
+ platforms: [android]
+
- name: rowCount
summary: The number of rows in this result set.
type: Number
@@ -112,12 +135,13 @@ properties:
type: Boolean
permission: read-only
platforms: [iphone,ipad]
+
examples:
- title: Using ResultSet
example: |
The following code will install a database and execute SQL statements that will create a
table, insert data into it, query the table and iterate through the returned ResultSet.
-
+
var db = Ti.Database.open('mydb1Installed');
db.execute('CREATE TABLE IF NOT EXISTS people (name TEXT, phone_number TEXT, city TEXT)');
db.execute('DELETE FROM people');
@@ -126,15 +150,17 @@ examples:
var thisPhoneNo = '1-617-000-0000';
var thisCity = 'Mountain View';
db.execute('INSERT INTO people (name, phone_number, city) VALUES (?, ?, ?)', thisName, thisPhoneNo, thisCity);
-
+
var personArray = ['Paul','020 7000 0000', 'London'];
db.execute('INSERT INTO people (name, phone_number, city) VALUES (?, ?, ?)', personArray);
-
+
var rows = db.execute('SELECT rowid,name,phone_number,city FROM people');
db.close();
-
- while (rows.isValidRow())
- {
+
+ Ti.API.info('Row count: ' + rows.rowCount);
+ Ti.API.info('Field count: ' + rows.fieldCount);
+
+ while (rows.isValidRow()){
Ti.API.info('Person ---> ROWID: ' + rows.fieldByName('rowid') + ', name:' + rows.field(1) + ', phone_number: ' + rows.fieldByName('phone_number') + ', city: ' + rows.field(3));
rows.next();
}
@@ -142,4 +168,3 @@ examples:
Note that the above `SELECT` query contains the [rowid](http://www.sqlite.org/lang_createtable.html#rowid)
field, which contains an SQLite-specific unique identifier for each row.
-
View
2  apidoc/Titanium/Media/VideoPlayer.yml
@@ -606,7 +606,7 @@ properties:
On Mobile Web, video format support depends on the web browser. You can specify an
array of URLs to videos of different formats. The web browser will select the first
video URL in the array that it is able to play. This is not supported on iOS and Android.
- type: [String,Array]
+ type: [String, Array<String>]
- name: useApplicationAudioSession
summary: |
View
11 apidoc/Titanium/UI/Label.yml
@@ -109,6 +109,17 @@ properties:
type: Boolean
default: true
platforms: [android, mobileweb]
+
+ - name: verticalAlign
+ summary: |
+ Vertical text alignment, specified using one of the
+ vertical alignment constants from <Titanium.UI>:
+ [TEXT_VERTICAL_ALIGNMENT_BOTTOM](Titanium.UI.TEXT_VERTICAL_ALIGNMENT_BOTTOM),
+ [TEXT_VERTICAL_ALIGNMENT_CENTER](Titanium.UI.TEXT_VERTICAL_ALIGNMENT_CENTER), or
+ [TEXT_VERTICAL_ALIGNMENT_TOP](Titanium.UI.TEXT_VERTICAL_ALIGNMENT_TOP).
+ type: [Number,String]
+ default: Titanium.UI.TEXT_VERTICAL_ALIGNMENT_CENTER
+ platforms: [mobileweb]
examples:
- title: Basic Label
View
3  build/titanium_version.py
@@ -1,3 +1,2 @@
-version = '2.0.0'
+version = '2.1.0'
module_apiversion = '2'
-
View
35 drillbit/tests/ui.controls.js
@@ -14,5 +14,38 @@ describe("Ti.UI control tests", {
f = Ti.UI.createButton();
valueOf(f.title).shouldBe('');
- }
+ },
+ textAreaFieldsHasText: function() {
+ var textArea1 = Ti.UI.createTextArea();
+ var hasText = textArea1.hasText();
+ valueOf(hasText).shouldBe(false);
+
+ var textArea2 = Ti.UI.createTextArea({
+ value : 'I am a textarea'
+ });
+ hasText = textArea2.hasText();
+ valueOf(hasText).shouldBe(true);
+
+ var textArea3 = Ti.UI.createTextArea({
+ value : '',
+ });
+ hasText = textArea3.hasText();
+ valueOf(hasText).shouldBe(false);
+
+ var textField1 = Ti.UI.createTextField();
+ hasText = textField1.hasText();
+ valueOf(hasText).shouldBe(false);
+
+ var textField2 = Ti.UI.createTextField({
+ value: "I am a textfield"
+ });
+ hasText = textField2.hasText();
+ valueOf(hasText).shouldBe(true);
+
+ var textField3 = Ti.UI.createTextField({
+ value : '',
+ });
+ hasText = textField3.hasText();
+ valueOf(hasText).shouldBe(false);
+ }
});
View
7 iphone/Classes/TiWindowProxy.m
@@ -414,7 +414,9 @@ -(void)openOnUIThread:(NSArray*)args
[self view];
[self windowWillOpen];
[self windowReady];
-
+ //This flag will track if window was opened with an animation to resolve the edge case
+ //that the animation completes before the method ends. TIMOB-8030
+ BOOL hasAnimation = NO;
if (openAnimation!=nil)
{
if (rootViewAttached)
@@ -428,6 +430,7 @@ -(void)openOnUIThread:(NSArray*)args
}
openAnimation.delegate = self;
[openAnimation animate:self];
+ hasAnimation = YES;
}
if (fullscreenFlag)
{
@@ -486,7 +489,7 @@ -(void)openOnUIThread:(NSArray*)args
[[TiApp app] showModalController:nc animated:animated];
}
}
- if (openAnimation==nil)
+ if (hasAnimation == NO)
{
[self windowDidOpen];
}
View
2  mobileweb/src/config.js
@@ -2,6 +2,7 @@ var require = {
app: {
analytics: ${app_analytics | jsQuoteEscapeFilter},
copyright: "${app_copyright | jsQuoteEscapeFilter}",
+ deployType: "${deploy_type | jsQuoteEscapeFilter}",
description: "${app_description | jsQuoteEscapeFilter}",
guid: "${app_guid | jsQuoteEscapeFilter}",
id: "${app_name | jsQuoteEscapeFilter}",
@@ -11,7 +12,6 @@ var require = {
url: "${app_url | jsQuoteEscapeFilter}",
version: "${app_version | jsQuoteEscapeFilter}"
},
- deployType: "${deploy_type | jsQuoteEscapeFilter}",
has: {
"declare-property-methods": true,
"js-btoa": function(g) {
View
18 mobileweb/themes/common.css
@@ -329,8 +329,7 @@ textarea {
.TiUIButtonDefault {
border: 1px solid #666;
- border-radius: 10px;
- padding: 10px 10px;
+ border-radius: 6px;
}
.TiUISliderTrack {
@@ -424,21 +423,6 @@ textarea {
border-radius: 5px;
}
-.TiUIActivityIndicatorContentContainer {
- display: none;
- height: 100%;
- width: 100%;
-}
-
-.TiUIActivityIndicatorIndicator {
- height: 36px;
- width: 36px;
-}
-
-.TiUIActivityIndicatorMessage {
- white-space: nowrap;
-}
-
.TiUIActivityIndicatorProng {
background-color: #fff;
border-radius: 1px;
View
31 mobileweb/titanium/Ti.js
@@ -13,11 +13,12 @@
*/
define(
- ["Ti/_", "Ti/_/analytics", "Ti/App", "Ti/_/Evented", "Ti/_/lang", "Ti/_/ready", "Ti/_/style", "Ti/Buffer", "Ti/Platform", "Ti/UI", "Ti/Locale", "Ti/_/include"],
- function(_, analytics, App, Evented, lang, ready, style, Buffer, Platform, UI) {
+ ["Ti/_", "Ti/_/analytics", "Ti/App", "Ti/_/Evented", "Ti/_/lang", "Ti/_/ready", "Ti/_/style", "Ti/Buffer", "Ti/Platform", "Ti/UI", "Ti/API", "Ti/Locale", "Ti/_/include"],
+ function(_, analytics, App, Evented, lang, ready, style, Buffer, Platform, UI, API) {
var global = window,
cfg = require.config,
+ deployType = cfg.app.deployType,
ver = cfg.ti.version,
is = require.is,
each = require.each,
@@ -53,7 +54,7 @@ define(
deferStart: function() {
if (loaded) {
- console.warn("app.js already loaded!");
+ API.warn("app.js already loaded!");
} else {
var n = Math.round(Math.random()*1e12);
waiting.push(n);
@@ -69,7 +70,7 @@ define(
loadAppjs = Ti.deferStart();
// add has() tests
- has.add("devmode", cfg.deployType === "development");
+ has.add("devmode", deployType === "development");
// Object.defineProperty() shim
if (!has("object-defineproperty")) {
@@ -179,21 +180,6 @@ define(
};
}
- // console.*() shim
- console === void 0 && (console = {});
-
- // make sure "log" is always at the end
- each(["debug", "info", "warn", "error", "log"], function (c) {
- console[c] || (console[c] = ("log" in console)
- ? function () {
- var a = Array.apply({}, arguments);
- a.unshift(c + ":");
- console.log(a.join(" "));
- }
- : function () {}
- );
- });
-
// JSON.parse() and JSON.stringify() shim
if (!has("json-stringify")) {
function escapeString(s){
@@ -298,8 +284,7 @@ define(
Object.defineProperty(global, "Ti", { value: Ti, writable: false });
Object.defineProperty(global, "Titanium", { value: Ti, writable: false });
- // print the Titanium version *after* the console shim
- console.info("[INFO] Appcelerator Titanium " + ver + " Mobile Web");
+ API.info("Appcelerator Titanium " + ver + " Mobile Web");
// make sure we have some vendor prefixes defined
cfg.vendorPrefixes || (cfg.vendorPrefixes = ["", "Moz", "Webkit", "O", "ms"]);
@@ -395,7 +380,7 @@ define(
app_name: App.name,
oscpu: 1,
mac_addr: null,
- deploytype: cfg.deployType,
+ deploytype: deployType,
ostype: Platform.osname,
osarch: null,
app_id: App.id,
@@ -408,7 +393,7 @@ define(
// app start event
analytics.add("ti.start", "ti.start", {
tz: (new Date()).getTimezoneOffset(),
- deploytype: cfg.deployType,
+ deploytype: deployType,
os: Platform.osname,
osver: Platform.ostype,
version: cfg.tiVersion,
View
9 mobileweb/titanium/Ti/API.js
@@ -4,9 +4,12 @@ define(["Ti/_/Evented", "Ti/_/lang"], function(Evented, lang) {
require.each(["debug", "error", "info", "log", "warn"], function(fn) {
api[fn] = function() {
- console[fn]("[" + fn.toUpperCase() + "] " + lang.toArray(arguments).map(function(a) {
- return require.is(a, "Object") ? a.hasOwnProperty("toString") ? a.toString() : JSON.stringify(a) : a === null ? "null" : a === void 0 ? "undefined" : a;
- }).join(' '));
+ if (!!window.console) {
+ var message = "[" + fn.toUpperCase() + "] " + lang.toArray(arguments).map(function(a) {
+ return require.is(a, "Object") ? a.hasOwnProperty("toString") ? a.toString() : JSON.stringify(a) : a === null ? "null" : a === void 0 ? "undefined" : a;
+ }).join(' ');
+ fn in console ? console[fn](message) : console.log(message);
+ }
};
});
View
10 mobileweb/titanium/Ti/Locale.js
@@ -1,4 +1,4 @@
-define(["require", "Ti/_/lang", "Ti/_/Evented"], function(require, lang, Evented) {
+define(["require", "Ti/_/lang", "Ti/_/Evented", "Ti/API"], function(require, lang, Evented, API) {
var locale = lang.val(navigator.language,navigator.browserLanguage).replace(/^([^\-\_]+)[\-\_](.+)?$/, function(o, l, c){ return l.toLowerCase() + (c && "-" + c.toUpperCase()); }),
languageParts = locale.split("-"),
@@ -21,25 +21,25 @@ define(["require", "Ti/_/lang", "Ti/_/Evented"], function(require, lang, Evented
// format a date into a locale specific date format. Optionally pass a second argument (string) as either "short" (default), "medium" or "long" for controlling the date format.
String.formatDate = function(dt, fmt) {
- console.debug('Method "String.formatDate" is not implemented yet.');
+ API.debug('Method "String.formatDate" is not implemented yet.');
return dt.toString();
};
// format a date into a locale specific time format.
String.formatTime = function(dt) {
- console.debug('Method "String.formatTime" is not implemented yet.');
+ API.debug('Method "String.formatTime" is not implemented yet.');
return dt.toString();
};
// format a number into a locale specific currency format.
String.formatCurrency = function(amt) {
- console.debug('Method "String.formatCurrency" is not implemented yet.');
+ API.debug('Method "String.formatCurrency" is not implemented yet.');
return amt;
};
// format a number into a locale specific decimal format.
String.formatDecimal = function(dec) {
- console.debug('Method "String.formatDecimal" is not implemented yet.');
+ API.debug('Method "String.formatDecimal" is not implemented yet.');
return dec;
};
View
10 mobileweb/titanium/Ti/Network/HTTPClient.js
@@ -1,5 +1,5 @@
-define(["Ti/_", "Ti/_/declare", "Ti/_/lang", "Ti/_/Evented", "Ti/Network", "Ti/Blob", "Ti/_/event"],
- function(_, declare, lang, Evented, Network, Blob, event) {
+define(["Ti/_", "Ti/_/declare", "Ti/_/lang", "Ti/_/Evented", "Ti/Network", "Ti/Blob", "Ti/_/event", "Ti/API"],
+ function(_, declare, lang, Evented, Network, Blob, event, API) {
var is = require.is,
on = require.on;
@@ -11,12 +11,12 @@ define(["Ti/_", "Ti/_/declare", "Ti/_/lang", "Ti/_/Evented", "Ti/Network", "Ti/B
this._handles = [
on(xhr, "error", this, "_onError"),
- on(xhr.upload, "error", this, "_onError"),
+ xhr.upload && on(xhr.upload, "error", this, "_onError"),
on(xhr, "progress", this, function(evt) {
evt.progress = evt.lengthComputable ? evt.loaded / evt.total : false;
is(this.ondatastream, "Function") && this.ondatastream.call(this, evt);
}),
- on(xhr.upload, "progress", this, function(evt) {
+ xhr.upload && on(xhr.upload, "progress", this, function(evt) {
evt.progress = evt.lengthComputable ? evt.loaded / evt.total : false;
is(this.onsendstream, "Function") && this.onsendstream.call(this, evt);
})
@@ -117,7 +117,7 @@ define(["Ti/_", "Ti/_/declare", "Ti/_/lang", "Ti/_/Evented", "Ti/Network", "Ti/B
!this._completed && this._onError("Request timed out");
}
}, timeout)));
- } catch (ex) {console.debug(ex)}
+ } catch (ex) {API.debug(ex)}
},
setRequestHeader: function(name, value) {
View
2  mobileweb/titanium/Ti/Platform.js
@@ -7,7 +7,7 @@ define(["Ti/_", "Ti/_/browser", "Ti/_/Evented", "Ti/_/lang", "Ti/Locale", "Ti/_/
mid = matches ? decodeURIComponent(matches[1]) : void 0,
unloaded,
on = require.on,
- hiddenIFrame = dom.create("iframe",{id: "urlOpener", display: "none"},doc.body);
+ hiddenIFrame = dom.create("iframe",{id: "urlOpener", style: {display: "none"} },doc.body);
mid || (mid = localStorage.getItem(midName));
mid || localStorage.setItem(midName, mid = _.uuid());
View
13 mobileweb/titanium/Ti/UI.js
@@ -1,6 +1,6 @@
define(
- ["Ti/_", "Ti/_/Evented", "Ti/_/lang", "Ti/_/ready", "Ti/_/style", "Ti/_/dom"],
- function(_, Evented, lang, ready, style, dom) {
+ ["Ti/_", "Ti/_/Evented", "Ti/_/lang", "Ti/_/ready", "Ti/_/style", "Ti/_/dom", "Ti/API"],
+ function(_, Evented, lang, ready, style, dom, API) {
var global = window,
body = document.body,
@@ -194,6 +194,7 @@ define(
break;
}
}
+ parent._markedForLayout = true;
previousParent = parent;
parent = parent._parent;
@@ -244,7 +245,7 @@ define(
node._layout._doLayout(node, node._measuredWidth, node._measuredHeight, node._getInheritedWidth() === Ti.UI.SIZE, node._getInheritedHeight() === Ti.UI.SIZE);
}
- showStats && console.debug("Layout " + self._layoutCount + ": " + self._elementLayoutCount +
+ showStats && API.debug("Layout " + self._layoutCount + ": " + self._elementLayoutCount +
" elements laid out in " + ((new Date().getTime() - startTime)) + "ms");
self._layoutInProgress = false;
@@ -344,9 +345,9 @@ define(
TEXT_AUTOCAPITALIZATION_NONE: 0,
TEXT_AUTOCAPITALIZATION_SENTENCES: 2,
TEXT_AUTOCAPITALIZATION_WORDS: 1,
- TEXT_VERTICAL_ALIGNMENT_BOTTOM: 2,
- TEXT_VERTICAL_ALIGNMENT_CENTER: 1,
- TEXT_VERTICAL_ALIGNMENT_TOP: 3,
+ TEXT_VERTICAL_ALIGNMENT_BOTTOM: "bottom",
+ TEXT_VERTICAL_ALIGNMENT_CENTER: "center",
+ TEXT_VERTICAL_ALIGNMENT_TOP: "top",
ANIMATION_CURVE_EASE_IN: 1,
ANIMATION_CURVE_EASE_IN_OUT: 2,
ANIMATION_CURVE_EASE_OUT: 3,
View
102 mobileweb/titanium/Ti/UI/ActivityIndicator.js
@@ -1,32 +1,29 @@
-define(["Ti/_/declare", "Ti/_/lang", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/style", "Ti/Locale", "Ti/UI"],
- function(declare, lang, FontWidget, dom, style, Locale, UI) {
+define(["Ti/_/declare", "Ti/_/lang", "Ti/_/UI/Widget", "Ti/_/dom", "Ti/_/style", "Ti/Locale", "Ti/UI"],
+ function(declare, lang, Widget, dom, style, Locale, UI) {
var opacity = 0.3,
- setStyle = style.set,
- postMessage = {
- post: "_renderMessage"
- };
+ setStyle = style.set;
- return declare("Ti.UI.ActivityIndicator", FontWidget, {
+ return declare("Ti.UI.ActivityIndicator", Widget, {
constructor: function() {
var prongs = this._prongs = [],
- container = this._contentContainer = dom.create("div", {
- className: "TiUIActivityIndicatorContentContainer",
- style: {
- boxOrient: "horizontal",
- boxPack: "center",
- boxAlign: "center",
- pointerEvents: "none"
- }
- }, this.domNode),
- indicator = this._indicatorIndicator = dom.create("div", {
- className: "TiUIActivityIndicatorIndicator",
- style: {
- pointerEvents: "none"
- }
- }, container),
- i = 0;
+ i = 0,
+ contentContainer = this._contentContainer = UI.createView({
+ layout: "horizontal",
+ width: UI.SIZE,
+ height: UI.SIZE
+ });
+ contentContainer._layout._defaultVerticalAlignment = "center";
+ this._add(contentContainer);
+ contentContainer.hide();
+
+ contentContainer._add(this._indicatorIndicator = UI.createView({
+ width: 36,
+ height: 36
+ }));
+
+ contentContainer._add(this._indicatorMessage = UI.createLabel());
for (; i < 12; i++) {
prongs.push(dom.create("div", {
@@ -36,20 +33,13 @@ define(["Ti/_/declare", "Ti/_/lang", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/sty
transformOrigin: "2px 18px",
opacity: opacity
}
- }, this._indicatorIndicator));
+ }, this._indicatorIndicator.domNode));
}
-
- this._addStyleableDomNode(this._indicatorMessage = dom.create("div", {
- className: "TiUIActivityIndicatorMessage",
- style: {
- pointerEvents: "none"
- }
- }, container));
},
show: function() {
if (!this._visible) {
- setStyle(this._contentContainer, "display", ["-webkit-box", "-moz-box"]);
+ this._contentContainer.show();
this._timer = setInterval(lang.hitch(this, "_animate"), 100);
this._visible = 1;
}
@@ -58,7 +48,7 @@ define(["Ti/_/declare", "Ti/_/lang", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/sty
hide: function() {
clearTimeout(this._timer);
if (this._visible) {
- setStyle(this._contentContainer, "display", "none");
+ this._contentContainer.hide();
this._visible = 0;
}
},
@@ -86,29 +76,31 @@ define(["Ti/_/declare", "Ti/_/lang", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/sty
_messagePadding: 0,
- _getContentSize: function(width, height) {
- var msg = this._getMessage();
- return {
- width: 36 + this._measureText(msg, this._indicatorMessage).width + this._messagePadding,
- height: Math.max(this._measureText(msg, this._indicatorMessage).height, 36)
- };
- },
-
- _getMessage: function() {
- return Locale._getString(this.messageid, this.message);
- },
-
- _renderMessage: function() {
- var msg = this._getMessage();
- this._messagePadding = msg ? 5 : 0;
- setStyle(this._indicatorMessage, "paddingLeft", dom.unitize(this._messagePadding));
- this._indicatorMessage.innerHTML = msg;
- this._hasSizeDimensions() && this._triggerLayout();
- },
-
properties: {
- message: postMessage,
- messageid: postMessage
+ color: {
+ set: function(value) {
+ return this._indicatorMessage.color = value;
+ }
+ },
+ font: {
+ set: function(value) {
+ return this._indicatorMessage.font = value;
+ }
+ },
+ message: {
+ set: function(value) {
+ var indicatorMessage = this._indicatorMessage;
+ indicatorMessage.left = value ? 5 : 0;
+ return indicatorMessage.text = value;
+ }
+ },
+ messageid: {
+ set: function(value) {
+ var indicatorMessage = this._indicatorMessage;
+ indicatorMessage.left = value ? 5 : 0;
+ return indicatorMessage.textid = value;
+ }
+ }
}
});
View
101 mobileweb/titanium/Ti/UI/Button.js
@@ -12,52 +12,33 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
return declare("Ti.UI.Button", FontWidget, {
constructor: function() {
- this._contentContainer = dom.create("div", {
- className: "TiUIButtonContentContainer",
- style: {
- display: ["-webkit-box", "-moz-box"],
- boxOrient: "horizontal",
- boxPack: "center",
- boxAlign: "center",
- pointerEvents: "none",
- width: "100%",
- height: "100%"
- }
- }, this.domNode);
-
- this._buttonImage = dom.create("img", {
- className: "TiUIButtonImage",
- style: {
- pointerEvents: "none"
- }
- }, this._contentContainer);
-
- this._buttonTitle = dom.create("div", {
- className: "TiUIButtonTitle",
- style: {
- whiteSpace: "nowrap",
- pointerEvents: "none",
- userSelect: "none"
- }
- }, this._contentContainer);
-
- this._addStyleableDomNode(this._buttonTitle);
+ var contentContainer = this._contentContainer = UI.createView({
+ width: UI.SIZE,
+ height: UI.SIZE,
+ layout: "horizontal",
+ borderColor: "transparent"
+ });
+ contentContainer._layout._defaultVerticalAlignment = "center";
+ this._add(contentContainer);
+ contentContainer._add(this._buttonImage = UI.createImageView());
+ contentContainer.add(this._buttonTitle = UI.createLabel());
+ this._addStyleableDomNode(this._buttonTitle.domNode);
this._setDefaultLook();
this.addEventListener("touchstart",function(){
if (this.selectedColor) {
- setStyle(this._buttonTitle,"color",this.selectedColor);
+ this._buttonTitle.color = this.selectedColor;
}
});
this.addEventListener("touchend",function(){
if (this.selectedColor) {
- setStyle(this._buttonTitle,"color",this.color || "black");
+ this._buttonTitle.color = this.color || "black";
}
});
this.domNode.addEventListener("mouseout",lang.hitch(this,function(){
if (this.selectedColor) {
- setStyle(this._buttonTitle,"color",this.color || "black");
+ this._buttonTitle.color = this.color || "black";
}
}));
},
@@ -79,36 +60,27 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
_setDefaultLook: function() {
if (!this._hasDefaultLook) {
this._hasDefaultLook = true;
+ this._previousBorderWidth = this.borderWidth;
+ this._previousBorderColor = this.borderColor;
css.add(this.domNode, "TiUIElementGradient");
css.add(this.domNode, "TiUIButtonDefault");
+ this._contentContainer.borderWidth = 6;
}
},
_clearDefaultLook: function() {
if (this._hasDefaultLook) {
this._hasDefaultLook = false;
+ this.borderWidth = this._previousBorderWidth;
+ this.borderColor = this._previousBorderColor;
css.remove(this.domNode, "TiUIElementGradient");
css.remove(this.domNode, "TiUIButtonDefault");
+ this._contentContainer.borderWidth = 0;
}
},
-
- _getContentSize: function(width, height) {
- return {
- width: this._buttonImage.width + this._measureText(this.title, this._buttonTitle).width,
- height: Math.max(this._buttonImage.height, this._measureText(this.title, this._buttonTitle).height)
- };
- },
-
- _setTouchEnabled: function(value) {
- FontWidget.prototype._setTouchEnabled.apply(this, arguments);
- var cssVal = value ? "auto" : "none";
- setStyle(this._contentContainer, "pointerEvents", cssVal);
- setStyle(this._buttonImage, "pointerEvents", cssVal);
- setStyle(this._buttonTitle, "pointerEvents", cssVal);
- },
_updateTitle: function() {
- this._buttonTitle.innerHTML = Locale._getString(this.titleid, this.title);
+ this._buttonTitle.text = Locale._getString(this.titleid, this.title);
this._hasSizeDimensions() && this._triggerLayout();
},
@@ -153,17 +125,25 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
image: {
set: function(value) {
- require.on(this._buttonImage, "load", lang.hitch(this, function () {
- this._hasSizeDimensions() && this._triggerLayout();
- }));
- this._buttonImage.src = value;
+ this._buttonImage.image = value;
return value;
}
},
selectedColor: void 0,
textAlign: {
set: function(value) {
- setStyle(this._contentContainer, "boxPack", value === UI.TEXT_ALIGNMENT_LEFT ? "start" : value === UI.TEXT_ALIGNMENT_RIGHT ? "end" : "center");
+ var left,
+ right,
+ center = this.center || {},
+ contentContainer = this._contentContainer;
+ switch(value) {
+ case UI.TEXT_ALIGNMENT_LEFT: left = 0; break;
+ case UI.TEXT_ALIGNMENT_CENTER: center.x = "50%"; break;
+ case UI.TEXT_ALIGNMENT_RIGHT: right = 0; break;
+ }
+ contentContainer.left = left;
+ contentContainer.center = center;
+ contentContainer.right = right;
return value;
}
},
@@ -171,7 +151,18 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
titleid: titlePost,
verticalAlign: {
set: function(value) {
- setStyle(this._contentContainer, "boxAlign", value === UI.TEXT_VERTICAL_ALIGNMENT_TOP ? "start" : value === UI.TEXT_VERTICAL_ALIGNMENT_BOTTOM ? "end" : "center");
+ var top,
+ bottom,
+ center = this.center || {},
+ contentContainer = this._contentContainer;
+ switch(value) {
+ case UI.TEXT_VERTICAL_ALIGNMENT_TOP: top = 0; break;
+ case UI.TEXT_VERTICAL_ALIGNMENT_CENTER: center.y = "50%"; break;
+ case UI.TEXT_VERTICAL_ALIGNMENT_BOTTOM: bottom = 0; break;
+ }
+ contentContainer.top = top;
+ contentContainer.center = center;
+ contentContainer.bottom = bottom;
return value;
},
value: UI.TEXT_VERTICAL_ALIGNMENT_CENTER
View
83 mobileweb/titanium/Ti/UI/Label.js
@@ -11,44 +11,29 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
return declare("Ti.UI.Label", FontWidget, {
constructor: function() {
- // Create the aligner div. This sets up a flexbox to float the text to the middle
- var aligner = this.textAlignerDiv = dom.create("div", {
- className: css.clean("TiUILabelTextAligner"),
- style: {
- display: ["-webkit-box", "-moz-box"],
- boxOrient: "vertical",
- boxPack: "center"
- }
- }, this.domNode);
-
- // Create the container div. This gets floated by the flexbox
- this.textContainerDiv = dom.create("div", {
- className: css.clean("TiUILabelTextContainer")
- }, aligner);
-
- this._addStyleableDomNode(this.textContainerDiv);
+ this._add(this._textContainer = UI.createView({
+ width: UI.INHERIT,
+ height: UI.SIZE,
+ center: {y: "50%"}
+ }));
+
+ var self = this,
+ textContainerDomNode = this._textContainerDomNode = this._textContainer.domNode;
+ self._textContainer._getContentSize = function(width, height) {
+ var text = self._textContainerDomNode.innerHTML;
+ return {
+ width: self._measureText(text, textContainerDomNode, width).width,
+ height: self._measureText(text, textContainerDomNode, width).height
+ };
+ };
+ this._addStyleableDomNode(textContainerDomNode);
this.wordWrap = true;
},
_defaultWidth: UI.SIZE,
_defaultHeight: UI.SIZE,
-
- _getContentSize: function(width, height) {
- var text = this._getText();
- return {
- width: this._measureText(text, this.textContainerDiv, width).width,
- height: this._measureText(text, this.textContainerDiv, width).height
- };
- },
-
- _setTouchEnabled: function(value) {
- FontWidget.prototype._setTouchEnabled.apply(this,arguments);
- var cssVal = value ? "auto" : "none"
- setStyle(this.textAlignerDiv,"pointerEvents", cssVal);
- setStyle(this.textContainerDiv,"pointerEvents", cssVal);
- },
_getText: function() {
var i,
@@ -84,14 +69,14 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
},
_setText: function() {
- this.textContainerDiv.innerHTML = this._getText();
+ this._textContainerDomNode.innerHTML = this._getText();
this._hasSizeDimensions() && this._triggerLayout();
},
_setTextShadow: function() {
var shadowColor = this.shadowColor && this.shadowColor !== "" ? this.shadowColor : void 0;
setStyle(
- this.textContainerDiv,
+ this._textContainerDomNode,
"textShadow",
this.shadowOffset || shadowColor
? (this.shadowOffset ? unitize(this.shadowOffset.x) + " " + unitize(this.shadowOffset.y) : "0px 0px") + " 0.1em " + lang.val(shadowColor,"black")
@@ -102,43 +87,59 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
properties: {
ellipsize: {
set: function(value) {
- setStyle(this.textContainerDiv,"textOverflow", !!value ? "ellipsis" : "clip");
+ setStyle(this._textContainerDomNode,"textOverflow", !!value ? "ellipsis" : "clip");
return value;
},
value: true
},
html: {
set: function(value) {
- this.textContainerDiv.innerHTML = value;
+ this._textContainerDomNode.innerHTML = value;
this._hasSizeDimensions() && this._triggerLayout();
return value;
}
},
shadowColor: {
- post: function(value) {
+ post: function() {
this._setTextShadow();
- return value;
}
},
shadowOffset: {
- post: function(value) {
+ post: function() {
this._setTextShadow();
- return value;
}
},
text: textPost,
textAlign: {
set: function(value) {
- setStyle(this.textContainerDiv, "textAlign", /(center|right)/.test(value) ? value : "left");
+ setStyle(this._textContainerDomNode, "textAlign", /(center|right)/.test(value) ? value : "left");
return value;
}
},
textid: textPost,
wordWrap: {
set: function(value) {
- setStyle(this.textContainerDiv, "whiteSpace", !!value ? "normal" : "nowrap");
+ setStyle(this._textContainerDomNode, "whiteSpace", !!value ? "normal" : "nowrap");
return value;
}
+ },
+ verticalAlign: {
+ set: function(value) {
+ var top,
+ bottom,
+ center = this.center || {},
+ textContainer = this._textContainer;
+ switch(value) {
+ case UI.TEXT_VERTICAL_ALIGNMENT_TOP: top = 0; break;
+ case UI.TEXT_VERTICAL_ALIGNMENT_CENTER: center.y = "50%"; break;
+ case UI.TEXT_VERTICAL_ALIGNMENT_BOTTOM: bottom = 0; break;
+ }
+ textContainer.top = top;
+ textContainer.center = center;
+ textContainer.bottom = bottom;
+ return value;
+ },
+ value: UI.TEXT_VERTICAL_ALIGNMENT_CENTER
}
}
View
136 mobileweb/titanium/Ti/UI/Switch.js
@@ -11,61 +11,30 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
constructor: function(args) {
- // This container holds the flex boxes used to position the elements
- this._contentContainer = dom.create("div", {
- className: "TiUISwitchContentContainer",
- style: {
- display: ["-webkit-box", "-moz-box"],
- boxOrient: "vertical",
- boxPack: "center",
- boxAlign: "stretch",
- width: "100%",
- height: "100%"
- }
- }, this.domNode)
+ var contentContainer = this._contentContainer = UI.createView({
+ width: UI.INHERIT,
+ height: UI.INHERIT,
+ layout: "vertical",
+ borderColor: "transparent"
+ });
+ contentContainer._forceInheritenceToFillOrSize = true;
+ this._add(contentContainer);
- // Create the text box and a flex box to align it
- this._titleContainer = dom.create("div", {
- className: "TiUISwitchTextAligner",
- style: {
- display: ["-webkit-box", "-moz-box"],
- boxOrient: "vertical",
- boxPack: "center",
- boxAlign: "center",
- boxFlex: 1
- }
- }, this._contentContainer);
- this._switchTitle = dom.create("div", {
- className: "TiUISwitchTitle",
- style: {
- whiteSpace: "nowrap",
- pointerEvents: "none",
- textAlign: "center"
- }
- }, this._titleContainer);
- this._addStyleableDomNode(this._switchTitle);
-
- // Create the switch indicator and a flex box to contain it
- this._indicatorContainer = dom.create("div", {
- className: "TiUISwitchTextAligner",
- style: {
- display: ["-webkit-box", "-moz-box"],
- boxPack: "center",
- boxAlign: "center",
- marginTop: "3px"
- }
- }, this._contentContainer);
- this._switchIndicator = dom.create("div", {
- className: "TiUISwitchIndicator",
- style: {
- padding: "4px 4px",
- borderRadius: "4px",
- border: "1px solid #888",
- pointerEvents: "none",
- width: "40px"
- }
- }, this._indicatorContainer);
- this._switchIndicator.domNode += " TiUISwitchIndicator";
+ contentContainer._add(this._switchTitle = UI.createLabel({
+ width: UI.INHERIT,
+ height: UI.INHERIT,
+ verticalAlign: UI.TEXT_VERTICAL_ALIGNMENT_CENTER,
+ textAlign: UI.TEXT_ALIGNMENT_CENTER
+ }));
+ this._switchTitle._forceInheritenceToFillOrSize = true;
+
+ contentContainer._add(this._switchIndicator = UI.createView({
+ width: 40,
+ height: 10,
+ borderRadius: 4,
+ borderWidth: 1,
+ borderColor: "#888"
+ }));
// Set the default look
this._setDefaultLook();
@@ -90,43 +59,25 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
_setDefaultLook: function() {
if (!this._hasDefaultLook) {
this._hasDefaultLook = true;
- css.add(this.domNode, "TiUIElementGradient");
this._previousBorderWidth = this.borderWidth;
this._previousBorderColor = this.borderColor;
- this.borderWidth = 1;
- this.borderColor = "#666";
- setStyle(this.domNode, {
- borderRadius: "6px",
- padding: "6px 6px"
- });
+ css.add(this.domNode, "TiUIElementGradient");
+ css.add(this.domNode, "TiUIButtonDefault");
+ this._contentContainer.borderWidth = 6;
}
},
_clearDefaultLook: function() {
if (this._hasDefaultLook) {
this._hasDefaultLook = false;
- var className = this.domNode.className;
- css.remove(this.domNode, "TiUIElementGradient");
this.borderWidth = this._previousBorderWidth;
this.borderColor = this._previousBorderColor;
- setStyle(this.domNode, {
- borderRadius: "",
- padding: ""
- });
+ css.remove(this.domNode, "TiUIElementGradient");
+ css.remove(this.domNode, "TiUIButtonDefault");
+ this._contentContainer.borderWidth = 0;
}
},
- _getContentSize: function(width, height) {
- var defaultLookOffset = (this._hasDefaultLook ? 12 : 0);
- return {
- width: Math.max(this._measureText(this._switchTitle.innerHTML, this._switchTitle).width, this._switchIndicator.offsetWidth) + defaultLookOffset,
- height: this._measureText(this._switchTitle.innerHTML, this._switchTitle).height + // Text height
- this._switchIndicator.offsetHeight + // Indicator height
- 3 + // Padding between the indicator and text
- defaultLookOffset // Border of the default style
- };
- },
-
_defaultWidth: UI.SIZE,
_defaultHeight: UI.SIZE,
@@ -172,13 +123,7 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
textAlign: {
set: function(value) {
- var cssValue = "";
- switch(value) {
- case UI.TEXT_VERTICAL_ALIGNMENT_TOP: cssValue = "start"; break;
- case UI.TEXT_VERTICAL_ALIGNMENT_CENTER: cssValue = "center"; break;
- case UI.TEXT_VERTICAL_ALIGNMENT_BOTTOM: cssValue = "end"; break;
- }
- setStyle(this._titleContainer, "boxAlign", cssValue);
+ this._switchTitle.textAlign = value;
return value;
}
},
@@ -186,8 +131,7 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
titleOff: {
set: function(value) {
if (!this.value) {
- this._switchTitle.innerHTML = value;
- this._hasSizeDimensions() && this._triggerLayout();
+ this._switchTitle.text = value;
}
return value;
},
@@ -197,8 +141,7 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
titleOn: {
set: function(value) {
if (this.value) {
- this._switchTitle.innerHTML = value;
- this._hasSizeDimensions() && this._triggerLayout();
+ this._switchTitle.text = value;
}
return value;
},
@@ -207,12 +150,9 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
value: {
set: function(value) {
- setStyle(this._switchIndicator,{
- backgroundColor: value ? "#0f0" : "#aaa"
- });
+ this._switchIndicator.backgroundColor = value ? "#0f0" : "#aaa";
value = !!value;
- this._switchTitle.innerHTML = value ? this.titleOn : this.titleOff;
- this._hasSizeDimensions() && this._triggerLayout();
+ this._switchTitle.text = value ? this.titleOn : this.titleOff;
return value;
},
post: function() {
@@ -224,13 +164,7 @@ define(["Ti/_/declare", "Ti/_/UI/FontWidget", "Ti/_/dom", "Ti/_/css", "Ti/_/styl
verticalAlign: {
set: function(value) {
- var cssValue = "";
- switch(value) {
- case UI.TEXT_VERTICAL_ALIGNMENT_TOP: cssValue = "start"; break;
- case UI.TEXT_VERTICAL_ALIGNMENT_CENTER: cssValue = "center"; break;
- case UI.TEXT_VERTICAL_ALIGNMENT_BOTTOM: cssValue = "end"; break;
- }
- setStyle(this._titleContainer, "boxPack", cssValue);
+ this._switchTitle.verticalAlign = value;
},
value: UI.TEXT_VERTICAL_ALIGNMENT_CENTER
}
View
44 mobileweb/titanium/Ti/UI/Tab.js
@@ -8,28 +8,24 @@ define(["Ti/_/declare", "Ti/UI/View", "Ti/_/dom", "Ti/Locale", "Ti/UI"],
return declare("Ti.UI.Tab", View, {
constructor: function(args) {
- var container = this._contentContainer = dom.create("div", {
- className: "TiUITabContentContainer",
- style: {
- display: ["-webkit-box", "-moz-box"],
- boxOrient: "vertical",
- boxPack: "center",
- boxAlign: "center"
- }
- }, this.domNode);
-
- this._tabIcon = dom.create("img", {
- className: "TiUITabImage"
- }, container);
-
- this._tabTitle = dom.create("div", {
- className: "TiUITabTitle",
- style: {
- whiteSpace: "nowrap",
- pointerEvents: "none",
- userSelect: "none"
- }
- }, container);
+
+ var container = UI.createView({
+ layout: "vertical",
+ width: "100%",
+ height: UI.SIZE
+ });
+ this._add(container);
+
+ container.add(this._tabIcon = UI.createImageView({
+ height: UI.SIZE,
+ width: UI.SIZE
+ }));
+
+ container.add(this._tabTitle = UI.createLabel({
+ width: "100%",
+ wordWrap: true,
+ textAlign: UI.TEXT_ALIGNMENT_CENTER
+ }));
var self = this;
this.addEventListener("singletap", function(e) {
@@ -58,7 +54,7 @@ define(["Ti/_/declare", "Ti/UI/View", "Ti/_/dom", "Ti/Locale", "Ti/UI"],
},
_setTitle: function() {
- this._tabTitle.innerHTML = Locale._getString(this.titleid, this.title);
+ this._tabTitle.text = Locale._getString(this.titleid, this.title);
},
properties: {
@@ -70,7 +66,7 @@ define(["Ti/_/declare", "Ti/UI/View", "Ti/_/dom", "Ti/Locale", "Ti/UI"],
icon: {
set: function(value) {
- return this._tabIcon.src = value;
+ return this._tabIcon.image = value;
}
},
View
4 mobileweb/titanium/Ti/_/Layouts/Base.js
@@ -1,4 +1,4 @@
-define(["Ti/_/css", "Ti/_/declare", "Ti/_/style", "Ti/_/dom"], function(css, declare, style, dom) {
+define(["Ti/_/css", "Ti/_/declare", "Ti/_/style", "Ti/_/dom", "Ti/API"], function(css, declare, style, dom, API) {
return declare("Ti._.Layouts.Base", null, {
@@ -13,7 +13,7 @@ define(["Ti/_/css", "Ti/_/declare", "Ti/_/style", "Ti/_/dom"], function(css, dec
verifyChild: function(child, parent) {
if (!child._alive || !child.domNode) {
- console.debug("WARNING: Attempting to layout element that has been destroyed.\n\t Removing the element from the parent.\n\t The parent has a widget ID of " + parent.widgetId + ".");
+ API.debug("WARNING: Attempting to layout element that has been destroyed.\n\t Removing the element from the parent.\n\t The parent has a widget ID of " + parent.widgetId + ".");
var children = parent.children;
children.splice(children.indexOf(child),1);
return;
View
40 mobileweb/titanium/Ti/_/Layouts/Horizontal.js
@@ -7,20 +7,26 @@ define(["Ti/_/Layouts/Base", "Ti/_/declare", "Ti/UI"], function(Base, declare, U
currentLeft = 0,
children = element.children,
availableWidth = width,
- childrenWithFillWidth = false;
+ tallestChildHeight = 0,
+ child,
+ childDimensions,
+ childWidth,
+ i,
+ precalculate = isHeightSize,
+ isWidthFill,
+ bottomMostEdge;
// Determine if any children have fill height
- for (var i = 0; i < children.length; i++) {
- children[i]._hasFillWidth() && (childrenWithFillWidth = true);
+ for (i = 0; i < children.length; i++) {
+ children[i]._hasFillWidth() && (precalculate = true);
}
- if (childrenWithFillWidth) {
- for (var i = 0; i < children.length; i++) {
- var child = children[i];
+ if (precalculate) {
+ for (i = 0; i < children.length; i++) {
+ child = children[i];
if (this.verifyChild(child,element) && !child._hasFillWidth()) {
- var childWidth;
if (child._markedForLayout) {
- childWidth = child._doLayout({
+ childDimensions = child._doLayout({
origin: {
x: 0,
y: 0