Skip to content

Commit

Permalink
Merge branch 'release/1.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasrafael committed Jan 20, 2020
2 parents c8f8d99 + a27db06 commit ceca711
Show file tree
Hide file tree
Showing 138 changed files with 8,682 additions and 4,942 deletions.
47 changes: 32 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,31 @@ apply plugin: 'com.android.application'
apply plugin: 'io.objectbox'

android {
buildToolsVersion = '28.0.3'
compileSdkVersion 28
defaultConfig {
applicationId "br.edu.uepb.nutes.haniot"
minSdkVersion 19
targetSdkVersion 28
versionCode 2
versionName "1.5.0"
versionCode 4
versionName "1.7.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
lintOptions {
disable 'MissingTranslation'
}
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -37,29 +47,29 @@ dependencies {
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
// TODO REMOVER após migração com retrofit for finalizada!

// Charts
implementation 'com.mikhaellopez:circularprogressbar:2.0.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'

// BUTTER KNIFE
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

//Floating Action Button
// Floating Action Button
implementation 'com.github.clans:fab:1.6.4'

//LIBRARY Simple BLE Connect
// LIBRARY Simple BLE Connect
implementation 'com.github.nutes-uepb:simple-ble-scanner:v1.0.1'

//LIBRARY Pulsator4Droid
// LIBRARY Pulsator4Droid
implementation 'pl.bclogic:pulsator4droid:1.0.3'

// NUMBER PICKER
implementation 'com.shawnlin:number-picker:2.4.6'

// EVENT BUS
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'org.greenrobot:eventbus:3.1.1'

//Android BLE Nordic
implementation 'no.nordicsemi.android:ble:2.1.0'
Expand All @@ -68,24 +78,31 @@ dependencies {
implementation 'com.github.nutes-uepb:simple-survey:v1.2.1'

// JavaRx
implementation 'io.reactivex.rxjava2:rxjava:2.2.7'
implementation 'io.reactivex.rxjava2:rxjava:2.2.12'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'

// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.1.1'

// Encode/Decode
implementation 'com.scottyab:secure-preferences-lib:0.1.7'
implementation 'com.auth0.android:jwtdecode:1.2.0'

// Expandable Recyclerview
implementation 'com.thoughtbot:expandablerecyclerview:1.3'
implementation 'com.thoughtbot:expandablecheckrecyclerview:1.4'

// Nordic Scanner
implementation 'no.nordicsemi.android.support.v18:scanner:1.4.1'

// TEST
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'
implementation 'io.jsonwebtoken:jjwt:0.2'

implementation 'com.thoughtbot:expandablerecyclerview:1.3'
implementation 'com.thoughtbot:expandablecheckrecyclerview:1.4'
implementation 'com.android.support:multidex:1.0.3'
}
8 changes: 8 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-ignorewarnings

-keepattributes *Annotation*
-keepclassmembers class ** {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
1 change: 1 addition & 0 deletions app/release/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":2,"versionName":"1.5.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
25 changes: 18 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="br.edu.uepb.nutes.haniot">
<!-- PERMISSIONS -->
<uses-permission android:name="android.permission.BLUETOOTH" />
Expand All @@ -8,6 +9,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<application
android:name=".App"
android:allowBackup="true"
Expand All @@ -17,11 +19,16 @@
android:screenOrientation="portrait"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity android:name=".activity.NutritionalEvaluationActivity"
android:parentActivityName=".activity.MainActivity"
></activity>
<!-- RECEIVER ACCOUNT SERVICE -->
tools:ignore="GoogleAppIndexingWarning"
android:fullBackupContent="true">
<activity
android:name=".activity.HistoricQuizActivity"
android:label="@string/title_activity_historic_quiz"
android:parentActivityName=".activity.ManagerPatientsActivity"
android:theme="@style/AppTheme.NoActionBar"/>
<activity
android:name=".activity.NutritionalEvaluationActivity"
android:parentActivityName=".activity.MainActivity" /> <!-- RECEIVER ACCOUNT SERVICE -->
<receiver android:name=".service.TokenExpirationService$TokenAlarmReceiver" /> <!-- ACTIVITIES -->
<activity android:name=".activity.WelcomeActivity" />
<activity android:name=".activity.PilotStudyActivity" />
Expand Down Expand Up @@ -57,6 +64,9 @@
<activity
android:name=".devices.HeartRateActivity"
android:screenOrientation="portrait" />
<activity
android:name=".devices.BloodPressureActivity"
android:screenOrientation="portrait" />
<activity
android:name=".devices.RecordHeartRateActivity"
android:screenOrientation="portrait" />
Expand All @@ -81,7 +91,7 @@
android:theme="@style/AppTheme" />
<activity android:name=".activity.AddMeasurementActivity" />
<activity
android:name=".activity.PatientRegisterActivity"
android:name=".activity.UserRegisterActivity"
android:theme="@style/AppTheme" />
<activity
android:name=".activity.QuizNutritionActivity"
Expand All @@ -92,7 +102,8 @@
android:screenOrientation="portrait"
android:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar" /> <!-- ACTIVITIES REGISTER DEVICES -->
<activity android:name=".devices.register.DeviceRegisterActivity" />
<activity android:name=".devices.register.DeviceManagerActivity" /> <!-- END ACTIVITIES REGISTER DEVICES -->
<activity android:name=".devices.register.DeviceManagerActivity" />
<activity android:name=".activity.account.ForgotPasswordActivity" /> <!-- END ACTIVITIES REGISTER DEVICES -->
<!-- SERVICES -->
<service
android:name=".service.BluetoothLeService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.annotation.StringRes;
import android.support.design.widget.FloatingActionButton;
Expand All @@ -29,24 +34,31 @@
import br.edu.uepb.nutes.haniot.R;
import br.edu.uepb.nutes.haniot.data.model.ItemGridType;
import br.edu.uepb.nutes.haniot.data.model.Measurement;
import br.edu.uepb.nutes.haniot.data.model.MeasurementType;
import br.edu.uepb.nutes.haniot.data.model.Patient;
import br.edu.uepb.nutes.haniot.data.model.PatientsType;
import br.edu.uepb.nutes.haniot.data.model.User;
import br.edu.uepb.nutes.haniot.data.repository.local.pref.AppPreferencesHelper;
import br.edu.uepb.nutes.haniot.data.repository.remote.haniot.DisposableManager;
import br.edu.uepb.nutes.haniot.data.repository.remote.haniot.ErrorHandler;
import br.edu.uepb.nutes.haniot.data.repository.remote.haniot.HaniotNetRepository;
import br.edu.uepb.nutes.haniot.fragment.FragmentAnthropometrics;
import br.edu.uepb.nutes.haniot.fragment.FragmentBloodPressure;
import br.edu.uepb.nutes.haniot.fragment.FragmentGlucose;
import br.edu.uepb.nutes.haniot.fragment.FragmentHeartRate;
import br.edu.uepb.nutes.haniot.utils.ConnectionUtils;
import br.edu.uepb.nutes.haniot.utils.DateUtils;
import br.edu.uepb.nutes.haniot.utils.NetworkUtil;
import butterknife.BindView;
import butterknife.ButterKnife;

public class AddMeasurementActivity extends AppCompatActivity {

private final String TAG = "AddMeasurementActivity";
private final String WIRELESS = "wifi";
private final String CONNECTIVITY_CHANGE = "android.net.conn.CONNECTIVITY_CHANGE";
private boolean wifiRequest;

@BindView(R.id.toolbar)
Toolbar toolbar;

Expand Down Expand Up @@ -86,7 +98,6 @@ public class AddMeasurementActivity extends AppCompatActivity {
@BindView(R.id.message_error)
TextView messageError;


private final Calendar myCalendar = Calendar.getInstance();
private HaniotNetRepository haniotNetRepository;
private AppPreferencesHelper appPreferencesHelper;
Expand All @@ -112,18 +123,67 @@ protected void onCreate(Bundle savedInstanceState) {
patient = appPreferencesHelper.getLastPatient();
type = appPreferencesHelper.getInt(getResources().getString(R.string.measurementType));
patientName = patient.getName();
if (patient.getGender().equals(PatientsType.GenderType.MALE))

if (patient.getGender().equals(PatientsType.GenderType.MALE)) {
genderIcon.setImageResource(R.drawable.x_boy);
else genderIcon.setImageResource(R.drawable.x_girl);
} else {
genderIcon.setImageResource(R.drawable.x_girl);
}

if (ItemGridType.typeSupported(type)) {
replaceFragment(type);
} else {
finish();
}

IntentFilter filterInternet = new IntentFilter(CONNECTIVITY_CHANGE);
registerReceiver(mReceiver, filterInternet);
saveMeasurement.setOnClickListener(v -> prepareMeasurement());
}

@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(mReceiver);
}

private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
int status = NetworkUtil.getConnectivityStatusString(context);

if (CONNECTIVITY_CHANGE.equals(action)) {
if (status == NetworkUtil.NETWORK_STATUS_NOT_CONNECTED) {
showMessageConnection(WIRELESS, true);
} else {
showMessageConnection(WIRELESS, false);
}
}
}
};

/**
* Displays message.
*/
public void showMessageConnection(String typeMessageError, boolean show) {
Log.w("MainActivity", "show message: " + typeMessageError);

if (typeMessageError.equals(WIRELESS)) {
if (show) {
wifiRequest = true;
messageError.setOnClickListener(null);
messageError.setText(getString(R.string.wifi_disabled));
runOnUiThread(() -> {
boxMessage.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
boxMessage.setVisibility(View.VISIBLE);
});
} else {
wifiRequest = false;
boxMessage.setVisibility(View.GONE);
}
}
}

/**
* Set fragment.
*
Expand Down Expand Up @@ -175,7 +235,7 @@ public void replaceFragment(int measurementType) {

case ItemGridType.BLOOD_PRESSURE:
measurementText = getResources().getString(R.string.blood_pressure);
typeMeasurement = "blood_pressure";
typeMeasurement = MeasurementType.BLOOD_PRESSURE;
messageInfo.setText(String.format(getResources().getString(R.string.add_measurement_message), measurementText, patientName));
getSupportActionBar().setTitle("Inserir Pressão Arterial");
textUnit.setText(getString(R.string.unit_pressure));
Expand Down Expand Up @@ -208,7 +268,7 @@ private void errorHandler(Throwable e) {
if (!checkConnectivity())
showMessage(R.string.no_internet_conection);
else
showMessage(R.string.error_500);
ErrorHandler.showMessage(this, e);
}

/**
Expand Down
Loading

0 comments on commit ceca711

Please sign in to comment.