Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
shota-saito committed Jul 21, 2017
1 parent 7523944 commit bc00763
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 1 deletion.
93 changes: 93 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,96 @@ StoriesProgressView

show horizontal progress like instagram stories.

<src="image/image.gif" width=300 />


How to Use
----

To see how the StoriesProgressView are added to your xml layouts, check the sample project.

```xml
<jp.shts.android.storiesprogressview.StoriesProgressView
android:id="@+id/stories"
android:layout_width="match_parent"
android:layout_height="3dp"
android:layout_gravity="top"
android:layout_marginTop="8dp" />
```

```java
public class YourActivity extends AppCompatActivity implements StoriesProgressView.StoriesListener {
private StoriesProgressView storiesProgressView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

storiesProgressView = (StoriesProgressView) findViewById(R.id.stories);
storiesProgressView.setStoriesCount(PROGRESS_COUNT); // <- set stories
storiesProgressView.setStoryDuration(1200L); // <- set a story duration
storiesProgressView.setStoriesListener(this); // <- set listener
storiesProgressView.startStories(); // <- start progress
}

@Override
public void onNext() {
Toast.makeText(this, "onNext", Toast.LENGTH_SHORT).show();
}

@Override
public void onComplete() {
Toast.makeText(this, "onComplete", Toast.LENGTH_SHORT).show();
}

@Override
protected void onDestroy() {
// Very important !
storiesProgressView.destroy();
super.onDestroy();
}
}
```

Install
---

Add it in your root build.gradle at the end of repositories:

```groovy
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
```

Add the dependency

```
dependencies {
compile 'com.github.shts:StoriesProgressView:1.0.0'
}
```

License
---

```
Copyright (C) 2017 Shota Saito
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.
```
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:layout_height="match_parent"
android:contentDescription="@null" />

<jp.shts.android.storyprogressbar.StoriesProgressView
<jp.shts.android.storiesprogressview.StoriesProgressView
android:id="@+id/stories"
android:layout_width="match_parent"
android:layout_height="3dp"
Expand Down
Binary file added image/capture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/image.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bc00763

Please sign in to comment.