show horizontal progress like instagram stories.
Switch branches/tags
Clone or download
Latest commit b4ef57b Aug 22, 2018
Permalink
Failed to load latest commit information.
app Add new startStories Aug 21, 2018
gradle/wrapper Initial Commit Jul 21, 2017
image update README.md Oct 23, 2017
library Add new startStories Aug 21, 2018
.gitignore git rm Aug 22, 2018
README.md Update version Aug 21, 2018
build.gradle Initial Commit Jul 21, 2017
gradle.properties Initial Commit Jul 21, 2017
gradlew Initial Commit Jul 21, 2017
gradlew.bat Initial Commit Jul 21, 2017
settings.gradle Initial Commit Jul 21, 2017

README.md

StoriesProgressView

show horizontal progress like instagram stories.

^She is Yui Kobayashi

How to Use

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

    <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" />

Overview

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 onPrev() {
        // Call when finished revserse animation.
        Toast.makeText(this, "onPrev", 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();
    }
}

Skip and Reverse story

  storiesProgressView.skip();
  storiesProgressView.reverse();

Pause and Resume story

  storiesProgressView.pause();
  storiesProgressView.resume();

Install

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

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

Add the dependency

	dependencies {
	        compile 'com.github.shts:StoriesProgressView:3.0.0'
	}

License

Copyright (C) 2017 Shota Saito(shts)

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.