Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f43bb92
Converted all the PNG to WebPs to save space.
Oct 11, 2017
d98a026
Added progressbar in ContributionsListFragment to be shown while its …
Bluesir9 Oct 11, 2017
b07064d
Correcting some easy Codacy issues
joeratt Oct 14, 2017
43af519
Fix Codacy issues
tabasavr Oct 18, 2017
836a1e3
Added option in SettingsFragment to allow users to send the logs as a…
Bluesir9 Oct 21, 2017
fe57db5
Synced branch with master and fixed bugs specific to accessing of fil…
Bluesir9 Oct 21, 2017
1d0a701
Changed usage of 'logs' to 'log file' to better fit the grammar
Bluesir9 Oct 21, 2017
0cc096c
Changed capital 'L' to small 'l' in the 'Send log file' string
Bluesir9 Oct 21, 2017
959c581
Refresh current location on refreshView()
neslihanturan Oct 23, 2017
9d6d773
Set progress bar visible on refresh
neslihanturan Oct 23, 2017
3c5eeea
Updated travis.yml
psh Oct 25, 2017
09fa465
Merge pull request #913 from Bluesir9/fix_374_download_my_uploads_loader
neslihanturan Oct 25, 2017
d6e7431
Merge pull request #914 from joeratt/master
neslihanturan Oct 25, 2017
c11db21
travis-ci: explicit license acceptance; android-26
whym Oct 26, 2017
069f711
Merge pull request #925 from whym/travis
neslihanturan Oct 26, 2017
3434c46
Merge pull request #921 from neslihanturan/fix#674
misaochan Oct 26, 2017
5447ae0
Localisation updates from https://translatewiki.net.
translatewiki Oct 27, 2017
dd4e7c3
Fixed bug when there are places nearby but none are loaded
tabasavr Oct 27, 2017
b0e8175
Merge pull request #917 from RSBat/master
whym Oct 27, 2017
bd5b950
Force request radius to be no larger than MAX_RADIUS, thus always mak…
tabasavr Oct 27, 2017
99f4f37
fix for issue #719
JohnKal Oct 27, 2017
dd8f9a4
fixed issues with code quality.
JohnKal Oct 28, 2017
aab792f
Add period to Javadoc comment.
JohnKal Oct 28, 2017
647d7bc
Localisation updates from https://translatewiki.net.
translatewiki Oct 30, 2017
7549638
Merge pull request #929 from JohnKal/master
neslihanturan Oct 30, 2017
1f88b6d
Merge pull request #928 from RSBat/no-data-fix
neslihanturan Oct 30, 2017
d091090
Merge pull request #920 from Bluesir9/fix_736_send_app_logs
neslihanturan Oct 31, 2017
ef90d2d
adding a privacy policy statement to the login page
aumassart Nov 1, 2017
6909ccf
Merge pull request #910 from akm0012/ConvertToWebP
misaochan Nov 1, 2017
10ac64d
Localisation updates from https://translatewiki.net.
translatewiki Nov 2, 2017
6ef5c35
Merge remote-tracking branch 'projet_original_master/master'
aumassart Nov 2, 2017
91ddcc7
adding privacy policy button for landscape and large modes too
aumassart Nov 2, 2017
3adb5d8
Update Gradle plugin to 3.0
Nov 1, 2017
e317c36
Disable LeakCanary for Robolectric tests
whym Nov 3, 2017
0964b05
Disable LeakCanary for Robolectric tests
whym Nov 3, 2017
3bc21ee
Disable AAPT 2
Nov 4, 2017
6e52df9
Merge pull request #934 from whym/leakcanary
misaochan Nov 4, 2017
ef56b69
Replay deprecated symbol usage and mark AAPT todo
Nov 4, 2017
5559e1b
Put PR link
Nov 4, 2017
39dfe88
Merge pull request #932 from maskaravivek/gradle
misaochan Nov 4, 2017
94f8a7f
Add unit test reports to Travis settings
whym Nov 4, 2017
061bb75
Merge pull request #936 from whym/travis
misaochan Nov 4, 2017
c926437
Localisation updates from https://translatewiki.net.
translatewiki Nov 6, 2017
c568f81
Localisation updates from https://translatewiki.net.
translatewiki Nov 9, 2017
6a7b7cb
Introduce dagger
Nov 11, 2017
c5f80d8
Merge pull request #951 from maskaravivek/dagger
neslihanturan Nov 13, 2017
e429667
Localisation updates from https://translatewiki.net.
translatewiki Nov 13, 2017
fb38c90
Merge pull request #933 from aumassart/master
misaochan Nov 14, 2017
e9b4ec6
Convert tests into Kotlin
whym Nov 14, 2017
b419140
Merge pull request #958 from whym/kotlin
misaochan Nov 15, 2017
9b5f69f
Updated screenshots
nicolas-raoul Nov 15, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ jdk:

android:
components:
- platform-tools
- tools
- build-tools-26.0.1
- platform-tools
- build-tools-26.0.2
- extra-google-m2repository
- extra-android-m2repository
- ${ANDROID_TARGET}
- android-25
- android-26
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
licenses:
- 'android-sdk-license-.+'

before_script:
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
Expand All @@ -38,8 +41,10 @@ after_success:
- bash <(curl -s https://codecov.io/bash)

after_failure:
- echo '*** Connected Test Rsults ***'
- w3m -dump ${TRAVIS_BUILD_DIR}/app/build/reports/androidTests/connected/*Test.html
- echo '*** Debug Unit Test Results ***'
- w3m -dump ${TRAVIS_BUILD_DIR}/app/build/reports/tests/*/classes/*Test.html
- echo '*** Connected Test Results ***'
- w3m -dump ${TRAVIS_BUILD_DIR}/app/build/reports/androidTests/connected/flavors/*/*Test.html

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
Expand Down
103 changes: 61 additions & 42 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,60 +1,71 @@
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco-android'
apply from: 'quality.gradle'
apply plugin: 'com.getkeepsafe.dexcount'

dependencies {
compile 'com.github.nicolas-raoul:Quadtree:ac16ea8035bf07'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
compile 'in.yuvi:http.fluent:1.3'
compile 'com.android.volley:volley:1.0.0'
compile 'ch.acra:acra:4.7.0'
compile 'org.mediawiki:api:1.3'
compile 'commons-codec:commons-codec:1.10'
compile 'com.github.pedrovgs:renderers:3.3.3'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.jakewharton.timber:timber:4.5.1'
compile 'info.debatty:java-string-similarity:0.24'
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.0@aar'){
implementation 'com.github.nicolas-raoul:Quadtree:ac16ea8035bf07'
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
implementation 'in.yuvi:http.fluent:1.3'
implementation 'com.android.volley:volley:1.0.0'
implementation 'ch.acra:acra:4.7.0'
implementation 'org.mediawiki:api:1.3'
implementation 'commons-codec:commons-codec:1.10'
implementation 'com.github.pedrovgs:renderers:3.3.3'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.jakewharton.timber:timber:4.5.1'
implementation 'info.debatty:java-string-similarity:0.24'
implementation ('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.0@aar'){
transitive=true
}

compile "com.android.support:support-v4:${project.supportLibVersion}"
compile "com.android.support:appcompat-v7:${project.supportLibVersion}"
compile "com.android.support:design:${project.supportLibVersion}"

compile "com.android.support:cardview-v7:${project.supportLibVersion}"
implementation "com.android.support:support-v4:${project.supportLibVersion}"
implementation "com.android.support:appcompat-v7:${project.supportLibVersion}"
implementation "com.android.support:design:${project.supportLibVersion}"

compile "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
annotationProcessor "com.jakewharton:butterknife-compiler:$BUTTERKNIFE_VERSION"
implementation "com.android.support:cardview-v7:${project.supportLibVersion}"

compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.squareup.okio:okio:1.13.0'
implementation "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
kapt "com.jakewharton:butterknife-compiler:$BUTTERKNIFE_VERSION"

compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.squareup.okio:okio:1.13.0'

implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
compile 'io.reactivex.rxjava2:rxjava:2.1.2'
compile 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
compile 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.0.0'
compile 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0'
compile 'com.jakewharton.rxbinding2:rxbinding-design:2.0.0'

compile 'com.facebook.fresco:fresco:1.3.0'
compile 'com.facebook.stetho:stetho:1.5.0'

testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.4'

testCompile 'com.squareup.okhttp3:mockwebserver:3.8.1'
androidTestCompile 'com.squareup.okhttp3:mockwebserver:3.8.1'
androidTestCompile "com.android.support:support-annotations:${project.supportLibVersion}"
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.2'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.0.0'

implementation 'com.facebook.fresco:fresco:1.3.0'
implementation 'com.facebook.stetho:stetho:1.5.0'

implementation "com.google.dagger:dagger:$DAGGER_VERSION"
implementation "com.google.dagger:dagger-android-support:$DAGGER_VERSION"

kapt "com.google.dagger:dagger-android-processor:$DAGGER_VERSION"
kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"

testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:3.4'

testImplementation 'com.squareup.okhttp3:mockwebserver:3.8.1'
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:3.8.1'
androidTestImplementation "com.android.support:support-annotations:${project.supportLibVersion}"
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
}

android {
Expand All @@ -73,6 +84,10 @@ android {
vectorDrawables.useSupportLibrary = true
}

sourceSets {
test.java.srcDirs += 'src/test/kotlin'
}

buildTypes {
release {
minifyEnabled false // See https://stackoverflow.com/questions/40232404/google-play-apk-and-android-studio-apk-usb-debug-behaving-differently - proguard.cfg modification alone insufficient.
Expand All @@ -83,6 +98,7 @@ android {
}
}

flavorDimensions 'tier'
productFlavors {
prod {
buildConfigField "String", "WIKIMEDIA_API_HOST", "\"https://commons.wikimedia.org/w/api.php\""
Expand All @@ -94,6 +110,7 @@ android {
buildConfigField "String", "EVENTLOG_WIKI", "\"commonswiki\""
buildConfigField "String", "SIGNUP_LANDING_URL", "\"https://commons.m.wikimedia.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page&returntoquery=welcome%3Dyes\""
buildConfigField "String", "SIGNUP_SUCCESS_REDIRECTION_URL", "\"https://commons.m.wikimedia.org/w/index.php?title=Main_Page&welcome=yes\""
dimension 'tier'
}

beta {
Expand All @@ -107,6 +124,7 @@ android {
buildConfigField "String", "EVENTLOG_WIKI", "\"commonswiki\""
buildConfigField "String", "SIGNUP_LANDING_URL", "\"https://commons.m.wikimedia.beta.wmflabs.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page&returntoquery=welcome%3Dyes\""
buildConfigField "String", "SIGNUP_SUCCESS_REDIRECTION_URL", "\"https://commons.m.wikimedia.beta.wmflabs.org/w/index.php?title=Main_Page&welcome=yes\""
dimension 'tier'
}
}

Expand All @@ -125,4 +143,5 @@ android {
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:25.2.0'
}
buildToolsVersion buildToolsVersion
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS"/>
<uses-permission android:name="com.google.android.apps.photos.permission.GOOGLE_PHOTOS"/>
<uses-permission android:name="android.permission.READ_LOGS"/>

<application
android:name=".CommonsApplication"
Expand Down
48 changes: 35 additions & 13 deletions app/src/main/java/fr/free/nrw/commons/CommonsApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.accounts.AccountManagerFuture;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
Expand All @@ -17,6 +18,7 @@
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.stetho.Stetho;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;

import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
Expand All @@ -25,11 +27,16 @@
import java.io.File;
import java.io.IOException;

import javax.inject.Inject;

import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasActivityInjector;
import fr.free.nrw.commons.auth.AccountUtil;
import fr.free.nrw.commons.caching.CacheController;
import fr.free.nrw.commons.contributions.Contribution;
import fr.free.nrw.commons.data.Category;
import fr.free.nrw.commons.data.DBOpenHelper;
import fr.free.nrw.commons.di.DaggerAppComponent;
import fr.free.nrw.commons.modifications.ModifierSequence;
import fr.free.nrw.commons.mwapi.ApacheHttpClientMediaWikiApi;
import fr.free.nrw.commons.mwapi.MediaWikiApi;
Expand All @@ -46,7 +53,7 @@
resDialogCommentPrompt = R.string.crash_dialog_comment_prompt,
resDialogOkToast = R.string.crash_dialog_ok_toast
)
public class CommonsApplication extends Application {
public class CommonsApplication extends Application implements HasActivityInjector {

private Account currentAccount = null; // Unlike a savings account...

Expand All @@ -60,6 +67,9 @@ public class CommonsApplication extends Application {
public static final String FEEDBACK_EMAIL = "commons-app-android@googlegroups.com";
public static final String FEEDBACK_EMAIL_SUBJECT = "Commons Android App (%s) Feedback";

@Inject DispatchingAndroidInjector<Activity> dispatchingActivityInjector;
@Inject MediaWikiApi mediaWikiApi;

private static CommonsApplication instance = null;
private MediaWikiApi api = null;
private LruCache<String, String> thumbnailUrlCache = new LruCache<>(1024);
Expand Down Expand Up @@ -117,16 +127,16 @@ public synchronized NearbyPlaces getNearbyPlaces() {
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
LeakCanary.install(this);

Timber.plant(new Timber.DebugTree());
setupLeakCanary();

Timber.plant(new Timber.DebugTree());

DaggerAppComponent
.builder()
.application(this)
.build()
.inject(this);

if (!BuildConfig.DEBUG) {
ACRA.init(this);
Expand All @@ -143,6 +153,13 @@ public void onCreate() {
cacheData = new CacheController();
}

protected RefWatcher setupLeakCanary() {
if (LeakCanary.isInAnalyzerProcess(this)) {
return RefWatcher.DISABLED;
}
return LeakCanary.install(this);
}

/**
* @return Account|null
*/
Expand All @@ -164,11 +181,11 @@ public Boolean revalidateAuthToken() {
if (curAccount == null) {
return false; // This should never happen
}
accountManager.invalidateAuthToken(AccountUtil.accountType(), getMWApi().getAuthCookie());

accountManager.invalidateAuthToken(AccountUtil.accountType(), mediaWikiApi.getAuthCookie());
try {
String authCookie = accountManager.blockingGetAuthToken(curAccount, "", false);
getMWApi().setAuthCookie(authCookie);
mediaWikiApi.setAuthCookie(authCookie);
return true;
} catch (OperationCanceledException | NullPointerException | IOException | AuthenticatorException e) {
e.printStackTrace();
Expand All @@ -178,8 +195,8 @@ public Boolean revalidateAuthToken() {

public boolean deviceHasCamera() {
PackageManager pm = getPackageManager();
return pm.hasSystemFeature(PackageManager.FEATURE_CAMERA) ||
pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
return pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)
|| pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
}

public void clearApplicationData(Context context, LogoutListener logoutListener) {
Expand Down Expand Up @@ -245,6 +262,11 @@ public void run(AccountManagerFuture<Boolean> accountManagerFuture) {
}
}

@Override
public DispatchingAndroidInjector<Activity> activityInjector() {
return dispatchingActivityInjector;
}

/**
* Deletes all tables and re-creates them.
*/
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/fr/free/nrw/commons/MediaDataExtractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class MediaDataExtractor {
private String filename;
private ArrayList<String> categories;
private Map<String, String> descriptions;
private Date date;
private String license;
private @Nullable LatLng coordinates;
private LicenseList licenseList;
Expand Down Expand Up @@ -153,7 +152,7 @@ private void processWikiParseTree(String source) throws IOException {
}

private Node findTemplate(Element parentNode, String title_) throws IOException {
String title= new PageTitle(title_).getDisplayText();
String title = new PageTitle(title_).getDisplayText();
NodeList nodes = parentNode.getChildNodes();
for (int i = 0, length = nodes.getLength(); i < length; i++) {
Node node = nodes.item(i);
Expand All @@ -179,7 +178,7 @@ private String getTemplateTitle(Node templateNode) throws IOException {
}

private static abstract class TemplateChildNodeComparator {
abstract public boolean match(Node node);
public abstract boolean match(Node node);
}

private Node findTemplateParameter(Node templateNode, String name) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void setMedia(Media media) {
if (currentThumbnailTask != null) {
currentThumbnailTask.cancel(true);
}
if(media == null) {
if (media == null) {
return;
}

Expand Down
Loading