Skip to content
Snippets Groups Projects
Commit 64e63fa0 authored by str4d's avatar str4d Committed by akwizgran
Browse files

Enable StrengthMeter to be defined in XML

parent b1f2f7d1
No related branches found
No related tags found
No related merge requests found
package org.briarproject.android.util;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.util.AttributeSet;
import android.widget.ProgressBar;
import static android.graphics.Color.BLACK;
import static android.graphics.Paint.Style.FILL;
import static android.graphics.Paint.Style.STROKE;
......@@ -9,14 +19,6 @@ import static org.briarproject.api.crypto.PasswordStrengthEstimator.QUITE_STRONG
import static org.briarproject.api.crypto.PasswordStrengthEstimator.QUITE_WEAK;
import static org.briarproject.api.crypto.PasswordStrengthEstimator.STRONG;
import static org.briarproject.api.crypto.PasswordStrengthEstimator.WEAK;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.widget.ProgressBar;
public class StrengthMeter extends ProgressBar {
......@@ -30,7 +32,11 @@ public class StrengthMeter extends ProgressBar {
private final ShapeDrawable bar;
public StrengthMeter(Context context) {
super(context, null, android.R.attr.progressBarStyleHorizontal);
this(context, null);
}
public StrengthMeter(Context context, AttributeSet attrs) {
super(context, attrs, android.R.attr.progressBarStyleHorizontal);
bar = new ShapeDrawable();
bar.getPaint().setColor(RED);
ClipDrawable clip = new ClipDrawable(bar, LEFT, HORIZONTAL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment