Skip to content

Commit

Permalink
Merge branch 'release/0.1.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Calabrese committed Nov 7, 2014
2 parents 54338c1 + 6019286 commit 2e8948a
Show file tree
Hide file tree
Showing 91 changed files with 4,848 additions and 2,093 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ bin/
gen/
out
logs
.DS_Store

# Ignore gradle files
.gradle/
Expand Down
5 changes: 5 additions & 0 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

We track contributions on a per-patch basis using git.
Please see our published git log:
* https://github.com/nightscout/android-uploader/commits/master

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
android-uploader
====================
[![Build Status](https://travis-ci.org/nightscout/cgm-remote-monitor.png)](https://travis-ci.org/nightscout/android-uploader)
[![Gitter chat](https://badges.gitter.im/nightscout.png)](https://gitter.im/nightscout/public)

A community maintained fork of original android uploader.
Android Uploader for the Nightscout Project.

We're currently consolidating multiple forks of the original code here.
This will support the 2 most common deployment models (REST / Hosted Mongo).

## [License - GPL V3](gpl-v3)
[gpl-3]: http://www.gnu.org/licenses/gpl-3.0.txt

android-uploader - Nightscout's open source MDDS CGM uploader and archiver
Copyright (C) 2014 Nightscout contributors. See the COPYRIGHT file
at the root directory of this distribution and at
https://github.com/nightscout/android-uploader/blob/master/COPYRIGHT

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

6 changes: 5 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ android {
}

dependencies {
compile files('libs/mongo-2.10.1.jar')
compile files('libs/acra-4.5.0.jar')
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.android.support:support-v4:20.0.0'
compile 'org.mongodb:mongo-java-driver:2.10.1'
compile 'com.google.android.gms:play-services:5.0.89'
}
Binary file added app/libs/acra-4.5.0.jar
Binary file not shown.
Binary file removed app/libs/mongo-2.10.1.jar
Binary file not shown.
31 changes: 31 additions & 0 deletions app/src/androidTest/java/com/nightscout/android/test/NSTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.nightscout.android.test;

import android.test.ActivityInstrumentationTestCase2;

import com.google.android.gms.analytics.Tracker;
import com.nightscout.android.MainActivity;
import com.nightscout.android.Nightscout;


public class NSTest extends ActivityInstrumentationTestCase2<MainActivity> {

private MainActivity activity;

@Override
protected void setUp() throws Exception {
super.setUp();
setActivityInitialTouchMode(false);
activity = getActivity();
}

public NSTest(){
super(MainActivity.class);
}

// Verifies the tracker returned by the application class is a singleton.
public void testTracker(){
Tracker tracker1=((Nightscout) getActivity().getApplicationContext()).getTracker();
Tracker tracker2=((Nightscout) getActivity().getApplicationContext()).getTracker();
assertEquals(tracker1,tracker2);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.nightscout.android.test;

import junit.framework.TestCase;

import com.nightscout.android.TimeConstants;
import com.nightscout.android.dexcom.Utils;

import java.util.Date;
import java.util.TimeZone;

public class UtilsTest extends TestCase {
public void testTimeString(){
String timeStr=Utils.getTimeString(60*1000);
assertEquals("1 min ago",timeStr);
timeStr=Utils.getTimeString(60*1000*60);
assertEquals("1 hours ago",timeStr);
timeStr=Utils.getTimeString(60*1000*60*24);
assertEquals("1 days ago",timeStr);
timeStr=Utils.getTimeString(60*1000*60*24*7);
assertEquals("1 weeks ago",timeStr);
}

public void testReceiverTimeToDate(){
long epochMS = 1230768000000L; // Jan 01, 2009 00:00 in UTC
// Purposefully lose some precision here
long currentTime=(new Date().getTime()/1000L)*1000L;
int currentTZOffset = TimeZone.getDefault().getRawOffset();
long milliseconds = epochMS - currentTZOffset;
long delta=(currentTime-milliseconds);
TimeZone tz = TimeZone.getDefault();
if (tz.inDaylightTime(new Date())) delta = delta + TimeConstants.ONE_HOUR_MS;
Date currentDateObj=Utils.receiverTimeToDate(delta/1000L);
assertEquals(currentTime,currentDateObj.getTime());
}
}
82 changes: 60 additions & 22 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,39 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nightscout.android">
package="com.nightscout.android"
android:versionCode="12"
android:versionName="0.1.7">

<uses-feature android:name="android.hardware.usb.host" />
<uses-sdk android:minSdkVersion="12"/>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.UPDATE_DEVICE_STATS"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<application>

<uses-sdk android:minSdkVersion="12" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />


<application
android:name=".Nightscout"
android:icon="@drawable/ic_launcher"
android:label="@string/title_activity_main" >
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="@xml/analytics_global_config" />
<activity
android:name=".dexcom.DexcomG4Activity"
android:icon="@drawable/ic_launcher"
android:label="NightScout"
android:launchMode="singleTask" >
android:name=".MainActivity"
android:screenOrientation="portrait"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />

<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>

<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>

<receiver android:name=".OnUpgradeReceiver">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" android:path="com.nightscout.android" />
</intent-filter>
</receiver>


<activity
android:name="org.acra.CrashReportDialog"
android:excludeFromRecents="true"
android:finishOnTaskLaunch="true"
android:launchMode="singleInstance"
android:theme="@android:style/Theme.Dialog" />

<service android:name=".dexcom.SyncingService" />

<activity
android:name=".settings.SettingsActivity"
android:label="@string/title_activity_settings"
android:parentActivityName=".MainActivity" >
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
android:name="android.support.PARENT_ACTIVITY"
android:value="com.nightscout.android.MainActivity" />
</activity>
<activity android:name=".settings.SettingsActivity"
android:icon="@drawable/ic_launcher"
android:label="Settings"/>
<service android:name=".dexcom.DexcomG4Service" >
</service>

</application>

</manifest>
31 changes: 31 additions & 0 deletions app/src/main/assets/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
body {
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
fill: #fff;
background: #000;
color: #808080;
overflow: hidden;
}

.container {
overflow: hidden;
display: block;
height: 95%;
width: 100%;
left: 0;
margin: 0;
padding: 0;
top: 0px;
z-index: 2;
}

.axis path,
.axis line {
fill: none;
stroke: #ffffff;
shape-rendering: crispEdges;
}

.grid path, .axis line {
stroke: #808080;
stroke-opacity: 1;
}
20 changes: 20 additions & 0 deletions app/src/main/assets/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, maximum-scale=1, initial-scale=1, user-scalable=0" />
<title>NightScout</title>
<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body>

<div class="container" id="container">
<div class="row-fluid section1">
<div id="chartContainer"></div>
</div>
</div>

<script src="js/d3.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/client.js"></script>
</body>
</html>
Loading

0 comments on commit 2e8948a

Please sign in to comment.