Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
542a84c
added support for shape (currently rounded rectangle)
atanasster Dec 1, 2013
fe2c887
added public newSegmentedControl:setDefaultSegment(segNum)
atanasster Dec 3, 2013
58d6354
Embossed Label shows for all custom themes
atanasster Dec 4, 2013
09cec0f
Custom themes for the segmented control id not honor the label color
atanasster Dec 4, 2013
aa14082
pickerwheel columnColor default
atanasster Dec 18, 2013
5fdcfa5
added onScroll event
atanasster Dec 19, 2013
de2370b
Fix parent screen coordinate calc, fixed onPress target set
atanasster Dec 21, 2013
1ce5d17
Changed to use self instead of view for consistency
atanasster Dec 21, 2013
99bf16e
tableviewext adds ability to slide out a row.
atanasster Dec 21, 2013
9ef780e
newEditField beta
atanasster Dec 22, 2013
563f928
newEdit Field support
atanasster Dec 25, 2013
f5cbf63
added support for custom theme for newEditField
atanasster Dec 25, 2013
daaf1ec
newEditField
atanasster Dec 30, 2013
c1102e8
widget_neweditfield
atanasster Jan 2, 2014
dc87a01
fixes
atanasster Jan 2, 2014
26043e4
fixes
atanasster Jan 3, 2014
0f87bd6
widget.newPanel
atanasster Jan 6, 2014
e305ad6
support for display.setDefault( "anchorX", ...)
atanasster Jan 6, 2014
3948ed3
fixes + calibration db
atanasster Jan 8, 2014
4de0487
sync branches
atanasster Jan 8, 2014
2a6f1b1
sync
atanasster Jan 8, 2014
a9cd156
sync
atanasster Jan 8, 2014
4b7ae5b
sync
atanasster Jan 8, 2014
bd92e3c
added getValue, setValue and fix for setDefaultSegment
atanasster Jan 8, 2014
9670faa
sync for widget._calculatePosition
atanasster Jan 8, 2014
8b8c276
pageSlider widget
atanasster Jan 8, 2014
0687192
sync to widget._calculatePosition
atanasster Jan 8, 2014
844b43c
sync for default anchor positions
atanasster Jan 8, 2014
b4984b2
keyboard height scaled now
atanasster Jan 9, 2014
d43294f
reintroduce fix for touch events
atanasster Jan 9, 2014
0a8b003
added device
atanasster Jan 9, 2014
e5e402b
slideForKeyboard fix
atanasster Jan 10, 2014
8271220
fixes
atanasster Jan 18, 2014
4dc79b5
fix for setTextColor work with Graphics 2
atanasster Jan 18, 2014
e47f61d
fixes
atanasster Jan 21, 2014
f1b7826
added labelWidth parameter
atanasster Jan 22, 2014
0efa74e
fixes
atanasster Jan 22, 2014
af9db59
cleanup
atanasster Jan 23, 2014
5e06ec1
Validation
atanasster Jan 23, 2014
31df94c
isModified
atanasster Jan 24, 2014
7012d9e
fixes for isModified
atanasster Jan 24, 2014
7c089db
fixes
atanasster Jan 25, 2014
ce11017
editField
atanasster Jan 30, 2014
ed696fd
added device
atanasster Jan 31, 2014
5456bf7
Fixes
atanasster Feb 3, 2014
567f481
font alignment
atanasster Feb 4, 2014
e18edc0
Delete editfield_calibrationdb.lua
atanasster Feb 4, 2014
509a20f
event.target
atanasster Feb 4, 2014
6e46d28
:getVersion
atanasster Feb 6, 2014
4e68a31
added "..." to the text inserted when the text is bigger than the edi…
Feb 27, 2014
69d2db6
added support to textBox (just use flag "isTextBox = true" in the par…
Apr 1, 2014
2677b6d
add param "useMoreTextIndicator = true" to make fakeText adds a "..."…
Apr 2, 2014
ce742a3
adding textOnly support (requested by Kerem)
Apr 3, 2014
836c4bc
updated fakeText position of textBox for iPhone 5
Apr 3, 2014
e1c1fca
Nexus 7
atanasster May 9, 2014
3e26a77
Conflicts:
atanasster May 10, 2014
23c1233
Resolve conflicts
atanasster May 10, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions widgetLibrary/editfield_calibrationdb.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
local M =

{
["device-Nexus 7"] = {
fontScale = 1.77,
textFieldHeightAdjust = 18,
textFieldXOffset = 3,
textFieldYOffset = -7,
labelXoffset = 0,
labelYoffset = 0,
},
}

return M

154 changes: 154 additions & 0 deletions widgetLibrary/editfield_defaults.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@

local clbData = require("widgets.editfield_calibrationdb")

local M = {}
M.androidKeyboardHeight = 350

if "Android" == system.getInfo("platformName") then
M.textFieldHeightAdjust = 18
M.textLineAdjust = 0
M.textFieldYOffset = - (M.textFieldHeightAdjust / 3)
M.textFieldXOffset = -1
M.fakeLabelYOffset = 0
M.fakeLabelXOffset = 0

elseif "simulator" == system.getInfo("environment") then
M.textLineAdjust = 0
M.textFieldYOffset = -1
M.textFieldXOffset = 0
M.fakeLabelYOffset = 0
M.fakeLabelXOffset = 1
M.textFieldHeightAdjust = 0;
else
M.textLineAdjust = 0
M.textFieldYOffset = 0
M.textFieldXOffset = 0
M.fakeLabelYOffset = M.textLineAdjust / 2
M.fakeLabelXOffset = 0
M.textFieldHeightAdjust = 0;

end
function M:calcFontSize()
local environment = system.getInfo("environment")
--default scaing for simulator
local fontScale = (( display.contentWidth - (display.screenOriginX * 2) ) / display.contentScaleX) / display.contentWidth
if system.getInfo("platformName") == "Android" then
--default font scaling for all versions
fontScale = (display.pixelWidth / display.contentWidth) * 0.5;
--check if its an Android version 2 device
local osVersion = system.getInfo("platformVersion")
if osVersion then
local pos = string.find(osVersion,"2.")
if pos == 1 then
fontScale = 1
end
end
elseif environment == "simulator" then
--in Corona simulator, check if its a tall device, which is probably Zoomed out
if display.pixelHeight > 800 then
fontScale = fontScale * .5
end
else
if string.match(system.getInfo("model"),"iPa") then
--iPads
if display.pixelHeight == 2048 then
--iPad retina
fontScale = (display.pixelHeight / display.contentHeight) * 0.5;
else
fontScale = 1 / display.contentScaleY
end
else
fontScale = (display.pixelHeight / display.contentHeight) * 0.5;
end

end

return fontScale

end

function M:robMiracleCalcFontSize()
return ( display.pixelWidth / display.contentWidth ) * 0.5
end

function M:mpappasCalcFontSize()
local sysType = system.getInfo("architectureInfo")

local fontScale = 1 / display.contentScaleY -- old method is fallback (ends up being sim setting)

if system.getInfo("platformName") == "Android" or not string.match(system.getInfo("model"),"iP") then -- try and get the real width / height and deal with it
--print(" -- -- Android font size calc...")

local missingInches = display.screenOriginY * -2 -- account for both top and bottom area (x2), and change the sign sign since originY is always negative, if it exists...

missingInches = missingInches / 320 -- 320 is 1 inch, in my 640x960 virual content space (960 == 3 inches for my app, designed for a standard iphone 4 display)
-- different contentScale sizes will use a different virtual pixel / inch value (eg, 320x480 virtual content = missingInches / 160)
--print(" -- missing inches == ", missingInches)

local heightIn = system.getInfo( "androidDisplayHeightInInches" )
local widthIn = system.getInfo( "androidDisplayWidthInInches" )
--print(" -- original height == ", heightIn)
if heightIn ~= nil then
heightIn = heightIn - missingInches

--Make sure its not nil... e.g. the simulator will return nil, perhaps some bad devices will too...

-- heightIn is height of actual droid app is running on
fontScale = heightIn / 3.0 -- 3.0 is actual iPhone 3gs /4 /4s height
--print(" -- fontsize set on actual droid screen inch height")
--print(" -- widthIn = ", widthIn)
--print(" -- heightIn = ", heightIn)
else
fontScale = 4/3 --Default to a 4 inch diagonal (iphone is 3.0)
--print(" -- fontsize set to 4 inch phone size")
end


else
local fontScale = 1
local heightIn = 3 -- default to stnadard iPhone size
local missingInches = display.screenOriginY * -2 -- account for both top and bottom area (x2), and change the sign sign originY is negative, if it exists...

missingInches = missingInches / 320 -- 320 is 1 inch, in my 640x960 virual content space (960 == 3 inches for my app, designed for a standard iphone 4 display)
-- different contentScale sizes will use a different virtual pixel / inch value (eg, 320x480 virtual content = missingInches / 160)
--
-- Since there is no corona facility to get the screen height of the device on iOS, we'll determine it ourselves.
--
if( sysType == "iPhone2,1" ) then -- 3GS
heightIn = 3.0 - missingInches -- original iPhone size
elseif( string.match(sysType, "iPhone3") or string.match(sysType, "iPhone4") ) then -- iPhone 4, 4S
heightIn = 3.0 - missingInches -- Same size as the old 3gs- better resolution, but same size
elseif( string.match(sysType, "iPhone5") ) then -- iPhone 5
heightIn = 4.0 - missingInches -- Should go back to 3, after missing inches chopped off by corona are deducted.
elseif sysType == "iPad2,5" or sysType == "iPad2,6" or sysType == "iPad2,7" or sysType == "iPad2,8" then -- 2,8 is unknown, just a guess at next mini #
heightIn = 6.25 - missingInches -- mini
elseif( string.match(sysType, "iPad") ) then -- standard iPad
heightIn = 7.75 - missingInches -- iPad
else
if( missingInches == 0 ) then
-- iPod falls through to here (and it is 3 inches tall, and any missing inches accounted for in a tall version, so that works for now)
heightIn = 3.0 - missingInches -- I would hope this is typical, zero extra on an unknown ios device
else
heightIn = 4.0 - missingInches -- otherwise, we'll take a flying guess that the unknown device is bigger than a tiny breadbox, and smaller than a car. (4 inches tall, iphone 5 format)
end
end
fontScale = heightIn / 3.0 -- 3.0 inches is actual iPhone 4 height (that my content is based on)
end
return fontScale

end

M.fontScale = M:calcFontSize()

local calibration = clbData[system.getInfo( "environment").."-".. system.getInfo("model")]
if calibration then
M.fontScale = calibration.fontScale
M.textFieldHeightAdjust = calibration.textFieldHeightAdjust
M.textFieldYOffset = calibration.textFieldYOffset
M.textFieldXOffset = calibration.textFieldXOffset
M.fakeLabelYOffset = calibration.labelYoffset
M.fakeLabelXOffset = calibration.labelXoffset
end

return M

82 changes: 82 additions & 0 deletions widgetLibrary/storyboardext.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
local storyboard = require("storyboard")

function storyboard.getCurrentScene()
local sceneName = storyboard.getCurrentSceneName()
if sceneName and string.len(sceneName) > 0 then
return storyboard.getScene(sceneName)
else
return nil
end
end


local oldNewScene = nil;
local function newScene()
local scene = oldNewScene()
scene._editFields = {}

function onExitScene( event )
native.setKeyboardFocus(nil)
end

function onEnterScene( event )
native.setKeyboardFocus(nil)
end

function onCreateScene( event )
native.setKeyboardFocus(nil)
end

function scene.addEditField(field)
scene._editFields [field] = field;
end

function scene.removeEditField(field)
scene._editFields [field] = nil;
end

function scene.validateEditFields()
local retVal = {}
for i,v in pairs(scene._editFields) do
if i:validate() then
table.insert(retVal, i)
end
end
if #retVal > 0 then
return retVal
else
return nil
end
end

function scene.isModified()
local retVal = {}
for i,v in pairs(scene._editFields) do
if i:isModified() then
table.insert(retVal, i)
end
end
if #retVal > 0 then
return retVal
else
return nil
end
end
function scene.setIsModified(value)
for i,v in pairs(scene._editFields) do
i:setIsModified(value)
end
end


scene:addEventListener( "exitScene", onExitScene )
scene:addEventListener( "enterScene", onEnterScene )
scene:addEventListener( "createScene", onCreateScene )
return scene;
end
if oldNewScene ~= newScene then
oldNewScene = storyboard.newScene
end

storyboard.newScene = newScene;

Loading