egui widgets are nice because there are many helper methods on the egui::Ui struct for adding widgets to the screen in various ways. For example, add_sized which designates an area to paint a widget. This is useful in the note_contents case, as it allows us to reserve available_space-20.0 pixels of the available area, saving 20.0 pixels for a side-actionbar popout. I'm not sure I'll use the side actionbar yet, but I've been experimenting with that as an option to save vertical space in the timeline. I still need to make the side actionbar into a widget as well. It currently uses the CollapsingHeader widget, which is designed for expanding elements vertically. We may need to make our own widget for animating an horizontal expansion if we want to achieve a similar effect for the side actionbar.
56 lines
1.2 KiB
Rust
56 lines
1.2 KiB
Rust
mod app;
|
|
//mod camera;
|
|
mod error;
|
|
//mod note;
|
|
//mod block;
|
|
mod abbrev;
|
|
mod widgets;
|
|
mod fonts;
|
|
mod images;
|
|
mod result;
|
|
mod imgcache;
|
|
mod filter;
|
|
mod ui;
|
|
mod timecache;
|
|
mod time;
|
|
mod notecache;
|
|
mod frame_history;
|
|
mod timeline;
|
|
mod colors;
|
|
mod profile;
|
|
|
|
pub use app::Damus;
|
|
pub use error::Error;
|
|
|
|
#[cfg(target_os = "android")]
|
|
use winit::platform::android::EventLoopBuilderExtAndroid;
|
|
|
|
pub type Result<T> = std::result::Result<T, error::Error>;
|
|
|
|
//#[cfg(target_os = "android")]
|
|
//use egui_android::run_android;
|
|
|
|
#[cfg(target_os = "android")]
|
|
use winit::platform::android::activity::AndroidApp;
|
|
|
|
#[cfg(target_os = "android")]
|
|
#[no_mangle]
|
|
#[tokio::main]
|
|
pub async fn android_main(app: AndroidApp) {
|
|
std::env::set_var("RUST_BACKTRACE", "full");
|
|
android_logger::init_once(android_logger::Config::default().with_min_level(log::Level::Info));
|
|
|
|
let path = app.internal_data_path().expect("data path");
|
|
let mut options = eframe::NativeOptions::default();
|
|
options.renderer = eframe::Renderer::Wgpu;
|
|
options.event_loop_builder = Some(Box::new(move |builder| {
|
|
builder.with_android_app(app);
|
|
}));
|
|
|
|
let res_ = eframe::run_native(
|
|
"Damus NoteDeck",
|
|
options,
|
|
Box::new(|cc| Box::new(Damus::new(cc, path, vec![]))),
|
|
);
|
|
}
|