blob: 529f019dc81b6ae4d8ef92928ce04979ef06199d (
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
52
53
54
55
56
57
58
59
60
61
62
63
|
package com.mapswithme.maps.promo;
import android.support.annotation.MainThread;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.mapswithme.util.NetworkPolicy;
import com.mapswithme.util.UTM;
import com.mapswithme.util.concurrency.UiThread;
public enum Promo
{
INSTANCE;
public interface Listener
{
void onCityGalleryReceived(@NonNull PromoCityGallery gallery);
void onErrorReceived();
}
@Nullable
private Promo.Listener mListener;
public void setListener(@Nullable Promo.Listener listener)
{
mListener = listener;
}
// Called from JNI.
@SuppressWarnings("unused")
@MainThread
void onCityGalleryReceived(@NonNull PromoCityGallery gallery)
{
if (!UiThread.isUiThread())
throw new AssertionError("Must be called from UI thread!");
if (mListener != null)
mListener.onCityGalleryReceived(gallery);
}
// Called from JNI.
@SuppressWarnings("unused")
@MainThread
void onErrorReceived()
{
if (!UiThread.isUiThread())
throw new AssertionError("Must be called from UI thread!");
if (mListener != null)
mListener.onErrorReceived();
}
public native void nativeRequestCityGallery(@NonNull NetworkPolicy policy,
double lat, double lon, @UTM.UTMType int utm);
public native void nativeRequestPoiGallery(@NonNull NetworkPolicy policy,
double lat, double lon, @NonNull String[] tags,
@UTM.UTMType int utm);
@Nullable
public static native PromoAfterBooking nativeGetPromoAfterBooking(@NonNull NetworkPolicy policy);
@Nullable
public static native String nativeGetCityUrl(@NonNull NetworkPolicy policy, double lat, double lon);
}
|