1 Star 0 Fork 0

AideLua / AndroLua+ 布局编译器

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

AndroLua+布局编译器

中文 | English

编译 AndroLua+ 布局,转换为 Lua 代码。

Android 5.0+ AndroLua+ 5.x

示例

源文件

{
  LinearLayout,
  orientation="vertical",
  layout_width="fill",
  layout_height="fill",
  {
    TextView,
    gravity="center",
    text="Hello AndroLua+",
    layout_width="fill",
    layout_height="fill",
  },
}

编译后

local LayoutHelper=require "LayoutHelper"
return function(root,group)
  local varsMap={}
  root=root or _G
  varsMap.view0=LinearLayout(activity)
  varsMap.params0=ViewGroup.LayoutParams(-1,-1)
  varsMap.params0=group and group.LayoutParams(varsMap.params0) or ViewGroup.LayoutParams(varsMap.params0)
  varsMap.view1=TextView(activity)
  varsMap.params1=LinearLayout.LayoutParams(ViewGroup.LayoutParams(-1,-1))
  varsMap.view1.setText("Hello AndroLua+")
  varsMap.view1.setGravity(17)
  varsMap.view1.setLayoutParams(varsMap.params1)
  --varsMap.params1=nil
  varsMap.view0.addView(varsMap.view1)
  --varsMap.view1=nil
  varsMap.view0.setOrientation(1)
  varsMap.view0.setLayoutParams(varsMap.params0)
  --varsMap.params0=nil
  --varsMap=nil
  return varsMap.view0
end

软件架构

  • 核心文件
    • lua/compilelayout.lua 编译器本体。
    • lua/VituralG.lua 虚拟 _G,用于获取代码调用。
    • lua/obj2code.lua 将对象转换为代码的工具。
    • LayoutHelper.lua 布局助手,需要导入到目标软件内,以提供一些类。
  • 其他文件
    • lua/i18n/ 供 lua 使用的 i18n.lua
    • lua/themeutil.lua 自适应目标平台的主题助手。这是 AideLua 共享页面必备组件。
    • main.lua AndroLua+ 入口文件。
    • init.lua AndroLua+ 配置文件。
    • layout.aly 软件布局文件。
    • helper.lua 装有一些方法文件。
    • layoutTemplate.lua 布局模板。
    • i18n/ 国际化配置文件。

安装教程

  1. 进入 Gitee 发行版下载预编译的安装包,文件名通常以 .apk 结尾
  2. 按照《刷机指南 - 安装软件》的教程安装本工具软件

使用说明

  1. 填入信息到上面的编辑框内
  2. 点击“导出 LayoutHelper”,将 LayoutHelper.lua 导出到 项目/lua 目录内(AideLua 为 项目/模块/类型/src/luaLibs)。
  3. 点击“编译布局”按钮,选择保存路径。

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

Gitee 仓库为主,GitHub 仓库为镜像。
虽然在 GitHub 上的仓库为镜像,但也不妨碍您提交 Issue。

翻译

  1. 复制 i18n/en.luai18n/你的语言.lua
  2. 复制 i18n/en/*i18n/你的语言/*
  3. 翻译 i18n/你的语言.luai18n/你的语言/*
  4. 提交代码并新建 Pull Request

其他内容

其他内容请见软件内使用说明。

MIT License Copyright (c) 2023 杰西205 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

将布局表转换为 Lua 代码 展开 收起
Lua 等 2 种语言
MIT
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
Lua
1
https://gitee.com/AideLua/AndroLuaLayoutCompiler.git
git@gitee.com:AideLua/AndroLuaLayoutCompiler.git
AideLua
AndroLuaLayoutCompiler
AndroLua+ 布局编译器
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891