Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ name = "vimit-gui"
path = "src/bin/vimit-gui.rs"
required-features = ["gui"]

[lib]
crate-type = ["rlib", "cdylib"]

[profile.release]
opt-level = "z"
lto = "thin"
Expand Down
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ pub mod parse;
pub use api::*;
pub use parse::*;

#[cfg(all(target_os = "android", feature = "android-gui"))]
slint::include_modules!();

use chrono::{SecondsFormat, Utc};
use serde_json::{Value, json};
use std::collections::{HashMap, HashSet};
Expand Down Expand Up @@ -49,6 +52,16 @@ pub const DEFAULT_WARNING_THRESHOLD: f64 = 75.0;
pub const DEFAULT_DANGER_THRESHOLD: f64 = 90.0;
pub const DEFAULT_ABTOP_BIN: &str = "abtop";

#[cfg(all(target_os = "android", feature = "android-gui"))]
#[unsafe(no_mangle)]
pub fn android_main(app: slint::android::AndroidApp) {
slint::android::init(app).expect("cannot initialize Android backend");
AppWindow::new()
.expect("cannot initialize Slint window")
.run()
.expect("cannot run Slint window");
}

pub const WINDOWS: [(&str, &str, &str, &str); 4] = [
(
"5h",
Expand Down
Loading