MainApp.sResources.getColor -> MainApp.gc.

This commit is contained in:
Johannes Mockenhaupt 2018-05-06 11:47:15 +02:00
parent b9c649bd68
commit ef70c1f244
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
12 changed files with 43 additions and 43 deletions

View file

@ -80,9 +80,9 @@ public class HistoryBrowseActivity extends AppCompatActivity {
ButterKnife.bind(this);
bgGraph.getGridLabelRenderer().setGridColor(MainApp.sResources.getColor(R.color.graphgrid));
bgGraph.getGridLabelRenderer().setGridColor(MainApp.gc(R.color.graphgrid));
bgGraph.getGridLabelRenderer().reloadStyles();
iobGraph.getGridLabelRenderer().setGridColor(MainApp.sResources.getColor(R.color.graphgrid));
iobGraph.getGridLabelRenderer().setGridColor(MainApp.gc(R.color.graphgrid));
iobGraph.getGridLabelRenderer().reloadStyles();
iobGraph.getGridLabelRenderer().setHorizontalLabelsVisible(false);
bgGraph.getGridLabelRenderer().setLabelVerticalWidth(50);

View file

@ -211,27 +211,27 @@ public class BgReading implements DataPointWithLabelInterface {
if (highLine < 1) {
highLine = Profile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units);
}
int color = MainApp.sResources.getColor(R.color.inrange);
int color = MainApp.gc(R.color.inrange);
if (isPrediction())
return getPredectionColor();
else if (valueToUnits(units) < lowLine)
color = MainApp.sResources.getColor(R.color.low);
color = MainApp.gc(R.color.low);
else if (valueToUnits(units) > highLine)
color = MainApp.sResources.getColor(R.color.high);
color = MainApp.gc(R.color.high);
return color;
}
public int getPredectionColor() {
if (isIOBPrediction)
return MainApp.sResources.getColor(R.color.iob);
return MainApp.gc(R.color.iob);
if (isCOBPrediction)
return MainApp.sResources.getColor(R.color.cob);
return MainApp.gc(R.color.cob);
if (isaCOBPrediction)
return 0x80FFFFFF & MainApp.sResources.getColor(R.color.cob);
return 0x80FFFFFF & MainApp.gc(R.color.cob);
if (isUAMPrediction)
return MainApp.sResources.getColor(R.color.uam);
return MainApp.gc(R.color.uam);
if (isZTPrediction)
return MainApp.sResources.getColor(R.color.zt);
return MainApp.gc(R.color.zt);
return R.color.mdtp_white;
}

View file

@ -251,7 +251,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
@Override
public int getColor() {
if (eventType.equals(ANNOUNCEMENT))
return MainApp.sResources.getColor(R.color.notificationAnnouncement);
return MainApp.gc(R.color.notificationAnnouncement);
if (eventType.equals(MBG))
return Color.RED;
if (eventType.equals(BGCHECK))

View file

@ -175,14 +175,14 @@ public class FillDialog extends DialogFragment implements OnClickListener {
confirmMessage.add("");
confirmMessage.add(MainApp.gs(R.string.bolus) + ": " + "<font color='" + MainApp.gc(R.color.colorCarbsButton) + "'>" + insulinAfterConstraints + "U" + "</font>");
if (!insulinAfterConstraints.equals(insulin))
confirmMessage.add("<font color='" + MainApp.sResources.getColor(R.color.low) + "'>" + MainApp.gs(R.string.bolusconstraintapplied) + "</font>");
confirmMessage.add("<font color='" + MainApp.gc(R.color.low) + "'>" + MainApp.gs(R.string.bolusconstraintapplied) + "</font>");
}
if (pumpSiteChangeCheckbox.isChecked())
confirmMessage.add("" + "<font color='" + MainApp.sResources.getColor(R.color.high) + "'>" + MainApp.gs(R.string.record_pump_site_change) + "</font>");
confirmMessage.add("" + "<font color='" + MainApp.gc(R.color.high) + "'>" + MainApp.gs(R.string.record_pump_site_change) + "</font>");
if (insulinCartridgeChangeCheckbox.isChecked())
confirmMessage.add("" + "<font color='" + MainApp.sResources.getColor(R.color.high) + "'>" + MainApp.gs(R.string.record_insulin_cartridge_change) + "</font>");
confirmMessage.add("" + "<font color='" + MainApp.gc(R.color.high) + "'>" + MainApp.gs(R.string.record_insulin_cartridge_change) + "</font>");
final String notes = notesEdit.getText().toString();
if (!notes.isEmpty()) {

View file

@ -269,9 +269,9 @@ public class CareportalFragment extends SubscriberFragment implements View.OnCli
public static int determineTextColor(CareportalEvent careportalEvent, double warnThreshold, double urgentThreshold) {
if (careportalEvent.isOlderThan(urgentThreshold)) {
return MainApp.sResources.getColor(R.color.low);
return MainApp.gc(R.color.low);
} else if (careportalEvent.isOlderThan(warnThreshold)) {
return MainApp.sResources.getColor(R.color.high);
return MainApp.gc(R.color.high);
} else {
return Color.WHITE;
}

View file

@ -330,7 +330,7 @@ public class ConfigBuilderFragment extends SubscriberFragment {
}
if (plugin.isEnabled(type)) {
view.setBackgroundColor(MainApp.sResources.getColor(R.color.configBuilderSelectedBackground));
view.setBackgroundColor(MainApp.gc(R.color.configBuilderSelectedBackground));
}
return view;

View file

@ -208,7 +208,7 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
}
if (!insulinAfterConstraints.equals(insulin))
actions.add("<font color='" + MainApp.sResources.getColor(R.color.warning) + "'>" + MainApp.gs(R.string.bolusconstraintapplied) + "</font>");
actions.add("<font color='" + MainApp.gc(R.color.warning) + "'>" + MainApp.gs(R.string.bolusconstraintapplied) + "</font>");
int eatingSoonTTDuration = SP.getInt(R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration);
eatingSoonTTDuration = eatingSoonTTDuration > 0 ? eatingSoonTTDuration : Constants.defaultEatingSoonTTDuration;

View file

@ -240,7 +240,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
loopStatusLayout = (LinearLayout) view.findViewById(R.id.overview_looplayout);
pumpStatusLayout = (LinearLayout) view.findViewById(R.id.overview_pumpstatuslayout);
pumpStatusView.setBackgroundColor(MainApp.sResources.getColor(R.color.colorInitializingBorder));
pumpStatusView.setBackgroundColor(MainApp.gc(R.color.colorInitializingBorder));
iobView = (TextView) view.findViewById(R.id.overview_iob);
cobView = (TextView) view.findViewById(R.id.overview_cob);
@ -300,9 +300,9 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
else
axisWidth = 80;
bgGraph.getGridLabelRenderer().setGridColor(MainApp.sResources.getColor(R.color.graphgrid));
bgGraph.getGridLabelRenderer().setGridColor(MainApp.gc(R.color.graphgrid));
bgGraph.getGridLabelRenderer().reloadStyles();
iobGraph.getGridLabelRenderer().setGridColor(MainApp.sResources.getColor(R.color.graphgrid));
iobGraph.getGridLabelRenderer().setGridColor(MainApp.gc(R.color.graphgrid));
iobGraph.getGridLabelRenderer().reloadStyles();
iobGraph.getGridLabelRenderer().setHorizontalLabelsVisible(false);
bgGraph.getGridLabelRenderer().setLabelVerticalWidth(axisWidth);
@ -1006,11 +1006,11 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
//Start with updating the BG as it is unaffected by loop.
// **** BG value ****
if (lastBG != null) {
int color = MainApp.sResources.getColor(R.color.inrange);
int color = MainApp.gc(R.color.inrange);
if (lastBG.valueToUnits(units) < lowLine)
color = MainApp.sResources.getColor(R.color.low);
color = MainApp.gc(R.color.low);
else if (lastBG.valueToUnits(units) > highLine)
color = MainApp.sResources.getColor(R.color.high);
color = MainApp.gc(R.color.high);
bgView.setText(lastBG.valueToUnitsToString(units));
arrowView.setText(lastBG.directionToSymbol());
bgView.setTextColor(color);
@ -1034,23 +1034,23 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
if (Config.APS && pump.getPumpDescription().isTempBasalCapable) {
apsModeView.setVisibility(View.VISIBLE);
apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.loopenabled));
apsModeView.setBackgroundColor(MainApp.gc(R.color.loopenabled));
apsModeView.setTextColor(Color.BLACK);
final LoopPlugin loopPlugin = LoopPlugin.getPlugin();
if (loopPlugin.isEnabled(PluginType.LOOP) && loopPlugin.isSuperBolus()) {
apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.looppumpsuspended));
apsModeView.setBackgroundColor(MainApp.gc(R.color.looppumpsuspended));
apsModeView.setText(String.format(MainApp.gs(R.string.loopsuperbolusfor), loopPlugin.minutesToEndOfSuspend()));
apsModeView.setTextColor(Color.WHITE);
} else if (loopPlugin.isEnabled(PluginType.LOOP) && loopPlugin.isDisconnected()) {
apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.looppumpsuspended));
apsModeView.setBackgroundColor(MainApp.gc(R.color.looppumpsuspended));
apsModeView.setText(String.format(MainApp.gs(R.string.loopdisconnectedfor), loopPlugin.minutesToEndOfSuspend()));
apsModeView.setTextColor(Color.WHITE);
} else if (loopPlugin.isEnabled(PluginType.LOOP) && loopPlugin.isSuspended()) {
apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.looppumpsuspended));
apsModeView.setBackgroundColor(MainApp.gc(R.color.looppumpsuspended));
apsModeView.setText(String.format(MainApp.gs(R.string.loopsuspendedfor), loopPlugin.minutesToEndOfSuspend()));
apsModeView.setTextColor(Color.WHITE);
} else if (pump.isSuspended()) {
apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.looppumpsuspended));
apsModeView.setBackgroundColor(MainApp.gc(R.color.looppumpsuspended));
apsModeView.setText(MainApp.gs(R.string.pumpsuspended));
apsModeView.setTextColor(Color.WHITE);
} else if (loopPlugin.isEnabled(PluginType.LOOP)) {
@ -1060,7 +1060,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
apsModeView.setText(MainApp.gs(R.string.openloop));
}
} else {
apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.loopdisabled));
apsModeView.setBackgroundColor(MainApp.gc(R.color.loopdisabled));
apsModeView.setText(MainApp.gs(R.string.disabledloop));
apsModeView.setTextColor(Color.WHITE);
}
@ -1072,12 +1072,12 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
TempTarget tempTarget = TreatmentsPlugin.getPlugin().getTempTargetFromHistory();
if (tempTarget != null) {
tempTargetView.setTextColor(Color.BLACK);
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetBackground));
tempTargetView.setBackgroundColor(MainApp.gc(R.color.tempTargetBackground));
tempTargetView.setVisibility(View.VISIBLE);
tempTargetView.setText(Profile.toTargetRangeString(tempTarget.low, tempTarget.high, Constants.MGDL, units) + " " + DateUtil.untilString(tempTarget.end()));
} else {
tempTargetView.setTextColor(Color.WHITE);
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetDisabledBackground));
tempTargetView.setBackgroundColor(MainApp.gc(R.color.tempTargetDisabledBackground));
tempTargetView.setText(Profile.toTargetRangeString(profile.getTargetLow(), profile.getTargetHigh(), units, units));
tempTargetView.setVisibility(View.VISIBLE);
}
@ -1148,7 +1148,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
}
if (activeTemp != null) {
baseBasalView.setTextColor(MainApp.sResources.getColor(R.color.basal));
baseBasalView.setTextColor(MainApp.gc(R.color.basal));
} else {
baseBasalView.setTextColor(Color.WHITE);

View file

@ -111,7 +111,7 @@ public class DanaRFragment extends SubscriberFragment {
View view = inflater.inflate(R.layout.danar_fragment, container, false);
unbinder = ButterKnife.bind(this, view);
pumpStatusView.setBackgroundColor(MainApp.sResources.getColor(R.color.colorInitializingBorder));
pumpStatusView.setBackgroundColor(MainApp.gc(R.color.colorInitializingBorder));
return view;
} catch (Exception e) {

View file

@ -186,7 +186,7 @@ public class Treatment implements DataPointWithLabelInterface {
@Override
public int getColor() {
if (isSMB)
return MainApp.sResources.getColor(R.color.tempbasal);
return MainApp.gc(R.color.tempbasal);
else if (isValid)
return Color.CYAN;
else

View file

@ -107,13 +107,13 @@ public class TreatmentsFragment extends SubscriberFragment implements View.OnCli
}
private void setBackgroundColorOnSelected(TextView selected) {
treatmentsTab.setBackgroundColor(MainApp.sResources.getColor(R.color.defaultbackground));
extendedBolusesTab.setBackgroundColor(MainApp.sResources.getColor(R.color.defaultbackground));
tempBasalsTab.setBackgroundColor(MainApp.sResources.getColor(R.color.defaultbackground));
tempTargetTab.setBackgroundColor(MainApp.sResources.getColor(R.color.defaultbackground));
profileSwitchTab.setBackgroundColor(MainApp.sResources.getColor(R.color.defaultbackground));
careportalTab.setBackgroundColor(MainApp.sResources.getColor(R.color.defaultbackground));
selected.setBackgroundColor(MainApp.sResources.getColor(R.color.tabBgColorSelected));
treatmentsTab.setBackgroundColor(MainApp.gc(R.color.defaultbackground));
extendedBolusesTab.setBackgroundColor(MainApp.gc(R.color.defaultbackground));
tempBasalsTab.setBackgroundColor(MainApp.gc(R.color.defaultbackground));
tempTargetTab.setBackgroundColor(MainApp.gc(R.color.defaultbackground));
profileSwitchTab.setBackgroundColor(MainApp.gc(R.color.defaultbackground));
careportalTab.setBackgroundColor(MainApp.gc(R.color.defaultbackground));
selected.setBackgroundColor(MainApp.gc(R.color.tabBgColorSelected));
}
@Subscribe

View file

@ -62,7 +62,7 @@ class SlidingTabStrip extends LinearLayout {
DEFAULT_BOTTOM_BORDER_COLOR_ALPHA);
mDefaultTabColorizer = new SimpleTabColorizer();
mDefaultTabColorizer.setIndicatorColors(MainApp.sResources.getColor(R.color.tabBgColorSelected));
mDefaultTabColorizer.setIndicatorColors(MainApp.gc(R.color.tabBgColorSelected));
mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density);
mBottomBorderPaint = new Paint();