Created
June 29, 2016 09:57
-
-
Save griajobag/6af97bb0da90d4ba6109d4bb9573f368 to your computer and use it in GitHub Desktop.
smooth progressbar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.putuguna.smoothprogressbar; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.view.animation.AccelerateInterpolator; | |
import android.widget.ProgressBar; | |
import fr.castorflex.android.smoothprogressbar.SmoothProgressBar; | |
import fr.castorflex.android.smoothprogressbar.SmoothProgressBarUtils; | |
import fr.castorflex.android.smoothprogressbar.SmoothProgressDrawable; | |
public class MainActivity extends AppCompatActivity { | |
private ProgressBar mProgressBar1; | |
private SmoothProgressBar mGoogleNow; | |
private SmoothProgressBar mPocketBar; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
mProgressBar1 = (ProgressBar) findViewById(R.id.progressbar2); | |
mPocketBar = (SmoothProgressBar) findViewById(R.id.pocket); | |
mProgressBar1.setIndeterminateDrawable(new SmoothProgressDrawable.Builder(MainActivity.this).interpolator(new AccelerateInterpolator()).build()); | |
mGoogleNow = (SmoothProgressBar) findViewById(R.id.google_now); | |
mPocketBar.setSmoothProgressDrawableBackgroundDrawable( | |
SmoothProgressBarUtils.generateDrawableWithColors( | |
getResources().getIntArray(R.array.pocket_background_colors), | |
((SmoothProgressDrawable)mPocketBar.getIndeterminateDrawable()).getStrokeWidth() | |
) | |
); | |
findViewById(R.id.start).setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
mPocketBar.progressiveStart(); | |
} | |
}); | |
findViewById(R.id.finish).setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
mPocketBar.progressiveStop(); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment