Skip to content

Instantly share code, notes, and snippets.

@pratheepchowdhary
Created June 22, 2019 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pratheepchowdhary/389ac635340c905aa34ef30e59ab07d5 to your computer and use it in GitHub Desktop.
Save pratheepchowdhary/389ac635340c905aa34ef30e59ab07d5 to your computer and use it in GitHub Desktop.
/*
* This is the source code of DMAudioStreaming for Android v. 1.0.0.
* You should have received a copy of the license in this archive (see LICENSE).
* Copyright @Dibakar_Mistry(dibakar.ece@gmail.com), 2017.
*/
package in.androidhunt.musicDEmo.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
public class LineProgress extends View {
public int progress;
public Paint paint = new Paint();
public LineProgress(Context context) {
super(context);
}
public LineProgress(Context context, AttributeSet attrs) {
super(context, attrs);
}
public LineProgress(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
paint = new Paint();
paint.setColor(Color.TRANSPARENT);
canvas.drawRect(0, 0, this.getWidth(), this.getHeight(), paint);
paint = new Paint();
paint.setColor(Color.BLACK);
canvas.drawRect(0, 0, this.progress, this.getHeight(), paint);
}
public void setLineProgress(int pg) {
int wdt = this.getWidth();
this.progress = pg * (wdt / 100);
invalidate();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment