WIP: add collection_times (text-only display) #7950
12 changed files with 71 additions and 3 deletions
|
@ -64,7 +64,8 @@ public class Metadata implements Parcelable
|
|||
FMD_WHEELCHAIR(43),
|
||||
FMD_LOCAL_REF(44),
|
||||
FMD_DRIVE_THROUGH(45),
|
||||
FMD_WEBSITE_MENU(46);
|
||||
FMD_WEBSITE_MENU(46),
|
||||
FMD_COLLECTION_TIMES(47);
|
||||
private final int mMetaType;
|
||||
|
||||
MetadataType(int metadataType)
|
||||
|
|
|
@ -114,6 +114,8 @@ public class PlacePageView extends Fragment implements View.OnClickListener,
|
|||
private View mAddOrganisation;
|
||||
private View mAddPlace;
|
||||
private View mEditTopSpace;
|
||||
private View mCollectionTimes;
|
||||
private TextView mTvCollectionTimes;
|
||||
|
||||
// Data
|
||||
private CoordinatesFormat mCoordsFormat = CoordinatesFormat.LatLonDecimal;
|
||||
|
@ -267,6 +269,9 @@ public class PlacePageView extends Fragment implements View.OnClickListener,
|
|||
mCapacity.setOnLongClickListener(this);
|
||||
mWheelchair.setOnLongClickListener(this);
|
||||
mDriveThrough.setOnLongClickListener(this);
|
||||
mCollectionTimes = mFrame.findViewById(R.id.ll__place_collection_times);
|
||||
mTvCollectionTimes = mFrame.findViewById(R.id.tv__place_collection_times);
|
||||
mCollectionTimes.setOnLongClickListener(this);
|
||||
|
||||
mDownloaderIcon = new DownloaderStatusIcon(mPreview.findViewById(R.id.downloader_status_frame));
|
||||
|
||||
|
@ -408,6 +413,9 @@ public class PlacePageView extends Fragment implements View.OnClickListener,
|
|||
final String level = Utils.getLocalizedLevel(getContext(), mMapObject.getMetadata(Metadata.MetadataType.FMD_LEVEL));
|
||||
refreshMetadataOrHide(level, mLevel, mTvLevel);
|
||||
|
||||
final String collectionTimes = mMapObject.getMetadata(Metadata.MetadataType.FMD_COLLECTION_TIMES);
|
||||
refreshMetadataOrHide(collectionTimes, mCollectionTimes, mTvCollectionTimes);
|
||||
|
||||
final String cap = mMapObject.getMetadata(Metadata.MetadataType.FMD_CAPACITY);
|
||||
refreshMetadataOrHide(!TextUtils.isEmpty(cap) ? getString(R.string.capacity, cap) : "", mCapacity, mTvCapacity);
|
||||
|
||||
|
|
14
android/app/src/main/res/drawable/ic_collection_icon.xml
Normal file
14
android/app/src/main/res/drawable/ic_collection_icon.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="m7.547,7.609 l-3.547,1.773 0.447,0.223 7.553,3.66 7.553,-3.66 0.447,-0.223 -3.547,-1.773c-0.443,0.252 -0.943,0.386 -1.453,0.391 0,1.657 -1.343,3 -3,3s-3,-1.343 -3,-3c-0.51,-0.005 -1.01,-0.139 -1.453,-0.391zM3,11.117v7.383c-0,0.379 0.214,0.725 0.553,0.895l7.447,3.605v-8l-7.447,-3.605zM21,11.117 L20.447,11.395 13,15v8l7.447,-3.605c0.339,-0.169 0.553,-0.516 0.553,-0.895z"/>
|
||||
<path
|
||||
android:pathData="m12,2 l-3,3m3,-3 l3,3m-3,3v-6"
|
||||
android:strokeWidth="1.8"
|
||||
android:strokeColor="@android:color/white"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/ll__place_collection_times"
|
||||
style="@style/PlacePageItemFrame"
|
||||
android:tag="collection_times"
|
||||
tools:background="#4000FFFF"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv__place_collection_times"
|
||||
style="@style/PlacePageMetadataIcon"
|
||||
app:srcCompat="@drawable/ic_collection_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv__place_collection_times"
|
||||
style="@style/PlacePageMetadataText"
|
||||
tools:text="Mo-Fr 9:00; Sa 11:00" />
|
||||
|
||||
</LinearLayout>
|
|
@ -35,6 +35,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
tools:layout="@layout/place_page_opening_hours_fragment" />
|
||||
|
||||
<include layout="@layout/place_page_collection_times" />
|
||||
|
||||
<include layout="@layout/place_page_cuisine"/>
|
||||
|
||||
<include layout="@layout/place_page_entrance"/>
|
||||
|
|
|
@ -266,6 +266,7 @@ public:
|
|||
string const denomination(meta.Get(feature::Metadata::FMD_DENOMINATION));
|
||||
string const wheelchair(GetWheelchairType(f));
|
||||
string const opening_hours(meta.Get(feature::Metadata::FMD_OPEN_HOURS));
|
||||
string const collection_times(meta.Get(feature::Metadata::FMD_COLLECTION_TIMES));
|
||||
string const wikipedia(meta.Get(feature::Metadata::FMD_WIKIPEDIA));
|
||||
string const wikimedia_commons(meta.Get(feature::Metadata::FMD_WIKIMEDIA_COMMONS));
|
||||
string const floor(meta.Get(feature::Metadata::FMD_LEVEL));
|
||||
|
@ -276,7 +277,7 @@ public:
|
|||
osmId, uid, lat, lon, mwmName, category, name, std::string(city),
|
||||
addrStreet, addrHouse, phone, website, stars, std::string(metaOperator), internet,
|
||||
denomination, wheelchair, opening_hours, wikipedia, floor, fee, atm, contact_facebook,
|
||||
contact_instagram, contact_twitter, contact_vk, contact_line, wikimedia_commons};
|
||||
contact_instagram, contact_twitter, contact_vk, contact_line, wikimedia_commons, collection_times};
|
||||
|
||||
AppendNames(f, columns);
|
||||
PrintAsCSV(columns, ';', cout);
|
||||
|
@ -290,7 +291,7 @@ void PrintHeader()
|
|||
"phone", "website", "cuisines", "stars", "operator",
|
||||
"internet", "denomination", "wheelchair", "opening_hours", "wikipedia",
|
||||
"floor", "fee", "atm", "contact_facebook", "contact_instagram",
|
||||
"contact_twitter", "contact_vk", "contact_line", "wikimedia_commons"};
|
||||
"contact_twitter", "contact_vk", "contact_line", "wikimedia_commons", "collection_times"};
|
||||
// Append all supported name languages in order.
|
||||
for (uint8_t idx = 1; idx < kLangCount; idx++)
|
||||
columns.push_back("name_" + string(StringUtf8Multilang::GetLangByCode(idx)));
|
||||
|
|
|
@ -152,6 +152,11 @@ std::string MetadataTagProcessorImpl::ValidateAndFormat_opening_hours(std::strin
|
|||
return v;
|
||||
}
|
||||
|
||||
std::string MetadataTagProcessorImpl::ValidateAndFormat_collection_times(std::string const & v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
std::string MetadataTagProcessorImpl::ValidateAndFormat_ele(std::string const & v) const
|
||||
{
|
||||
if (IsNoNameNoAddressBuilding(m_params))
|
||||
|
@ -510,6 +515,7 @@ void MetadataTagProcessor::operator()(std::string const & k, std::string const &
|
|||
switch (mdType)
|
||||
{
|
||||
case Metadata::FMD_OPEN_HOURS: valid = ValidateAndFormat_opening_hours(v); break;
|
||||
case Metadata::FMD_COLLECTION_TIMES: valid = ValidateAndFormat_collection_times(v); break;
|
||||
case Metadata::FMD_FAX_NUMBER: // The same validator as for phone.
|
||||
case Metadata::FMD_PHONE_NUMBER: valid = ValidateAndFormat_phone(v); break;
|
||||
case Metadata::FMD_STARS: valid = ValidateAndFormat_stars(v); break;
|
||||
|
|
|
@ -15,6 +15,7 @@ struct MetadataTagProcessorImpl
|
|||
static std::string ValidateAndFormat_url(std::string const & v) ;
|
||||
static std::string ValidateAndFormat_phone(std::string const & v) ;
|
||||
static std::string ValidateAndFormat_opening_hours(std::string const & v) ;
|
||||
static std::string ValidateAndFormat_collection_times(std::string const & v) ;
|
||||
std::string ValidateAndFormat_ele(std::string const & v) const;
|
||||
static std::string ValidateAndFormat_destination(std::string const & v) ;
|
||||
static std::string ValidateAndFormat_local_ref(std::string const & v) ;
|
||||
|
|
|
@ -63,6 +63,8 @@ bool Metadata::TypeFromString(string_view k, Metadata::EType & outType)
|
|||
{
|
||||
if (k == "opening_hours")
|
||||
outType = Metadata::FMD_OPEN_HOURS;
|
||||
else if (k == "collection_times")
|
||||
outType = Metadata::FMD_COLLECTION_TIMES;
|
||||
else if (k == "phone" || k == "contact:phone" || k == "contact:mobile" || k == "mobile")
|
||||
outType = Metadata::FMD_PHONE_NUMBER;
|
||||
else if (k == "fax" || k == "contact:fax")
|
||||
|
@ -213,6 +215,7 @@ string ToString(Metadata::EType type)
|
|||
{
|
||||
case Metadata::FMD_CUISINE: return "cuisine";
|
||||
case Metadata::FMD_OPEN_HOURS: return "opening_hours";
|
||||
case Metadata::FMD_COLLECTION_TIMES: return "collection_times";
|
||||
case Metadata::FMD_PHONE_NUMBER: return "phone";
|
||||
case Metadata::FMD_FAX_NUMBER: return "fax";
|
||||
case Metadata::FMD_STARS: return "stars";
|
||||
|
|
|
@ -152,6 +152,7 @@ public:
|
|||
FMD_LOCAL_REF = 44,
|
||||
FMD_DRIVE_THROUGH = 45,
|
||||
FMD_WEBSITE_MENU = 46,
|
||||
FMD_COLLECTION_TIMES = 47,
|
||||
FMD_COUNT
|
||||
};
|
||||
|
||||
|
|
|
@ -146,6 +146,11 @@ std::string_view MapObject::GetOpeningHours() const
|
|||
return m_metadata.Get(MetadataID::FMD_OPEN_HOURS);
|
||||
}
|
||||
|
||||
std::string_view MapObject::GetCollectionTimes() const
|
||||
{
|
||||
return m_metadata.Get(MetadataID::FMD_COLLECTION_TIMES);
|
||||
}
|
||||
|
||||
feature::Internet MapObject::GetInternet() const
|
||||
{
|
||||
return feature::InternetFromString(m_metadata.Get(MetadataID::FMD_INTERNET));
|
||||
|
|
|
@ -80,7 +80,11 @@ public:
|
|||
std::string FormatRoadShields() const;
|
||||
|
||||
std::string_view GetOpeningHours() const;
|
||||
|
||||
std::string_view GetCollectionTimes() const;
|
||||
|
||||
feature::Internet GetInternet() const;
|
||||
|
||||
int GetStars() const;
|
||||
|
||||
/// @returns true if feature has ATM type.
|
||||
|
|
Reference in a new issue