Include previous Wikimedia hackathon (2018) task, peer review, to codebase (#2602)

* Add new activity to manifest

* Create review activity layout base

* Add a new menu item to drawer for peer review

* Add a top menu with randomizer icon to review activity

* Add strings for review button

* Add activity to ActivityBuilderModule for injection

* Add a new drawer item to start review acitivty

* Create base of the Review Activity

* Add fragment pager

* Add new fragment for injection

* Create a fragment pager layout

* Wikimedia hackathon 2018 (#1533)

* First draft of fn to get random recent image

* Use log entries for requests to beta, try to connect refresh button

FIXME: runs http request on main thread, breaks

* Tweak button connection

* Add ReviewController class

* Fix fragments

* Wmhack2018 (#1534)

* tiny fixes

* Load pictures into activities

* Re-use same class for all review fragments (#1537)

And try to add pager indicator

* [WIP] category check

* [WIP] add on-click actions to ReviewActivity

* [WIP] add SendThankTask

* Make it beautiful

* Add some category stuff back in to review (#1538)

* Use standalone category extraction code in MediaDataExtractor

* Add categories to category review page

* Change category question text sizes

* Call randomizer whenever the activity is ready

* Add progressbar

* [WIP] add DeleteTask.askReasonAndExecute

* Fix refresh button string

* Typo: "nominate *for* deletion"

* Add formatting to categories and put them in the same textView

* Pass context and adapters as parameters to controller

* Add actions to controller

* Make everyting work

* Add another fragment to thank

* Fix npe

* Add missing execute method

* Some codes

* Add a funy text

* More random recent image selection (#1542)

time-based randomness is biased - if someone uploaded 100 images in
hour, one week ago, and I select a random point in time, their last
image is way more likely to come up than anything else.

With this, there is still bias towards choosing one of the last N
in any burst of uploads (where N is the number of recent changes
fetched) but it's a bit better than before.

* Create Revision class

* Add meaningluf strings

* Error handling for review image/category fetch (#1543)

* Add information layout for username and filename

* Use Single to get firstRevision

* try to add username and filename

* Ensure caption is shown on every review fragment

* Fix build

* Fixes missing import

* Change button text,show current category, add skip image button

* Modify texts, fix night mode issues

* Positive Wording

* fix landscape issue

* Add checkbox popup,rewording

* Spelling Correction

* Fix merge

* Remove commented out code, use lambda

* Simplify toolbar include
This commit is contained in:
Silky Priya 2019-03-21 17:35:23 +05:30 committed by neslihanturan
parent a1a65d0832
commit a32ba452ec
33 changed files with 1594 additions and 33 deletions

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/>
</vector>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadius="0dp"
android:shape="ring"
android:thickness="2dp"
android:useLevel="false">
<solid android:color="@android:color/darker_gray"/>
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:innerRadius="0dp"
android:shape="ring"
android:thickness="4dp"
android:useLevel="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/commons_app_blue_dark"/>
</shape>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/tab_indicator_selected"
android:state_selected="true"/>
<item android:drawable="@drawable/tab_indicator_default"/>
</selector>

View file

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/toolbar"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
android:orientation="vertical"
android:weightSum="15">
<Button
android:id="@+id/skip_image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="SKIP THIS IMAGE"
android:textColor="@color/button_blue_dark"
android:background="@android:color/transparent"
android:layout_weight="1"
android:textStyle="bold"/>
<fr.free.nrw.commons.review.ReviewViewPager
android:id="@+id/reviewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:fadingEdge="none"
android:layout_weight="13.5"/>
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/reviewPagerIndicator"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_gravity="center"
android:foregroundGravity="center_vertical"
android:elevation="1dp"
android:background="?attr/colorPrimaryDark"
android:layout_weight="0.5"
/>
</LinearLayout>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<include layout="@layout/drawer_view" />
</androidx.drawerlayout.widget.DrawerLayout>

View file

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_above="@+id/bottomview"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="300dp">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_marginTop="0dp"
android:src="@drawable/commons_logo_large" />
<RelativeLayout
android:id="@+id/uploadOverlay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|bottom"
android:gravity="center"
android:layout_alignParentBottom="true"
android:background="#77000000"
android:padding="@dimen/tiny_gap"
>
<TextView
android:id="@+id/imageCaption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF"
style="?android:textAppearanceMedium"
/>
</RelativeLayout>
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="visible"
/>
</RelativeLayout>
<TextView
android:id="@+id/reviewQuestion"
android:layout_width="match_parent"
android:layout_height="80dp"
android:textAlignment="center"
android:textSize="32sp"
android:textColor="?attr/reviewHeading"
android:gravity="center_vertical"
android:text="testing1"
/>
<TextView
android:id="@+id/reviewQuestionContext"
android:layout_width="match_parent"
android:layout_height="100dp"
android:textAlignment="center"
android:textSize="22sp"
android:layout_marginBottom="15dp"
android:gravity="center_vertical"
android:text="testing2"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:weightSum="2"
android:orientation="horizontal">
<Button
android:id="@+id/yesButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="@dimen/activity_margin_horizontal"
android:background="@android:color/transparent"
android:text="@string/yes"
android:textSize="18sp"
android:textColor="@color/yes_button_color"
android:textAlignment="center"
/>
<Button
android:id="@+id/noButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:layout_weight="1"
android:layout_margin="@dimen/activity_margin_horizontal"
android:text="@string/no"
android:textSize="18sp"
android:textColor="@color/no_button_color"
android:textAlignment="center"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:id="@+id/bottomview"
android:layout_width="match_parent"
android:layout_height="10dp"
android:layout_alignParentBottom="true"
android:background="?attr/colorPrimaryDark"></View>
</RelativeLayout>

View file

@ -22,6 +22,11 @@
android:icon="@drawable/ic_round_star_filled_24px"
android:title="@string/navigation_item_bookmarks"/>
<item
android:id="@+id/action_review"
android:icon="@drawable/ic_check_black_24dp"
android:title="@string/navigation_item_review"/>
</group>
<group android:id="@+id/drawer_account">
<item

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_review_randomizer"
android:title="@string/refresh_button"
app:showAsAction="ifRoom|withText"
android:icon="@drawable/ic_refresh_white_24dp"
/>
</menu>

View file

@ -17,6 +17,7 @@
<attr name="textEnabled" format="reference"/>
<attr name="bookmarkButtonColor" format="reference"/>
<attr name="rowButtonColor" format="reference"/>
<attr name="reviewHeading" format="reference"/>
<attr name="contributionsListBackground" format="reference"/>
<attr name="achievementBackground" format="reference"/>

View file

@ -67,4 +67,6 @@
<color name="black">#000000</color>
<color name="swipe_red" tools:ignore="MissingDefaultResource">#FF0000</color>
<color name="yes_button_color">#B22222</color>
<color name="no_button_color">#006400</color>
</resources>

View file

@ -87,6 +87,7 @@
<string name="title_activity_signup">Sign Up</string>
<string name="title_activity_featured_images">Featured Images</string>
<string name="title_activity_category_details">Category</string>
<string name="title_activity_review">Peer Review</string>
<string name="menu_about">About</string>
<string name="about_license">The Wikimedia Commons app is an open-source app created and maintained by grantees and volunteers of the Wikimedia community. The Wikimedia Foundation is not involved in the creation, development, or maintenance of the app. </string>
<string name="trademarked_name" translatable="false">Wikimedia Commons</string>
@ -229,6 +230,7 @@
<string name="navigation_item_info">Tutorial</string>
<string name="navigation_item_notification">Notifications</string>
<string name="navigation_item_featured_images">Featured</string>
<string name="navigation_item_review">Review</string>
<string name="nearby_needs_permissions">Nearby places cannot be displayed without location permissions</string>
<string name="no_description_found">no description found</string>
<string name="nearby_info_menu_commons_article">Commons file page</string>
@ -259,6 +261,8 @@
<string name="nominate_deletion">Nominate for Deletion</string>
<string name="nominated_for_deletion">This image has been nominated for deletion.</string>
<string name="nominated_see_more"><![CDATA[<u>See webpage for details</u>]]></string>
<string name="nominating_file_for_deletion">Nominating %1$s for deletion.</string>
<string name="nominating_for_deletion_status">Nominating file for deletion: %1$s</string>
<string name="view_browser">View in Browser</string>
<string name="skip_login">Skip</string>
<string name="navigation_item_login">Log in</string>
@ -289,6 +293,8 @@
<string name="no_internet">Internet unavailable</string>
<string name="internet_established">Internet available</string>
<string name="error_notifications">Error fetching notifications</string>
<string name="error_review">Error fetching image for review. Press refresh to try again.</string>
<string name="error_review_categories">Error fetching image categories for review. Press refresh to try again.</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>
@ -456,6 +462,50 @@ Upload your first media by tapping on the add button.</string>
<string name="this_function_needs_network_connection">This function requires network connection, please check your connection settings.</string>
<string name="bad_token_error_proposed_solution">Upload failed due to issues with edit token. Please try logging out and in again. </string>
<string name="error_processing_image">Error occurred while processing the image. Please try again!</string>
<string name="getting_edit_token">Getting token for editing</string>
<string name="check_category_adding_template">Adding template for category check</string>
<string name="check_category_notification_title">Requesting category check for %1$s</string>
<string name="check_category_edit_summary">Requesting category check</string>
<string name="check_category_success_title">Requesting category check: Success</string>
<string name="check_category_failure_title">Requesting category check: Failed</string>
<string name="check_category_success_message">Successfully requested category check for %1$s</string>
<string name="check_category_failure_message">Could not request category check for %1$s</string>
<string name="check_category_toast">Requesting category check for %1$s</string>
<string name="nominate_for_deletion_edit_file_page">Adding delete message to file</string>
<string name="nominate_for_deletion_done">Done</string>
<string name="nominate_for_deletion_notify_user">Notifying User on Talk page</string>
<string name="nominate_for_deletion_edit_deletion_request_log">Adding file to Delete requests log</string>
<string name="nominate_for_deletion_create_deletion_request">Creating Delete requests subpage</string>
<string name="notsure">Not sure</string>
<string name="send_thank_success_title">Sending Thanks: Success</string>
<string name="send_thank_success_message">Successfully sent thanks to %1$s</string>
<string name="send_thank_failure_message">Failed to send thanks %1$s</string>
<string name="send_thank_failure_title">Sending Thanks: Failure</string>
<string name="send_thank_send">Sending thanks</string>
<string name="send_thank_notification_title">Sending thanks</string>
<string name="send_thank_toast">Sending Thanks for %1$s</string>
<string name="review_copyright">Does this follow the rules of copyright?</string>
<string name="review_category">Is this correctly categorized?</string>
<string name="review_spam">Is this in-scope?</string>
<string name="review_thanks">Would you like to thank the contributor?</string>
<string name="review_spam_explanation">Click NO to nominate this image for deletion if it is not useful at all.</string>
<string name="review_copyright_explanation">Logos, screenshots, movie posters are often copyright violations.\n Click NO to nominate this image for deletion</string>
<string name="review_thanks_explanation">%1$s will be encouraged by your appreciation</string>
<string name="review_no_category">Oh, this is not even categorized!</string>
<string name="review_category_explanation">This image is under %1$s categories.</string>
<string name="review_spam_report_question">It is out of scope because it is</string>
<string name="review_spam_report_problem">spam</string>
<string name="review_c_violation_report_question">It is copyright violation because it is </string>
<string name="review_c_violation_report_problem">copyRightViolation</string>
<string name="review_category_yes_button_text">NO, MIS-CATEGORIZED</string>
<string name="review_category_no_button_text">SEEMS FINE</string>
<string name="review_spam_yes_button_text">NO, OUT OF SCOPE</string>
<string name="review_spam_no_button_text">SEEMS FINE</string>
<string name="review_copyright_yes_button_text">NO, COPYRIGHT VIOLATION</string>
<string name="review_copyright_no_button_text">SEEMS FINE</string>
<string name="review_thanks_yes_button_text">YES, WHY NOT</string>
<string name="review_thanks_no_button_text">NEXT IMAGE</string>
<plurals name="receiving_shared_content">
<item quantity="one">Receiving shared content. Processing the image might take some time depending on the size of the image and your device</item>

View file

@ -17,6 +17,7 @@
<item name="colorButtonNormal">@color/primaryColor</item>
<item name="bookmarkButtonColor">@color/button_blue_dark</item>
<item name="rowButtonColor">@color/button_blue_dark</item>
<item name="reviewHeading">@color/white</item>
<item name="semitransparentText">@color/commons_app_blue_dark</item>
<item name="subBackground">@color/sub_background_dark</item>
@ -50,6 +51,7 @@
<item name="colorButtonNormal">@color/primaryColor</item>
<item name="bookmarkButtonColor">@color/button_blue</item>
<item name="rowButtonColor">@color/button_blue</item>
<item name="reviewHeading">@color/black</item>
<item name="semitransparentText">@color/commons_app_blue_light</item>
<item name="subBackground">@color/sub_background_light</item>