mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	Merge gamification branch with master (#1752)
* Quiz (#1629) * Layout inflated * Layout for mcq added * Inflated Basic Layout * Implemented basic flow * Added the basic implementation pf score * Added the result layout * Added the result layout * Added functionality to set result * Changed the launcher intent to Quiz Activity for testing purpose * Explanations of answers added * Improved the layout of quiz result a bit * Fixed some minor issues * Fixed build issues * Api Added and basic structure for calling implemented * Added intents * Added the title * Fixed image error and improved quality of pr * Made separate class for checking quiz * Added counter * Implemented back and next for quiz result * Added back functionality to quiz * Added progressBar * Fixed bugs * Improved code quality * Imporved code Quality * Updated strings * Added share screenshot function * Added checks and improved UI * Removed unused string * Removed unused string * Adding checks and improving code quality * Changed string * Improved code quality * Update strings.xml * Update MediaWikiApi.java * Fix build
This commit is contained in:
		
							parent
							
								
									80068f7e9f
								
							
						
					
					
						commit
						386bd0a106
					
				
					 21 changed files with 1067 additions and 8 deletions
				
			
		|  | @ -1,5 +1,6 @@ | |||
| package fr.free.nrw.commons.contributions; | ||||
| 
 | ||||
| import android.accounts.Account; | ||||
| import android.content.ComponentName; | ||||
| import android.content.Context; | ||||
| import android.content.Intent; | ||||
|  | @ -34,8 +35,10 @@ import fr.free.nrw.commons.auth.AuthenticatedActivity; | |||
| import fr.free.nrw.commons.auth.SessionManager; | ||||
| import fr.free.nrw.commons.media.MediaDetailPagerFragment; | ||||
| import fr.free.nrw.commons.mwapi.MediaWikiApi; | ||||
| import fr.free.nrw.commons.quiz.QuizChecker; | ||||
| import fr.free.nrw.commons.settings.Prefs; | ||||
| import fr.free.nrw.commons.upload.UploadService; | ||||
| import fr.free.nrw.commons.utils.ViewUtil; | ||||
| import io.reactivex.android.schedulers.AndroidSchedulers; | ||||
| import io.reactivex.disposables.CompositeDisposable; | ||||
| import io.reactivex.schedulers.Schedulers; | ||||
|  | @ -137,10 +140,17 @@ public  class       ContributionsActivity | |||
| 
 | ||||
|             getSupportLoaderManager().initLoader(0, null, this); | ||||
|         } | ||||
| 
 | ||||
|         requestAuthToken(); | ||||
|         initDrawer(); | ||||
|         setTitle(getString(R.string.title_activity_contributions)); | ||||
| 
 | ||||
| 
 | ||||
|         if(checkAccount()) { | ||||
|             new QuizChecker(this, | ||||
|                     sessionManager.getCurrentAccount().name, | ||||
|                     mediaWikiApi); | ||||
|         } | ||||
|         if(!BuildConfig.FLAVOR.equalsIgnoreCase("beta")){ | ||||
|             setUploadCount(); | ||||
|         } | ||||
|  | @ -338,6 +348,21 @@ public  class       ContributionsActivity | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * to ensure user is logged in | ||||
|      * @return | ||||
|      */ | ||||
|     private boolean checkAccount() { | ||||
|         Account currentAccount = sessionManager.getCurrentAccount(); | ||||
|         if (currentAccount == null) { | ||||
|             Timber.d("Current account is null"); | ||||
|             ViewUtil.showLongToast(this, getResources().getString(R.string.user_not_logged_in)); | ||||
|             sessionManager.forceLogin(this); | ||||
|             return false; | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onBackStackChanged() { | ||||
|         initBackButton(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vivek Maskara
						Vivek Maskara