Merge pull request #366 from MilosKozak/profile-switch-buttons

Show profile switch button in profiles
This commit is contained in:
Milos Kozak 2017-08-16 18:11:26 +02:00 committed by GitHub
commit 69a378bb75
4 changed files with 16 additions and 5 deletions

View file

@ -500,9 +500,13 @@ public class CircadianPercentageProfileFragment extends SubscriberFragment {
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) { if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) {
profileswitchButton.setVisibility(View.GONE); profileswitchButton.setVisibility(View.GONE);
} else if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
profileswitchButton.setText(MainApp.instance().getText(R.string.activate_profile));
profileswitchButton.setVisibility(View.VISIBLE);
} else { } else {
profileswitchButton.setText(MainApp.instance().getText(R.string.send_to_pump));
profileswitchButton.setVisibility(View.VISIBLE); profileswitchButton.setVisibility(View.VISIBLE);
} }
} }

View file

@ -148,9 +148,13 @@ public class LocalProfileFragment extends SubscriberFragment {
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) { if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) {
profileswitchButton.setVisibility(View.GONE); profileswitchButton.setVisibility(View.GONE);
} else if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
profileswitchButton.setText(MainApp.instance().getText(R.string.activate_profile));
profileswitchButton.setVisibility(View.VISIBLE);
} else { } else {
profileswitchButton.setText(MainApp.instance().getText(R.string.send_to_pump));
profileswitchButton.setVisibility(View.VISIBLE); profileswitchButton.setVisibility(View.VISIBLE);
} }
} }

View file

@ -156,9 +156,13 @@ public class SimpleProfileFragment extends SubscriberFragment {
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) { if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) {
profileswitchButton.setVisibility(View.GONE); profileswitchButton.setVisibility(View.GONE);
} else if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
profileswitchButton.setText(MainApp.instance().getText(R.string.activate_profile));
profileswitchButton.setVisibility(View.VISIBLE);
} else { } else {
profileswitchButton.setText(MainApp.instance().getText(R.string.send_to_pump));
profileswitchButton.setVisibility(View.VISIBLE); profileswitchButton.setVisibility(View.VISIBLE);
} }
} }

View file

@ -698,8 +698,7 @@
<string name="rapid_acting_oref">Rapid-Acting Oref</string> <string name="rapid_acting_oref">Rapid-Acting Oref</string>
<string name="ultrarapid_oref">Ultra-Rapid Oref</string> <string name="ultrarapid_oref">Ultra-Rapid Oref</string>
<string name="dia_too_short" formatted="false">"DIA of %s too short - using %s instead!"</string> <string name="dia_too_short" formatted="false">"DIA of %s too short - using %s instead!"</string>
<string name="activate_profile">ACTIVATE PROFILE</string>
</resources> </resources>