aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/ui/DirectionImage.java
blob: cd7695e0103772f36dd47ace8d8e56c3261a60d9 (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
package cgeo.geocaching.ui;

import cgeo.geocaching.list.StoredList;
import cgeo.geocaching.network.HtmlImage;

import org.apache.commons.lang3.StringUtils;

import android.graphics.drawable.BitmapDrawable;

public class DirectionImage {

    static private HtmlImage htmlImage = new HtmlImage(HtmlImage.SHARED, false, StoredList.STANDARD_LIST_ID, false);

    /**
     * Retrieve the direction image corresponding to the direction code.
     *
     * @param directionCode one of the eight cardinal points
     * @return a drawable with the arrow pointing into the right direction
     */
    public static BitmapDrawable getDrawable(final String directionCode) {
        return StringUtils.isNotBlank(directionCode) ? htmlImage.getDrawable("http://www.geocaching.com/images/icons/compass/" + directionCode + ".gif") : null;
    }

}