├── .gitignore ├── .hgtags ├── LICENSE ├── README.md ├── broken_tests ├── libs │ ├── android.19.jar │ ├── fest-android-1.0.7.jar │ ├── fest-assert-core-2.0M10.jar │ ├── hamcrest-core-1.3.jar │ ├── junit-4.11.jar │ ├── mockito-all-1.9.5.jar │ ├── robolectric-2.3-20140430.042024-167-jar-with-dependencies.jar │ ├── robolectric-2.3-20140430.042024-167-javadoc.jar │ └── robolectric-2.3-20140430.042024-167-sources.jar ├── src │ ├── org.robolectric.Config.properties │ └── org │ │ └── opendatakit │ │ ├── tables │ │ ├── activities │ │ │ ├── AbsBaseActivityStub.java │ │ │ ├── AbsTableActivityStub.java │ │ │ ├── AbsTableActivityTest.java │ │ │ ├── TableDisplayActivityStub.java │ │ │ ├── TableDisplayActivityTest.java │ │ │ ├── TableLevelPreferencesActivityStub.java │ │ │ ├── TableLevelPreferencesActivityTest.java │ │ │ ├── WebViewActivityStub.java │ │ │ └── WebViewActivityTest.java │ │ ├── application │ │ │ └── TestTables.java │ │ ├── fragments │ │ │ ├── AbsBaseFragmentStub.java │ │ │ ├── AbsBaseFragmentTest.java │ │ │ ├── AbsWebTableFragmentStub.java │ │ │ ├── AbsWebTableFragmentTest.java │ │ │ ├── ListViewFragmentTest.java │ │ │ ├── MapListViewFragmentStub.java │ │ │ ├── MapListViewFragmentTest.java │ │ │ ├── SpreadsheetFragmentTest.java │ │ │ ├── TableManagerFragmentStub.java │ │ │ ├── TableManagerFragmentTest.java │ │ │ ├── TableMapFragmentTest.java │ │ │ ├── TablePreferenceFragmentStub.java │ │ │ ├── TablePreferenceFragmentTest.java │ │ │ ├── WebFragmentStub.java │ │ │ └── WebFragmentTest.java │ │ └── views │ │ │ ├── components │ │ │ └── TableNameStructAdapterTest.java │ │ │ └── webkits │ │ │ ├── ControlStub.java │ │ │ ├── ControlTest.java │ │ │ └── TableDataTest.java │ │ └── testutils │ │ ├── FragmentTestCase.java │ │ ├── ODKFragmentTestUtil.java │ │ ├── TestCaseUtils.java │ │ ├── TestConstants.java │ │ ├── TestContextMenu.java │ │ └── WebViewUtilsTest.java └── test │ ├── java │ └── org │ │ └── opendatakit │ │ └── tables │ │ └── test │ │ └── perf │ │ ├── tablelaunch │ │ ├── TableActivityLaunchTest.java │ │ ├── TableActivitySearchTest.java │ │ └── TableCollectionLaunchTest.java │ │ └── util │ │ ├── DbUtil.java │ │ └── Timer.java │ └── res │ ├── drawable-hdpi │ └── icon.png │ ├── drawable-ldpi │ ├── Thumbs.db │ └── icon.png │ ├── drawable-mdpi │ └── icon.png │ ├── layout │ └── main.xml │ └── values │ └── strings.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── tables_app ├── build.gradle ├── google-services.json ├── lint.xml └── src ├── androidTestUitest ├── AndroidManifest.xml └── java │ └── org │ └── opendatakit │ ├── espresso │ ├── AbsBaseTest.java │ ├── ColorRuleTest.java │ ├── CsvTest.java │ ├── InteropTest.java │ ├── TablePrefTest.java │ ├── WebViewActivityTest.java │ ├── WebViewPerfTest.java │ └── WebkitStressTest.java │ └── util │ ├── EspressoUtils.java │ ├── ODKMatchers.java │ ├── TestConstants.java │ └── UAUtils.java └── main ├── AndroidManifest.xml ├── java └── org │ └── opendatakit │ └── tables │ ├── activities │ ├── AbsBaseActivity.java │ ├── AbsBaseWebActivity.java │ ├── AbsTableActivity.java │ ├── AndroidShortcuts.java │ ├── ExportCSVActivity.java │ ├── IOdkTablesActivity.java │ ├── ISpreadsheetFragmentContainer.java │ ├── ImportCSVActivity.java │ ├── Launcher.java │ ├── MainActivity.java │ ├── TableDisplayActivity.java │ └── TableLevelPreferencesActivity.java │ ├── application │ └── Tables.java │ ├── data │ ├── PossibleTableViewTypes.java │ └── ViewFragmentType.java │ ├── fragments │ ├── AbsTableDisplayFragment.java │ ├── AbsTableLevelPreferenceFragment.java │ ├── AbsTablesFragment.java │ ├── AbsWebTableFragment.java │ ├── ColorRuleListFragment.java │ ├── ColumnListFragment.java │ ├── ColumnPreferenceFragment.java │ ├── DetailViewFragment.java │ ├── DetailWithListDetailViewFragment.java │ ├── DetailWithListListViewFragment.java │ ├── EditColorRuleFragment.java │ ├── IMapListViewCallbacks.java │ ├── IWebFragment.java │ ├── ImportExportDialogFragment.java │ ├── InitializationFragment.java │ ├── ListViewFragment.java │ ├── LocationDialogFragment.java │ ├── MapListViewFragment.java │ ├── NavigateFragment.java │ ├── SpreadsheetFragment.java │ ├── StatusColorRuleListFragment.java │ ├── TableManagerFragment.java │ ├── TableMapInnerFragment.java │ ├── TablePreferenceFragment.java │ └── WebFragment.java │ ├── logic │ └── AverageAngle.java │ ├── preferences │ ├── DefaultViewTypePreference.java │ ├── EditColorPreference.java │ ├── EditNameDialogPreference.java │ └── FileSelectorPreference.java │ ├── providers │ └── GeoProvider.java │ ├── tasks │ ├── ExportRequest.java │ ├── ExportTask.java │ ├── ImportRequest.java │ └── ImportTask.java │ ├── types │ └── FormType.java │ ├── utils │ ├── ActivityUtil.java │ ├── Constants.java │ ├── DistanceUtil.java │ ├── IntentUtil.java │ ├── PreferenceUtil.java │ ├── SQLQueryStruct.java │ ├── SurveyUtil.java │ ├── TableFileUtils.java │ └── TableNameStruct.java │ └── views │ ├── CellInfo.java │ ├── ColorPickerDialog.java │ ├── CompassView.java │ ├── SpreadsheetProps.java │ ├── SpreadsheetUserTable.java │ ├── SpreadsheetView.java │ ├── TabularView.java │ ├── TouchListView.java │ ├── WScrollView.java │ ├── components │ ├── ColorRuleAdapter.java │ ├── TableNameStructAdapter.java │ └── TableViewTypeAdapter.java │ └── webkits │ ├── OdkTables.java │ ├── OdkTablesIf.java │ ├── OdkTablesWebView.java │ └── TableDataExecutorProcessor.java └── res ├── drawable-hdpi ├── census_bearing.png ├── compass.png ├── compass_heading.png ├── ic_action_content_discard.png ├── ic_add_black_24dp.png ├── ic_archive_black_24dp.png ├── ic_export_csv_black_24dp.png ├── ic_forward_black_24dp.png ├── ic_import_csv_black_24dp.png ├── ic_mode_edit_black_24dp.png ├── ic_search_black_24dp.png ├── ic_sort_black_24dp.png ├── ic_unarchive_black_24dp.png ├── ic_view_headline_black_24dp.png ├── icon.png ├── odk_tables_ab_icon.png └── odk_tables_icon.png ├── drawable-ldpi └── odk_tables_icon.png ├── drawable-mdpi ├── ic_action_content_discard.png ├── ic_add_black_24dp.png ├── ic_archive_black_24dp.png ├── ic_export_csv_black_24dp.png ├── ic_forward_black_24dp.png ├── ic_import_csv_black_24dp.png ├── ic_mode_edit_black_24dp.png ├── ic_search_black_24dp.png ├── ic_sort_black_24dp.png ├── ic_unarchive_black_24dp.png ├── ic_view_headline_black_24dp.png ├── icon.png ├── icon_home.png ├── odk_tables_ab_icon.png ├── odk_tables_icon.png ├── tables_app.png └── tables_table.png ├── drawable-xhdpi ├── ic_action_content_discard.png ├── ic_add_black_24dp.png ├── ic_archive_black_24dp.png ├── ic_export_csv_black_24dp.png ├── ic_forward_black_24dp.png ├── ic_import_csv_black_24dp.png ├── ic_mode_edit_black_24dp.png ├── ic_search_black_24dp.png ├── ic_sort_black_24dp.png ├── ic_unarchive_black_24dp.png ├── ic_view_headline_black_24dp.png ├── icon.png ├── odk_tables_ab_icon.png └── odk_tables_icon.png ├── drawable-xxhdpi ├── ic_action_content_discard.png ├── ic_add_black_24dp.png ├── ic_archive_black_24dp.png ├── ic_export_csv_black_24dp.png ├── ic_forward_black_24dp.png ├── ic_import_csv_black_24dp.png ├── ic_mode_edit_black_24dp.png ├── ic_search_black_24dp.png ├── ic_sort_black_24dp.png ├── ic_unarchive_black_24dp.png ├── ic_view_headline_black_24dp.png ├── icon.png ├── odk_tables_ab_icon.png └── odk_tables_icon.png ├── drawable-xxxhdpi ├── ic_add_black_24dp.png ├── ic_archive_black_24dp.png ├── ic_export_csv_black_24dp.png ├── ic_forward_black_24dp.png ├── ic_import_csv_black_24dp.png ├── ic_mode_edit_black_24dp.png ├── ic_search_black_24dp.png ├── ic_sort_black_24dp.png ├── ic_unarchive_black_24dp.png ├── ic_view_headline_black_24dp.png ├── icon.png ├── odk_tables_ab_icon.png └── odk_tables_icon.png ├── drawable ├── btn_item_no_shadow.xml ├── clickable.xml ├── item_background_state.xml ├── my_border.xml └── thumb.xml ├── layout-land ├── map_fragment.xml └── split_content_fragment.xml ├── layout ├── about_wrapper_activity.xml ├── activity_main_activity.xml ├── activity_table_display_activity.xml ├── activity_table_manager.xml ├── activity_web_view_activity.xml ├── aggregate_choose_tables_activity.xml ├── col_manager.xml ├── color_rule_manager.xml ├── column_list.xml ├── copy_expansion_files_layout.xml ├── defaultoptions_view.xml ├── dv_wrapper.xml ├── edit_default_form_preference.xml ├── edit_listview_name_dialog.xml ├── file_manager.xml ├── fragment_color_rule_list.xml ├── fragment_table_list.xml ├── importexport_view.xml ├── list_view_manager.xml ├── manage_property_sets.xml ├── map_fragment.xml ├── message_with_text_edit_field_dialog.xml ├── navigate_fragment.xml ├── row_for_edit_view_entry.xml ├── row_for_view_entry.xml ├── row_item_with_preference.xml ├── security_activity.xml ├── shortcut_edit_dialog.xml ├── shortcut_item.xml ├── shortcut_list.xml ├── shortcut_list_item.xml ├── split_content_fragment.xml ├── table_level_preferences.xml └── web_view_container.xml ├── menu ├── context_menu_color_rule_list.xml ├── detail_view_menu.xml ├── menu_color_rule_list.xml ├── table_manager.xml ├── table_manager_context.xml ├── top_level_table_menu.xml └── web_view_activity.xml ├── raw ├── configzip └── systemzip ├── values-es └── strings.xml ├── values ├── arrays.xml ├── colors.xml ├── dimensions.xml ├── drawables.xml ├── ids.xml ├── strings.xml ├── touchlistview.xml └── untranslatable.xml └── xml ├── network_security_config.xml ├── preference_color_rule_entry.xml ├── preference_column.xml ├── preference_row_color_rule_entry.xml └── table_preference.xml /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .gradle 3 | .idea 4 | local.properties 5 | *.iml 6 | tables_app/fabric.properties 7 | odkanalytics/ 8 | -------------------------------------------------------------------------------- /broken_tests/libs/android.19.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/libs/android.19.jar -------------------------------------------------------------------------------- /broken_tests/libs/fest-android-1.0.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/libs/fest-android-1.0.7.jar -------------------------------------------------------------------------------- /broken_tests/libs/fest-assert-core-2.0M10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/libs/fest-assert-core-2.0M10.jar -------------------------------------------------------------------------------- /broken_tests/libs/hamcrest-core-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/libs/hamcrest-core-1.3.jar -------------------------------------------------------------------------------- /broken_tests/libs/junit-4.11.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/libs/junit-4.11.jar -------------------------------------------------------------------------------- /broken_tests/libs/mockito-all-1.9.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/libs/mockito-all-1.9.5.jar -------------------------------------------------------------------------------- /broken_tests/libs/robolectric-2.3-20140430.042024-167-jar-with-dependencies.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/libs/robolectric-2.3-20140430.042024-167-jar-with-dependencies.jar -------------------------------------------------------------------------------- /broken_tests/libs/robolectric-2.3-20140430.042024-167-javadoc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/libs/robolectric-2.3-20140430.042024-167-javadoc.jar -------------------------------------------------------------------------------- /broken_tests/libs/robolectric-2.3-20140430.042024-167-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/libs/robolectric-2.3-20140430.042024-167-sources.jar -------------------------------------------------------------------------------- /broken_tests/src/org.robolectric.Config.properties: -------------------------------------------------------------------------------- 1 | manifest=../tables/AndroidManifest.xml 2 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/activities/AbsBaseActivityStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.activities; 16 | 17 | import org.opendatakit.testutils.TestConstants; 18 | 19 | public class AbsBaseActivityStub extends AbsBaseActivity { 20 | 21 | public static final String DEFAULT_APP_NAME = 22 | TestConstants.TABLES_DEFAULT_APP_NAME; 23 | 24 | public static String APP_NAME = DEFAULT_APP_NAME; 25 | 26 | @Override 27 | String retrieveAppNameFromIntent() { 28 | return APP_NAME; 29 | } 30 | 31 | public static void resetState() { 32 | APP_NAME = DEFAULT_APP_NAME; 33 | } 34 | 35 | @Override 36 | public void databaseAvailable() { 37 | // TODO Auto-generated method stub 38 | 39 | } 40 | 41 | @Override 42 | public void databaseUnavailable() { 43 | // TODO Auto-generated method stub 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/activities/AbsTableActivityStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.activities; 16 | 17 | import org.opendatakit.tables.activities.TableDisplayActivity.ViewFragmentType; 18 | import org.opendatakit.testutils.TestConstants; 19 | 20 | /** 21 | * Basic implementation of a TableActivity for testing. More complicated 22 | * table activity stubs should extend this one. 23 | *

24 | * Set the static objects here as you need them, but be sure to reset them to 25 | * their default values. 26 | * @author sudar.sam@gmail.com 27 | * 28 | */ 29 | public class AbsTableActivityStub extends AbsTableActivity { 30 | 31 | // If modified during tests, the APP_NAME and TABLE_PROPERTIES objects should 32 | // be reset to these default values so that tests begin in a known state. 33 | public static final String DEFAULT_APP_NAME = 34 | TestConstants.TABLES_DEFAULT_APP_NAME; 35 | public static final String DEFAULT_TABLE_ID = TestConstants.DEFAULT_TABLE_ID; 36 | public static final ViewFragmentType DEFAULT_FRAGMENT_TYPE = 37 | ViewFragmentType.SPREADSHEET; 38 | 39 | public static String APP_NAME = DEFAULT_APP_NAME; 40 | public static String TABLE_ID = DEFAULT_TABLE_ID; 41 | public static ViewFragmentType FRAGMENT_TYPE = DEFAULT_FRAGMENT_TYPE; 42 | 43 | @Override 44 | String retrieveAppNameFromIntent() { 45 | return APP_NAME; 46 | } 47 | 48 | @Override 49 | String retrieveTableIdFromIntent() { 50 | return TABLE_ID; 51 | } 52 | 53 | /** 54 | * Reset the stub's state to the default values. Should be called after each 55 | * test modifying the object. 56 | */ 57 | public static void resetState() { 58 | APP_NAME = DEFAULT_APP_NAME; 59 | TABLE_ID = DEFAULT_TABLE_ID; 60 | } 61 | 62 | public ViewFragmentType getCurrentFragmentType() { 63 | return FRAGMENT_TYPE; 64 | } 65 | 66 | @Override 67 | public void databaseAvailable() { 68 | // TODO Auto-generated method stub 69 | 70 | } 71 | 72 | @Override 73 | public void databaseUnavailable() { 74 | // TODO Auto-generated method stub 75 | 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/activities/TableLevelPreferencesActivityStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.activities; 16 | 17 | import org.opendatakit.testutils.TestConstants; 18 | 19 | import android.os.Bundle; 20 | 21 | 22 | /** 23 | * Basic stub for testing {@link TableLevelPreferencesActivity}. We need to do 24 | * things like return a known TableProperties object. 25 | *

26 | * Set the static objects here as you need them, but be sure to reset them 27 | * to their default values. 28 | * @author sudar.sam@gmail.com 29 | * 30 | */ 31 | public class TableLevelPreferencesActivityStub 32 | extends TableLevelPreferencesActivity { 33 | 34 | // It is ugly, but I think that this has to be duplicated in each activity, 35 | // since java doesn't support multiple inheritance. Ideally we'd be extending 36 | // both the class under test and the TableActivityStub here. 37 | 38 | // If modified during tests, the APP_NAME and TABLE_PROPERTIES objects should 39 | // be reset to these default values so that tests begin in a known state. 40 | public static final String DEFAULT_APP_NAME = 41 | TestConstants.TABLES_DEFAULT_APP_NAME; 42 | public static final String DEFAULT_TABLE_ID = "testTableId"; 43 | public static final FragmentType DEFAULT_FRAGMENT_TYPE = 44 | FragmentType.TABLE_PREFERENCE; 45 | 46 | public static FragmentType FRAGMENT_TYPE = DEFAULT_FRAGMENT_TYPE; 47 | public static String APP_NAME = DEFAULT_APP_NAME; 48 | public static String TABLE_ID = DEFAULT_TABLE_ID; 49 | 50 | public static void resetState() { 51 | FRAGMENT_TYPE = DEFAULT_FRAGMENT_TYPE; 52 | APP_NAME = DEFAULT_APP_NAME; 53 | TABLE_ID = DEFAULT_TABLE_ID; 54 | } 55 | 56 | @Override 57 | String retrieveAppNameFromIntent() { 58 | return APP_NAME; 59 | } 60 | 61 | @Override 62 | String retrieveTableIdFromIntent() { 63 | return TABLE_ID; 64 | } 65 | 66 | @Override 67 | FragmentType retrieveFragmentTypeFromBundleOrActivity(Bundle savedInstanceState) { 68 | return FRAGMENT_TYPE; 69 | } 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/activities/TableLevelPreferencesActivityTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.activities; 16 | 17 | import static org.fest.assertions.api.ANDROID.assertThat; 18 | 19 | import org.junit.Test; 20 | import org.junit.runner.RunWith; 21 | import org.robolectric.RobolectricTestRunner; 22 | 23 | import android.widget.AbsListView; 24 | 25 | 26 | /** 27 | * 28 | * @author sudar.sam@gmail.com 29 | * 30 | */ 31 | @RunWith(RobolectricTestRunner.class) 32 | public class TableLevelPreferencesActivityTest { 33 | 34 | // TODO: Robolectric doesn't currently support PreferenceFragments. Wait for 35 | // now. 36 | 37 | @Test 38 | public void meaninglessTest() { 39 | assertThat((AbsListView) null).isNull(); 40 | } 41 | 42 | // TableLevelPreferencesActivityStub activity; 43 | // 44 | // @Before 45 | // public void setup() { 46 | // // Create a mock TableProperties that will give us known results. 47 | // TableProperties propertiesMock = mock(TableProperties.class); 48 | // TableLevelPreferencesActivityStub.TABLE_PROPERTIES = propertiesMock; 49 | // this.activity = 50 | // Robolectric.buildActivity(TableLevelPreferencesActivityStub.class) 51 | // .create() 52 | // .start() 53 | // .resume() 54 | // .visible() 55 | // .get(); 56 | // } 57 | // 58 | // @After 59 | // public void after() { 60 | // TableLevelPreferencesActivityStub.resetState(); 61 | // } 62 | 63 | // @Test 64 | // public void tablePreferenceFragmentNotNull() { 65 | // Fragment fragment = this.activity.getFragmentManager() 66 | // .findFragmentById(R.id.fragment_table_preference); 67 | // assertThat(fragment).isNotNull(); 68 | // } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/activities/WebViewActivityStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.activities; 16 | 17 | import org.opendatakit.testutils.TestConstants; 18 | 19 | public class WebViewActivityStub extends MainActivity { 20 | 21 | public static final String DEFAULT_APP_NAME = 22 | TestConstants.TABLES_DEFAULT_APP_NAME; 23 | public static final boolean DO_SCAN_ALL_TABLES = false; 24 | 25 | public static String APP_NAME = DEFAULT_APP_NAME; 26 | 27 | public static void resetState() { 28 | APP_NAME = DEFAULT_APP_NAME; 29 | } 30 | 31 | @Override 32 | public String getAppName() { 33 | return APP_NAME; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/application/TestTables.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.application; 16 | 17 | import java.lang.reflect.Method; 18 | 19 | import org.robolectric.TestLifecycleApplication; 20 | 21 | public class TestTables extends Tables implements TestLifecycleApplication { 22 | 23 | @Override 24 | public void beforeTest(Method method) { 25 | } 26 | 27 | @Override 28 | public void prepareTest(Object test) { 29 | } 30 | 31 | @Override 32 | public void afterTest(Method method) { 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/fragments/AbsBaseFragmentStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.fragments; 16 | 17 | /** 18 | * 19 | * @author sudar.sam@gmail.com 20 | * 21 | */ 22 | public class AbsBaseFragmentStub extends AbsBaseFragment { 23 | 24 | @Override 25 | public void databaseAvailable() { 26 | // we assume the service connection is mocked and does not require any of these calls 27 | } 28 | 29 | @Override 30 | public void databaseUnavailable() { 31 | // we assume the service connection is mocked and does not require any of these calls 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/fragments/AbsBaseFragmentTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.fragments; 16 | 17 | import static org.fest.assertions.api.ANDROID.assertThat; 18 | 19 | import org.junit.After; 20 | import org.junit.Before; 21 | import org.junit.Test; 22 | import org.junit.runner.RunWith; 23 | import org.opendatakit.common.android.application.CommonApplication; 24 | import org.opendatakit.tables.activities.AbsBaseActivityStub; 25 | import org.opendatakit.testutils.ODKFragmentTestUtil; 26 | import org.opendatakit.testutils.TestCaseUtils; 27 | import org.opendatakit.testutils.TestConstants; 28 | import org.robolectric.RobolectricTestRunner; 29 | 30 | import android.app.Activity; 31 | import android.app.Fragment; 32 | import android.app.FragmentManager; 33 | 34 | /** 35 | * 36 | * @author sudar.sam@gmail.com 37 | * 38 | */ 39 | @RunWith(RobolectricTestRunner.class) 40 | public class AbsBaseFragmentTest { 41 | 42 | @Before 43 | public void setup() { 44 | CommonApplication.setMocked(); 45 | TestCaseUtils.setExternalStorageMounted(); 46 | 47 | TestCaseUtils.setThreeTableDataset(true); 48 | } 49 | 50 | @After 51 | public void after() { 52 | TestCaseUtils.resetExternalStorageState(); 53 | AbsBaseActivityStub.resetState(); 54 | } 55 | 56 | @Test 57 | public void fragmentInitializesNonNull() { 58 | AbsBaseFragmentStub stub = new AbsBaseFragmentStub(); 59 | Activity activity = ODKFragmentTestUtil.startActivityAttachFragment( 60 | AbsBaseActivityStub.class, 61 | stub, null, 62 | TestConstants.DEFAULT_FRAGMENT_TAG); 63 | FragmentManager mgr = activity.getFragmentManager(); 64 | Fragment fragment = mgr.findFragmentByTag(TestConstants.DEFAULT_FRAGMENT_TAG); 65 | assertThat(fragment).isNotNull(); 66 | } 67 | 68 | @Test(expected=IllegalStateException.class) 69 | public void activityOtherThanAbsBaseActivityThrowsIllegalState() { 70 | AbsBaseFragmentStub stub = new AbsBaseFragmentStub(); 71 | Activity activity = ODKFragmentTestUtil.startActivityAttachFragment( 72 | Activity.class, 73 | stub, null, 74 | TestConstants.DEFAULT_FRAGMENT_TAG); 75 | FragmentManager mgr = activity.getFragmentManager(); 76 | Fragment fragment = mgr.findFragmentByTag(TestConstants.DEFAULT_FRAGMENT_TAG); 77 | } 78 | 79 | @Test 80 | public void fragmentGetsAppNameFromParentActivity() { 81 | AbsBaseFragmentStub stub = new AbsBaseFragmentStub(); 82 | Activity activity = ODKFragmentTestUtil.startActivityAttachFragment( 83 | AbsBaseActivityStub.class, 84 | stub, null, 85 | TestConstants.DEFAULT_FRAGMENT_TAG); 86 | FragmentManager mgr = activity.getFragmentManager(); 87 | Fragment fragment = mgr.findFragmentByTag(TestConstants.DEFAULT_FRAGMENT_TAG); 88 | 89 | String retrievedAppName = stub.getAppName(); 90 | org.fest.assertions.api.Assertions.assertThat(retrievedAppName) 91 | .isNotNull() 92 | .isEqualTo(TestConstants.TABLES_DEFAULT_APP_NAME); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/fragments/AbsWebTableFragmentStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.fragments; 16 | 17 | import org.opendatakit.tables.activities.TableDisplayActivity.ViewFragmentType; 18 | import org.opendatakit.tables.views.webkits.TableData; 19 | import org.opendatakit.testutils.TestConstants; 20 | 21 | import android.webkit.WebView; 22 | 23 | public class AbsWebTableFragmentStub extends AbsWebTableFragment { 24 | 25 | public static final WebView DEFAULT_WEB_VIEW = 26 | TestConstants.getWebViewMock(); 27 | public static final TableData DEFAULT_TABLE_DATA = 28 | TestConstants.getTableDataMock(); 29 | public static final String DEFAULT_FILE_NAME = 30 | TestConstants.DEFAULT_FILE_NAME; 31 | public static final ViewFragmentType DEFAULT_FRAGMENT_TYPE = 32 | ViewFragmentType.SPREADSHEET; 33 | 34 | public static WebView WEB_VIEW = DEFAULT_WEB_VIEW; 35 | public static String FILE_NAME = DEFAULT_FILE_NAME; 36 | public static ViewFragmentType FRAGMENT_TYPE = DEFAULT_FRAGMENT_TYPE; 37 | public static TableData TABLE_DATA = DEFAULT_TABLE_DATA; 38 | 39 | public static void resetState() { 40 | WEB_VIEW = DEFAULT_WEB_VIEW; 41 | FILE_NAME = DEFAULT_FILE_NAME; 42 | FRAGMENT_TYPE = DEFAULT_FRAGMENT_TYPE; 43 | TABLE_DATA = DEFAULT_TABLE_DATA; 44 | } 45 | 46 | @Override 47 | public ViewFragmentType getFragmentType() { 48 | return FRAGMENT_TYPE; 49 | } 50 | 51 | @Override 52 | protected TableData createDataObject() { 53 | // TODO: this goes away... 54 | // TODO Auto-generated method stub 55 | return null; 56 | } 57 | 58 | @Override 59 | public void databaseAvailable() { 60 | // we assume the service connection is mocked and does not require any of these calls 61 | } 62 | 63 | @Override 64 | public void databaseUnavailable() { 65 | // we assume the service connection is mocked and does not require any of these calls 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/fragments/AbsWebTableFragmentTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.fragments; 16 | 17 | import static org.fest.assertions.api.ANDROID.assertThat; 18 | 19 | import org.junit.After; 20 | import org.junit.Before; 21 | import org.junit.Test; 22 | import org.junit.runner.RunWith; 23 | import org.opendatakit.common.android.application.CommonApplication; 24 | import org.opendatakit.tables.activities.TableDisplayActivity; 25 | import org.opendatakit.tables.activities.TableDisplayActivity.ViewFragmentType; 26 | import org.opendatakit.tables.activities.TableDisplayActivityStub; 27 | import org.opendatakit.testutils.ODKFragmentTestUtil; 28 | import org.opendatakit.testutils.TestCaseUtils; 29 | import org.opendatakit.testutils.TestConstants; 30 | import org.robolectric.RobolectricTestRunner; 31 | import org.robolectric.shadows.ShadowLog; 32 | 33 | import android.app.FragmentManager; 34 | 35 | @RunWith(RobolectricTestRunner.class) 36 | public class AbsWebTableFragmentTest { 37 | 38 | DetailViewFragment fragment; 39 | TableDisplayActivity activity; 40 | 41 | @Before 42 | public void before() { 43 | CommonApplication.setMocked(); 44 | TestCaseUtils.setExternalStorageMounted(); 45 | 46 | TestCaseUtils.setThreeTableDataset(true); 47 | ShadowLog.stream = System.out; 48 | TableDisplayActivityStub.BUILD_MENU_FRAGMENT = false; 49 | } 50 | 51 | @After 52 | public void after() { 53 | TestCaseUtils.resetExternalStorageState(); 54 | TableDisplayActivityStub.resetState(); 55 | } 56 | 57 | private void setupFragmentWithDefaultFileName() { 58 | setupFragmentWithFileName(TestConstants.DEFAULT_FILE_NAME); 59 | } 60 | 61 | private void setupFragmentWithFileName(String fileName) { 62 | this.doGlobalSetup(fileName); 63 | } 64 | 65 | private void doGlobalSetup(String fileName) { 66 | this.activity = ODKFragmentTestUtil.startDetailWebFragmentForTableDisplayActivity( 67 | TestConstants.DEFAULT_TABLE_ID, 68 | fileName, 69 | TestConstants.ROWID_1 70 | ); 71 | FragmentManager mgr = activity.getFragmentManager(); 72 | String fragTag = TableDisplayActivity.getFragmentTag(ViewFragmentType.DETAIL); 73 | this.fragment = (DetailViewFragment) mgr.findFragmentByTag(fragTag); 74 | } 75 | 76 | @Test 77 | public void fragmentInitializesNonNull() { 78 | this.setupFragmentWithFileName("testFileName"); 79 | assertThat(this.fragment).isNotNull(); 80 | } 81 | 82 | @Test 83 | public void fragmentStoresCorrectFileName() { 84 | String target = "test/path/to/file"; 85 | this.setupFragmentWithFileName(target); 86 | org.fest.assertions.api.Assertions.assertThat(this.fragment.getFileName()) 87 | .isEqualTo(target); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/fragments/MapListViewFragmentStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.fragments; 16 | 17 | import org.opendatakit.tables.views.webkits.Control; 18 | import org.opendatakit.tables.views.webkits.TableData; 19 | import org.opendatakit.testutils.TestConstants; 20 | 21 | public class MapListViewFragmentStub extends MapListViewFragment { 22 | 23 | public static TableData TABLE_DATA = TestConstants.getTableDataMock(); 24 | public static Control CONTROL = TestConstants.getControlMock(); 25 | public static String FILE_NAME = TestConstants.DEFAULT_FILE_NAME; 26 | 27 | public static void resetState() { 28 | TABLE_DATA = TestConstants.getTableDataMock(); 29 | CONTROL = TestConstants.getControlMock(); 30 | FILE_NAME = TestConstants.DEFAULT_FILE_NAME; 31 | } 32 | 33 | @Override 34 | public Control createControlObject() { 35 | return CONTROL; 36 | } 37 | 38 | @Override 39 | protected TableData createDataObject() { 40 | return TABLE_DATA; 41 | } 42 | 43 | @Override 44 | public String getFileName() { 45 | return FILE_NAME; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/fragments/TableManagerFragmentStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.fragments; 16 | 17 | import java.util.List; 18 | 19 | import org.opendatakit.tables.utils.TableNameStruct; 20 | 21 | public class TableManagerFragmentStub extends TableManagerFragment { 22 | 23 | List dummyList; 24 | int numberOfCallsToUpdatePropertiesList; 25 | 26 | public TableManagerFragmentStub(List toDisplay) { 27 | this.dummyList = toDisplay; 28 | this.numberOfCallsToUpdatePropertiesList = 0; 29 | } 30 | 31 | @Override 32 | protected void updateTableIdList() { 33 | this.numberOfCallsToUpdatePropertiesList++; 34 | super.updateTableIdList(); 35 | // super.setList(dummyList); 36 | } 37 | 38 | /** 39 | * Get the number of times 40 | * {@link TableManagerFragment#updateTablePropertiesList()} was called. 41 | * A helper function that is an alternative to using mockito's mocks and 42 | * spies. 43 | * @return 44 | */ 45 | public int getNumberOfCallsToUpdatePropertiesList() { 46 | return this.numberOfCallsToUpdatePropertiesList; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/fragments/TableMapFragmentTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.fragments; 16 | 17 | import org.junit.Test; 18 | import org.junit.runner.RunWith; 19 | import org.robolectric.RobolectricTestRunner; 20 | 21 | @RunWith(RobolectricTestRunner.class) 22 | public class TableMapFragmentTest { 23 | 24 | @Test 25 | public void meanginlessDummyTest() { 26 | // Weirdly, this class is currently throwing a recursive call to execute 27 | // pending transaction exception on the computer but working on the 28 | // device. This should be investigated. 29 | org.fest.assertions.api.Assertions.assertThat(true).isEqualTo(true); 30 | } 31 | 32 | // TableMapFragmentStub fragment; 33 | // Activity activity; 34 | // 35 | // @Before 36 | // public void setup() { 37 | // ShadowLog.stream = System.out; 38 | // } 39 | // 40 | // @After 41 | // public void after() { 42 | // TableMapFragmentStub.resetState(); 43 | // } 44 | // 45 | // private void doGlobalSetup(TableMapFragmentStub stub) { 46 | // this.fragment = stub; 47 | // ODKFragmentTestUtil.startFragmentForActivity( 48 | // TableDisplayActivityStub.class, 49 | // stub, 50 | // null); 51 | // } 52 | // 53 | // private void setupFragmentWithDefaults() { 54 | // TableMapFragmentStub stub = new TableMapFragmentStub(); 55 | // this.doGlobalSetup(stub); 56 | // } 57 | // 58 | // private void setupFragmentWithFileName(String fileName) { 59 | // TableMapFragmentStub.FILE_NAME = fileName; 60 | // TableMapFragmentStub stub = new TableMapFragmentStub(); 61 | // this.doGlobalSetup(stub); 62 | // } 63 | // 64 | // @Test 65 | // public void fragmentInitializesNonNull() { 66 | // this.setupFragmentWithDefaults(); 67 | // assertThat(this.fragment).isNotNull(); 68 | // } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/fragments/TablePreferenceFragmentStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.fragments; 16 | 17 | public class TablePreferenceFragmentStub extends TablePreferenceFragment { 18 | 19 | @Override 20 | protected void initializeAllPreferences() { 21 | // no-op for now. 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/fragments/TablePreferenceFragmentTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.fragments; 16 | 17 | import static org.fest.assertions.api.ANDROID.assertThat; 18 | 19 | import org.junit.Test; 20 | import org.junit.runner.RunWith; 21 | import org.robolectric.RobolectricTestRunner; 22 | 23 | import android.widget.AbsListView; 24 | 25 | @RunWith(RobolectricTestRunner.class) 26 | public class TablePreferenceFragmentTest { 27 | 28 | // TODO: wait on this until Robolectric publishes my fix for preferences as 29 | // part of the jar 30 | @Test 31 | public void meaninglessTest() { 32 | assertThat((AbsListView) null).isNull(); 33 | } 34 | 35 | // TablePreferenceFragment fragment; 36 | // Activity activity; 37 | // 38 | // @Before 39 | // public void setup() { 40 | // TablePreferenceFragmentStub stub = new TablePreferenceFragmentStub(); 41 | // this.fragment = stub; 42 | // ODKFragmentTestUtil.startFragmentForActivity( 43 | // AbsTableActivityStub.class, 44 | // fragment, 45 | // null); 46 | // } 47 | // 48 | // @Test 49 | // public void testFragmentIsNotNull() { 50 | // assertThat(this.fragment).isNotNull(); 51 | // } 52 | // 53 | // @Test 54 | // public void canFindAPreference() { 55 | // EditTextPreference idPref = this.fragment.findEditTextPreference( 56 | // Constants.PreferenceKeys.Table.TABLE_ID); 57 | // assertThat(idPref).isNotNull(); 58 | // } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/fragments/WebFragmentStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.fragments; 16 | 17 | import org.opendatakit.tables.views.webkits.Control; 18 | import org.opendatakit.testutils.TestConstants; 19 | 20 | import android.webkit.WebView; 21 | 22 | public class WebFragmentStub extends WebFragment { 23 | 24 | public static final WebView DEFAULT_WEB_VIEW = 25 | TestConstants.getWebViewMock(); 26 | public static final String DEFAULT_FILE_NAME = 27 | TestConstants.DEFAULT_FILE_NAME; 28 | public static final Control DEFAULT_CONTROL = 29 | TestConstants.getControlMock(); 30 | 31 | public static WebView WEB_VIEW = DEFAULT_WEB_VIEW; 32 | public static String FILE_NAME = DEFAULT_FILE_NAME; 33 | public static Control CONTROL = DEFAULT_CONTROL; 34 | 35 | public static void resetState() { 36 | WEB_VIEW = DEFAULT_WEB_VIEW; 37 | FILE_NAME = DEFAULT_FILE_NAME; 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/fragments/WebFragmentTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.fragments; 16 | 17 | import static org.fest.assertions.api.ANDROID.assertThat; 18 | 19 | import org.junit.After; 20 | import org.junit.Before; 21 | import org.junit.Test; 22 | import org.junit.runner.RunWith; 23 | import org.opendatakit.common.android.application.CommonApplication; 24 | import org.opendatakit.tables.activities.AbsBaseActivityStub; 25 | import org.opendatakit.tables.utils.IntentUtil; 26 | import org.opendatakit.testutils.ODKFragmentTestUtil; 27 | import org.opendatakit.testutils.TestCaseUtils; 28 | import org.robolectric.RobolectricTestRunner; 29 | import org.robolectric.shadows.ShadowLog; 30 | 31 | import android.app.Activity; 32 | import android.os.Bundle; 33 | 34 | @RunWith(RobolectricTestRunner.class) 35 | public class WebFragmentTest { 36 | 37 | WebFragmentStub fragment; 38 | Activity activity; 39 | 40 | @Before 41 | public void before() { 42 | CommonApplication.setMocked(); 43 | TestCaseUtils.setExternalStorageMounted(); 44 | 45 | TestCaseUtils.setThreeTableDataset(true); 46 | ShadowLog.stream = System.out; 47 | } 48 | 49 | @After 50 | public void after() { 51 | TestCaseUtils.resetExternalStorageState(); 52 | WebFragmentStub.resetState(); 53 | } 54 | 55 | private void setupFragmentWithFileName(String fileName) { 56 | WebFragmentStub stub = new WebFragmentStub(); 57 | Bundle bundle = new Bundle(); 58 | IntentUtil.addFileNameToBundle(bundle, fileName); 59 | stub.setArguments(bundle); 60 | this.doGlobalSetup(stub); 61 | } 62 | 63 | private void doGlobalSetup(WebFragmentStub stub) { 64 | this.fragment = stub; 65 | this.activity = ODKFragmentTestUtil.startActivityAttachFragment( 66 | AbsBaseActivityStub.class, 67 | stub, 68 | null, null); 69 | } 70 | 71 | @Test 72 | public void fragmentInitializesNonNull() { 73 | this.setupFragmentWithFileName("testFileName"); 74 | assertThat(this.fragment).isNotNull(); 75 | } 76 | 77 | @Test 78 | public void fragmentStoresCorrectFileNameInArguments() { 79 | String target = "test/path/to/file"; 80 | this.setupFragmentWithFileName(target); 81 | org.fest.assertions.api.Assertions.assertThat(this.fragment.getFileName()) 82 | .isEqualTo(target); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/tables/views/webkits/ControlStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.views.webkits; 16 | 17 | import java.util.Map; 18 | 19 | import org.opendatakit.common.android.database.data.OrderedColumns; 20 | import org.opendatakit.tables.activities.AbsBaseActivity; 21 | 22 | import android.content.ContentValues; 23 | import android.content.Context; 24 | import android.os.RemoteException; 25 | 26 | public class ControlStub extends Control { 27 | 28 | public static ContentValues CONTENT_VALUES = null; 29 | public static String GENERATED_ROW_ID = null; 30 | 31 | public ControlStub(AbsBaseActivity activity, String tableId, OrderedColumns orderedDefns) throws RemoteException { 32 | super(activity, tableId, orderedDefns); 33 | } 34 | 35 | public static void resetState() { 36 | CONTENT_VALUES = null; 37 | GENERATED_ROW_ID = null; 38 | } 39 | 40 | @Override 41 | protected ContentValues getContentValuesFromMap( 42 | Context context, String appName, String tableId, 43 | OrderedColumns orderedDefns, 44 | Map elementKeyToValue) { 45 | return CONTENT_VALUES; 46 | } 47 | 48 | @Override 49 | protected String generateRowId() { 50 | return GENERATED_ROW_ID; 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/testutils/FragmentTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.testutils; 16 | 17 | import org.junit.After; 18 | import org.junit.Before; 19 | import org.junit.Test; 20 | import org.junit.runner.RunWith; 21 | import org.robolectric.Robolectric; 22 | import org.robolectric.RobolectricTestRunner; 23 | import org.robolectric.shadows.ShadowLog; 24 | import org.robolectric.util.ActivityController; 25 | 26 | import android.app.Activity; 27 | import android.app.Fragment; 28 | import android.app.FragmentManager; 29 | 30 | /** 31 | * Provides basic functionality for tests of fragment. Handles putting 32 | * Fragments into an empty base activity. Tests for fragments should extend 33 | * this class. 34 | *

35 | * Base on: 36 | * http://blog.nikhaldimann.com/2013/10/10/robolectric-2-2-some-pages-from-the-missing-manual/ 37 | * @author sudar.sam@gmail.com 38 | * 39 | */ 40 | @RunWith(RobolectricTestRunner.class) 41 | public class FragmentTestCase { 42 | 43 | private static final String FRAGMENT_TAG = "fragment"; 44 | 45 | private ActivityController controller; 46 | private Activity activity; 47 | private T fragment; 48 | 49 | @Before 50 | public void before() { 51 | ShadowLog.stream = System.out; 52 | } 53 | 54 | /** 55 | * Adds the fragment to a new blank activity, initializing its view. 56 | * @param fragment 57 | */ 58 | public void startFragment(T fragment) { 59 | this.fragment = fragment; 60 | controller = Robolectric.buildActivity(Activity.class); 61 | activity = (Activity) controller.create().start().visible().get(); 62 | FragmentManager fragmentManager = activity.getFragmentManager(); 63 | fragmentManager.beginTransaction() 64 | .add(this.fragment, FRAGMENT_TAG).commit(); 65 | } 66 | 67 | /** 68 | * Get the activity that contains the fragment. 69 | * @return 70 | */ 71 | public Activity getParentActivity() { 72 | return this.activity; 73 | } 74 | 75 | @Test 76 | public void meaninglessTest() { 77 | assert(true == false); 78 | } 79 | 80 | @After 81 | public void destroyFragment() { 82 | if (this.fragment != null) { 83 | FragmentManager fragmentManager = this.activity.getFragmentManager(); 84 | fragmentManager.beginTransaction().remove(this.fragment).commit(); 85 | this.fragment = null; 86 | this.activity = null; 87 | } 88 | } 89 | 90 | public void pauseAndResumeFragment() { 91 | this.controller.pause().resume(); 92 | } 93 | 94 | @SuppressWarnings("unchecked") 95 | public T recreateFragment() { 96 | this.activity.recreate(); 97 | this.fragment = 98 | (T) this.activity.getFragmentManager().findFragmentByTag(FRAGMENT_TAG); 99 | return this.fragment; 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /broken_tests/src/org/opendatakit/testutils/TestContextMenu.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.testutils; 16 | 17 | import org.robolectric.tester.android.view.TestMenu; 18 | 19 | import android.graphics.drawable.Drawable; 20 | import android.view.ContextMenu; 21 | import android.view.Menu; 22 | import android.view.View; 23 | 24 | /** 25 | * This is a VERY basic implemention of ContextMenu so that we can just do 26 | * basic assertions about what the ContextMenu looks like when inflated. We 27 | * basically want to be able to say things about it when it's inflated. 28 | * @author sudar.sam@gmail.com 29 | * 30 | */ 31 | public class TestContextMenu extends TestMenu implements ContextMenu, Menu { 32 | 33 | @Override 34 | public void clearHeader() { 35 | // TODO Auto-generated method stub 36 | 37 | } 38 | 39 | @Override 40 | public ContextMenu setHeaderIcon(int arg0) { 41 | // TODO Auto-generated method stub 42 | return null; 43 | } 44 | 45 | @Override 46 | public ContextMenu setHeaderIcon(Drawable arg0) { 47 | // TODO Auto-generated method stub 48 | return null; 49 | } 50 | 51 | @Override 52 | public ContextMenu setHeaderTitle(int arg0) { 53 | // TODO Auto-generated method stub 54 | return null; 55 | } 56 | 57 | @Override 58 | public ContextMenu setHeaderTitle(CharSequence arg0) { 59 | // TODO Auto-generated method stub 60 | return null; 61 | } 62 | 63 | @Override 64 | public ContextMenu setHeaderView(View arg0) { 65 | // TODO Auto-generated method stub 66 | return null; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /broken_tests/test/java/org/opendatakit/tables/test/perf/tablelaunch/TableActivityLaunchTest.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.test.perf.tablelaunch; 2 | 3 | import org.opendatakit.tables.Activity.TableManager; 4 | import org.opendatakit.tables.activities.Controller; 5 | import org.opendatakit.tables.data.DbHelper; 6 | import org.opendatakit.tables.data.TableProperties; 7 | import org.opendatakit.tables.data.TableViewSettings; 8 | import org.opendatakit.tables.test.perf.util.DbUtil; 9 | import org.opendatakit.tables.test.perf.util.Timer; 10 | import android.app.Activity; 11 | import android.test.InstrumentationTestCase; 12 | import android.test.PerformanceTestCase; 13 | import android.view.KeyEvent; 14 | 15 | 16 | public class TableActivityLaunchTest extends InstrumentationTestCase 17 | implements PerformanceTestCase { 18 | 19 | private final Timer timer; 20 | 21 | public TableActivityLaunchTest() { 22 | timer = new Timer(); 23 | } 24 | 25 | public boolean isPerformanceOnly() { 26 | return true; 27 | } 28 | 29 | public int startPerformance( 30 | PerformanceTestCase.Intermediates intermediates) { 31 | return 1; 32 | } 33 | 34 | public void testLaunches() { 35 | //int viewType = TableViewSettings.Type.SPREADSHEET; 36 | String label = "custom list"; 37 | Activity tableManager = launchActivity("org.opendatakit.tables", 38 | TableManager.class, null); 39 | getInstrumentation().waitForIdleSync(); 40 | TableProperties tp = TableProperties.getTablePropertiesForTable( 41 | DbHelper.getDbHelper(tableManager), 42 | DbUtil.TEMPERATURE_TABLE_ID); 43 | //tp.getOverviewViewSettings().setViewType(viewType); 44 | timer.start(); 45 | Controller.launchTableActivity(tableManager, tp, true); 46 | getInstrumentation().waitForIdleSync(); 47 | getInstrumentation().sendKeyDownUpSync(KeyEvent.KEYCODE_A); 48 | timer.end(); 49 | timer.print(label + " launch"); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /broken_tests/test/java/org/opendatakit/tables/test/perf/tablelaunch/TableActivitySearchTest.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.test.perf.tablelaunch; 2 | 3 | import org.opendatakit.tables.activities.Controller; 4 | import org.opendatakit.tables.activities.SpreadsheetDisplayActivity; 5 | import org.opendatakit.tables.data.DbHelper; 6 | import org.opendatakit.tables.data.TableProperties; 7 | import org.opendatakit.tables.test.perf.util.DbUtil; 8 | import org.opendatakit.tables.test.perf.util.Timer; 9 | import android.app.Activity; 10 | import android.content.Intent; 11 | import android.test.ActivityInstrumentationTestCase2; 12 | import android.test.PerformanceTestCase; 13 | import android.widget.EditText; 14 | import android.widget.ImageButton; 15 | 16 | 17 | public class TableActivitySearchTest 18 | extends ActivityInstrumentationTestCase2 19 | implements PerformanceTestCase { 20 | 21 | private final Timer timer; 22 | 23 | public TableActivitySearchTest() { 24 | super(SpreadsheetDisplayActivity.class); 25 | timer = new Timer(); 26 | } 27 | 28 | @Override 29 | public void setUp() { 30 | TableProperties tp = TableProperties.getTablePropertiesForTable( 31 | DbHelper.getDbHelper(getInstrumentation().getContext()), 32 | DbUtil.TEMPERATURE_TABLE_ID); 33 | Intent intent = new Intent(getInstrumentation().getContext(), 34 | SpreadsheetDisplayActivity.class); 35 | intent.putExtra(Controller.INTENT_KEY_TABLE_ID, tp.getTableId()); 36 | intent.putExtra(Controller.INTENT_KEY_IS_OVERVIEW, true); 37 | setActivityIntent(intent); 38 | } 39 | 40 | public void testSearch() { 41 | Activity activity = getActivity(); 42 | final EditText searchField = (EditText) activity.findViewById( 43 | Controller.VIEW_ID_SEARCH_FIELD); 44 | final ImageButton searchButton = (ImageButton) activity.findViewById( 45 | Controller.VIEW_ID_SEARCH_BUTTON); 46 | Runnable r = new Runnable() { 47 | @Override 48 | public void run() { 49 | searchField.setText("fridge_id:0"); 50 | timer.start(); 51 | searchButton.performClick(); 52 | timer.end(); 53 | timer.print("search"); 54 | } 55 | }; 56 | try { 57 | runTestOnUiThread(r); 58 | } catch(Throwable e) { 59 | throw new RuntimeException(e); 60 | } 61 | getInstrumentation().waitForIdleSync(); 62 | } 63 | 64 | public boolean isPerformanceOnly() { 65 | return true; 66 | } 67 | 68 | public int startPerformance( 69 | PerformanceTestCase.Intermediates intermediates) { 70 | return 1; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /broken_tests/test/java/org/opendatakit/tables/test/perf/tablelaunch/TableCollectionLaunchTest.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.test.perf.tablelaunch; 2 | 3 | import org.opendatakit.tables.Activity.TableManager; 4 | import org.opendatakit.tables.activities.Controller; 5 | import org.opendatakit.tables.data.DbHelper; 6 | import org.opendatakit.tables.data.TableProperties; 7 | import org.opendatakit.tables.test.perf.util.DbUtil; 8 | import org.opendatakit.tables.test.perf.util.Timer; 9 | import android.app.Activity; 10 | import android.test.InstrumentationTestCase; 11 | import android.test.PerformanceTestCase; 12 | 13 | 14 | public class TableCollectionLaunchTest extends InstrumentationTestCase 15 | implements PerformanceTestCase { 16 | 17 | private final Timer timer; 18 | 19 | public TableCollectionLaunchTest() { 20 | timer = new Timer(); 21 | } 22 | 23 | public boolean isPerformanceOnly() { 24 | return true; 25 | } 26 | 27 | public int startPerformance( 28 | PerformanceTestCase.Intermediates intermediates) { 29 | return 1; 30 | } 31 | 32 | public void testLaunches() { 33 | //int viewType = TableViewSettings.Type.SPREADSHEET; 34 | String label = "line"; 35 | Activity tableManager = launchActivity("org.opendatakit.tables", 36 | TableManager.class, null); 37 | getInstrumentation().waitForIdleSync(); 38 | TableProperties tp = TableProperties.getTablePropertiesForTable( 39 | DbHelper.getDbHelper(tableManager), 40 | DbUtil.TEMPERATURE_TABLE_ID); 41 | //tp.getOverviewViewSettings().setViewType(viewType); 42 | Controller.launchTableActivity(tableManager, tp, true); 43 | getInstrumentation().waitForIdleSync(); 44 | timer.start(); 45 | Controller.launchTableActivity(tableManager, tp, "fridge_id:0", false); 46 | getInstrumentation().waitForIdleSync(); 47 | timer.end(); 48 | timer.print(label + " launch"); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /broken_tests/test/java/org/opendatakit/tables/test/perf/util/DbUtil.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.test.perf.util; 2 | 3 | 4 | public class DbUtil { 5 | 6 | public static final String TEMPERATURE_TABLE_ID = 7 | "769d744d-0f39-4023-9309-099e20479b89"; 8 | } 9 | -------------------------------------------------------------------------------- /broken_tests/test/java/org/opendatakit/tables/test/perf/util/Timer.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.test.perf.util; 2 | 3 | import android.util.Log; 4 | 5 | 6 | public class Timer { 7 | 8 | private static final String TAG = "Timer"; 9 | 10 | private long startTime; 11 | private long endTime; 12 | 13 | public Timer() { 14 | startTime = -1; 15 | endTime = -1; 16 | } 17 | 18 | public void start() { 19 | startTime = System.currentTimeMillis(); 20 | } 21 | 22 | public void end() { 23 | endTime = System.currentTimeMillis(); 24 | } 25 | 26 | public void print(String label) { 27 | long duration = endTime - startTime; 28 | Log.d(TAG, " " + label + ": " + duration + "ms"); 29 | } 30 | 31 | public long getDuration() { 32 | return (endTime - startTime); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /broken_tests/test/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/test/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /broken_tests/test/res/drawable-ldpi/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/test/res/drawable-ldpi/Thumbs.db -------------------------------------------------------------------------------- /broken_tests/test/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/test/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /broken_tests/test/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/broken_tests/test/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /broken_tests/test/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /broken_tests/test/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello World! 4 | ODK Tables Performance Tests 5 | 6 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | dependencies { 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' 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | mavenCentral() 19 | maven { 20 | url "https://jitpack.io" 21 | } 22 | ivy { 23 | url 'http://cwe.cs.washington.edu:8082/artifactory/libs-demo/' 24 | } 25 | maven { 26 | url 'http://cwe.cs.washington.edu:8082/artifactory/libs-master/' 27 | } 28 | ivy { 29 | url 'http://cwe.cs.washington.edu:8082/artifactory/libs-snapshot/' 30 | } 31 | } 32 | } 33 | 34 | configurations.all { 35 | transitive = true 36 | } 37 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 2 | android.useAndroidX=true 3 | android.useJetpack=false 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Oct 29 14:28:12 PDT 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 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(); 6 | } 7 | 8 | logger.warn('tables/settings.gradle -- gradle.ext.workspacePath: ' + gradle.ext.workspacePath) 9 | 10 | gradle.ext.local = gradle.ext.workspacePath + '/gradle-config/remote.gradle' 11 | gradle.ext.remote = 'https://raw.githubusercontent.com/opendatakit/gradle-config/' + gradle.ext.gradleConfigVersion + '/remote.gradle' 12 | gradle.ext.useLocal = true // set to false to always build against remote artifacts 13 | 14 | if ((new File(gradle.ext.local)).exists()) { 15 | gradle.ext.useLocalPaths = true 16 | apply from: gradle.ext.local 17 | } else { 18 | gradle.ext.useLocalPaths = false 19 | apply from: gradle.ext.remote 20 | } 21 | 22 | settingsScripts.each { 23 | apply from: it 24 | } 25 | 26 | include(tablesProjectChild) 27 | 28 | if (libraryProjectPath.exists() && gradle.ext.useLocal) { // check if local library project is present 29 | if (!ext.librarySubProjectDictory.exists()) { 30 | ext.librarySubProjectDictory.mkdirs() 31 | } 32 | include libraryProjectName 33 | project(libraryProjectName).setProjectDir(libraryProjectPath) // set local location 34 | } 35 | 36 | if (commonProjectPath.exists() && gradle.ext.useLocal) { // check if local common project is present 37 | if (!ext.commonSubProjectDictory.exists()) { 38 | ext.commonSubProjectDictory.mkdirs() 39 | } 40 | include commonProjectName 41 | project(commonProjectName).setProjectDir(commonProjectPath) // set local location 42 | } 43 | -------------------------------------------------------------------------------- /tables_app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "876360963794", 4 | "firebase_url": "https://odk-x-97b95.firebaseio.com", 5 | "project_id": "odk-x-97b95", 6 | "storage_bucket": "odk-x-97b95.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:876360963794:android:98706b15d2122f52f5bf0b", 12 | "android_client_info": { 13 | "package_name": "org.opendatakit.tables" 14 | } 15 | }, 16 | "api_key": [ 17 | { 18 | "current_key": "AIzaSyBsjcNb77BHWv81ubNn2hwW_D20hjsC_qM" 19 | } 20 | ], 21 | "services": { 22 | "analytics_service": { 23 | "status": 1 24 | } 25 | } 26 | } 27 | ], 28 | "configuration_version": "1" 29 | } -------------------------------------------------------------------------------- /tables_app/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tables_app/src/androidTestUitest/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | -------------------------------------------------------------------------------- /tables_app/src/androidTestUitest/java/org/opendatakit/espresso/AbsBaseTest.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.espresso; 2 | 3 | import android.app.Activity; 4 | import android.app.Application; 5 | import android.util.Log; 6 | 7 | import androidx.test.core.app.ApplicationProvider; 8 | import androidx.test.platform.app.InstrumentationRegistry; 9 | 10 | import org.junit.Before; 11 | import org.opendatakit.tables.application.Tables; 12 | 13 | 14 | public class AbsBaseTest { 15 | public static Tables c = null; 16 | private static String TAG = AbsBaseTest.class.getSimpleName(); 17 | @Before public void _setUpC() { 18 | c = Tables.getInstance(); 19 | _setUpC(ApplicationProvider.getApplicationContext()); 20 | if (c == null) { 21 | _setUpC(InstrumentationRegistry.getInstrumentation().getTargetContext()); 22 | } 23 | if (c == null) 24 | throw new java.lang.IllegalStateException(); 25 | } 26 | 27 | public void _setUpC(Object context) { 28 | if (context instanceof Application) { 29 | c = (Tables) context; 30 | } else if (context instanceof Activity) { 31 | c = (Tables) ((Activity) context).getApplication(); 32 | } else { 33 | if (context == null) { 34 | Log.e(TAG, "context is null!"); 35 | } else { 36 | Log.i(TAG, context.toString()); 37 | } 38 | } 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /tables_app/src/androidTestUitest/java/org/opendatakit/util/TestConstants.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.util; 2 | 3 | public class TestConstants { 4 | //UI Automator Timeouts 5 | //Timeout for launching an app 6 | public static final int APP_START_TIMEOUT = 20 * 1000; 7 | //Timeout for "Configuring ..." 8 | public static final int APP_INIT_TIMEOUT = 5 * 60 * 1000; 9 | //Timeout for view rendering 10 | public static final int OBJ_WAIT_TIMEOUT = 3000; 11 | //Timeout for opening table manager 12 | public static final int TABLE_MGR_WAIT = 10 * 1000; 13 | //Table names and related 14 | public static final String T_HOUSE_DISPLAY_NAME = "Tea Houses"; 15 | public static final String T_HOUSE_TABLE_ID = "Tea_houses"; 16 | public static final String T_INVENTORY_DISPLAY_NAME = "Tea inventory"; 17 | public static final String T_INVENTORY_TABLE_ID = "Tea_inventory"; 18 | public static final String T_HOUSE_E_DISPLAY_NAME = "Tea Houses Editable"; 19 | public static final String T_HOUSE_E_TABLE_ID = "Tea_houses_editable"; 20 | //Web names 21 | public static final String LAUNCH_DEMO_ID = "launch-button"; 22 | public static final String GEO_TAB_ID = "geotaggerTab"; 23 | public static final String HOPE_TAB_ID = "hopeTab"; 24 | //Misc. 25 | public static final String APP_NAME = "default"; 26 | //ODK Services menu 27 | public static final String TABLES_SPECIFIC_SETTINGS = "Tables-specific Settings"; 28 | public static final String CUSTOM_HOME = "Use custom home screen"; 29 | //Package names 30 | public static String TABLES_PKG_NAME = "org.opendatakit.tables"; 31 | public static String SURVEY_PKG_NAME = "org.opendatakit.survey"; 32 | //Espresso Web 33 | public static int WEB_WAIT_TIMEOUT = 6000; 34 | } 35 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/activities/IOdkTablesActivity.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.activities; 2 | 3 | import org.opendatakit.activities.IOdkCommonActivity; 4 | import org.opendatakit.activities.IOdkDataActivity; 5 | 6 | /** 7 | * @author mitchellsundt@gmail.com 8 | */ 9 | public interface IOdkTablesActivity extends IOdkCommonActivity, IOdkDataActivity { 10 | 11 | /** 12 | * Takes a fragment id and if that fragment exists and is a webkit, returns the url currently 13 | * being viewed in the fragment 14 | * 15 | * @param ifChanged unused 16 | * @param fragmentID the id of the webview fragment, if there are more than one 17 | * @return The url of the requested fragment or null 18 | */ 19 | String getUrlBaseLocation(boolean ifChanged, String fragmentID); 20 | 21 | /** 22 | * If there is a map view fragment, return the index of the selected item 23 | * 24 | * @return null if not a map view or no item selected; otherwise, selected item index. 25 | */ 26 | Integer getIndexOfSelectedItem(); 27 | } 28 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/activities/ISpreadsheetFragmentContainer.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.activities; 2 | 3 | import org.opendatakit.tables.views.SpreadsheetProps; 4 | 5 | /** 6 | * Created by Niles on 6/20/17. 7 | * Designates something that contains properties. 8 | */ 9 | public interface ISpreadsheetFragmentContainer { 10 | /** 11 | * Gets the spreadsheet properties (should be mutable!) 12 | * 13 | * @return the properties for the current view 14 | */ 15 | SpreadsheetProps getProps(); 16 | } 17 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/application/Tables.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package org.opendatakit.tables.application; 16 | 17 | import android.content.Context; 18 | 19 | import com.google.firebase.analytics.FirebaseAnalytics; 20 | import org.opendatakit.application.CommonApplication; 21 | import org.opendatakit.tables.R; 22 | 23 | import java.lang.ref.WeakReference; 24 | 25 | /** 26 | * The application, holds a reference to itself and a very helpful getDatabase method 27 | */ 28 | public class Tables extends CommonApplication { 29 | 30 | /** 31 | * Used for logging 32 | */ 33 | @SuppressWarnings("unused") 34 | private static final String TAG = Tables.class.getSimpleName(); 35 | 36 | private static WeakReference ref = null; 37 | 38 | private FirebaseAnalytics analytics; 39 | 40 | public static Tables getInstance() { 41 | if (ref == null) 42 | // shut the IDE up 43 | throw new IllegalStateException("not possible"); 44 | return ref.get(); 45 | } 46 | 47 | @Override 48 | public int getApkDisplayNameResourceId() { 49 | return R.string.app_name; 50 | } 51 | 52 | @Override 53 | public int getConfigZipResourceId() { 54 | return R.raw.configzip; 55 | } 56 | 57 | @Override 58 | public int getSystemZipResourceId() { 59 | return R.raw.systemzip; 60 | } 61 | 62 | public String getVersionedToolName() { 63 | String versionDetail = this.getVersionDetail(); 64 | return getString(R.string.app_name) + versionDetail; 65 | } 66 | 67 | @Override 68 | public void onCreate() { 69 | ref = new WeakReference<>(this); 70 | super.onCreate(); 71 | 72 | analytics = FirebaseAnalytics.getInstance(this); 73 | analytics.logEvent(FirebaseAnalytics.Event.APP_OPEN, null); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/data/ViewFragmentType.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.data; 2 | 3 | /** 4 | * The fragment types this activity could be displaying. 5 | * 6 | * @author sudar.sam@gmail.com 7 | */ 8 | @SuppressWarnings("JavaDoc") 9 | public enum ViewFragmentType { 10 | SPREADSHEET, LIST, MAP, DETAIL, DETAIL_WITH_LIST, SUB_LIST, NAVIGATE 11 | } 12 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/fragments/AbsTableDisplayFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.fragments; 17 | 18 | import androidx.fragment.app.Fragment; 19 | import android.content.Context; 20 | import org.opendatakit.database.data.OrderedColumns; 21 | import org.opendatakit.database.data.UserTable; 22 | import org.opendatakit.tables.activities.AbsTableActivity; 23 | import org.opendatakit.tables.activities.TableDisplayActivity; 24 | 25 | /** 26 | * The base class for any {@link Fragment} that displays a table. 27 | * 28 | * @author sudar.sam@gmail.com 29 | */ 30 | public abstract class AbsTableDisplayFragment extends AbsTablesFragment { 31 | 32 | @Override 33 | public void onAttach(Context context) { 34 | super.onAttach(context); 35 | if (!(context instanceof TableDisplayActivity)) { 36 | throw new IllegalStateException( 37 | "fragment must be attached to a " + TableDisplayActivity.class.getSimpleName()); 38 | } 39 | } 40 | 41 | /** 42 | * Get the tableId of the active table. 43 | * 44 | * @return the table id 45 | */ 46 | public String getTableId() { 47 | return ((AbsTableActivity) getActivity()).getTableId(); 48 | } 49 | 50 | /** 51 | * Get the description of the table. 52 | * 53 | * @return the columns of the active table 54 | */ 55 | public OrderedColumns getColumnDefinitions() { 56 | return ((AbsTableActivity) getActivity()).getColumnDefinitions(); 57 | } 58 | 59 | /** 60 | * Get the {@link UserTable} being held by the {@link TableDisplayActivity}. 61 | * 62 | * @return the user table (data in the table) from the enclosing activity 63 | */ 64 | public UserTable getUserTable() { 65 | return ((TableDisplayActivity) getActivity()).getUserTable(); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/fragments/AbsTableLevelPreferenceFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.fragments; 17 | 18 | import android.os.Bundle; 19 | import androidx.preference.EditTextPreference; 20 | import androidx.preference.ListPreference; 21 | import androidx.preference.PreferenceFragmentCompat ; 22 | import org.opendatakit.activities.IAppAwareActivity; 23 | import org.opendatakit.database.data.OrderedColumns; 24 | import org.opendatakit.tables.activities.AbsTableActivity; 25 | 26 | /** 27 | * This fragment should be extended to display any preferences that apply at a 28 | * table level. Any preference fragments that expect a tableId 29 | * to be available should extend this fragment. 30 | *

31 | * This Fragment can only be used inside a {@link AbsTableActivity}. 32 | * 33 | * @author sudar.sam@gmail.com 34 | */ 35 | public abstract class AbsTableLevelPreferenceFragment extends PreferenceFragmentCompat { 36 | 37 | @Override 38 | public void onActivityCreated(Bundle savedInstanceState) { 39 | super.onActivityCreated(savedInstanceState); 40 | // We have to verify that we are attached to an AbsTableActivity, or else 41 | // we won't have a tableId available. 42 | if (!(this.getActivity() instanceof AbsTableActivity)) { 43 | throw new IllegalStateException( 44 | "AbsTableLevelPreferenceFragment can " + "only be used with AbsTableActivity. " + this 45 | .getActivity().getClass() + " is not appropriate."); 46 | } 47 | } 48 | 49 | String getAppName() { 50 | return ((IAppAwareActivity) getActivity()).getAppName(); 51 | } 52 | 53 | String getTableId() { 54 | return ((AbsTableActivity) getActivity()).getTableId(); 55 | } 56 | 57 | OrderedColumns getColumnDefinitions() { 58 | return ((AbsTableActivity) getActivity()).getColumnDefinitions(); 59 | } 60 | 61 | /** 62 | * Find an {@link EditTextPreference} with the given key. 63 | * Convenience method for 64 | * calling {@link PreferenceFragment#findPreference(CharSequence)} and 65 | * casting it to {@link EditTextPreference}. 66 | * 67 | * @param key the key to search the fragment for 68 | * @return the edit text preference with that key or null if it wasn't found 69 | */ 70 | EditTextPreference findEditTextPreference(String key) { 71 | return (EditTextPreference) this.findPreference(key); 72 | } 73 | 74 | /** 75 | * Find a {@link ListPreference} with the given key. Convenience method for 76 | * calling {@link PreferenceFragment#findPreference(CharSequence)} and 77 | * casting it to {@link ListPreference}. 78 | * 79 | * @param key the key to search the fragment for 80 | * @return the list preference with that key or null if it wasn't found 81 | */ 82 | ListPreference findListPreference(String key) { 83 | return (ListPreference) findPreference(key); 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/fragments/DetailViewFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.fragments; 17 | 18 | import androidx.fragment.app.Fragment; 19 | import android.view.View; 20 | import org.opendatakit.activities.IOdkCommonActivity; 21 | import org.opendatakit.database.data.BaseTable; 22 | import org.opendatakit.database.queries.BindArgs; 23 | import org.opendatakit.database.service.DbHandle; 24 | import org.opendatakit.database.service.UserDbInterface; 25 | import org.opendatakit.logging.WebLogger; 26 | import org.opendatakit.tables.R; 27 | import org.opendatakit.tables.application.Tables; 28 | /** 29 | * {@link Fragment} for displaying a detail view. 30 | * 31 | * @author sudar.sam@gmail.com 32 | */ 33 | public class DetailViewFragment extends AbsWebTableFragment { 34 | 35 | /** 36 | * Used for logging 37 | */ 38 | @SuppressWarnings("unused") 39 | private static final String TAG = DetailViewFragment.class.getSimpleName(); 40 | public void databaseAvailable() { 41 | super.databaseAvailable(); 42 | View view = getView(); 43 | if (view != null) { 44 | view.post(new Runnable() { 45 | @Override 46 | public void run() { 47 | checkAccess(); 48 | } 49 | }); 50 | } 51 | } 52 | private void checkAccess() { 53 | String tableId = ((IOdkCommonActivity) getActivity()).getTableId(); 54 | String rowId = ((IOdkCommonActivity) getActivity()).getInstanceId(); 55 | UserDbInterface dbInt = Tables.getInstance().getDatabase(); 56 | boolean can_edit = true; 57 | try { 58 | DbHandle db = dbInt.openDatabase(getAppName()); 59 | 60 | BaseTable result = dbInt 61 | // we know it's safe to dump the table id in there because we got it from the TDA 62 | .arbitrarySqlQuery(getAppName(), db,tableId, "SELECT * FROM "+tableId+" WHERE _id = ?", 63 | new BindArgs(new String[] {rowId}), 1, 0); 64 | String access = result.getRowAtIndex(0).getRawStringByKey("_effective_access"); 65 | if (access != null) { 66 | can_edit = access.contains("w"); 67 | } 68 | dbInt.closeDatabase(getAppName(), db); 69 | } catch (Exception e) { 70 | WebLogger.getLogger(getAppName()).printStackTrace(e); 71 | } 72 | if (!can_edit) { 73 | View edit_button = getActivity().findViewById(R.id.menu_edit_row); 74 | if (edit_button != null) { 75 | edit_button.setVisibility(View.GONE); 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/fragments/DetailWithListDetailViewFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.fragments; 17 | 18 | import android.os.Bundle; 19 | import android.view.LayoutInflater; 20 | import android.view.View; 21 | import android.view.ViewGroup; 22 | import org.opendatakit.logging.WebLogger; 23 | import org.opendatakit.tables.R; 24 | import org.opendatakit.tables.utils.Constants; 25 | import org.opendatakit.views.ODKWebView; 26 | 27 | /** 28 | * Created by jbeorse on 5/1/17. 29 | * The fragment with two webviews on one screen, one list and one detail 30 | */ 31 | public class DetailWithListDetailViewFragment extends AbsWebTableFragment { 32 | 33 | private static final String TAG = DetailWithListDetailViewFragment.class.getSimpleName(); 34 | 35 | @Override 36 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 37 | Bundle savedInstanceState) { 38 | View newView = super.onCreateView(inflater, container, savedInstanceState); 39 | 40 | if (newView == null) { 41 | WebLogger.getLogger(getAppName()).e(TAG, "[onCreateView] parent view was null"); 42 | return null; 43 | } 44 | 45 | ODKWebView webView = newView.findViewById(R.id.webkit); 46 | if (webView == null) { 47 | WebLogger.getLogger(getAppName()).e(TAG, "[onCreateView] web view was null"); 48 | return newView; 49 | } 50 | webView.setContainerFragmentID(Constants.FragmentTags.DETAIL_WITH_LIST_DETAIL); 51 | return newView; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/fragments/DetailWithListListViewFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.fragments; 17 | 18 | import android.os.Bundle; 19 | import android.view.LayoutInflater; 20 | import android.view.View; 21 | import android.view.ViewGroup; 22 | import org.opendatakit.logging.WebLogger; 23 | import org.opendatakit.tables.R; 24 | import org.opendatakit.tables.utils.Constants; 25 | import org.opendatakit.views.ODKWebView; 26 | 27 | /** 28 | * Created by jbeorse on 5/1/17. 29 | * The fragment with two webviews on one screen, each a list 30 | */ 31 | public class DetailWithListListViewFragment extends AbsWebTableFragment { 32 | 33 | private static final String TAG = DetailWithListListViewFragment.class.getSimpleName(); 34 | 35 | @Override 36 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 37 | Bundle savedInstanceState) { 38 | View newView = super.onCreateView(inflater, container, savedInstanceState); 39 | 40 | if (newView == null) { 41 | WebLogger.getLogger(getAppName()).e(TAG, "[onCreateView] parent view was null"); 42 | return null; 43 | } 44 | ODKWebView webView = newView.findViewById(R.id.webkit); 45 | if (webView == null) { 46 | WebLogger.getLogger(getAppName()).e(TAG, "[onCreateView] web view was null"); 47 | return newView; 48 | } 49 | webView.setContainerFragmentID(Constants.FragmentTags.DETAIL_WITH_LIST_LIST); 50 | return newView; 51 | } 52 | } -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/fragments/IMapListViewCallbacks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.fragments; 17 | 18 | /** 19 | * @author sudar.sam@gmail.com 20 | */ 21 | interface IMapListViewCallbacks { 22 | 23 | /** 24 | * Sets the index of the row that is selected. 25 | * 26 | * @param index the index of the selected item 27 | */ 28 | void setIndexOfSelectedItem(int index); 29 | 30 | /** 31 | * Set the state to indicate that no row is selected. Resets the state set 32 | * with a call to {@link #setIndexOfSelectedItem(int)}. 33 | */ 34 | void setNoItemSelected(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/fragments/IWebFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.fragments; 17 | 18 | import org.opendatakit.tables.views.webkits.OdkTablesWebView; 19 | 20 | /** 21 | * Interface defining behavior for those Fragments that display a 22 | * {@link org.opendatakit.views.ODKWebView }. 23 | * 24 | * @author sudar.sam@gmail.com 25 | */ 26 | public interface IWebFragment { 27 | 28 | /** 29 | * Get the webkit in this fragment 30 | * 31 | * @return the webkit in the fragment 32 | */ 33 | OdkTablesWebView getWebKit(); 34 | 35 | /** 36 | * Toggles visibility of the "database unavailable" text box and 37 | * the webkit based upon the accessibility of the database. 38 | */ 39 | void setWebKitVisibility(); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/fragments/ListViewFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.fragments; 17 | 18 | import androidx.fragment.app.Fragment; 19 | 20 | /** 21 | * {@link Fragment} for displaying a List view. 22 | * 23 | * @author sudar.sam@gmail.com 24 | */ 25 | public class ListViewFragment extends AbsWebTableFragment { 26 | 27 | /** 28 | * Used for logging 29 | */ 30 | @SuppressWarnings("unused") 31 | private static final String TAG = ListViewFragment.class.getSimpleName(); 32 | } 33 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/fragments/WebFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.fragments; 17 | 18 | import android.os.Bundle; 19 | import android.view.LayoutInflater; 20 | import android.view.View; 21 | import android.view.ViewGroup; 22 | import android.webkit.WebView; 23 | import org.opendatakit.logging.WebLogger; 24 | import org.opendatakit.tables.R; 25 | import org.opendatakit.tables.application.Tables; 26 | import org.opendatakit.tables.views.webkits.OdkTablesWebView; 27 | 28 | /** 29 | * Displays an HTML file that is not associated with a particular table. 30 | * Consequently it does not add a data JavaScript interface to its 31 | * {@link WebView}. To display data about a table, see 32 | * {@link AbsWebTableFragment} and its subclasses. 33 | * 34 | * @author sudar.sam@gmail.com 35 | */ 36 | public class WebFragment extends AbsTablesFragment implements IWebFragment { 37 | 38 | private static final String TAG = WebFragment.class.getSimpleName(); 39 | 40 | @Override 41 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 42 | Bundle savedInstanceState) { 43 | WebLogger.getLogger(getAppName()) 44 | .d(TAG, "[onCreateView] activity is: " + getActivity().getClass().getSimpleName()); 45 | 46 | return inflater.inflate(R.layout.web_view_container, container, false); 47 | } 48 | 49 | @Override 50 | public void onResume() { 51 | super.onResume(); 52 | OdkTablesWebView view = getWebKit(); 53 | if ( view != null ) { 54 | view.onResume(); 55 | } 56 | } 57 | 58 | @Override 59 | public void onPause() { 60 | super.onPause(); 61 | OdkTablesWebView view = getWebKit(); 62 | if ( view != null ) { 63 | view.onPause(); 64 | } 65 | } 66 | 67 | @Override 68 | public OdkTablesWebView getWebKit() { 69 | if (getView() == null) 70 | return null; 71 | return (OdkTablesWebView) getView().findViewById(R.id.webkit); 72 | } 73 | 74 | @Override 75 | public void setWebKitVisibility() { 76 | if (getView() == null) { 77 | return; 78 | } 79 | 80 | View webView = getView().findViewById(R.id.webkit); 81 | View noDatabase = getView().findViewById(android.R.id.empty); 82 | 83 | if (Tables.getInstance().getDatabase() != null) { 84 | webView.setVisibility(View.VISIBLE); 85 | noDatabase.setVisibility(View.GONE); 86 | } else { 87 | webView.setVisibility(View.GONE); 88 | noDatabase.setVisibility(View.VISIBLE); 89 | } 90 | } 91 | 92 | @Override 93 | public void databaseAvailable() { 94 | 95 | if (getView() != null) { 96 | setWebKitVisibility(); 97 | getWebKit().reloadPage(); 98 | } 99 | } 100 | 101 | @Override 102 | public void databaseUnavailable() { 103 | if (getView() != null) { 104 | setWebKitVisibility(); 105 | getWebKit().setForceLoadDuringReload(); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/logic/AverageAngle.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.logic; 2 | 3 | /** 4 | * Created by nkuebler on 14/07/14. 5 | */ 6 | public class AverageAngle 7 | { 8 | private double[] mValues; 9 | private int mCurrentIndex; 10 | private int mNumberOfFrames; 11 | private boolean mIsFull; 12 | private double mAverageValue = Double.NaN; 13 | 14 | public AverageAngle(int frames) 15 | { 16 | this.mNumberOfFrames = frames; 17 | this.mCurrentIndex = 0; 18 | this.mValues = new double[frames]; 19 | } 20 | 21 | public void add(double d) 22 | { 23 | mValues[mCurrentIndex] = d; 24 | if (mCurrentIndex == mNumberOfFrames - 1) { 25 | mCurrentIndex = 0; 26 | mIsFull = true; 27 | } else { 28 | mCurrentIndex++; 29 | } 30 | updateAverageValue(); 31 | } 32 | 33 | public double getAverage() 34 | { 35 | return this.mAverageValue; 36 | } 37 | 38 | private void updateAverageValue() 39 | { 40 | int numberOfElementsToConsider = mNumberOfFrames; 41 | if (!mIsFull) { 42 | numberOfElementsToConsider = mCurrentIndex + 1; 43 | } 44 | 45 | if (numberOfElementsToConsider == 1) { 46 | this.mAverageValue = mValues[0]; 47 | return; 48 | } 49 | 50 | // Formula: http://en.wikipedia.org/wiki/Circular_mean 51 | double sumSin = 0.0; 52 | double sumCos = 0.0; 53 | for (int i = 0; i < numberOfElementsToConsider; i++) { 54 | double v = mValues[i]; 55 | sumSin += Math.sin(v); 56 | sumCos += Math.cos(v); 57 | } 58 | this.mAverageValue = Math.atan2(sumSin, sumCos); 59 | } 60 | } -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/preferences/EditColorPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.preferences; 17 | 18 | import android.content.Context; 19 | import androidx.preference.Preference; 20 | import android.util.AttributeSet; 21 | import org.opendatakit.tables.views.ColorPickerDialog; 22 | import org.opendatakit.tables.views.ColorPickerDialog.OnColorChangedListener; 23 | 24 | /** 25 | * Preference for editing a color. 26 | * 27 | * @author sudar.sam@gmail.com 28 | */ 29 | public class EditColorPreference extends Preference { 30 | 31 | private Context mContext; 32 | 33 | /** 34 | * Default constructor, saves context 35 | * 36 | * @param context Passed into ColorPickerDialog 37 | * @param attrs unused 38 | */ 39 | public EditColorPreference(Context context, AttributeSet attrs) { 40 | super(context, attrs); 41 | this.mContext = context; 42 | } 43 | 44 | /** 45 | * Set the onPreferenceClickListener so that the color picker is created when 46 | * the preference is clicked. 47 | * 48 | * @param listener the interface that will receive the call 49 | * back when the dialog receives input--likely the calling activity. 50 | * @param key the String key that will be passed back via the callback so you 51 | * know which color preference has been edited 52 | * @param title the title of the dialog 53 | * @param initialColor the initial color the dialog should be set to 54 | */ 55 | public void initColorPickerListener(final OnColorChangedListener listener, final String key, 56 | final String title, final int initialColor) { 57 | this.setOnPreferenceClickListener(new OnPreferenceClickListener() { 58 | @Override 59 | public boolean onPreferenceClick(Preference preference) { 60 | new ColorPickerDialog(mContext, listener, key, initialColor, initialColor, title).show(); 61 | return true; 62 | } 63 | }); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/preferences/EditNameDialogPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.preferences; 17 | 18 | import android.content.Context; 19 | import android.preference.DialogPreference; 20 | import android.util.AttributeSet; 21 | 22 | /** 23 | * Basic dialog to allow editing a text field 24 | *

25 | * Based on Android's EditTextPreference class. 26 | * 27 | * @author sudar.sam@gmail.com 28 | */ 29 | public class EditNameDialogPreference extends DialogPreference { 30 | 31 | /** 32 | * Default constructor 33 | * 34 | * @param context unused 35 | * @param attrs unused 36 | */ 37 | public EditNameDialogPreference(Context context, AttributeSet attrs) { 38 | super(context, attrs); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/tasks/ExportRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.tasks; 17 | 18 | /** 19 | * this class describes a request to export a table to a csv file 20 | */ 21 | public class ExportRequest { 22 | 23 | // the app name 24 | private final String appName; 25 | // the id of the table to export 26 | private final String tableId; 27 | // the prefix for the filename of the exported csv files 28 | private final String fileQualifier; 29 | 30 | /** 31 | * All the actual exporting is handled by androidlibrary/builder/CsvUtil 32 | * 33 | * @param appName the app name 34 | * @param tableId the id of the table to export 35 | * @param fileQualifier the prefix for the filename of the exported csv files 36 | */ 37 | public ExportRequest(String appName, String tableId, String fileQualifier) { 38 | this.appName = appName; 39 | this.tableId = tableId; 40 | this.fileQualifier = fileQualifier; 41 | } 42 | 43 | /** 44 | * standard getter for the app name 45 | * 46 | * @return the app name 47 | */ 48 | public String getAppName() { 49 | return appName; 50 | } 51 | 52 | /** 53 | * standard getter for the table id 54 | * 55 | * @return the id of the table to export 56 | */ 57 | public String getTableId() { 58 | return tableId; 59 | } 60 | 61 | /** 62 | * standard getter for the file qualifier 63 | * 64 | * @return the prefix for the csv filenames 65 | */ 66 | String getFileQualifier() { 67 | return fileQualifier; 68 | } 69 | } -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/tasks/ImportRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.tasks; 17 | 18 | /** 19 | * Describes a request to import a csv file 20 | */ 21 | public class ImportRequest { 22 | 23 | // The prefix for the csv file to import 24 | private final String fileQualifier; 25 | // whether to create the table if it doesn't already exist 26 | private final boolean createTable; 27 | // the id of the table to import 28 | private final String tableId; 29 | 30 | /** 31 | * forwards request to the three argument constructor 32 | * 33 | * @param tableId table id 34 | * @param fileQualifier filename prefix 35 | */ 36 | public ImportRequest(String tableId, String fileQualifier) { 37 | this(true, tableId, fileQualifier); 38 | } 39 | 40 | /** 41 | * simple constructor that stores its three arguments 42 | * 43 | * @param createTable whether to create the table if it doesn't exist 44 | * @param tableId the id of the table 45 | * @param fileQualifier the prefix for the csv file to import 46 | */ 47 | private ImportRequest(boolean createTable, String tableId, String fileQualifier) { 48 | this.createTable = createTable; 49 | this.tableId = tableId; 50 | this.fileQualifier = fileQualifier; 51 | } 52 | 53 | /** 54 | * standard getter for whether we should create the table if it doesn't already exist 55 | * 56 | * @return whether we should create the table if it doesn't already exist 57 | */ 58 | boolean getCreateTable() { 59 | return createTable; 60 | } 61 | 62 | /** 63 | * standard getter for the table id 64 | * 65 | * @return the table id 66 | */ 67 | public String getTableId() { 68 | return tableId; 69 | } 70 | 71 | /** 72 | * standard getter for the filename prefix 73 | * 74 | * @return the prefix for the filename 75 | */ 76 | String getFileQualifier() { 77 | return fileQualifier; 78 | } 79 | } -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/utils/DistanceUtil.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.utils; 2 | /* 3 | ###=================================================================================================== 4 | ### get distance in metres between 2 points: 5 | ### Vincenty Formula http://www.movable-type.co.uk/scripts/latlong-vincenty.html 6 | */ 7 | 8 | public final class DistanceUtil 9 | { 10 | public static double getDistance(double lat1, double lon1, double lat2, double lon2) 11 | { 12 | double a = 6378137, b = 6356752.314245, f = 1 / 298.257223563; 13 | double L = Math.toRadians(lon2 - lon1); 14 | double U1 = Math.atan((1 - f) * Math.tan(Math.toRadians(lat1))); 15 | double U2 = Math.atan((1 - f) * Math.tan(Math.toRadians(lat2))); 16 | double sinU1 = Math.sin(U1), cosU1 = Math.cos(U1); 17 | double sinU2 = Math.sin(U2), cosU2 = Math.cos(U2); 18 | double cosSqAlpha; 19 | double sinSigma; 20 | double cos2SigmaM; 21 | double cosSigma; 22 | double sigma; 23 | 24 | double lambda = L, lambdaP, iterLimit = 100; 25 | do 26 | { 27 | double sinLambda = Math.sin(lambda), cosLambda = Math.cos(lambda); 28 | sinSigma = Math.sqrt( (cosU2 * sinLambda) 29 | * (cosU2 * sinLambda) 30 | + (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda) 31 | * (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda) 32 | ); 33 | if (sinSigma == 0) 34 | { 35 | return 0; 36 | } 37 | 38 | cosSigma = sinU1 * sinU2 + cosU1 * cosU2 * cosLambda; 39 | sigma = Math.atan2(sinSigma, cosSigma); 40 | double sinAlpha = cosU1 * cosU2 * sinLambda / sinSigma; 41 | cosSqAlpha = 1 - sinAlpha * sinAlpha; 42 | cos2SigmaM = cosSigma - 2 * sinU1 * sinU2 / cosSqAlpha; 43 | 44 | double C = f / 16 * cosSqAlpha * (4 + f * (4 - 3 * cosSqAlpha)); 45 | lambdaP = lambda; 46 | lambda = L + (1 - C) * f * sinAlpha 47 | * (sigma + C * sinSigma 48 | * (cos2SigmaM + C * cosSigma 49 | * (-1 + 2 * cos2SigmaM * cos2SigmaM) 50 | ) 51 | ); 52 | 53 | } while (Math.abs(lambda - lambdaP) > 1e-12 && --iterLimit > 0); 54 | 55 | if (iterLimit == 0) 56 | { 57 | return 0; 58 | } 59 | 60 | double uSq = cosSqAlpha * (a * a - b * b) / (b * b); 61 | double A = 1 + uSq / 16384 62 | * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq))); 63 | double B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq))); 64 | double deltaSigma = 65 | B * sinSigma 66 | * (cos2SigmaM + B / 4 67 | * (cosSigma 68 | * (-1 + 2 * cos2SigmaM * cos2SigmaM) - B / 6 * cos2SigmaM 69 | * (-3 + 4 * sinSigma * sinSigma) 70 | * (-3 + 4 * cos2SigmaM * cos2SigmaM))); 71 | 72 | double s = b * A * (sigma - deltaSigma); 73 | 74 | return s; 75 | } 76 | 77 | public static String getFormatedDistance(double distance) { 78 | String result = ""; 79 | if(distance >= 1000) { 80 | distance = distance/1000; 81 | result = String.format("%.2f", distance) + " km"; 82 | } else { 83 | result = String.format("%.0f", distance) + " m"; 84 | } 85 | 86 | return result; 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/utils/SQLQueryStruct.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.utils; 17 | 18 | import org.opendatakit.database.queries.BindArgs; 19 | 20 | /** 21 | * Basic holder for the components of a SQL query. 22 | * 23 | * @author sudar.sam@gmail.com 24 | */ 25 | public class SQLQueryStruct { 26 | 27 | /** 28 | * A sql clause that narrows down the list of returned rows 29 | */ 30 | public String whereClause; 31 | /** 32 | * TODO 33 | */ 34 | public BindArgs selectionArgs; 35 | /** 36 | * A list of columns to group by 37 | */ 38 | public String[] groupBy; 39 | /** 40 | * A SQL having clause 41 | */ 42 | public String having; 43 | /** 44 | * The column id of the column to sort the results by 45 | */ 46 | public String orderByElementKey; 47 | /** 48 | * the direction to sort by, ASC for ascending, DESC for descending 49 | */ 50 | public String orderByDirection; 51 | 52 | /** 53 | * A simple constructor that stores its properties 54 | * 55 | * @param whereClause A sql clause that narrows down the list of returned rows 56 | * @param selectionArgs TODO 57 | * @param groupBy A list of columns to group by 58 | * @param having A SQL having clause 59 | * @param orderByElementKey The column id of the column to sort the results by 60 | * @param orderByDirection the direction to sort by, ASC for ascending, DESC for descending 61 | */ 62 | public SQLQueryStruct(String whereClause, BindArgs selectionArgs, String[] groupBy, String having, 63 | String orderByElementKey, String orderByDirection) { 64 | this.whereClause = whereClause; 65 | this.selectionArgs = selectionArgs; 66 | this.groupBy = groupBy; 67 | this.having = having; 68 | this.orderByElementKey = orderByElementKey; 69 | this.orderByDirection = orderByDirection; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/utils/TableFileUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.utils; 17 | 18 | import android.util.Log; 19 | import org.opendatakit.utilities.ODKFileUtils; 20 | 21 | /** 22 | * This is a general place for utils regarding odktables files. These are files 23 | * that are associated with various tables, such as html files for different 24 | * views, etc. 25 | * 26 | * @author sudar.sam@gmail.com 27 | */ 28 | public final class TableFileUtils { 29 | 30 | private static final String TAG = TableFileUtils.class.getSimpleName(); 31 | 32 | /** 33 | * Do not instantiate this class 34 | */ 35 | private TableFileUtils() { 36 | } 37 | 38 | public static String getDefaultAppName() { 39 | Log.i(TAG, "appName is null on intent"); 40 | return ODKFileUtils.getOdkDefaultAppName(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/utils/TableNameStruct.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.utils; 17 | 18 | /** 19 | * Associates a table id with its name. 20 | * 21 | * @author sudar.sam@gmail.com 22 | */ 23 | public class TableNameStruct { 24 | 25 | private String mTableId; 26 | private String mLocalizedDisplayName; 27 | 28 | /** 29 | * Initializes 30 | * 31 | * @param tableId stored 32 | * @param localizedDisplayName stored 33 | */ 34 | public TableNameStruct(String tableId, String localizedDisplayName) { 35 | this.mTableId = tableId; 36 | this.mLocalizedDisplayName = localizedDisplayName; 37 | } 38 | 39 | public String getTableId() { 40 | return this.mTableId; 41 | } 42 | 43 | public String getLocalizedDisplayName() { 44 | return this.mLocalizedDisplayName; 45 | } 46 | 47 | @Override 48 | public int hashCode() { 49 | final int prime = 31; 50 | int result = 1; 51 | result = 52 | prime * result + (mLocalizedDisplayName == null ? 0 : mLocalizedDisplayName.hashCode()); 53 | result = prime * result + (mTableId == null ? 0 : mTableId.hashCode()); 54 | return result; 55 | } 56 | 57 | @Override 58 | public boolean equals(Object obj) { 59 | if (this == obj) 60 | return true; 61 | if (obj == null) 62 | return false; 63 | if (getClass() != obj.getClass()) 64 | return false; 65 | TableNameStruct other = (TableNameStruct) obj; 66 | if (mLocalizedDisplayName == null) { 67 | if (other.mLocalizedDisplayName != null) 68 | return false; 69 | } else if (!mLocalizedDisplayName.equals(other.mLocalizedDisplayName)) 70 | return false; 71 | if (mTableId == null) { 72 | if (other.mTableId != null) 73 | return false; 74 | } else if (!mTableId.equals(other.mTableId)) 75 | return false; 76 | return true; 77 | } 78 | 79 | @Override 80 | public String toString() { 81 | return "TableNameStruct [mTableId=" + mTableId + ", mLocalizedDisplayName=" 82 | + mLocalizedDisplayName + "]"; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/views/CellInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.views; 17 | 18 | import android.os.Parcel; 19 | import android.os.Parcelable; 20 | 21 | /** 22 | * Stores information about a cell, particularly the column, column position and row id 23 | */ 24 | public class CellInfo implements Parcelable { 25 | // elementKey may be null if we ever need a touch 26 | // listener on status column. For now, everything works. 27 | 28 | /** 29 | * Parcelable cruft 30 | */ 31 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { 32 | public CellInfo createFromParcel(Parcel in) { 33 | return new CellInfo(in); 34 | } 35 | 36 | public CellInfo[] newArray(int size) { 37 | return new CellInfo[size]; 38 | } 39 | }; 40 | /** 41 | * The ID of the row 42 | */ 43 | public final int rowId; 44 | // this is ONLY relevant to this TabularView 45 | /** 46 | * TODO document 47 | */ 48 | final int colPos; 49 | /** 50 | * The column of the cell 51 | */ 52 | public String elementKey; 53 | 54 | /** 55 | * TODO document 56 | * 57 | * @param elementKey 58 | * @param colPos 59 | * @param rowId 60 | */ 61 | CellInfo(String elementKey, int colPos, int rowId) { 62 | this.elementKey = elementKey; 63 | this.colPos = colPos; 64 | this.rowId = rowId; 65 | } 66 | 67 | private CellInfo(Parcel in) { 68 | if (in.readByte() == 1) { 69 | elementKey = in.readString(); 70 | } 71 | rowId = in.readInt(); 72 | colPos = in.readInt(); 73 | } 74 | 75 | @Override 76 | public int describeContents() { 77 | return 0; 78 | } 79 | 80 | @Override 81 | public void writeToParcel(Parcel dest, int flags) { 82 | if (elementKey == null) { 83 | dest.writeByte((byte) 0); 84 | } else { 85 | dest.writeByte((byte) 1); 86 | dest.writeString(elementKey); 87 | } 88 | dest.writeInt(rowId); 89 | dest.writeInt(colPos); 90 | } 91 | } -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/views/CompassView.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.views; 2 | 3 | /* 4 | * @author belendia@gmail.com 5 | */ 6 | 7 | import android.content.Context; 8 | import android.graphics.Canvas; 9 | import androidx.appcompat.widget.AppCompatImageView; 10 | import android.util.AttributeSet; 11 | 12 | public class CompassView extends AppCompatImageView { 13 | private float deg = 0; 14 | 15 | public CompassView(Context context, AttributeSet attrs) { 16 | super(context, attrs); 17 | } 18 | 19 | @Override 20 | protected void onDraw(Canvas canvas) { 21 | int width = getWidth(); 22 | int height = getHeight(); 23 | 24 | canvas.rotate(360 - deg, width/2, height/2); 25 | super.onDraw(canvas); 26 | } 27 | 28 | public void setDegrees(float degrees) { 29 | deg = degrees; 30 | invalidate(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/views/WScrollView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.views; 17 | 18 | import android.content.Context; 19 | import android.util.AttributeSet; 20 | import android.view.MotionEvent; 21 | import android.widget.HorizontalScrollView; 22 | import android.widget.ScrollView; 23 | 24 | /** 25 | * Modified HorizontalScrollView that communicates scroll actions to interior 26 | * Vertical scroll view. From: 27 | * http://stackoverflow.com/questions/3866499/two-directional-scroll-view 28 | *

29 | * Usage: ScrollView sv = new ScrollView(this.getContext()); WScrollView hsv = 30 | * new WScrollView(this.getContext()); hsv.sv = sv; 31 | *

32 | * sv.addView(new ViewOfYourChoice(getContext()), new 33 | * LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); 34 | * hsv.addView(sv, new LayoutParams(LayoutParams.WRAP_CONTENT, 35 | * LayoutParams.MATCH_PARENT)); setContentView(hsv, new 36 | * LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); 37 | */ 38 | public class WScrollView extends HorizontalScrollView { 39 | /** 40 | * The internal scrollview, set by the client code 41 | */ 42 | public ScrollView sv; 43 | 44 | /** 45 | * Default one-argument constructor 46 | * @param context unused 47 | */ 48 | public WScrollView(Context context) { 49 | super(context); 50 | } 51 | 52 | /** 53 | * Default two-argument constructor 54 | * @param context unused 55 | * @param attrs unused 56 | */ 57 | public WScrollView(Context context, AttributeSet attrs) { 58 | super(context, attrs); 59 | } 60 | 61 | /** 62 | * Default three-argument constructor 63 | * @param context unused 64 | * @param attrs unused 65 | * @param defStyle unused 66 | */ 67 | public WScrollView(Context context, AttributeSet attrs, int defStyle) { 68 | super(context, attrs, defStyle); 69 | } 70 | 71 | @Override 72 | public boolean onTouchEvent(MotionEvent event) { 73 | try { 74 | boolean ret = super.onTouchEvent(event); 75 | ret |= sv.onTouchEvent(event); 76 | return ret; 77 | } catch (IllegalArgumentException ignored) { 78 | // just return false 79 | } 80 | return false; 81 | } 82 | 83 | @Override 84 | public boolean onInterceptTouchEvent(MotionEvent event) { 85 | try { 86 | boolean ret = super.onInterceptTouchEvent(event); 87 | ret |= sv.onInterceptTouchEvent(event); 88 | return ret; 89 | } catch (IllegalArgumentException ignored) { 90 | // just return false 91 | } 92 | return false; 93 | } 94 | } -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/views/components/TableNameStructAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.views.components; 17 | 18 | import androidx.annotation.NonNull; 19 | import android.view.LayoutInflater; 20 | import android.view.View; 21 | import android.widget.ArrayAdapter; 22 | import android.widget.ImageView; 23 | import android.widget.RelativeLayout; 24 | import android.widget.TextView; 25 | import org.opendatakit.tables.R; 26 | import org.opendatakit.tables.activities.AbsBaseActivity; 27 | import org.opendatakit.tables.utils.TableNameStruct; 28 | 29 | import java.util.List; 30 | 31 | /** 32 | * An adapter for displaying TableProperties. 33 | * 34 | * @author sudar.sam@gmail.com 35 | */ 36 | public class TableNameStructAdapter extends ArrayAdapter { 37 | 38 | /** 39 | * Used for logging 40 | */ 41 | @SuppressWarnings("unused") 42 | private static final String TAG = TableNameStructAdapter.class.getSimpleName(); 43 | 44 | /** 45 | * Constructs a new TableNameStructAdapter with a set of values to be added 46 | * 47 | * @param context unused 48 | * @param values All added to the array adapter 49 | */ 50 | public TableNameStructAdapter(AbsBaseActivity context, List values) { 51 | super(context, R.layout.row_item_with_preference); 52 | this.clear(); 53 | this.addAll(values); 54 | } 55 | 56 | @NonNull 57 | @Override 58 | public View getView(int position, android.view.View convertView, 59 | @NonNull android.view.ViewGroup parent) { 60 | if (convertView == null) { 61 | convertView = LayoutInflater.from(getContext()) 62 | .inflate(R.layout.row_item_with_preference, parent, false); 63 | } 64 | final RelativeLayout view = (RelativeLayout) convertView; 65 | TextView textView = view.findViewById(R.id.row_item_text); 66 | 67 | TableNameStruct nameStruct = getItem(position); 68 | if (nameStruct == null) { // should never happen 69 | TextView failure = new TextView(parent.getContext()); 70 | failure.setText(R.string.error); 71 | return failure; 72 | } 73 | 74 | textView.setText(nameStruct.getLocalizedDisplayName()); 75 | ImageView imageView = view.findViewById(R.id.row_item_icon); 76 | imageView.setOnClickListener(new View.OnClickListener() { 77 | 78 | @Override 79 | public void onClick(View v) { 80 | // We want to pop open the context menu. Therefore anything using this 81 | // must have registered the item for a click. 82 | view.performLongClick(); 83 | } 84 | }); 85 | return view; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/views/components/TableViewTypeAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 University of Washington 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package org.opendatakit.tables.views.components; 17 | 18 | import android.content.Context; 19 | import android.widget.ArrayAdapter; 20 | import org.opendatakit.data.TableViewType; 21 | import org.opendatakit.logging.WebLogger; 22 | import org.opendatakit.tables.data.PossibleTableViewTypes; 23 | 24 | /** 25 | * Adapter that displays {@see TableViewType} options. 26 | *

27 | * Used in DefaultViewTypePreference 28 | * 29 | * @author sudar.sam@gmail.com 30 | */ 31 | public class TableViewTypeAdapter extends ArrayAdapter { 32 | 33 | /** 34 | * Used for logging 35 | */ 36 | private static final String TAG = TableViewTypeAdapter.class.getSimpleName(); 37 | /** 38 | * The app name 39 | */ 40 | private final String mAppName; 41 | private PossibleTableViewTypes mPossibleViewTypes; 42 | private CharSequence[] mViewTypeValues; 43 | 44 | /** 45 | * Sets up local variables for a TableViewTypeAdapter 46 | * 47 | * @param context unused 48 | * @param appName the app name 49 | * @param resource unused 50 | * @param entries unused 51 | * @param entryValues A list of all view types, spreadsheet, list and map 52 | * @param viewTypes An object with methods that can tell us which view types (map, spreadsheet, 53 | * list) the user should be able to select 54 | */ 55 | public TableViewTypeAdapter(Context context, String appName, int resource, CharSequence[] entries, 56 | CharSequence[] entryValues, PossibleTableViewTypes viewTypes) { 57 | super(context, resource, entries); 58 | mAppName = appName; 59 | mViewTypeValues = entryValues; 60 | mPossibleViewTypes = viewTypes; 61 | } 62 | 63 | @Override 64 | public boolean areAllItemsEnabled() { 65 | // so we get asked about individual availability. 66 | return false; 67 | } 68 | 69 | @Override 70 | public boolean isEnabled(int position) { 71 | if (this.mPossibleViewTypes == null) { 72 | return false; 73 | } 74 | 75 | String currentItem = mViewTypeValues[position].toString(); 76 | if (currentItem.equals(TableViewType.SPREADSHEET.name())) { 77 | return mPossibleViewTypes.spreadsheetViewIsPossible(); 78 | } else if (currentItem.equals(TableViewType.LIST.name())) { 79 | return mPossibleViewTypes.listViewIsPossible(); 80 | } else if (currentItem.equals(TableViewType.MAP.name())) { 81 | return mPossibleViewTypes.mapViewIsPossible(); 82 | } else { 83 | // Enable it. 84 | WebLogger.getLogger(mAppName).e(TAG, "unrecognized entryValue: " + currentItem); 85 | return true; 86 | } 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /tables_app/src/main/java/org/opendatakit/tables/views/webkits/OdkTablesWebView.java: -------------------------------------------------------------------------------- 1 | package org.opendatakit.tables.views.webkits; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Context; 5 | import android.util.AttributeSet; 6 | import org.opendatakit.tables.activities.IOdkTablesActivity; 7 | import org.opendatakit.tables.utils.Constants; 8 | import org.opendatakit.views.ODKWebView; 9 | 10 | /** 11 | * @author mitchellsundt@gmail.com 12 | */ 13 | public class OdkTablesWebView extends ODKWebView { 14 | // Used for logging 15 | private static final String TAG = OdkTablesWebView.class.getSimpleName(); 16 | 17 | /** 18 | * IGNORE THE WARNINGS 19 | * This has to be a class property, or it will get garbage collected while the javascript is 20 | * still trying to use it 21 | */ 22 | @SuppressWarnings("FieldCanBeLocal") private OdkTables tables; 23 | 24 | /** 25 | * Constructs a new WebView for use with tables 26 | * 27 | * @param context Used to construct an OdkTables object 28 | * @param attrs unused 29 | */ 30 | /* Some information about the warning we're about to ignore 31 | * "For applications built for API levels below 17, WebView#addJavascriptInterface presents a 32 | * security hazard as JavaScript on the target web page has the ability to use reflection to 33 | * access the injected object's public fields and thus manipulate the host application in 34 | * unintended ways." 35 | * https://labs.mwrinfosecurity.com/blog/2013/09/24/ 36 | * webview-addjavascriptinterface-remote-code-execution/ 37 | */ 38 | @SuppressLint("AddJavascriptInterface") public OdkTablesWebView(Context context, 39 | AttributeSet attrs) { 40 | super(context, attrs); 41 | //setLayerType(View.LAYER_TYPE_SOFTWARE, null); 42 | // stomp on the odkTablesIf object... 43 | //noinspection ThisEscapedInObjectConstruction -- We're already in a stable state here 44 | tables = new OdkTables(context, this); 45 | addJavascriptInterface(tables.getJavascriptInterfaceWithWeakReference(), 46 | Constants.JavaScriptHandles.ODK_TABLES_IF); 47 | } 48 | 49 | @Override public boolean hasPageFramework() { 50 | return false; 51 | } 52 | 53 | /** 54 | * IMPORTANT: This function should only be called with the context of the database listeners 55 | * OR if called from elsewhere there should be an if statement before invoking that checks 56 | * if the database is currently available. 57 | */ 58 | @Override public void reloadPage() { 59 | 60 | log.i(TAG, "reloadPage: current loadPageUrl: " + getLoadPageUrl()); 61 | String baseUrl = ((IOdkTablesActivity) getOdkContext()) 62 | .getUrlBaseLocation(false, getContainerFragmentID()); 63 | 64 | if (baseUrl != null) { 65 | loadPageOnUiThread(baseUrl, getContainerFragmentID()); 66 | } else { 67 | log.w(TAG, "reloadPage: framework did not load -- cannot load anything!"); 68 | } 69 | 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/census_bearing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/census_bearing.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/compass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/compass.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/compass_heading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/compass_heading.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/ic_action_content_discard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/ic_action_content_discard.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/ic_add_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/ic_add_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/ic_archive_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/ic_archive_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/ic_export_csv_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/ic_export_csv_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/ic_forward_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/ic_forward_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/ic_import_csv_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/ic_import_csv_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/ic_mode_edit_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/ic_mode_edit_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/ic_search_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/ic_search_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/ic_sort_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/ic_sort_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/ic_unarchive_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/ic_unarchive_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/ic_view_headline_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/ic_view_headline_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/odk_tables_ab_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/odk_tables_ab_icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-hdpi/odk_tables_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-hdpi/odk_tables_icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-ldpi/odk_tables_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-ldpi/odk_tables_icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/ic_action_content_discard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/ic_action_content_discard.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/ic_add_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/ic_add_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/ic_archive_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/ic_archive_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/ic_export_csv_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/ic_export_csv_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/ic_forward_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/ic_forward_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/ic_import_csv_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/ic_import_csv_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/ic_mode_edit_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/ic_mode_edit_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/ic_search_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/ic_search_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/ic_sort_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/ic_sort_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/ic_unarchive_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/ic_unarchive_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/ic_view_headline_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/ic_view_headline_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/icon_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/icon_home.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/odk_tables_ab_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/odk_tables_ab_icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/odk_tables_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/odk_tables_icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/tables_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/tables_app.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-mdpi/tables_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-mdpi/tables_table.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/ic_action_content_discard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/ic_action_content_discard.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/ic_add_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/ic_add_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/ic_archive_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/ic_archive_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/ic_export_csv_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/ic_export_csv_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/ic_forward_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/ic_forward_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/ic_import_csv_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/ic_import_csv_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/ic_mode_edit_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/ic_mode_edit_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/ic_search_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/ic_search_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/ic_sort_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/ic_sort_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/ic_unarchive_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/ic_unarchive_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/ic_view_headline_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/ic_view_headline_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/odk_tables_ab_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/odk_tables_ab_icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xhdpi/odk_tables_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xhdpi/odk_tables_icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/ic_action_content_discard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/ic_action_content_discard.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/ic_add_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/ic_add_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/ic_archive_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/ic_archive_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/ic_export_csv_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/ic_export_csv_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/ic_forward_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/ic_forward_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/ic_import_csv_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/ic_import_csv_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/ic_mode_edit_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/ic_mode_edit_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/ic_search_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/ic_search_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/ic_sort_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/ic_sort_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/ic_unarchive_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/ic_unarchive_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/ic_view_headline_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/ic_view_headline_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/odk_tables_ab_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/odk_tables_ab_icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxhdpi/odk_tables_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxhdpi/odk_tables_icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/ic_add_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/ic_add_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/ic_archive_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/ic_archive_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/ic_export_csv_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/ic_export_csv_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/ic_forward_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/ic_forward_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/ic_import_csv_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/ic_import_csv_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/ic_mode_edit_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/ic_mode_edit_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/ic_search_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/ic_search_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/ic_sort_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/ic_sort_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/ic_unarchive_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/ic_unarchive_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/ic_view_headline_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/ic_view_headline_black_24dp.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/odk_tables_ab_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/odk_tables_ab_icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable-xxxhdpi/odk_tables_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odk-x/tables/87f0f3321d660d36aa2bb1a5696893f21be7f7da/tables_app/src/main/res/drawable-xxxhdpi/odk_tables_icon.png -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable/btn_item_no_shadow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable/clickable.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable/item_background_state.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable/my_border.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /tables_app/src/main/res/drawable/thumb.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout-land/map_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 23 | 24 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout-land/split_content_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 20 | 21 | 27 | 28 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/about_wrapper_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/activity_main_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/activity_table_display_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/activity_table_manager.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/activity_web_view_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/aggregate_choose_tables_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 19 | 20 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/col_manager.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 22 | 23 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/color_rule_manager.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 22 | 23 | 31 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/column_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/copy_expansion_files_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 32 | 33 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/defaultoptions_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 17 | 18 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/dv_wrapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/edit_default_form_preference.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 18 | 19 | 29 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/edit_listview_name_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/file_manager.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 19 | 20 | 25 | 26 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/fragment_color_rule_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/fragment_table_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 22 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/importexport_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 17 | 18 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/list_view_manager.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 22 | 23 | 31 | 32 | -------------------------------------------------------------------------------- /tables_app/src/main/res/layout/manage_property_sets.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 |