Skip to content
Snippets Groups Projects
Commit 43423ddc authored by Lennart Goedhart's avatar Lennart Goedhart
Browse files

Merge branch 'develop' into pazaan/develop-basal-rates

* develop:
  Make app reading data directly again if triggered by use
  align restart of polling with last known event. It'll try to align with the last poll up to 2h (hardcoded). After that we assume that there is may be a sensor initialisation and restart polling immediately
  branch name can be added to VERSION_NAME
  change chart to GraphView
  change chart to GraphView
  fixing #95
parents 0e123b26 9600f5b4
No related branches found
No related tags found
No related merge requests found
......@@ -5,3 +5,4 @@ local.properties
.idea
bugfender.properties
/app/app.iml
gradle.properties
\ No newline at end of file
......@@ -27,7 +27,7 @@ apply plugin: 'realm-android'
def gitVersion() {
// current dir is <your proj>/app, so it's likely that all your git repo files are in the dir
// above.
ext.repo = Grgit.open(project.file('..'))
ext.repo = Grgit.open()
// should result in the same value as running
// git tag -l | wc -l or git tag -l | grep -c ".*" -
......@@ -36,14 +36,15 @@ def gitVersion() {
}
def gitCommitId() {
//def process = ['sh', '-c', 'git tag -l | grep -c ".*" -'].execute().text.trim()
//return process.toInteger() + 1
//return 42
// current dir is <your proj>/app, so it's likely that all your git repo files are in the dir
// above.
ext.repo = Grgit.open(project.file('..'))
ext.repo = Grgit.open()
return ext.repo.log().first().id.substring(0, 7) //+ " " + ext.repo.branch.current.name
}
return ext.repo.log().first().id.substring(0, 7)
def gitBranch() {
ext.repo = Grgit.open()
return ext.repo.branch.current.name
}
def getBugfenderApiKey() {
......@@ -66,7 +67,7 @@ android {
applicationId "info.nightscout.android"
minSdkVersion 14
targetSdkVersion 23
versionName project.properties['version'] + "/" + gitCommitId()
versionName project.properties['version'] + "/" + gitCommitId() // + " (" + gitBranch()+")"
versionCode gitVersion()
buildConfigField "String", "BUGFENDER_API_KEY", getBugfenderApiKey()
}
......@@ -154,8 +155,7 @@ dependencies {
compile 'com.mikepenz:google-material-typeface:2.2.0.1.original@aar'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.bugfender.sdk:android:0.6.2'
compile 'com.github.PhilJay:MPAndroidChart-Realm:v2.0.2@aar'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
compile 'com.jjoe64:graphview:4.2.1'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
......
......@@ -80,11 +80,7 @@
<receiver android:name=".medtronic.service.MedtronicCnlAlarmReceiver" />
<receiver android:name=".upload.nightscout.NightscoutUploadReceiver" />
<receiver android:name=".xdrip_plus.XDripPlusUploadReceiver" /><!-- ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<receiver android:name=".xdrip_plus.XDripPlusUploadReceiver" />
</application>
......
......@@ -21,15 +21,14 @@ import java.util.Date;
import java.util.Locale;
import java.util.concurrent.TimeoutException;
import info.nightscout.android.BuildConfig;
import info.nightscout.android.R;
import info.nightscout.android.USB.UsbHidDriver;
import info.nightscout.android.medtronic.MainActivity;
import info.nightscout.android.medtronic.MedtronicCnlReader;
import info.nightscout.android.medtronic.exception.ChecksumException;
import info.nightscout.android.medtronic.exception.EncryptionException;
import info.nightscout.android.medtronic.message.MessageUtils;
import info.nightscout.android.medtronic.exception.UnexpectedMessageException;
import info.nightscout.android.medtronic.message.MessageUtils;
import info.nightscout.android.model.medtronicNg.ContourNextLinkInfo;
import info.nightscout.android.model.medtronicNg.PumpInfo;
import info.nightscout.android.model.medtronicNg.PumpStatusEvent;
......@@ -38,8 +37,6 @@ import info.nightscout.android.xdrip_plus.XDripPlusUploadReceiver;
import io.realm.Realm;
import io.realm.RealmResults;
import static info.nightscout.android.medtronic.MainActivity.setActivePumpMac;
public class MedtronicCnlIntentService extends IntentService {
public final static int USB_VID = 0x1a79;
public final static int USB_PID = 0x6210;
......@@ -155,12 +152,7 @@ public class MedtronicCnlIntentService extends IntentService {
.findFirst();
if (info == null) {
// TODO - use realm.createObject()?
info = realm.createObject(ContourNextLinkInfo.class, cnlReader.getStickSerial());
//info = new ContourNextLinkInfo();
///info.setSerialNumber(cnlReader.getStickSerial());
//info = realm.copyToRealm(info);
}
cnlReader.getPumpSession().setStickSerial(info.getSerialNumber());
......@@ -204,7 +196,7 @@ public class MedtronicCnlIntentService extends IntentService {
// reduce polling interval to half until pump is available
MedtronicCnlAlarmManager.setAlarm(activePump.getLastQueryTS() +
(MainActivity.pollInterval + MedtronicCnlIntentService.POLL_GRACE_PERIOD_MS) / (MainActivity.reducePollOnPumpAway?2L:1L)
(MainActivity.pollInterval / (MainActivity.reducePollOnPumpAway?2L:1L))
);
} else {
setActivePumpMac(pumpMAC);
......
package info.nightscout.android.model.medtronicNg;
import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet;
import java.util.Date;
import io.realm.RealmObject;
......
......@@ -51,8 +51,7 @@ public class SettingsFragment extends PreferenceFragment implements OnSharedPref
*/
private void setMinBatPollIntervall(ListPreference pollIntervalPref, ListPreference lowBatPollIntervalPref) {
final String currentValue = lowBatPollIntervalPref.getValue();
final int pollIntervalPos = pollIntervalPref.findIndexOfValue(pollIntervalPref.getValue()),
lowBatPollIntervalPos = lowBatPollIntervalPref.findIndexOfValue(currentValue),
final int pollIntervalPos = (pollIntervalPref.findIndexOfValue(pollIntervalPref.getValue()) >= 0?pollIntervalPref.findIndexOfValue(pollIntervalPref.getValue()):0),
length = pollIntervalPref.getEntries().length;
CharSequence[] entries = new String[length - pollIntervalPos],
......
......@@ -119,11 +119,10 @@
</LinearLayout>
<com.github.mikephil.charting.charts.ScatterChart
android:id="@+id/chart"
<com.jjoe64.graphview.GraphView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible" />
android:layout_height="100dip"
android:id="@+id/chart" />
<ScrollView
android:id="@+id/scrollView"
......
......@@ -21,4 +21,20 @@
<item>3600000</item>
<!--item>0</item-->
</string-array>
<string-array name="chart_zoom">
<item>1 hour</item>
<item>3 hours</item>
<item>6 hours</item>
<item>12 hours</item>
<item>24 hours</item>
</string-array>
<string-array name="chart_zoom_hours">
<item>1</item>
<item>3</item>
<item>6</item>
<item>12</item>
<item>24</item>
</string-array>
</resources>
\ No newline at end of file
......@@ -57,4 +57,5 @@
<string name="no_registered_contour_next_link_devices">No registered Contour Next Link devices</string>
<string name="to_register_a_contour_next_link_you_must_first_plug_it_in_and_get_a_reading_from_the_pump">To register a Contour Next Link you must first plug it in, and get a reading from the pump.</string>
<string name="serial_number">Serial number</string>
<string name="preferences_chart_interval">Chart Zoom</string>
</resources>
......@@ -41,6 +41,15 @@
android:entries="@array/poll_interval"
android:entryValues="@array/poll_interval_millis"/>
</PreferenceCategory>
<PreferenceCategory android:title="Display">
<ListPreference
android:key="chartZoom"
android:defaultValue="3"
android:title="@string/preferences_chart_interval"
android:summary="%s"
android:entries="@array/chart_zoom"
android:entryValues="@array/chart_zoom_hours"/>
</PreferenceCategory>
<PreferenceCategory android:title="Sharing">
<CheckBoxPreference
android:disableDependentsState="false"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment