mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 05:13:53 +01:00
* achievements/: add Javadocs * actions/: add Javadocs * WikiAccountAuthenticator: add Javadocs * ReasonBuilder: add Javadocs * di: Add javadocs to DI files * bookmarks: add Javadocs to bookmarks files * di: Added more Javadocs * file: add Javadocs for file picker * actions: add proper decription to the classes
This commit is contained in:
parent
803bed43d7
commit
0affe71745
25 changed files with 269 additions and 5 deletions
|
|
@ -18,6 +18,11 @@ import fr.free.nrw.commons.review.ReviewActivity;
|
|||
import fr.free.nrw.commons.settings.SettingsActivity;
|
||||
import fr.free.nrw.commons.upload.UploadActivity;
|
||||
|
||||
/**
|
||||
* This Class handles the dependency injection (using dagger)
|
||||
* so, if a developer needs to add a new activity to the commons app
|
||||
* then that must be mentioned here to inject the dependencies
|
||||
*/
|
||||
@Module
|
||||
@SuppressWarnings({"WeakerAccess", "unused"})
|
||||
public abstract class ActivityBuilderModule {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ import dagger.android.HasFragmentInjector;
|
|||
import dagger.android.HasServiceInjector;
|
||||
import dagger.android.support.HasSupportFragmentInjector;
|
||||
|
||||
/**
|
||||
* Provides injectors for all sorts of components
|
||||
* Ex: Activities, Fragments, Services, ContentProviders
|
||||
*/
|
||||
public class ApplicationlessInjection
|
||||
implements
|
||||
HasActivityInjector,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ import fr.free.nrw.commons.upload.UploadModule;
|
|||
import fr.free.nrw.commons.widget.PicOfDayAppWidget;
|
||||
|
||||
|
||||
/**
|
||||
* Facilitates Injection from CommonsApplicationModule to all the
|
||||
* classes seeking a dependency to be injected
|
||||
*/
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
CommonsApplicationModule.class,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,13 @@ import io.reactivex.Scheduler;
|
|||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* The Dependency Provider class for Commons Android.
|
||||
*
|
||||
* Provides all sorts of ContentProviderClients used by the app
|
||||
* along with the Liscences, AccountUtility, UploadController, Logged User,
|
||||
* Location manager etc
|
||||
*/
|
||||
@Module
|
||||
@SuppressWarnings({"WeakerAccess", "unused"})
|
||||
public class CommonsApplicationModule {
|
||||
|
|
@ -90,6 +97,10 @@ public class CommonsApplicationModule {
|
|||
return new AccountUtil();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides an instance of CategoryContentProviderClient i.e. the categories
|
||||
* that are there in local storage
|
||||
*/
|
||||
@Provides
|
||||
@Named("category")
|
||||
public ContentProviderClient provideCategoryContentProviderClient(Context context) {
|
||||
|
|
@ -132,6 +143,11 @@ public class CommonsApplicationModule {
|
|||
return context.getContentResolver().acquireContentProviderClient(BuildConfig.BOOKMARK_LOCATIONS_AUTHORITY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a Json store instance(JsonKvStore) which keeps
|
||||
* the provided Gson in it's instance
|
||||
* @param gson stored inside the store instance
|
||||
*/
|
||||
@Provides
|
||||
@Named("default_preferences")
|
||||
public JsonKvStore providesDefaultKvStore(Context context, Gson gson) {
|
||||
|
|
@ -182,6 +198,10 @@ public class CommonsApplicationModule {
|
|||
return ConfigUtils.isBetaFlavour();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide JavaRx IO scheduler which manages IO operations
|
||||
* across various Threads
|
||||
*/
|
||||
@Named(IO_THREAD)
|
||||
@Provides
|
||||
public Scheduler providesIoThread(){
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ public abstract class CommonsDaggerAppCompatActivity extends AppCompatActivity i
|
|||
return supportFragmentInjector;
|
||||
}
|
||||
|
||||
/**
|
||||
* when this Activity is created it injects an instance of this class inside
|
||||
* activityInjector method of ApplicationlessInjection
|
||||
*/
|
||||
private void inject() {
|
||||
ApplicationlessInjection injection = ApplicationlessInjection.getInstance(getApplicationContext());
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ import android.content.Intent;
|
|||
|
||||
import dagger.android.AndroidInjector;
|
||||
|
||||
/**
|
||||
* Receives broadcast then injects it's instance to the broadcastReceiverInjector method of
|
||||
* ApplicationlessInjection class
|
||||
*/
|
||||
public abstract class CommonsDaggerBroadcastReceiver extends BroadcastReceiver {
|
||||
|
||||
public CommonsDaggerBroadcastReceiver() {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@ import fr.free.nrw.commons.category.CategoryContentProvider;
|
|||
import fr.free.nrw.commons.contributions.ContributionsContentProvider;
|
||||
import fr.free.nrw.commons.explore.recentsearches.RecentSearchesContentProvider;
|
||||
|
||||
/**
|
||||
* This Class Represents the Module for dependency injection (using dagger)
|
||||
* so, if a developer needs to add a new ContentProvider to the commons app
|
||||
* then that must be mentioned here to inject the dependencies
|
||||
*/
|
||||
@Module
|
||||
@SuppressWarnings({"WeakerAccess", "unused"})
|
||||
public abstract class ContentProviderBuilderModule {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ import fr.free.nrw.commons.upload.categories.UploadCategoriesFragment;
|
|||
import fr.free.nrw.commons.upload.license.MediaLicenseFragment;
|
||||
import fr.free.nrw.commons.upload.mediaDetails.UploadMediaDetailFragment;
|
||||
|
||||
/**
|
||||
* This Class Represents the Module for dependency injection (using dagger)
|
||||
* so, if a developer needs to add a new Fragment to the commons app
|
||||
* then that must be mentioned here to inject the dependencies
|
||||
*/
|
||||
@Module
|
||||
@SuppressWarnings({"WeakerAccess", "unused"})
|
||||
public abstract class FragmentBuilderModule {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@ import dagger.android.ContributesAndroidInjector;
|
|||
import fr.free.nrw.commons.auth.WikiAccountAuthenticatorService;
|
||||
import fr.free.nrw.commons.upload.UploadService;
|
||||
|
||||
/**
|
||||
* This Class Represents the Module for dependency injection (using dagger)
|
||||
* so, if a developer needs to add a new Service to the commons app
|
||||
* then that must be mentioned here to inject the dependencies
|
||||
*/
|
||||
@Module
|
||||
@SuppressWarnings({"WeakerAccess", "unused"})
|
||||
public abstract class ServiceBuilderModule {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue