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

import android.graphics.drawable.BitmapDrawable;

public class DirectionImage {

    static final private HtmlImage HTML_IMAGE = 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 an observable containing zero or more drawables (the last one being the freshest image)
     */
    public static Observable<BitmapDrawable> fetchDrawable(final String directionCode) {
        return HTML_IMAGE.fetchDrawable("https://www.geocaching.com/images/icons/compass/" + directionCode + ".gif");
    }

}