aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/settings/EditPasswordPreference.java
blob: 267a0b3790c019aaa7ee6785a90d30ffe775abff (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(final Context context) {
        super(context);
    }

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

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

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

}