Android: add oldBottomMargin, oldHeight & bottomMargin

This commit is contained in:
王劲鹏 2021-03-30 11:43:58 +08:00 committed by osborn
parent 10c60814d1
commit f4e6042cae

View File

@ -34,6 +34,8 @@ public class KeyboardPlugin extends DoricJavaPlugin {
private final Set<String> callbackIds = new HashSet<>(); private final Set<String> callbackIds = new HashSet<>();
private float keyboardHeight = 0;
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1) @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public KeyboardPlugin(DoricContext doricContext) { public KeyboardPlugin(DoricContext doricContext) {
super(doricContext); super(doricContext);
@ -61,7 +63,13 @@ public class KeyboardPlugin extends DoricJavaPlugin {
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
try { try {
data.put("oldBottomMargin", 0);
data.put("bottomMargin", 0);
data.put("oldHeight", keyboardHeight);
data.put("height", DoricUtils.px2dp(heightDiff - virtualNavigationHeight)); data.put("height", DoricUtils.px2dp(heightDiff - virtualNavigationHeight));
keyboardHeight = DoricUtils.px2dp(heightDiff - virtualNavigationHeight);
callback.resolve(new JavaValue(data)); callback.resolve(new JavaValue(data));
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();