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

View file

@ -152,15 +152,6 @@
android:layout_marginLeft="10dp"
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>
<TextView