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

Add compose support #93

Open
rosenpin opened this issue Sep 22, 2023 · 3 comments
Open

Add compose support #93

rosenpin opened this issue Sep 22, 2023 · 3 comments

Comments

@rosenpin
Copy link

The README currently falsely claims that this library has jetpack compose support.
You also mention later in the README that to use this library with jetpack compose users should use an AppCompatActivity instead of a ComponentActivity, but the latter is required to use compose.
To add proper compose support we should create a dialog view specifically for compose

@SuddenH4X
Copy link
Owner

Hi @rosenpin, you don't have to use a ComponentActivity for Jetpack Compose. Instead it is the minimum required type of activity but you can also use a AppCompatActivity or FragmentActivity (because AppCompatActivity extends FragmentActivity which extends ComponentActivity).

@rosenpin
Copy link
Author

rosenpin commented Sep 23, 2023

That's not the case AFAIK. The ComponentActivity you inherit to use Jetpack compose is different from the regular base ComponentActivity which in turn inherits directly from Activity. See here
image

They are named the same which is hella confusing, but the compose ComponentActivity, the one that supplies the setContent method required to set compose views as your layout is not the same as the ComponentActivity that FragmentActivity and AppCompatActivity inherit from

When trying to show the rating dialog from the compose component activity I get this error:
image

@rosenpin
Copy link
Author

Actually seems like adding this library allows the use of setContent in an AppCompatActivity.
implementation "androidx.compose.ui:ui:1.5.1"
https://developer.android.com/jetpack/androidx/releases/compose-ui#1.5.1

Might be worth adding it to the README :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants