Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Commit

Permalink
- Fix gradle + appcompat owes from androidx injection enforced by Google
Browse files Browse the repository at this point in the history
- Fix merging conflicts
- Fix toolbar for plugins's settings
  • Loading branch information
denzilferreira committed Feb 27, 2019
1 parent bf29934 commit 011ede4
Show file tree
Hide file tree
Showing 28 changed files with 260 additions and 103 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions aware-core/aware.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

22 changes: 7 additions & 15 deletions aware-core/build.gradle
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"
}

4 changes: 2 additions & 2 deletions aware-core/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion aware-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<application
android:label="@string/app_name"
android:networkSecurityConfig="@xml/aware_ssl_config">

<!-- Activities -->
Expand Down
179 changes: 179 additions & 0 deletions aware-core/src/main/java/com/aware/ui/AppCompatPreferenceActivity.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
68 changes: 16 additions & 52 deletions aware-phone/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}

4 changes: 2 additions & 2 deletions aware-phone/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions aware-phone/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

<application
android:icon="@drawable/ic_launcher_aware"
android:label="@string/app_name"
android:label="AWARE"
android:theme="@style/Theme.Aware">

<!-- Activities -->
Expand All @@ -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">
<intent-filter>
Expand Down
4 changes: 2 additions & 2 deletions aware-phone/src/main/java/com/aware/phone/Aware_Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 011ede4

Please sign in to comment.