Skip to content

Commit

Permalink
Merge pull request NightscoutFoundation#143 from StephenBlackWasAlrea…
Browse files Browse the repository at this point in the history
…dyTaken/xDrip-2-beta

xDrip 2 beta
  • Loading branch information
StephenBlackWasAlreadyTaken committed Sep 14, 2015
2 parents 7dbcb72 + 886d94d commit c30bc48
Show file tree
Hide file tree
Showing 105 changed files with 2,319 additions and 1,062 deletions.
17 changes: 9 additions & 8 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,19 @@
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="okio-1.2.0" level="project" />
<orderEntry type="library" exported="" name="answers-1.3.0" level="project" />
<orderEntry type="library" exported="" name="crashlytics-core-2.3.3" level="project" />
<orderEntry type="library" exported="" name="zxing-android-integration-2.0.0" level="project" />
<orderEntry type="library" exported="" name="core-3.1.0" level="project" />
<orderEntry type="library" exported="" name="crashlytics-2.2.3" level="project" />
<orderEntry type="library" exported="" name="answers-1.1.2" level="project" />
<orderEntry type="library" exported="" name="rxjava-1.0.0" level="project" />
<orderEntry type="library" exported="" name="acra-4.5.0" level="project" />
<orderEntry type="library" exported="" name="mongo-java-driver-2.10.1" level="project" />
<orderEntry type="library" exported="" name="crashlytics-2.5.0" level="project" />
<orderEntry type="library" exported="" name="guava-18.0" level="project" />
<orderEntry type="library" exported="" name="seeds-functional-16.0.1" level="project" />
<orderEntry type="library" exported="" name="seeds-strings-16.0.1" level="project" />
<orderEntry type="library" exported="" name="usb-serial-for-android-v010" level="project" />
<orderEntry type="library" exported="" name="seeds-base-16.0.1" level="project" />
<orderEntry type="library" exported="" name="fabric-1.3.0" level="project" />
<orderEntry type="library" exported="" name="mongo-java-driver-3.0.3" level="project" />
<orderEntry type="library" exported="" name="fabric-1.3.5" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.0.0" level="project" />
<orderEntry type="library" exported="" name="zxing-android-minimal-2.0.0" level="project" />
<orderEntry type="library" exported="" name="android-uploader-CORE_FOR_XDRIP" level="project" />
Expand All @@ -109,14 +110,14 @@
<orderEntry type="library" exported="" name="zxing-android-legacy-2.0.0" level="project" />
<orderEntry type="library" exported="" name="retrofit-1.9.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.1.1" level="project" />
<orderEntry type="library" exported="" name="beta-1.1.2" level="project" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="slf4j-api-1.7.7" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.1.1" level="project" />
<orderEntry type="library" exported="" name="snackbar-2.10.8" level="project" />
<orderEntry type="library" exported="" name="beta-1.1.3" level="project" />
<orderEntry type="library" exported="" name="seeds-primitives-16.0.1" level="project" />
<orderEntry type="library" exported="" name="pebblekit-2.6.0" level="project" />
<orderEntry type="library" exported="" name="hellocharts-library-1.1" level="project" />
<orderEntry type="library" exported="" name="pebblekit-3.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.1.1" level="project" />
<orderEntry type="library" exported="" name="hellocharts-android-v1.5.5" level="project" />
</component>
</module>
8 changes: 5 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ android {
applicationId "com.eveningoutpost.dexdrip"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionCode 2
versionName generateVersionName()
}
buildTypes {
Expand All @@ -101,7 +101,9 @@ dependencies {
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.getpebble:pebblekit:3.0.0'
compile 'io.reactivex:rxjava:1.0.0'
compile 'ch.acra:acra:4.5.0'
compile 'com.github.lecho:hellocharts-android:v1.5.5'

compile 'com.google.guava:guava:18.0'

compile('com.github.nightscout:android-uploader:CORE_FOR_XDRIP') {
transitive = false;
Expand All @@ -116,7 +118,7 @@ dependencies {
compile 'org.slf4j:slf4j-api:1.7.7'
/* end relevant android-uploader dependencies */

compile('com.crashlytics.sdk.android:crashlytics:2.2.3@aar') {
compile('com.crashlytics.sdk.android:crashlytics:2.5.0@aar') {
transitive = true;
}
}
Binary file removed app/libs/hellocharts-library-1.1.jar
Binary file not shown.
19 changes: 15 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
android:value="DexDrip.db" />
<meta-data
android:name="AA_DB_VERSION"
android:value="35" />
android:value="36" />

<provider
android:name="com.activeandroid.content.ContentProvider"
Expand Down Expand Up @@ -195,8 +195,15 @@

<activity
android:name=".AlertList"
android:label="@string/title_activity_alert_list" >
</activity>
android:label="@string/title_activity_alert_list" />

<activity
android:name=".ErrorsActivity"
android:label="Error List" />

<activity
android:name=".FollowerManagementActivity"
android:label="Manage Followers" />

<service
android:name=".Services.SnoozeOnNotificationDismissService"
Expand All @@ -207,7 +214,11 @@
android:enabled="true"
android:exported="true" >
</service>

<service
android:name=".ShareModels.ShareRest"
android:enabled="true"
android:exported="true" >
</service>
<service
android:name=".UtilityModels.Notifications"
android:exported="false" >
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/migrations/33.sql

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.eveningoutpost.dexdrip.Models.Calibration;
import com.eveningoutpost.dexdrip.Models.UserError.Log;
import com.eveningoutpost.dexdrip.UtilityModels.CollectionServiceStarter;


Expand Down Expand Up @@ -64,7 +64,7 @@ public void onClick(View v) {
value.setError("Calibration Can Not be blank");
}
} else {
Log.w("CALERROR", "ERROR");
Log.w("CALERROR", "Sensor is not active, cannot calibrate");
}
}
});
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/eveningoutpost/dexdrip/AlertList.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import com.eveningoutpost.dexdrip.Models.UserError.Log;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
Expand Down Expand Up @@ -72,7 +72,7 @@ ArrayList<HashMap<String, String>> createAlertsMap(boolean above) {

List<AlertType> alerts = AlertType.getAll(above);
for (AlertType alert : alerts) {
Log.e(TAG, alert.toString());
Log.d(TAG, alert.toString());
feedList.add(createAlertMap(alert));
}
return feedList;
Expand Down Expand Up @@ -161,10 +161,10 @@ public void onClick(View v) {

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.e(TAG, "onActivityResult called ");
Log.d(TAG, "onActivityResult called ");
if (requestCode == ADD_ALERT || requestCode == EDIT_ALERT) {
if(resultCode == RESULT_OK) {
Log.e(TAG, "onActivityResult called invalidating...");
Log.d(TAG, "onActivityResult called invalidating...");
FillLists();
}
if (resultCode == RESULT_CANCELED) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/eveningoutpost/dexdrip/AutoStart.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.eveningoutpost.dexdrip.Models.UserError.Log;

import com.eveningoutpost.dexdrip.UtilityModels.CollectionServiceStarter;

Expand All @@ -13,7 +13,7 @@
public class AutoStart extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.w("DexDrip", "Service auto starter, starting!");
Log.d("DexDrip", "Service auto starter, starting!");
CollectionServiceStarter.newStart(context);
}
}
69 changes: 43 additions & 26 deletions app/src/main/java/com/eveningoutpost/dexdrip/BluetoothScan.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
Expand All @@ -32,6 +31,7 @@

import com.activeandroid.query.Select;
import com.eveningoutpost.dexdrip.Models.ActiveBluetoothDevice;
import com.eveningoutpost.dexdrip.Models.UserError.Log;
import com.eveningoutpost.dexdrip.UtilityModels.CollectionServiceStarter;
import com.eveningoutpost.dexdrip.utils.AndroidBarcode;
import com.eveningoutpost.dexdrip.utils.ListActivityWithMenu;
Expand All @@ -41,7 +41,7 @@
import java.util.ArrayList;
import java.util.List;

import lecho.lib.hellocharts.util.Utils;
import lecho.lib.hellocharts.util.ChartUtils;

@TargetApi(android.os.Build.VERSION_CODES.JELLY_BEAN_MR2)
public class BluetoothScan extends ListActivityWithMenu {
Expand Down Expand Up @@ -116,23 +116,27 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_scan:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
scanLeDeviceLollipop(true);
} else
scanLeDevice(true);
BluetoothManager bluetooth_manager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
Toast.makeText(this, "Scanning", Toast.LENGTH_LONG).show();
if(bluetooth_manager == null) {
Toast.makeText(this, "This device does not seem to support bluetooth", Toast.LENGTH_LONG).show();
return true;
} else {
if(!bluetooth_manager.getAdapter().isEnabled()) {
Toast.makeText(this, "Bluetooth is turned off on this device currently", Toast.LENGTH_LONG).show();
return true;
} else {
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR2){
if(android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2){
Toast.makeText(this, "The android version of this device is not compatible with Bluetooth Low Energy", Toast.LENGTH_LONG).show();
return true;
}
}
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
scanLeDeviceLollipop(true);
} else {
scanLeDevice(true);
}
return true;
// case R.id.menu_stop:
// Intent tableIntent = new Intent(this, RawDataTable.class);
Expand Down Expand Up @@ -161,7 +165,9 @@ public void run() {
bluetooth_adapter.startLeScan(mLeScanCallback);
} else {
is_scanning = false;
bluetooth_adapter.stopLeScan(mLeScanCallback);
if(bluetooth_adapter != null && bluetooth_adapter.isEnabled()) {
bluetooth_adapter.stopLeScan(mLeScanCallback);
}
}
invalidateOptionsMenu();
}
Expand Down Expand Up @@ -208,25 +214,36 @@ private void scanLeDeviceLollipop(final boolean enable) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
lollipopScanner = bluetooth_adapter.getBluetoothLeScanner();
}

Log.d(TAG, "Starting scanner 21");
// Stops scanning after a pre-defined scan period.
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
is_scanning = false;
lollipopScanner.stopScan(mScanCallback);
invalidateOptionsMenu();
if(lollipopScanner != null) {
Log.d(TAG, "Starting scanner 21");
// Stops scanning after a pre-defined scan period.
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
is_scanning = false;
if(bluetooth_adapter != null && bluetooth_adapter.isEnabled()) {
lollipopScanner.stopScan(mScanCallback);
}
invalidateOptionsMenu();
}
}, SCAN_PERIOD);
ScanSettings settings = new ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
.build();
is_scanning = true;
lollipopScanner.startScan(null, settings, mScanCallback);
} else {
try {
scanLeDevice(true);
} catch (Exception e) {
Log.e(TAG, "Failed to scan for ble device", e);
}
}, SCAN_PERIOD);
ScanSettings settings = new ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
.build();
is_scanning = true;
lollipopScanner.startScan(null, settings, mScanCallback);
}
} else {
is_scanning = false;
lollipopScanner.stopScan(mScanCallback);
if(bluetooth_adapter != null && bluetooth_adapter.isEnabled()) {
lollipopScanner.stopScan(mScanCallback);
}
}
invalidateOptionsMenu();
}
Expand Down Expand Up @@ -363,8 +380,8 @@ public View getView(int i, View view, ViewGroup viewGroup) {
final String deviceName = device.getName();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
if(prefs.getString("last_connected_device_address", "").compareTo(device.getAddress()) == 0) {
viewHolder.deviceName.setTextColor(Utils.COLOR_BLUE);
viewHolder.deviceAddress.setTextColor(Utils.COLOR_BLUE);
viewHolder.deviceName.setTextColor(ChartUtils.COLOR_BLUE);
viewHolder.deviceAddress.setTextColor(ChartUtils.COLOR_BLUE);
}
viewHolder.deviceName.setText(deviceName);
viewHolder.deviceAddress.setText(device.getAddress());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.text.TextUtils;
import android.util.Log;
import com.eveningoutpost.dexdrip.Models.UserError.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
package com.eveningoutpost.dexdrip;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.TextView;

import com.eveningoutpost.dexdrip.Models.Calibration;
import com.eveningoutpost.dexdrip.UtilityModels.Constants;
import com.eveningoutpost.dexdrip.utils.ActivityWithMenu;

import java.text.DateFormat;
Expand All @@ -22,7 +16,7 @@
import lecho.lib.hellocharts.model.Line;
import lecho.lib.hellocharts.model.LineChartData;
import lecho.lib.hellocharts.model.PointValue;
import lecho.lib.hellocharts.util.Utils;
import lecho.lib.hellocharts.util.ChartUtils;
import lecho.lib.hellocharts.view.LineChartView;


Expand Down Expand Up @@ -65,7 +59,7 @@ public void setupCharts() {
}

Line line = new Line(values);
line.setColor(Utils.COLOR_BLUE);
line.setColor(ChartUtils.COLOR_BLUE);
line.setHasLines(false);
line.setPointRadius(4);
line.setHasPoints(true);
Expand All @@ -84,7 +78,7 @@ public void setupCharts() {
GraphHeader.setText(Header);
}
Line calibrationLine = new Line(lineValues);
calibrationLine.setColor(Utils.COLOR_RED);
calibrationLine.setColor(ChartUtils.COLOR_RED);
calibrationLine.setHasLines(true);
calibrationLine.setHasPoints(false);
Axis axisX = new Axis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.text.TextUtils;
import android.util.Log;
import com.eveningoutpost.dexdrip.Models.UserError.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand Down
Loading

0 comments on commit c30bc48

Please sign in to comment.