|
| 1 | +use std::str::FromStr; |
| 2 | + |
| 3 | +use android_activity::AndroidApp; |
| 4 | +use ruffle_core::backend::ui::{LanguageIdentifier, UiBackend}; |
| 5 | +use url::Url; |
| 6 | + |
| 7 | +#[derive(Clone)] |
| 8 | +pub struct AndroidUiBackend { |
| 9 | + app: AndroidApp, |
| 10 | +} |
| 11 | + |
| 12 | +impl AndroidUiBackend { |
| 13 | + pub fn new(app: AndroidApp) -> Self { |
| 14 | + Self { app } |
| 15 | + } |
| 16 | +} |
| 17 | + |
| 18 | +impl UiBackend for AndroidUiBackend { |
| 19 | + fn mouse_visible(&self) -> bool { |
| 20 | + false |
| 21 | + } |
| 22 | + |
| 23 | + fn set_mouse_visible(&mut self, visible: bool) {} |
| 24 | + |
| 25 | + fn set_mouse_cursor(&mut self, cursor: ruffle_core::backend::ui::MouseCursor) {} |
| 26 | + |
| 27 | + fn clipboard_content(&mut self) -> String { |
| 28 | + "".into() |
| 29 | + } |
| 30 | + |
| 31 | + fn set_clipboard_content(&mut self, content: String) {} |
| 32 | + |
| 33 | + fn set_fullscreen( |
| 34 | + &mut self, |
| 35 | + is_full: bool, |
| 36 | + ) -> Result<(), ruffle_core::backend::ui::FullscreenError> { |
| 37 | + Ok(()) |
| 38 | + } |
| 39 | + |
| 40 | + fn display_root_movie_download_failed_message( |
| 41 | + &self, |
| 42 | + _invalid_swf: bool, |
| 43 | + _fetched_error: String, |
| 44 | + ) { |
| 45 | + } |
| 46 | + |
| 47 | + fn message(&self, message: &str) {} |
| 48 | + |
| 49 | + fn open_virtual_keyboard(&self) { |
| 50 | + self.app.show_soft_input(false); |
| 51 | + } |
| 52 | + |
| 53 | + fn close_virtual_keyboard(&self) { |
| 54 | + self.app.hide_soft_input(false); |
| 55 | + } |
| 56 | + |
| 57 | + fn language(&self) -> ruffle_core::backend::ui::LanguageIdentifier { |
| 58 | + LanguageIdentifier::from_str("en-US").unwrap() |
| 59 | + } |
| 60 | + |
| 61 | + fn display_unsupported_video(&self, url: Url) {} |
| 62 | + |
| 63 | + fn load_device_font( |
| 64 | + &self, |
| 65 | + query: &ruffle_core::FontQuery, |
| 66 | + register: &mut dyn FnMut(ruffle_core::backend::ui::FontDefinition), |
| 67 | + ) { |
| 68 | + } |
| 69 | + |
| 70 | + fn sort_device_fonts( |
| 71 | + &self, |
| 72 | + query: &ruffle_core::FontQuery, |
| 73 | + register: &mut dyn FnMut(ruffle_core::backend::ui::FontDefinition), |
| 74 | + ) -> Vec<ruffle_core::FontQuery> { |
| 75 | + Vec::new() |
| 76 | + } |
| 77 | + |
| 78 | + fn display_file_open_dialog( |
| 79 | + &mut self, |
| 80 | + filters: Vec<ruffle_core::backend::ui::FileFilter>, |
| 81 | + ) -> Option<ruffle_core::backend::ui::DialogResultFuture> { |
| 82 | + None |
| 83 | + } |
| 84 | + |
| 85 | + fn display_file_save_dialog( |
| 86 | + &mut self, |
| 87 | + file_name: String, |
| 88 | + title: String, |
| 89 | + ) -> Option<ruffle_core::backend::ui::DialogResultFuture> { |
| 90 | + None |
| 91 | + } |
| 92 | + |
| 93 | + fn close_file_dialog(&mut self) {} |
| 94 | +} |
0 commit comments