Skip to content

Commit d03b97c

Browse files
author
野松
committed
request update: bugfix update
1 parent dab9781 commit d03b97c

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Android/LuaViewDemo/LuaViewDemo.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,6 @@
101101
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
102102
<orderEntry type="library" exported="" name="glide-3.7.0" level="project" />
103103
<orderEntry type="module" module-name="LuaViewSDK" exported="" />
104+
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
104105
</component>
105106
</module>

Android/LuaViewDemo/assets/test/UI_Window.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ window.callback({
3535
end,
3636
onBack = function()
3737
print("onBack")
38-
return false
38+
39+
40+
Toast("onBack")
41+
return true
3942
end,
4043
onWifiConnected = function()
4144
print("onWifiConnected")

Android/LuaViewSDK/src/com/taobao/luaview/view/LVViewGroup.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,16 @@ protected void onWindowVisibilityChanged(int visibility) {
114114
@Override
115115
public boolean onKeyUp(int keyCode, KeyEvent event) {
116116
if (keyCode == KeyEvent.KEYCODE_BACK) {
117-
LuaValue result = mLuaUserdata != null ? mLuaUserdata.callOnBack() : LuaValue.FALSE;
118-
return result != null && result.optboolean(false);
117+
return onBackPressed();
119118
}
120119
return super.onKeyUp(keyCode, event);
121120
}
122121

122+
public boolean onBackPressed(){
123+
LuaValue result = mLuaUserdata != null ? mLuaUserdata.callOnBack() : LuaValue.FALSE;
124+
return result != null && result.optboolean(false);
125+
}
126+
123127
@Override
124128
protected void onLayout(boolean changed, int l, int t, int r, int b) {
125129
super.onLayout(changed, l, t, r, b);

0 commit comments

Comments
 (0)