Skip to content

Commit 384e642

Browse files
author
Paolo Rotolo
committed
Merge pull request #206 from Glucosio/develop
Releasing 0.10.0
2 parents 6727e8a + 673b079 commit 384e642

File tree

116 files changed

+1737
-345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1737
-345
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ after_success:
2323

2424
script:
2525
- cd $TRAVIS_BUILD_DIR/
26-
- ./gradlew clean build
26+
- ./gradlew assembleDebug
2727

2828
notifications:
2929
slack: glucosio:uk2xb9sAxOaVedj7zePyuBqa

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ Glucosio for Android, an user centered free and open source app for Diabetes man
1818
Alternatively, from the Welcome screen, select **Import project**.
1919

2020
## Download on Google Play Store
21-
<a href="https://play.google.com/store/apps/details?id=org.glucosio.android" alt="Download from Google Play">
22-
<img src="http://www.android.com/images/brand/android_app_on_play_large.png">
23-
</a>
21+
<a href="https://play.google.com/store/apps/details?id=org.glucosio.android&utm_source=global_co&utm_medium=prtnr&utm_content=Mar2515&utm_campaign=PartBadge&pcampaignid=MKT-AC-global-none-all-co-pr-py-PartBadges-Oct1515-1"><img alt="Get it on Google Play" height="100" src="https://play.google.com/intl/en_us/badges/images/apps/en-play-badge.png" /></a>
2422

2523
## Test Drive Glucosio Daily
2624
http://daily.glucosio.org

app/build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ android {
99
defaultConfig {
1010
minSdkVersion 16
1111
targetSdkVersion 23
12-
versionCode 10
13-
versionName '0.9.4'
12+
versionCode 11
13+
versionName '0.10.0'
1414

1515
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1616
}
@@ -62,7 +62,7 @@ dependencies {
6262
compile 'com.google.android.gms:play-services-wearable:8.4.0'
6363

6464
// Other libraries
65-
compile 'io.realm:realm-android:0.87.2'
65+
compile 'io.realm:realm-android:0.87.4'
6666
compile 'com.github.clans:fab:1.6.2'
6767
compile 'com.wdullaer:materialdatetimepicker:2.1.1'
6868
compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
@@ -71,10 +71,9 @@ dependencies {
7171
compile('com.mikepenz:materialdrawer:4.6.4@aar') {
7272
transitive = true
7373
}
74-
compile ("com.instabug.library:instabugsupport:1.7.3")
74+
compile 'com.instabug.library:instabugcompat:2.1.1'
7575

7676
wearApp project(':wear')
77-
7877
// Testing libraries
7978
androidTestCompile 'com.android.support.test:rules:0.4.1'
8079
androidTestCompile 'com.android.support.test:runner:0.4.1'

app/proguard-rules.pro

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,40 @@
2323
-dontwarn javax.**
2424
-dontwarn io.realm.**
2525

26-
-dontwarn android.support.**
27-
-keep class android.support.v7.** { *; }
28-
-keep interface android.support.v7.** { *; }
29-
-keep class com.google.android.gms.** { *; }
26+
# RxAndroid
27+
-dontwarn rx.internal.util.unsafe.**
28+
29+
## Instabug
30+
-dontwarn org.apache.http.**
31+
-dontwarn android.net.http.AndroidHttpClient
3032
-dontwarn com.google.android.gms.**
31-
-keep class com.instabug.** { *; }
33+
-dontwarn com.android.volley.toolbox.**
34+
-dontwarn com.instabug.**
35+
36+
## AppCompat
37+
-keep public class android.support.v7.widget.** { *; }
38+
-keep public class android.support.v7.internal.widget.** { *; }
39+
-keep public class android.support.v7.internal.view.menu.** { *; }
40+
41+
-keep public class * extends android.support.v4.view.ActionProvider {
42+
public <init>(android.content.Context);
43+
}
44+
45+
## Google Play Services
46+
-dontnote com.google.vending.licensing.ILicensingService
47+
-keep class * extends java.util.ListResourceBundle {
48+
protected Object[][] getContents();
49+
}
50+
51+
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
52+
public static final *** NULL;
53+
}
54+
55+
-keepnames @com.google.android.gms.common.annotation.KeepName class *
56+
-keepclassmembernames class * {
57+
@com.google.android.gms.common.annotation.KeepName *;
58+
}
59+
60+
-keepnames class * implements android.os.Parcelable {
61+
public static final ** CREATOR;
62+
}

app/src/main/AndroidManifest.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="org.glucosio.android">
44

5+
<uses-permission android:name="android.permission.NFC" />
6+
<uses-feature android:name="android.hardware.nfc" android:required="true" />
57
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
68
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
9+
<!-- Required for Instabug -->
10+
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE"/>
11+
<permission
12+
android:name="${applicationId}.permission.C2D_MESSAGE"
13+
android:protectionLevel="signature"/>
714

815
<application
916
android:name=".GlucosioApplication"
@@ -98,6 +105,7 @@
98105
<activity
99106
android:name=".activity.AddGlucoseActivity"
100107
android:label="@string/title_activity_add_glucose"
108+
android:windowSoftInputMode="stateVisible"
101109
android:parentActivityName=".activity.MainActivity">
102110
<meta-data
103111
android:name="android.support.PARENT_ACTIVITY"
@@ -106,6 +114,7 @@
106114
<activity
107115
android:name=".activity.AddWeightActivity"
108116
android:label="@string/title_activity_add_weight"
117+
android:windowSoftInputMode="stateVisible"
109118
android:parentActivityName=".activity.MainActivity">
110119
<meta-data
111120
android:name="android.support.PARENT_ACTIVITY"
@@ -114,6 +123,7 @@
114123
<activity
115124
android:name=".activity.AddCholesterolActivity"
116125
android:label="@string/title_activity_add_cholesterol"
126+
android:windowSoftInputMode="stateVisible"
117127
android:parentActivityName=".activity.MainActivity">
118128
<meta-data
119129
android:name="android.support.PARENT_ACTIVITY"
@@ -122,6 +132,7 @@
122132
<activity
123133
android:name=".activity.AddKetoneActivity"
124134
android:label="@string/title_activity_add_ketone"
135+
android:windowSoftInputMode="stateVisible"
125136
android:parentActivityName=".activity.MainActivity">
126137
<meta-data
127138
android:name="android.support.PARENT_ACTIVITY"
@@ -130,6 +141,7 @@
130141
<activity
131142
android:name=".activity.AddPressureActivity"
132143
android:label="@string/title_activity_add_pressure"
144+
android:windowSoftInputMode="stateVisible"
133145
android:parentActivityName=".activity.MainActivity">
134146
<meta-data
135147
android:name="android.support.PARENT_ACTIVITY"
@@ -138,6 +150,24 @@
138150
<activity
139151
android:name=".activity.AddHB1ACActivity"
140152
android:label="@string/title_activity_add_hb1ac"
153+
android:windowSoftInputMode="stateVisible"
154+
android:parentActivityName=".activity.MainActivity">
155+
<meta-data
156+
android:name="android.support.PARENT_ACTIVITY"
157+
android:value="org.glucosio.android.activity.MainActivity" />
158+
</activity>
159+
<activity android:name=".activity.FreestyleLibre">
160+
<!-- NFC for FreeStyle -->
161+
<intent-filter>
162+
<action android:name="android.nfc.action.TECH_DISCOVERED" />
163+
<category android:name="android.intent.category.DEFAULT"/>
164+
</intent-filter>
165+
<meta-data android:name="android.nfc.action.TECH_DISCOVERED" android:resource="@xml/nfc_tech_filter" />
166+
</activity>
167+
<activity android:name=".activity.A1Calculator"
168+
android:label="@string/activity_converter_title"
169+
android:windowSoftInputMode="stateVisible"
170+
android:screenOrientation="portrait"
141171
android:parentActivityName=".activity.MainActivity">
142172
<meta-data
143173
android:name="android.support.PARENT_ACTIVITY"
120 KB
Binary file not shown.
41.4 KB
Binary file not shown.
46.9 KB
Binary file not shown.

app/src/main/java/org/glucosio/android/GlucosioApplication.java

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package org.glucosio.android;
22

33
import android.app.Application;
4-
import android.content.Context;
4+
import android.content.SharedPreferences;
5+
import android.preference.PreferenceManager;
56
import android.util.Log;
67

78
import com.google.android.gms.analytics.GoogleAnalytics;
89
import com.google.android.gms.analytics.Tracker;
10+
import com.instabug.library.IBGInvocationEvent;
911
import com.instabug.library.Instabug;
1012

1113
import uk.co.chrisjenx.calligraphy.CalligraphyConfig;
12-
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
1314

1415
public class GlucosioApplication extends Application {
1516

@@ -39,11 +40,31 @@ synchronized public Tracker getDefaultTracker() {
3940
public void onCreate() {
4041
super.onCreate();
4142

43+
// Get Dyslexia preference and adjust font
44+
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
45+
boolean isDyslexicModeOn = sharedPref.getBoolean("pref_font_dyslexia", false);
46+
47+
if (isDyslexicModeOn) {
48+
setFont("fonts/opendyslexic.otf");
49+
} else {
50+
setFont("fonts/lato.ttf");
51+
}
52+
53+
if (BuildConfig.DEBUG) {
54+
new Instabug.Builder(this, "b2226aa30fec24f6f4bed6ad68964e9b")
55+
.setInvocationEvent(IBGInvocationEvent.IBGInvocationEventShake)
56+
.build();
57+
} else {
58+
new Instabug.Builder(this, "820ee7db3118d03fd5f4249b5a73672e")
59+
.setInvocationEvent(IBGInvocationEvent.IBGInvocationEventShake)
60+
.build();
61+
}
62+
}
63+
64+
private void setFont(String font){
4265
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
43-
.setDefaultFontPath("fonts/lato.ttf")
66+
.setDefaultFontPath(font)
4467
.setFontAttrId(R.attr.fontPath)
4568
.build());
46-
Instabug.initialize(this, "b2226aa30fec24f6f4bed6ad68964e9b");
47-
4869
}
4970
}
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
package org.glucosio.android.activity;
2+
3+
import android.content.Context;
4+
import android.os.Bundle;
5+
import android.support.v7.app.AppCompatActivity;
6+
import android.support.v7.widget.Toolbar;
7+
import android.text.Editable;
8+
import android.text.TextWatcher;
9+
import android.view.KeyEvent;
10+
import android.view.Menu;
11+
import android.view.MenuItem;
12+
import android.view.inputmethod.EditorInfo;
13+
import android.view.inputmethod.InputMethodManager;
14+
import android.widget.EditText;
15+
import android.widget.TextView;
16+
17+
import org.glucosio.android.R;
18+
import org.glucosio.android.presenter.A1CCalculatorPresenter;
19+
20+
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
21+
22+
public class A1Calculator extends AppCompatActivity {
23+
24+
A1CCalculatorPresenter presenter;
25+
TextView glucoseUnit;
26+
double convertedA1C = 0;
27+
28+
@Override
29+
protected void onCreate(Bundle savedInstanceState) {
30+
super.onCreate(savedInstanceState);
31+
setContentView(R.layout.activity_a1_calculator);
32+
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
33+
34+
if (toolbar != null) {
35+
setSupportActionBar(toolbar);
36+
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
37+
getSupportActionBar().setElevation(2);
38+
}
39+
40+
presenter = new A1CCalculatorPresenter(this);
41+
42+
EditText glucoseEditText = (EditText) findViewById(R.id.activity_converter_a1c_glucose);
43+
glucoseUnit = (TextView) findViewById(R.id.activity_converter_a1c_glucose_unit);
44+
final TextView A1CTextView = (TextView) findViewById(R.id.activity_converter_a1c_a1c);
45+
46+
presenter.checkUnit();
47+
glucoseEditText.addTextChangedListener(new TextWatcher() {
48+
@Override
49+
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
50+
51+
}
52+
53+
@Override
54+
public void onTextChanged(CharSequence s, int start, int before, int count) {
55+
56+
}
57+
58+
@Override
59+
public void afterTextChanged(Editable s) {
60+
if (!s.toString().equals("")) {
61+
convertedA1C = presenter.calculateA1C(s.toString());
62+
A1CTextView.setText(convertedA1C+"");
63+
}
64+
}
65+
});
66+
67+
glucoseEditText.setOnEditorActionListener(
68+
new TextView.OnEditorActionListener() {
69+
70+
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
71+
if (actionId == EditorInfo.IME_ACTION_DONE) {
72+
// your additional processing...
73+
return true;
74+
} else {
75+
return false;
76+
}
77+
}
78+
});
79+
glucoseEditText.setFocusable(true);
80+
}
81+
82+
public void setMmol(){
83+
glucoseUnit.setText("mmol/L");
84+
}
85+
86+
@Override
87+
public boolean onKeyUp(int keyCode, KeyEvent event) {
88+
if (keyCode == KeyEvent.KEYCODE_BACK)
89+
{
90+
((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput
91+
(InputMethodManager.SHOW_FORCED,InputMethodManager.HIDE_IMPLICIT_ONLY);
92+
}
93+
return super.onKeyUp(keyCode, event);
94+
}
95+
96+
@Override
97+
public boolean onKeyDown(int keyCode, KeyEvent event) {
98+
if (keyCode == KeyEvent.KEYCODE_BACK)
99+
{
100+
((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput
101+
(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
102+
}
103+
return super.onKeyDown(keyCode, event);
104+
}
105+
106+
@Override
107+
public boolean onCreateOptionsMenu(Menu menu) {
108+
getMenuInflater().inflate(R.menu.menu_converter_a1c, menu);
109+
return true;
110+
}
111+
112+
@Override
113+
public boolean onOptionsItemSelected(MenuItem item) {
114+
switch (item.getItemId()) {
115+
case R.id.action_menu_save:
116+
presenter.saveA1C(convertedA1C);
117+
break;
118+
case android.R.id.home:
119+
finish();
120+
break;
121+
}
122+
return true;
123+
}
124+
125+
@Override
126+
protected void attachBaseContext(Context newBase) {
127+
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
128+
}
129+
}

0 commit comments

Comments
 (0)