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

Multi-window dynamic context support #1

Closed
cioccarellia opened this issue Nov 27, 2020 · 4 comments
Closed

Multi-window dynamic context support #1

cioccarellia opened this issue Nov 27, 2020 · 4 comments
Assignees
Labels
android enhancement New feature or request

Comments

@cioccarellia
Copy link
Owner

As specified in the docs:

After {@link Build.VERSION_CODES#R}, {@link Resources} must be obtained by {@link android.app.Activity} or
{@link android.content.Context} created with {@link android.content.Context#createWindowContext(int, Bundle)}. 
{@link Application#getResources()} may report wrong values in multi-window or on secondary displays.

Currently kite does not support sharing and dynamically switching context. Therefore it lacks support for multi-window apps. There should be a manual mode where the context can be explicitly set every time a resource is accessed, and therefore the internal Kite context is not used in those occasions.

@cioccarellia cioccarellia self-assigned this Nov 27, 2020
@cioccarellia cioccarellia added the enhancement New feature or request label Nov 30, 2020
@paulocoutinhox
Copy link

Hi.

Great library!

Do you have any solution for this?

A normal app uses multi-window?

Thanks.

@cioccarellia
Copy link
Owner Author

cioccarellia commented Nov 30, 2020

Afaik, since apps targeting Android R, Resouces must be called on a Context which references an active window. This is because apps start having different kind of target devices, such as multiple-display phones. This (I believe) changes how resources have to be fetched, depending on how your app is built. In theory, if you do not differentiate between screens and you develop your app without this attention (in context, using application context to initialize kite, pun not intended) , you will work for 1-screen devices but run into hypothetical issues in multi screen devices. This means that you have to switch contexts basing on your usage-site.

This is being worked on, and will be implemented using extension functions to temporarily run fetches in another Context, or to permanently change the current Kite context (which is not possible by default).

Take a peak at KiteContextExtensions.kt. Will be stable soon, I need to write some docs and samples about it. (#3)

@paulocoutinhox
Copy link

Thanks for the great library!

Your repository contains .idea folder.

It is automatically now for multi-window?

@cioccarellia
Copy link
Owner Author

Hey @prsolucoes! Yes, effectively 1.1.0 contains all the tools to dynamically switch context, and can be used with milti-window applications. In a couple of hours I'll publish the release :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants