| 58 | } |
| 59 | |
| 60 | void WindowCore::init() |
| 61 | { |
| 62 | ViewCore::init(); |
| 63 | |
| 64 | title.onChange() += [=](auto &property) { |
| 65 | bdn::android::wrapper::NativeRootView rootView(getJView().getParent().getRef_()); |
| 66 | rootView.setTitle(property.get()); |
| 67 | }; |
| 68 | |
| 69 | bdn::android::wrapper::NativeRootView rootView(getJView().getParent().getRef_()); |
| 70 | |
| 71 | _weakRootViewRef = bdn::java::WeakReference(rootView.getRef_()); |
| 72 | |
| 73 | updateUIScaleFactor(rootView.getContext().getResources().getConfiguration()); |
| 74 | updateOrientation(rootView.getContext().getResources().getConfiguration()); |
| 75 | |
| 76 | rootViewSizeChanged(rootView.getWidth(), rootView.getHeight()); |
| 77 | |
| 78 | contentView.onChange() += [=](auto &property) { updateContent(property.get()); }; |
| 79 | |
| 80 | allowedOrientations.onChange() += [=](auto &property) { |
| 81 | bdn::android::wrapper::Activity activity(getJView().getContext().getRef_()); |
| 82 | |
| 83 | if (property.get() == Window::Core::Orientation::All) { |
| 84 | activity.setRequestedOrientation(bdn::android::wrapper::ActivityInfo::SCREEN_ORIENTATION_FULL_USER); |
| 85 | } else if (property.get() & Window::Core::Orientation::PortraitMask) { |
| 86 | activity.setRequestedOrientation(bdn::android::wrapper::ActivityInfo::SCREEN_ORIENTATION_USER_PORTRAIT); |
| 87 | } else if (property.get() & Window::Core::Orientation::LandscapeMask) { |
| 88 | activity.setRequestedOrientation( |
| 89 | bdn::android::wrapper::ActivityInfo::SCREEN_ORIENTATION_USER_LANDSCAPE); |
| 90 | } |
| 91 | }; |
| 92 | } |
| 93 | |
| 94 | void WindowCore::initTag() |
| 95 | { |