feat: 引入 MyLuaFileManager 并重构 LuaFragment 容器注册#300
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
home.lua的 FragmentManager 来决定并排或重叠的展示布局。FrameLayout替换为MaterialCardView以便在宿主层更灵活地控制容器样式与动画锚点。Description
MyLuaFileManager(app/src/main/java/com/hydrogen/MyLuaFileManager.java),提供唯一 ID 生成、内存级ConcurrentHashMap注册/查找以及通过SharedPreferences的元数据持久化(type、containerId、luaPath)。MyLuaFileFragment(app/src/main/java/com/hydrogen/MyLuaFileFragment.java),将根容器改为MaterialCardView,使用View.generateViewId()生成容器 ID,生成mFragmentId并在onAttach注册、onDestroy注销;新增setFragmentType、getFragmentIdString、getFragmentType接口并在注册时将记录写入MyLuaFileManager。app/src/main/assets_bin/mods/muk.lua)在构建MyLuaFileFragment后调用.setFragmentType(f)并将返回的 fragment ID 写入宿主容器的 tag(R.id.fragment_container)。home.lua(app/src/main/assets_bin/home.lua)添加获取LuaFragment记录(fragmentId)辅助函数以便通过 ID 获取type、containerId、luaPath、container和fragment等信息。Testing
./gradlew :app:compileDebugJavaWithJavac进行静态编译验证,命令在当前环境失败,报错为Unsupported class file major version 69,属于本地 JDK/Gradle 与编译产物版本不匹配导致的环境问题(非代码逻辑错误)。Codex Task