Skip to content

Commit

Permalink
Merge branch 'master' into timob-7799
Browse files Browse the repository at this point in the history
  • Loading branch information
nebrius committed Mar 29, 2012
2 parents 3e9e1a2 + ac3852d commit 1481177
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 38 deletions.
Expand Up @@ -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)) {
Expand Down
Expand Up @@ -502,6 +502,7 @@ protected class AnimationListener implements Animation.AnimationListener
{
public void onAnimationEnd(Animation a)
{

if (relayoutChild) {
LayoutParams params = (LayoutParams) view.getLayoutParams();
TiConvert.fillLayout(options, params);
Expand All @@ -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);
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
44 changes: 26 additions & 18 deletions apidoc/Titanium/Database/DB.yml
Expand Up @@ -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`.
Expand All @@ -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,
Expand All @@ -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
57 changes: 41 additions & 16 deletions apidoc/Titanium/Database/ResultSet.yml
Expand Up @@ -5,6 +5,7 @@ extends: Titanium.Proxy
since: "0.1"
createable: false
platforms: [android, iphone, ipad]

methods:
- name: close
summary: |
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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');
Expand All @@ -126,20 +150,21 @@ 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();
}
rows.close();
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.
2 changes: 1 addition & 1 deletion apidoc/Titanium/Media/VideoPlayer.yml
Expand Up @@ -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: |
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit 1481177

Please sign in to comment.