Feature/localised image descriptions (#1634)

* wip

* Changes for adding descriptions in multipe languages[issue #1501]

* Added callback for the adapter

* Codacy suggested changes

* Sort the languages in the spinner in alphabetical order

* scroll view nested scrolling enabled false

* Nested scrolling enabled false [Allow rv to expand]

* rebased to master, resolved conflicts

* replaced setCompoundDrawables with setCompoundDrawablesWithIntrinsicBounds [the former dint used to work on all devices]

*     replaced setCompoundDrawables with setCompoundDrawablesWithIntrinsicBounds [the former dint used to work on all devices]
This commit is contained in:
Ashish Kumar 2018-08-03 18:09:37 +05:30 committed by Vivek Maskara
parent e4c518ccce
commit 12a83da3a2
12 changed files with 622 additions and 122 deletions

View file

@ -12,6 +12,7 @@
android:paddingRight="@dimen/standard_gap"
android:paddingStart="@dimen/standard_gap"
android:paddingTop="@dimen/small_gap"
android:nestedScrollingEnabled="false"
android:theme="@style/DarkAppTheme">
<LinearLayout
@ -38,40 +39,36 @@
android:scrollHorizontally="false" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/descEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/mapbox_info_icon_default"
android:drawableRight="@drawable/mapbox_info_icon_default"
android:hint="@string/share_description_hint"
android:imeOptions="flagNoExtractUi"
android:inputType="textMultiLine" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner
android:id="@+id/licenseSpinner"
android:layout_width="0dp"
android:layout_weight="15"
android:layout_height="wrap_content"
android:theme="?attr/spinnerTheme" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_descriptions"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_marginTop="4dp"
android:orientation="horizontal"
android:id="@+id/ll_add_description"
android:layout_width="wrap_content"
android:layout_gravity="right"
android:gravity="right"
android:padding="10dp"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:id="@+id/licenseInfo"
android:layout_height="wrap_content"
android:text="(?)"
android:textColor="@color/primaryTextColor"/>
style="@style/TextAppearance.AppCompat.Body1"
android:text="@string/add_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<Spinner
android:id="@+id/licenseSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?attr/spinnerTheme" />
<Button
android:id="@+id/titleDescButton"

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="10">
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/spinner_description_languages"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:spinnerMode="dialog"></android.support.v7.widget.AppCompatSpinner>
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="7">
<EditText
android:id="@+id/et_description_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/mapbox_info_icon_default"
android:drawableRight="@drawable/mapbox_info_icon_default"
android:hint="@string/share_description_hint"
android:imeOptions="flagNoExtractUi"
android:inputType="textMultiLine"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:id="@+id/ll_container_description_language"
android:orientation="vertical">
<TextView
android:id="@+id/tv_language"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dp"
android:imeOptions="flagNoExtractUi"
android:maxLines="1"
style="@style/Base.TextAppearance.AppCompat.Widget.TextView.SpinnerItem"
android:singleLine="true"
tools:text="en"
/>
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/item_white_background"></View>
</LinearLayout>

View file

@ -248,50 +248,47 @@
<string name="nominated_see_more"><u>See webpage for details</u></string>
<string name="view_browser">View in Browser</string>
<string name="nearby_location_has_not_changed">Location has not changed.</string>
<string name="nearby_location_not_available">Location not available.</string>
<string name="location_permission_rationale_nearby">Permission required to display a list of nearby places</string>
<string name="get_directions">GET DIRECTIONS</string>
<string name="read_article">READ ARTICLE</string>
<string name="nearby_location_has_not_changed">Location has not changed.</string>
<string name="nearby_location_not_available">Location not available.</string>
<string name="location_permission_rationale_nearby">Permission required to display a list of nearby places</string>
<string name="get_directions">GET DIRECTIONS</string>
<string name="read_article">READ ARTICLE</string>
<string name="notifications_welcome" formatted="false">Welcome to Wikimedia Commons, %1$s! We\'re glad you\'re here.</string>
<string name="notifications_talk_page_message">%1$s left a message on your talk page</string>
<string name="notifications_thank_you_edit">Thank you for making an edit</string>
<string name="notifications_mention">%1$s mentioned you on %2$s.</string>
<string name="toggle_view_button">Toggle view</string>
<string name="nearby_directions">DIRECTIONS</string>
<string name="nearby_wikidata">WIKIDATA</string>
<string name="nearby_wikipedia">WIKIPEDIA</string>
<string name="nearby_commons">COMMONS</string>
<string name="about_rate_us"><![CDATA[<u>Rate us</u>]]></string>
<string name="about_faq"><![CDATA[<u>FAQ</u>]]></string>
<string name="welcome_skip_button">Skip Tutorial</string>
<string name="no_internet">Internet unavailable</string>
<string name="internet_established">Internet available</string>
<string name="error_notifications">Error fetching notifications</string>
<string name="no_notifications">No notifications found</string>
<string name="about_translate"><![CDATA[<u>Translate</u>]]></string>
<string name="about_translate_title">Languages</string>
<string name="about_translate_message">Select the language that you would like to submit translations for</string>
<string name="about_translate_proceed">Proceed</string>
<string name="about_translate_cancel">Cancel</string>
<string name="retry">Retry</string>
<string formatted="false" name="notifications_welcome">Welcome to Wikimedia Commons, %1$s! We\'re glad you\'re here.</string>
<string name="notifications_talk_page_message">%1$s left a message on your talk page</string>
<string name="notifications_thank_you_edit">Thank you for making an edit</string>
<string name="notifications_mention">%1$s mentioned you on %2$s.</string>
<string name="toggle_view_button">Toggle view</string>
<string name="nearby_directions">DIRECTIONS</string>
<string name="nearby_wikidata">WIKIDATA</string>
<string name="nearby_wikipedia">WIKIPEDIA</string>
<string name="nearby_commons">COMMONS</string>
<string name="about_rate_us"><![CDATA[<u>Rate us</u>]]></string>
<string name="about_faq"><![CDATA[<u>FAQ</u>]]></string>
<string name="welcome_skip_button">Skip Tutorial</string>
<string name="no_internet">Internet unavailable</string>
<string name="internet_established">Internet available</string>
<string name="error_notifications">Error fetching notifications</string>
<string name="no_notifications">No notifications found</string>
<string name="about_translate"><![CDATA[<u>Translate</u>]]></string>
<string name="about_translate_title">Languages</string>
<string name="about_translate_message">Select the language that you would like to submit translations for</string>
<string name="about_translate_proceed">Proceed</string>
<string name="about_translate_cancel">Cancel</string>
<string name="retry">Retry</string>
<string name="showcase_view_got_it_button">Got it!</string>
<string name="showcase_view_whole_nearby_activity">These are the places near you that need pictures to illustrate their Wikipedia articles</string>
<string name="showcase_view_list_icon">Tapping this button brings up a list of these places</string>
<string name="showcase_view_plus_fab">You can upload a picture for any place from your gallery or camera</string>
<string name="showcase_view_got_it_button">Got it!</string>
<string name="showcase_view_whole_nearby_activity">These are the places near you that need pictures to illustrate their Wikipedia articles</string>
<string name="showcase_view_list_icon">Tapping this button brings up a list of these places</string>
<string name="showcase_view_plus_fab">You can upload a picture for any place from your gallery or camera</string>
<string name="no_images_found">No images found!</string>
<string name="error_loading_images">Error occurred while loading images.</string>
<string name="image_uploaded_by">Uploaded by: %1$s</string>
<string name="no_images_found">No images found!</string>
<string name="error_loading_images">Error occurred while loading images.</string>
<string name="image_uploaded_by">Uploaded by: %1$s</string>
<string name="block_notification">You are blocked from editing Commons</string>
<string name="share_app_title">Share App</string>
<string name="share_coordinates_not_present">Coordinates were not specified during image selection</string>
<string name="error_fetching_nearby_places">Error fetching nearby places.</string>
<string name="appwidget_img">Pic of the Day</string>
<string name="app_widget_heading">Pic of the Day</string>
<string name="block_notification">You are blocked from editing Commons</string>
<string name="appwidget_img">Pic of the Day</string>
<string name="app_widget_heading">Pic of the Day</string>
<string name="menu_search_button">Search</string>
<string name="search_commons">Search Commons</string>
<string name="images_not_found">No Images matching %1$s found</string>
@ -325,6 +322,10 @@
<string name="correct">Correct Answer</string>
<string name="wrong">Wrong Answer</string>
<string name="quiz_screenshot_question">Is this screenshot OK to upload?</string>
<string name="share_app_title">Share App</string>
<string name="share_coordinates_not_present">Coordinates were not specified during image selection</string>
<string name="error_fetching_nearby_places">Error fetching nearby places.</string>
<string name="add_description">+ Add description</string>
<string name="delete_recent_searches_dialog">Are you sure you want to clear your search history?</string>
<string name="search_history_deleted">Search history deleted</string>