Add Iris Android APK tooling
This commit is contained in:
1 parent
e137f38a5d
commit
df1290904b
24 files changed
+1814
-63
No files matched your search
@@ -112,8 +112,8 @@ fn battery_line(samples: &[i32]) -> String {
|
||||
)
|
||||
}
|
||||
|
||||
impl AndroidAppState for BenchClient {
|
||||
fn new(mut ui_state: AndroidUiState, rsc: &mut StdRsc<Self>) -> Self {
|
||||
impl BenchClient {
|
||||
pub(super) fn new(mut ui_state: AndroidUiState, rsc: &mut StdRsc<Self>) -> Self {
|
||||
let content = WidgetPtr::new().add(rsc);
|
||||
let loading = placeholder(rsc, "Loading fixture...");
|
||||
content(rsc).set(loading);
|
||||
@@ -186,16 +186,24 @@ impl AndroidAppState for BenchClient {
|
||||
}
|
||||
client
|
||||
}
|
||||
}
|
||||
|
||||
fn platform_ready(&mut self, _rsc: &mut StdRsc<Self>, vm: JavaVM, view: GlobalRef) {
|
||||
impl AndroidAppState for BenchClient {
|
||||
type Resources = StdRsc<Self>;
|
||||
|
||||
fn platform_ready(&mut self, _rsc: &mut Self::Resources, vm: JavaVM, view: GlobalRef) {
|
||||
self.platform = Some(Arc::new(PlatformHandle::new(vm, view)));
|
||||
}
|
||||
|
||||
fn back_pressed(&mut self, _rsc: &mut StdRsc<Self>) -> bool {
|
||||
fn back_pressed(&mut self, _rsc: &mut Self::Resources) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn on_insets_changed(&mut self, rsc: &mut StdRsc<Self>, insets: iris::android::WindowInsets) {
|
||||
fn on_insets_changed(
|
||||
&mut self,
|
||||
rsc: &mut Self::Resources,
|
||||
insets: iris::android::WindowInsets,
|
||||
) {
|
||||
if insets.top != self.last_top_pad {
|
||||
self.last_top_pad = insets.top;
|
||||
let controls = bench_controls(rsc, insets.top);
|
||||
|
||||
@@ -36,7 +36,7 @@ extern "system" fn new_view_peer<'local>(
|
||||
view: View<'local>,
|
||||
context: Context<'local>,
|
||||
) -> jlong {
|
||||
iris::android::new_peer::<ActiveClient>(env, view, context)
|
||||
iris::android::new_peer::<ActiveClient>(env, view, context, ActiveClient::new)
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
|
||||
@@ -89,8 +89,8 @@ fn frame_report_controls(rsc: &mut StdRsc<TranscriptClient>) -> WeakWidget {
|
||||
(report, reset).span(Dir::RIGHT).height(56).add(rsc)
|
||||
}
|
||||
|
||||
impl AndroidAppState for TranscriptClient {
|
||||
fn new(mut ui_state: AndroidUiState, rsc: &mut StdRsc<Self>) -> Self {
|
||||
impl TranscriptClient {
|
||||
pub(super) fn new(mut ui_state: AndroidUiState, rsc: &mut StdRsc<Self>) -> Self {
|
||||
let content = WidgetPtr::new().add(rsc);
|
||||
let loading = placeholder(rsc, "Loading sessions...");
|
||||
content(rsc).set(loading);
|
||||
@@ -112,8 +112,12 @@ impl AndroidAppState for TranscriptClient {
|
||||
client.spawn_fetch_sessions(rsc);
|
||||
client
|
||||
}
|
||||
}
|
||||
|
||||
fn back_pressed(&mut self, _rsc: &mut StdRsc<Self>) -> bool {
|
||||
impl AndroidAppState for TranscriptClient {
|
||||
type Resources = StdRsc<Self>;
|
||||
|
||||
fn back_pressed(&mut self, _rsc: &mut Self::Resources) -> bool {
|
||||
// No screen stack of its own -- same "let the activity finish"
|
||||
// answer `iris-android-app`'s tabs `Client` already gives.
|
||||
false
|
||||
|
||||
Reference in new issue
Block a user