Reorderd editor page fields

Signed-off-by: map-per <map-per@gmx.de>
This commit is contained in:
map-per 2025-01-29 14:14:43 +01:00 committed by Konstantin Pastbin
parent 2b82c234e0
commit e02ae76196
3 changed files with 174 additions and 32 deletions

View file

@ -50,6 +50,8 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
private View mCardName;
private View mCardAddress;
private View mCardDetails;
private View mCardSocialMedia;
private View mCardBuilding;
private RecyclerView mNamesView;
@ -93,7 +95,6 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
private TextView mStreet;
private TextInputEditText mHouseNumber;
private View mBlockLevels;
private TextInputEditText mBuildingLevels;
// Define Metadata entries, that have more tricky logic, separately.
@ -135,6 +136,7 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
private View mEditOpeningHours;
private TextInputEditText mDescription;
private final Map<Metadata.MetadataType, View> mDetailsBlocks = new HashMap<>();
private final Map<Metadata.MetadataType, View> mSocialMediaBlocks = new HashMap<>();
private TextView mReset;
private EditorHostFragment mParent;
@ -300,29 +302,29 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
{
UiUtils.showIf(Editor.nativeIsNameEditable(), mCardName);
UiUtils.showIf(Editor.nativeIsAddressEditable(), mCardAddress);
UiUtils.showIf(Editor.nativeIsBuilding() && !Editor.nativeIsPointType(), mBlockLevels);
UiUtils.showIf(Editor.nativeIsBuilding() && !Editor.nativeIsPointType(), mCardBuilding);
final int[] editableDetails = Editor.nativeGetEditableProperties();
if (editableDetails.length == 0)
{
UiUtils.hide(mCardDetails);
return;
}
for (var e : mDetailsBlocks.entrySet())
setCardVisibility(mCardDetails, mDetailsBlocks, editableDetails);
setCardVisibility(mCardSocialMedia, mSocialMediaBlocks, editableDetails);
}
private void setCardVisibility(View card, Map<Metadata. MetadataType, View> blocks, int[] editableDetails) {
for (var e : blocks.entrySet())
UiUtils.hide(e.getValue());
boolean anyEditableDetails = false;
boolean anyBlockElement = false;
for (int type : editableDetails)
{
final View detailsBlock = mDetailsBlocks.get(Metadata.MetadataType.fromInt(type));
if (detailsBlock == null)
final View blockElement = blocks.get(Metadata.MetadataType.fromInt(type));
if (blockElement == null)
continue;
anyEditableDetails = true;
UiUtils.show(detailsBlock);
anyBlockElement = true;
UiUtils.show(blockElement);
}
UiUtils.showIf(anyEditableDetails, mCardDetails);
UiUtils.showIf(anyBlockElement, card);
}
private void refreshOpeningTime()
@ -412,6 +414,8 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
mCardName = view.findViewById(R.id.cv__name);
mCardAddress = view.findViewById(R.id.cv__address);
mCardDetails = view.findViewById(R.id.cv__details);
mCardSocialMedia = view.findViewById(R.id.cv__social_media);
mCardBuilding = view.findViewById(R.id.cv__building);
initNamesView(view);
// Address
@ -424,7 +428,7 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
initBlock(view, Metadata.MetadataType.FMD_POSTCODE, R.id.block_zipcode, 0, R.string.editor_zip_code, 0);
// Details
mBlockLevels = view.findViewById(R.id.block_levels);
View mBlockLevels = view.findViewById(R.id.block_levels);
mBuildingLevels = findInputAndInitBlock(mBlockLevels, 0,
getString(R.string.editor_storey_number, Editor.nativeGetMaxEditableBuildingLevels()));
mBuildingLevels.setInputType(InputType.TYPE_CLASS_NUMBER);
@ -493,12 +497,13 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
mDetailsBlocks.put(Metadata.MetadataType.FMD_WEBSITE, websiteBlock);
mDetailsBlocks.put(Metadata.MetadataType.FMD_WEBSITE_MENU, websiteMenuBlock);
mDetailsBlocks.put(Metadata.MetadataType.FMD_EMAIL, emailBlock);
mDetailsBlocks.put(Metadata.MetadataType.FMD_CONTACT_FACEBOOK, facebookContactBlock);
mDetailsBlocks.put(Metadata.MetadataType.FMD_CONTACT_INSTAGRAM, instagramContactBlock);
mDetailsBlocks.put(Metadata.MetadataType.FMD_CONTACT_TWITTER, twitterContactBlock);
mDetailsBlocks.put(Metadata.MetadataType.FMD_CONTACT_VK, vkContactBlock);
mDetailsBlocks.put(Metadata.MetadataType.FMD_CONTACT_LINE, lineContactBlock);
mDetailsBlocks.put(Metadata.MetadataType.FMD_OPERATOR, operatorBlock);
mSocialMediaBlocks.put(Metadata.MetadataType.FMD_CONTACT_FACEBOOK, facebookContactBlock);
mSocialMediaBlocks.put(Metadata.MetadataType.FMD_CONTACT_INSTAGRAM, instagramContactBlock);
mSocialMediaBlocks.put(Metadata.MetadataType.FMD_CONTACT_TWITTER, twitterContactBlock);
mSocialMediaBlocks.put(Metadata.MetadataType.FMD_CONTACT_VK, vkContactBlock);
mSocialMediaBlocks.put(Metadata.MetadataType.FMD_CONTACT_LINE, lineContactBlock);
}
private static TextInputEditText findInput(View blockWithInput)

View file

@ -123,9 +123,6 @@
<include
android:id="@+id/block_zipcode"
layout="@layout/item_editor_input"/>
<include
android:id="@+id/block_levels"
layout="@layout/item_editor_input"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
@ -141,6 +138,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_base"
android:paddingBottom="@dimen/margin_half"
android:fontFamily="@string/robotoMedium"
android:text="@string/details"
android:textAppearance="@style/MwmTextAppearance.Body3"
@ -184,6 +182,14 @@
android:background="?dividerHorizontal"/>
</RelativeLayout>
<include
android:id="@+id/block_operator"
layout="@layout/item_editor_input"/>
<include
android:id="@+id/block_website"
layout="@layout/item_editor_input"/>
<include
android:id="@+id/block_website_menu"
layout="@layout/item_editor_input"/>
@ -219,13 +225,11 @@
</RelativeLayout>
<include
android:id="@+id/block_operator"
layout="@layout/item_editor_input"/>
<include
android:id="@+id/block_website"
android:id="@+id/block_email"
layout="@layout/item_editor_input"/>
<!-- ToDo: Level is missing compared with iOS. -->
<RelativeLayout
android:id="@+id/block_wifi"
style="@style/MwmWidget.Editor.MetadataBlock.Clickable">
@ -305,12 +309,28 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- ToDo: Level is missing compared with iOS. -->
<androidx.cardview.widget.CardView
android:id="@+id/cv__social_media"
style="@style/MwmWidget.Editor.CardView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingEnd="@dimen/margin_base"
android:paddingStart="@dimen/margin_base">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_base"
android:paddingBottom="@dimen/margin_half"
android:fontFamily="@string/robotoMedium"
android:text="@string/social_media"
android:textAppearance="@style/MwmTextAppearance.Body3"
tools:ignore="UnusedAttribute"/>
<include
android:id="@+id/block_email"
layout="@layout/item_editor_input"/>
<include
android:id="@+id/block_facebook"
layout="@layout/item_editor_input"/>
@ -328,6 +348,33 @@
layout="@layout/item_editor_input"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cv__building"
style="@style/MwmWidget.Editor.CardView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingEnd="@dimen/margin_base"
android:paddingStart="@dimen/margin_base">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_base"
android:paddingBottom="@dimen/margin_half"
android:fontFamily="@string/robotoMedium"
android:text="@string/building"
android:textAppearance="@style/MwmTextAppearance.Body3"
tools:ignore="UnusedAttribute"/>
<include
android:id="@+id/block_levels"
layout="@layout/item_editor_input"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cv__more"
style="@style/MwmWidget.Editor.CardView">

View file

@ -14827,6 +14827,96 @@
zh-Hans = 详细信息
zh-Hant = 詳細資訊
[social_media]
tags = android
en = Social Media
af = Sosiale media
ar = وسائل التواصل الاجتماعي
az = Sosial Media
be = Сацыяльныя сеткі
bg = Социални медии
ca = Mitjans Socials
cs = Sociální média
da = Sociale medier
de = Social Media
el = Μέσα κοινωνικής δικτύωσης
es = Redes sociales
et = Sotsiaalmeedia
eu = Sare sozialak
fa = رسانه های اجتماعی
fi = Sosiaalinen media
fr = Réseaux sociaux
he = מדיה חברתית
hi = सोशल मीडिया
hu = Közösségi média
id = Media Sosial
it = I social media
ja = ソーシャルメディア
ko = 소셜 미디어
lt = Socialinė žiniasklaida
lv = Sociālie tīkli
mr = सोशल मीडिया
nb = Sosiale medier
nl = Sociale media
pl = Media społecznościowe
pt = Redes sociais
ro = Social Media
ru = Социальные сети
sk = Sociálne médiá
sv = Sociala medier
sw = Mitandao ya Kijamii
th = โซเชียลมีเดีย
tr = Sosyal Medya
uk = Соціальні мережі
vi = Truyền thông xã hội
zh-Hans = 社交媒体
zh-Hant = 社群媒體
[building]
tags = android
en = Building
af = Gebou
ar = البناء
az = bina
be = Будынак
bg = Сграда
ca = Edifici
cs = Budova
da = Bygning
de = Gebäude
el = Κτίριο
es = Edificio
et = Hoone
eu = Eraikina
fa = ساختمان
fi = Rakennus
fr = Bâtiment
he = בִּניָן
hi = इमारत
hu = Épület
id = Bangunan
it = Edificio
ja = 建物
ko = 빌딩
lt = Pastatas
lv = Ēka
mr = इमारत
nb = Bygning
nl = Gebouw
pl = Budynek
pt = Edifício
ro = Clădire
ru = Здание
sk = Budova
sv = Byggnad
sw = Jengo
th = อาคาร
tr = Bina
uk = Будівля
vi = Xây dựng
zh-Hans = 建筑
zh-Hant = 大樓
[add_street]
comment = Text field to enter non-existing street name, below list of known streets around
tags = android,ios