!11 screen 接口修改,window avoidArea native实现修改

Merge pull request !11 from xiaojianfeng/OpenHarmony-3.2-Beta2
This commit is contained in:
openharmony_ci
2022-09-05 04:29:25 +00:00
committed by Gitee
3 changed files with 9 additions and 9 deletions
@@ -235,9 +235,6 @@ declare namespace screen {
HORIZONTAL = 2,
REVERSE_VERTICAL = 3,
REVERSE_HORIZONTAL = 4,
SENSOR = 5,
SENSOR_VERTICAL = 6,
SENSOR_HORIZONTAL = 7,
}
/**
@@ -707,11 +707,6 @@ NativeValue* InitScreenOrientation(NativeEngine* engine)
CreateJsValue(*engine, static_cast<int32_t>(Orientation::REVERSE_VERTICAL)));
object->SetProperty("REVERSE_HORIZONTAL",
CreateJsValue(*engine, static_cast<int32_t>(Orientation::REVERSE_HORIZONTAL)));
object->SetProperty("SENSOR", CreateJsValue(*engine, static_cast<int32_t>(Orientation::SENSOR)));
object->SetProperty("SENSOR_VERTICAL",
CreateJsValue(*engine, static_cast<int32_t>(Orientation::SENSOR_VERTICAL)));
object->SetProperty("SENSOR_HORIZONTAL",
CreateJsValue(*engine, static_cast<int32_t>(Orientation::SENSOR_HORIZONTAL)));
return objValue;
}
@@ -130,7 +130,15 @@ void JsWindowListener::OnAvoidAreaChanged(const AvoidArea avoidArea, AvoidAreaTy
NativeValue* argv[] = { avoidAreaValue };
thisListener->CallJsMethod(SYSTEM_AVOID_AREA_CHANGE_CB.c_str(), argv, ArraySize(argv));
} else {
NativeValue* argv[] = { CreateJsValue(engine, static_cast<uint32_t>(type)), avoidAreaValue };
NativeValue *objValue = engine.CreateObject();
NativeObject *object = ConvertNativeValueTo<NativeObject>(objValue);
if (object == nullptr) {
WLOGFE("Failed to get object");
return;
}
object->SetProperty("type", CreateJsValue(engine, static_cast<uint32_t>(type)));
object->SetProperty("area", avoidAreaValue);
NativeValue* argv[] = { objValue };
thisListener->CallJsMethod(AVOID_AREA_CHANGE_CB.c_str(), argv, ArraySize(argv));
}
}