textColor="#009688",
onClick=function()
if checkAll() then
local updatedata={}
if not isEmpty(iVersion.text) then
updatedata.Version=iVersion.text
end
if iUseVersionName.isChecked() then
updatedata.UseVersionName="true"
end
if not isEmpty(iDownloadUrl.text) then
updatedata.DownloadUrl=iDownloadUrl.text
end
if not isEmpty(iChangeLog.text) then
updatedata.ChangeLog=iChangeLog.text
if iChangeLogUseHtml.isChecked() then
updatedata.ChangeLogUseHtml="true"
end
end
if iForce then
updatedata.Force="true"
end
local data="<ServiceData>"..serialize({["Update"]=updatedata}).."</ServiceData>"
对话框()
.设置标题("已生成")
.设置消息("服务数据已生成,您可以将其放置在云端(如QQ收藏),取得访问链接进行配置。")
.设置积极按钮("复制",function()
复制文本(data)
弹出消息("已复制")
end)
.显示()
else
弹出消息("请检查您的输入")
end
end
},
},
},
},
},
},
}

activity.setContentView(loadlayout(layout))

iUseVersionName.setOnCheckedChangeListener{
onCheckedChanged=function(view,checked)
if iUseVersionName.isChecked() then
iVersion.setInputType(1)
else
iVersion.setInputType(InputType.TYPE_CLASS_NUMBER)
end
end
}

function checkVersion()
if isEmpty(iVersion.text) then
iVersion.setError("请填写版本")
return false
else
if iUseVersionName.isChecked() or (not iVersion.text:find("[^%d]")) then
iVersion.setError(nil)
return true
else
iVersion.setError("版本号仅允许整数")
return false
end
end
end

function checkDownloadUrl()
if isEmpty(iDownloadUrl.text) then
iDownloadUrl.setError("请填写下载地址")
return false
else
if not iDownloadUrl.text:find("^https?://") then
iDownloadUrl.text="http://"..iDownloadUrl.text
end
iDownloadUrl.setError(nil)
return true
end
end

function checkAll()
local versionisok=checkVersion()
local downloadurlisok=checkDownloadUrl()
return (versionisok and downloadurlisok)
end


Prev |
Pg.: 1 2


Back to home | File page

Subscribe | Register | Login | N