aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/maps/OtherCachersOverlayItem.java
blob: 9844e83e6a5bf51a11ee6665bc629b0e0fb1691e (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
package cgeo.geocaching.maps;

import cgeo.geocaching.R;
import cgeo.geocaching.go4cache.Go4CacheUser;

import android.content.Context;
import android.graphics.drawable.Drawable;

public class OtherCachersOverlayItem {
    private final Context context;
    private final Go4CacheUser user;

    public OtherCachersOverlayItem(Context contextIn, Go4CacheUser userIn) {
        context = contextIn;
        user = userIn;
    }

    public Drawable getMarker() {
        Drawable marker;

        if (user != null && user.getDate() != null && user.getDate().getTime() >= (System.currentTimeMillis() - (20 * 60 * 1000))) {
            marker = context.getResources().getDrawable(R.drawable.user_location_active);
        } else {
            marker = context.getResources().getDrawable(R.drawable.user_location);
        }

        marker.setBounds(0, 0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight());
        marker.setAlpha(190);

        return marker;
    }

    public Go4CacheUser getUser() {
        return user;
    }
}