Todo for user (#3851)

* Add a simple message

* Categories are edited

* Display categories

* read whole page

* Revert wrong changes

* Add newly added category field

* Doesnt displaey alreasy added categories

* add strings for notifications

* clean code

* Readd accidentally removed imports

* Fix edit layout style

* Fix category update messages

* Pass isWikipediaButtonDisplayed information to fragment

* Remove unused class

* Fix strings

* Fix string

* Add exeption for uncategorised images too

* Revert project.xml changes

* fix update buttonvisibility issue

* Make sure it works for auto added categories too

* make the button visible

* Make the button appear when categories are entered

* Include cancel button

* Make view updated too

* Make category view edited

* Update categories in an hacky way

* Fix unnecessary method call

* Add notes for short term fix to display added category

* Fix tests

* Fix strings

* Fix click issue
This commit is contained in:
neslihanturan 2020-08-17 14:30:46 +03:00 committed by GitHub
parent f5e28834fc
commit 1856196851
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 799 additions and 36 deletions

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
</vector>

View file

@ -8,6 +8,20 @@
android:background="?attr/mainBackground"
>
<LinearLayout
android:id="@+id/dummy_category_edit_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="35dp"
android:layout_gravity="bottom"
android:visibility="gone"
android:orientation="vertical"
android:weightSum="10">
<include
layout="@layout/layout_edit_categories" />
</LinearLayout>
<ImageView
android:id="@+id/mediaDetailImageFailed"
android:layout_height="wrap_content"
@ -53,9 +67,12 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_250"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/mediaDetailImageViewSpacer" />
android:id="@+id/mediaDetailImageViewSpacer"
>
</LinearLayout>
</FrameLayout>
@ -88,6 +105,30 @@
tools:text="Title of the media" />
</LinearLayout>
<LinearLayout
android:id="@+id/toDoLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
android:background="@color/layout_light_grey"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/MediaDetailTextLabel"
android:text="@string/warning" />
<TextView
android:id="@+id/toDoReason"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin_vertical"
style="@style/MediaDetailTextBody" />
</LinearLayout>
<LinearLayout
style="@style/MediaDetailContainer"
android:layout_width="match_parent"
@ -255,9 +296,19 @@
android:layout_width="@dimen/widget_margin"
android:layout_height="match_parent"
android:layout_weight="70"
android:orientation="vertical" />
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/categoryEditButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="@dimen/standard_gap"
android:layout_gravity="end"
android:background="@drawable/ic_baseline_edit_24" />
<LinearLayout
style="@style/MediaDetailContainer"
android:layout_width="match_parent"

View file

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:id="@+id/category_edit_layout"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="vertical"
android:background="@color/white"
android:elevation="30dp">
<TextView
android:id="@+id/tv_subtitle"
android:layout_width="wrap_content"
android:layout_height="@dimen/half_standard_height"
android:layout_margin="@dimen/quarter_standard_height"
android:gravity="center_vertical"
android:text="Type categories"
android:textSize="@dimen/subtitle_text"
android:visibility="visible" />
<FrameLayout
android:id="@+id/category_search_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/standard_gap"
>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_container_search"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<SearchView
android:id="@+id/et_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/categories_search_text_hint"
android:imeOptions="actionSearch"
android:inputType="text"
android:maxLines="1"/>
</com.google.android.material.textfield.TextInputLayout>
<ProgressBar
android:id="@+id/pb_categories"
style="?android:progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/tiny_gap"
android:layout_marginRight="@dimen/tiny_gap"
android:layout_gravity="center_vertical|end"
android:indeterminate="true"
android:indeterminateOnly="true"
android:visibility="gone" />
</FrameLayout>
<TextView
android:id="@+id/existing_categories"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/quarter_standard_height"
android:gravity="center_vertical"
android:textSize="@dimen/subtitle_text"
android:visibility="visible" />
<TextView
android:id="@+id/no_results_found"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/quarter_standard_height"
android:gravity="center_vertical"
android:text="No results found"
android:textSize="@dimen/description_text_size"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="6"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_categories"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:background="@color/white"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2">
<Button
android:id="@+id/cancel_categories_button"
android:layout_width="wrap_content"
android:layout_margin="@dimen/quarter_standard_height"
android:layout_height="wrap_content"
android:text="@string/cancel"
android:padding="@dimen/small_gap"
android:textColor="@color/white"
android:background="@color/opak_middle_grey"
/>
<Button
android:id="@+id/update_categories_button"
android:layout_width="wrap_content"
android:layout_margin="@dimen/quarter_standard_height"
android:layout_height="wrap_content"
android:text="@string/category_edit_button_text"
android:padding="@dimen/small_gap"
android:textColor="@color/white"
android:background="@color/button_blue"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/category_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<CheckBox
android:id="@+id/category_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checkMark="?android:attr/textCheckMark"
android:checked="false"
android:gravity="center_vertical"
android:padding="@dimen/tiny_gap"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/category_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Category"
app:layout_constraintLeft_toRightOf="@+id/category_checkbox"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -598,6 +598,17 @@ Upload your first media by tapping on the add button.</string>
<string name="delete_helper_ask_reason_copyright_logo">Logo</string>
<string name="delete_helper_ask_reason_copyright_other">Other</string>
<string name="delete_helper_ask_alert_set_positive_button_reason">Because it is</string>
<string name="category_edit_helper_make_edit_toast">Trying to update categories.</string>
<string name="category_edit_helper_show_edit_title">Category update</string>
<string name="category_edit_helper_show_edit_title_success">Success</string>
<plurals name="category_edit_helper_show_edit_message_if">
<item quantity="one">Category %1$s is added.</item>
<item quantity="other">Categories %1$s are added.</item>
</plurals>
<string name="category_edit_helper_edit_message_else">Could not add categories.</string>
<string name="category_edit_button_text">Update categories</string>
<string name="share_image_via">Share image via</string>
<string name="no_achievements_yet">You haven\'t made any contributions yet</string>
<string name="account_created">Account created!</string>
@ -636,6 +647,10 @@ Upload your first media by tapping on the add button.</string>
<string name="load_more">Load More</string>
<string name="nearby_no_results">No places found, try changing your search criteria.</string>
<string name="todo_improve">Suggested improvements:</string>
<string name="missing_category">- Add categories to this image to improve usability.</string>
<string name="missing_article">- Add this image to the associated Wikipedia article that has no images.</string>
<string name="edit_category">Edit categories</string>
<string name="add_picture_to_wikipedia_article_title">Add image to Wikipedia</string>
<string name="add_picture_to_wikipedia_article_desc">Do you want to add this picture to the %1$s language Wikipedia article?</string>