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