Show in Overview when loop is disabled

This commit is contained in:
AdrianLxM 2016-11-02 18:04:14 +01:00
parent 7bcdf36ca0
commit b1f3bb17bb
2 changed files with 15 additions and 3 deletions

View file

@ -11,6 +11,7 @@ import android.os.Handler;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -429,9 +430,18 @@ public class OverviewFragment extends Fragment {
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun; final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
if (Config.APS) { if (Config.APS) {
apsModeView.setVisibility(View.VISIBLE); apsModeView.setVisibility(View.VISIBLE);
if (MainApp.getConfigBuilder().isClosedModeEnabled()) apsModeView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorCancelTempButton));
apsModeView.setText(MainApp.sResources.getString(R.string.closedloop)); LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
else apsModeView.setText(MainApp.sResources.getString(R.string.openloop)); if(activeloop != null && activeloop.isEnabled(activeloop.getType())) {
if (MainApp.getConfigBuilder().isClosedModeEnabled()) {
apsModeView.setText(MainApp.sResources.getString(R.string.closedloop));
} else {
apsModeView.setText(MainApp.sResources.getString(R.string.openloop));
}
} else {
apsModeView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorSetExtendedButton));
apsModeView.setText(MainApp.sResources.getString(R.string.disabledloop));
}
} else { } else {
apsModeView.setVisibility(View.GONE); apsModeView.setVisibility(View.GONE);
} }

View file

@ -132,6 +132,8 @@
<string name="closedloop">Closed Loop</string> <string name="closedloop">Closed Loop</string>
<string name="openloop">Open Loop</string> <string name="openloop">Open Loop</string>
<string name="disabledloop">Loop Disabled</string>
<string name="openloop_newsuggestion">New suggestion available</string> <string name="openloop_newsuggestion">New suggestion available</string>
<string name="unsupportedclientver">Unsupported version of NSClient</string> <string name="unsupportedclientver">Unsupported version of NSClient</string>
<string name="nsclientnotinstalled">NSClient not installed. Record lost!</string> <string name="nsclientnotinstalled">NSClient not installed. Record lost!</string>