diff --git a/.travis.yml b/.travis.yml index 0865605f..078c182a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,12 +14,15 @@ cache: - $HOME/.gradle/caches/ - $HOME/.gradle/wrapper/ +before_install: + - echo yes | sdkmanager "build-tools;28.0.3" + android: components: # tools required - tools # The BuildTools version used by your project - - build-tools-28.0.0 + - build-tools-28.0.3 # The SDK version used to compile your projects - android-22 - android-28 diff --git a/build.gradle b/build.gradle index 6e088a79..64d9c8c2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,27 +1,27 @@ // 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" } } -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 +31,9 @@ subprojects { group = 'org.smartregister' - ext.androidToolsBuildGradle = '28.0.0' - ext.androidBuildToolsVersion = '28.0.0' + ext.androidToolsBuildGradleVersion = '3.6.4' + ext.androidBuildToolsVersion = '28.0.3' + ext.coverallsGradlePluginVersion = '2.8.3' ext.androidMinSdkVersion = 18 ext.androidCompileSdkVersion = 28 ext.androidTargetSdkVersion = 28 diff --git a/gradle.properties b/gradle.properties index 398951d0..2c1e01ca 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=0.0.21-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/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1513a230..51aaf25a 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 +#Tue Jul 21 00:53:45 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 fca40576..bd453178 100644 --- a/opensrp-reporting/build.gradle +++ b/opensrp-reporting/build.gradle @@ -6,20 +6,28 @@ buildscript { jcenter() } dependencies { - classpath "com.android.tools.build:gradle:3.1.2" - 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}" } } +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" } android { + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + compileSdkVersion androidCompileSdkVersion buildToolsVersion androidBuildToolsVersion @@ -29,7 +37,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 { @@ -73,16 +81,8 @@ 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.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' @@ -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,10 +113,12 @@ 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' + implementation "androidx.core:core-ktx:+" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } @@ -146,3 +148,6 @@ coveralls { } apply from: '../maven.gradle' +repositories { + mavenCentral() +} 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/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/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/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/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/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/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 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 41d07130..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,17 +1,17 @@ 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 android.support.v4.content.ContextCompat; +import androidx.annotation.NonNull; +import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; 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 00f19e7a..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 android.support.v4.content.ContextCompat; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; + +import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; +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/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"> - - 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/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..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 android.support.constraint.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; 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()); diff --git a/sample/build.gradle b/sample/build.gradle index 57ce21f2..9656d20d 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -4,22 +4,22 @@ buildscript { jcenter() } dependencies { - classpath "com.android.tools.build:gradle:3.1.2" - 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' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' android { + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + compileSdkVersion androidCompileSdkVersion buildToolsVersion androidBuildToolsVersion @@ -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,11 @@ 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' + implementation "androidx.core:core-ktx:+" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} +repositories { + mavenCentral() } 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 236f5396..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 android.support.v4.app.Fragment; -import android.support.v4.app.LoaderManager; -import android.support.v4.content.AsyncTaskLoader; -import android.support.v4.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 2cc26e33..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 android.support.v4.app.Fragment; -import android.support.v4.content.ContextCompat; +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 1e9d3d84..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,15 +1,16 @@ package org.smartregister.sample.view; 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 android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; - -import org.smartregister.reporting.contract.ReportContract; + +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; public class SampleActivity extends AppCompatActivity { @@ -20,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); @@ -39,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) { @@ -62,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 82973de1..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