Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #183 from pazaan/develop-indra-rc1
Browse files Browse the repository at this point in the history
Devlop indra RC to master
  • Loading branch information
pazaan authored Jan 25, 2018
2 parents d582d46 + 537560b commit 3f22268
Show file tree
Hide file tree
Showing 125 changed files with 17,388 additions and 2,642 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ fabric.properties
local.properties
.idea
/app/app.iml
bugfender.properties
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ cache:
env:
global:
- EMULATOR_API_LEVEL=14
- ANDROID_API_LEVEL=25
- ANDROID_BUILD_TOOLS_VERSION=25.0.2
- ANDROID_API_LEVEL=26
- ANDROID_BUILD_TOOLS_VERSION=26.0.2
- ANDROID_ABI=armeabi-v7a
- ADB_INSTALL_TIMEOUT=5

Expand Down Expand Up @@ -73,4 +73,4 @@ notifications:
- https://webhooks.gitter.im/e/0283e844d525908106b2
on_success: change
on_failure: always
on_start: false
on_start: false
48 changes: 29 additions & 19 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'io.fabric.tools:gradle:1.22.2'
classpath 'io.fabric.tools:gradle:1.25.1'
classpath 'io.realm:realm-gradle-plugin:3.4.0'
classpath 'org.ajoberstar:grgit:1.5.0'
classpath 'org.codehaus.groovy:groovy-json:2.4.12'
Expand All @@ -19,15 +19,14 @@ plugins {
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
}

apply plugin: 'io.fabric'
apply plugin: 'realm-android'

def generateVersionCode() {
// We need to get the number of releases directly from GitHub, since Travis
// does a "git clone --depth=50", meaning we don't get all the tags locally.
Expand All @@ -51,16 +50,23 @@ def getBugfenderApiKey() {
String bugfenderApiKey = System.getenv("BUGFENDER_API_KEY")

if(bugfenderApiKey == null) {
logger.warn("Bugfender API key not set")
bugfenderApiKey = ""
File file = new File("app/bugfender.properties")
if (file.exists()) {
Properties properties = new Properties()
properties.load(new FileInputStream(file.getAbsolutePath().toString()))
bugfenderApiKey = properties.getProperty("apiKey", "")
} else {
logger.warn("Bugfender API key not set")
bugfenderApiKey = ""
}
}

return "\"" + bugfenderApiKey + "\""
}

android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
compileSdkVersion 26
buildToolsVersion '26.0.2'
// FIXME - replace with URLConnection. This is used in ManageCNLActivity.
useLibrary 'org.apache.http.legacy'

Expand All @@ -71,9 +77,9 @@ android {
defaultConfig {
applicationId "info.nightscout.android"
minSdkVersion 14
targetSdkVersion 25
targetSdkVersion 26
versionName generateVersionName()
versionCode generateVersionCode()
versionCode generateVersionCode() // FIXME - this forces a need for an online lookup and compile fails when offline
buildConfigField "String", "BUGFENDER_API_KEY", getBugfenderApiKey()
}

Expand All @@ -86,7 +92,7 @@ android {
}

debug {
ext.enableCrashlytics = false
ext.enableCrashlytics = file("fabric.properties").exists()
}
}

Expand All @@ -105,12 +111,16 @@ release {

dependencies {
compile files('libs/slf4j-api-1.7.2.jar')
compile files('libs/lzo-core-1.0.5.jar')

compile 'com.getpebble:pebblekit:4.0.1@aar'

compile 'com.android.support:support-v13:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:percent:26.1.0'
compile 'com.android.support:support-v13:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.mikepenz:google-material-typeface:2.2.0.1.original@aar'
compile 'com.mikepenz:ionicons-typeface:2.0.1.3@aar'
Expand All @@ -121,16 +131,16 @@ dependencies {
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'

compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
compile('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true
}

// The version of okhttp3 *must* be the same as the version in AppUpdater
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'

compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true;
transitive = true
}
compile('com.mikepenz:materialdrawer:5.2.9@aar') {
transitive = true
Expand Down
Binary file added app/libs/lzo-core-1.0.5.jar
Binary file not shown.
86 changes: 60 additions & 26 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.USB_PERMISSION" />

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- allow to disable battery optimization -->
<uses-permission-sdk-23 android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />

Expand All @@ -29,27 +29,15 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">


<!-- I have set screenOrientation to "portrait" to avoid the restart of AsyncTasks when you rotate the phone -->
<!-- configChanges="uiMode" added to avoid restart of AsyncTasks when phone is plugged into charger/dock (for phones that can do usb otg & charging simultaneously -->
<activity
android:name=".medtronic.MainActivity"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:launchMode="singleTask"
android:configChanges="uiMode"
android:screenOrientation="portrait">

<intent-filter android:icon="@drawable/ic_launcher">
<category android:name="android.intent.category.DEFAULT" />
android:persistableMode="persistNever"
android:configChanges="uiMode">

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

<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>
<activity
android:name=".settings.SettingsActivity"
Expand All @@ -61,7 +49,6 @@
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand All @@ -70,20 +57,67 @@

<activity android:name=".medtronic.StatusActivity" />

<activity
android:name=".medtronic.UsbActivity"
android:icon="@drawable/ic_launcher"
android:theme = "@android:style/Theme.Translucent"
android:taskAffinity=""
android:label="@string/app_name">
<intent-filter android:icon="@drawable/ic_launcher">
<category android:name="android.intent.category.DEFAULT" />
<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>

<activity
android:name=".AutoStartActivity"
android:icon="@drawable/ic_launcher"
android:theme = "@android:style/Theme.Translucent"
android:taskAffinity=""
android:label="@string/app_name">
</activity>

<service
android:name=".upload.nightscout.NightscoutUploadIntentService"
android:icon="@drawable/ic_launcher" />
android:name=".upload.nightscout.NightscoutUploadService"
android:icon="@drawable/ic_launcher"
android:stopWithTask="false"
/>
<service
android:name=".xdrip_plus.XDripPlusUploadIntentService"
android:icon="@drawable/ic_launcher" />
android:name=".xdrip_plus.XDripPlusUploadService"
android:icon="@drawable/ic_launcher"
android:stopWithTask="false"
/>
<service
android:name=".medtronic.service.MedtronicCnlIntentService"
android:icon="@drawable/ic_launcher" />

<receiver android:name=".medtronic.service.MedtronicCnlAlarmReceiver" />
<receiver android:name=".upload.nightscout.NightscoutUploadReceiver" />
<receiver android:name=".xdrip_plus.XDripPlusUploadReceiver" />
android:name=".medtronic.service.MedtronicCnlService"
android:icon="@drawable/ic_launcher"
android:stopWithTask="false"
android:process=":cnl"
/>
<service
android:name=".medtronic.service.MasterService"
android:icon="@drawable/ic_launcher"
android:stopWithTask="false"
/>

<receiver android:name=".medtronic.service.MedtronicCnlAlarmReceiver"
/>
<receiver android:name=".AutoStartReceiver">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
<receiver android:name=".medtronic.service.MedtronicCnlShutdownReceiver">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
<action android:name="android.intent.action.QUICKBOOT_POWEROFF" />
</intent-filter>
</receiver>
</application>

</manifest>
34 changes: 34 additions & 0 deletions app/src/main/java/info/nightscout/android/AutoStartActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package info.nightscout.android;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import info.nightscout.android.medtronic.service.MasterService;

/**
* Created by John on 22.12.17.
*/

public class AutoStartActivity extends AppCompatActivity {
private static final String TAG = AutoStartActivity.class.getSimpleName();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "onCreate called");

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

if (prefs.getBoolean("EnableCgmService", false)) {
Log.d(TAG, "MasterService auto starter, starting!");

startService(new Intent(getBaseContext(), MasterService.class));
}

finish();
}
}
23 changes: 23 additions & 0 deletions app/src/main/java/info/nightscout/android/AutoStartReceiver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package info.nightscout.android;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
* Created by Pogman on 4.9.17.
*/

public class AutoStartReceiver extends BroadcastReceiver {
private static final String TAG = AutoStartReceiver.class.getSimpleName();

@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "Boot complete, starting AutoStartActivity");

Intent i = new Intent(context, AutoStartActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
Loading

0 comments on commit 3f22268

Please sign in to comment.