awesome-app-rating icon indicating copy to clipboard operation
awesome-app-rating copied to clipboard

Add compose support

Open rosenpin opened this issue 1 year ago • 3 comments

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

rosenpin avatar Sep 22 '23 09:09 rosenpin

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).

SuddenH4X avatar Sep 23 '23 14:09 SuddenH4X

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 avatar Sep 23 '23 15:09 rosenpin

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 :)

rosenpin avatar Sep 23 '23 16:09 rosenpin