added JavaDoc comments

This commit is contained in:
prajgov 2017-12-19 19:11:39 +05:30
parent 2a80b7ff36
commit 3d6c6e0301
3 changed files with 48 additions and 14 deletions

View file

@ -8,10 +8,18 @@ import butterknife.ButterKnife;
import fr.free.nrw.commons.theme.NavigationBaseActivity; import fr.free.nrw.commons.theme.NavigationBaseActivity;
import fr.free.nrw.commons.ui.widget.HtmlTextView; import fr.free.nrw.commons.ui.widget.HtmlTextView;
/**
* Represents about screen of this app
*/
public class AboutActivity extends NavigationBaseActivity { public class AboutActivity extends NavigationBaseActivity {
@BindView(R.id.about_version) TextView versionText; @BindView(R.id.about_version) TextView versionText;
@BindView(R.id.about_license) HtmlTextView aboutLicenseText; @BindView(R.id.about_license) HtmlTextView aboutLicenseText;
/**
* This method helps in the creation About screen
*
* @param savedInstanceState Data bundle
*/
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View file

@ -44,21 +44,32 @@ import timber.log.Timber;
) )
public class CommonsApplication extends DaggerApplication { public class CommonsApplication extends DaggerApplication {
public static final String DEFAULT_EDIT_SUMMARY = "Uploaded using Android Commons app";
public static final String FEEDBACK_EMAIL = "commons-app-android@googlegroups.com";
public static final String LOGS_PRIVATE_EMAIL = "commons-app-android-private@googlegroups.com";
public static final String FEEDBACK_EMAIL_SUBJECT = "Commons Android App (%s) Feedback";
@Inject SessionManager sessionManager; @Inject SessionManager sessionManager;
@Inject DBOpenHelper dbOpenHelper; @Inject DBOpenHelper dbOpenHelper;
@Inject @Named("default_preferences") SharedPreferences defaultPrefs; @Inject @Named("default_preferences") SharedPreferences defaultPrefs;
@Inject @Named("application_preferences") SharedPreferences applicationPrefs; @Inject @Named("application_preferences") SharedPreferences applicationPrefs;
@Inject @Named("prefs") SharedPreferences otherPrefs; @Inject @Named("prefs") SharedPreferences otherPrefs;
public static final String DEFAULT_EDIT_SUMMARY = "Uploaded using Android Commons app";
public static final String FEEDBACK_EMAIL = "commons-app-android@googlegroups.com";
public static final String LOGS_PRIVATE_EMAIL = "commons-app-android-private@googlegroups.com";
public static final String FEEDBACK_EMAIL_SUBJECT = "Commons Android App (%s) Feedback";
private CommonsApplicationComponent component; private CommonsApplicationComponent component;
private RefWatcher refWatcher; private RefWatcher refWatcher;
/**
* Provides a way to get member refWatcher
*
* @param context Application context
* @return application member refWatcher
*/
public static RefWatcher getRefWatcher(Context context) {
CommonsApplication application = (CommonsApplication) context.getApplicationContext();
return application.refWatcher;
}
/**
* Used to declare and initialize various components and dependencies
*/
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
@ -80,6 +91,10 @@ public class CommonsApplication extends DaggerApplication {
System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0"); System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0");
} }
/**
* Helps in setting up LeakCanary library
* @return instance of LeakCanary
*/
protected RefWatcher setupLeakCanary() { protected RefWatcher setupLeakCanary() {
if (LeakCanary.isInAnalyzerProcess(this)) { if (LeakCanary.isInAnalyzerProcess(this)) {
return RefWatcher.DISABLED; return RefWatcher.DISABLED;
@ -87,16 +102,19 @@ public class CommonsApplication extends DaggerApplication {
return LeakCanary.install(this); return LeakCanary.install(this);
} }
public static RefWatcher getRefWatcher(Context context) { /**
CommonsApplication application = (CommonsApplication) context.getApplicationContext(); * Helps in injecting dependency library Dagger
return application.refWatcher; * @return Dagger injector
} */
@Override @Override
protected AndroidInjector<? extends DaggerApplication> applicationInjector() { protected AndroidInjector<? extends DaggerApplication> applicationInjector() {
return injector(); return injector();
} }
/**
* used to create injector of application component
* @return Application component of Dagger
*/
public CommonsApplicationComponent injector() { public CommonsApplicationComponent injector() {
if (component == null) { if (component == null) {
component = DaggerCommonsApplicationComponent.builder() component = DaggerCommonsApplicationComponent.builder()
@ -106,6 +124,11 @@ public class CommonsApplication extends DaggerApplication {
return component; return component;
} }
/**
* clears data of current application
* @param context Application context
* @param logoutListener Implementation of interface LogoutListener
*/
public void clearApplicationData(Context context, LogoutListener logoutListener) { public void clearApplicationData(Context context, LogoutListener logoutListener) {
File cacheDirectory = context.getCacheDir(); File cacheDirectory = context.getCacheDir();
File applicationDirectory = new File(cacheDirectory.getParent()); File applicationDirectory = new File(cacheDirectory.getParent());
@ -145,6 +168,9 @@ public class CommonsApplication extends DaggerApplication {
Contribution.Table.onDelete(db); Contribution.Table.onDelete(db);
} }
/**
* Interface used to get log-out events
*/
public interface LogoutListener { public interface LogoutListener {
void onLogoutComplete(); void onLogoutComplete();
} }

View file

@ -7,7 +7,7 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath "com.android.tools.build:gradle:${project.gradleVersion}" classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1' classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.1' classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"