[TIMOB-14806] ProjectTemplate: values used as comparison to determine device form factor are wrong
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-02-13T21:25:41.000+0000 |
Affected Version/s | Release 3.1.2 |
Fix Version/s | 2013 Sprint 23, 2013 Sprint 25, 2013 Sprint 25 Tooling, Release 3.2.0 |
Components | Android, Templates |
Labels | qe-3.1.2, qe-closed-3.2.0, qe-testadded |
Reporter | Federico Casali |
Assignee | Christian Sullivan |
Created | 2013-08-10T01:38:09.000+0000 |
Updated | 2016-11-29T11:48:30.000+0000 |
Description
Problem description
In Appcelerator Studio template samples for classic projects, the values used as comparison to determine if the device is a tablet or a handheld are outdated and could lead to a wrong detection.Steps to reproduce
Create a new Single Window Project and open app.js. Check line:
var isTablet = osname === 'ipad' || (osname === 'android' && (width > 899 || height > 899));
A Google Galaxy Nexus device (for example) has those values:
height: 1184 width: 720
As a result, it is being detected as a 'tablet' while is a 'handheld' device.
PRs to [MASTER] https://github.com/appcelerator-developer-relations/Template.Tabbed/pull/6 https://github.com/appcelerator-developer-relations/Template.SingleWindow/pull/3 https://github.com/appcelerator-developer-relations/Template.MasterDetail/pull/3 https://github.com/appcelerator-developer-relations/Sample.Todo/pull/7 https://github.com/appcelerator-developer-relations/Sample.Mapping/pull/7
This issue is still reproducible. Still shows the below line in app.js file. Hence reopening this issue.
Test Environment - Appc Studio - 3.2.0.201310230601 SDK - 3.2.0.v20131022171645 acs -1.0.7 alloy - 1.2.2 titanium - 3.2.0 titanium-code-processor - 1.0.3 Xcode - 5.0.1 OS - Mac OS X Mavericks (10.9)
The PR is merged, and the new template is updated in the Studio ruble.
Verified fixed on: Mac OSX 10.9 Mavericks Titanium Studio, build: 3.2.0.201311160316 Titanium SDK, build: 3.2.0.v20131118142443 CLI: 3.2.0-alpha Alloy: 1.3.0 app.js by default shows: var isTablet = osname === 'ipad' || (osname === 'android' && (width > 720) && (height > 600)); Closing.
I don't get it. A Samsung Galaxy S4 has height:1920 & width:1080 which according to the fix will be considered as a tablet whereas its a handheld device. Reopening. Environment: Appcel Studio : 3.2.0.201311161724 Ti SDK : 3.2.0.v20131117001643 Mac OSX : 10.8.5 Alloy : 1.3.0 CLI - 3.2.0-alpha Device: Samsung Galaxy S4 running android 4.2.2
[~mxia] [~ingo] So what is the agreed parameters of a tablet? The lager devices may be handhelds, but they are considered Phablets which falls in between phone and tablet.
Use the code here: https://github.com/appcelerator/alloy/blob/7ca0be6f142046f328b6b911b28fa3117501e14d/Alloy/lib/alloy.js#L449 Which is basically the same as here: http://stackoverflow.com/questions/16784101/how-to-find-tablet-or-phone-in-android-programmatically
PRs: https://github.com/appcelerator-developer-relations/Template.MasterDetail/pull/4 https://github.com/appcelerator-developer-relations/Template.Tabbed/pull/8 https://github.com/appcelerator-developer-relations/Template.SingleWindow/pull/4
Verified fixed on: Mac OSX 10.9 Mavericks Titanium Studio, build: 3.2.0.201312142258 Titanium SDK, build: 3.2.0.v20131216064236 CLI: 3.2.0-cr3 Alloy: 1.3.0-cr Android Phone: Galaxy S4 (4.2.2) Screen Resolution: 1920x1080 Used "Master Detail" classic application. Used the following code
Code verified that the device was infact a phone despite the large screen resolution. Closing