# StatusStories **Repository Path**: baijuncheng-open-source/statusstories ## Basic Information - **Project Name**: StatusStories - **Description**: 一个高度可定制化的故事视图 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-04-13 - **Last Updated**: 2021-09-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # StatusStories ![gif](https://images.gitee.com/uploads/images/2021/0714/103813_f8b24cd5_8230582.gif "statusstories1.gif") StatusStories helps you implement Photo Stories similar to - Snapchat stories - Instagram stories - Whatsapp Statuses - Facebook Messenger Stories ![1](https://images.gitee.com/uploads/images/2021/0714/104726_c5465c36_8230582.png "device-2021-07-14-104321.png") ![2](https://images.gitee.com/uploads/images/2021/0414/151224_c585ef95_8230582.jpeg "Screenshot_20210412_172048_com.rahuljanagouda.statusstories.sample.jpg") ![3](https://images.gitee.com/uploads/images/2021/0414/151539_f7a61cfb_8230582.jpeg "Screenshot_20210412_172233_com.rahuljanagouda.statusstories.sample.jpg") ![4](https://images.gitee.com/uploads/images/2021/0414/151549_a2efe936_8230582.jpeg "Screenshot_20210412_172512_com.rahuljanagouda.statusstories.sample.jpg") ## Features at glance - Highly customizable Stories view - Click left right edge to move forward or previous just like WhatsApp - Hold the center area to pause - Cache the images using glide - Progress bar indicates the downloaded content from the internet - Immersive mode enables the more engaging experience - Control the duration of each Story - Finishes after the last story ends ## Install #1 Add the below lines in your root build.gradle. This library is using glide internally to download and cache the images. ```groovy dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) testImplementation 'junit:junit:4.12' implementation project(path: ':statusstories') } ``` #2. Add the dependency ``` Compile this project, copy the har package generated in the build directory of the statusstories folder to the project lib folder Add the following code in the sample's gradle dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) } ``` #3remote maven repo integration The lib is available on Maven Central, you can find it with [Gradle, please] ```xml dependencies { implementation 'com.gitee.baijuncheng-open-source:StatusStories:1.0.1' } ``` ## How to Use Launch the activity with the configuration ##### Note: The picture loading timeout time is set to 10 seconds. If the picture is too large or the network is not good, the picture will not be loaded and the story will continue. ##### You can set the loading failure image in OnLoadFailure //urls array that should be shown as a story ``` private final String[] resources = new String[]{ "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3668046106,2640230749&fm=26&gp=0.jpg", "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1435378814,925307395&fm=26&gp=0.jpg", "https://firebasestorage.googleapis.com/v0/b/firebase-satya.appspot.com/o/images%2Fi00005.jpg?alt=media&token=7d179938-c419-44f4-b965-1993858d6e71", "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2625820219,825469968&fm=26&gp=0.jpg", "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2512083915,1589918522&fm=26&gp=0.jpg", "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1097975762,2965304043&fm=26&gp=0.jpg", "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2309388168,229304212&fm=26&gp=0.jpg" }; ``` ``` //launch with presettings AbilitySlice slice = new StatusStoriesSlice(); Intent intent = new Intent(); Operation operation = new Intent.OperationBuilder() .withAction(Intent.ACTION_QUERY_WEATHER) .build(); intent.setParam(StatusStoriesSlice.STATUS_RESOURCES_KEY, resources); intent.setParam(StatusStoriesSlice.STATUS_DURATION_KEY, storyDuration); intent.setParam(StatusStoriesSlice.IS_IMMERSIVE_KEY, ImmersiveEnabled); intent.setParam(StatusStoriesSlice.IS_CACHING_ENABLED_KEY, CacheStatusEnabled); intent.setParam(StatusStoriesSlice.IS_TEXT_PROGRESS_ENABLED_KEY, ShowProdgressStatus); intent.setOperation(operation); present(slice, intent); ``` Inspired by [StoriesProgressView](https://github.com/shts/StoriesProgressView) # Change Log ## [1.0.0] - April, 2021 - 增加statusStories库; # TODO - [ ] Write tests 🌚 - [ ] Pre-fetch/pre-load the next image - [ ] Supporting customizing contents loaded in Gifs, anyt view - [ ] Implement swipeable ## License ``` Copyright (C) 2017 Rahul Janagouda Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```