Skip to content

Commit 8a8ec7f

Browse files
author
Paolo Rotolo
authored
Releasing Glucosio 1.3.0 (#322)
* Start working on Reminders. * Updated build gradle to 2.2.0-rc1 from beta * Add Reminders in Realm. Add migration to schema 4. * Add ArrayAdapter for reminders. * Continue work on Reminders. * Add method to get all active reminders * Automatic translation import (build 924). * Continue work on Reminders. * Fix migration. * Add reminders notification. * Fix some issues. * Codacy warnings fixed * Automatic translation import (build 937). * Fix reminder triggered on boot, update Gradle version to stable. * Update dependencies. * Fix #285 (#295) * Start working on Reminders. * Add Reminders in Realm. Add migration to schema 4. * Add ArrayAdapter for reminders. * Continue work on Reminders. * Add method to get all active reminders * Fix notes export, abstract to a pseudo MVP architecture * Continue work on Reminders. * Simple note tests * Fix notes export, abstract to a pseudo MVP architecture * Simple note tests * Improve quality from codacy report * Fix migration. * Class ReadingToCSV is not final, removed the redundant Sys.currentTMls, added todo to tests * Add reminders notification. * Improvements #2 on PR comments * Fix some issues. * Codacy warnings fixed * Automatic translation import (build 937). * Fix reminder triggered on boot, update Gradle version to stable. * Update dependencies. * Fix notes export, abstract to a pseudo MVP architecture * Simple note tests * Improve quality from codacy report * Class ReadingToCSV is not final, removed the redundant Sys.currentTMls, added todo to tests * Improvements #2 on PR comments * Add labels on reminders. * Add label on reminder notification. * Updated deprecated comment from WebviewClient * Moved URLs as fields * Extracted some methods and leaved the code cleaner * Created basic network connectivity * Extracted external glucosio links to separate class * Create and improved the basic network availability implementation * Refactored the LicenseActivity: - Made a presenter - Some basic interaction tests * Applied some format * Renamed to ExternalLinkActivity * Dialog made not cancelable * Typo fix for preferences terms * Initialized map with predefined 3 elements * Created launcher methodˆ * Replaced old call to Terms * Replaced old call to Terms on HelloActivity * Replaced all old called with the new launch method * Created extractor method for extracting title and url from intent extra * Removed obsolete tests and changed behaviour for presenter * Added new strings. Fix label layout. * Automatic translation import (build 957). * - Added annotations for non null parameters - Replaced empty string checks with Android classes - Private method for extra extracting * Fixed message for evening case * Removed unnecessary local variable * Allow comma as decimal separator when adding Glucose reading * Added contributor credits * Set locale back to default after tests in ReadingToolsTest * Refactor AddReadingPresenter * Cleaning some codacy useful warnings (#310) * Removing unused variables and fields, inlining fields used once, minor improvements * Removed unused misleading badge * Remove categories creaition from assistant (fix #245) (#308) * Removed unused functionality, introduced butterknife, removed categories mentioning and first tests for fragment * Removed unused field and minor cleanup * Removed cardview since it is not appropriate here * Removed whitespace * Added test for adapter * Simplified adapter instantiation * Added test for presenter * Add mmol/L unit check in validGlucose method * Remove hardcoded strings for concentrations like mg/dL * Add number formatting for values when converting to string * Improve FreeStyle Libre support (#306) * Updated build gradle to 2.2.0-rc1 from beta * Add labels on reminders. * Add label on reminder notification. * Updated deprecated comment from WebviewClient * Moved URLs as fields * Extracted some methods and leaved the code cleaner * Created basic network connectivity * Extracted external glucosio links to separate class * Create and improved the basic network availability implementation * Refactored the LicenseActivity: - Made a presenter - Some basic interaction tests * Applied some format * Renamed to ExternalLinkActivity * Dialog made not cancelable * Typo fix for preferences terms * Initialized map with predefined 3 elements * Created launcher methodˆ * Replaced old call to Terms * Replaced old call to Terms on HelloActivity * Replaced all old called with the new launch method * Created extractor method for extracting title and url from intent extra * Removed obsolete tests and changed behaviour for presenter * FreestyleLibre: divide raw value by 8.5 xdrip+/LimiTTer are dividing by 8.5, seems to work good for many people there, including me * FreesyleLibre: use latest value We wanted to use the latest history value, but used the oldest one, because array is filled from newest to oldest Also we should use trend values instead of history values, as the newest history value can be up to 15 minutes old * Added new strings. Fix label layout. * Automatic translation import (build 957). * - Added annotations for non null parameters - Replaced empty string checks with Android classes - Private method for extra extracting * Round the glucose value before converting to int * Fixed message for evening case * Removed unnecessary local variable * Allow comma as decimal separator when adding Glucose reading * Added contributor credits * Set locale back to default after tests in ReadingToolsTest * Refactor AddReadingPresenter * Cleaning some codacy useful warnings (#310) * Removing unused variables and fields, inlining fields used once, minor improvements * Removed unused misleading badge * Remove categories creaition from assistant (fix #245) (#308) * Removed unused functionality, introduced butterknife, removed categories mentioning and first tests for fragment * Removed unused field and minor cleanup * Removed cardview since it is not appropriate here * Removed whitespace * Added test for adapter * Simplified adapter instantiation * Added test for presenter * Fix mmol edit bug. * Fix A1C conversion bug. * Support 'Almost' translated languages This application is used in various countries. And in Crowdin, some languages are already 100% translated or almost translated. But Glucosio is still support only English. These features are enhancement of it. And also, you can find Crowdin's API for translation status. But there are too many non-translated languages and it was useless to get it's all data. The API needs Auth key so until it is cleared, just maintaining available strings manually would be better. I already made code, but I will just keep it. - Add available_languages.xml of 'almost' translated languages - Add updateLocale code on MainPresenter when there is already user profile in DB - Swap two codes order of calling MainPresenter for update MainActivities in start - Add localeHelper variable for MainActivity - Changed getLocalesWithTranslation to available languages - Fixed bug in build.gradle. It should contain one more backslash * Fix code duplication. * Target API 25. Add App Shortcuts. * Fix App Shortcuts. * Releasing Glucosio 1.3.0 * Fixed for StringIndexOutOfBoundsException * Trying to fix travis * Releasing Glucosio 1.3.0 (38)
1 parent 1ac224a commit 8a8ec7f

File tree

110 files changed

+2508
-720
lines changed

Some content is hidden

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

110 files changed

+2508
-720
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ jdk:
66
android:
77
components:
88
- tools
9-
- build-tools-24.0.0
10-
- android-24
9+
- build-tools-25.0.0
10+
- android-25
1111
- extra-android-support
1212
- extra-google-google_play_services
1313
- extra-android-m2repository

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
[![Build Status](https://travis-ci.org/Glucosio/glucosio-android.svg)](https://travis-ci.org/Glucosio/glucosio-android)
33
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a6f7bcc22a174ac9b36795438c143b6d)](https://www.codacy.com/app/Glucosio/glucosio-android?utm_source=github.com&utm_medium=referral&utm_content=Glucosio/glucosio-android&utm_campaign=Badge_Grade)
44
[![Coverage Status](https://coveralls.io/repos/github/Glucosio/glucosio-android/badge.svg?branch=develop)](https://coveralls.io/github/Glucosio/glucosio-android?branch=develop)
5-
[![Stories in Ready](https://badge.waffle.io/Glucosio/glucosio-android.svg?label=ready&title=Ready)](http://waffle.io/Glucosio/glucosio-android)
65

76
# Glucosio for Android
87
Glucosio for Android, a user centered free and open source app for Diabetes management and research for Android.

app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ apply plugin: 'com.neenbedankt.android-apt'
2424
apply plugin: 'jacoco'
2525

2626
android {
27-
compileSdkVersion 24
27+
compileSdkVersion 25
2828
buildToolsVersion buildToolsVer
2929

3030
lintOptions {
@@ -33,9 +33,9 @@ android {
3333

3434
defaultConfig {
3535
minSdkVersion 16
36-
targetSdkVersion 24
37-
versionCode 35
38-
versionName '1.2.1'
36+
targetSdkVersion 25
37+
versionCode 38
38+
versionName '1.3.0'
3939
applicationId 'org.glucosio.android'
4040

4141
vectorDrawables.useSupportLibrary = true
@@ -171,7 +171,7 @@ def getAllLocales() {
171171

172172
fileTree("src/main/res").visit { FileVisitDetails details ->
173173
if (details.file.path.endsWith("strings.xml")) {
174-
def languageCode = details.file.parent.tokenize('/').last().replaceAll('values-', '').replaceAll('-r', '-')
174+
def languageCode = details.file.parent.tokenize('/\\').last().replaceAll('values-', '').replaceAll('-r', '-')
175175
languageCode = (languageCode == "values") ? "en" : languageCode;
176176
foundLocales.append("\"").append(languageCode).append("\"").append(",")
177177
}

app/src/androidTest/java/org/glucosio/android/MainActivityTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,6 @@ public void check_001_checkIfToolbarIsDisplayed() throws InterruptedException {
5757
goThroughHelloActivity();
5858
onView(withId(R.id.activity_main_toolbar)).check(matches(isDisplayed()));
5959
}
60+
61+
// TODO: 09/09/16 Test the responses in UI -> Show ui notice when export started, is empty or error
6062
}

app/src/main/AndroidManifest.xml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@
3636
<!-- Required for Google Cloud Messaging -->
3737
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
3838

39+
<!-- Required to set reminders -->
40+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
41+
3942
<!-- Enable Chromebook support (no touch) -->
40-
<uses-feature android:name="android.hardware.touchscreen"
43+
<uses-feature
44+
android:name="android.hardware.touchscreen"
4145
android:required="false" />
4246

4347
<permission
@@ -66,7 +70,7 @@
6670
android:name=".activity.PreferencesActivity"
6771
android:theme="@style/GlucosioSettings" />
6872
<activity
69-
android:name=".activity.LicenceActivity"
73+
android:name=".activity.ExternalLinkActivity"
7074
android:theme="@style/GlucosioSettings" />
7175
<activity
7276
android:name=".activity.AboutActivity"
@@ -154,6 +158,7 @@
154158

155159
<category android:name="android.intent.category.DEFAULT" />
156160
</intent-filter>
161+
157162
<meta-data
158163
android:name="android.nfc.action.TECH_DISCOVERED"
159164
android:resource="@xml/nfc_tech_filter" />
@@ -169,7 +174,7 @@
169174
android:value="org.glucosio.android.activity.MainActivity" />
170175
</activity>
171176

172-
<!-- Google Cloud Messaging receiver -->
177+
<!-- Google Cloud Messaging receiver -->
173178
<receiver
174179
android:name="com.google.android.gms.gcm.GcmReceiver"
175180
android:exported="true"
@@ -195,6 +200,15 @@
195200
</intent-filter>
196201
</service>
197202

203+
<receiver
204+
android:name="org.glucosio.android.receivers.GlucosioBroadcastReceiver"
205+
android:enabled="false">
206+
<intent-filter>
207+
<action android:name="android.intent.action.BOOT_COMPLETED" />
208+
<action android:name="android.intent.action.MAIN" />
209+
</intent-filter>
210+
</receiver>
211+
198212
<!--
199213
Register AnalyticsReceiver and AnalyticsService to support background
200214
dispatching on non-Google Play devices
@@ -236,9 +250,14 @@
236250
android:theme="@style/SplashTheme">
237251
<intent-filter>
238252
<action android:name="android.intent.action.MAIN" />
253+
239254
<category android:name="android.intent.category.LAUNCHER" />
240255
</intent-filter>
256+
<meta-data
257+
android:name="android.app.shortcuts"
258+
android:resource="@xml/shortcuts" />
241259
</activity>
260+
<activity android:name=".activity.RemindersActivity"></activity>
242261
</application>
243262

244263
</manifest>

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
import uk.co.chrisjenx.calligraphy.CalligraphyConfig;
4444

4545
public class GlucosioApplication extends Application {
46+
47+
private static GlucosioApplication sInstance;
48+
4649
@Nullable
4750
private Analytics analytics;
4851

@@ -55,7 +58,7 @@ public class GlucosioApplication extends Application {
5558
@Override
5659
public void onCreate() {
5760
super.onCreate();
58-
61+
sInstance = this;
5962
initFont();
6063
initLanguage();
6164
}
@@ -153,6 +156,13 @@ public Preferences getPreferences() {
153156
return preferences;
154157
}
155158

159+
public static GlucosioApplication getInstance() {
160+
if (sInstance == null) {
161+
sInstance = new GlucosioApplication();
162+
}
163+
return sInstance;
164+
}
165+
156166
@NonNull
157167
public HelloPresenter createHelloPresenter(@NonNull final HelloActivity activity) {
158168
return new HelloPresenter(activity, getDBHandler());

app/src/main/java/org/glucosio/android/activity/AboutActivity.java

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@
2929
import android.support.v7.app.AppCompatActivity;
3030
import android.view.MenuItem;
3131
import android.widget.Toast;
32-
32+
import java.util.Locale;
3333
import org.glucosio.android.GlucosioApplication;
3434
import org.glucosio.android.R;
3535
import org.glucosio.android.analytics.Analytics;
36-
37-
import java.util.Locale;
38-
36+
import org.glucosio.android.tools.network.GlucosioExternalLinks;
3937
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
4038

4139
public class AboutActivity extends AppCompatActivity {
@@ -75,32 +73,28 @@ public void onCreate(final Bundle savedInstanceState) {
7573
final Preference privacyPref = (Preference) findPreference("preference_privacy");
7674
final Preference termsPref = (Preference) findPreference("preference_terms");
7775
final Preference versionPref = (Preference) findPreference("preference_version");
76+
final Preference thanksPref = (Preference) findPreference("preference_thanks");
7877

7978

8079
termsPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
8180
@Override
8281
public boolean onPreferenceClick(Preference preference) {
83-
Intent intent = new Intent(getActivity(), LicenceActivity.class);
84-
Bundle bundle = new Bundle();
85-
bundle.putString("key", "terms");
86-
intent.putExtras(bundle);
87-
startActivity(intent);
88-
82+
ExternalLinkActivity.launch(
83+
getActivity(),
84+
getString(R.string.preferences_terms),
85+
GlucosioExternalLinks.TERMS);
8986
addTermsAnalyticsEvent("Glucosio Terms opened");
90-
9187
return false;
9288
}
9389
});
9490

9591
licencesPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
9692
@Override
9793
public boolean onPreferenceClick(Preference preference) {
98-
Intent intent = new Intent(getActivity(), LicenceActivity.class);
99-
Bundle bundle = new Bundle();
100-
bundle.putString("key", "open_source");
101-
intent.putExtras(bundle);
102-
startActivity(intent);
103-
94+
ExternalLinkActivity.launch(
95+
getActivity(),
96+
getString(R.string.preferences_licences_open),
97+
GlucosioExternalLinks.LICENSES);
10498
addTermsAnalyticsEvent("Glucosio Licence opened");
10599
return false;
106100
}
@@ -136,14 +130,23 @@ public boolean onPreferenceClick(Preference preference) {
136130
privacyPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
137131
@Override
138132
public boolean onPreferenceClick(Preference preference) {
139-
Intent intent = new Intent(getActivity(), LicenceActivity.class);
140-
Bundle bundle = new Bundle();
141-
bundle.putString("key", "privacy");
142-
intent.putExtras(bundle);
143-
startActivity(intent);
144-
133+
ExternalLinkActivity.launch(
134+
getActivity(),
135+
getString(R.string.preferences_privacy),
136+
GlucosioExternalLinks.PRIVACY);
145137
addTermsAnalyticsEvent("Glucosio Privacy opened");
138+
return false;
139+
}
140+
});
146141

142+
thanksPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
143+
@Override
144+
public boolean onPreferenceClick(Preference preference) {
145+
ExternalLinkActivity.launch(
146+
getActivity(),
147+
getString(R.string.preferences_contributors),
148+
GlucosioExternalLinks.THANKS);
149+
addTermsAnalyticsEvent("Glucosio Contributors opened");
147150
return false;
148151
}
149152
});

app/src/main/java/org/glucosio/android/activity/AddA1CActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected void onCreate(Bundle savedInstanceState) {
6262
this.createFANViewAndListener();
6363

6464
if (!"percentage".equals(presenter.getA1CUnitMeasuerement())) {
65-
unitTextView.setText("mmol/mol");
65+
unitTextView.setText(getString(R.string.mmol_mol));
6666
}
6767

6868
// If an id is passed, open the activity in edit mode

app/src/main/java/org/glucosio/android/activity/AddGlucoseActivity.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ public class AddGlucoseActivity extends AddReadingActivity {
5252
private TextView readingTextView;
5353
private EditText typeCustomEditText;
5454
private EditText notesEditText;
55-
private AppCompatButton addFreeStyleButton;
56-
private TextInputLayout readingInputLayout;
5755
private LabelledSpinner readingTypeSpinner;
5856
private boolean isCustomType = false;
5957

@@ -79,8 +77,8 @@ protected void onCreate(Bundle savedInstanceState) {
7977
readingTypeSpinner.setItemsArray(R.array.dialog_add_measured_list);
8078
readingTextView = (TextView) findViewById(R.id.glucose_add_concentration);
8179
typeCustomEditText = (EditText) findViewById(R.id.glucose_type_custom);
82-
readingInputLayout = (TextInputLayout) findViewById(R.id.glucose_add_concentration_layout);
83-
addFreeStyleButton = (AppCompatButton) findViewById(R.id.glucose_add_freestyle_button);
80+
TextInputLayout readingInputLayout = (TextInputLayout) findViewById(R.id.glucose_add_concentration_layout);
81+
AppCompatButton addFreeStyleButton = (AppCompatButton) findViewById(R.id.glucose_add_freestyle_button);
8482
notesEditText = (EditText) findViewById(R.id.glucose_add_notes);
8583

8684
this.createDateTimeViewAndListener();
@@ -110,9 +108,9 @@ public void onNothingChosen(View labelledSpinner, AdapterView<?> adapterView) {
110108
TextView unitM = (TextView) findViewById(R.id.glucose_add_unit_measurement);
111109

112110
if (presenter.getUnitMeasuerement().equals("mg/dL")) {
113-
unitM.setText("mg/dL");
111+
unitM.setText(getString(R.string.mg_dL));
114112
} else {
115-
unitM.setText("mmol/L");
113+
unitM.setText(getString(R.string.mmol_L));
116114
}
117115

118116
// If an id is passed, open the activity in edit mode
@@ -121,7 +119,15 @@ public void onNothingChosen(View labelledSpinner, AdapterView<?> adapterView) {
121119
if (this.isEditing()) {
122120
setTitle(R.string.title_activity_add_glucose_edit);
123121
GlucoseReading readingToEdit = presenter.getGlucoseReadingById(this.getEditId());
124-
readingTextView.setText(readingToEdit.getReading() + "");
122+
123+
String readingString;
124+
if (presenter.getUnitMeasuerement().equals("mg/dL")) {
125+
readingString = String.valueOf(readingToEdit.getReading());
126+
} else {
127+
readingString = String.valueOf(presenter.convertToMmol(readingToEdit.getReading()));
128+
}
129+
130+
readingTextView.setText(readingString);
125131
notesEditText.setText(readingToEdit.getNotes());
126132
cal.setTime(readingToEdit.getCreated());
127133
this.getAddDateTextView().setText(dateTime.getDate(cal));
@@ -154,7 +160,7 @@ public void onNothingChosen(View labelledSpinner, AdapterView<?> adapterView) {
154160

155161
p = getIntent().getExtras();
156162
reading = p.getString("reading");
157-
if (reading!=null) {
163+
if (reading != null) {
158164
// If yes, first convert the decimal value from Freestyle to Integer
159165
double d = Double.parseDouble(reading);
160166
int glucoseValue = (int) d;

app/src/main/java/org/glucosio/android/activity/AddWeightActivity.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
public class AddWeightActivity extends AddReadingActivity {
3636

3737
private TextView readingTextView;
38-
private TextView unitTextView;
3938

4039
@Override
4140
protected void onCreate(Bundle savedInstanceState) {
@@ -56,7 +55,7 @@ protected void onCreate(Bundle savedInstanceState) {
5655
presenter.setReadingTimeNow();
5756

5857
readingTextView = (TextView) findViewById(R.id.weight_add_value);
59-
unitTextView = (TextView) findViewById(R.id.weight_add_unit_measurement);
58+
TextView unitTextView = (TextView) findViewById(R.id.weight_add_unit_measurement);
6059

6160
this.createDateTimeViewAndListener();
6261
this.createFANViewAndListener();

0 commit comments

Comments
 (0)