mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	Modified the code to only function in beta build variant.
This commit is contained in:
		
							parent
							
								
									7c32f57c31
								
							
						
					
					
						commit
						2ae46a4c33
					
				
					 2 changed files with 32 additions and 5 deletions
				
			
		|  | @ -26,6 +26,7 @@ import javax.inject.Inject; | |||
| import javax.inject.Named; | ||||
| 
 | ||||
| import butterknife.ButterKnife; | ||||
| import fr.free.nrw.commons.BuildConfig; | ||||
| import fr.free.nrw.commons.HandlerService; | ||||
| import fr.free.nrw.commons.Media; | ||||
| import fr.free.nrw.commons.R; | ||||
|  | @ -139,6 +140,12 @@ public  class       ContributionsActivity | |||
|         requestAuthToken(); | ||||
|         initDrawer(); | ||||
|         setTitle(getString(R.string.title_activity_contributions)); | ||||
| 
 | ||||
|         if(!BuildConfig.FLAVOR.equalsIgnoreCase("beta")){ | ||||
|             Timber.d("setUploadCount()"); | ||||
|             setUploadCount(); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | @ -265,11 +272,26 @@ public  class       ContributionsActivity | |||
|     } | ||||
| 
 | ||||
|     @SuppressWarnings("ConstantConditions") | ||||
|     public void setUploadCount(int uploadCount) { | ||||
|         getSupportActionBar().setSubtitle(getResources() | ||||
|                 .getQuantityString(R.plurals.contributions_subtitle, uploadCount, uploadCount)); | ||||
|     private void setUploadCount() { | ||||
|         compositeDisposable.add(mediaWikiApi | ||||
|                 .getUploadCount(sessionManager.getCurrentAccount().name) | ||||
|                 .subscribeOn(Schedulers.io()) | ||||
|                 .observeOn(AndroidSchedulers.mainThread()) | ||||
|                 .subscribe( | ||||
|                         uploadCount -> getSupportActionBar().setSubtitle(getResources() | ||||
|                                 .getQuantityString(R.plurals.contributions_subtitle, | ||||
|                                         uploadCount, uploadCount)), | ||||
|                         t -> Timber.e(t, "Fetching upload count failed") | ||||
|                 )); | ||||
|     } | ||||
| 
 | ||||
|     public void betaSetUploadCount(int betaUploadCount){ | ||||
|         Timber.d("" + betaUploadCount); | ||||
|         getSupportActionBar().setSubtitle(getResources() | ||||
|                 .getQuantityString(R.plurals.contributions_subtitle, betaUploadCount, betaUploadCount)); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public void notifyDatasetChanged() { | ||||
|         // Do nothing for now | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ import javax.inject.Named; | |||
| 
 | ||||
| import butterknife.BindView; | ||||
| import butterknife.ButterKnife; | ||||
| import fr.free.nrw.commons.BuildConfig; | ||||
| import fr.free.nrw.commons.R; | ||||
| import fr.free.nrw.commons.di.CommonsDaggerSupportFragment; | ||||
| import fr.free.nrw.commons.nearby.NearbyActivity; | ||||
|  | @ -88,8 +89,12 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment { | |||
| 
 | ||||
|     public void setAdapter(ListAdapter adapter) { | ||||
|         this.contributionsList.setAdapter(adapter); | ||||
|         Timber.d("ContributionsListFragment -> " + adapter.getCount()); | ||||
|         ((ContributionsActivity) getActivity()).setUploadCount(adapter.getCount()); | ||||
|         Timber.d("" + adapter.getCount()); | ||||
| 
 | ||||
|         if(BuildConfig.FLAVOR.equalsIgnoreCase("beta")){ | ||||
|             Timber.d("betaBuild : adapter count -> " + adapter.getCount()); | ||||
|             ((ContributionsActivity) getActivity()).betaSetUploadCount(adapter.getCount()); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public void changeProgressBarVisibility(boolean isVisible) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 knightshade
						knightshade