polyhorn_android/raw/
environment.rs1use polyhorn_android_sys::{Activity, Env};
2use polyhorn_ui::layout::LayoutTree;
3use std::sync::{Arc, RwLock};
4
5#[derive(Clone)]
7pub struct Environment {
8 activity: Activity,
9 env: Env<'static>,
10 layout_tree: Arc<RwLock<LayoutTree>>,
11}
12
13impl Environment {
14 pub fn new(
16 activity: Activity,
17 env: Env<'static>,
18 layout_tree: Arc<RwLock<LayoutTree>>,
19 ) -> Environment {
20 Environment {
21 activity,
22 env,
23 layout_tree,
24 }
25 }
26
27 pub fn activity(&self) -> &Activity {
28 &self.activity
29 }
30
31 pub fn env(&self) -> &Env {
32 &self.env
33 }
34
35 pub fn layout_tree(&mut self) -> &Arc<RwLock<LayoutTree>> {
37 &self.layout_tree
38 }
39}