mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-03 00:03:53 +01:00
replace deprecated circular progress bar with material progress bar
This commit is contained in:
parent
c2c6dc26e3
commit
2223e6de3e
5 changed files with 89 additions and 73 deletions
|
|
@ -47,7 +47,7 @@ dependencies {
|
|||
|
||||
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
|
||||
implementation 'com.dinuscxj:circleprogressbar:1.1.1'
|
||||
implementation "com.google.android.material:material:1.12.0"
|
||||
implementation 'com.karumi:dexter:5.0.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
|
||||
|
|
|
|||
|
|
@ -306,6 +306,7 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
|
|||
if (uploadCount==0){
|
||||
setZeroAchievements();
|
||||
}else {
|
||||
|
||||
binding.imagesUploadedProgressbar.setVisibility(View.VISIBLE);
|
||||
binding.imagesUploadedProgressbar.setProgress
|
||||
(100*uploadCount/levelInfo.getMaxUploadCount());
|
||||
|
|
@ -342,8 +343,8 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
|
|||
private void setImageRevertPercentage(int notRevertPercentage){
|
||||
binding.imageRevertsProgressbar.setVisibility(View.VISIBLE);
|
||||
binding.imageRevertsProgressbar.setProgress(notRevertPercentage);
|
||||
String revertPercentage = Integer.toString(notRevertPercentage);
|
||||
binding.imageRevertsProgressbar.setProgressTextFormatPattern(revertPercentage + "%%");
|
||||
final String revertPercentage = Integer.toString(notRevertPercentage);
|
||||
binding.tvRevertedImages.setText(revertPercentage + "%");
|
||||
binding.imagesRevertLimitText.setText(getResources().getString(R.string.achievements_revert_limit_message)+ levelInfo.getMinNonRevertPercentage() + "%");
|
||||
}
|
||||
|
||||
|
|
@ -357,10 +358,8 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
|
|||
binding.thanksReceived.setText(String.valueOf(achievements.getThanksReceived()));
|
||||
binding.imagesUsedByWikiProgressBar.setProgress
|
||||
(100 * achievements.getUniqueUsedImages() / levelInfo.getMaxUniqueImages());
|
||||
if(binding.tvWikiPb != null) {
|
||||
binding.tvWikiPb.setText
|
||||
(achievements.getUniqueUsedImages() + "/" + levelInfo.getMaxUniqueImages());
|
||||
}
|
||||
binding.tvWikiPb.setText(achievements.getUniqueUsedImages() + "/"
|
||||
+ levelInfo.getMaxUniqueImages());
|
||||
binding.imageFeatured.setText(String.valueOf(achievements.getFeaturedImages()));
|
||||
binding.qualityImages.setText(String.valueOf(achievements.getQualityImages()));
|
||||
String levelUpInfoString = getString(R.string.level).toUpperCase();
|
||||
|
|
|
|||
|
|
@ -65,10 +65,10 @@ public class QuizResultActivity extends AppCompatActivity {
|
|||
* @param score
|
||||
*/
|
||||
public void setScore(int score) {
|
||||
int per = score * MULTIPLIER_TO_GET_PERCENTAGE;
|
||||
binding.resultProgressBar.setProgress(per);
|
||||
binding.resultProgressBar.setProgressTextFormatPattern(score +" / " + NUMBER_OF_QUESTIONS);
|
||||
String message = getResources().getString(R.string.congratulatory_message_quiz,per + "%");
|
||||
final int scorePercent = score * MULTIPLIER_TO_GET_PERCENTAGE;
|
||||
binding.resultProgressBar.setProgress(scorePercent);
|
||||
binding.tvResultProgress.setText(score +" / " + NUMBER_OF_QUESTIONS);
|
||||
final String message = getResources().getString(R.string.congratulatory_message_quiz,scorePercent + "%");
|
||||
binding.congratulatoryMessage.setText(message);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,20 +41,37 @@
|
|||
android:textSize="32sp"
|
||||
android:layout_marginTop="@dimen/activity_margin_vertical" />
|
||||
|
||||
<com.dinuscxj.progressbar.CircleProgressBar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dimen_250"
|
||||
android:layout_marginRight="@dimen/activity_margin_horizontal"
|
||||
android:layout_marginLeft="@dimen/activity_margin_horizontal"
|
||||
android:layout_marginTop="@dimen/activity_margin_vertical"
|
||||
android:progress="50"
|
||||
app:progress_end_color="#8C8B98"
|
||||
app:progress_start_color="#3A3381"
|
||||
app:progress_stroke_width="@dimen/first_fab"
|
||||
app:progress_text_size="@dimen/large_gap"
|
||||
app:progress_text_format_pattern="4/5"
|
||||
app:style="solid_line"
|
||||
android:id="@+id/result_progress_bar"/>
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dimen_250"
|
||||
android:layout_marginRight="@dimen/activity_margin_horizontal"
|
||||
android:layout_marginLeft="@dimen/activity_margin_horizontal"
|
||||
android:layout_marginTop="@dimen/activity_margin_vertical">
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/result_progress_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dimen_250"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="false"
|
||||
app:showAnimationBehavior="outward"
|
||||
app:indicatorColor="#3A3381"
|
||||
app:indicatorSize="128dp"
|
||||
app:trackThickness="@dimen/first_fab"
|
||||
app:trackColor="#B7B6B6" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_result_progress"
|
||||
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/large_gap"
|
||||
app:autoSizeStepGranularity="1sp"
|
||||
app:autoSizeTextType="uniform" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -133,27 +133,20 @@
|
|||
android:layout_width="@dimen/dimen_40"
|
||||
android:layout_height="@dimen/dimen_40"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginRight="32dp">
|
||||
android:layout_marginEnd="32dp">
|
||||
|
||||
<com.dinuscxj.progressbar.CircleProgressBar
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/images_uploaded_progressbar"
|
||||
android:layout_width="@dimen/dimen_40"
|
||||
android:layout_height="@dimen/dimen_40"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:indeterminate="false"
|
||||
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" />
|
||||
app:showAnimationBehavior="outward"
|
||||
app:indicatorColor="@color/primaryColor"
|
||||
app:indicatorSize="32dp"
|
||||
app:trackThickness="@dimen/progressbar_stroke"
|
||||
app:trackColor="#B7B6B6"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_uploaded_images"
|
||||
|
|
@ -228,24 +221,38 @@
|
|||
android:layout_marginStart="@dimen/activity_margin_horizontal"
|
||||
android:layout_below="@id/images_reverted_info"/>
|
||||
|
||||
<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"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/image_reverts_progressbar"
|
||||
app:progress_end_color="#8C8B98"
|
||||
app:progress_start_color="#3A3381"
|
||||
app:progress_text_size="@dimen/progressbar_text"
|
||||
app:progress_stroke_width="@dimen/progressbar_stroke"
|
||||
app:progress_text_format_pattern="92%%"
|
||||
app:progress_text_color="@color/secondaryColor"
|
||||
app:style="solid_line" />
|
||||
android:layout_marginEnd="32dp">
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/image_reverts_progressbar"
|
||||
android:layout_width="@dimen/dimen_40"
|
||||
android:layout_height="@dimen/dimen_40"
|
||||
android:indeterminate="false"
|
||||
android:layout_marginEnd="@dimen/large_gap"
|
||||
app:showAnimationBehavior="outward"
|
||||
app:indicatorColor="@color/primaryColor"
|
||||
app:indicatorSize="32dp"
|
||||
app:trackThickness="@dimen/progressbar_stroke"
|
||||
app:trackColor="#B7B6B6"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_reverted_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>
|
||||
|
||||
<RelativeLayout
|
||||
|
|
@ -295,27 +302,20 @@
|
|||
android:layout_width="@dimen/dimen_40"
|
||||
android:layout_height="@dimen/dimen_40"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginRight="32dp">
|
||||
android:layout_marginEnd="32dp">
|
||||
|
||||
<com.dinuscxj.progressbar.CircleProgressBar
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/images_used_by_wiki_progress_bar"
|
||||
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:indeterminate="false"
|
||||
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" />
|
||||
app:showAnimationBehavior="outward"
|
||||
app:indicatorColor="@color/primaryColor"
|
||||
app:indicatorSize="32dp"
|
||||
app:trackThickness="@dimen/progressbar_stroke"
|
||||
app:trackColor="#B7B6B6"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_wiki_pb"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue