android: fix build

wip android keyboard fixes

wip 4.0.0 game-activity

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-03-11 16:08:07 -07:00
parent 7b558f8f58
commit 505083998d
9 changed files with 101 additions and 36 deletions

View File

@@ -24,5 +24,5 @@ android {
dependencies {
implementation "com.google.android.material:material:1.5.0"
implementation "androidx.games:games-activity:2.0.2"
implementation "androidx.games:games-activity:4.0.0"
}

View File

@@ -5,7 +5,7 @@ use egui_winit::winit::platform::android::activity::AndroidApp;
use notedeck_columns::Damus;
use notedeck_dave::Dave;
use crate::{chrome::Chrome, setup::setup_chrome};
use crate::{app::NotedeckApp, chrome::Chrome, setup::setup_chrome};
use notedeck::Notedeck;
use serde_json::Value;
use std::fs;
@@ -18,7 +18,12 @@ pub async fn android_main(app: AndroidApp) {
use tracing_subscriber::{prelude::*, EnvFilter};
std::env::set_var("RUST_BACKTRACE", "full");
std::env::set_var("RUST_LOG", "egui=debug,egui-winit=debug,notedeck=debug,notedeck_columns=debug,notedeck_chrome=debug,enostr=debug,android_activity=debug");
//std::env::set_var("DAVE_ENDPOINT", "http://ollama.jb55.com/v1");
//std::env::set_var("DAVE_MODEL", "hhao/qwen2.5-coder-tools:latest");
std::env::set_var(
"RUST_LOG",
"egui=debug,egui-winit=debug,notedeck=debug,notedeck_columns=debug,notedeck_chrome=debug,enostr=debug,android_activity=debug",
);
//std::env::set_var(
// "RUST_LOG",
@@ -84,8 +89,8 @@ pub async fn android_main(app: AndroidApp) {
completely_unrecognized
);
chrome.add_app(columns);
chrome.add_app(dave);
chrome.add_app(NotedeckApp::Columns(columns));
chrome.add_app(NotedeckApp::Dave(dave));
// test dav
chrome.set_active(1);

View File

@@ -34,7 +34,9 @@ pub fn setup_chrome(ctx: &egui::Context, args: &notedeck::Args, theme: ThemePref
pub fn setup_cc(ctx: &egui::Context, is_mobile: bool) {
fonts::setup_fonts(ctx);
//ctx.set_pixels_per_point(ctx.pixels_per_point() + UI_SCALE_FACTOR);
if notedeck::ui::is_compiled_as_mobile() {
ctx.set_pixels_per_point(ctx.pixels_per_point() + 0.2);
}
//ctx.set_pixels_per_point(1.0);
//
//
@@ -45,8 +47,6 @@ pub fn setup_cc(ctx: &egui::Context, is_mobile: bool) {
ctx.all_styles_mut(|style| theme::add_custom_style(is_mobile, style));
}
//pub const UI_SCALE_FACTOR: f32 = 0.2;
pub fn generate_native_options(paths: DataPath) -> NativeOptions {
let window_builder = Box::new(move |builder: egui::ViewportBuilder| {
let builder = builder

View File

@@ -1,3 +1,5 @@
#![cfg_attr(target_os = "android", allow(dead_code, unused_variables))]
use std::path::PathBuf;
use base64::{prelude::BASE64_URL_SAFE, Engine};

View File

@@ -1,4 +1,5 @@
use crate::draft::{Draft, Drafts, MentionHint};
#[cfg(not(target_os = "android"))]
use crate::media_upload::{nostrbuild_nip96_upload, MediaPath};
use crate::post::{downcast_post_buffer, MentionType, NewPost};
use crate::ui::search_results::SearchResultsView;