eliminate PluginSwitcher
This commit is contained in:
parent
c1a1cc3108
commit
9e962b953f
15 changed files with 205 additions and 179 deletions
|
@ -1,10 +1,14 @@
|
||||||
package info.nightscout.androidaps.interfaces;
|
package info.nightscout.androidaps.interfaces;
|
||||||
|
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.events.EventConfigBuilderChange;
|
||||||
|
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.EventConfigBuilderUpdateGui;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -41,25 +45,25 @@ public abstract class PluginBase {
|
||||||
|
|
||||||
// Default always calls invoke
|
// Default always calls invoke
|
||||||
// Plugins that have special constraints if they get switched to may override this method
|
// Plugins that have special constraints if they get switched to may override this method
|
||||||
public void switchAllowed(ConfigBuilderFragment.PluginViewHolder.PluginSwitcher pluginSwitcher, FragmentActivity activity) {
|
public void switchAllowed(boolean newState, FragmentActivity activity) {
|
||||||
pluginSwitcher.invoke();
|
performPluginSwitch(newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void confirmPumpPluginActivation(ConfigBuilderFragment.PluginViewHolder.PluginSwitcher pluginSwitcher, FragmentActivity activity) {
|
protected void confirmPumpPluginActivation(boolean newState, FragmentActivity activity) {
|
||||||
boolean allowHardwarePump = SP.getBoolean("allow_hardware_pump", false);
|
boolean allowHardwarePump = SP.getBoolean("allow_hardware_pump", false);
|
||||||
if (allowHardwarePump || activity == null) {
|
if (allowHardwarePump || activity == null) {
|
||||||
pluginSwitcher.invoke();
|
performPluginSwitch(newState);
|
||||||
} else {
|
} else {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||||
builder.setMessage(R.string.allow_hardware_pump_text)
|
builder.setMessage(R.string.allow_hardware_pump_text)
|
||||||
.setPositiveButton(R.string.yes, (dialog, id) -> {
|
.setPositiveButton(R.string.yes, (dialog, id) -> {
|
||||||
pluginSwitcher.invoke();
|
performPluginSwitch(newState);
|
||||||
SP.putBoolean("allow_hardware_pump", true);
|
SP.putBoolean("allow_hardware_pump", true);
|
||||||
if (L.isEnabled(L.PUMP))
|
if (L.isEnabled(L.PUMP))
|
||||||
log.debug("First time HW pump allowed!");
|
log.debug("First time HW pump allowed!");
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.cancel, (dialog, id) -> {
|
.setNegativeButton(R.string.cancel, (dialog, id) -> {
|
||||||
pluginSwitcher.cancel();
|
MainApp.bus().post(new EventConfigBuilderUpdateGui());
|
||||||
if (L.isEnabled(L.PUMP))
|
if (L.isEnabled(L.PUMP))
|
||||||
log.debug("User does not allow switching to HW pump!");
|
log.debug("User does not allow switching to HW pump!");
|
||||||
});
|
});
|
||||||
|
@ -67,13 +71,15 @@ public abstract class PluginBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public PluginType getType() {
|
private void performPluginSwitch(boolean enabled) {
|
||||||
// return mainType;
|
setPluginEnabled(getType(), enabled);
|
||||||
// }
|
setFragmentVisible(getType(), enabled);
|
||||||
|
ConfigBuilderFragment.processOnEnabledCategoryChanged(this, getType());
|
||||||
// public String getFragmentClass() {
|
ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxEnabled");
|
||||||
// return fragmentClass;
|
MainApp.bus().post(new EventRefreshGui());
|
||||||
// }
|
MainApp.bus().post(new EventConfigBuilderChange());
|
||||||
|
ConfigBuilderPlugin.getPlugin().logPluginStatus();
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
if (pluginDescription.pluginName == -1)
|
if (pluginDescription.pluginName == -1)
|
||||||
|
@ -168,7 +174,7 @@ public abstract class PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFragmentVisible() {
|
public boolean isFragmentVisible() {
|
||||||
if (pluginDescription.alwayVisible)
|
if (pluginDescription.alwaysVisible)
|
||||||
return true;
|
return true;
|
||||||
if (pluginDescription.neverVisible)
|
if (pluginDescription.neverVisible)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.interfaces;
|
||||||
public class PluginDescription {
|
public class PluginDescription {
|
||||||
PluginType mainType = PluginType.GENERAL;
|
PluginType mainType = PluginType.GENERAL;
|
||||||
String fragmentClass = null;
|
String fragmentClass = null;
|
||||||
public boolean alwayVisible = false;
|
public boolean alwaysVisible = false;
|
||||||
public boolean neverVisible = false;
|
public boolean neverVisible = false;
|
||||||
public boolean alwaysEnabled = false;
|
public boolean alwaysEnabled = false;
|
||||||
boolean showInList = true;
|
boolean showInList = true;
|
||||||
|
@ -11,7 +11,6 @@ public class PluginDescription {
|
||||||
int shortName = -1;
|
int shortName = -1;
|
||||||
int description = -1;
|
int description = -1;
|
||||||
int preferencesId = -1;
|
int preferencesId = -1;
|
||||||
int advancedPreferencesId = -1;
|
|
||||||
public boolean enableByDefault = false;
|
public boolean enableByDefault = false;
|
||||||
public boolean visibleByDefault = false;
|
public boolean visibleByDefault = false;
|
||||||
|
|
||||||
|
@ -30,8 +29,8 @@ public class PluginDescription {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PluginDescription alwayVisible(boolean alwayVisible) {
|
public PluginDescription alwaysVisible(boolean alwayVisible) {
|
||||||
this.alwayVisible = alwayVisible;
|
this.alwaysVisible = alwayVisible;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,11 +59,6 @@ public class PluginDescription {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PluginDescription advancedPreferencesId(int advancedPreferencesId) {
|
|
||||||
this.advancedPreferencesId = advancedPreferencesId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PluginDescription enableByDefault(boolean enableByDefault) {
|
public PluginDescription enableByDefault(boolean enableByDefault) {
|
||||||
this.enableByDefault = enableByDefault;
|
this.enableByDefault = enableByDefault;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -1,33 +1,29 @@
|
||||||
package info.nightscout.androidaps.plugins.configBuilder;
|
package info.nightscout.androidaps.plugins.configBuilder;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.StringRes;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RadioButton;
|
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.StringRes;
|
||||||
|
|
||||||
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
import butterknife.Unbinder;
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.activities.PreferencesActivity;
|
|
||||||
import info.nightscout.androidaps.events.EventConfigBuilderChange;
|
|
||||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
|
||||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||||
import info.nightscout.androidaps.interfaces.BgSourceInterface;
|
import info.nightscout.androidaps.interfaces.BgSourceInterface;
|
||||||
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
|
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
|
||||||
|
@ -99,6 +95,15 @@ public class ConfigBuilderFragment extends SubscriberFragment {
|
||||||
for (PluginViewHolder pluginViewHolder : pluginViewHolders) pluginViewHolder.update();
|
for (PluginViewHolder pluginViewHolder : pluginViewHolders) pluginViewHolder.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void on(EventConfigBuilderUpdateGui e) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity != null)
|
||||||
|
activity.runOnUiThread(() -> {
|
||||||
|
updateGUI();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void createViews() {
|
private void createViews() {
|
||||||
createViewsForPlugins(R.string.configbuilder_profile, R.string.configbuilder_profile_description, PluginType.PROFILE, MainApp.getSpecificPluginsVisibleInListByInterface(ProfileInterface.class, PluginType.PROFILE));
|
createViewsForPlugins(R.string.configbuilder_profile, R.string.configbuilder_profile_description, PluginType.PROFILE, MainApp.getSpecificPluginsVisibleInListByInterface(ProfileInterface.class, PluginType.PROFILE));
|
||||||
createViewsForPlugins(R.string.configbuilder_insulin, R.string.configbuilder_insulin_description, PluginType.INSULIN, MainApp.getSpecificPluginsVisibleInListByInterface(InsulinInterface.class, PluginType.INSULIN));
|
createViewsForPlugins(R.string.configbuilder_insulin, R.string.configbuilder_insulin_description, PluginType.INSULIN, MainApp.getSpecificPluginsVisibleInListByInterface(InsulinInterface.class, PluginType.INSULIN));
|
||||||
|
@ -119,17 +124,13 @@ public class ConfigBuilderFragment extends SubscriberFragment {
|
||||||
((TextView) parent.findViewById(R.id.category_description)).setText(MainApp.gs(description));
|
((TextView) parent.findViewById(R.id.category_description)).setText(MainApp.gs(description));
|
||||||
LinearLayout pluginContainer = parent.findViewById(R.id.category_plugins);
|
LinearLayout pluginContainer = parent.findViewById(R.id.category_plugins);
|
||||||
for (PluginBase plugin: plugins) {
|
for (PluginBase plugin: plugins) {
|
||||||
PluginViewHolder pluginViewHolder = new PluginViewHolder(pluginType, plugin);
|
PluginViewHolder pluginViewHolder = new PluginViewHolder(this, pluginType, plugin);
|
||||||
pluginContainer.addView(pluginViewHolder.getBaseView());
|
pluginContainer.addView(pluginViewHolder.getBaseView());
|
||||||
pluginViewHolders.add(pluginViewHolder);
|
pluginViewHolders.add(pluginViewHolder);
|
||||||
}
|
}
|
||||||
categories.addView(parent);
|
categories.addView(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean areMultipleSelectionsAllowed(PluginType type) {
|
|
||||||
return type == PluginType.GENERAL || type == PluginType.CONSTRAINTS ||type == PluginType.LOOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void processOnEnabledCategoryChanged(PluginBase changedPlugin, PluginType type) {
|
public static void processOnEnabledCategoryChanged(PluginBase changedPlugin, PluginType type) {
|
||||||
ArrayList<PluginBase> pluginsInCategory = null;
|
ArrayList<PluginBase> pluginsInCategory = null;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -185,99 +186,4 @@ public class ConfigBuilderFragment extends SubscriberFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PluginViewHolder {
|
|
||||||
|
|
||||||
private Unbinder unbinder;
|
|
||||||
private PluginType pluginType;
|
|
||||||
private PluginBase plugin;
|
|
||||||
|
|
||||||
LinearLayout baseView;
|
|
||||||
@BindView(R.id.plugin_enabled_exclusive)
|
|
||||||
RadioButton enabledExclusive;
|
|
||||||
@BindView(R.id.plugin_enabled_inclusive)
|
|
||||||
CheckBox enabledInclusive;
|
|
||||||
@BindView(R.id.plugin_name)
|
|
||||||
TextView pluginName;
|
|
||||||
@BindView(R.id.plugin_description)
|
|
||||||
TextView pluginDescription;
|
|
||||||
@BindView(R.id.plugin_preferences)
|
|
||||||
ImageButton pluginPreferences;
|
|
||||||
@BindView(R.id.plugin_visibility)
|
|
||||||
CheckBox pluginVisibility;
|
|
||||||
|
|
||||||
public PluginViewHolder(PluginType pluginType, PluginBase plugin) {
|
|
||||||
this.pluginType = pluginType;
|
|
||||||
this.plugin = plugin;
|
|
||||||
baseView = (LinearLayout) getLayoutInflater().inflate(R.layout.configbuilder_single_plugin, null);
|
|
||||||
unbinder = ButterKnife.bind(this, baseView);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
public LinearLayout getBaseView() {
|
|
||||||
return baseView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update() {
|
|
||||||
enabledExclusive.setVisibility(areMultipleSelectionsAllowed(pluginType) ? View.GONE : View.VISIBLE);
|
|
||||||
enabledInclusive.setVisibility(areMultipleSelectionsAllowed(pluginType) ? View.VISIBLE : View.GONE);
|
|
||||||
enabledExclusive.setChecked(plugin.isEnabled(pluginType));
|
|
||||||
enabledInclusive.setChecked(plugin.isEnabled(pluginType));
|
|
||||||
enabledInclusive.setEnabled(!plugin.pluginDescription.alwaysEnabled);
|
|
||||||
enabledExclusive.setEnabled(!plugin.pluginDescription.alwaysEnabled);
|
|
||||||
pluginName.setText(plugin.getName());
|
|
||||||
if (plugin.getDescription() == null) pluginDescription.setVisibility(View.GONE);
|
|
||||||
else {
|
|
||||||
pluginDescription.setVisibility(View.VISIBLE);
|
|
||||||
pluginDescription.setText(plugin.getDescription());
|
|
||||||
}
|
|
||||||
pluginPreferences.setVisibility(plugin.getPreferencesId() == -1 || !plugin.isEnabled(pluginType) ? View.INVISIBLE : View.VISIBLE);
|
|
||||||
pluginVisibility.setVisibility(plugin.hasFragment() ? View.VISIBLE : View.INVISIBLE);
|
|
||||||
pluginVisibility.setEnabled(!(plugin.pluginDescription.neverVisible || plugin.pluginDescription.alwayVisible) && plugin.isEnabled(pluginType));
|
|
||||||
pluginVisibility.setChecked(plugin.isFragmentVisible());
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnClick(R.id.plugin_visibility)
|
|
||||||
void onVisibilityChanged() {
|
|
||||||
plugin.setFragmentVisible(pluginType, pluginVisibility.isChecked());
|
|
||||||
ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxVisible");
|
|
||||||
MainApp.bus().post(new EventRefreshGui());
|
|
||||||
ConfigBuilderPlugin.getPlugin().logPluginStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnClick({R.id.plugin_enabled_exclusive, R.id.plugin_enabled_inclusive})
|
|
||||||
void onEnabledChanged() {
|
|
||||||
plugin.switchAllowed(new PluginSwitcher(), getActivity());
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnClick(R.id.plugin_preferences)
|
|
||||||
void onPluginPreferencesClicked() {
|
|
||||||
PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", () -> {
|
|
||||||
Intent i = new Intent(getContext(), PreferencesActivity.class);
|
|
||||||
i.putExtra("id", plugin.getPreferencesId());
|
|
||||||
startActivity(i);
|
|
||||||
}, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unbind() {
|
|
||||||
unbinder.unbind();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PluginSwitcher {
|
|
||||||
public void invoke() {
|
|
||||||
boolean enabled = enabledExclusive.getVisibility() == View.VISIBLE ? enabledExclusive.isChecked() : enabledInclusive.isChecked();
|
|
||||||
plugin.setPluginEnabled(pluginType, enabled);
|
|
||||||
plugin.setFragmentVisible(pluginType, enabled);
|
|
||||||
processOnEnabledCategoryChanged(plugin, pluginType);
|
|
||||||
updateGUI();
|
|
||||||
ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxEnabled");
|
|
||||||
MainApp.bus().post(new EventRefreshGui());
|
|
||||||
MainApp.bus().post(new EventConfigBuilderChange());
|
|
||||||
ConfigBuilderPlugin.getPlugin().logPluginStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void cancel(){
|
|
||||||
updateGUI();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class ConfigBuilderPlugin extends PluginBase {
|
||||||
.fragmentClass(ConfigBuilderFragment.class.getName())
|
.fragmentClass(ConfigBuilderFragment.class.getName())
|
||||||
.showInList(true)
|
.showInList(true)
|
||||||
.alwaysEnabled(true)
|
.alwaysEnabled(true)
|
||||||
.alwayVisible(false)
|
.alwaysVisible(false)
|
||||||
.pluginName(R.string.configbuilder)
|
.pluginName(R.string.configbuilder)
|
||||||
.shortName(R.string.configbuilder_shortname)
|
.shortName(R.string.configbuilder_shortname)
|
||||||
.description(R.string.description_config_builder)
|
.description(R.string.description_config_builder)
|
||||||
|
@ -102,7 +102,7 @@ public class ConfigBuilderPlugin extends PluginBase {
|
||||||
|
|
||||||
for (PluginBase p : pluginList) {
|
for (PluginBase p : pluginList) {
|
||||||
PluginType type = p.getType();
|
PluginType type = p.getType();
|
||||||
if (p.pluginDescription.alwaysEnabled && p.pluginDescription.alwayVisible)
|
if (p.pluginDescription.alwaysEnabled && p.pluginDescription.alwaysVisible)
|
||||||
continue;
|
continue;
|
||||||
if (p.pluginDescription.alwaysEnabled && p.pluginDescription.neverVisible)
|
if (p.pluginDescription.alwaysEnabled && p.pluginDescription.neverVisible)
|
||||||
continue;
|
continue;
|
||||||
|
@ -262,7 +262,7 @@ public class ConfigBuilderPlugin extends PluginBase {
|
||||||
return activeSensitivity;
|
return activeSensitivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void logPluginStatus() {
|
public void logPluginStatus() {
|
||||||
if (L.isEnabled(L.CONFIGBUILDER))
|
if (L.isEnabled(L.CONFIGBUILDER))
|
||||||
for (PluginBase p : pluginList) {
|
for (PluginBase p : pluginList) {
|
||||||
log.debug(p.getName() + ":" +
|
log.debug(p.getName() + ":" +
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package info.nightscout.androidaps.plugins.configBuilder
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.EventUpdateGui
|
||||||
|
|
||||||
|
class EventConfigBuilderUpdateGui : EventUpdateGui() {
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
package info.nightscout.androidaps.plugins.configBuilder;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.OnClick;
|
||||||
|
import butterknife.Unbinder;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.activities.PreferencesActivity;
|
||||||
|
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
|
import info.nightscout.androidaps.utils.PasswordProtection;
|
||||||
|
|
||||||
|
public class PluginViewHolder {
|
||||||
|
|
||||||
|
private Unbinder unbinder;
|
||||||
|
private PluginType pluginType;
|
||||||
|
private PluginBase plugin;
|
||||||
|
private ConfigBuilderFragment fragment;
|
||||||
|
|
||||||
|
LinearLayout baseView;
|
||||||
|
@BindView(R.id.plugin_enabled_exclusive)
|
||||||
|
RadioButton enabledExclusive;
|
||||||
|
@BindView(R.id.plugin_enabled_inclusive)
|
||||||
|
CheckBox enabledInclusive;
|
||||||
|
@BindView(R.id.plugin_name)
|
||||||
|
TextView pluginName;
|
||||||
|
@BindView(R.id.plugin_description)
|
||||||
|
TextView pluginDescription;
|
||||||
|
@BindView(R.id.plugin_preferences)
|
||||||
|
ImageButton pluginPreferences;
|
||||||
|
@BindView(R.id.plugin_visibility)
|
||||||
|
CheckBox pluginVisibility;
|
||||||
|
|
||||||
|
public PluginViewHolder(ConfigBuilderFragment fragment, PluginType pluginType, PluginBase plugin) {
|
||||||
|
this.pluginType = pluginType;
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.fragment = fragment;
|
||||||
|
baseView = (LinearLayout) fragment.getLayoutInflater().inflate(R.layout.configbuilder_single_plugin, null);
|
||||||
|
unbinder = ButterKnife.bind(this, baseView);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinearLayout getBaseView() {
|
||||||
|
return baseView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
enabledExclusive.setVisibility(areMultipleSelectionsAllowed(pluginType) ? View.GONE : View.VISIBLE);
|
||||||
|
enabledInclusive.setVisibility(areMultipleSelectionsAllowed(pluginType) ? View.VISIBLE : View.GONE);
|
||||||
|
enabledExclusive.setChecked(plugin.isEnabled(pluginType));
|
||||||
|
enabledInclusive.setChecked(plugin.isEnabled(pluginType));
|
||||||
|
enabledInclusive.setEnabled(!plugin.pluginDescription.alwaysEnabled);
|
||||||
|
enabledExclusive.setEnabled(!plugin.pluginDescription.alwaysEnabled);
|
||||||
|
pluginName.setText(plugin.getName());
|
||||||
|
if (plugin.getDescription() == null) pluginDescription.setVisibility(View.GONE);
|
||||||
|
else {
|
||||||
|
pluginDescription.setVisibility(View.VISIBLE);
|
||||||
|
pluginDescription.setText(plugin.getDescription());
|
||||||
|
}
|
||||||
|
pluginPreferences.setVisibility(plugin.getPreferencesId() == -1 || !plugin.isEnabled(pluginType) ? View.INVISIBLE : View.VISIBLE);
|
||||||
|
pluginVisibility.setVisibility(plugin.hasFragment() ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
pluginVisibility.setEnabled(!(plugin.pluginDescription.neverVisible || plugin.pluginDescription.alwaysVisible) && plugin.isEnabled(pluginType));
|
||||||
|
pluginVisibility.setChecked(plugin.isFragmentVisible());
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnClick(R.id.plugin_visibility)
|
||||||
|
void onVisibilityChanged() {
|
||||||
|
plugin.setFragmentVisible(pluginType, pluginVisibility.isChecked());
|
||||||
|
ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxVisible");
|
||||||
|
MainApp.bus().post(new EventRefreshGui());
|
||||||
|
ConfigBuilderPlugin.getPlugin().logPluginStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnClick({R.id.plugin_enabled_exclusive, R.id.plugin_enabled_inclusive})
|
||||||
|
void onEnabledChanged() {
|
||||||
|
plugin.switchAllowed(enabledExclusive.getVisibility() == View.VISIBLE ? enabledExclusive.isChecked() : enabledInclusive.isChecked(), fragment.getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnClick(R.id.plugin_preferences)
|
||||||
|
void onPluginPreferencesClicked() {
|
||||||
|
PasswordProtection.QueryPassword(fragment.getContext(), R.string.settings_password, "settings_password", () -> {
|
||||||
|
Intent i = new Intent(fragment.getContext(), PreferencesActivity.class);
|
||||||
|
i.putExtra("id", plugin.getPreferencesId());
|
||||||
|
fragment.startActivity(i);
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unbind() {
|
||||||
|
unbinder.unbind();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean areMultipleSelectionsAllowed(PluginType type) {
|
||||||
|
return type == PluginType.GENERAL || type == PluginType.CONSTRAINTS ||type == PluginType.LOOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -62,7 +62,7 @@ public class MaintenancePlugin extends PluginBase {
|
||||||
super(new PluginDescription()
|
super(new PluginDescription()
|
||||||
.mainType(PluginType.GENERAL)
|
.mainType(PluginType.GENERAL)
|
||||||
.fragmentClass(MaintenanceFragment.class.getName())
|
.fragmentClass(MaintenanceFragment.class.getName())
|
||||||
.alwayVisible(false)
|
.alwaysVisible(false)
|
||||||
.alwaysEnabled(true)
|
.alwaysEnabled(true)
|
||||||
.pluginName(R.string.maintenance)
|
.pluginName(R.string.maintenance)
|
||||||
.shortName(R.string.maintenance_shortname)
|
.shortName(R.string.maintenance_shortname)
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class OverviewPlugin extends PluginBase {
|
||||||
super(new PluginDescription()
|
super(new PluginDescription()
|
||||||
.mainType(PluginType.GENERAL)
|
.mainType(PluginType.GENERAL)
|
||||||
.fragmentClass(OverviewFragment.class.getName())
|
.fragmentClass(OverviewFragment.class.getName())
|
||||||
.alwayVisible(true)
|
.alwaysVisible(true)
|
||||||
.alwaysEnabled(true)
|
.alwaysEnabled(true)
|
||||||
.pluginName(R.string.overview)
|
.pluginName(R.string.overview)
|
||||||
.shortName(R.string.overview_shortname)
|
.shortName(R.string.overview_shortname)
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class NSProfilePlugin extends PluginBase implements ProfileInterface {
|
||||||
.pluginName(R.string.nsprofile)
|
.pluginName(R.string.nsprofile)
|
||||||
.shortName(R.string.profileviewer_shortname)
|
.shortName(R.string.profileviewer_shortname)
|
||||||
.alwaysEnabled(Config.NSCLIENT)
|
.alwaysEnabled(Config.NSCLIENT)
|
||||||
.alwayVisible(Config.NSCLIENT)
|
.alwaysVisible(Config.NSCLIENT)
|
||||||
.showInList(!Config.NSCLIENT)
|
.showInList(!Config.NSCLIENT)
|
||||||
.description(R.string.description_profile_nightscout)
|
.description(R.string.description_profile_nightscout)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.combo;
|
package info.nightscout.androidaps.plugins.pump.combo;
|
||||||
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -40,7 +39,6 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment;
|
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
||||||
|
@ -164,8 +162,8 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void switchAllowed(ConfigBuilderFragment.PluginViewHolder.PluginSwitcher pluginSwitcher, FragmentActivity activity) {
|
public void switchAllowed(boolean newState, FragmentActivity activity) {
|
||||||
confirmPumpPluginActivation(pluginSwitcher, activity);
|
confirmPumpPluginActivation(newState, activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common;
|
package info.nightscout.androidaps.plugins.pump.common;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.BuildConfig;
|
import info.nightscout.androidaps.BuildConfig;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
@ -108,8 +108,8 @@ public abstract class PumpPluginAbstract extends PluginBase implements PumpInter
|
||||||
public abstract void onStartCustomActions();
|
public abstract void onStartCustomActions();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void switchAllowed(ConfigBuilderFragment.PluginViewHolder.PluginSwitcher pluginSwitcher, FragmentActivity activity) {
|
public void switchAllowed(boolean newState, FragmentActivity activity) {
|
||||||
confirmPumpPluginActivation(pluginSwitcher, activity);
|
confirmPumpPluginActivation(newState, activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.danaR;
|
package info.nightscout.androidaps.plugins.pump.danaR;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment;
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -80,8 +79,8 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void switchAllowed(ConfigBuilderFragment.PluginViewHolder.PluginSwitcher pluginSwitcher, FragmentActivity activity) {
|
public void switchAllowed(boolean newState, FragmentActivity activity) {
|
||||||
confirmPumpPluginActivation(pluginSwitcher, activity);
|
confirmPumpPluginActivation(newState, activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,9 +5,9 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment;
|
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.DetailedBolusInfoStorage;
|
import info.nightscout.androidaps.plugins.configBuilder.DetailedBolusInfoStorage;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
||||||
|
@ -127,8 +126,8 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void switchAllowed(ConfigBuilderFragment.PluginViewHolder.PluginSwitcher pluginSwitcher, FragmentActivity activity) {
|
public void switchAllowed(boolean newState, FragmentActivity activity) {
|
||||||
confirmPumpPluginActivation(pluginSwitcher, activity);
|
confirmPumpPluginActivation(newState, activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceConnection mConnection = new ServiceConnection() {
|
private ServiceConnection mConnection = new ServiceConnection() {
|
||||||
|
|
|
@ -9,12 +9,7 @@ import android.os.IBinder;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment;
|
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.*;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.descriptors.*;
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -48,8 +43,11 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
||||||
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
|
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
|
@ -76,6 +74,13 @@ import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events.StartOfTBREvent;
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events.StartOfTBREvent;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events.TotalDailyDoseEvent;
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events.TotalDailyDoseEvent;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events.TubeFilledEvent;
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.history.history_events.TubeFilledEvent;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.ActiveBRProfileBlock;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.BRProfile1Block;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.BRProfileBlock;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.FactoryMinBolusAmountBlock;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.MaxBasalAmountBlock;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.MaxBolusAmountBlock;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.parameter_blocks.TBROverNotificationBlock;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.CancelBolusMessage;
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.CancelBolusMessage;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.CancelTBRMessage;
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.CancelTBRMessage;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.ChangeTBRMessage;
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.remote_control.ChangeTBRMessage;
|
||||||
|
@ -99,6 +104,19 @@ import info.nightscout.androidaps.plugins.pump.insight.connection_service.Insigh
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.database.InsightBolusID;
|
import info.nightscout.androidaps.plugins.pump.insight.database.InsightBolusID;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.database.InsightHistoryOffset;
|
import info.nightscout.androidaps.plugins.pump.insight.database.InsightHistoryOffset;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.database.InsightPumpID;
|
import info.nightscout.androidaps.plugins.pump.insight.database.InsightPumpID;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveBasalRate;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveBolus;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.ActiveTBR;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.AlertType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.BasalProfile;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.BasalProfileBlock;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.BatteryStatus;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.BolusType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.CartridgeStatus;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.InsightState;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.OperatingMode;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.PumpTime;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.insight.descriptors.TotalDailyDose;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.exceptions.InsightException;
|
import info.nightscout.androidaps.plugins.pump.insight.exceptions.InsightException;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_errors.AppLayerErrorException;
|
import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_errors.AppLayerErrorException;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_errors.NoActiveTBRToCanceLException;
|
import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_errors.NoActiveTBRToCanceLException;
|
||||||
|
@ -232,8 +250,8 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void switchAllowed(ConfigBuilderFragment.PluginViewHolder.PluginSwitcher pluginSwitcher, FragmentActivity activity) {
|
public void switchAllowed(boolean newState, FragmentActivity activity) {
|
||||||
confirmPumpPluginActivation(pluginSwitcher, activity);
|
confirmPumpPluginActivation(newState, activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class PluginDescriptionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void alwayVisibleTest() {
|
public void alwayVisibleTest() {
|
||||||
PluginDescription pluginDescription = new PluginDescription().alwayVisible(true);
|
PluginDescription pluginDescription = new PluginDescription().alwaysVisible(true);
|
||||||
Assert.assertEquals(true, pluginDescription.alwayVisible);
|
Assert.assertEquals(true, pluginDescription.alwaysVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -64,12 +64,6 @@ public class PluginDescriptionTest {
|
||||||
Assert.assertEquals(10, pluginDescription.preferencesId);
|
Assert.assertEquals(10, pluginDescription.preferencesId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void advancedPreferencesIdTest() {
|
|
||||||
PluginDescription pluginDescription = new PluginDescription().advancedPreferencesId(10);
|
|
||||||
Assert.assertEquals(10, pluginDescription.advancedPreferencesId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void enableByDefault() {
|
public void enableByDefault() {
|
||||||
PluginDescription pluginDescription = new PluginDescription().enableByDefault(true);
|
PluginDescription pluginDescription = new PluginDescription().enableByDefault(true);
|
||||||
|
|
Loading…
Reference in a new issue