forked from organicmaps/organicmaps
[android] Fixed the order of parameters in booking info request
This commit is contained in:
parent
4dc1d18ca5
commit
795cbd14c4
3 changed files with 17 additions and 17 deletions
|
@ -65,7 +65,7 @@ void PrepareClassRefs(JNIEnv * env, jclass sponsoredClass)
|
|||
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
// static void onDescriptionReceived(final String id, final String description)
|
||||
g_infoCallback = jni::GetStaticMethodID(
|
||||
env, g_sponsoredClass, "onInfoReceived",
|
||||
env, g_sponsoredClass, "onHotelInfoReceived",
|
||||
"(Ljava/lang/String;Lcom/mapswithme/maps/widget/placepage/Sponsored$HotelInfo;)V");
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public class PlacePageView extends RelativeLayout
|
|||
implements View.OnClickListener,
|
||||
View.OnLongClickListener,
|
||||
Sponsored.OnPriceReceivedListener,
|
||||
Sponsored.OnInfoReceivedListener,
|
||||
Sponsored.OnHotelInfoReceivedListener,
|
||||
LineCountTextView.OnLineCountCalculatedListener,
|
||||
RecyclerClickListener,
|
||||
NearbyAdapter.OnItemClickListener
|
||||
|
@ -536,7 +536,7 @@ public class PlacePageView extends RelativeLayout
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onInfoReceived(@NonNull String id, @NonNull Sponsored.HotelInfo info)
|
||||
public void onHotelInfoReceived(@NonNull String id, @NonNull Sponsored.HotelInfo info)
|
||||
{
|
||||
if (mSponsored == null || !TextUtils.equals(id, mSponsored.getId()))
|
||||
return;
|
||||
|
@ -654,7 +654,7 @@ public class PlacePageView extends RelativeLayout
|
|||
if (info == null)
|
||||
return;
|
||||
|
||||
String event = Statistics.EventName.PP_SPONSORED_NONE;
|
||||
String event = null;
|
||||
Map<String, String> params = new HashMap<>();
|
||||
switch (info.getType())
|
||||
{
|
||||
|
@ -671,7 +671,7 @@ public class PlacePageView extends RelativeLayout
|
|||
case Sponsored.TYPE_GEOCHAT:
|
||||
break;
|
||||
case Sponsored.TYPE_OPENTABLE:
|
||||
params.put("provider", "Opentable.Com");
|
||||
params.put("provider", "OpenTable");
|
||||
params.put("restaurant_lat",
|
||||
(mMapObject == null ? "N/A" : String.valueOf(mMapObject.getLat())));
|
||||
params.put("restaurant_lon",
|
||||
|
@ -684,7 +684,8 @@ public class PlacePageView extends RelativeLayout
|
|||
}
|
||||
|
||||
final Location location = LocationHelper.INSTANCE.getLastKnownLocation();
|
||||
Statistics.INSTANCE.trackEvent(event, location, params);
|
||||
if (!TextUtils.isEmpty(event))
|
||||
Statistics.INSTANCE.trackEvent(event, location, params);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1024,7 +1025,6 @@ public class PlacePageView extends RelativeLayout
|
|||
{
|
||||
switch (mSponsored.getType())
|
||||
{
|
||||
|
||||
case Sponsored.TYPE_BOOKING:
|
||||
buttons.add(PlacePageButtons.Item.BOOKING);
|
||||
break;
|
||||
|
|
|
@ -158,7 +158,7 @@ public final class Sponsored
|
|||
void onPriceReceived(@NonNull String id, @NonNull String price, @NonNull String currency);
|
||||
}
|
||||
|
||||
interface OnInfoReceivedListener
|
||||
interface OnHotelInfoReceivedListener
|
||||
{
|
||||
/**
|
||||
* This method is called from the native core on the UI thread
|
||||
|
@ -168,7 +168,7 @@ public final class Sponsored
|
|||
* @param info A hotel info
|
||||
*/
|
||||
@UiThread
|
||||
void onInfoReceived(@NonNull String id, @NonNull HotelInfo info);
|
||||
void onHotelInfoReceived(@NonNull String id, @NonNull HotelInfo info);
|
||||
}
|
||||
|
||||
// Hotel ID -> Price
|
||||
|
@ -180,7 +180,7 @@ public final class Sponsored
|
|||
@NonNull
|
||||
private static WeakReference<OnPriceReceivedListener> sPriceListener = new WeakReference<>(null);
|
||||
@NonNull
|
||||
private static WeakReference<OnInfoReceivedListener> sInfoListener = new WeakReference<>(null);
|
||||
private static WeakReference<OnHotelInfoReceivedListener> sInfoListener = new WeakReference<>(null);
|
||||
|
||||
@Nullable
|
||||
private String mId;
|
||||
|
@ -252,7 +252,7 @@ public final class Sponsored
|
|||
sPriceListener = new WeakReference<>(listener);
|
||||
}
|
||||
|
||||
static void setInfoListener(@NonNull OnInfoReceivedListener listener)
|
||||
static void setInfoListener(@NonNull OnHotelInfoReceivedListener listener)
|
||||
{
|
||||
sInfoListener = new WeakReference<>(listener);
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public final class Sponsored
|
|||
switch (sponsored.getType())
|
||||
{
|
||||
case TYPE_BOOKING:
|
||||
requestHotelInfo(locale, id);
|
||||
requestHotelInfo(id, locale);
|
||||
break;
|
||||
case TYPE_GEOCHAT:
|
||||
// TODO: request geochat info
|
||||
|
@ -300,7 +300,7 @@ public final class Sponsored
|
|||
/**
|
||||
* Make request to obtain hotel information.
|
||||
* This method also checks cache for requested hotel id
|
||||
* and if cache exists - call {@link #onInfoReceived(String, HotelInfo) onInfoReceived} immediately
|
||||
* and if cache exists - call {@link #onHotelInfoReceived(String, HotelInfo) onHotelInfoReceived} immediately
|
||||
*
|
||||
* @param id A Hotel id
|
||||
* @param locale A user locale
|
||||
|
@ -309,7 +309,7 @@ public final class Sponsored
|
|||
{
|
||||
HotelInfo info = sInfoCache.get(id);
|
||||
if (info != null)
|
||||
onInfoReceived(id, info);
|
||||
onHotelInfoReceived(id, info);
|
||||
|
||||
nativeRequestHotelInfo(id, locale);
|
||||
}
|
||||
|
@ -328,13 +328,13 @@ public final class Sponsored
|
|||
listener.onPriceReceived(id, price, currency);
|
||||
}
|
||||
|
||||
private static void onInfoReceived(@NonNull String id, @NonNull HotelInfo info)
|
||||
private static void onHotelInfoReceived(@NonNull String id, @NonNull HotelInfo info)
|
||||
{
|
||||
sInfoCache.put(id, info);
|
||||
|
||||
OnInfoReceivedListener listener = sInfoListener.get();
|
||||
OnHotelInfoReceivedListener listener = sInfoListener.get();
|
||||
if (listener != null)
|
||||
listener.onInfoReceived(id, info);
|
||||
listener.onHotelInfoReceived(id, info);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
Loading…
Add table
Reference in a new issue