|
| 1 | +# Deprecated APIs |
| 2 | + |
| 3 | +## (Legacy) UI-module (View-based) |
| 4 | + |
| 5 | +> [!WARNING] |
| 6 | +> **Deprecated:** The legacy View-based UI module (`com.mikepenz:aboutlibraries`) is deprecated and will receive limited support. |
| 7 | +> Please migrate to the [Compose UI module](#ui-module-compose). |
| 8 | +> For embedding Compose in Views, consider using [ComposeView](https://developer.android.com/develop/ui/compose/migrate/interoperability-apis/compose-in-views). |
| 9 | +> While newer Gradle plugin versions *might* be compatible with older UI modules regarding the data format, migration is strongly recommended. |
| 10 | +
|
| 11 | +```gradle |
| 12 | +// build.gradle.kts |
| 13 | +// Recommended: Using version catalog |
| 14 | +implementation(libs.aboutlibraries.view) |
| 15 | +
|
| 16 | +// Alternative: Direct dependency declaration |
| 17 | +// implementation("com.mikepenz:aboutlibraries:${latestAboutLibsRelease}") |
| 18 | +``` |
| 19 | + |
| 20 | +### Usage |
| 21 | + |
| 22 | +Use this library in a few different ways. Create a custom activity, including a custom style or just |
| 23 | +use its generated information. Or simply use the built-in Activity or Fragment and just pass the |
| 24 | +libs to include. |
| 25 | + |
| 26 | +> **Note**: The new version requires the new Material3 theme as base. |
| 27 | +
|
| 28 | +#### Activity |
| 29 | + |
| 30 | +```kotlin |
| 31 | +LibsBuilder() |
| 32 | + .start(this) // start the activity |
| 33 | +``` |
| 34 | + |
| 35 | +The activity uses a toolbar, which requires the appropriate theme. |
| 36 | +See [Style the AboutLibraries](#style-the-aboutlibraries-%EF%B8%8F) for more details |
| 37 | + |
| 38 | +#### Fragment |
| 39 | + |
| 40 | +```kotlin |
| 41 | +val fragment = LibsBuilder() |
| 42 | + .supportFragment() |
| 43 | +``` |
| 44 | + |
| 45 | +#### About this App UI |
| 46 | + |
| 47 | +The `AboutLibraries` library also offers the ability to create an `About this app` screen. |
| 48 | +Add the following .xml file (or just the strings - the key must be the same) to the project. |
| 49 | + |
| 50 | +```xml |
| 51 | + |
| 52 | +<resources> |
| 53 | + <string name="aboutLibraries_description_showIcon">true</string> |
| 54 | + <string name="aboutLibraries_description_showVersion">true</string> |
| 55 | + <string name="aboutLibraries_description_text">Place the description here :D</string> |
| 56 | +</resources> |
| 57 | +``` |
| 58 | + |
| 59 | +or use the builder and add following: |
| 60 | + |
| 61 | +```kotlin |
| 62 | +.withAboutIconShown(true) |
| 63 | + .withAboutVersionShown(true) |
| 64 | + .withAboutDescription("This is a small sample which can be set in the about my app description file.<br /><b>Style this with html markup :D</b>") |
| 65 | +``` |
| 66 | + |
| 67 | +#### Style the AboutLibraries 🖌️ |
| 68 | + |
| 69 | +Create a custom style for the AboutLibraries UI. |
| 70 | + |
| 71 | +```xml |
| 72 | +// define a custom style |
| 73 | +<style name="CustomAboutLibrariesStyle" parent=""> |
| 74 | + <!-- AboutLibraries specific values --> |
| 75 | + <item name="aboutLibrariesCardBackground">?cardBackgroundColor</item> |
| 76 | + <item name="aboutLibrariesDescriptionTitle">?android:textColorPrimary</item> |
| 77 | + <item name="aboutLibrariesDescriptionText">?android:textColorSecondary</item> |
| 78 | + <item name="aboutLibrariesDescriptionDivider">@color/opensource_divider</item> |
| 79 | + <item name="aboutLibrariesOpenSourceTitle">?android:textColorPrimary</item> |
| 80 | + <item name="aboutLibrariesOpenSourceText">?android:textColorSecondary</item> |
| 81 | + <item name="aboutLibrariesSpecialButtonText">?android:textColorPrimary</item> |
| 82 | + <item name="aboutLibrariesOpenSourceDivider">@color/opensource_divider</item> |
| 83 | +</style> |
| 84 | + |
| 85 | + // define the custom styles for the theme |
| 86 | + |
| 87 | +<style name="SampleApp" parent="Theme.MaterialComponents.Light.NoActionBar"> |
| 88 | +... |
| 89 | +<item name="aboutLibrariesStyle">@style/CustomAboutLibrariesStyle</item> |
| 90 | +... |
| 91 | +</style> |
| 92 | +``` |
0 commit comments