aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/settings/EditPasswordPreference.java
blob: af0704160f1dddfd1817925750447e299e60412f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package cgeo.geocaching.settings;

import org.apache.commons.lang3.StringUtils;

import android.content.Context;
import android.preference.EditTextPreference;
import android.util.AttributeSet;

/**
 * Password preference. It will only show a row of asterisks as summary instead of the password.
 * <p>
 * Use it exactly as an EditTextPreference
 * 
 */
public class EditPasswordPreference extends EditTextPreference {

    public EditPasswordPreference(Context context) {
        super(context);
    }

    public EditPasswordPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public EditPasswordPreference(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public void setSummary(CharSequence summary) {
        if (StringUtils.isBlank(summary)) {
            super.setSummary(StringUtils.EMPTY);
        } else {
            super.setSummary(StringUtils.repeat("\u2022 ", 10));
        }
    }

}