Skip to content

Commit

Permalink
Merge facb233 into 0da21a0
Browse files Browse the repository at this point in the history
  • Loading branch information
ekigamba committed Mar 1, 2021
2 parents 0da21a0 + facb233 commit fe1d40c
Show file tree
Hide file tree
Showing 21 changed files with 115 additions and 108 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Android CI with Gradle

on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]

jobs:
unit_tests:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Print Java version
run: java -version
- name: Uninstall NDK
run: sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --uninstall 'ndk-bundle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build project
run: ./gradlew opensrp-configurable-views:jacocoTestReport --stacktrace
- name: Run coveralls task
run: ./gradlew opensrp-configurable-views:coveralls --stacktrace
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
- name: Build APK (Maintain stability)
run: ./gradlew opensrp-configurable-views:assembleDebug --stacktrace
52 changes: 0 additions & 52 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ buildscript {
repositories {
google()
jcenter()
maven{ url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0"
classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.10.2'
}
}

Expand Down Expand Up @@ -32,7 +34,7 @@ subprojects {

group = 'org.smartregister'

ext.androidToolsBuildGradle = '3.1.2'
ext.androidToolsBuildGradle = '4.0.0'
ext.androidBuildToolsVersion = '28.0.3'
ext.androidMinSdkVersion = 18
ext.androidCompileSdkVersion = 28
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.1.5-SNAPSHOT
VERSION_NAME=1.2.0-PREVIEW-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Configurable Views Library
Expand All @@ -11,4 +11,6 @@ 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

8 changes: 2 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#Fri Feb 23 09:42:51 EAT 2018
#Fri Feb 26 16:29:57 EAT 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
22 changes: 12 additions & 10 deletions opensrp-configurable-views/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:" + androidToolsBuildGradle
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2'
}
}

Expand All @@ -18,6 +17,7 @@ allprojects {
maven {
url 'https://maven.google.com'
}
maven { url 'https://dl.bintray.com/ibm-watson-health/ibm-fhir-server-releases'}
}
}

Expand All @@ -41,7 +41,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 {
Expand Down Expand Up @@ -78,14 +78,16 @@ android {
includeAndroidResources = true
}
}

defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
}

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}

dependencies {
implementation('org.smartregister:opensrp-client-core:1.8.17-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-core:3.1.0-GS-PREVIEW-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.github.bmelnychuk', module: 'atv'
}
Expand All @@ -108,7 +110,7 @@ dependencies {
testImplementation "org.powermock:powermock-api-mockito2:$powerMockVersion"
testImplementation "org.powermock:powermock-classloading-xstream:$powerMockVersion"

androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
Expand Down Expand Up @@ -138,7 +140,7 @@ task checkJson2ViewLatest {

preBuild.dependsOn checkJson2ViewLatest

task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {

reports {
xml.enabled = true
Expand All @@ -149,14 +151,14 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'crea
getReports().getHtml().setDestination(file("${buildDir}/reports/jacoco/jacocoRootReport/html"))

def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*', '**/*$ViewBinder*.*']
def debugTree = fileTree(dir: "$project.buildDir/intermediates/classes/debug", excludes: fileFilter)
def debugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/classes", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"

sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = fileTree(dir: project.buildDir, includes: [
sourceDirectories.setFrom(files([mainSrc]))
classDirectories.setFrom(files([debugTree]))
executionData.setFrom(fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec'
])
]))
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ConfigurableViewsLibrary {

public static ConfigurableViewsLibrary instance;
public static Context context;
private String password;
private byte[] password;

private ConfigurableViewsRepository configurableViewsRepository;
public static JsonSpecHelper jsonSpecHelper;
Expand Down Expand Up @@ -50,7 +50,7 @@ public static Context getContext() {
return context;
}

public String getPassword() {
public byte[] getPassword() {
if (password == null) {
String username = getContext().userService().getAllSharedPreferences().fetchRegisteredANM();
password = getContext().userService().getGroupId(username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.smartregister.configurableviews.model.View;
import org.smartregister.configurableviews.model.ViewConfiguration;
import org.smartregister.configurableviews.repository.ConfigurableViewsRepository;
import org.smartregister.view.contract.IView;

import java.util.Arrays;
import java.util.LinkedList;
Expand Down Expand Up @@ -62,13 +63,13 @@ public void registerViewConfigurations(List<String> viewIdentifiers) {
}
}

public Set<View> getRegisterActiveColumns(String identifier) {
Set<View> visibleColumns = new TreeSet<>(new ViewPositionComparator());
public Set<IView> getRegisterActiveColumns(String identifier) {
Set<IView> visibleColumns = new TreeSet<>(new ViewPositionComparator());
int maxColumns = viewConfigurations.get(identifier).getViews().size();
maxColumns = !isTabletSize && maxColumns > 3 ? 3 : maxColumns;
for (View view : viewConfigurations.get(identifier).getViews()) {
for (IView view : viewConfigurations.get(identifier).getViews()) {
if (view.isVisible())
visibleColumns.add(view);
visibleColumns.add((View) view);
}
if (!isTabletSize && visibleColumns.size() > maxColumns) {
View[] columnsArray = visibleColumns.toArray(new View[]{});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@


import org.smartregister.configurableviews.model.View;
import org.smartregister.view.contract.IView;

import java.util.Comparator;

/**
* Created by samuelgithengi on 11/21/17.
*/

public class ViewPositionComparator implements Comparator<View> {
public class ViewPositionComparator implements Comparator<IView> {

@Override
public int compare(View v1, View v2) {
public int compare(IView v1, IView v2) {
if (v1.getResidence() == null && v2.getResidence() == null)
return 0;
else if (v1.getResidence() == null && v2.getResidence() != null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.smartregister.configurableviews.model;

public abstract class BaseConfiguration {
import org.smartregister.view.contract.IBaseConfiguration;

public abstract class BaseConfiguration implements IBaseConfiguration {

private String language;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.smartregister.configurableviews.model;

public class Field {
import org.smartregister.view.contract.IField;

public class Field implements IField {
private String displayName;
private String dbAlias;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import com.google.gson.annotations.SerializedName;

import org.smartregister.view.contract.IResidence;

/**
* Created by ndegwamartin on 13/10/2017.
*/

public class Residence {
public class Residence implements IResidence {

private String parent;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package org.smartregister.configurableviews.model;

import org.smartregister.view.contract.IResidence;
import org.smartregister.view.contract.IView;

import java.util.Map;

/**
* Created by ndegwamartin on 13/10/2017.
*/

public class View {
public class View implements IView {

private String type;

private String orientation;

private Residence residence;
private IResidence residence;

private boolean visible = true;

Expand Down Expand Up @@ -72,11 +75,12 @@ public void setLabel(String label) {
this.label = label;
}

public Residence getResidence() {
public IResidence getResidence() {
return residence;
}

public void setResidence(Residence residence) {

public void setResidence(IResidence residence) {
this.residence = residence;
}

Expand Down

0 comments on commit fe1d40c

Please sign in to comment.