diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-17 21:30:25 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-17 21:30:25 +0200 |
commit | f5aa36ef9f092240f99cb64b83cc64b91544d638 (patch) | |
tree | c19311230153b006a34a45785f68ecbe5993a2f0 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget | |
parent | 5895385153aa1b56717495b816238961d03023a5 (diff) | |
download | open-keychain-f5aa36ef9f092240f99cb64b83cc64b91544d638.tar.gz open-keychain-f5aa36ef9f092240f99cb64b83cc64b91544d638.tar.bz2 open-keychain-f5aa36ef9f092240f99cb64b83cc64b91544d638.zip |
fix rest of resource leaks (#1351)
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PasswordStrengthView.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PasswordStrengthView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PasswordStrengthView.java index 1487c3053..0ec145657 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PasswordStrengthView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PasswordStrengthView.java @@ -97,26 +97,23 @@ public class PasswordStrengthView extends View { public PasswordStrengthView(Context context, AttributeSet attrs) { super(context, attrs); - int COLOR_FAIL = context.getResources().getColor(R.color.android_red_light); - int COLOR_WEAK = context.getResources().getColor(R.color.android_orange_light); - int COLOR_STRONG = context.getResources().getColor(R.color.android_green_light); + int COLOR_FAIL = getResources().getColor(R.color.android_red_light); + int COLOR_WEAK = getResources().getColor(R.color.android_orange_light); + int COLOR_STRONG = getResources().getColor(R.color.android_green_light); TypedArray style = context.getTheme().obtainStyledAttributes( attrs, R.styleable.PasswordStrengthView, 0, 0); - try { - mStrengthRequirement = style.getInteger(R.styleable.PasswordStrengthView_strength, - STRENGTH_MEDIUM); - mShowGuides = style.getBoolean(R.styleable.PasswordStrengthView_showGuides, true); - mColorFail = style.getColor(R.styleable.PasswordStrengthView_color_fail, COLOR_FAIL); - mColorWeak = style.getColor(R.styleable.PasswordStrengthView_color_weak, COLOR_WEAK); - mColorStrong = style.getColor(R.styleable.PasswordStrengthView_color_strong, - COLOR_STRONG); - } catch (Exception e) { - e.printStackTrace(); - } + mStrengthRequirement = style.getInteger(R.styleable.PasswordStrengthView_strength, + STRENGTH_MEDIUM); + mShowGuides = style.getBoolean(R.styleable.PasswordStrengthView_showGuides, true); + mColorFail = style.getColor(R.styleable.PasswordStrengthView_color_fail, COLOR_FAIL); + mColorWeak = style.getColor(R.styleable.PasswordStrengthView_color_weak, COLOR_WEAK); + mColorStrong = style.getColor(R.styleable.PasswordStrengthView_color_strong, + COLOR_STRONG); + // Create and style the paint used for drawing the guide on the indicator mGuidePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mGuidePaint.setStyle(Paint.Style.FILL_AND_STROKE); @@ -124,6 +121,9 @@ public class PasswordStrengthView extends View { // Create and style paint for indicator mIndicatorPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mIndicatorPaint.setStyle(Paint.Style.FILL); + + style.recycle(); + } /** |