forked from organicmaps/organicmaps
Support local experts on Android.
This commit is contained in:
parent
a37e03685a
commit
0241aedd3d
2 changed files with 210 additions and 0 deletions
32
android/jni/com/mapswithme/maps/locals/Locals.cpp
Normal file
32
android/jni/com/mapswithme/maps/locals/Locals.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include "android/jni/com/mapswithme/maps/Framework.hpp"
|
||||
|
||||
#include "android/jni/com/mapswithme/core/jni_helper.hpp"
|
||||
#include "partners_api/locals_api.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
jclass g_localExpertClass;
|
||||
jmethodID g_localExpertConstructor;
|
||||
|
||||
void PrepareClassRefs(JNIEnv * env)
|
||||
{
|
||||
if (g_localExpertClass)
|
||||
return;
|
||||
|
||||
@NonNull int id,
|
||||
@NotNull String name,
|
||||
@NotNull String country,
|
||||
@NotNull String city,
|
||||
double rating, int reviewCount, @NonNull double price
|
||||
@NonNull String currency, String motto, String about,
|
||||
@NonNull String offer, @NonNull String pageUrl, @NonNull String photoUrl
|
||||
|
||||
g_localExpertClass = jni::GetGlobalClassRef(env, "com/mapswithme/maps/locals/LocalExpert");
|
||||
g_localExpertConstructor =
|
||||
jni::GetConstructorID(env, g_viatorProductClass,
|
||||
"(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;DID"
|
||||
"Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;"
|
||||
"Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
}
|
||||
|
||||
} // namespace
|
178
android/src/com/mapswithme/maps/locals/LocalExpert.java
Normal file
178
android/src/com/mapswithme/maps/locals/LocalExpert.java
Normal file
|
@ -0,0 +1,178 @@
|
|||
package com.mapswithme.maps.locals;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
public final class LocalExpert implements Parcelable
|
||||
{
|
||||
private final int mId;
|
||||
@NonNull
|
||||
private final String mName;
|
||||
@NonNull
|
||||
private final String mCountry;
|
||||
@NonNull
|
||||
private final String mCity;
|
||||
private final double mRating;
|
||||
private final int mReviewCount;
|
||||
private final double mPrice;
|
||||
@NonNull
|
||||
private final String mCurrency;
|
||||
@NonNull
|
||||
private final String mMotto;
|
||||
@NonNull
|
||||
private final String mAboutExpert;
|
||||
@NonNull
|
||||
private final String mOfferDescription;
|
||||
@NonNull
|
||||
private final String mPageUrl;
|
||||
@NonNull
|
||||
private final String mPhotoUrl;
|
||||
|
||||
|
||||
public static final Creator<LocalExpert> CREATOR = new Creator<LocalExpert>()
|
||||
{
|
||||
@Override
|
||||
public LocalExpert createFromParcel(Parcel in)
|
||||
{
|
||||
return new LocalExpert(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalExpert[] newArray(int size)
|
||||
{
|
||||
return new LocalExpert[size];
|
||||
}
|
||||
};
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public LocalExpert(int id, @NonNull String name, @NonNull String country,
|
||||
@NonNull String city, double rating, int reviewCount,
|
||||
double price, @NonNull String currency, @NonNull String motto,
|
||||
@NonNull String about, @NonNull String offer, @NonNull String pageUrl,
|
||||
@NonNull String photoUrl)
|
||||
{
|
||||
mId = id;
|
||||
mName = name;
|
||||
mCountry = country;
|
||||
mCity = city;
|
||||
mRating = rating;
|
||||
mReviewCount = reviewCount;
|
||||
mPrice = price;
|
||||
mCurrency = currency;
|
||||
mMotto = motto;
|
||||
mAboutExpert = about;
|
||||
mOfferDescription = offer;
|
||||
mPhotoUrl = photoUrl;
|
||||
mPageUrl = pageUrl;
|
||||
}
|
||||
|
||||
private LocalExpert(Parcel in)
|
||||
{
|
||||
mId = in.readInt();
|
||||
mName = in.readString();
|
||||
mCountry = in.readString();
|
||||
mCity = in.readString();
|
||||
mRating = in.readDouble();
|
||||
mReviewCount = in.readInt();
|
||||
mPrice = in.readDouble();
|
||||
mCurrency = in.readString();
|
||||
mMotto = in.readString();
|
||||
mAboutExpert = in.readString();
|
||||
mOfferDescription = in.readString();
|
||||
mPhotoUrl = in.readString();
|
||||
mPageUrl = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags)
|
||||
{
|
||||
dest.writeInt(mId);
|
||||
dest.writeString(mName);
|
||||
dest.writeString(mCountry);
|
||||
dest.writeString(mCity);
|
||||
dest.writeDouble(mRating);
|
||||
dest.writeInt(mReviewCount);
|
||||
dest.writeDouble(mPrice);
|
||||
dest.writeString(mCurrency);
|
||||
dest.writeString(mMotto);
|
||||
dest.writeString(mAboutExpert);
|
||||
dest.writeString(mOfferDescription);
|
||||
dest.writeString(mPhotoUrl);
|
||||
dest.writeString(mPageUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getId() { return mId; }
|
||||
|
||||
@NonNull
|
||||
String getName() { return mName; }
|
||||
|
||||
@NonNull
|
||||
String getCountry() { return mCountry; }
|
||||
|
||||
@NonNull
|
||||
String getCity() { return mCity; }
|
||||
|
||||
double getRating() { return mRating; }
|
||||
|
||||
int getReviewCount()
|
||||
{
|
||||
return mReviewCount;
|
||||
}
|
||||
|
||||
double getPrice()
|
||||
{
|
||||
return mPrice;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
String getCurrency() { return mCurrency; }
|
||||
|
||||
@NonNull
|
||||
String getMotto() { return mMotto; }
|
||||
|
||||
@NonNull
|
||||
String getAboutExpert() { return mAboutExpert; }
|
||||
|
||||
@NonNull
|
||||
String getOfferDescription() { return mOfferDescription; }
|
||||
|
||||
@NonNull
|
||||
String getPageUrl()
|
||||
{
|
||||
return mPageUrl;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
String getPhotoUrl() { return mPhotoUrl; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
LocalExpert that = (LocalExpert) o;
|
||||
|
||||
if (mId != that.mId) return false;
|
||||
if (!mName.equals(that.mName)) return false;
|
||||
if (!mCountry.equals(that.mCountry)) return false;
|
||||
if (!mCity.equals(that.mCity)) return false;
|
||||
if (Double.compare(that.mRating, mRating) != 0) return false;
|
||||
if (mReviewCount != that.mReviewCount) return false;
|
||||
if (Double.compare(that.mPrice, mPrice) != 0) return false;
|
||||
if (!mCurrency.equals(that.mCurrency)) return false;
|
||||
if (!mMotto.equals(that.mMotto)) return false;
|
||||
if (!mAboutExpert.equals(that.mAboutExpert)) return false;
|
||||
if (!mOfferDescription.equals(that.mOfferDescription)) return false;
|
||||
if (!mPhotoUrl.equals(that.mPhotoUrl)) return false;
|
||||
return mPageUrl.equals(that.mPageUrl);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue