forked from organicmaps/organicmaps
[android] Cian models
This commit is contained in:
parent
191d3d497a
commit
6cfcb044bd
2 changed files with 243 additions and 0 deletions
143
android/src/com/mapswithme/maps/cian/RentOffer.java
Normal file
143
android/src/com/mapswithme/maps/cian/RentOffer.java
Normal file
|
@ -0,0 +1,143 @@
|
|||
package com.mapswithme.maps.cian;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
public final class RentOffer implements Parcelable
|
||||
{
|
||||
@NonNull
|
||||
private final String mFlatType;
|
||||
private final int mRoomsCount;
|
||||
private final int mPrice;
|
||||
private final int mFloorNumber;
|
||||
private final int mFloorsCount;
|
||||
@NonNull
|
||||
private final String mUrl;
|
||||
@NonNull
|
||||
private final String mAddress;
|
||||
|
||||
public static final Creator<RentOffer> CREATOR = new Creator<RentOffer>()
|
||||
{
|
||||
@Override
|
||||
public RentOffer createFromParcel(Parcel in)
|
||||
{
|
||||
return new RentOffer(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RentOffer[] newArray(int size)
|
||||
{
|
||||
return new RentOffer[size];
|
||||
}
|
||||
};
|
||||
|
||||
public RentOffer(@NonNull String flatType, int roomsCount, int price, int floorNumber,
|
||||
int floorsCount, @NonNull String url, @NonNull String address)
|
||||
{
|
||||
mFlatType = flatType;
|
||||
mRoomsCount = roomsCount;
|
||||
mPrice = price;
|
||||
mFloorNumber = floorNumber;
|
||||
mFloorsCount = floorsCount;
|
||||
mUrl = url;
|
||||
mAddress = address;
|
||||
}
|
||||
|
||||
private RentOffer(Parcel in)
|
||||
{
|
||||
mFlatType = in.readString();
|
||||
mRoomsCount = in.readInt();
|
||||
mPrice = in.readInt();
|
||||
mFloorNumber = in.readInt();
|
||||
mFloorsCount = in.readInt();
|
||||
mUrl = in.readString();
|
||||
mAddress = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags)
|
||||
{
|
||||
dest.writeString(mFlatType);
|
||||
dest.writeInt(mRoomsCount);
|
||||
dest.writeInt(mPrice);
|
||||
dest.writeInt(mFloorNumber);
|
||||
dest.writeInt(mFloorsCount);
|
||||
dest.writeString(mUrl);
|
||||
dest.writeString(mAddress);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getFlatType()
|
||||
{
|
||||
return mFlatType;
|
||||
}
|
||||
|
||||
public int getRoomsCount()
|
||||
{
|
||||
return mRoomsCount;
|
||||
}
|
||||
|
||||
public int getPrice()
|
||||
{
|
||||
return mPrice;
|
||||
}
|
||||
|
||||
public int getFloorNumber()
|
||||
{
|
||||
return mFloorNumber;
|
||||
}
|
||||
|
||||
public int getFloorsCount()
|
||||
{
|
||||
return mFloorsCount;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getUrl()
|
||||
{
|
||||
return mUrl;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getAddress()
|
||||
{
|
||||
return mAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
RentOffer rentOffer = (RentOffer) o;
|
||||
|
||||
if (mRoomsCount != rentOffer.mRoomsCount) return false;
|
||||
if (mPrice != rentOffer.mPrice) return false;
|
||||
if (mFloorNumber != rentOffer.mFloorNumber) return false;
|
||||
if (mFloorsCount != rentOffer.mFloorsCount) return false;
|
||||
if (!mFlatType.equals(rentOffer.mFlatType)) return false;
|
||||
if (!mUrl.equals(rentOffer.mUrl)) return false;
|
||||
return mAddress.equals(rentOffer.mAddress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result = mFlatType.hashCode();
|
||||
result = 31 * result + mRoomsCount;
|
||||
result = 31 * result + mPrice;
|
||||
result = 31 * result + mFloorNumber;
|
||||
result = 31 * result + mFloorsCount;
|
||||
result = 31 * result + mUrl.hashCode();
|
||||
result = 31 * result + mAddress.hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
100
android/src/com/mapswithme/maps/cian/RentPlace.java
Normal file
100
android/src/com/mapswithme/maps/cian/RentPlace.java
Normal file
|
@ -0,0 +1,100 @@
|
|||
package com.mapswithme.maps.cian;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RentPlace implements Parcelable
|
||||
{
|
||||
private final double mLat;
|
||||
private final double mLon;
|
||||
@NonNull
|
||||
private final List<RentOffer> mOffers;
|
||||
|
||||
public static final Creator<RentPlace> CREATOR = new Creator<RentPlace>()
|
||||
{
|
||||
@Override
|
||||
public RentPlace createFromParcel(Parcel in)
|
||||
{
|
||||
return new RentPlace(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RentPlace[] newArray(int size)
|
||||
{
|
||||
return new RentPlace[size];
|
||||
}
|
||||
};
|
||||
|
||||
public RentPlace(double lat, double lon, @NonNull List<RentOffer> offers)
|
||||
{
|
||||
mLat = lat;
|
||||
mLon = lon;
|
||||
mOffers = offers;
|
||||
}
|
||||
|
||||
private RentPlace(Parcel in)
|
||||
{
|
||||
mLat = in.readDouble();
|
||||
mLon = in.readDouble();
|
||||
mOffers = in.createTypedArrayList(RentOffer.CREATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags)
|
||||
{
|
||||
dest.writeDouble(mLat);
|
||||
dest.writeDouble(mLon);
|
||||
dest.writeTypedList(mOffers);
|
||||
}
|
||||
|
||||
public double getLat()
|
||||
{
|
||||
return mLat;
|
||||
}
|
||||
|
||||
public double getLon()
|
||||
{
|
||||
return mLon;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public List<RentOffer> getOffers()
|
||||
{
|
||||
return mOffers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
RentPlace rentPlace = (RentPlace) o;
|
||||
|
||||
if (Double.compare(rentPlace.mLat, mLat) != 0) return false;
|
||||
if (Double.compare(rentPlace.mLon, mLon) != 0) return false;
|
||||
return mOffers.equals(rentPlace.mOffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(mLat);
|
||||
result = (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(mLon);
|
||||
result = 31 * result + (int) (temp ^ (temp >>> 32));
|
||||
result = 31 * result + mOffers.hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue