Fix #2915 Refractor feature Review (#2916)

* BugFix #2915
* Refractor ReviewActivity and ReviewImageFragment and the related layout files, to properly use the scrollview
* Use ButterKnife for ViewBindings in ReviewImageFragment
* updated resource id names to follow underscore notation in xml
* Use menu item instead of ImageView over toolbar in ReviewActivity
* use tools:replace instead of android:text for dummy texts

* merge nested if's [Codacy review]

* updated string review_category_yes_button_text, use textAllCaps in yes and no button in ReviewFragment

* updated other strings to use non bold letters
This commit is contained in:
Ashish Kumar 2019-04-24 18:22:12 +05:30 committed by neslihanturan
parent 37e9eae314
commit bb7ab62b34
6 changed files with 221 additions and 198 deletions

View file

@ -1,80 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
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
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar" />
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:id="@+id/review_image_info"
app:srcCompat="@drawable/ic_info_outline_24dp"
android:tint="@color/white"
android:layout_alignParentRight="true"
android:layout_margin="20dp"/>
<LinearLayout
android:id="@+id/skip_image_row"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_below="@+id/toolbar"
android:orientation="horizontal"
android:gravity="center">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/skip_image"
style="@style/Widget.AppCompat.Button.Borderless"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:drawableEnd="@drawable/ic_info_outline_24dp"
android:drawablePadding="12dp"
android:drawableTint="@color/button_blue_dark"
android:text="@string/skip_image"
android:textColor="@color/button_blue_dark"/>
<Button
android:id="@+id/skip_image"
android:layout_width="130dp"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:text="@string/skip_image"
android:textColor="@color/button_blue_dark"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:id="@+id/skip_image_info"
android:layout_marginTop="4dp"
android:layout_marginRight="@dimen/activity_margin_horizontal"
android:layout_marginEnd="@dimen/activity_margin_horizontal"
android:layout_gravity="top"
app:srcCompat="@drawable/ic_info_outline_24dp"
android:tint="@color/button_blue_dark" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="2"
>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/skip_image_row"
android:layout_above="@+id/reviewPagerIndicator"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_marginTop="5dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginTop="5dp"
>
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/imageView"
android:id="@+id/review_image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
@ -82,7 +58,7 @@
app:srcCompat="@drawable/commons_logo" />
<RelativeLayout
android:id="@+id/uploadOverlay"
android:id="@+id/rl_container_upload_overlay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
@ -92,7 +68,7 @@
android:padding="@dimen/tiny_gap">
<TextView
android:id="@+id/imageCaption"
android:id="@+id/tv_image_caption"
style="?android:textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -101,44 +77,46 @@
</RelativeLayout>
<ProgressBar
android:id="@+id/progressBar"
android:id="@+id/pb_review_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
android:visibility="gone"
tools:visibility="visible"/>
</RelativeLayout>
<fr.free.nrw.commons.review.ReviewViewPager
android:id="@+id/reviewPager"
android:layout_width="match_parent"
android:layout_height="300dp"
android:fadingEdge="none" />
<fr.free.nrw.commons.review.ReviewViewPager
android:id="@+id/view_pager_review"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fadingEdge="none"/>
</LinearLayout>
</ScrollView>
<View
android:id="@+id/bottomview"
android:layout_width="match_parent"
android:layout_height="15dp"
android:layout_alignParentBottom="true"
android:background="?attr/colorPrimaryDark"></View>
<RelativeLayout
android:id="@+id/rl_container_bottom_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:layout_alignParentBottom="true"
android:background="?attr/colorPrimaryDark"
android:elevation="2dp">
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/pager_indicator_review"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="?attr/colorPrimaryDark"
android:foregroundGravity="center_vertical"
/>
</RelativeLayout>
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/reviewPagerIndicator"
android:layout_width="match_parent"
android:layout_height="10dp"
android:layout_gravity="center"
android:background="?attr/colorPrimaryDark"
android:elevation="1dp"
android:foregroundGravity="center_vertical"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>
<include layout="@layout/drawer_view" />

View file

@ -1,70 +1,80 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:paddingBottom="10dp"
android:orientation="vertical"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_above="@id/ll_container_buttons">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:orientation="vertical">
<TextView
android:id="@+id/tv_review_question"
android:layout_width="match_parent"
android:layout_height="80dp"
android:gravity="center_vertical"
tools:text="testing1"
android:textAlignment="center"
android:textColor="?attr/reviewHeading"
android:textSize="32sp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:orientation="vertical">
<TextView
android:id="@+id/tv_review_question_context"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:gravity="center_vertical"
tools:text="testing2"
android:textAlignment="center"
android:textSize="22sp"/>
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/reviewQuestion"
android:layout_width="match_parent"
android:layout_height="80dp"
android:gravity="center_vertical"
android:text="testing1"
android:textAlignment="center"
android:textColor="?attr/reviewHeading"
android:textSize="32sp" />
<LinearLayout
android:id="@+id/ll_container_buttons"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:padding="2dp"
android:weightSum="2">
<TextView
android:id="@+id/reviewQuestionContext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:gravity="center_vertical"
android:text="testing2"
android:textAlignment="center"
android:textSize="22sp" />
<Button
android:id="@+id/button_yes"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:layout_margin="@dimen/activity_margin_horizontal"
android:background="@android:color/transparent"
android:text="@string/yes"
android:textAllCaps="true"
android:textAlignment="center"
android:textColor="@color/yes_button_color"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:textAllCaps="true"
android:id="@+id/button_no"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:layout_margin="@dimen/activity_margin_horizontal"
android:background="@android:color/transparent"
android:text="@string/no"
android:textAlignment="center"
android:textColor="@color/no_button_color"
/>
<Button
android:id="@+id/yesButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_margin_horizontal"
android:layout_weight="1"
android:background="@android:color/transparent"
android:text="@string/yes"
android:textAlignment="center"
android:textColor="@color/yes_button_color"
android:textSize="18sp" />
<Button
android:id="@+id/noButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_margin_horizontal"
android:layout_weight="1"
android:background="@android:color/transparent"
android:text="@string/no"
android:textAlignment="center"
android:textColor="@color/no_button_color"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,9 @@
<?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/menu_image_info"
app:showAsAction="always"
android:title="@string/image_info"
android:icon="@drawable/ic_info_outline_24dp"/>
</menu>

View file

@ -500,14 +500,14 @@ Upload your first media by tapping on the add button.</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>
<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>
<string name="skip_image_explanation">Clicking this button will give you another recently uploaded image from Wikimedia Commons</string>
<string name="review_image_explanation">You can review images and improve the quality of Wikimedia Commoms.\n The four parameters of review are: \n - Is this image in-scope? \n - Does this image follow the rules of copyright? \n - Is this image correctly categorized? \n - If all goes well you can also thank the contributor.</string>
@ -539,4 +539,5 @@ Upload your first media by tapping on the add button.</string>
<string name="welcome_dont_upload_content_description">Examples of images not to upload</string>
<string name="skip_image">SKIP THIS IMAGE</string>
<string name="download_failed_we_cannot_download_the_file_without_storage_permission">Download Failed!!. We cannot download the file without external storage permission.</string>
<string name="image_info">Image Info</string>
</resources>