diff --git a/.gitignore b/.gitignore
index 5918195b..7b3a1154 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-
# Created by https://www.gitignore.io/api/android,intellij,opencv,gradle
### Android ###
@@ -21,6 +20,15 @@ out/
.gradle/
build/
+# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
+!gradle-wrapper.jar
+
+# Ignore Gradle GUI config
+gradle-app.setting
+
+# Keystore files
+app/keys
+
# Local configuration file (sdk path, etc)
local.properties
@@ -36,58 +44,36 @@ proguard/
# Android Studio captures folder
captures/
-# Intellij
-*.iml
-.idea/workspace.xml
-.idea/libraries
+# External native build folder generated in Android Studio 2.2 and later
+.externalNativeBuild
-# Keystore files
-*.jks
+# Freeline
+freeline.py
+freeline/
+freeline_project_description.json
### Android Patch ###
gen-external-apklibs
-
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
-# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839-How-to-manage-projects-under-Version-Control-Systems
# User-specific stuff:
-.idea/
-#.idea/workspace.xml
-#.idea/tasks.xml
-#.idea/dictionaries
-#.idea/vcs.xml
-#.idea/jsLibraryMappings.xml
-
-# Sensitive or high-churn files:
-#.idea/dataSources.ids
-#.idea/dataSources.xml
-#.idea/dataSources.local.xml
-#.idea/sqlDataSources.xml
-#.idea/dynamic.xml
-#.idea/uiDesigner.xml
+.idea/**/workspace.xml
+.idea/**/tasks.xml
# Gradle:
-#.idea/gradle.xml
-#.idea/libraries
-
-# Mongo Explorer plugin:
-#.idea/mongoSettings.xml
-
-## File-based project format:
-*.iws
-
-## Plugin-specific files:
-
-# IntelliJ
-/out/
+*.iml
+.idea/**/gradle.xml
+.idea/**/misc.xml
+.idea/**/libraries
-# mpeltonen/sbt-idea plugin
-.idea_modules/
+# CMake
+cmake-build-debug/
-# JIRA plugin
-atlassian-ide-plugin.xml
+# Sonarlint plugin
+.idea/sonarlint
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
@@ -95,15 +81,6 @@ crashlytics.properties
crashlytics-build.properties
fabric.properties
-### Intellij Patch ###
-# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
-
-# *.iml
-# modules.xml
-# .idea/misc.xml
-# *.ipr
-
-
### OpenCV ###
#OpenCV for Mac and Linux
#build and release folders
@@ -113,19 +90,4 @@ fabric.properties
*/cmake_install.cmake
.DS_Store
-
-### Gradle ###
-.gradle
-/build/
-
-# Ignore Gradle GUI config
-gradle-app.setting
-
-# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
-!gradle-wrapper.jar
-
-# Cache of project
-.gradletasknamecache
-
-# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
-# gradle/wrapper/gradle-wrapper.properties
\ No newline at end of file
+# End of https://www.gitignore.io/api/android,intellij,opencv,gradle
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 00000000..32b8ce75
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/copyright/GPLv3.xml b/.idea/copyright/GPLv3.xml
new file mode 100644
index 00000000..9044886a
--- /dev/null
+++ b/.idea/copyright/GPLv3.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 00000000..32c904fc
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/.idea/dictionaries/davidmigloz.xml b/.idea/dictionaries/davidmigloz.xml
new file mode 100644
index 00000000..624740f7
--- /dev/null
+++ b/.idea/dictionaries/davidmigloz.xml
@@ -0,0 +1,9 @@
+
+
+
+ lozano
+ qube
+ sonarqube
+
+
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..9f5200ce
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 00000000..9b6e38d6
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..dcb6b8c4
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/app/build.gradle b/app/build.gradle
index b6a17f02..67ebee4d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,38 +20,61 @@ apply plugin: 'com.android.application'
apply plugin: 'jacoco-android'
apply plugin: 'realm-android'
+
+// Get signing config
+def keystorePropertiesFile = rootProject.file("app/keys/keystore.properties")
+def keystoreProperties = new Properties()
+keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
+
android {
+
compileSdkVersion 25
- buildToolsVersion '25.0.0'
+ buildToolsVersion '25.0.3'
+
defaultConfig {
applicationId "com.davidmiguel.gobees"
+
minSdkVersion 19
targetSdkVersion 25
+
versionCode 11
versionName "v1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
+
+ signingConfigs {
+ relase {
+ keyAlias keystoreProperties['keyAlias']
+ keyPassword keystoreProperties['keyPassword']
+ storeFile file(keystoreProperties['storeFile'])
+ storePassword keystoreProperties['storePassword']
+ }
+ }
+
buildTypes {
debug {
testCoverageEnabled true
- minifyEnabled true
- // Uses new built-in shrinker http://tools.android.com/tech-docs/new-build-system/built-in-shrinker
- useProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguardTest-rules.pro'
}
release {
- minifyEnabled true
- useProguard true
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ shrinkResources true // Remove unused resources
+ minifyEnabled true // Enable proguard (shrinks, optimizes and obfuscates code)
+ proguardFiles getDefaultProguardFile('proguard-android.txt'),
+ 'proguard-guava.pro',
+ 'proguard-mpandroidchart.pro',
+ 'proguard-rounded-image-view.pro',
+ 'proguard-realm.pro',
+ 'proguard-rules.pro'
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguardTest-rules.pro'
+ signingConfig signingConfigs.relase
}
}
+
buildTypes.each {
// OpenWeatherMap key (stored in [USER_HOME]/.gradle/gradle.properties)
it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', OpenWeatherMapApiKey
}
+
// Mock: stubs out the service layer completely and returns a fake dataset
// Prod: production version
productFlavors {
@@ -62,6 +85,7 @@ android {
}
}
+
// Remove mockRelease as it's not needed.
android.variantFilter { variant ->
if (variant.buildType.name.equals('release')
@@ -69,16 +93,24 @@ android {
variant.setIgnore(true);
}
}
+
// android.jar methods return either null or zero, not throw exceptions
testOptions {
unitTests.returnDefaultValues = true
}
+
// Always show the result of every unit test, even if it passes
testOptions.unitTests.all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}
+
+ // Explicitly tells Gradle which version shall be compiled (due to Espresso conflicts)
+ configurations.all {
+ resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.2'
+ }
+
// Lint checks
lintOptions {
disable 'SetJavaScriptEnabled', 'MissingTranslation'
@@ -93,24 +125,42 @@ sourceSets {
dependencies {
- // App's dependencies, including test
- compile 'com.android.support:recyclerview-v7:25.1.1'
- compile 'com.android.support:appcompat-v7:25.1.1'
- compile 'com.android.support:design:25.1.1'
- compile 'com.android.support:cardview-v7:25.1.1'
- compile 'com.android.support:support-v4:25.1.1'
+ //----------------------------------------------------------------------------------------------
+ // App Dependencies
+ //----------------------------------------------------------------------------------------------
+
+ // Support libraries : https://developer.android.com/topic/libraries/support-library/packages.html
+ compile 'com.android.support:recyclerview-v7:25.3.1'
+ compile 'com.android.support:appcompat-v7:25.3.1'
+ compile 'com.android.support:design:25.3.1'
+ compile 'com.android.support:cardview-v7:25.3.1'
+ compile 'com.android.support:support-v4:25.3.1'
+ // Google Location and Activity Recognition : https://developers.google.com/android/guides/setup
+ compile 'com.google.android.gms:play-services-location:11.0.4'
+ // OpenCV (computer vision) : https://github.com/davidmigloz/opencv-android-gradle-repo/
compile 'com.github.davidmigloz:opencv-android-gradle-repo:3.2.0'
- compile 'com.google.android.gms:play-services-location:10.0.1'
- compile 'com.google.guava:guava:20.0'
+ // Guava (Google Core Libraries) : https://github.com/google/guava
+ compile 'com.google.guava:guava:23.0-android'
+ // RoundedImageView (ImageView that supports rounded corners) : https://github.com/vinc3m1/RoundedImageView
compile 'com.makeramen:roundedimageview:2.3.0'
- compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
+ // MPAndroidChart (chart view / graph view) : https://github.com/PhilJay/MPAndroidChart
+ compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
+ // VNTNumberPickerPreference (NumberPicker Preference) : https://github.com/vanniktech/VNTNumberPickerPreference
compile 'com.vanniktech:vntnumberpickerpreference:1.0.0'
+ // Permission Utils (check runtime permissions) : https://github.com/rebus007/PermissionUtils
compile 'rebus:permission-utils:1.0.6'
- // Dependencies for local unit tests
+
+ //----------------------------------------------------------------------------------------------
+ // Testing Dependencies
+ //----------------------------------------------------------------------------------------------
+
+ // JUnit (unit testing framework) : http://junit.org/junit4/
testCompile 'junit:junit:4.12'
- testCompile 'org.mockito:mockito-all:2.0.2-beta'
- testCompile 'org.powermock:powermock-module-junit4:1.6.6'
- testCompile 'org.powermock:powermock-api-mockito:1.6.6'
+ // Mockito (mocking framework) : http://site.mockito.org/
+ testCompile 'org.mockito:mockito-core:2.10.0'
+ // PowerMock (mocking framework) : https://github.com/powermock/powermock
+ testCompile "org.powermock:powermock-module-junit4:1.7.1"
+ testCompile "org.powermock:powermock-api-mockito2:1.7.1"
testCompile 'org.slf4j:slf4j-api:1.7.22'
testCompile 'org.slf4j:slf4j-log4j12:1.7.22'
testCompile 'log4j:log4j:1.2.17'
@@ -126,11 +176,8 @@ dependencies {
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
// Resolve conflicts between main and test APK:
- androidTestCompile 'com.android.support:support-annotations:25.1.1'
- androidTestCompile 'com.android.support:support-v4:25.1.1'
- androidTestCompile 'com.android.support:recyclerview-v7:25.1.1'
- androidTestCompile 'com.android.support:appcompat-v7:25.1.1'
- androidTestCompile 'com.android.support:design:25.1.1'
+ androidTestCompile 'com.android.support:support-annotations:25.3.1'
+
}
/*
@@ -163,7 +210,6 @@ afterEvaluate {
/*
SonarQube configuration.
-
*/
sonarqube {
properties {
@@ -178,4 +224,4 @@ sonarqube {
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.jacoco.reportMissing.force.zero", true
}
-}
\ No newline at end of file
+}
diff --git a/app/proguard-guava.pro b/app/proguard-guava.pro
new file mode 100644
index 00000000..d502767b
--- /dev/null
+++ b/app/proguard-guava.pro
@@ -0,0 +1,9 @@
+#----------------------------------------------------------------------------------------------
+# Guava | https://github.com/google/guava/issues/2926
+#----------------------------------------------------------------------------------------------
+
+-dontwarn com.google.common.base.**
+-dontwarn com.google.errorprone.annotations.**
+-dontwarn com.google.j2objc.annotations.**
+-dontwarn java.lang.ClassValue
+-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
diff --git a/app/proguard-mpandroidchart.pro b/app/proguard-mpandroidchart.pro
new file mode 100644
index 00000000..a7428c49
--- /dev/null
+++ b/app/proguard-mpandroidchart.pro
@@ -0,0 +1,7 @@
+#----------------------------------------------------------------------------------------------
+# MPAndroidChart | https://github.com/PhilJay/MPAndroidChart/issues/348#issuecomment-87453245
+#----------------------------------------------------------------------------------------------
+
+-keep public class com.github.mikephil.charting.animation.* {
+ public protected *;
+}
diff --git a/app/proguard-realm.pro b/app/proguard-realm.pro
new file mode 100644
index 00000000..bb444c1d
--- /dev/null
+++ b/app/proguard-realm.pro
@@ -0,0 +1,9 @@
+#----------------------------------------------------------------------------------------------
+# Realm | https://stackoverflow.com/questions/40211916/proguard-with-parceler-and-realm
+#----------------------------------------------------------------------------------------------
+
+-keepnames public class * extends io.realm.RealmObject
+-keep @io.realm.annotations.RealmModule class *
+-keep class io.realm.** { *; }
+-dontwarn javax.**
+-dontwarn io.realm.**
diff --git a/app/proguard-rounded-image-view.pro b/app/proguard-rounded-image-view.pro
new file mode 100644
index 00000000..c21ed692
--- /dev/null
+++ b/app/proguard-rounded-image-view.pro
@@ -0,0 +1,5 @@
+#----------------------------------------------------------------------------------------------
+# RoundedImageView | https://github.com/WhisperSystems/Signal-Android/blob/master/proguard-rounded-image-view.pro
+#----------------------------------------------------------------------------------------------
+
+-dontwarn com.squareup.picasso.**
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 811449cc..b0cbab5c 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -1,53 +1,3 @@
-# Some methods are only called from tests, so make sure the shrinker keeps them.
--keep class com.example.android.architecture.blueprints.** { *; }
-
--keep class android.support.v4.widget.DrawerLayout { *; }
--keep class android.support.test.espresso.IdlingResource { *; }
--keep class com.google.common.base.Preconditions { *; }
-
-# Proguard rules that are applied to your test apk/code.
--ignorewarnings
-
--keepattributes *Annotation*
-
--dontnote junit.framework.**
--dontnote junit.runner.**
-
--dontwarn android.test.**
--dontwarn android.support.test.**
--dontwarn org.junit.**
--dontwarn org.hamcrest.**
--dontwarn com.squareup.javawriter.JavaWriter
-
-# Uncomment this if you use Mockito
--dontwarn org.mockito.**
-
-# Configuration for Guava 18.0
--keep class com.google.common.io.Resources {
- public static ;
-}
--keep class com.google.common.collect.Lists {
- public static ** reverse(**);
-}
--keep class com.google.common.base.Charsets {
- public static ;
-}
--keep class com.google.common.base.Joiner {
- public static com.google.common.base.Joiner on(java.lang.String);
- public ** join(...);
-}
--keepclassmembers class ** {
- @com.google.common.eventbus.Subscribe public *;
-}
--keep class com.google.common.collect.MapMakerInternalMap$ReferenceEntry
--keep class com.google.common.cache.LocalCache$ReferenceEntry
-# http://stackoverflow.com/questions/9120338/proguard-configuration-for-guava-with-obfuscation-and-optimization
--dontwarn javax.annotation.**
--dontwarn javax.inject.**
--dontwarn sun.misc.Unsafe
-# Guava 19.0
--dontwarn java.lang.ClassValue
--dontwarn com.google.j2objc.annotations.Weak
--dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-# RecyclerView
--keep class android.support.v7.widget.RecyclerView { *; }
+#----------------------------------------------------------------------------------------------
+# General Proguard rules
+#----------------------------------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index c0d1089b..b4a08075 100644
--- a/build.gradle
+++ b/build.gradle
@@ -16,31 +16,30 @@
* along with this program. If not, see .
*/
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
buildscript {
repositories {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.3'
- classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
- classpath 'io.realm:realm-gradle-plugin:2.3.0'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ // Android Plugin for Gradle : https://developer.android.com/studio/releases/gradle-plugin.html#updating-plugin
+ classpath 'com.android.tools.build:gradle:2.3.3'
+ // JaCoCo Android : https://github.com/arturdm/jacoco-android-gradle-plugin
+ classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2'
+ // Realm db : https://github.com/realm/realm-java/blob/master/CHANGELOG.md
+ classpath 'io.realm:realm-gradle-plugin:3.7.0'
}
}
plugins {
- id "org.sonarqube" version "2.2"
+ // SonarQube : https://plugins.gradle.org/plugin/org.sonarqube
+ id "org.sonarqube" version "2.5"
}
-apply plugin: 'org.sonarqube'
allprojects {
repositories {
jcenter()
mavenCentral()
+ maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/raphaelbussa/maven" }
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 04e285f3..9e26512d 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Dec 28 10:00:20 PST 2015
+#Mon Aug 28 23:58:24 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip