diff --git a/README.md b/README.md index 38d57fab5..e7ad21587 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,23 @@ The platform is scalable with plugins and can be integrated with other platforms ![Arquitecture](http://www.awareframework.com/wp-content/uploads/2015/12/aware-architecture.png) +Getting started +=============== +Add to the build.gradle inside your module to include AWARE's libraries + +```Gradle +repositories { + maven { url "https://jitpack.io" } +} + +dependencies { + api "com.github.denzilferreira:aware-client:master-SNAPSHOT" +} +``` + +You can now refer to AWARE's functions inside your app. + + Individuals: Record your own data ================================= ![Individuals](http://www.awareframework.com/wp-content/uploads/2014/05/personal.png) diff --git a/aware-core/aware.gradle b/aware-core/aware.gradle index 3d5d4fbaa..09d4028be 100644 --- a/aware-core/aware.gradle +++ b/aware-core/aware.gradle @@ -3,11 +3,12 @@ ext { ion_libs = "2.+" support_libs = "28.0.0" google_libs = "16.0.0" - version_code = 809 + version_code = 810 version_readable = "4.0." + version_code + "." + "bundle" compile_sdk = 28 - target_sdk = 26 + target_sdk = 28 minimum_sdk = 19 build_tools = "28.0.3" aware_libs = "master-SNAPSHOT" -} \ No newline at end of file +} + diff --git a/aware-core/build.gradle b/aware-core/build.gradle index 07ac472b8..d1b9a6449 100644 --- a/aware-core/build.gradle +++ b/aware-core/build.gradle @@ -1,5 +1,8 @@ apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + android { compileSdkVersion compile_sdk buildToolsVersion build_tools @@ -56,26 +59,15 @@ android { } } -if (System.getenv("storeFile") != null && System.getenv("storePassword") != null && System.getenv("keyAlias") != null && System.getenv("keyPassword") != null) { - android.signingConfigs.release.storeFile = file(System.getenv("storeFile")) - android.signingConfigs.release.storePassword = System.getenv("storePassword") - android.signingConfigs.release.keyAlias = System.getenv("keyAlias") - android.signingConfigs.release.keyPassword = System.getenv("keyPassword") -} else { - println("No keystore defined. Unsigned .apk!") - android.buildTypes.release.signingConfig = null -} - -repositories { - maven { url "https://jitpack.io" } //MPAndroidChart, AWARE -} - dependencies { implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:$mqtt_libs" implementation "com.koushikdutta.ion:ion:$ion_libs" + implementation "com.android.support:design:$support_libs" implementation "com.android.support:gridlayout-v7:$support_libs" + implementation "com.android.support:cardview-v7:$support_libs" implementation "com.android.support:appcompat-v7:$support_libs" - implementation "com.android.support:design:$support_libs" + implementation "com.android.support:support-annotations:$support_libs" implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0-alpha' + implementation"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/aware-core/gradle/wrapper/gradle-wrapper.properties b/aware-core/gradle/wrapper/gradle-wrapper.properties index 09bb65726..8fedf236a 100644 --- a/aware-core/gradle/wrapper/gradle-wrapper.properties +++ b/aware-core/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Feb 12 23:06:48 EET 2019 +#Tue Feb 26 13:44:06 EET 2019 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-4.10.1-all.zip diff --git a/aware-core/src/main/AndroidManifest.xml b/aware-core/src/main/AndroidManifest.xml index 14e938fca..6edef7c20 100644 --- a/aware-core/src/main/AndroidManifest.xml +++ b/aware-core/src/main/AndroidManifest.xml @@ -21,7 +21,6 @@ diff --git a/aware-core/src/main/java/com/aware/ui/AppCompatPreferenceActivity.java b/aware-core/src/main/java/com/aware/ui/AppCompatPreferenceActivity.java new file mode 100755 index 000000000..bcccd6ef7 --- /dev/null +++ b/aware-core/src/main/java/com/aware/ui/AppCompatPreferenceActivity.java @@ -0,0 +1,179 @@ +package com.aware.ui; + +import android.content.Context; +import android.content.SharedPreferences; +import android.content.res.Configuration; +import android.os.Build; +import android.os.Bundle; +import android.preference.Preference; +import android.preference.PreferenceActivity; +import android.preference.PreferenceGroup; +import android.support.annotation.LayoutRes; +import android.support.annotation.Nullable; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatDelegate; +import android.support.v7.widget.*; +import android.util.AttributeSet; +import android.view.MenuInflater; +import android.view.View; +import android.view.ViewGroup; + +/** + * Created by denzil on 09/10/15. + * Inspired by this: https://gist.github.com/StelianMorariu/fcc4db7f677660316a8f + */ +public abstract class AppCompatPreferenceActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener { + + private AppCompatDelegate mDelegate; + + @Nullable + @Override + public View onCreateView(String name, Context context, AttributeSet attrs) { + final View result = super.onCreateView(name, context, attrs); + if (result != null) return result; + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + // If we're running pre-L, we need to 'inject' our tint aware Views in place of the standard framework versions + switch (name) { + case "EditText": + return new AppCompatEditText(this, attrs); + case "Spinner": + return new AppCompatSpinner(this, attrs); + case "CheckBox": + return new AppCompatCheckBox(this, attrs); + case "RadioButton": + return new AppCompatRadioButton(this, attrs); + case "CheckedTextView": + return new AppCompatCheckedTextView(this, attrs); + case "AutoCompleteTextView": + return new AppCompatAutoCompleteTextView(this, attrs); + case "Button": + return new AppCompatButton(this, attrs); + case "RatingBar": + return new AppCompatRatingBar(this, attrs); + case "SeekBar": + return new AppCompatSeekBar(this, attrs); + case "TextView": + return new AppCompatTextView(this, attrs); + } + } + return null; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + getDelegate().installViewFactory(); + getDelegate().onCreate(savedInstanceState); + super.onCreate(savedInstanceState); + } + + public PreferenceGroup getPreferenceParent(Preference preference) { + return getPreferenceParent(getPreferenceScreen(), preference); + } + + public PreferenceGroup getPreferenceParent(PreferenceGroup root, Preference preference) { + for (int i = 0; i < root.getPreferenceCount(); i++) { + Preference p = root.getPreference(i); + if (p == preference) + return root; + if (PreferenceGroup.class.isInstance(p)) { + PreferenceGroup parent = getPreferenceParent((PreferenceGroup) p, preference); + if (parent != null) + return parent; + } + } + return null; + } + + @Override + protected void onResume() { + super.onResume(); + getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); + } + + @Override + protected void onPause() { + super.onPause(); + getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); + } + + @Override + protected void onPostCreate(Bundle savedInstanceState) { + super.onPostCreate(savedInstanceState); + getDelegate().onPostCreate(savedInstanceState); + } + + public ActionBar getSupportActionBar() { + return getDelegate().getSupportActionBar(); + } + + public void setSupportActionBar(@Nullable Toolbar toolbar) { + getDelegate().setSupportActionBar(toolbar); + } + + @Override + public MenuInflater getMenuInflater() { + return getDelegate().getMenuInflater(); + } + + @Override + public void setContentView(@LayoutRes int layoutResID) { + getDelegate().setContentView(layoutResID); + } + + @Override + public void setContentView(View view) { + getDelegate().setContentView(view); + } + + @Override + public void setContentView(View view, ViewGroup.LayoutParams params) { + getDelegate().setContentView(view, params); + } + + @Override + public void addContentView(View view, ViewGroup.LayoutParams params) { + getDelegate().addContentView(view, params); + } + + @Override + protected void onPostResume() { + super.onPostResume(); + getDelegate().onPostResume(); + } + + @Override + protected void onTitleChanged(CharSequence title, int color) { + super.onTitleChanged(title, color); + getDelegate().setTitle(title); + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + getDelegate().onConfigurationChanged(newConfig); + } + + @Override + protected void onStop() { + super.onStop(); + getDelegate().onStop(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + getDelegate().onDestroy(); + } + + public void invalidateOptionsMenu() { + getDelegate().invalidateOptionsMenu(); + } + + private AppCompatDelegate getDelegate() { + if (mDelegate == null) { + mDelegate = AppCompatDelegate.create(this, null); + } + return mDelegate; + } +} diff --git a/aware-phone/build.gradle b/aware-phone/build.gradle index e9c58c338..8ad33774f 100755 --- a/aware-phone/build.gradle +++ b/aware-phone/build.gradle @@ -102,61 +102,25 @@ if (System.getenv("storeFile") != null && System.getenv("storePassword") != null } dependencies { - implementation "com.android.support:cardview-v7:$support_libs" - implementation "com.android.support:design:$support_libs" - implementation('me.dm7.barcodescanner:zbar:1.8.4') { exclude group: 'com.android.support', module: "support-v4" } + + implementation "com.android.support:appcompat-v7:$support_libs" + implementation "com.android.support:design:$support_libs" - api project(':aware-core') - - api (project(":com.aware.plugin.device_usage")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } - - api (project(":com.aware.plugin.ambient_noise")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } - - api (project(":com.aware.plugin.contacts_list")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } - - api (project(":com.aware.plugin.studentlife.audio")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } - - api (project(":com.aware.plugin.fitbit")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } - - api (project(":com.aware.plugin.google.activity_recognition")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } - - api (project(":com.aware.plugin.google.auth")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } - - api (project(":com.aware.plugin.google.fused_location")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } - - api (project(":com.aware.plugin.openweather")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } - - api (project(":com.aware.plugin.esm.scheduler")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } - - api (project(":com.aware.plugin.sensortag")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } - - api (project(":com.aware.plugin.sentimental")) { - exclude group:'com.github.denzilferreira',module:'aware-client' - } + api (project(':aware-core')) + api (project(":com.aware.plugin.ambient_noise")) + api (project(":com.aware.plugin.device_usage")) + api (project(":com.aware.plugin.contacts_list")) + api (project(":com.aware.plugin.studentlife.audio")) + api (project(":com.aware.plugin.fitbit")) + api (project(":com.aware.plugin.google.activity_recognition")) + api (project(":com.aware.plugin.google.auth")) + api (project(":com.aware.plugin.google.fused_location")) + api (project(":com.aware.plugin.openweather")) + api (project(":com.aware.plugin.esm.scheduler")) + api (project(":com.aware.plugin.sensortag")) + api (project(":com.aware.plugin.sentimental")) } diff --git a/aware-phone/gradle/wrapper/gradle-wrapper.properties b/aware-phone/gradle/wrapper/gradle-wrapper.properties index 09bb65726..8fedf236a 100644 --- a/aware-phone/gradle/wrapper/gradle-wrapper.properties +++ b/aware-phone/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Feb 12 23:06:48 EET 2019 +#Tue Feb 26 13:44:06 EET 2019 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-4.10.1-all.zip diff --git a/aware-phone/src/main/AndroidManifest.xml b/aware-phone/src/main/AndroidManifest.xml index 4d24105f3..448008060 100755 --- a/aware-phone/src/main/AndroidManifest.xml +++ b/aware-phone/src/main/AndroidManifest.xml @@ -61,7 +61,7 @@ @@ -70,7 +70,7 @@ android:configChanges="keyboardHidden|orientation|screenSize" android:exported="true" android:icon="@drawable/ic_launcher_aware" - android:label="@string/aware_sensors" + android:label="AWARE" android:launchMode="singleTop" android:theme="@style/Theme.Aware"> diff --git a/aware-phone/src/main/java/com/aware/phone/Aware_Client.java b/aware-phone/src/main/java/com/aware/phone/Aware_Client.java index 4b4b3b838..b08a5a242 100755 --- a/aware-phone/src/main/java/com/aware/phone/Aware_Client.java +++ b/aware-phone/src/main/java/com/aware/phone/Aware_Client.java @@ -77,8 +77,8 @@ protected void onCreate(Bundle savedInstanceState) { //Android 8 specific: create a notification channel for AWARE if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationManager not_manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - NotificationChannel aware_channel = new NotificationChannel(Aware.AWARE_NOTIFICATION_ID, getResources().getString(com.aware.R.string.app_name), NotificationManager.IMPORTANCE_DEFAULT); - aware_channel.setDescription(getResources().getString(com.aware.R.string.aware_description)); + NotificationChannel aware_channel = new NotificationChannel(Aware.AWARE_NOTIFICATION_ID, getResources().getString(R.string.app_name), NotificationManager.IMPORTANCE_DEFAULT); + aware_channel.setDescription(getResources().getString(R.string.aware_description)); aware_channel.enableLights(true); aware_channel.setLightColor(Color.BLUE); aware_channel.enableVibration(true); diff --git a/aware-phone/src/main/java/com/aware/phone/ui/Aware_Activity.java b/aware-phone/src/main/java/com/aware/phone/ui/Aware_Activity.java index 766d239f8..32b30c0f5 100755 --- a/aware-phone/src/main/java/com/aware/phone/ui/Aware_Activity.java +++ b/aware-phone/src/main/java/com/aware/phone/ui/Aware_Activity.java @@ -10,6 +10,7 @@ import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.v4.content.PermissionChecker; +import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; @@ -118,4 +119,10 @@ public boolean onOptionsItemSelected(MenuItem item) { } return super.onOptionsItemSelected(item); } + + @Override + protected void onResume() { + super.onResume(); + setTitle("AWARE"); + } } diff --git a/aware-phone/src/main/res/values/strings.xml b/aware-phone/src/main/res/values/strings.xml deleted file mode 100644 index 7247f40ef..000000000 --- a/aware-phone/src/main/res/values/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - Accelerometer - Applications - \ No newline at end of file diff --git a/aware-tests/gradle/wrapper/gradle-wrapper.properties b/aware-tests/gradle/wrapper/gradle-wrapper.properties index 09bb65726..cae58fbf1 100644 --- a/aware-tests/gradle/wrapper/gradle-wrapper.properties +++ b/aware-tests/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ 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-4.10.1-all.zip diff --git a/build.gradle b/build.gradle index 1276b7790..5049ba470 100644 --- a/build.gradle +++ b/build.gradle @@ -2,8 +2,8 @@ apply from: 'aware-core/aware.gradle' buildscript { - - ext.kotlin_version = '1.3.11' + + ext.kotlin_version = '1.3.21' repositories { maven { @@ -12,7 +12,7 @@ buildscript { google() jcenter() mavenCentral() - maven { url "https://jitpack.io" } //MPAndroidChart, AWARE + maven { url "https://jitpack.io" } } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' diff --git a/com.aware.plugin.ambient_noise b/com.aware.plugin.ambient_noise index 7042e2fd1..7b1a6b43b 160000 --- a/com.aware.plugin.ambient_noise +++ b/com.aware.plugin.ambient_noise @@ -1 +1 @@ -Subproject commit 7042e2fd19c32fc6321c29f0ff9be259fc953336 +Subproject commit 7b1a6b43b94596f1a3a4f61e0d88eac2351db7c2 diff --git a/com.aware.plugin.contacts_list b/com.aware.plugin.contacts_list index 1b685e5c9..93ef82eb1 160000 --- a/com.aware.plugin.contacts_list +++ b/com.aware.plugin.contacts_list @@ -1 +1 @@ -Subproject commit 1b685e5c9523945455ea4d145d1a3a0652f9ca0d +Subproject commit 93ef82eb13c0954641ffb385dbc395836aea1d6c diff --git a/com.aware.plugin.device_usage b/com.aware.plugin.device_usage index 487db9240..ec65d51b6 160000 --- a/com.aware.plugin.device_usage +++ b/com.aware.plugin.device_usage @@ -1 +1 @@ -Subproject commit 487db9240e0c7377ad8b9ac032df6c8e34080f43 +Subproject commit ec65d51b6c90f8ea7a136b3ed1316f976236c593 diff --git a/com.aware.plugin.esm.scheduler b/com.aware.plugin.esm.scheduler index fe4c263a2..d6d3fe458 160000 --- a/com.aware.plugin.esm.scheduler +++ b/com.aware.plugin.esm.scheduler @@ -1 +1 @@ -Subproject commit fe4c263a23938278fe0b8022f6fa2ad0f4b794cb +Subproject commit d6d3fe4584953f60dce2776cf49825bdf988f7c7 diff --git a/com.aware.plugin.fitbit b/com.aware.plugin.fitbit index f6997db71..02ee163f2 160000 --- a/com.aware.plugin.fitbit +++ b/com.aware.plugin.fitbit @@ -1 +1 @@ -Subproject commit f6997db718202d2fe700d884797f8345e419ce08 +Subproject commit 02ee163f22bc7fd54825427864aae66211991272 diff --git a/com.aware.plugin.google.activity_recognition b/com.aware.plugin.google.activity_recognition index 604ecb4c1..480c7e833 160000 --- a/com.aware.plugin.google.activity_recognition +++ b/com.aware.plugin.google.activity_recognition @@ -1 +1 @@ -Subproject commit 604ecb4c1c7efe1027dac83c768270c971d7b1d2 +Subproject commit 480c7e833351ca50b6eddc2398f84c583f15b50c diff --git a/com.aware.plugin.google.auth b/com.aware.plugin.google.auth index de40e9285..ac3c92726 160000 --- a/com.aware.plugin.google.auth +++ b/com.aware.plugin.google.auth @@ -1 +1 @@ -Subproject commit de40e928556378ed03e75d18b9b4f92eadda4645 +Subproject commit ac3c927268216a8d0df36caa9a0378c407d8bf59 diff --git a/com.aware.plugin.google.fused_location b/com.aware.plugin.google.fused_location index a203539a3..796c63ac5 160000 --- a/com.aware.plugin.google.fused_location +++ b/com.aware.plugin.google.fused_location @@ -1 +1 @@ -Subproject commit a203539a3b8dcbf1e1c12059019f0c6c59366d10 +Subproject commit 796c63ac5f9057ddf0c1e14c7ab1a213e5247c5d diff --git a/com.aware.plugin.openweather b/com.aware.plugin.openweather index 7e7177256..60391162f 160000 --- a/com.aware.plugin.openweather +++ b/com.aware.plugin.openweather @@ -1 +1 @@ -Subproject commit 7e7177256e81378584449fc6c48ebb0ae2abd066 +Subproject commit 60391162fac1601a6f08f14a9d0feed5d3b07096 diff --git a/com.aware.plugin.sensortag b/com.aware.plugin.sensortag index 043c0a03c..dbf835c65 160000 --- a/com.aware.plugin.sensortag +++ b/com.aware.plugin.sensortag @@ -1 +1 @@ -Subproject commit 043c0a03c70aa080035922460eb74cc8773e9f0d +Subproject commit dbf835c653428edbb09ffd8d731ec4d7f69a9444 diff --git a/com.aware.plugin.sentimental b/com.aware.plugin.sentimental index 03a87c192..3370a10d1 160000 --- a/com.aware.plugin.sentimental +++ b/com.aware.plugin.sentimental @@ -1 +1 @@ -Subproject commit 03a87c19247822ebea1e943507c39d008a9c876b +Subproject commit 3370a10d199f6f0a85f1bfdb5dc5da739ccd4572 diff --git a/com.aware.plugin.studentlife.audio b/com.aware.plugin.studentlife.audio index 2997496f5..3e2cad8b5 160000 --- a/com.aware.plugin.studentlife.audio +++ b/com.aware.plugin.studentlife.audio @@ -1 +1 @@ -Subproject commit 2997496f5caee374e3eb7bc17503850c382283da +Subproject commit 3e2cad8b5a60dfa44c49be45f265fb5c76c3610a diff --git a/gradle.properties b/gradle.properties index 4a9594aee..60baee871 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,4 @@ -org.gradle.jvmargs=-Xmx2048M \ No newline at end of file +org.gradle.jvmargs=-Xmx2048M + +android.useAndroidX=false +android.enableJetifier=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 09bb65726..8fedf236a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Feb 12 23:06:48 EET 2019 +#Tue Feb 26 13:44:06 EET 2019 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-4.10.1-all.zip