Use one standard Iris resource bundle
This commit is contained in:
1 parent
6dbc800739
commit
7e5a4c0071
16 files changed
+129
-100
No files matched your search
+9
-11
@@ -89,8 +89,8 @@ impl AndroidUiState {
|
||||
}
|
||||
}
|
||||
|
||||
impl<State: 'static> HasRoot<AndroidRsc<State>> for AndroidUiState {
|
||||
fn set_root(&mut self, rsc: &mut AndroidRsc<State>, root: StrongWidget) {
|
||||
impl<State: 'static> HasRoot<StdRsc<State>> for AndroidUiState {
|
||||
fn set_root(&mut self, rsc: &mut StdRsc<State>, root: StrongWidget) {
|
||||
self.root = Some(crate::overlay::default_overlay_root(rsc, root));
|
||||
}
|
||||
}
|
||||
@@ -101,15 +101,15 @@ pub trait HasAndroidUiState: Sized + 'static {
|
||||
}
|
||||
|
||||
pub trait AndroidAppState: HasAndroidUiState {
|
||||
fn new(ui_state: AndroidUiState, rsc: &mut AndroidRsc<Self>) -> Self;
|
||||
fn new(ui_state: AndroidUiState, rsc: &mut StdRsc<Self>) -> Self;
|
||||
#[allow(unused_variables)]
|
||||
fn back_pressed(&mut self, rsc: &mut AndroidRsc<Self>) -> bool {
|
||||
fn back_pressed(&mut self, rsc: &mut StdRsc<Self>) -> bool {
|
||||
false
|
||||
}
|
||||
#[allow(unused_variables)]
|
||||
fn platform_ready(&mut self, rsc: &mut AndroidRsc<Self>, vm: JavaVM, view: GlobalRef) {}
|
||||
fn platform_ready(&mut self, rsc: &mut StdRsc<Self>, vm: JavaVM, view: GlobalRef) {}
|
||||
#[allow(unused_variables)]
|
||||
fn on_insets_changed(&mut self, rsc: &mut AndroidRsc<Self>, insets: WindowInsets) {}
|
||||
fn on_insets_changed(&mut self, rsc: &mut StdRsc<Self>, insets: WindowInsets) {}
|
||||
}
|
||||
|
||||
/// Widget-facing insets in physical pixels, decoupled from JNI's integer shape.
|
||||
@@ -140,15 +140,13 @@ impl WindowInsets {
|
||||
}
|
||||
}
|
||||
|
||||
pub type AndroidRsc<State> = AppRsc<State>;
|
||||
|
||||
/// The `ViewPeer` android-view dispatches every callback to. One per
|
||||
/// `RustView` instance; `new_peer` (below) builds it and hands the id to
|
||||
/// Java the same way android-view's own demo does.
|
||||
pub struct IrisViewPeer<State: AndroidAppState> {
|
||||
pub(super) rsc: AndroidRsc<State>,
|
||||
pub(super) rsc: StdRsc<State>,
|
||||
pub(super) state: State,
|
||||
task_recv: TaskMsgReceiver<AndroidRsc<State>>,
|
||||
task_recv: TaskMsgReceiver<StdRsc<State>>,
|
||||
/// Converts input and Choreographer timestamps onto one monotonic clock.
|
||||
device_clock: Option<DeviceClock>,
|
||||
}
|
||||
@@ -812,7 +810,7 @@ pub fn new_peer<'local, State: AndroidAppState>(
|
||||
let vm = env.get_java_vm().unwrap();
|
||||
let global_view = env.new_global_ref(&view.0).unwrap();
|
||||
let redraw: Arc<dyn RequestRedraw> = Arc::new(AndroidRedrawHandle::new(vm, global_view));
|
||||
let (mut rsc, task_recv) = AppRsc::new(redraw);
|
||||
let (mut rsc, task_recv) = StdRsc::new(redraw);
|
||||
rsc.ui.set_density(content_scale);
|
||||
let shared = Rc::new(RefCell::new(Shared::default()));
|
||||
let ui_state = AndroidUiState::new(shared.clone(), content_scale);
|
||||
|
||||
Reference in new issue
Block a user