fix percentage concatenation on profile names

This commit is contained in:
AdrianLxM 2017-10-10 22:11:06 +02:00
parent 549b72b032
commit 398e950f8e
2 changed files with 6 additions and 2 deletions

View file

@ -726,7 +726,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
profileSwitch = new ProfileSwitch(); profileSwitch = new ProfileSwitch();
profileSwitch.date = System.currentTimeMillis(); profileSwitch.date = System.currentTimeMillis();
profileSwitch.source = Source.USER; profileSwitch.source = Source.USER;
profileSwitch.profileName = MainApp.getConfigBuilder().getProfileName(); profileSwitch.profileName = MainApp.getConfigBuilder().getProfileName(System.currentTimeMillis(), false);
profileSwitch.profileJson = MainApp.getConfigBuilder().getProfile().getData().toString(); profileSwitch.profileJson = MainApp.getConfigBuilder().getProfile().getData().toString();
profileSwitch.profilePlugin = ConfigBuilderPlugin.getActiveProfileInterface().getClass().getName(); profileSwitch.profilePlugin = ConfigBuilderPlugin.getActiveProfileInterface().getClass().getName();
profileSwitch.durationInMinutes = duration; profileSwitch.durationInMinutes = duration;

View file

@ -934,10 +934,14 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
} }
public String getProfileName(long time) { public String getProfileName(long time) {
return getProfileName(time, true);
}
public String getProfileName(long time, boolean customized) {
ProfileSwitch profileSwitch = getProfileSwitchFromHistory(time); ProfileSwitch profileSwitch = getProfileSwitchFromHistory(time);
if (profileSwitch != null) { if (profileSwitch != null) {
if (profileSwitch.profileJson != null) { if (profileSwitch.profileJson != null) {
return profileSwitch.getCustomizedName(); return customized?profileSwitch.getCustomizedName():profileSwitch.profileName;
} else { } else {
Profile profile = activeProfile.getProfile().getSpecificProfile(profileSwitch.profileName); Profile profile = activeProfile.getProfile().getSpecificProfile(profileSwitch.profileName);
if (profile != null) if (profile != null)