Skip to content

Commit

Permalink
Merge branch 'master' into TIMOB-27737
Browse files Browse the repository at this point in the history
  • Loading branch information
garymathews committed Feb 11, 2020
2 parents fb807b6 + 19f532b commit b2e7524
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 34 deletions.
7 changes: 7 additions & 0 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,13 @@ AndroidBuilder.prototype.validate = function validate(logger, config, cli) {
// determine the abis to support
this.abis = this.validABIs;
const customABIs = cli.tiapp.android && cli.tiapp.android.abi && cli.tiapp.android.abi.indexOf('all') === -1;
if (!customABIs && (this.deployType === 'production')) {
// If "tiapp.xml" does not have <abi/> entry, then exclude "x86" and "x86_64" from production builds by default.
// These abis are mostly needed for testing in an emulator. Physical x86 devices are extremely rare.
this.abis = this.abis.filter(abi => {
return !abi.startsWith('x86');
});
}
if (customABIs) {
this.abis = cli.tiapp.android.abi;
this.abis.forEach(function (abi) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem;
import android.app.Activity;
import android.os.Message;
import android.view.View;

// clang-format off
@Kroll.proxy(creatableInModule = UIModule.class,
propertyAccessors = {
Expand Down Expand Up @@ -171,6 +173,16 @@ public void remove(TiViewProxy control)
}
}

@Override
public KrollDict getRect()
{
View v = null;
if (tableViewItem != null) {
v = tableViewItem.getContentView();
}
return getViewRect(v);
}

public void setTableViewItem(TiTableViewRowProxyItem item)
{
this.tableViewItem = item;
Expand Down Expand Up @@ -201,9 +213,14 @@ public boolean handleMessage(Message msg)
if (tableViewItem != null) {
tableViewItem.setRowData(this);
// update/refresh table view when a row's data changed.
TiUITableView table = getTable().getTableView();
table.setModelDirty();
table.updateView();
TableViewProxy proxy = getTable();
if (proxy != null) {
TiUITableView table = (TiUITableView) proxy.peekView();
if (table != null) {
table.setModelDirty();
table.updateView();
}
}
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,6 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
} else {
h = Math.max(minRowHeight, height.getAsPixels(this));
}
// Make sure the height is greater than 1 (not 0 since image views default to 1)
if (hasChildView && h > 1) {
content.getLayoutParams().height = h;
}

if (Log.isDebugModeEnabled()) {
Log.d(TAG, "Row content measure (" + adjustedWidth + "x" + h + ")", Log.DEBUG_MODE);
Expand Down Expand Up @@ -656,6 +652,11 @@ public Drawable getSelectorDrawable()
return selectorDrawable;
}

public TiCompositeLayout getContentView()
{
return this.content;
}

@Override
public void release()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,31 +273,34 @@ public boolean handleMessage(Message msg)
public KrollDict getRect()
// clang-format on
{
KrollDict d = new KrollDict();
View v = null;
if (view != null) {
View v = view.getOuterView();
if (v != null) {
int position[] = new int[2];
v.getLocationInWindow(position);

TiDimension nativeWidth = new TiDimension(v.getWidth(), TiDimension.TYPE_WIDTH);
TiDimension nativeHeight = new TiDimension(v.getHeight(), TiDimension.TYPE_HEIGHT);
TiDimension nativeLeft = new TiDimension(position[0], TiDimension.TYPE_LEFT);
TiDimension nativeTop = new TiDimension(position[1], TiDimension.TYPE_TOP);
TiDimension localLeft = new TiDimension(v.getX(), TiDimension.TYPE_LEFT);
TiDimension localTop = new TiDimension(v.getY(), TiDimension.TYPE_TOP);
v = view.getOuterView();
}
return getViewRect(v);
}

// TiDimension needs a view to grab the window manager, so we'll just use the decorview of the current window
View decorView = TiApplication.getAppRootOrCurrentActivity().getWindow().getDecorView();
if (decorView != null) {
d.put(TiC.PROPERTY_WIDTH, nativeWidth.getAsDefault(decorView));
d.put(TiC.PROPERTY_HEIGHT, nativeHeight.getAsDefault(decorView));
d.put(TiC.PROPERTY_X, localLeft.getAsDefault(decorView));
d.put(TiC.PROPERTY_Y, localTop.getAsDefault(decorView));
d.put(TiC.PROPERTY_X_ABSOLUTE, nativeLeft.getAsDefault(decorView));
d.put(TiC.PROPERTY_Y_ABSOLUTE, nativeTop.getAsDefault(decorView));
}
}
protected KrollDict getViewRect(View v)
{
KrollDict d = new KrollDict();
if (v != null) {
int position[] = new int[2];
v.getLocationInWindow(position);

TiDimension nativeWidth = new TiDimension(v.getWidth(), TiDimension.TYPE_WIDTH);
TiDimension nativeHeight = new TiDimension(v.getHeight(), TiDimension.TYPE_HEIGHT);
TiDimension nativeLeft = new TiDimension(position[0], TiDimension.TYPE_LEFT);
TiDimension nativeTop = new TiDimension(position[1], TiDimension.TYPE_TOP);
TiDimension localLeft = new TiDimension(v.getX(), TiDimension.TYPE_LEFT);
TiDimension localTop = new TiDimension(v.getY(), TiDimension.TYPE_TOP);

// TiDimension needs a view to grab the window manager.
d.put(TiC.PROPERTY_WIDTH, nativeWidth.getAsDefault(v));
d.put(TiC.PROPERTY_HEIGHT, nativeHeight.getAsDefault(v));
d.put(TiC.PROPERTY_X, localLeft.getAsDefault(v));
d.put(TiC.PROPERTY_Y, localTop.getAsDefault(v));
d.put(TiC.PROPERTY_X_ABSOLUTE, nativeLeft.getAsDefault(v));
d.put(TiC.PROPERTY_Y_ABSOLUTE, nativeTop.getAsDefault(v));
}
if (!d.containsKey(TiC.PROPERTY_WIDTH)) {
d.put(TiC.PROPERTY_WIDTH, 0);
Expand Down
8 changes: 4 additions & 4 deletions support/module/packaged/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@
"integrity": "sha512-jWm02Frq1M0mMfG9sVqgYmcgUQKJvtu1SWYoCmajZR/m8NKANPNtDVD0VH5Znx7X2KB87nF6I7L4kEYXaeXzNQ=="
},
"ti.map": {
"url": "https://github.com/appcelerator-modules/ti.map/releases/download/v5.0.0-android/ti.map-android-5.0.0.zip",
"integrity": "sha512-+CCV3N77tHvJtY+Sx6nVLJGMEEDO7ZquxuBnQ4WHN/9vJX3yM6ij4PV2PBpz7dE5TKSAUdhFAHw+vFKbWaSyhg=="
"url": "https://github.com/appcelerator-modules/ti.map/releases/download/v5.0.1-android/ti.map-android-5.0.1.zip",
"integrity": "sha512-W8Fq4DV3E8kcWqcZdjvoEbKHgqBumZS9jzi4gTiZf1OeeNoEsnXI4ZrjOZsO0VguuG9kra82EcXU6HMM/Jur0Q=="
},
"ti.webdialog": {
"url": "https://github.com/appcelerator-modules/titanium-web-dialog/releases/download/v2.0.0-android/ti.webdialog-android-2.0.0.zip",
"integrity": "sha512-+haYFThyviM98FRMBHAIQdEVjXUQBphdVad/XeW0Hpv1z2J7zwiKzLGiIaRpBGjrP/A4kdDh3jfiVqHxSfcbNg=="
},
"ti.playservices": {
"url": "https://github.com/appcelerator-modules/ti.playservices/releases/download/17.1.0/ti.playservices-android-17.1.0.zip",
"integrity": "sha512-sobsaptebR+OkCejTK98nXSGeLZicfQ9ULMEQ51kEtYKjCZQtKZLDfo2nV25/OXGz48mWYsUJLKERk4OAuwyXw=="
"url": "https://github.com/appcelerator-modules/ti.playservices/releases/download/v17.1.1/ti.playservices-android-17.1.1.zip",
"integrity": "sha512-/823uyjx5KL3kqCoyMGVjm7+S6KG8y0E8IYXMuf4JoO41gwcbSxIebltwzo/RyYGcYycVFnHqtudKOh0zN65aQ=="
},
"ti.identity": {
"url": "https://github.com/appcelerator-modules/titanium-identity/releases/download/v3.0.1-android/ti.identity-android-3.0.1.zip",
Expand Down
59 changes: 59 additions & 0 deletions tests/Resources/ti.ui.tableview.addontest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Appcelerator Titanium Mobile
* Copyright (c) 2015-Present by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
/* eslint-env mocha */
/* eslint no-unused-expressions: "off" */
'use strict';
var should = require('./utilities/assertions');

describe('Titanium.UI.TableView', function () {
var win;

this.timeout(5000);

afterEach(function (done) {
if (win) {
win.close();
}
win = null;

// timeout to allow window to close
setTimeout(() => {
done();
}, 500);
});

it.iosBroken('resize row with Ti.UI.SIZE on content height change', function (finish) {
var heights = [ 100, 200, 50 ];
var tableView = Ti.UI.createTableView({});
var row = Ti.UI.createTableViewRow({
height: Ti.UI.SIZE,
width: Ti.UI.FILL
});
var view = Ti.UI.createView({
height: heights.pop(),
backgroundColor: 'red'
});
row.add(view);
tableView.setData([ row ]);
tableView.addEventListener('postlayout', function onPostLayout() {
console.error('postlayout', row.rect.height, view.rect.height);
should(row.rect.height).be.eql(view.rect.height);
if (!heights.length) {
tableView.removeEventListener('postlayout', onPostLayout);
finish();
}
view.height = heights.pop();
});

win = Ti.UI.createWindow({
backgroundColor: 'blue'
});

win.add(tableView);
win.open();
});
});

0 comments on commit b2e7524

Please sign in to comment.