File tree Expand file tree Collapse file tree 4 files changed +48
-3
lines changed
java/com/example/zhangpeng/androidlua Expand file tree Collapse file tree 4 files changed +48
-3
lines changed Original file line number Diff line number Diff line change 9
9
android : roundIcon =" @mipmap/ic_launcher_round"
10
10
android : supportsRtl =" true"
11
11
android : theme =" @style/AppTheme" >
12
- <activity android : name =" .MainActivity" >
12
+ <activity android : name =" .UI. MainActivity" >
13
13
<intent-filter >
14
14
<action android : name =" android.intent.action.MAIN" />
15
15
Original file line number Diff line number Diff line change 1
- package com .example .zhangpeng .androidlua ;
1
+ package com .example .zhangpeng .androidlua . UI ;
2
2
3
3
import android .support .v7 .app .AppCompatActivity ;
4
4
import android .os .Bundle ;
5
5
import android .util .Log ;
6
6
7
+ import com .example .zhangpeng .androidlua .R ;
8
+
7
9
import org .keplerproject .luajava .LuaException ;
8
10
import org .keplerproject .luajava .LuaState ;
9
11
import org .keplerproject .luajava .LuaStateFactory ;
Original file line number Diff line number Diff line change
1
+ package com .example .zhangpeng .androidlua .luajava ;
2
+
3
+ import org .keplerproject .luajava .LuaState ;
4
+ import org .keplerproject .luajava .LuaStateFactory ;
5
+
6
+ /**
7
+ * good
8
+ * Created by zhangpeng on 2018/3/18.
9
+ */
10
+
11
+ public class LuaJava {
12
+
13
+ private LuaState luaState ;
14
+
15
+ private static final class LuaJavaHolder {
16
+ private static LuaJava LUA_JAVA =new LuaJava ();
17
+ }
18
+
19
+ private LuaJava (){
20
+ luaState =LuaStateFactory .newLuaState ();
21
+ luaState .openLibs ();
22
+ }
23
+
24
+
25
+ public static LuaJava getLuaJavaInstance (){
26
+ return LuaJavaHolder .LUA_JAVA ;
27
+ }
28
+
29
+ public LuaState getLuaState (){
30
+ return luaState ;
31
+ }
32
+
33
+ public void closeLua (){
34
+ if (luaState != null && !luaState .isClosed ()) {
35
+ //只能在退出应用时才调用
36
+ luaState .close ();
37
+ LuaJavaHolder .LUA_JAVA =null ;
38
+ }
39
+ }
40
+
41
+
42
+
43
+ }
Original file line number Diff line number Diff line change 4
4
xmlns : tools =" http://schemas.android.com/tools"
5
5
android : layout_width =" match_parent"
6
6
android : layout_height =" match_parent"
7
- tools : context =" com.example.zhangpeng.androidlua.MainActivity" >
7
+ tools : context =" com.example.zhangpeng.androidlua.UI. MainActivity" >
8
8
9
9
<TextView
10
10
android : layout_width =" wrap_content"
You can’t perform that action at this time.
0 commit comments