Skip to content

Commit 87f0f33

Browse files
authored
Merge pull request #197 from odk-x/demo
2.1.9 release
2 parents 67d4ac0 + 81ec22c commit 87f0f33

File tree

13 files changed

+162
-246
lines changed

13 files changed

+162
-246
lines changed

build.gradle

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22
buildscript {
33
repositories {
44
google()
5-
jcenter()
65
mavenCentral()
76
}
87
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.1.3'
10-
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.9.8'
11-
classpath 'com.google.gms:google-services:4.3.5'
12-
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.2'
8+
classpath 'com.android.tools.build:gradle:4.2.2'
9+
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.23.4'
10+
classpath 'com.google.gms:google-services:4.3.10'
11+
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
1312
}
1413
}
1514

1615
allprojects {
1716
repositories {
1817
google()
19-
jcenter()
18+
mavenCentral()
2019
maven {
2120
url "https://jitpack.io"
2221
}

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

settings.gradle

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
gradle.ext.gradleConfigVersion = 150
2-
3-
if ( !gradle.ext.has('workspacePath') ) {
4-
def env = System.getProperties();
5-
logger.warn("tables/settings.gradle System.getProperties().stringPropertyNames(): " + env.stringPropertyNames());
6-
def path = System.getProperty('com.android.studio.gradle.project.path');
7-
if ( path != null ) {
8-
logger.warn("tables/settings.gradle Found value for System.getProperty('com.android.studio.gradle.project.path')");
9-
gradle.ext.workspacePath = (new File(path)).getParentFile().getAbsolutePath();
10-
} else {
11-
logger.warn("tables/settings.gradle No value found for System.getProperty('com.android.studio.gradle.project.path')");
12-
gradle.ext.workspacePath = new File("..").getAbsolutePath();
13-
}
1+
gradle.ext.gradleConfigVersion = 155
2+
3+
if (!gradle.ext.has('workspacePath')) {
4+
logger.warn("rootDir: " + rootDir.getAbsolutePath());
5+
gradle.ext.workspacePath = rootDir.getParentFile().getAbsolutePath();
146
}
157

168
logger.warn('tables/settings.gradle -- gradle.ext.workspacePath: ' + gradle.ext.workspacePath)

tables_app/build.gradle

+13-16
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ android {
3030

3131
testApplicationId(groupId + tablesName + testNameSuffix)
3232
testInstrumentationRunner(instrumentationRunner)
33-
34-
multiDexEnabled true
3533
}
3634

3735
flavorDimensions "stage", "testing"
@@ -126,17 +124,16 @@ allprojects {
126124
dependencies {
127125
implementation 'androidx.annotation:annotation:1.2.0'
128126
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
129-
implementation 'androidx.fragment:fragment:1.3.2'
127+
implementation 'androidx.fragment:fragment:1.3.6'
130128
implementation 'androidx.preference:preference:1.1.1'
131-
implementation 'androidx.appcompat:appcompat:1.2.0'
132-
implementation 'androidx.recyclerview:recyclerview:1.1.0'
133-
implementation 'com.google.android.material:material:1.3.0'
129+
implementation 'androidx.appcompat:appcompat:1.3.1'
130+
implementation 'androidx.recyclerview:recyclerview:1.2.1'
131+
implementation 'com.google.android.material:material:1.4.0'
134132
implementation 'com.github.wbrunette:ProgressWheel:3.4'
135133

136-
implementation 'com.google.firebase:firebase-analytics:18.0.2'
137-
implementation 'com.google.firebase:firebase-crashlytics:17.4.1'
134+
implementation 'com.google.firebase:firebase-analytics:19.0.2'
135+
implementation 'com.google.firebase:firebase-crashlytics:18.2.3'
138136

139-
implementation 'androidx.multidex:multidex:2.0.1'
140137

141138
if (libraryProjectPath.exists() && gradle.useLocal) { // Local project is favoured
142139
implementation project(libraryProjectName)
@@ -160,15 +157,15 @@ dependencies {
160157
classifier: snapshotRelease, version: latestVersion, ext: 'aar')
161158
}
162159

163-
implementation 'com.google.android.gms:play-services-maps:17.0.0'
160+
implementation 'com.google.android.gms:play-services-maps:17.0.1'
164161

165162
//for Espresso
166-
androidTestUitestImplementation 'androidx.test:runner:1.3.0'
167-
androidTestUitestImplementation 'androidx.test:rules:1.3.0'
168-
androidTestUitestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
169-
androidTestUitestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
170-
androidTestUitestImplementation 'androidx.test.espresso:espresso-web:3.3.0'
171-
androidTestUitestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
163+
androidTestUitestImplementation 'androidx.test:runner:1.4.0'
164+
androidTestUitestImplementation 'androidx.test:rules:1.4.0'
165+
androidTestUitestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
166+
androidTestUitestImplementation 'androidx.test.espresso:espresso-intents:3.4.0'
167+
androidTestUitestImplementation 'androidx.test.espresso:espresso-web:3.4.0'
168+
androidTestUitestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
172169
androidTestUitestImplementation 'androidx.annotation:annotation:1.2.0'
173170

174171
//for UI Automator

tables_app/src/androidTestUitest/java/org/opendatakit/espresso/CsvTest.java

+23-26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
package org.opendatakit.espresso;
22

3+
import static androidx.test.espresso.Espresso.onData;
4+
import static androidx.test.espresso.Espresso.onView;
5+
import static androidx.test.espresso.action.ViewActions.click;
6+
import static androidx.test.espresso.action.ViewActions.typeText;
7+
import static androidx.test.espresso.assertion.ViewAssertions.matches;
8+
import static androidx.test.espresso.intent.Intents.intending;
9+
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction;
10+
import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup;
11+
import static androidx.test.espresso.matcher.ViewMatchers.assertThat;
12+
import static androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed;
13+
import static androidx.test.espresso.matcher.ViewMatchers.withClassName;
14+
import static androidx.test.espresso.matcher.ViewMatchers.withId;
15+
import static androidx.test.espresso.matcher.ViewMatchers.withText;
16+
import static org.hamcrest.Matchers.endsWith;
17+
import static org.hamcrest.Matchers.equalTo;
18+
import static org.hamcrest.Matchers.is;
19+
import static org.opendatakit.util.TestConstants.APP_NAME;
20+
import static org.opendatakit.util.TestConstants.T_HOUSE_DISPLAY_NAME;
21+
import static org.opendatakit.util.TestConstants.T_HOUSE_TABLE_ID;
22+
323
import android.Manifest;
424
import android.app.Activity;
525
import android.app.Instrumentation;
@@ -9,7 +29,6 @@
929
import android.widget.EditText;
1030
import android.widget.Spinner;
1131

12-
import androidx.test.espresso.Espresso;
1332
import androidx.test.espresso.intent.rule.IntentsTestRule;
1433
import androidx.test.filters.LargeTest;
1534
import androidx.test.platform.app.InstrumentationRegistry;
@@ -23,6 +42,7 @@
2342
import org.junit.rules.RuleChain;
2443
import org.junit.rules.TestRule;
2544
import org.opendatakit.tables.R;
45+
import org.opendatakit.tables.activities.ImportCSVActivity;
2646
import org.opendatakit.tables.activities.MainActivity;
2747
import org.opendatakit.tables.utils.TableFileUtils;
2848
import org.opendatakit.util.EspressoUtils;
@@ -33,27 +53,6 @@
3353
import java.io.File;
3454
import java.io.FilenameFilter;
3555

36-
import static androidx.test.espresso.Espresso.onData;
37-
import static androidx.test.espresso.Espresso.onView;
38-
import static androidx.test.espresso.action.ViewActions.click;
39-
import static androidx.test.espresso.action.ViewActions.typeText;
40-
import static androidx.test.espresso.assertion.ViewAssertions.matches;
41-
import static androidx.test.espresso.intent.Intents.intending;
42-
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction;
43-
import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup;
44-
import static androidx.test.espresso.matcher.ViewMatchers.assertThat;
45-
import static androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed;
46-
import static androidx.test.espresso.matcher.ViewMatchers.withClassName;
47-
import static androidx.test.espresso.matcher.ViewMatchers.withId;
48-
import static androidx.test.espresso.matcher.ViewMatchers.withText;
49-
import static org.hamcrest.Matchers.endsWith;
50-
import static org.hamcrest.Matchers.equalTo;
51-
import static org.hamcrest.Matchers.is;
52-
import static org.opendatakit.util.TestConstants.APP_NAME;
53-
import static org.opendatakit.util.TestConstants.OI_PICK_FILE;
54-
import static org.opendatakit.util.TestConstants.T_HOUSE_DISPLAY_NAME;
55-
import static org.opendatakit.util.TestConstants.T_HOUSE_TABLE_ID;
56-
5756

5857
@LargeTest
5958
public class CsvTest {
@@ -215,7 +214,7 @@ public void exportCsv_invalidQualifier() {
215214
@Test
216215
public void importCsv_fileOutOfAppDir() {
217216
//stub intent
218-
intending(hasAction(OI_PICK_FILE)).respondWith(
217+
intending(hasAction(Intent.ACTION_OPEN_DOCUMENT)).respondWith(
219218
new Instrumentation.ActivityResult(Activity.RESULT_OK,
220219
new Intent().setData(Uri.fromFile(new File("/file")))));
221220

@@ -224,8 +223,6 @@ public void importCsv_fileOutOfAppDir() {
224223
onView(withText(R.string.import_choose_csv_file)).perform(click());
225224

226225
//check toast
227-
EspressoUtils.toastMsgMatcher(mIntentsRule, is(EspressoUtils
228-
.getString(mIntentsRule, R.string.file_not_under_app_dir,
229-
ODKFileUtils.getAppFolder(APP_NAME))));
226+
EspressoUtils.toastMsgMatcher(mIntentsRule, is(ImportCSVActivity.IMPORT_FILE_MUST_RESIDE_IN_OPENDATAKIT_FOLDER));
230227
}
231228
}

tables_app/src/androidTestUitest/java/org/opendatakit/espresso/TablePrefTest.java

+19-21
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.opendatakit.util.ODKMatchers;
3838
import org.opendatakit.util.UAUtils;
3939
import org.opendatakit.utilities.ODKFileUtils;
40+
import org.opendatakit.utilities.ODKXFileUriUtils;
4041

4142
import java.io.File;
4243

@@ -72,7 +73,6 @@
7273
import static org.hamcrest.Matchers.notNullValue;
7374
import static org.opendatakit.tables.utils.Constants.IntentKeys.TABLE_PREFERENCE_FRAGMENT_TYPE;
7475
import static org.opendatakit.util.TestConstants.APP_NAME;
75-
import static org.opendatakit.util.TestConstants.OI_PICK_FILE;
7676
import static org.opendatakit.util.TestConstants.T_HOUSE_E_DISPLAY_NAME;
7777
import static org.opendatakit.util.TestConstants.T_HOUSE_E_TABLE_ID;
7878
import static org.opendatakit.util.TestConstants.T_HOUSE_TABLE_ID;
@@ -237,24 +237,24 @@ public void setup() {
237237
}
238238

239239
@Test
240-
public void intents_launchOIFileManager() {
240+
public void intents_launchFilePicker() {
241241
//Check intent on "List View File"
242242
EspressoUtils
243243
.onRecyclerViewText(R.string.list_view_file)
244244
.perform(click());
245-
intended(hasAction(OI_PICK_FILE), Intents.times(1));
245+
intended(hasAction(Intent.ACTION_OPEN_DOCUMENT), Intents.times(1));
246246

247247
//Check intent on "Detail View File"
248248
EspressoUtils
249249
.onRecyclerViewText(R.string.detail_view_file)
250250
.perform(click());
251-
intended(hasAction(OI_PICK_FILE), Intents.times(2));
251+
intended(hasAction(Intent.ACTION_OPEN_DOCUMENT), Intents.times(2));
252252

253253
//Check intent on "Map List View File"
254254
EspressoUtils
255255
.onRecyclerViewText(R.string.map_list_view_file)
256256
.perform(click());
257-
intended(hasAction(OI_PICK_FILE), Intents.times(3));
257+
intended(hasAction(Intent.ACTION_OPEN_DOCUMENT), Intents.times(3));
258258
}
259259

260260
@Test
@@ -375,16 +375,15 @@ public void view_rotateScreen() throws RemoteException, InterruptedException {
375375

376376
@Test
377377
public void intents_listView() {
378-
final String listViewPath =
379-
"/" + APP_NAME + "/config/tables/Tea_houses/html/Tea_houses_list.html";
378+
String listViewPath = "tables/Tea_houses/html/Tea_houses_list.html";
379+
Uri listViewUri = ODKXFileUriUtils.getConfigUri(APP_NAME).buildUpon().appendPath(listViewPath).build();
380380

381381
//backup current config
382382
String currFile = getListViewFile();
383383

384384
//stub response
385-
intending(hasAction(OI_PICK_FILE)).respondWith(
386-
new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent()
387-
.setData(Uri.fromFile(new File(ODKFileUtils.getOdkFolder() + listViewPath)))));
385+
intending(hasAction(Intent.ACTION_OPEN_DOCUMENT)).respondWith(
386+
new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent().setData(listViewUri)));
388387

389388
//edit list view path
390389
EspressoUtils
@@ -410,28 +409,28 @@ public void intents_listView() {
410409

411410
@Test
412411
public void intents_detailView() {
413-
final String detailViewPath =
414-
"/" + APP_NAME + "/config/tables/Tea_houses/html/Tea_houses_detail.html";
415-
final String listViewPath =
416-
"/" + APP_NAME + "/config/tables/Tea_houses/html/Tea_houses_list.html";
412+
String detailViewPath = "tables/Tea_houses/html/Tea_houses_detail.html";
413+
String listViewPath = "tables/Tea_houses/html/Tea_houses_list.html";
414+
Uri detailViewUri = ODKXFileUriUtils.getConfigUri(APP_NAME).buildUpon().appendPath(detailViewPath).build();
415+
Uri listViewUri = ODKXFileUriUtils.getConfigUri(APP_NAME).buildUpon().appendPath(listViewPath).build();
417416

418417
//back up current config
419418
String currDetailFile = getDetailViewFile();
420419
String currListFile = getListViewFile();
421420

422421
//stub response
423-
intending(hasAction(OI_PICK_FILE)).respondWith(
422+
intending(hasAction(Intent.ACTION_OPEN_DOCUMENT)).respondWith(
424423
new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent()
425-
.setData(Uri.fromFile(new File(ODKFileUtils.getOdkFolder() + detailViewPath)))));
424+
.setData(detailViewUri)));
426425

427426
//edit detail view path
428427
EspressoUtils
429428
.onRecyclerViewText(R.string.detail_view_file)
430429
.perform(click());
431430

432-
intending(hasAction(OI_PICK_FILE)).respondWith(
431+
intending(hasAction(Intent.ACTION_OPEN_DOCUMENT)).respondWith(
433432
new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent()
434-
.setData(Uri.fromFile(new File(ODKFileUtils.getOdkFolder() + listViewPath)))));
433+
.setData(listViewUri)));
435434

436435
//edit list view path
437436
EspressoUtils
@@ -455,8 +454,7 @@ public void intents_detailView() {
455454
allOf(withId(R.id.webkit), isDescendantOfA(withId(R.id.top_pane)));
456455

457456
//check url
458-
onView(topWebViewMatcher)
459-
.check(matches(ODKMatchers.withUrl(endsWith(detailViewPath))));
457+
onView(topWebViewMatcher).check(matches(ODKMatchers.withUrl(endsWith(detailViewPath))));
460458

461459
EspressoUtils
462460
.delayedFindElement(topWebViewMatcher, Locator.ID, "TITLE", WEB_WAIT_TIMEOUT)
@@ -528,7 +526,7 @@ public void display_outOfAppDirViewFile() {
528526

529527
try {
530528
//stub intent
531-
intending(hasAction(OI_PICK_FILE)).respondWith(
529+
intending(hasAction(Intent.ACTION_OPEN_DOCUMENT)).respondWith(
532530
new Instrumentation.ActivityResult(Activity.RESULT_OK,
533531
new Intent().setData(Uri.fromFile(new File("/test.html")))));
534532

tables_app/src/androidTestUitest/java/org/opendatakit/util/TestConstants.java

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public class TestConstants {
2222
public static final String GEO_TAB_ID = "geotaggerTab";
2323
public static final String HOPE_TAB_ID = "hopeTab";
2424
//Misc.
25-
public static final String OI_PICK_FILE = "org.openintents.action.PICK_FILE";
2625
public static final String APP_NAME = "default";
2726
//ODK Services menu
2827
public static final String TABLES_SPECIFIC_SETTINGS = "Tables-specific Settings";

0 commit comments

Comments
 (0)