├── .gitignore ├── CONTRIBUTING.md ├── ComposeInfoHostConfigurationGuide.md ├── LICENSE ├── README.md ├── SSComposeInfoBarConfigurationGuide.md ├── app ├── .gitignore ├── build.gradle.kts ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── simform │ │ └── sscustominfobarapp │ │ ├── MainActivity.kt │ │ ├── home │ │ ├── Home.kt │ │ └── SettingBottomSheet.kt │ │ ├── ui │ │ └── theme │ │ │ ├── Color.kt │ │ │ ├── Theme.kt │ │ │ └── Type.kt │ │ └── utils │ │ ├── AppDimens.kt │ │ └── AppUtils.kt │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ ├── ic_launcher_background.xml │ ├── liquid_cheese.xml │ └── wintery_sunburst.png │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-mdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xxhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xxxhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ └── values │ └── strings.xml ├── build.gradle.kts ├── gifs ├── action.gif ├── annotated.gif ├── default.gif ├── error.gif ├── expand_shrink.gif ├── fade_in_out.gif ├── gradient.gif ├── horizontal_slide.gif ├── internet_observer.gif ├── png.gif ├── scale.gif ├── scale_vertical.gif ├── slide_to_action.gif ├── success.gif ├── svg.gif ├── swipe_to_dismiss.gif └── warning.gif ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle.kts └── sscustominfobar ├── .gitignore ├── build.gradle.kts ├── consumer-rules.pro ├── proguard-rules.pro └── src └── main ├── AndroidManifest.xml ├── java └── com │ └── simform │ └── sscustominfobar │ ├── animation │ └── AnimationUtil.kt │ ├── defaultInfoBars │ ├── ErrorInfoBar.kt │ ├── OfflineInfoBar.kt │ ├── SlideToPerformActionInfoBar.kt │ ├── SuccessInfoBar.kt │ └── WarningInfoBar.kt │ ├── main │ ├── SSComposeInfoBar.kt │ ├── SSComposeInfoHost.kt │ ├── SSInfoBarBackground.kt │ └── components │ │ └── CustomText.kt │ ├── res │ ├── Colors.kt │ └── Dimens.kt │ └── utils │ ├── ConnectivityObserver.kt │ ├── DirectionalLazyListState.kt │ ├── LibUtils.kt │ ├── SwipeToDismissModifier.kt │ └── TextType.kt └── res └── values └── strings.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/android,androidstudio,kotlin,java,gradle,git 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=android,androidstudio,kotlin,java,gradle,git 3 | 4 | ### Android ### 5 | # Built application files 6 | *.apk 7 | *.aar 8 | *.ap_ 9 | *.aab 10 | 11 | # Files for the ART/Dalvik VM 12 | *.dex 13 | 14 | # Java class files 15 | *.class 16 | 17 | # Generated files 18 | bin/ 19 | gen/ 20 | out/ 21 | # Uncomment the following line in case you need and you don't have the release build type files in your app 22 | release/ 23 | 24 | # Gradle files 25 | .gradle/ 26 | build/ 27 | 28 | # Local configuration file (sdk path, etc) 29 | local.properties 30 | 31 | # Local secret keys file (api keys) 32 | apikeys.properties 33 | 34 | # Proguard folder generated by Eclipse 35 | proguard/ 36 | 37 | # Log Files 38 | *.log 39 | 40 | # Android Studio Navigation editor temp files 41 | .navigation/ 42 | 43 | # Android Studio captures folder 44 | captures/ 45 | 46 | # IntelliJ 47 | .idea 48 | *.iml 49 | .idea/workspace.xml 50 | .idea/tasks.xml 51 | .idea/gradle.xml 52 | .idea/assetWizardSettings.xml 53 | .idea/dictionaries 54 | .idea/libraries 55 | # Android Studio 3 in .gitignore file. 56 | .idea/caches 57 | .idea/modules.xml 58 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 59 | .idea/navEditor.xml 60 | 61 | # Keystore files 62 | # Uncomment the following lines if you do not want to check your keystore files in. 63 | #*.jks 64 | #*.keystore 65 | 66 | # External native build folder generated in Android Studio 2.2 and later 67 | .externalNativeBuild 68 | .cxx/ 69 | 70 | # Google Services (e.g. APIs or Firebase) 71 | # google-services.json 72 | 73 | # Freeline 74 | freeline.py 75 | freeline/ 76 | freeline_project_description.json 77 | 78 | # fastlane 79 | fastlane/report.xml 80 | fastlane/Preview.html 81 | fastlane/screenshots 82 | fastlane/test_output 83 | fastlane/readme.md 84 | 85 | # Version control 86 | vcs.xml 87 | 88 | # lint 89 | lint/intermediates/ 90 | lint/generated/ 91 | lint/outputs/ 92 | lint/tmp/ 93 | # lint/reports/ 94 | 95 | ### Android Patch ### 96 | gen-external-apklibs 97 | output.json 98 | 99 | # Replacement of .externalNativeBuild directories introduced 100 | # with Android Studio 3.5. 101 | 102 | ### Git ### 103 | # Created by git for backups. To disable backups in Git: 104 | # $ git config --global mergetool.keepBackup false 105 | *.orig 106 | 107 | # Created by git when using merge tools for conflicts 108 | *.BACKUP.* 109 | *.BASE.* 110 | *.LOCAL.* 111 | *.REMOTE.* 112 | *_BACKUP_*.txt 113 | *_BASE_*.txt 114 | *_LOCAL_*.txt 115 | *_REMOTE_*.txt 116 | 117 | ### Java ### 118 | # Compiled class file 119 | 120 | # Log file 121 | 122 | # BlueJ files 123 | *.ctxt 124 | 125 | # Mobile Tools for Java (J2ME) 126 | .mtj.tmp/ 127 | 128 | # Package Files # 129 | *.jar 130 | *.war 131 | *.nar 132 | *.ear 133 | *.zip 134 | *.tar.gz 135 | *.rar 136 | 137 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 138 | hs_err_pid* 139 | 140 | ### Kotlin ### 141 | # Compiled class file 142 | 143 | # Log file 144 | 145 | # BlueJ files 146 | 147 | # Mobile Tools for Java (J2ME) 148 | 149 | # Package Files # 150 | 151 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 152 | 153 | ### Gradle ### 154 | .gradle 155 | 156 | # Ignore Gradle GUI config 157 | gradle-app.setting 158 | 159 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 160 | !gradle-wrapper.jar 161 | 162 | # Cache of project 163 | .gradletasknamecache 164 | 165 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 166 | # gradle/wrapper/gradle-wrapper.properties 167 | 168 | ### Gradle Patch ### 169 | **/build/ 170 | 171 | ### AndroidStudio ### 172 | # Covers files to be ignored for android development using Android Studio. 173 | 174 | # Built application files 175 | 176 | # Files for the ART/Dalvik VM 177 | 178 | # Java class files 179 | 180 | # Generated files 181 | 182 | # Gradle files 183 | 184 | # Signing files 185 | .signing/ 186 | 187 | # Local configuration file (sdk path, etc) 188 | 189 | # Proguard folder generated by Eclipse 190 | 191 | # Log Files 192 | 193 | # Android Studio 194 | /*/build/ 195 | /*/local.properties 196 | /*/out 197 | /*/*/build 198 | /*/*/production 199 | *.ipr 200 | *~ 201 | *.swp 202 | 203 | # Android Patch 204 | 205 | # External native build folder generated in Android Studio 2.2 and later 206 | 207 | # NDK 208 | obj/ 209 | 210 | # IntelliJ IDEA 211 | *.iws 212 | /out/ 213 | 214 | # User-specific configurations 215 | .idea/caches/ 216 | .idea/libraries/ 217 | .idea/shelf/ 218 | .idea/.name 219 | .idea/compiler.xml 220 | .idea/copyright/profiles_settings.xml 221 | .idea/encodings.xml 222 | .idea/misc.xml 223 | .idea/scopes/scope_settings.xml 224 | .idea/vcs.xml 225 | .idea/jsLibraryMappings.xml 226 | .idea/datasources.xml 227 | .idea/dataSources.ids 228 | .idea/sqlDataSources.xml 229 | .idea/dynamic.xml 230 | .idea/uiDesigner.xml 231 | 232 | # OS-specific files 233 | .DS_Store 234 | .DS_Store? 235 | ._* 236 | .Spotlight-V100 237 | .Trashes 238 | ehthumbs.db 239 | Thumbs.db 240 | 241 | # Legacy Eclipse project files 242 | .classpath 243 | .project 244 | .cproject 245 | .settings/ 246 | 247 | # Mobile Tools for Java (J2ME) 248 | 249 | # Package Files # 250 | 251 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) 252 | 253 | ## Plugin-specific files: 254 | 255 | # mpeltonen/sbt-idea plugin 256 | .idea_modules/ 257 | 258 | # JIRA plugin 259 | atlassian-ide-plugin.xml 260 | 261 | # Mongo Explorer plugin 262 | .idea/mongoSettings.xml 263 | 264 | # Crashlytics plugin (for Android Studio and IntelliJ) 265 | com_crashlytics_export_strings.xml 266 | crashlytics.properties 267 | crashlytics-build.properties 268 | fabric.properties 269 | 270 | ### AndroidStudio Patch ### 271 | 272 | !/gradle/wrapper/gradle-wrapper.jar 273 | 274 | # Settings 275 | settings/ 276 | 277 | !/app/src/production 278 | 279 | # End of https://www.toptal.com/developers/gitignore/api/android,androidstudio,kotlin,java,gradle,git -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Way to contribute 2 | 3 | 1. Fork the repo and create your branch from `main`. 4 | 2. Clone the project to your own machine. (Please have a look at [**Readme.md**](https://github.com/SimformSolutionsPvtLtd/SSCompose-CustomInfoBar/blob/master/README.md) to understand how to run this project on your machine) 5 | 3. Commit changes to your own branch 6 | 4. Make sure your code lints. 7 | 5. Push your work back up to your fork. 8 | 6. Issue that pull request! 9 | -------------------------------------------------------------------------------- /ComposeInfoHostConfigurationGuide.md: -------------------------------------------------------------------------------- 1 | 2 | # SSComposeInfoHost Config Customization 3 | 4 | ## You can customise the SSComposeInfoBar Behaviour by configuring the SSComposeInfoHost. 5 | 6 | 1. **Such as the direction from which the InfoBar will be shown.** 7 | ```kotlin 8 | var direction by remember { 9 | mutableStateOf((SSComposeInfoBarDirection.Top)) 10 | } 11 | 12 | SSComposeInfoHost( 13 | modifier = Modifier 14 | .fillMaxSize(), 15 | composeHostState = composeInfoHostState, 16 | direction = direction 17 | ) 18 | ``` 19 | 20 | 2. **Whether we want to show a default info bar when there is no internet connection.** 21 | ```kotlin 22 | SSComposeInfoHost( 23 | modifier = Modifier 24 | .fillMaxSize(), 25 | composeHostState = composeInfoHostState, 26 | enableNetworkMonitoring = true, 27 | ) 28 | ``` 29 | 3. **To show a custom ComposeInfoBar we can pass our own Composable in the parameter.** 30 | ```kotlin 31 | SSComposeInfoHost( 32 | modifier = Modifier 33 | .fillMaxSize(), 34 | composeHostState = composeInfoHostState, 35 | composeInfoBar = { content -> 36 | SSComposeInfoBar( 37 | title = content.title, 38 | description = content.description 39 | ) 40 | } 41 | ) 42 | ``` 43 | 44 | 4. **If you want to have a functionality where the info bar gets dismissed when user starts scrolling some content downwards and it should be visible only if user scrolls slightly upwards.** 45 | ```kotlin 46 | val lazyListState = rememberLazyListState() 47 | 48 | SSComposeInfoHost( 49 | modifier = Modifier 50 | .fillMaxSize(), 51 | composeHostState = composeInfoHostState, 52 | contentScrollState = lazyListState 53 | ) 54 | ``` 55 | 56 | 5. **If you want a callback when the info bar is dismissed successfully then we can set an onDismissListener to ComposeInfoHostState** 57 | ```kotlin 58 | val composeInfoHostState by remember { 59 | mutableStateOf(SSComposeInfoHostState()) 60 | } 61 | 62 | composeInfoHostState.setOnInfoBarDismiss { 63 | Toast.makeText( 64 | context, 65 | context.getString(R.string.info_bar_dismissed_successfully), 66 | Toast.LENGTH_SHORT 67 | ).show() 68 | } 69 | 70 | SSComposeInfoHost( 71 | modifier = Modifier 72 | .fillMaxSize(), 73 | composeHostState = composeInfoHostState 74 | ) 75 | ``` 76 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Simform Solutions 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Banner] 2 | 3 | # :speech_balloon: SSCompose-CustomInfoBar :speech_balloon: 4 | 5 |
6 | 7 | [![Platform-badge]][Android] 8 | [![Jetpack Compose-badge]][Android] 9 | [![API-badge]][Android] 10 | [![Kotlin Version](https://img.shields.io/badge/Kotlin-v1.9.23-blue.svg)](https://kotlinlang.org) 11 | [![Release-badge]][Release] 12 | 13 |
14 | 15 | 16 | Welcome to our SSCompose-CustomInfoBar Library! :tada: 17 | Tired of generic snackbars? This Jetpack Compose library offers a powerful and customizable way to 18 | display informative messages within your app. 19 | 20 | ## :zap: Features 21 | 22 | - **Content**: Add :speech_balloon: text, icons, or even custom composables to your info bar for 23 | ultimate flexibility. 24 | - **Position**: Display the info bar strategically at the :point_up: top or :point_down: bottom of 25 | your 26 | screen. 27 | - **Duration**: Control how long the info bar stays visible, from indefinite to short :zap: or 28 | long : 29 | hourglass: durations. 30 | - **Styles**: Predefined styles like :warning: error, :information_source: info, and warning are 31 | available, or craft your own style with custom background, 32 | text color, and icons. 33 | - **Swipe to dismiss**: Users can dismiss the info bar with a simple swipe, providing an interactive 34 | touch. 35 | - **Look & Feel**: :paintbrush: Customize the info bar's shape, color, and elevation to seamlessly 36 | match 37 | your app's design. 38 | - **Theming**: Integrate with Jetpack Compose's theming system for a consistent and beautiful look 39 | across your app. 40 | - **Animations**: :tada: Liven up your info bars with various built-in entrance and exit animations. 41 | - **Offline Notifications**: :signal_strength: A constructor flag which allows to automatically 42 | displays 43 | an info bar giving "you are offline" notification. 44 | - **Action button**: :+1: Optional action button to show on InfoBar. 45 | - **On Dismiss Callback**: Get notified about bar dismissal. 46 | - **Queueing System**: :repeat: Display multiple info bars sequentially. 47 | 48 | **NOTE:** 49 | - Scroll to show and hide info bar feature work only with LazyListState. 50 | - If the duration of infoBar is infinite then the queue feature won't work. 51 | - Currently there is no limit to how many info bars can be added to queue for displaying. 52 | 53 | 54 | ## :framed_picture: Preview 55 | |Full Preview | 56 | |---| 57 | |