check for units null

This commit is contained in:
Milos Kozak 2017-06-30 10:35:05 +02:00
parent a8a4ffcab1
commit 38002be73d
2 changed files with 7 additions and 24 deletions

View file

@ -162,8 +162,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
TextView sage; TextView sage;
TextView pbage; TextView pbage;
TextView updating;
CheckBox showPredictionView; CheckBox showPredictionView;
CheckBox showBasalsView; CheckBox showBasalsView;
CheckBox showIobView; CheckBox showIobView;
@ -260,8 +258,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sage = (TextView) view.findViewById(R.id.careportal_sensorage); sage = (TextView) view.findViewById(R.id.careportal_sensorage);
pbage = (TextView) view.findViewById(R.id.careportal_pbage); pbage = (TextView) view.findViewById(R.id.careportal_pbage);
updating = (TextView) view.findViewById(R.id.overview_updating);
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph); bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph); iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph);
@ -880,15 +876,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (timeView != null) { //must not exists if (timeView != null) { //must not exists
timeView.setText(DateUtil.timeString(new Date())); timeView.setText(DateUtil.timeString(new Date()));
} }
if (updating != null)
updating.setVisibility(View.VISIBLE);
if (MainApp.getConfigBuilder().getProfile() == null) {// app not initialized yet if (MainApp.getConfigBuilder().getProfile() == null) {// app not initialized yet
pumpStatusView.setText(R.string.noprofileset); pumpStatusView.setText(R.string.noprofileset);
pumpStatusLayout.setVisibility(View.VISIBLE); pumpStatusLayout.setVisibility(View.VISIBLE);
loopStatusLayout.setVisibility(View.GONE); loopStatusLayout.setVisibility(View.GONE);
if (updating != null)
updating.setVisibility(View.GONE);
return; return;
} }
pumpStatusLayout.setVisibility(View.GONE); pumpStatusLayout.setVisibility(View.GONE);
@ -904,6 +895,13 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
Profile profile = MainApp.getConfigBuilder().getProfile(); Profile profile = MainApp.getConfigBuilder().getProfile();
String units = profile.getUnits(); String units = profile.getUnits();
if (units == null) {
pumpStatusView.setText(R.string.noprofileset);
pumpStatusLayout.setVisibility(View.VISIBLE);
loopStatusLayout.setVisibility(View.GONE);
return;
}
// open loop mode // open loop mode
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun; final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
if (Config.APS && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable) { if (Config.APS && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable) {
@ -1101,8 +1099,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
avgdeltaView.setText(""); avgdeltaView.setText("");
} }
} else { } else {
if (updating != null)
updating.setVisibility(View.GONE);
return; return;
} }
Integer flag = bgView.getPaintFlags(); Integer flag = bgView.getPaintFlags();
@ -1516,8 +1512,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
List<DataPointWithLabelInterface> bgListArray = new ArrayList<>(); List<DataPointWithLabelInterface> bgListArray = new ArrayList<>();
if (bgReadingsArray.size() == 0) { if (bgReadingsArray.size() == 0) {
if (updating != null)
updating.setVisibility(View.GONE);
return; return;
} }
@ -1654,8 +1648,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
bgGraph.onDataChanged(false, false); bgGraph.onDataChanged(false, false);
iobGraph.onDataChanged(false, false); iobGraph.onDataChanged(false, false);
if (updating != null)
updating.setVisibility(View.GONE);
Profiler.log(log, from, updateGUIStart); Profiler.log(log, from, updateGUIStart);
} }

View file

@ -152,15 +152,6 @@
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/overview_updating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/updating"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/updating"
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<TextView <TextView