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 documentation regarding Custom preview annotation usage 🤩 📜 #307

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

oas004
Copy link
Contributor

@oas004 oas004 commented Mar 10, 2023

Here I have added documentation for using Custom preview annotation with Showkase. I have added use cases and KSP vs KAPT differences. Also added docs about how to use this with KAPT.

This should not be merged before the next release is out to avoid confusion.

I'm not entirely sure about the placement and how the content is structured. Is there anything else that is needed to be mentioned @vinaygaba? :)

Her I have added documentation for using Custom preview annotation with Showkase. I have added use cases and KSP vs KAPT differences. Also added docs
about how to use this with KAPT.
@oas004 oas004 marked this pull request as ready for review March 13, 2023 10:01
@polivmi1
Copy link

I am seeing slow builds:

w: [ksp] No dependencies are reported for ShowkaseMetadata_showkase_somemultipreview which will prevent
incremental compilation.

This is how the annotation looks
@Preview(name = "english", group = "some", locale = "en", showBackground = true)
@Preview(name = "russian", group = "some", locale = "ru", showBackground = true)
@Preview(name = "arabic", group = "some", locale = "ar", showBackground = true)
@Preview(name = "0.85f", group = "some", fontScale = 0.85f, showBackground = true)
@Preview(name = "1.00f", group = "some", fontScale = 1.00f, showBackground = true)
@Preview(name = "1.15f", group = "some", fontScale = 1.15f, showBackground = true)
@Preview(name = "1.30f", group = "some", fontScale = 1.30f, showBackground = true)
@Preview(name = "LIGHT", group = "some", uiMode = Configuration.UI_MODE_NIGHT_NO, showBackground = true)
@Preview(name = "DARK", group = "some", uiMode = Configuration.UI_MODE_NIGHT_YES, showBackground = true)
@Preview(name = "NEXUS", group = "some", showSystemUi = true, device = Devices.NEXUS_5)
@Preview(name = "PIXEL", group = "some", showSystemUi = true, device = Devices.PIXEL_4)
@Preview(name = "LANDSCAPE", group = "some", showSystemUi = true, device = Devices.AUTOMOTIVE_1024p)
annotation class SomeMultiPreview

Is there any other setup needed to make ksp incremental with the update to this library?

@oas004
Copy link
Contributor Author

oas004 commented Mar 24, 2023

@polivmi1 I think it might be better to open an issue for this. I'm not 100% sure if this has anything to do with the custom preview annotation implementation, but are you using that through a fork or something?

@polivmi1
Copy link

@oas004 I am using 1.0.0-beta18 . It isn't published on github releases, but is available in https://mvnrepository.com/artifact/com.airbnb.android/showkase and should contain the latest changes. That's also the version that breaks.

@oas004
Copy link
Contributor Author

oas004 commented Mar 24, 2023

I tried copying the annotation you made in the sample project and it seems to work as expected. Is the project you are using public?

@polivmi1
Copy link

Unfortunately not. Next week I will try to set up a sample project to reproduce the error.

@polivmi1
Copy link

@oas004 this is a sample where it is reproducible: https://github.com/polivmi1/ShowkaseIncrementalCompilation
Screenshot 2023-03-27 at 10 49 03

@oas004
Copy link
Contributor Author

oas004 commented Mar 27, 2023

Thank you! I will check this out! :)

@polivmi1
Copy link

@oas004 I have updated the sample and I am not seeing Showkase to apply any of the Preview parameters like:
locale, showBackground, fontScale, uiMode, showSystemUi, device

Is that supported on ksp?

@oas004
Copy link
Contributor Author

oas004 commented Mar 29, 2023

It should support the same preview type as single preview in older versions😊

@yoviekaputra
Copy link

Hi everyone, my code is like this

@Preview("Light")
@Preview("Dark", uiMode = Configuration.UI_MODE_NIGHT_YES)
annotation class PreviewMultipleMode

@Composable
@PreviewMultipleMode
@ShowkaseComposable(name = "ComponentPreview", group = "Toolbar", skip = true)
fun ToolbarPreview(
    @PreviewParameter(ToolbarPreviewParameterProvider::class) parameter: ToolbarPreviewParameter
) {
    ToolbarBasePreview(parameter = parameter)
}

also, I have added to my grade

kapt {
    arguments {
        arg("multiPreviewType", "com.airbnb.android.submodule.showkasesample.LocalePreview")
    }
}

but I still have errors like this issue #357

can anyone help me?

@oas004
Copy link
Contributor Author

oas004 commented Oct 2, 2023

I think maybe if we can take the issues related to this feature in separate issues that would be cool. I don't think they are directly related to this PR. I have commented on your issue @yoviekaputra :) Will try to have a look at that.

I will try to rebase this branch. Do you think we should merge this PR @vinaygaba ? This is only documentation changes for the multi preview stuff. I think it would be nice to get that in for people using that in their code base :) Wdyt?

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

Successfully merging this pull request may close these issues.

4 participants