functora-egui 0.4.2

shadcn/ui-inspired widget library for egui - buttons, inputs, selects, dialogs, and 70+ more components with light/dark theming
Documentation
use android_activity::AndroidApp;
use std::sync::Arc;

use crate::android::ime::store_app as store_ime_app;
use crate::platform::android::store_app;

pub fn run<F>(app: AndroidApp, title: &str, creator: F)
where
    F: FnOnce(
            &eframe::CreationContext<'_>,
        ) -> Result<Box<dyn eframe::App>, Box<dyn std::error::Error + Send + Sync>>
        + 'static,
{
    let cloned = app.clone();
    store_ime_app(app.clone());
    store_app(app);
    crate::deep_link::set_schedule_update(Arc::new(
        crate::platform::android_back::wake_via_repaint,
    ));
    let options = eframe::NativeOptions {
        android_app: Some(cloned),
        viewport: egui::ViewportBuilder::default(),
        ..Default::default()
    };
    let result = eframe::run_native(
        title,
        options,
        Box::new(move |cc| {
            crate::platform::android_back::store_context(&cc.egui_ctx);
            creator(cc)
        }),
    );
    if let Err(error) = result {
        eprintln!("eframe error: {error}");
    }
}