|
1 | | -# SSComposeShowCaseView |
| 1 | +# SSComposeShowCaseView |
| 2 | +[](https://developer.android.com/jetpack/compose) |
| 3 | +[](https://kotlinlang.org) |
| 4 | +[](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat) |
| 5 | +[](https://www.android.com/) |
| 6 | + |
| 7 | +## Introduction |
| 8 | +In this repository, provided demonstration for showcaseview, which is a way to display features of our app to users. |
| 9 | + |
| 10 | +## Features |
| 11 | +* Simple rounded showcase view |
| 12 | +* Simple rectangle showcase view |
| 13 | +* Animated rounded showcase view |
| 14 | +* Animated rectangle showcase view |
| 15 | +* Automatic showcase view |
| 16 | +* Customise delay between showcase, background opacity |
| 17 | + |
| 18 | +# 🎬 Preview |
| 19 | + |
| 20 | +| Simple Rounded | Animated Rounded | |
| 21 | +|--|--| |
| 22 | +| <img src="/gif/Simple_Rounded_Showcase_View.gif" height="500px"/> | <img src="/gif/Animated_Rounded_Showcase_View.gif" height="500px"/> | |
| 23 | + |
| 24 | +| Simple Rectangle | Animated Rectangle | |
| 25 | +|--|--| |
| 26 | +| <img src="/gif/Simple_Rectangle_Showcase_View.gif" height="500px"/> | <img src="/gif/Animated_Rectangle_Showcase_View.gif" height="500px"/> | |
| 27 | + |
| 28 | +### Gradle Dependency |
| 29 | +* Add it in your root build.gradle at the end of repositories: |
| 30 | + |
| 31 | + - For Gradle version 5.x.x or less |
| 32 | + ``` |
| 33 | + allprojects { |
| 34 | + repositories { |
| 35 | + ... |
| 36 | + maven { url 'https://jitpack.io' } |
| 37 | + } |
| 38 | + } |
| 39 | + ``` |
| 40 | + - For Gradle version 6.x.x and above, in settings.gradle file inside `pluginManagement` block |
| 41 | + ``` |
| 42 | + pluginManagement { |
| 43 | + repositories { |
| 44 | + ... |
| 45 | + maven { url 'https://jitpack.io' } |
| 46 | + } |
| 47 | + } |
| 48 | + ``` |
| 49 | +
|
| 50 | +* Add the dependency in your app's build.gradle file |
| 51 | +
|
| 52 | + ``` |
| 53 | + dependencies { |
| 54 | + implementation 'com.github.simformsolutions:SSComposeShowCaseView:1.0' |
| 55 | + } |
| 56 | + ``` |
| 57 | + |
| 58 | +## 🤔 How to use it |
| 59 | +* Composable function which is used to start showcase view |
| 60 | + ```kotlin |
| 61 | + fun ShowCaseTarget( |
| 62 | + targets: SnapshotStateMap<String, ShowcaseProperty>, |
| 63 | + isEnableAutoShowCase: Boolean = false, |
| 64 | + showcaseDelay: Long = 2000, |
| 65 | + key: String, |
| 66 | + onShowCaseCompleted: () -> Unit |
| 67 | + ) |
| 68 | + ``` |
| 69 | + |
| 70 | +* Customise your showcase view using this data class |
| 71 | + ```kotlin |
| 72 | + data class ShowcaseProperty( |
| 73 | + val index: Int, |
| 74 | + val coordinates: LayoutCoordinates, |
| 75 | + val title: String, |
| 76 | + val titleColor: Color = Color.White, |
| 77 | + val subTitle: String, |
| 78 | + val subTitleColor: Color = Color.White, |
| 79 | + val showCaseType: ShowcaseType = ShowcaseType.SIMPLE_ROUNDED, |
| 80 | + val blurOpacity: Float = 0.8f |
| 81 | + ) |
| 82 | + ``` |
| 83 | + |
| 84 | +* To start showcase view call composable function `ShowCaseTarget` like below |
| 85 | + ```kotlin |
| 86 | + val targets = remember { mutableStateMapOf<String, ShowcaseProperty>() } |
| 87 | + ShowCaseTarget(targets = targets, isEnableAutoShowCase = true, key = "Dashboard") { |
| 88 | + CoroutineScope(Dispatchers.Main).launch { |
| 89 | + Toast.makeText(context, "Thank you! Intro Completed", Toast.LENGTH_SHORT).show() |
| 90 | + } |
| 91 | + } |
| 92 | + ``` |
| 93 | + |
| 94 | +* On which ever component you need to showcase, take coordinates of that component using Modifier.onGloballyPositioned and use ShowcaseProperty like shown below |
| 95 | + ```kotlin |
| 96 | + Image( |
| 97 | + imageVector = Icons.Default.MoreVert, |
| 98 | + contentDescription = "More icon", |
| 99 | + modifier = Modifier |
| 100 | + .padding(10.dp) |
| 101 | + .onGloballyPositioned { |
| 102 | + target["more"] = ShowcaseProperty( |
| 103 | + index = 1, |
| 104 | + coordinates = it, |
| 105 | + title = "More options", |
| 106 | + subTitle = "Click here to see options", |
| 107 | + showCaseType = ShowcaseType.ANIMATED_RECTANGLE |
| 108 | + ) |
| 109 | + } |
| 110 | + ) |
| 111 | + ``` |
| 112 | + |
| 113 | +### All Attributes |
| 114 | +------------------------ |
| 115 | +| Attribute | Description | Default | |
| 116 | +| --- | --- | --- | |
| 117 | +| `index` | Set index to show showcase one by one | None | |
| 118 | +| `coordinates` | Componants coordinates for showcase | None | |
| 119 | +| `title` | Showcase title | None | |
| 120 | +| `titleColor` | Color for title | `White` | |
| 121 | +| `subTitle` | Showcase subtitle | None | |
| 122 | +| `subTitleColor` | Color for subtitle | `White` | |
| 123 | +| `showCaseType` | Pass type of showcase (SIMPLE_ROUNDED,SIMPLE_RECTANGLE, ANIMATED_ROUNDED, ANIMATED_RECTANGLE) | `SIMPLE_ROUNDED` | |
| 124 | +| `blurOpacity` | Pass opacity to blur background | `0.08f` | |
| 125 | +| `isEnableAutoShowCase` | To manage showcase automatically | `false` | |
| 126 | +| `showcaseDelay` | Delay in-between showcase for automatic showcase view | `2000` | |
| 127 | +| `key` | To manage if showcase already shown or not | None | |
| 128 | + |
| 129 | +## Inspired by |
| 130 | +- [canopas/Intro-showcase-view](https://github.com/canopas/Intro-showcase-view) |
| 131 | + |
| 132 | +## Our Libraries in JetPackCompose |
| 133 | +- [SSJetPackComposeProgressButton](https://github.com/SimformSolutionsPvtLtd/SSJetPackComposeProgressButton) : SSJetPackComposeProgressButton is an elegant button with a different loading animations which makes your app attractive. |
| 134 | +- [SSJetpackComposeSwipeableView](https://github.com/SimformSolutionsPvtLtd/SSJetpackComposeSwipeableView) : SSJetpackComposeSwipeableView is a small library which provides support for the swipeable views. You can use this in your lazyColumns or can add a simple view which contains swipe to edit/delete functionality. |
| 135 | +- [SSComposeOTPPinView](https://github.com/SimformSolutionsPvtLtd/SSComposeOTPPinView) : A custom OTP view to enter a code usually used in authentication. It includes different types of OTPViews which is easy to use and configure your own view and character of OTP using all the attributes. |
| 136 | + |
| 137 | +## Official Documentations |
| 138 | +- [Jetpack Compose](https://developer.android.com/jetpack/compose) |
| 139 | +- [Jetpack Compose Pathways](https://developer.android.com/courses/pathways/compose) |
| 140 | +- [Jetpack Compose Samples](https://github.com/android/compose-samples) |
| 141 | + |
| 142 | +## Find this library useful? ❤️ |
| 143 | +Support it by joining __[stargazers](https://github.com/SimformSolutionsPvtLtd/SSComposeShowCaseView/stargazers)__ for this repository.⭐ |
| 144 | + |
| 145 | +## How to Contribute🤝 |
| 146 | +Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪 |
| 147 | +Check out our __[Contributing Guide](https://github.com/SimformSolutionsPvtLtd/SSComposeShowCaseView/blob/develop/CONTRIBUTING.md)__ for ideas on contributing. |
| 148 | + |
| 149 | +## 🐛 Bugs and Feedback |
| 150 | +For bugs, feature requests, and discussion please use [GitHub Issues](https://github.com/SimformSolutionsPvtLtd/SSComposeShowCaseView/issues). |
| 151 | + |
| 152 | +## Our Showcase View Library in Flutter |
| 153 | +- Check out our Flutter library [Flutter_ShowCaseView](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview) |
| 154 | + |
| 155 | +## Awesome Mobile Libraries |
| 156 | +- Check out our other available [awesome mobile libraries](https://github.com/SimformSolutionsPvtLtd/Awesome-Mobile-Libraries) |
| 157 | + |
| 158 | +## License |
| 159 | +``` |
| 160 | +MIT License |
| 161 | +
|
| 162 | +Copyright (c) 2022 Simform Solutions |
| 163 | +
|
| 164 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 165 | +of this software and associated documentation files (the "Software"), to deal |
| 166 | +in the Software without restriction, including without limitation the rights |
| 167 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 168 | +copies of the Software, and to permit persons to whom the Software is |
| 169 | +furnished to do so, subject to the following conditions: |
| 170 | +
|
| 171 | +The above copyright notice and this permission notice shall be included in all |
| 172 | +copies or substantial portions of the Software. |
| 173 | +
|
| 174 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 175 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 176 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 177 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 178 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 179 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 180 | +SOFTWARE. |
| 181 | +``` |
0 commit comments