diff --git a/app/src/main/java/org/glucosio/android/adapter/HistoryAdapter.java b/app/src/main/java/org/glucosio/android/adapter/HistoryAdapter.java index 66dba537..0dcf093f 100644 --- a/app/src/main/java/org/glucosio/android/adapter/HistoryAdapter.java +++ b/app/src/main/java/org/glucosio/android/adapter/HistoryAdapter.java @@ -21,6 +21,7 @@ package org.glucosio.android.adapter; import android.content.Context; +import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; @@ -189,7 +190,7 @@ public void onBindViewHolder(ViewHolder holder, int position) { datetimeTextView.setText(presenter.convertDate(hb1acDateTimeArray.get(position))); typeTextView.setText(""); typeTextView.setVisibility(View.GONE); - readingTextView.setTextColor(mContext.getResources().getColor(R.color.glucosio_text_dark)); + readingTextView.setTextColor(ContextCompat.getColor(mContext, R.color.glucosio_text_dark)); break; // Cholesterol case 2: @@ -198,7 +199,7 @@ public void onBindViewHolder(ViewHolder holder, int position) { readingTextView.setText(mContext.getString(R.string.mg_dL_value, reading)); datetimeTextView.setText(presenter.convertDate(cholesterolDateTimeArray.get(position))); typeTextView.setText("LDL: " + cholesterolLDLArray.get(position) + " - " + "HDL: " + cholesterolHDLArray.get(position)); - readingTextView.setTextColor(mContext.getResources().getColor(R.color.glucosio_text_dark)); + readingTextView.setTextColor(ContextCompat.getColor(mContext, R.color.glucosio_text_dark)); break; // Pressure case 3: @@ -207,7 +208,7 @@ public void onBindViewHolder(ViewHolder holder, int position) { datetimeTextView.setText(presenter.convertDate(pressureDateTimeArray.get(position))); typeTextView.setText(""); typeTextView.setVisibility(View.GONE); - readingTextView.setTextColor(mContext.getResources().getColor(R.color.glucosio_text_dark)); + readingTextView.setTextColor(ContextCompat.getColor(mContext, R.color.glucosio_text_dark)); break; //Ketones case 4: @@ -216,7 +217,7 @@ public void onBindViewHolder(ViewHolder holder, int position) { datetimeTextView.setText(presenter.convertDate(ketoneDataTimeArray.get(position))); typeTextView.setText(""); typeTextView.setVisibility(View.GONE); - readingTextView.setTextColor(mContext.getResources().getColor(R.color.glucosio_text_dark)); + readingTextView.setTextColor(ContextCompat.getColor(mContext, R.color.glucosio_text_dark)); break; // Weight case 5: @@ -233,7 +234,7 @@ public void onBindViewHolder(ViewHolder holder, int position) { datetimeTextView.setText(presenter.convertDate(weightDataTime.get(position))); typeTextView.setText(""); typeTextView.setVisibility(View.GONE); - readingTextView.setTextColor(mContext.getResources().getColor(R.color.glucosio_text_dark)); + readingTextView.setTextColor(ContextCompat.getColor(mContext, R.color.glucosio_text_dark)); break; } } diff --git a/app/src/main/java/org/glucosio/android/fragment/HistoryFragment.java b/app/src/main/java/org/glucosio/android/fragment/HistoryFragment.java index 2497ce99..a5b0a351 100644 --- a/app/src/main/java/org/glucosio/android/fragment/HistoryFragment.java +++ b/app/src/main/java/org/glucosio/android/fragment/HistoryFragment.java @@ -28,6 +28,7 @@ import android.support.design.widget.BottomSheetDialog; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; +import android.support.v4.content.ContextCompat; import android.support.v7.widget.CardView; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; @@ -232,7 +233,7 @@ public void onClick(View v) { item.setAlpha(1.0f); mAdapter.notifyDataSetChanged(); } - }).setActionTextColor(getResources().getColor(R.color.glucosio_accent)).show(); + }).setActionTextColor(ContextCompat.getColor(getContext(), R.color.glucosio_accent)).show(); } }); diff --git a/app/src/main/java/org/glucosio/android/fragment/OverviewFragment.java b/app/src/main/java/org/glucosio/android/fragment/OverviewFragment.java index f342b212..b51747b5 100644 --- a/app/src/main/java/org/glucosio/android/fragment/OverviewFragment.java +++ b/app/src/main/java/org/glucosio/android/fragment/OverviewFragment.java @@ -276,7 +276,7 @@ public void onNothingSelected(AdapterView parent) { final XAxis xAxis = chart.getXAxis(); xAxis.setDrawGridLines(false); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); - xAxis.setTextColor(getResources().getColor(R.color.glucosio_text_light)); + xAxis.setTextColor(ContextCompat.getColor(getContext(), R.color.glucosio_text_light)); xAxis.setAvoidFirstLastClipping(true); double minGlucoseValue = presenter.getGlucoseMinValue(); @@ -294,13 +294,13 @@ public void onNothingSelected(AdapterView parent) { } ll1.setLineWidth(0.8f); - ll1.setLineColor(getResources().getColor(R.color.glucosio_reading_low)); + ll1.setLineColor(ContextCompat.getColor(getContext(), R.color.glucosio_reading_low)); ll2.setLineWidth(0.8f); - ll2.setLineColor(getResources().getColor(R.color.glucosio_reading_high)); + ll2.setLineColor(ContextCompat.getColor(getContext(), R.color.glucosio_reading_high)); YAxis leftAxis = chart.getAxisLeft(); - leftAxis.setTextColor(getResources().getColor(R.color.glucosio_text_light)); + leftAxis.setTextColor(ContextCompat.getColor(getContext(), R.color.glucosio_text_light)); leftAxis.setStartAtZero(false); leftAxis.disableGridDashedLine(); leftAxis.setDrawGridLines(false); @@ -483,7 +483,7 @@ private LineData generateGlucoseData() { } xValues = xVals; - LineData data = new LineData(generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_pink))); + LineData data = new LineData(generateLineDataSet(yVals, ContextCompat.getColor(getContext(), R.color.glucosio_pink))); return data; } @@ -505,7 +505,7 @@ private LineData generateA1cData() { xValues = xVals; // create a data object with the datasets - return new LineData(generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_fab_HB1AC))); + return new LineData(generateLineDataSet(yVals, ContextCompat.getColor(getContext(), R.color.glucosio_fab_HB1AC))); } private LineData generateKetonesData() { @@ -526,7 +526,7 @@ private LineData generateKetonesData() { xValues = xVals; // create a data object with the datasets - return new LineData(generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_fab_ketones))); + return new LineData(generateLineDataSet(yVals, ContextCompat.getColor(getContext(), R.color.glucosio_fab_ketones))); } private LineData generateWeightData() { @@ -547,7 +547,7 @@ private LineData generateWeightData() { xValues = xVals; // create a data object with the datasets - return new LineData(generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_fab_weight))); + return new LineData(generateLineDataSet(yVals, ContextCompat.getColor(getContext(), R.color.glucosio_fab_weight))); } private LineData generatePressureData() { @@ -575,8 +575,8 @@ private LineData generatePressureData() { } xValues = xVals; - LineData data = new LineData(generateLineDataSet(yValsMax, getResources().getColor(R.color.glucosio_fab_pressure))); - data.addDataSet(generateLineDataSet(yValsMin, getResources().getColor(R.color.glucosio_fab_pressure))); + LineData data = new LineData(generateLineDataSet(yValsMax, ContextCompat.getColor(getContext(), R.color.glucosio_fab_pressure))); + data.addDataSet(generateLineDataSet(yValsMin, ContextCompat.getColor(getContext(), R.color.glucosio_fab_pressure))); // create a data object with the datasets return data; } @@ -599,7 +599,7 @@ private LineData generateCholesterolData() { xValues = xVals; // create a data object with the datasets - return new LineData(generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_fab_cholesterol))); + return new LineData(generateLineDataSet(yVals, ContextCompat.getColor(getContext(), R.color.glucosio_fab_cholesterol))); } private LineDataSet generateLineDataSet(List vals, int color) { @@ -607,7 +607,7 @@ private LineDataSet generateLineDataSet(List vals, int color) { LineDataSet set1 = new LineDataSet(vals, ""); List colors = new ArrayList<>(); - if (color == getResources().getColor(R.color.glucosio_pink)) { + if (color == ContextCompat.getColor(getContext(), R.color.glucosio_pink)) { for (Entry val : vals) { if (val.getY() == (0)) { colors.add(Color.TRANSPARENT); @@ -630,7 +630,7 @@ private LineDataSet generateLineDataSet(List vals, int color) { set1.setValueTextSize(0); set1.setValueTextColor(Color.parseColor("#FFFFFF")); set1.setFillDrawable(getResources().getDrawable(R.drawable.graph_gradient)); - set1.setHighLightColor(getResources().getColor(R.color.glucosio_gray_light)); + set1.setHighLightColor(ContextCompat.getColor(getContext(), R.color.glucosio_gray_light)); set1.setCubicIntensity(0.2f); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2) { diff --git a/app/src/main/java/org/glucosio/android/service/DataLayerListenerService.java b/app/src/main/java/org/glucosio/android/service/DataLayerListenerService.java index d1eea554..e8aef4f6 100644 --- a/app/src/main/java/org/glucosio/android/service/DataLayerListenerService.java +++ b/app/src/main/java/org/glucosio/android/service/DataLayerListenerService.java @@ -24,6 +24,7 @@ import android.app.PendingIntent; import android.content.Intent; import android.support.v4.app.NotificationCompat; +import android.support.v4.content.ContextCompat; import android.util.Log; import com.google.android.gms.wearable.MessageEvent; import com.google.android.gms.wearable.WearableListenerService; @@ -79,7 +80,7 @@ private void showNotification(String reading, String readingType) { new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_stat_glucosio) .setContentTitle(getResources().getString(R.string.wear_new_reading)) - .setColor(getResources().getColor(R.color.glucosio_pink)) + .setColor(ContextCompat.getColor(getApplicationContext(), R.color.glucosio_pink)) .setContentIntent(contentIntent) .setAutoCancel(true) .setContentText(reading + ", " + readingType); diff --git a/app/src/main/java/org/glucosio/android/tools/GlucoseRanges.java b/app/src/main/java/org/glucosio/android/tools/GlucoseRanges.java index fa4659cd..a7183ec0 100644 --- a/app/src/main/java/org/glucosio/android/tools/GlucoseRanges.java +++ b/app/src/main/java/org/glucosio/android/tools/GlucoseRanges.java @@ -21,6 +21,7 @@ package org.glucosio.android.tools; import android.content.Context; +import android.support.annotation.ColorRes; import android.support.annotation.VisibleForTesting; import android.support.v4.content.ContextCompat; import org.glucosio.android.R; @@ -106,18 +107,24 @@ public String colorFromReading(double reading) { } public int stringToColor(String color) { + @ColorRes int colorInt; switch (color) { case "green": - return ContextCompat.getColor(mContext, R.color.glucosio_reading_ok); + colorInt = R.color.glucosio_reading_ok; + break; case "red": - return ContextCompat.getColor(mContext, R.color.glucosio_reading_hyper); + colorInt = R.color.glucosio_reading_hyper; + break; case "blue": - return ContextCompat.getColor(mContext, R.color.glucosio_reading_low); + colorInt = R.color.glucosio_reading_low; + break; case "orange": - return ContextCompat.getColor(mContext, R.color.glucosio_reading_high); + colorInt = R.color.glucosio_reading_high; + break; default: - return ContextCompat.getColor(mContext, R.color.glucosio_reading_hypo); + colorInt = R.color.glucosio_reading_hypo; } - } + return ContextCompat.getColor(mContext, colorInt); + } } diff --git a/app/src/main/java/org/glucosio/android/tools/LabelledSpinner.java b/app/src/main/java/org/glucosio/android/tools/LabelledSpinner.java index 8514030e..cb26b361 100644 --- a/app/src/main/java/org/glucosio/android/tools/LabelledSpinner.java +++ b/app/src/main/java/org/glucosio/android/tools/LabelledSpinner.java @@ -23,9 +23,11 @@ import android.content.Context; import android.content.res.TypedArray; import android.support.annotation.ArrayRes; +import android.support.annotation.ColorInt; import android.support.annotation.ColorRes; import android.support.annotation.LayoutRes; import android.support.annotation.StringRes; +import android.support.v4.content.ContextCompat; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; @@ -91,7 +93,7 @@ private void initializeViews(Context context, AttributeSet attrs) { 0); String labelText = typedArray.getString(R.styleable.LabelledSpinner_labelText); mWidgetColor = typedArray.getColor(R.styleable.LabelledSpinner_widgetColor, - getResources().getColor(R.color.widget_labelled_spinner)); + ContextCompat.getColor(getContext(), R.color.widget_labelled_spinner)); typedArray.recycle(); LayoutInflater inflater = @@ -174,8 +176,9 @@ public int getColor() { * color that is to be displayed on the widget. */ public void setColor(@ColorRes int colorRes) { - mLabel.setTextColor(getResources().getColor(colorRes)); - mDivider.setBackgroundColor(getResources().getColor(colorRes)); + @ColorInt int color = ContextCompat.getColor(getContext(), colorRes); + mLabel.setTextColor(color); + mDivider.setBackgroundColor(color); } /** @@ -400,4 +403,4 @@ public interface OnItemChosenListener { */ void onNothingChosen(View labelledSpinner, AdapterView adapterView); } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/glucosio/android/tools/NotDismissableEditText.java b/app/src/main/java/org/glucosio/android/tools/NotDismissableEditText.java index 7a051abe..13bd6aee 100644 --- a/app/src/main/java/org/glucosio/android/tools/NotDismissableEditText.java +++ b/app/src/main/java/org/glucosio/android/tools/NotDismissableEditText.java @@ -21,12 +21,12 @@ package org.glucosio.android.tools; import android.content.Context; +import android.support.v7.widget.AppCompatEditText; import android.util.AttributeSet; import android.view.KeyEvent; -import android.widget.EditText; -public class NotDismissableEditText extends EditText { +public class NotDismissableEditText extends AppCompatEditText { public NotDismissableEditText(Context context, AttributeSet attrs) { super(context, attrs); diff --git a/app/src/main/res/layout/activity_a1_calculator.xml b/app/src/main/res/layout/activity_a1_calculator.xml index 61fc10c7..29c6b434 100644 --- a/app/src/main/res/layout/activity_a1_calculator.xml +++ b/app/src/main/res/layout/activity_a1_calculator.xml @@ -62,7 +62,8 @@ android:text="@string/activity_converter_a1c_glucose" android:textColor="@color/glucosio_text_dark" android:textSize="12sp" - android:textStyle="bold" /> + android:textStyle="bold" + tools:ignore="MissingPrefix" /> + android:textSize="52sp" + tools:ignore="MissingPrefix" /> + android:textSize="52sp" + tools:ignore="MissingPrefix" /> @@ -83,11 +82,11 @@ android:layout_weight="2"> + android:hint="@string/dialog_add_cholesterol_total" /> + android:textStyle="bold" + tools:ignore="MissingPrefix" /> + android:hint="@string/dialog_add_cholesterol_ldl" /> + android:hint="@string/dialog_add_cholesterol_hdl" /> + android:textStyle="bold" + tools:ignore="MissingPrefix" /> @@ -184,8 +185,8 @@ android:cursorVisible="false" android:focusable="false" android:focusableInTouchMode="false" - android:inputType="time" android:hint="@string/dialog_add_time" + android:inputType="time" android:singleLine="true" android:textSize="@dimen/abc_text_size_body_2_material" /> diff --git a/app/src/main/res/layout/activity_add_glucose.xml b/app/src/main/res/layout/activity_add_glucose.xml index e73d0519..3465d37f 100644 --- a/app/src/main/res/layout/activity_add_glucose.xml +++ b/app/src/main/res/layout/activity_add_glucose.xml @@ -52,7 +52,6 @@ android:layout_alignParentRight="true" android:layout_marginBottom="-32dp" android:layout_marginRight="20dp" - android:onClick="onFabClicked" android:visibility="invisible" app:backgroundTint="@color/glucosio_accent" app:srcCompat="@drawable/ic_done_black_24dp" /> @@ -86,11 +85,11 @@ android:layout_weight="1"> + android:hint="@string/dialog_add_concentration" /> + android:textStyle="bold" + tools:ignore="MissingPrefix" /> + android:textStyle="bold" + android:visibility="gone" /> @@ -156,8 +156,8 @@ android:cursorVisible="false" android:focusable="false" android:focusableInTouchMode="false" - android:inputType="time" android:hint="@string/dialog_add_time" + android:inputType="time" android:singleLine="true" android:textSize="@dimen/abc_text_size_body_2_material" /> diff --git a/app/src/main/res/layout/activity_add_hb1ac.xml b/app/src/main/res/layout/activity_add_hb1ac.xml index 1850a527..a82aac67 100644 --- a/app/src/main/res/layout/activity_add_hb1ac.xml +++ b/app/src/main/res/layout/activity_add_hb1ac.xml @@ -51,7 +51,6 @@ android:layout_alignParentRight="true" android:layout_marginBottom="-32dp" android:layout_marginRight="20dp" - android:onClick="onFabClicked" android:visibility="invisible" app:backgroundTint="@color/glucosio_accent" app:srcCompat="@drawable/ic_done_black_24dp" /> @@ -82,11 +81,11 @@ android:layout_weight="1"> + android:hint="@string/dialog_add_hb1ac" /> + android:textStyle="bold" + tools:ignore="MissingPrefix" /> @@ -82,11 +81,11 @@ android:layout_weight="1"> + android:hint="@string/dialog_add_ketones" /> + android:textStyle="bold" + tools:ignore="MissingPrefix" /> diff --git a/app/src/main/res/layout/activity_add_pressure.xml b/app/src/main/res/layout/activity_add_pressure.xml index 4d893a12..c6d43c5e 100644 --- a/app/src/main/res/layout/activity_add_pressure.xml +++ b/app/src/main/res/layout/activity_add_pressure.xml @@ -51,7 +51,6 @@ android:layout_alignParentRight="true" android:layout_marginBottom="-32dp" android:layout_marginRight="20dp" - android:onClick="onFabClicked" android:visibility="invisible" app:backgroundTint="@color/glucosio_accent" app:srcCompat="@drawable/ic_done_black_24dp" /> @@ -83,11 +82,11 @@ android:layout_weight="1"> + android:hint="@string/dialog_add_pressure_max" /> + android:hint="@string/dialog_add_pressure_min" /> + android:textStyle="bold" + tools:ignore="MissingPrefix" /> @@ -92,6 +91,7 @@ \ No newline at end of file + android:layout_height="fill_parent" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 7ef5b261..f16001f2 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -96,7 +96,7 @@ + android:layout_weight="1" /> diff --git a/app/src/main/res/layout/backup_drive_activity.xml b/app/src/main/res/layout/backup_drive_activity.xml index 832cdb54..df42da2a 100644 --- a/app/src/main/res/layout/backup_drive_activity.xml +++ b/app/src/main/res/layout/backup_drive_activity.xml @@ -1,5 +1,6 @@ + android:textStyle="bold" + tools:ignore="MissingPrefix" /> + android:textStyle="bold" + tools:ignore="MissingPrefix" /> + android:text="@string/activity_main_add_new_reading" + tools:ignore="MissingPrefix" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> @@ -135,7 +140,8 @@ android:gravity="center" android:paddingTop="8dp" android:text="@string/fab_pressure" - android:textSize="12sp" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_add_bottom_dialog_disabled.xml b/app/src/main/res/layout/fragment_add_bottom_dialog_disabled.xml index 760e0676..d3c2dbdf 100644 --- a/app/src/main/res/layout/fragment_add_bottom_dialog_disabled.xml +++ b/app/src/main/res/layout/fragment_add_bottom_dialog_disabled.xml @@ -1,6 +1,7 @@ + android:text="@string/activity_main_add_new_reading" + tools:ignore="MissingPrefix" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> @@ -127,7 +132,8 @@ android:gravity="center" android:paddingTop="8dp" android:text="@string/fab_pressure" - android:textSize="12sp" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> + android:textSize="12sp" + tools:ignore="MissingPrefix" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_assistant_item.xml b/app/src/main/res/layout/fragment_assistant_item.xml index 9ff4747a..8c7c0f8f 100644 --- a/app/src/main/res/layout/fragment_assistant_item.xml +++ b/app/src/main/res/layout/fragment_assistant_item.xml @@ -36,6 +36,7 @@ android:paddingLeft="16dp" android:paddingRight="16dp" android:textStyle="bold" + tools:ignore="MissingPrefix" tools:text="Title" /> SplashActivity Manage on Drive + mm/Hg mmol/mol mmol/L %1$s mmol/mol