mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
5074: Fix cropped numbers in Leaderboard (#5143)
* fix cropped numbers in the Achievements fragment * add null check in inflateAchievements method to fix NullPointerException in AchievementsFragmentUnitTests
This commit is contained in:
parent
23ee2b60d8
commit
7d895c4379
3 changed files with 89 additions and 34 deletions
|
|
@ -77,9 +77,15 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
|
|||
@BindView(R.id.images_uploaded_progressbar)
|
||||
CircleProgressBar imagesUploadedProgressbar;
|
||||
|
||||
@BindView(R.id.tv_uploaded_images)
|
||||
AppCompatTextView uploadedImagesTextview;
|
||||
|
||||
@BindView(R.id.images_used_by_wiki_progress_bar)
|
||||
CircleProgressBar imagesUsedByWikiProgressBar;
|
||||
|
||||
@BindView(R.id.tv_wiki_pb)
|
||||
AppCompatTextView imagesUsedByWikiTextview;
|
||||
|
||||
@BindView(R.id.image_reverts_progressbar)
|
||||
CircleProgressBar imageRevertsProgressbar;
|
||||
|
||||
|
|
@ -365,8 +371,8 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
|
|||
imagesUploadedProgressbar.setVisibility(View.VISIBLE);
|
||||
imagesUploadedProgressbar.setProgress
|
||||
(100*uploadCount/levelInfo.getMaxUploadCount());
|
||||
imagesUploadedProgressbar.setProgressTextFormatPattern
|
||||
(uploadCount +"/" + levelInfo.getMaxUploadCount() );
|
||||
uploadedImagesTextview.setText
|
||||
(uploadCount + "/" + levelInfo.getMaxUploadCount());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -413,8 +419,10 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
|
|||
thanksReceived.setText(String.valueOf(achievements.getThanksReceived()));
|
||||
imagesUsedByWikiProgressBar.setProgress
|
||||
(100 * achievements.getUniqueUsedImages() / levelInfo.getMaxUniqueImages());
|
||||
imagesUsedByWikiProgressBar.setProgressTextFormatPattern
|
||||
if(imagesUsedByWikiTextview != null) {
|
||||
imagesUsedByWikiTextview.setText
|
||||
(achievements.getUniqueUsedImages() + "/" + levelInfo.getMaxUniqueImages());
|
||||
}
|
||||
imagesFeatured.setText(String.valueOf(achievements.getFeaturedImages()));
|
||||
tvQualityImages.setText(String.valueOf(achievements.getQualityImages()));
|
||||
String levelUpInfoString = getString(R.string.level).toUpperCase();
|
||||
|
|
|
|||
|
|
@ -128,25 +128,48 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<com.dinuscxj.progressbar.CircleProgressBar
|
||||
<FrameLayout
|
||||
android:layout_width="@dimen/dimen_40"
|
||||
android:layout_height="@dimen/dimen_40"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="@dimen/large_gap"
|
||||
android:layout_marginRight="@dimen/large_gap"
|
||||
android:id="@+id/images_uploaded_progressbar"
|
||||
android:progress="50"
|
||||
app:progress_text_size="@dimen/progressbar_text"
|
||||
app:progress_end_color="#8C8B98"
|
||||
app:progress_start_color="#3A3381"
|
||||
app:progress_stroke_width="@dimen/progressbar_stroke"
|
||||
app:progress_text_format_pattern="573/110"
|
||||
android:visibility="gone"
|
||||
app:progress_text_color="@color/secondaryColor"
|
||||
app:style="solid_line" />
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginRight="32dp">
|
||||
|
||||
<com.dinuscxj.progressbar.CircleProgressBar
|
||||
android:layout_width="@dimen/dimen_40"
|
||||
android:layout_height="@dimen/dimen_40"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="@dimen/large_gap"
|
||||
android:layout_marginRight="@dimen/large_gap"
|
||||
android:id="@+id/images_uploaded_progressbar"
|
||||
android:progress="50"
|
||||
app:progress_text_size="@dimen/progressbar_text"
|
||||
app:progress_end_color="#8C8B98"
|
||||
app:progress_start_color="#3A3381"
|
||||
app:progress_stroke_width="@dimen/progressbar_stroke"
|
||||
app:progress_text_format_pattern=""
|
||||
android:visibility="gone"
|
||||
app:progress_text_color="@color/secondaryColor"
|
||||
app:style="solid_line" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_uploaded_images"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/progressbar_padding"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/secondaryColor"
|
||||
app:autoSizeMaxTextSize="@dimen/progressbar_text"
|
||||
app:autoSizeMinTextSize="2sp"
|
||||
app:autoSizeStepGranularity="1sp"
|
||||
app:autoSizeTextType="uniform" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
@ -267,23 +290,46 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<com.dinuscxj.progressbar.CircleProgressBar
|
||||
<FrameLayout
|
||||
android:layout_width="@dimen/dimen_40"
|
||||
android:layout_height="@dimen/dimen_40"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginRight="@dimen/large_gap"
|
||||
android:layout_marginEnd="@dimen/large_gap"
|
||||
android:progress="50"
|
||||
app:progress_text_size="@dimen/progressbar_text"
|
||||
android:id="@+id/images_used_by_wiki_progress_bar"
|
||||
app:progress_end_color="#8C8B98"
|
||||
app:progress_start_color="#3A3381"
|
||||
app:progress_stroke_width="2.5dp"
|
||||
android:visibility="gone"
|
||||
app:progress_text_color="@color/secondaryColor"
|
||||
app:progress_text_format_pattern="12/24"
|
||||
app:style="solid_line" />
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginRight="32dp">
|
||||
|
||||
<com.dinuscxj.progressbar.CircleProgressBar
|
||||
android:layout_width="@dimen/dimen_40"
|
||||
android:layout_height="@dimen/dimen_40"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginRight="@dimen/large_gap"
|
||||
android:layout_marginEnd="@dimen/large_gap"
|
||||
android:progress="50"
|
||||
app:progress_text_size="@dimen/progressbar_text"
|
||||
android:id="@+id/images_used_by_wiki_progress_bar"
|
||||
app:progress_end_color="#8C8B98"
|
||||
app:progress_start_color="#3A3381"
|
||||
app:progress_stroke_width="2.5dp"
|
||||
android:visibility="gone"
|
||||
app:progress_text_color="@color/secondaryColor"
|
||||
app:progress_text_format_pattern=""
|
||||
app:style="solid_line" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_wiki_pb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/progressbar_padding"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/secondaryColor"
|
||||
app:autoSizeMaxTextSize="@dimen/progressbar_text"
|
||||
app:autoSizeMinTextSize="2sp"
|
||||
app:autoSizeStepGranularity="1sp"
|
||||
app:autoSizeTextType="uniform" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
<dimen name="very_large_height">240dp</dimen>
|
||||
<dimen name="fragment_height">48dp</dimen>
|
||||
<dimen name="filter_padding">15dp</dimen>
|
||||
<dimen name="progressbar_padding">3.5dp</dimen>
|
||||
|
||||
<!-- Component sizes -->
|
||||
<dimen name="overflow_icon_dimen">56dp</dimen>
|
||||
|
|
@ -52,7 +53,7 @@
|
|||
<dimen name="first_fab">15dp</dimen>
|
||||
<dimen name="second_fab">25dp</dimen>
|
||||
<dimen name="subtitle_text">12sp</dimen>
|
||||
<dimen name="progressbar_text">9dp</dimen>
|
||||
<dimen name="progressbar_text">9sp</dimen>
|
||||
|
||||
<!-- App widget margin -->
|
||||
<dimen name="widget_margin">0dp</dimen>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue