Skip to content

Fixes #3788-Distinctively show quality images and featured images in Achievements #3966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ class Achievements {
* @param featuredImages
*/
var featuredImages = 0
/**
* getter function to get count of featured images
* @return
*/
/**
* setter function to set count of featured images
* @param featuredImages
*/
var qualityImages = 0
/**
* getter function to get count of images uploaded
* @return
Expand All @@ -57,12 +66,14 @@ class Achievements {
articlesUsingImages: Int,
thanksReceived: Int,
featuredImages: Int,
qualityImages: Int,
imagesUploaded: Int,
revertCount: Int) {
this.uniqueUsedImages = uniqueUsedImages
this.articlesUsingImages = articlesUsingImages
this.thanksReceived = thanksReceived
this.featuredImages = featuredImages
this.qualityImages = qualityImages
this.imagesUploaded = imagesUploaded
this.revertCount = revertCount
}
Expand Down Expand Up @@ -91,8 +102,8 @@ class Achievements {
response.uniqueUsedImages,
response.articlesUsingImages,
response.thanksReceived,
response.featuredImages.qualityImages
+ response.featuredImages.featuredPicturesOnWikimediaCommons, 0,
response.featuredImages.featuredPicturesOnWikimediaCommons,
response.featuredImages.qualityImages, 0,
response.deletedUploads
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
@BindView(R.id.image_featured)
TextView imagesFeatured;

@BindView(R.id.quality_images)
TextView tvQualityImages;

@BindView(R.id.images_revert_limit_text)
TextView imagesRevertLimitText;

Expand Down Expand Up @@ -414,6 +417,7 @@ private void inflateAchievements(Achievements achievements) {
imagesUsedByWikiProgressBar.setProgressTextFormatPattern
(achievements.getUniqueUsedImages() + "/" + levelInfo.getMaxUniqueImages());
imagesFeatured.setText(String.valueOf(achievements.getFeaturedImages()));
tvQualityImages.setText(String.valueOf(achievements.getQualityImages()));
String levelUpInfoString = getString(R.string.level).toUpperCase();
levelUpInfoString += " " + levelInfo.getLevelNumber();
levelNumber.setText(levelUpInfoString);
Expand Down Expand Up @@ -492,6 +496,12 @@ public void showThanksReceivedInfo(){
,getResources().getString(R.string.thanks_received_explanation));
}

@OnClick(R.id.quality_images_info)
public void showQualityImagesInfo() {
launchAlert(getResources().getString(R.string.statistics_quality)
, getResources().getString(R.string.quality_images_info));
}

/**
* takes title and message as input to display alerts
* @param title
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions app/src/main/res/layout/fragment_achievements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,74 @@

</RelativeLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_margin_horizontal"
android:layout_marginRight="@dimen/activity_margin_horizontal"
android:layout_marginEnd="@dimen/activity_margin_horizontal"
android:layout_marginStart="@dimen/activity_margin_horizontal"
android:layout_marginTop="@dimen/activity_margin_horizontal">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_toStartOf="@+id/quality_images"
android:layout_toLeftOf="@+id/quality_images"
android:orientation="horizontal"
android:gravity="center_vertical">

<ImageView
android:layout_width="@dimen/overflow_icon_dimen"
android:layout_height="@dimen/overflow_icon_dimen"
android:id="@+id/quality_image_icon"
app:srcCompat="@drawable/ic_quality_images_logo"
android:scaleType="centerInside" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:textAppearanceMedium"
android:layout_marginStart="@dimen/activity_margin_horizontal"
android:layout_marginLeft="@dimen/activity_margin_horizontal"
android:layout_marginEnd="@dimen/activity_margin_horizontal"
android:layout_marginRight="@dimen/activity_margin_horizontal"
android:text="@string/statistics_quality" />

<ImageView
android:layout_width="@dimen/medium_width"
android:layout_height="@dimen/medium_height"
android:id="@+id/quality_images_info"
android:layout_marginTop="@dimen/activity_margin_horizontal"
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/primaryDarkColor" />

</LinearLayout>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:textAppearanceMedium"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/activity_margin_horizontal"
android:layout_marginStart="@dimen/activity_margin_horizontal"
android:layout_centerVertical="true"
tools:text="2"
android:text="0"
android:id="@+id/quality_images"
android:layout_marginLeft="@dimen/activity_margin_horizontal"
android:layout_marginEnd="@dimen/half_standard_height"
android:layout_marginRight="@dimen/half_standard_height" />

</RelativeLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -697,4 +697,6 @@ Upload your first media by tapping on the add button.</string>
<string name="limited_connection_enabled">Limited connection mode enabled!</string>
<string name="limited_connection_disabled">Limited connection mode disabled. Pending uploads will resume now.</string>
<string name="limited_connection">Limited Connection</string>
<string name="statistics_quality">Quality Images</string>
<string name="quality_images_info">Quality images are diagrams or photographs that meet certain quality standards (which are mostly technical in nature) and are valuable for Wikimedia projects</string>
</resources>