Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Android Support #46

Open
9 of 11 tasks
ogoffart opened this issue Sep 2, 2020 · 9 comments
Open
9 of 11 tasks

Initial Android Support #46

ogoffart opened this issue Sep 2, 2020 · 9 comments
Labels
a:platform-android Android platform integration (mO,bS) roadmap Tickets that we can use for roadmapping

Comments

@ogoffart
Copy link
Member

ogoffart commented Sep 2, 2020

This project is funded through NGIO Core via NLNet - https://nlnet.nl/project/SlintAndroid/

Here's a possible breakdown of tasks that we devised. We estimate this in the range of ~4 months of work.

  1. Base Android Port Milestone. This milestone covers the foundation of the port, to allow for the cross-compilation of a Rust based Slint application, deployment to a device, and showing primitive graphics on the screen, including text labels. Rendering is to be done with Skia, for GPU acceleration and native looking text rendering.
  1. Text Input Integration Milestone. This milestone covers the work to allow the user to interact with text input fields in Slint in a way that is consistent with other Android applications.
  • Show or hide the Android system virtual keyboard depending on focus on text input fields.
  • Ensure visibility of text input fields when focused and the virtual keyboard occupies a part of the screen. This includes scrolling and resizing the user interface.
  • Add support for text selection handles by rendering them at the correct location and allowing the user to interact with them way.
  1. Dialog and Menu Widgets. This milestone will add first-class support for Material Design Dialog and Menu components. Dialogs in general and Menus specifically are crucial for many application workflows on Android.
  • Add support for dialog components in the material design style and rendering them in a way that makes them appear like native dialogs.
  • Add support for declaring menu structures in the Slint language, rendering them with the material design style, and obtaining the user-selected menu item choice in native code.
  1. Date and Time Picker Widgets. This milestone will add support for Date and Time picker widgets, for use in dialogs. Both user interface elements represent complex controls and data models, due to different time zones and localization.
  • Add support for a widget in the material design style to allow the user to select a date, based on the system calendar and an optional provided input date.
  • Add support for a widget in the material design style for picking a time, based on the system time and an optional provided input time.

Update: Check the documentation to try the android backend: https://docs.rs/slint/latest/slint/android/index.html

@ogoffart ogoffart added the roadmap Tickets that we can use for roadmapping label Sep 2, 2020
@tronical tronical changed the title Adroid support Android support Sep 2, 2020
@Berrysoft
Copy link
Contributor

Is there any progress here? I've found that both winit and glutin has Android support.

@ogoffart
Copy link
Member Author

Not really. There is some work in progress to make it compile in the olivier/wip/android branch, but it doesn't work yet. Some more work will be needed to adjust the way the window is initialized.

@Skilvingr
Copy link

Hi, I've forked @ogoffart 's repo and I've finally managed to build a working printerdemo example here by using cargo-apk.

The main issues I've had to solve are:

  1. delaying the initialisation of the window, until the event loop receives a InitWindow event (which means that Android is ready to create it):
    The fastest (and obviously not the most elegant) way is to block android_init using a loop. (the path I've taken)
    The best way would probably be to make surface, gl context and other stuff optional, as other projects have already done.

  2. disable fontconfig, as the ndk doesn't ship a bundled version and Android seems to ignore every self-compiled library one adds to the apk:
    If I've understood correctly the code I've read, the same thing is done for wasm32 builds.

Overall, everything seems to work decently (considering that this was a test), apart from the fact that, as soon as one tries to switch app, Android destroys context and surface and the application crashes (for the same reason of point 1.).
Screenshot_20230601_174645

I hope this will help to speed up the development. Thank you for your work!

@tronical
Copy link
Member

tronical commented Jun 1, 2023

Great work!

@tronical
Copy link
Member

One aspect that might need support in the run-time library APIs or perhaps even the .slint language is first-class support for the Android Activity Lifecycle. The Android Activity Crate supports these state events, and we may want to integrate this with callbacks to the application - ideally in a platform independent way that the same API could be used also on iOS.

@tronical
Copy link
Member

tronical commented Sep 5, 2023

We've made an initial plan for how we'd like to break down the Android port and I'd like to share it here for further editing/discussion. I'll edit the current empty description of this issue for that purpose.

@tronical tronical changed the title Android support Initial Android Support Sep 5, 2023
@ogoffart ogoffart added the a:platform-android Android platform integration (mO,bS) label Sep 8, 2023
@calvin2021y
Copy link

Is there a roadmap or plan with timetable for mobile support?

@tronical
Copy link
Member

Is there a roadmap or plan with timetable for mobile support?

We have not made a plan beyond the breakdown and time estimate outlined in the description of this issue. We want to learn from the Android port first and then have a better idea about what additional functionality and features we need to support also iOS and mobile specific features in general. This initial work on Android is also limited to Rust as target programming language.

@moolight-seashell
Copy link

is there a way to build an android widget component in slint ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:platform-android Android platform integration (mO,bS) roadmap Tickets that we can use for roadmapping
Projects
None yet
Development

No branches or pull requests

6 participants