aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/export/AbstractExport.java
blob: 94d05061b4e701dd526a4b968a7677207acb8810 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
package cgeo.geocaching.export;

import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.R;

abstract class AbstractExport implements Export {
    private final String name;

    protected AbstractExport(final String name) {
        this.name = name;
    }

    @Override
    public String getName() {
        return name;
    }

    /**
     * Generates a localized string from a resource id.
     *
     * @param resourceId
     *            the resource id of the string
     * @return localized string
     */
    protected static String getString(final int resourceId) {
        return CgeoApplication.getInstance().getString(resourceId);
    }

    /**
     * Generates a localized string from a resource id.
     *
     * @param resourceId
     *            the resource id of the string
     * @param params
     *            The parameter
     * @return localized string
     */
    protected static String getString(final int resourceId, final Object... params) {
        return CgeoApplication.getInstance().getString(resourceId, params);
    }

    @Override
    public String toString() {
        // used in the array adapter of the dialog showing the exports
        return getName();
    }

    protected String getProgressTitle() {
        return getString(R.string.export) + ": " + getName();
    }
}