From 9f6b896092c39ca746600aff6250e7eebeec6008 Mon Sep 17 00:00:00 2001 From: Allan O Date: Mon, 18 May 2020 09:05:28 +0300 Subject: [PATCH 01/17] :arrow_up: Update client-core dependency --- opensrp-reporting/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensrp-reporting/build.gradle b/opensrp-reporting/build.gradle index fca40576..72f35d68 100644 --- a/opensrp-reporting/build.gradle +++ b/opensrp-reporting/build.gradle @@ -82,7 +82,7 @@ allprojects { } dependencies { - implementation('org.smartregister:opensrp-client-core:1.9.3-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-core:1.10.5-SNAPSHOT@aar') { transitive = true exclude group: 'com.github.bmelnychuk', module: 'atv' exclude group: 'com.google.guava', module: 'guava' From 20c75233f4c224616fbdee6033c9417f1ba8bdfc Mon Sep 17 00:00:00 2001 From: Allan O Date: Tue, 19 May 2020 08:15:16 +0300 Subject: [PATCH 02/17] :arrow_up: Enable useAndroidX & update gradle version --- gradle.properties | 4 +++- opensrp-reporting/build.gradle | 2 +- sample/build.gradle | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3c1d5a66..2c1e01ca 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=0.0.20-SNAPSHOT +VERSION_NAME=0.1.0-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Reporting Library @@ -11,5 +11,7 @@ POM_SETTING_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt POM_SETTING_LICENCE_DIST=repo POM_SETTING_DEVELOPER_ID=opensrp POM_SETTING_DEVELOPER_NAME=OpenSRP Onadev +android.useAndroidX=true +android.enableJetifier=true diff --git a/opensrp-reporting/build.gradle b/opensrp-reporting/build.gradle index 72f35d68..fa77db42 100644 --- a/opensrp-reporting/build.gradle +++ b/opensrp-reporting/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath "com.android.tools.build:gradle:3.1.2" + classpath "com.android.tools.build:gradle:3.2.0" classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2' } } diff --git a/sample/build.gradle b/sample/build.gradle index 57ce21f2..0ce7a7d4 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath "com.android.tools.build:gradle:3.1.2" + classpath "com.android.tools.build:gradle:3.2.0" classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2' } } From bb84f73ef918031bdf1745c3ba3a1c4a52080978 Mon Sep 17 00:00:00 2001 From: Allan O Date: Tue, 19 May 2020 08:33:47 +0300 Subject: [PATCH 03/17] :fire: Migrate to AndroidX package namespace --- opensrp-reporting/build.gradle | 16 ++++++++-------- .../adapter/TableViewWidgetAdapter.java | 5 +++-- .../view/ReportingProcessingSnackbar.java | 2 +- .../smartregister/reporting/view/TableView.java | 2 +- .../view/NumericDisplayFactoryTest.java | 2 +- sample/build.gradle | 16 ++++++++-------- .../sample/view/DashboardFragment.java | 8 ++++---- .../sample/view/ResourcesFragment.java | 4 ++-- .../sample/view/SampleActivity.java | 9 ++++----- sample/src/main/res/layout/sample_activity.xml | 2 +- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/opensrp-reporting/build.gradle b/opensrp-reporting/build.gradle index fa77db42..812fe61a 100644 --- a/opensrp-reporting/build.gradle +++ b/opensrp-reporting/build.gradle @@ -29,7 +29,7 @@ android { versionCode Integer.parseInt(project.VERSION_CODE) versionName project.VERSION_NAME multiDexEnabled true - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { @@ -90,11 +90,11 @@ dependencies { exclude group: 'org.apache.httpcomponents', module: 'httpmime' } - implementation 'com.android.support:appcompat-v7:28.0.0' - implementation 'com.android.support:support-v4:28.0.0' - implementation 'com.android.support:recyclerview-v7:28.0.0' - implementation 'com.android.support:design:28.0.0' - implementation 'com.android.support.constraint:constraint-layout:1.1.3' + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.recyclerview:recyclerview:1.0.0' + implementation 'com.google.android.material:material:1.0.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.github.lecho:hellocharts-library:1.5.8@aar' implementation 'com.google.guava:guava:20.0' @@ -113,8 +113,8 @@ dependencies { testImplementation "org.powermock:powermock-api-mockito2:$powerMockVersion" testImplementation "org.powermock:powermock-classloading-xstream:$powerMockVersion" testImplementation 'org.skyscreamer:jsonassert:1.5.0' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' implementation group: 'org.yaml', name: 'snakeyaml', version: '1.23' diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/adapter/TableViewWidgetAdapter.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/adapter/TableViewWidgetAdapter.java index b97caf15..fdda98bc 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/adapter/TableViewWidgetAdapter.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/adapter/TableViewWidgetAdapter.java @@ -3,14 +3,15 @@ import android.content.Context; import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.LayerDrawable; -import android.support.v4.widget.TextViewCompat; -import android.support.v7.widget.RecyclerView; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.core.widget.TextViewCompat; +import androidx.recyclerview.widget.RecyclerView; + import org.smartregister.reporting.R; import org.smartregister.reporting.view.TableView; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingSnackbar.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingSnackbar.java index 41d07130..8a0eb36b 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingSnackbar.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingSnackbar.java @@ -5,7 +5,7 @@ import android.support.design.widget.BaseTransientBottomBar; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.Snackbar; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/TableView.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/TableView.java index 00f19e7a..12d6893e 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/TableView.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/TableView.java @@ -7,7 +7,7 @@ import android.os.Bundle; import android.os.Parcelable; import android.support.annotation.Nullable; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; diff --git a/opensrp-reporting/src/test/java/org/smartregister/reporting/view/NumericDisplayFactoryTest.java b/opensrp-reporting/src/test/java/org/smartregister/reporting/view/NumericDisplayFactoryTest.java index c220cc1d..3c7f67fb 100644 --- a/opensrp-reporting/src/test/java/org/smartregister/reporting/view/NumericDisplayFactoryTest.java +++ b/opensrp-reporting/src/test/java/org/smartregister/reporting/view/NumericDisplayFactoryTest.java @@ -1,7 +1,7 @@ package org.smartregister.reporting.view; import android.content.Context; -import android.support.constraint.ConstraintLayout; +import androidx.constraintlayout.ConstraintLayout; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; diff --git a/sample/build.gradle b/sample/build.gradle index 0ce7a7d4..1ded7072 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -30,7 +30,7 @@ android { versionCode 1 versionName "1.0" multiDexEnabled true - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -92,11 +92,11 @@ dependencies { implementation project(":opensrp-reporting") implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' - - implementation 'com.android.support:support-media-compat:28.0.0' - implementation 'com.android.support:support-v4:28.0.0' - implementation 'com.android.support:appcompat-v7:28.0.0' - implementation 'com.android.support:design:28.0.0' + + implementation 'androidx.media:media:1.0.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'com.google.android.material:material:1.0.0' implementation 'de.hdodenhof:circleimageview:2.2.0' @@ -111,6 +111,6 @@ dependencies { testImplementation "org.powermock:powermock-classloading-xstream:$powerMockVersion" testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' } diff --git a/sample/src/main/java/org/smartregister/sample/view/DashboardFragment.java b/sample/src/main/java/org/smartregister/sample/view/DashboardFragment.java index 7c529ec1..853b8c46 100644 --- a/sample/src/main/java/org/smartregister/sample/view/DashboardFragment.java +++ b/sample/src/main/java/org/smartregister/sample/view/DashboardFragment.java @@ -4,10 +4,10 @@ import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v4.app.LoaderManager; -import android.support.v4.content.AsyncTaskLoader; -import android.support.v4.content.Loader; +import androidx.core.app.Fragment; +import androidx.core.app.LoaderManager; +import androidx.core.content.AsyncTaskLoader; +import androidx.core.content.Loader; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/org/smartregister/sample/view/ResourcesFragment.java b/sample/src/main/java/org/smartregister/sample/view/ResourcesFragment.java index 2cc26e33..21d6c2f0 100644 --- a/sample/src/main/java/org/smartregister/sample/view/ResourcesFragment.java +++ b/sample/src/main/java/org/smartregister/sample/view/ResourcesFragment.java @@ -3,8 +3,8 @@ import android.graphics.Typeface; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.content.ContextCompat; +import androidx.core.app.Fragment; +import androidx.core.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/org/smartregister/sample/view/SampleActivity.java b/sample/src/main/java/org/smartregister/sample/view/SampleActivity.java index 1e9d3d84..a81025fe 100644 --- a/sample/src/main/java/org/smartregister/sample/view/SampleActivity.java +++ b/sample/src/main/java/org/smartregister/sample/view/SampleActivity.java @@ -2,14 +2,13 @@ import android.os.Bundle; import android.support.design.widget.TabLayout; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.view.ViewPager; +import androidx.core.app.Fragment; +import androidx.core.app.FragmentManager; +import androidx.core.app.FragmentPagerAdapter; +import androidx.core.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; -import org.smartregister.reporting.contract.ReportContract; import org.smartregister.sample.R; public class SampleActivity extends AppCompatActivity { diff --git a/sample/src/main/res/layout/sample_activity.xml b/sample/src/main/res/layout/sample_activity.xml index 82973de1..fcdcd095 100644 --- a/sample/src/main/res/layout/sample_activity.xml +++ b/sample/src/main/res/layout/sample_activity.xml @@ -59,7 +59,7 @@ - Date: Fri, 29 May 2020 07:05:16 +0300 Subject: [PATCH 04/17] :recycle: Accept Android SDK licence for build-tools 28 --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0865605f..4a296872 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,9 @@ cache: - $HOME/.gradle/caches/ - $HOME/.gradle/wrapper/ +before_install: + - yes | sdkmanager "platforms;android-28" + android: components: # tools required From 1c5e86bbbae21981a38d8cc90688466cc1ec6fc3 Mon Sep 17 00:00:00 2001 From: Allan O Date: Fri, 29 May 2020 07:54:31 +0300 Subject: [PATCH 05/17] :wrench: Update Travis build-tools version and explicitly accept version licence --- .travis.yml | 4 ++-- build.gradle | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4a296872..c0b39270 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,14 +15,14 @@ cache: - $HOME/.gradle/wrapper/ before_install: - - yes | sdkmanager "platforms;android-28" + - echo yes | sdkmanager "build-tools;28.0.2" android: components: # tools required - tools # The BuildTools version used by your project - - build-tools-28.0.0 + - build-tools-28.0.2 # The SDK version used to compile your projects - android-22 - android-28 diff --git a/build.gradle b/build.gradle index 6e088a79..0390894b 100644 --- a/build.gradle +++ b/build.gradle @@ -31,8 +31,8 @@ subprojects { group = 'org.smartregister' - ext.androidToolsBuildGradle = '28.0.0' - ext.androidBuildToolsVersion = '28.0.0' + ext.androidToolsBuildGradle = '3.2.0' + ext.androidBuildToolsVersion = '28.0.2' ext.androidMinSdkVersion = 18 ext.androidCompileSdkVersion = 28 ext.androidTargetSdkVersion = 28 From 2dded3e827944df10a9a23b08a95ed02872ea771 Mon Sep 17 00:00:00 2001 From: Allan O Date: Fri, 29 May 2020 08:49:46 +0300 Subject: [PATCH 06/17] :alien: Update imports from correct AndroidX namespace Update namespace for imports --- .../smartregister/reporting/ReportingLibrary.java | 3 +-- .../reporting/dao/ReportIndicatorDaoImpl.java | 7 ++++--- .../reporting/domain/CompositeIndicatorTally.java | 4 ++-- .../reporting/domain/IndicatorQuery.java | 2 +- .../reporting/event/IndicatorTallyEvent.java | 2 +- .../exception/MultiResultProcessorException.java | 2 +- .../reporting/job/IndicatorGeneratorJobCreator.java | 5 +++-- .../job/RecurringIndicatorGeneratingJob.java | 3 ++- .../processor/DefaultMultiResultProcessor.java | 2 +- .../reporting/processor/MultiResultProcessor.java | 2 +- .../repository/DailyIndicatorCountRepository.java | 7 ++++--- .../repository/IndicatorQueryRepository.java | 6 ++++-- .../smartregister/reporting/util/ReportingUtils.java | 2 +- .../org/smartregister/reporting/util/ViewUtils.java | 10 ++++++---- .../reporting/view/ProgressIndicatorView.java | 3 ++- .../reporting/view/ReportingProcessingSnackbar.java | 12 ++++++------ .../reporting/view/ReportingProcessingView.java | 8 +++++--- .../org/smartregister/reporting/view/TableView.java | 8 +++++--- .../reporting/view/NumericDisplayFactoryTest.java | 3 ++- 19 files changed, 52 insertions(+), 39 deletions(-) diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/ReportingLibrary.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/ReportingLibrary.java index 0d4d9f86..10ea7ba8 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/ReportingLibrary.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/ReportingLibrary.java @@ -1,7 +1,6 @@ package org.smartregister.reporting; -import android.support.annotation.NonNull; -import android.util.Log; +import androidx.annotation.NonNull; import net.sqlcipher.database.SQLiteDatabase; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/dao/ReportIndicatorDaoImpl.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/dao/ReportIndicatorDaoImpl.java index c6fdaec3..ec7694da 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/dao/ReportIndicatorDaoImpl.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/dao/ReportIndicatorDaoImpl.java @@ -1,10 +1,11 @@ package org.smartregister.reporting.dao; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; import android.text.TextUtils; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; + import com.google.gson.Gson; import net.sqlcipher.Cursor; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/CompositeIndicatorTally.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/CompositeIndicatorTally.java index a7ea7f4d..40c6c114 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/CompositeIndicatorTally.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/CompositeIndicatorTally.java @@ -1,7 +1,7 @@ package org.smartregister.reporting.domain; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import java.util.Date; import java.util.List; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorQuery.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorQuery.java index c825d1ac..a531c82b 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorQuery.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorQuery.java @@ -1,6 +1,6 @@ package org.smartregister.reporting.domain; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import java.util.List; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/event/IndicatorTallyEvent.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/event/IndicatorTallyEvent.java index 2c35336b..d1c5d055 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/event/IndicatorTallyEvent.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/event/IndicatorTallyEvent.java @@ -1,6 +1,6 @@ package org.smartregister.reporting.event; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.smartregister.reporting.domain.TallyStatus; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/exception/MultiResultProcessorException.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/exception/MultiResultProcessorException.java index 73cd9415..405fb204 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/exception/MultiResultProcessorException.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/exception/MultiResultProcessorException.java @@ -1,6 +1,6 @@ package org.smartregister.reporting.exception; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.smartregister.reporting.domain.CompositeIndicatorTally; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/job/IndicatorGeneratorJobCreator.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/job/IndicatorGeneratorJobCreator.java index 63c2e99b..4918acc3 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/job/IndicatorGeneratorJobCreator.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/job/IndicatorGeneratorJobCreator.java @@ -1,9 +1,10 @@ package org.smartregister.reporting.job; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.util.Log; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import com.evernote.android.job.Job; import com.evernote.android.job.JobCreator; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/job/RecurringIndicatorGeneratingJob.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/job/RecurringIndicatorGeneratingJob.java index e9b388d5..1cffdaf9 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/job/RecurringIndicatorGeneratingJob.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/job/RecurringIndicatorGeneratingJob.java @@ -1,9 +1,10 @@ package org.smartregister.reporting.job; import android.content.Intent; -import android.support.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; + import org.smartregister.AllConstants; import org.smartregister.job.BaseJob; import org.smartregister.reporting.service.IndicatorGeneratorIntentService; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/processor/DefaultMultiResultProcessor.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/processor/DefaultMultiResultProcessor.java index 79b5abef..25d7a155 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/processor/DefaultMultiResultProcessor.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/processor/DefaultMultiResultProcessor.java @@ -1,6 +1,6 @@ package org.smartregister.reporting.processor; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/processor/MultiResultProcessor.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/processor/MultiResultProcessor.java index 12ecd576..47b36576 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/processor/MultiResultProcessor.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/processor/MultiResultProcessor.java @@ -1,6 +1,6 @@ package org.smartregister.reporting.processor; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.smartregister.reporting.domain.CompositeIndicatorTally; import org.smartregister.reporting.domain.IndicatorTally; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/repository/DailyIndicatorCountRepository.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/repository/DailyIndicatorCountRepository.java index 76a9e624..6b170c6a 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/repository/DailyIndicatorCountRepository.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/repository/DailyIndicatorCountRepository.java @@ -2,9 +2,10 @@ import android.content.ContentValues; import android.database.SQLException; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/repository/IndicatorQueryRepository.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/repository/IndicatorQueryRepository.java index 9da2504a..3bd880b6 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/repository/IndicatorQueryRepository.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/repository/IndicatorQueryRepository.java @@ -1,10 +1,12 @@ package org.smartregister.reporting.repository; import android.content.ContentValues; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; + import android.text.TextUtils; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/util/ReportingUtils.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/util/ReportingUtils.java index 9d313de1..cc2bfdd0 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/util/ReportingUtils.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/util/ReportingUtils.java @@ -1,6 +1,6 @@ package org.smartregister.reporting.util; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import net.sqlcipher.Cursor; import net.sqlcipher.database.SQLiteDatabase; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/util/ViewUtils.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/util/ViewUtils.java index 52350d40..7362e730 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/util/ViewUtils.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/util/ViewUtils.java @@ -1,13 +1,15 @@ package org.smartregister.reporting.util; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.design.widget.BaseTransientBottomBar; -import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import com.google.android.material.snackbar.BaseTransientBottomBar; + import org.smartregister.reporting.view.ReportingProcessingSnackbar; /** diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ProgressIndicatorView.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ProgressIndicatorView.java index ce61f0e8..9baf76e2 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ProgressIndicatorView.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ProgressIndicatorView.java @@ -12,7 +12,6 @@ import android.os.Build; import android.os.Bundle; import android.os.Parcelable; -import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.AttributeSet; import android.view.Gravity; @@ -21,6 +20,8 @@ import android.widget.ProgressBar; import android.widget.TextView; +import androidx.annotation.Nullable; + import org.smartregister.reporting.R; import timber.log.Timber; diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingSnackbar.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingSnackbar.java index 8a0eb36b..9924dfbd 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingSnackbar.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingSnackbar.java @@ -1,10 +1,7 @@ package org.smartregister.reporting.view; - -import android.support.annotation.NonNull; -import android.support.design.widget.BaseTransientBottomBar; -import android.support.design.widget.CoordinatorLayout; -import android.support.design.widget.Snackbar; +import androidx.annotation.NonNull; +import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; @@ -12,6 +9,9 @@ import android.view.ViewParent; import android.widget.FrameLayout; +import com.google.android.material.snackbar.BaseTransientBottomBar; +import com.google.android.material.snackbar.Snackbar; + import org.smartregister.reporting.R; @@ -22,7 +22,7 @@ public class ReportingProcessingSnackbar extends BaseTransientBottomBar { protected ReportingProcessingSnackbar(@NonNull ViewGroup parent, @NonNull View content - , @NonNull android.support.design.snackbar.ContentViewCallback contentViewCallback) { + , @NonNull ContentViewCallback contentViewCallback) { super(parent, content, contentViewCallback); getView().setBackgroundColor(ContextCompat.getColor(parent.getContext(), android.R.color.transparent)); diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingView.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingView.java index 75e11df5..d6fc454b 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingView.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/ReportingProcessingView.java @@ -4,13 +4,15 @@ import android.annotation.TargetApi; import android.content.Context; import android.os.Build; -import android.support.annotation.Nullable; -import android.support.design.snackbar.ContentViewCallback; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.MotionEvent; import android.widget.LinearLayout; +import androidx.annotation.Nullable; + +import com.google.android.material.snackbar.BaseTransientBottomBar; + import org.smartregister.reporting.R; @@ -18,7 +20,7 @@ * Created by Ephraim Kigamba - ekigamba@ona.io on 2019-06-27 */ -public class ReportingProcessingView extends LinearLayout implements ContentViewCallback { +public class ReportingProcessingView extends LinearLayout implements BaseTransientBottomBar.ContentViewCallback { public ReportingProcessingView(Context context) { super(context); diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/TableView.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/TableView.java index 12d6893e..2a9027e7 100644 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/view/TableView.java +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/view/TableView.java @@ -6,10 +6,12 @@ import android.graphics.drawable.GradientDrawable; import android.os.Bundle; import android.os.Parcelable; -import android.support.annotation.Nullable; + +import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import android.util.AttributeSet; import android.view.Gravity; import android.widget.LinearLayout; diff --git a/opensrp-reporting/src/test/java/org/smartregister/reporting/view/NumericDisplayFactoryTest.java b/opensrp-reporting/src/test/java/org/smartregister/reporting/view/NumericDisplayFactoryTest.java index 3c7f67fb..387d3391 100644 --- a/opensrp-reporting/src/test/java/org/smartregister/reporting/view/NumericDisplayFactoryTest.java +++ b/opensrp-reporting/src/test/java/org/smartregister/reporting/view/NumericDisplayFactoryTest.java @@ -1,11 +1,12 @@ package org.smartregister.reporting.view; import android.content.Context; -import androidx.constraintlayout.ConstraintLayout; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; +import androidx.constraintlayout.widget.ConstraintLayout; + import org.junit.Assert; import org.junit.Before; import org.junit.Rule; From a081a96bb0ceb44ec883969eea49b97f406bbb55 Mon Sep 17 00:00:00 2001 From: Allan O Date: Mon, 1 Jun 2020 13:55:17 +0300 Subject: [PATCH 07/17] :bug: Fix RecyclerView widget package namespace Fix namespace for RecyclerView widget used in TableView layout --- opensrp-reporting/src/main/res/layout/table_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opensrp-reporting/src/main/res/layout/table_view.xml b/opensrp-reporting/src/main/res/layout/table_view.xml index e69871d0..5f4abd35 100644 --- a/opensrp-reporting/src/main/res/layout/table_view.xml +++ b/opensrp-reporting/src/main/res/layout/table_view.xml @@ -5,13 +5,13 @@ android:background="@drawable/table_view_border" android:orientation="vertical"> - - From ea633feeb6ac1f97f267a94b639c7416affd46c7 Mon Sep 17 00:00:00 2001 From: Allan O Date: Mon, 1 Jun 2020 23:03:30 +0300 Subject: [PATCH 08/17] :recycle: Trigger Coveralls From 23a0c051bc66330660923540e4eaa652fe06edee Mon Sep 17 00:00:00 2001 From: Allan O Date: Tue, 9 Jun 2020 07:44:40 +0300 Subject: [PATCH 09/17] :recycle: Trigger build From 107101306e268e8a4158f8777edf5750d5debbd0 Mon Sep 17 00:00:00 2001 From: Allan O Date: Wed, 15 Jul 2020 18:17:14 +0300 Subject: [PATCH 10/17] :hammer: Update lib Gradle configs to reference ext versions & set compileOptions --- build.gradle | 25 +++++++++++------------- gradle/wrapper/gradle-wrapper.properties | 4 ++-- opensrp-reporting/build.gradle | 18 ++++++++--------- sample/build.gradle | 18 ++++++++--------- 4 files changed, 29 insertions(+), 36 deletions(-) diff --git a/build.gradle b/build.gradle index 0390894b..d99a96de 100644 --- a/build.gradle +++ b/build.gradle @@ -10,18 +10,14 @@ buildscript { } } -configure(allprojects) { project -> - - version = VERSION_NAME - group = GROUP - buildscript { - repositories { - google() - jcenter() - mavenCentral() - maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } - mavenLocal() - } +allprojects { + repositories { + google() + jcenter() + mavenCentral() + maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } + maven { url "https://s3.amazonaws.com/repo.commonsware.com" } + mavenLocal() } } @@ -31,8 +27,9 @@ subprojects { group = 'org.smartregister' - ext.androidToolsBuildGradle = '3.2.0' - ext.androidBuildToolsVersion = '28.0.2' + ext.androidToolsBuildGradleVersion = '3.6.3' + ext.androidBuildToolsVersion = '28.0.3' + ext.coverallsGradlePluginVersion = '2.8.3' ext.androidMinSdkVersion = 18 ext.androidCompileSdkVersion = 28 ext.androidTargetSdkVersion = 28 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1513a230..eaa19c0d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Mar 26 17:38:02 EAT 2019 +#Sun Jul 05 22:13:24 EAT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip \ No newline at end of file diff --git a/opensrp-reporting/build.gradle b/opensrp-reporting/build.gradle index 812fe61a..e8d71d09 100644 --- a/opensrp-reporting/build.gradle +++ b/opensrp-reporting/build.gradle @@ -6,8 +6,8 @@ buildscript { jcenter() } dependencies { - classpath "com.android.tools.build:gradle:3.2.0" - classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2' + classpath "com.android.tools.build:gradle:${androidToolsBuildGradleVersion}" + classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:${coverallsGradlePluginVersion}" } } @@ -20,6 +20,12 @@ jacoco { } android { + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + compileSdkVersion androidCompileSdkVersion buildToolsVersion androidBuildToolsVersion @@ -73,14 +79,6 @@ tasks.withType(Test) { jacoco.includeNoLocationClasses = true } -allprojects { - repositories { - maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } - maven { url "https://s3.amazonaws.com/repo.commonsware.com" } - mavenLocal() - } -} - dependencies { implementation('org.smartregister:opensrp-client-core:1.10.5-SNAPSHOT@aar') { transitive = true diff --git a/sample/build.gradle b/sample/build.gradle index 1ded7072..e633094b 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -4,22 +4,20 @@ buildscript { jcenter() } dependencies { - classpath "com.android.tools.build:gradle:3.2.0" - classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2' - } -} - -allprojects { - repositories { - maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } - maven { url "https://s3.amazonaws.com/repo.commonsware.com" } - mavenLocal() + classpath "com.android.tools.build:gradle:${androidToolsBuildGradleVersion}" + classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:${coverallsGradlePluginVersion}" } } apply plugin: 'com.android.application' android { + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + compileSdkVersion androidCompileSdkVersion buildToolsVersion androidBuildToolsVersion From 5072c899a6c073486a9836526bffbf6b1522c150 Mon Sep 17 00:00:00 2001 From: Allan O Date: Wed, 15 Jul 2020 18:44:30 +0300 Subject: [PATCH 11/17] :bug: Remove android.support namespace references --- .../src/main/AndroidManifest.xml | 2 +- .../dao/ReportIndicatorDaoImplTest.java | 2 +- .../sample/ExampleInstrumentedTest.java | 5 ++-- sample/src/main/AndroidManifest.xml | 2 +- .../sample/view/DashboardFragment.java | 13 ++++----- .../sample/view/ResourcesFragment.java | 3 ++- .../sample/view/SampleActivity.java | 27 ++++++++++--------- .../src/main/res/layout/sample_activity.xml | 22 +++++++-------- 8 files changed, 41 insertions(+), 35 deletions(-) diff --git a/opensrp-reporting/src/main/AndroidManifest.xml b/opensrp-reporting/src/main/AndroidManifest.xml index adf3ece4..130d97b6 100644 --- a/opensrp-reporting/src/main/AndroidManifest.xml +++ b/opensrp-reporting/src/main/AndroidManifest.xml @@ -7,7 +7,7 @@ android:label="@string/app_name" android:supportsRtl="true"> diff --git a/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java b/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java index 787310fb..9548bb3e 100644 --- a/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java +++ b/opensrp-reporting/src/test/java/org/smartregister/reporting/dao/ReportIndicatorDaoImplTest.java @@ -1,6 +1,6 @@ package org.smartregister.reporting.dao; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import net.sqlcipher.MatrixCursor; import net.sqlcipher.database.SQLiteDatabase; diff --git a/sample/src/androidTest/java/org/smartregister/sample/ExampleInstrumentedTest.java b/sample/src/androidTest/java/org/smartregister/sample/ExampleInstrumentedTest.java index 7724be0d..bee0a64d 100644 --- a/sample/src/androidTest/java/org/smartregister/sample/ExampleInstrumentedTest.java +++ b/sample/src/androidTest/java/org/smartregister/sample/ExampleInstrumentedTest.java @@ -1,8 +1,9 @@ package org.smartregister.sample; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; + +import androidx.test.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 504bc157..3e56f598 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -10,7 +10,7 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/sample/src/main/java/org/smartregister/sample/view/DashboardFragment.java b/sample/src/main/java/org/smartregister/sample/view/DashboardFragment.java index fa8b0887..38d2f06d 100644 --- a/sample/src/main/java/org/smartregister/sample/view/DashboardFragment.java +++ b/sample/src/main/java/org/smartregister/sample/view/DashboardFragment.java @@ -2,16 +2,17 @@ import android.content.Context; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import androidx.core.app.Fragment; -import androidx.core.app.LoaderManager; -import androidx.core.content.AsyncTaskLoader; -import androidx.core.content.Loader; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.loader.app.LoaderManager; +import androidx.loader.content.AsyncTaskLoader; +import androidx.loader.content.Loader; + import org.smartregister.reporting.contract.ReportContract; import org.smartregister.reporting.domain.IndicatorTally; import org.smartregister.reporting.domain.PieChartSlice; diff --git a/sample/src/main/java/org/smartregister/sample/view/ResourcesFragment.java b/sample/src/main/java/org/smartregister/sample/view/ResourcesFragment.java index 21d6c2f0..1bcf44c7 100644 --- a/sample/src/main/java/org/smartregister/sample/view/ResourcesFragment.java +++ b/sample/src/main/java/org/smartregister/sample/view/ResourcesFragment.java @@ -3,8 +3,9 @@ import android.graphics.Typeface; import android.os.Bundle; -import androidx.core.app.Fragment; import androidx.core.content.ContextCompat; +import androidx.fragment.app.Fragment; + import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/org/smartregister/sample/view/SampleActivity.java b/sample/src/main/java/org/smartregister/sample/view/SampleActivity.java index a81025fe..77d8f704 100644 --- a/sample/src/main/java/org/smartregister/sample/view/SampleActivity.java +++ b/sample/src/main/java/org/smartregister/sample/view/SampleActivity.java @@ -1,13 +1,15 @@ package org.smartregister.sample.view; import android.os.Bundle; -import android.support.design.widget.TabLayout; -import androidx.core.app.Fragment; -import androidx.core.app.FragmentManager; -import androidx.core.app.FragmentPagerAdapter; -import androidx.core.view.ViewPager; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.ViewPager; + +import com.google.android.material.tabs.TabLayout; import org.smartregister.sample.R; @@ -19,6 +21,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.sample_activity); setUpViews(); } + private void setUpViews() { Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); @@ -38,6 +41,11 @@ private void setUpViews() { tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager)); } + @Override + protected void onResume() { + super.onResume(); + } + public class SectionsPagerAdapter extends FragmentPagerAdapter { public SectionsPagerAdapter(FragmentManager fm) { @@ -61,9 +69,4 @@ public int getCount() { return 2; } } - - @Override - protected void onResume() { - super.onResume(); - } } diff --git a/sample/src/main/res/layout/sample_activity.xml b/sample/src/main/res/layout/sample_activity.xml index fcdcd095..8276b1e4 100644 --- a/sample/src/main/res/layout/sample_activity.xml +++ b/sample/src/main/res/layout/sample_activity.xml @@ -1,5 +1,5 @@ - - - - + - - - - - + + - - \ No newline at end of file + \ No newline at end of file From 013c1a91c97cc4168b7a0c077c653c3178200bfb Mon Sep 17 00:00:00 2001 From: Allan O Date: Wed, 15 Jul 2020 19:36:36 +0300 Subject: [PATCH 12/17] :recycle: Trigger build From 5a29a7a2185e342c12b7ef7c0f2158745a7f2baa Mon Sep 17 00:00:00 2001 From: Allan O Date: Wed, 15 Jul 2020 21:36:34 +0300 Subject: [PATCH 13/17] :hammer: Accept buildTools 28.0.3 licence --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c0b39270..078c182a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,14 +15,14 @@ cache: - $HOME/.gradle/wrapper/ before_install: - - echo yes | sdkmanager "build-tools;28.0.2" + - echo yes | sdkmanager "build-tools;28.0.3" android: components: # tools required - tools # The BuildTools version used by your project - - build-tools-28.0.2 + - build-tools-28.0.3 # The SDK version used to compile your projects - android-22 - android-28 From 8ccbae1f0a17b1d7dc51d978e274351541e872ce Mon Sep 17 00:00:00 2001 From: Allan O Date: Fri, 17 Jul 2020 20:52:31 +0300 Subject: [PATCH 14/17] :white_check_mark: Fix failing tests --- .../reporting/view/ProgressIndicatorViewTest.java | 6 ++++-- .../smartregister/reporting/view/TableViewTest.java | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/opensrp-reporting/src/test/java/org/smartregister/reporting/view/ProgressIndicatorViewTest.java b/opensrp-reporting/src/test/java/org/smartregister/reporting/view/ProgressIndicatorViewTest.java index cbc805a1..e5f2ff2b 100644 --- a/opensrp-reporting/src/test/java/org/smartregister/reporting/view/ProgressIndicatorViewTest.java +++ b/opensrp-reporting/src/test/java/org/smartregister/reporting/view/ProgressIndicatorViewTest.java @@ -11,9 +11,9 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; +import org.robolectric.Robolectric; import org.robolectric.RuntimeEnvironment; import org.smartregister.reporting.BaseUnitTest; import org.smartregister.reporting.R; @@ -23,12 +23,14 @@ */ public class ProgressIndicatorViewTest extends BaseUnitTest { - @Mock private AttributeSet attributeSet; @Before public void setUp() { MockitoAnnotations.initMocks(this); + attributeSet = Robolectric.buildAttributeSet() + .addAttribute(R.attr.subtitle, "subtitle") + .build(); } @Test diff --git a/opensrp-reporting/src/test/java/org/smartregister/reporting/view/TableViewTest.java b/opensrp-reporting/src/test/java/org/smartregister/reporting/view/TableViewTest.java index 3eb96684..0fa3db50 100644 --- a/opensrp-reporting/src/test/java/org/smartregister/reporting/view/TableViewTest.java +++ b/opensrp-reporting/src/test/java/org/smartregister/reporting/view/TableViewTest.java @@ -12,6 +12,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; +import org.robolectric.Robolectric; import org.robolectric.RuntimeEnvironment; import org.smartregister.reporting.BaseUnitTest; import org.smartregister.reporting.R; @@ -23,12 +24,15 @@ */ public class TableViewTest extends BaseUnitTest { - @Mock private AttributeSet attributeSet; @Before public void setUp() { MockitoAnnotations.initMocks(this); + MockitoAnnotations.initMocks(this); + attributeSet = Robolectric.buildAttributeSet() + .addAttribute(R.attr.subtitle, "subtitle") + .build(); } @Test @@ -37,15 +41,12 @@ public void testConstructorsInstantiateSuccesfully() { TableView view = new TableView(RuntimeEnvironment.application); Assert.assertNotNull(view); - view = new TableView(RuntimeEnvironment.application, attributeSet); Assert.assertNotNull(view); - view = new TableView(RuntimeEnvironment.application, attributeSet, R.styleable.ProgressIndicatorView_progress); Assert.assertNotNull(view); - view = new TableView(RuntimeEnvironment.application, attributeSet, R.styleable.ProgressIndicatorView_progress, R.style.tableViewTestStyle); Assert.assertNotNull(view); } @@ -157,7 +158,6 @@ public void testSetTableDataInvokesRefreshLayoutMethod() { view.setRowTextColor(RuntimeEnvironment.application.getResources().getColor(R.color.dark_grey)); view.setRowBorderHidden(true); - view.setTableData(null, null); Assert.assertEquals(1, view.getColumnCount()); From 721edf70f17c1d4bba4807874ae5608220af4bc1 Mon Sep 17 00:00:00 2001 From: Allan O Date: Fri, 17 Jul 2020 21:15:35 +0300 Subject: [PATCH 15/17] :recycle: Trigger checks From 60d5ee3977b6d20e0f922a578cc9812cfec38037 Mon Sep 17 00:00:00 2001 From: Allan O Date: Tue, 21 Jul 2020 09:45:41 +0300 Subject: [PATCH 16/17] :recycle: Rewrite IndicatorYamlConfig & AppProperties Rewritten in Kotlin --- .../domain/IndicatorsYamlConfig.java | 15 -------------- .../reporting/domain/IndicatorsYamlConfig.kt | 6 ++++++ .../reporting/util/AppProperties.java | 20 ------------------- .../reporting/util/AppProperties.kt | 20 +++++++++++++++++++ 4 files changed, 26 insertions(+), 35 deletions(-) delete mode 100644 opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorsYamlConfig.java create mode 100644 opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorsYamlConfig.kt delete mode 100644 opensrp-reporting/src/main/java/org/smartregister/reporting/util/AppProperties.java create mode 100644 opensrp-reporting/src/main/java/org/smartregister/reporting/util/AppProperties.kt diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorsYamlConfig.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorsYamlConfig.java deleted file mode 100644 index 9946ba5d..00000000 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorsYamlConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.smartregister.reporting.domain; - -import java.util.List; - -public class IndicatorsYamlConfig { - private List indicators; - - public List getIndicators() { - return indicators; - } - - public void setIndicators(List indicators) { - this.indicators = indicators; - } -} diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorsYamlConfig.kt b/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorsYamlConfig.kt new file mode 100644 index 00000000..91e02a0c --- /dev/null +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/domain/IndicatorsYamlConfig.kt @@ -0,0 +1,6 @@ +package org.smartregister.reporting.domain + +class IndicatorsYamlConfig { + var indicators: List? = null + +} \ No newline at end of file diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/util/AppProperties.java b/opensrp-reporting/src/main/java/org/smartregister/reporting/util/AppProperties.java deleted file mode 100644 index 9d169683..00000000 --- a/opensrp-reporting/src/main/java/org/smartregister/reporting/util/AppProperties.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.smartregister.reporting.util; - -import java.util.Properties; - -/** - * Created by randati on 2019-09-02. - */ -public class AppProperties extends Properties { - public Boolean getPropertyBoolean(String key) { - return Boolean.valueOf(getProperty(key)); - } - - public Boolean hasProperty(String key) { - return getProperty(key) != null; - } - - public static class KEY { - public static final String COUNT_INCREMENTAL = "reporting.incremental"; - } -} diff --git a/opensrp-reporting/src/main/java/org/smartregister/reporting/util/AppProperties.kt b/opensrp-reporting/src/main/java/org/smartregister/reporting/util/AppProperties.kt new file mode 100644 index 00000000..caf39669 --- /dev/null +++ b/opensrp-reporting/src/main/java/org/smartregister/reporting/util/AppProperties.kt @@ -0,0 +1,20 @@ +package org.smartregister.reporting.util + +import java.util.* + +/** + * Created by randati on 2019-09-02. + */ +class AppProperties : Properties() { + fun getPropertyBoolean(key: String?): Boolean { + return java.lang.Boolean.valueOf(getProperty(key)) + } + + fun hasProperty(key: String?): Boolean { + return getProperty(key) != null + } + + object KEY { + const val COUNT_INCREMENTAL = "reporting.incremental" + } +} \ No newline at end of file From b337d64bc9ec8d5dd3f7e05e9f539bef7b69539b Mon Sep 17 00:00:00 2001 From: Allan O Date: Tue, 21 Jul 2020 09:51:02 +0300 Subject: [PATCH 17/17] :green_heart: Add Kotlin-Android & Kotlin-gradle plugins --- build.gradle | 6 +++++- gradle/wrapper/gradle-wrapper.properties | 2 +- opensrp-reporting/build.gradle | 9 ++++++++- sample/build.gradle | 7 +++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index d99a96de..64d9c8c2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,16 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { + ext.kotlin_version = '1.3.72' repositories { google() mavenCentral() + jcenter() } dependencies { classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0" + classpath "com.android.tools.build:gradle:3.6.4" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -27,7 +31,7 @@ subprojects { group = 'org.smartregister' - ext.androidToolsBuildGradleVersion = '3.6.3' + ext.androidToolsBuildGradleVersion = '3.6.4' ext.androidBuildToolsVersion = '28.0.3' ext.coverallsGradlePluginVersion = '2.8.3' ext.androidMinSdkVersion = 18 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index eaa19c0d..51aaf25a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -#Sun Jul 05 22:13:24 EAT 2020 +#Tue Jul 21 00:53:45 EAT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/opensrp-reporting/build.gradle b/opensrp-reporting/build.gradle index e8d71d09..bd453178 100644 --- a/opensrp-reporting/build.gradle +++ b/opensrp-reporting/build.gradle @@ -11,9 +11,11 @@ buildscript { } } +apply plugin: 'com.android.library' apply plugin: 'jacoco' apply plugin: 'com.github.kt3k.coveralls' -apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' jacoco { toolVersion = "0.8.0" @@ -115,6 +117,8 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' implementation group: 'org.yaml', name: 'snakeyaml', version: '1.23' + implementation "androidx.core:core-ktx:+" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } @@ -144,3 +148,6 @@ coveralls { } apply from: '../maven.gradle' +repositories { + mavenCentral() +} diff --git a/sample/build.gradle b/sample/build.gradle index e633094b..9656d20d 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -10,6 +10,8 @@ buildscript { } apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' android { @@ -111,4 +113,9 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' + implementation "androidx.core:core-ktx:+" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} +repositories { + mavenCentral() }