ConfigBuilder styling
This commit is contained in:
parent
4adcb88d12
commit
13cb4c28ed
|
@ -57,6 +57,12 @@ public abstract class PluginBase {
|
|||
return getName();
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "This is an example description.";
|
||||
/*if (pluginDescription.description == -1) return null;
|
||||
else return MainApp.gs(pluginDescription.description);*/
|
||||
}
|
||||
|
||||
public PluginType getType() {
|
||||
return pluginDescription.mainType;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ public class PluginDescription {
|
|||
boolean showInList = true;
|
||||
int pluginName = -1;
|
||||
int shortName = -1;
|
||||
int description = -1;
|
||||
int preferencesId = -1;
|
||||
int advancedPreferencesId = -1;
|
||||
public boolean enableByDefault = false;
|
||||
|
@ -74,6 +75,11 @@ public class PluginDescription {
|
|||
return this;
|
||||
}
|
||||
|
||||
public PluginDescription description(int description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFragmentClass() {
|
||||
return fragmentClass;
|
||||
}
|
||||
|
|
|
@ -1,30 +1,31 @@
|
|||
package info.nightscout.androidaps.plugins.ConfigBuilder;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.crashlytics.android.answers.CustomEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnCheckedChanged;
|
||||
import butterknife.OnClick;
|
||||
import info.nightscout.androidaps.Config;
|
||||
import butterknife.Optional;
|
||||
import butterknife.Unbinder;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.PreferencesActivity;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
@ -50,69 +51,47 @@ import info.nightscout.utils.PasswordProtection;
|
|||
|
||||
public class ConfigBuilderFragment extends SubscriberFragment {
|
||||
|
||||
@BindView(R.id.configbuilder_insulinlistview)
|
||||
ListView insulinListView;
|
||||
@BindView(R.id.configbuilder_sensitivitylistview)
|
||||
ListView sensitivityListView;
|
||||
@BindView(R.id.configbuilder_bgsourcelistview)
|
||||
ListView bgsourceListView;
|
||||
@BindView(R.id.configbuilder_bgsourcelabel)
|
||||
TextView bgsourceLabel;
|
||||
@BindView(R.id.configbuilder_pumplistview)
|
||||
ListView pumpListView;
|
||||
@BindView(R.id.configbuilder_pumplabel)
|
||||
TextView pumpLabel;
|
||||
@BindView(R.id.configbuilder_looplistview)
|
||||
ListView loopListView;
|
||||
@BindView(R.id.configbuilder_looplabel)
|
||||
TextView loopLabel;
|
||||
@BindView(R.id.configbuilder_treatmentslistview)
|
||||
ListView treatmentsListView;
|
||||
@BindView(R.id.configbuilder_treatmentslabel)
|
||||
TextView treatmentsLabel;
|
||||
@BindView(R.id.configbuilder_profilelistview)
|
||||
ListView profileListView;
|
||||
@BindView(R.id.configbuilder_profilelabel)
|
||||
TextView profileLabel;
|
||||
@BindView(R.id.configbuilder_apslistview)
|
||||
ListView apsListView;
|
||||
@BindView(R.id.configbuilder_apslabel)
|
||||
TextView apsLabel;
|
||||
@BindView(R.id.configbuilder_constraintslistview)
|
||||
ListView constraintsListView;
|
||||
@BindView(R.id.configbuilder_constraintslabel)
|
||||
TextView constraintsLabel;
|
||||
@BindView(R.id.configbuilder_generallistview)
|
||||
ListView generalListView;
|
||||
private List<PluginView> pluginViews = new ArrayList<>();
|
||||
|
||||
@BindView(R.id.configbuilder_mainlayout)
|
||||
LinearLayout mainLayout;
|
||||
@BindView(R.id.configbuilder_unlock)
|
||||
@BindView(R.id.profile_plugins)
|
||||
LinearLayout profilePlugins;
|
||||
@BindView(R.id.insulin_plugins)
|
||||
LinearLayout insulinPlugins;
|
||||
@BindView(R.id.bgsource_plugins)
|
||||
LinearLayout bgSourcePlugins;
|
||||
@BindView(R.id.pump_plugins)
|
||||
LinearLayout pumpPlugins;
|
||||
@BindView(R.id.sensitivity_plugins)
|
||||
LinearLayout sensitivityPlugins;
|
||||
@BindView(R.id.aps_plugins)
|
||||
LinearLayout apsPlugins;
|
||||
@BindView(R.id.loop_plugins)
|
||||
LinearLayout loopPlugins;
|
||||
@BindView(R.id.constraints_plugins)
|
||||
LinearLayout constraintsPlugins;
|
||||
@BindView(R.id.treatments_plugins)
|
||||
LinearLayout treatmentsPlugins;
|
||||
@BindView(R.id.general_plugins)
|
||||
LinearLayout generalPlugins;
|
||||
|
||||
@BindView(R.id.main_layout)
|
||||
ScrollView mainLayout;
|
||||
@BindView(R.id.unlock)
|
||||
Button unlock;
|
||||
|
||||
PluginCustomAdapter insulinDataAdapter = null;
|
||||
PluginCustomAdapter sensivityDataAdapter = null;
|
||||
PluginCustomAdapter bgsourceDataAdapter = null;
|
||||
PluginCustomAdapter pumpDataAdapter = null;
|
||||
PluginCustomAdapter loopDataAdapter = null;
|
||||
PluginCustomAdapter treatmentDataAdapter = null;
|
||||
PluginCustomAdapter profileDataAdapter = null;
|
||||
PluginCustomAdapter apsDataAdapter = null;
|
||||
PluginCustomAdapter constraintsDataAdapter = null;
|
||||
PluginCustomAdapter generalDataAdapter = null;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
try {
|
||||
View view = inflater.inflate(R.layout.configbuilder_fragment, container, false);
|
||||
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
|
||||
if (PasswordProtection.isLocked("settings_password"))
|
||||
mainLayout.setVisibility(View.GONE);
|
||||
else
|
||||
unlock.setVisibility(View.GONE);
|
||||
else unlock.setVisibility(View.GONE);
|
||||
|
||||
createViews();
|
||||
|
||||
return view;
|
||||
} catch (Exception e) {
|
||||
FabricPrivacy.logException(e);
|
||||
|
@ -121,222 +100,48 @@ public class ConfigBuilderFragment extends SubscriberFragment {
|
|||
return null;
|
||||
}
|
||||
|
||||
@OnClick(R.id.configbuilder_unlock)
|
||||
public void onClickUnlock() {
|
||||
@OnClick(R.id.unlock)
|
||||
void onClickUnlock() {
|
||||
PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", () -> {
|
||||
mainLayout.setVisibility(View.VISIBLE);
|
||||
unlock.setVisibility(View.GONE);
|
||||
}, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
for (PluginView pluginView : pluginViews) pluginView.unbind();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
|
||||
insulinDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(InsulinInterface.class, PluginType.INSULIN), PluginType.INSULIN);
|
||||
insulinListView.setAdapter(insulinDataAdapter);
|
||||
setListViewHeightBasedOnChildren(insulinListView);
|
||||
bgsourceDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(BgSourceInterface.class, PluginType.BGSOURCE), PluginType.BGSOURCE);
|
||||
bgsourceListView.setAdapter(bgsourceDataAdapter);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginType.BGSOURCE).size() == 0)
|
||||
bgsourceLabel.setVisibility(View.GONE);
|
||||
setListViewHeightBasedOnChildren(bgsourceListView);
|
||||
pumpDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginType.PUMP), PluginType.PUMP);
|
||||
pumpListView.setAdapter(pumpDataAdapter);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginType.PUMP).size() == 0 || Config.NSCLIENT || Config.G5UPLOADER) {
|
||||
pumpLabel.setVisibility(View.GONE);
|
||||
pumpListView.setVisibility(View.GONE);
|
||||
}
|
||||
setListViewHeightBasedOnChildren(pumpListView);
|
||||
loopDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginType.LOOP), PluginType.LOOP);
|
||||
loopListView.setAdapter(loopDataAdapter);
|
||||
setListViewHeightBasedOnChildren(loopListView);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginType.LOOP).size() == 0)
|
||||
loopLabel.setVisibility(View.GONE);
|
||||
treatmentDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginType.TREATMENT), PluginType.TREATMENT);
|
||||
treatmentsListView.setAdapter(treatmentDataAdapter);
|
||||
setListViewHeightBasedOnChildren(treatmentsListView);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginType.TREATMENT).size() == 0)
|
||||
treatmentsLabel.setVisibility(View.GONE);
|
||||
profileDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(ProfileInterface.class, PluginType.PROFILE), PluginType.PROFILE);
|
||||
profileListView.setAdapter(profileDataAdapter);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginType.PROFILE).size() == 0)
|
||||
profileLabel.setVisibility(View.GONE);
|
||||
setListViewHeightBasedOnChildren(profileListView);
|
||||
apsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginType.APS), PluginType.APS);
|
||||
apsListView.setAdapter(apsDataAdapter);
|
||||
setListViewHeightBasedOnChildren(apsListView);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginType.APS).size() == 0)
|
||||
apsLabel.setVisibility(View.GONE);
|
||||
sensivityDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(SensitivityInterface.class, PluginType.SENSITIVITY), PluginType.SENSITIVITY);
|
||||
sensitivityListView.setAdapter(sensivityDataAdapter);
|
||||
setListViewHeightBasedOnChildren(sensitivityListView);
|
||||
constraintsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(ConstraintsInterface.class, PluginType.CONSTRAINTS), PluginType.CONSTRAINTS);
|
||||
constraintsListView.setAdapter(constraintsDataAdapter);
|
||||
setListViewHeightBasedOnChildren(constraintsListView);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginType.CONSTRAINTS).size() == 0)
|
||||
constraintsLabel.setVisibility(View.GONE);
|
||||
generalDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginType.GENERAL), PluginType.GENERAL);
|
||||
generalListView.setAdapter(generalDataAdapter);
|
||||
setListViewHeightBasedOnChildren(generalListView);
|
||||
for (PluginView pluginView : pluginViews) pluginView.update();
|
||||
}
|
||||
|
||||
/*
|
||||
* ConfigBuilderFragment code
|
||||
*/
|
||||
|
||||
private class PluginCustomAdapter extends ArrayAdapter<PluginBase> {
|
||||
|
||||
private ArrayList<PluginBase> pluginList;
|
||||
final private PluginType type;
|
||||
|
||||
PluginCustomAdapter(Context context, int textViewResourceId,
|
||||
ArrayList<PluginBase> pluginList, PluginType type) {
|
||||
super(context, textViewResourceId, pluginList);
|
||||
this.pluginList = new ArrayList<>();
|
||||
this.pluginList.addAll(pluginList);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private class PluginViewHolder {
|
||||
TextView name;
|
||||
CheckBox checkboxEnabled;
|
||||
CheckBox checkboxVisible;
|
||||
ImageView settings;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View getView(int position, View view, @NonNull ViewGroup parent) {
|
||||
|
||||
PluginViewHolder holder;
|
||||
PluginBase plugin = pluginList.get(position);
|
||||
|
||||
if (view == null) {
|
||||
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.configbuilder_simpleitem, null);
|
||||
|
||||
holder = new PluginViewHolder();
|
||||
holder.name = (TextView) view.findViewById(R.id.configbuilder_simpleitem_name);
|
||||
holder.checkboxEnabled = (CheckBox) view.findViewById(R.id.configbuilder_simpleitem_checkboxenabled);
|
||||
holder.checkboxVisible = (CheckBox) view.findViewById(R.id.configbuilder_simpleitem_checkboxvisible);
|
||||
holder.settings = (ImageView) view.findViewById(R.id.configbuilder_simpleitem_settings);
|
||||
|
||||
if (plugin.isEnabled(type) && plugin.getPreferencesId() != -1)
|
||||
holder.settings.setVisibility(View.VISIBLE);
|
||||
else
|
||||
holder.settings.setVisibility(View.INVISIBLE);
|
||||
|
||||
view.setTag(holder);
|
||||
|
||||
holder.checkboxEnabled.setOnClickListener(v -> {
|
||||
CheckBox cb = (CheckBox) v;
|
||||
PluginBase plugin1 = (PluginBase) cb.getTag();
|
||||
plugin1.setPluginEnabled(type, cb.isChecked());
|
||||
plugin1.setFragmentVisible(type, cb.isChecked());
|
||||
onEnabledCategoryChanged(plugin1, type);
|
||||
ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxEnabled");
|
||||
MainApp.bus().post(new EventRefreshGui());
|
||||
MainApp.bus().post(new EventConfigBuilderChange());
|
||||
ConfigBuilderPlugin.getPlugin().logPluginStatus();
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ConfigurationChange"));
|
||||
});
|
||||
|
||||
holder.checkboxVisible.setOnClickListener(v -> {
|
||||
CheckBox cb = (CheckBox) v;
|
||||
PluginBase plugin12 = (PluginBase) cb.getTag();
|
||||
plugin12.setFragmentVisible(type, cb.isChecked());
|
||||
ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxVisible");
|
||||
MainApp.bus().post(new EventRefreshGui());
|
||||
ConfigBuilderPlugin.getPlugin().logPluginStatus();
|
||||
});
|
||||
|
||||
holder.settings.setOnClickListener(v -> {
|
||||
final PluginBase plugin13 = (PluginBase) v.getTag();
|
||||
PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", () -> {
|
||||
Intent i = new Intent(getContext(), PreferencesActivity.class);
|
||||
i.putExtra("id", plugin13.getPreferencesId());
|
||||
startActivity(i);
|
||||
}, null);
|
||||
});
|
||||
|
||||
holder.name.setOnLongClickListener(v -> {
|
||||
final PluginBase plugin14 = (PluginBase) v.getTag();
|
||||
PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", () -> {
|
||||
Intent i = new Intent(getContext(), PreferencesActivity.class);
|
||||
i.putExtra("id", plugin14.getPreferencesId());
|
||||
startActivity(i);
|
||||
}, null);
|
||||
return false;
|
||||
});
|
||||
|
||||
} else {
|
||||
holder = (PluginViewHolder) view.getTag();
|
||||
}
|
||||
|
||||
holder.name.setText(plugin.getName());
|
||||
holder.checkboxEnabled.setChecked(plugin.isEnabled(type));
|
||||
holder.checkboxVisible.setChecked(plugin.isFragmentVisible());
|
||||
holder.name.setTag(plugin);
|
||||
holder.checkboxEnabled.setTag(plugin);
|
||||
holder.checkboxVisible.setTag(plugin);
|
||||
holder.settings.setTag(plugin);
|
||||
|
||||
if (plugin.pluginDescription.alwaysEnabled) {
|
||||
holder.checkboxEnabled.setEnabled(false);
|
||||
}
|
||||
|
||||
if (plugin.pluginDescription.alwayVisible) {
|
||||
holder.checkboxEnabled.setEnabled(false);
|
||||
}
|
||||
|
||||
if (!plugin.isEnabled(type)) {
|
||||
holder.checkboxVisible.setEnabled(false);
|
||||
}
|
||||
|
||||
if (!plugin.hasFragment()) {
|
||||
holder.checkboxVisible.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
// Hide enabled control and force enabled plugin if there is only one plugin available
|
||||
if (type == PluginType.INSULIN || type == PluginType.PUMP || type == PluginType.SENSITIVITY)
|
||||
if (pluginList.size() < 2) {
|
||||
holder.checkboxEnabled.setEnabled(false);
|
||||
plugin.setPluginEnabled(type, true);
|
||||
ConfigBuilderPlugin.getPlugin().storeSettings("ForceEnable");
|
||||
}
|
||||
|
||||
// Constraints cannot be disabled
|
||||
if (type == PluginType.CONSTRAINTS)
|
||||
holder.checkboxEnabled.setEnabled(false);
|
||||
|
||||
// Hide disabled profiles by default
|
||||
if (type == PluginType.PROFILE) {
|
||||
if (!plugin.isEnabled(type)) {
|
||||
holder.checkboxVisible.setEnabled(false);
|
||||
holder.checkboxVisible.setChecked(false);
|
||||
} else {
|
||||
holder.checkboxVisible.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Disable profile control for pump profiles if pump is not enabled
|
||||
if (type == PluginType.PROFILE) {
|
||||
if (PumpInterface.class.isAssignableFrom(plugin.getClass())) {
|
||||
if (!plugin.isEnabled(PluginType.PUMP)) {
|
||||
holder.checkboxEnabled.setEnabled(false);
|
||||
holder.checkboxEnabled.setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isEnabled(type)) {
|
||||
view.setBackgroundColor(MainApp.gc(R.color.configBuilderSelectedBackground));
|
||||
}
|
||||
|
||||
return view;
|
||||
private void createViews() {
|
||||
createViewsForPlugins(profilePlugins, MainApp.getSpecificPluginsVisibleInListByInterface(ProfileInterface.class, PluginType.PROFILE));
|
||||
createViewsForPlugins(insulinPlugins, MainApp.getSpecificPluginsVisibleInListByInterface(InsulinInterface.class, PluginType.INSULIN));
|
||||
createViewsForPlugins(bgSourcePlugins, MainApp.getSpecificPluginsVisibleInListByInterface(BgSourceInterface.class, PluginType.BGSOURCE));
|
||||
createViewsForPlugins(pumpPlugins, MainApp.getSpecificPluginsVisibleInList(PluginType.PUMP));
|
||||
createViewsForPlugins(sensitivityPlugins, MainApp.getSpecificPluginsVisibleInListByInterface(SensitivityInterface.class, PluginType.SENSITIVITY));
|
||||
createViewsForPlugins(apsPlugins, MainApp.getSpecificPluginsVisibleInList(PluginType.APS));
|
||||
createViewsForPlugins(loopPlugins, MainApp.getSpecificPluginsVisibleInList(PluginType.LOOP));
|
||||
createViewsForPlugins(constraintsPlugins, MainApp.getSpecificPluginsVisibleInListByInterface(ConstraintsInterface.class, PluginType.CONSTRAINTS));
|
||||
createViewsForPlugins(treatmentsPlugins, MainApp.getSpecificPluginsVisibleInList(PluginType.TREATMENT));
|
||||
createViewsForPlugins(generalPlugins, MainApp.getSpecificPluginsVisibleInList(PluginType.GENERAL));
|
||||
}
|
||||
|
||||
private void createViewsForPlugins(LinearLayout parent, List<PluginBase> plugins) {
|
||||
for (PluginBase plugin: plugins) {
|
||||
PluginView pluginView = new PluginView(plugin);
|
||||
parent.addView(pluginView.getBaseView());
|
||||
pluginViews.add(pluginView);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean areMultipleSelectionsAllowed(PluginType type) {
|
||||
return type == PluginType.GENERAL || type == PluginType.CONSTRAINTS ||type == PluginType.LOOP;
|
||||
}
|
||||
|
||||
public static void processOnEnabledCategoryChanged(PluginBase changedPlugin, PluginType type) {
|
||||
|
@ -394,35 +199,95 @@ public class ConfigBuilderFragment extends SubscriberFragment {
|
|||
}
|
||||
}
|
||||
|
||||
void onEnabledCategoryChanged(PluginBase changedPlugin, PluginType type) {
|
||||
processOnEnabledCategoryChanged(changedPlugin, type);
|
||||
updateGUI();
|
||||
}
|
||||
class PluginView {
|
||||
|
||||
/****
|
||||
* Method for Setting the Height of the ListView dynamically.
|
||||
* *** Hack to fix the issue of not showing all the items of the ListView
|
||||
* *** when placed inside a ScrollView
|
||||
****/
|
||||
public static void setListViewHeightBasedOnChildren(ListView listView) {
|
||||
ListAdapter listAdapter = listView.getAdapter();
|
||||
if (listAdapter == null)
|
||||
return;
|
||||
private Unbinder unbinder;
|
||||
private PluginBase plugin;
|
||||
private boolean updating = false;
|
||||
|
||||
int desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(), View.MeasureSpec.UNSPECIFIED);
|
||||
int totalHeight = 0;
|
||||
View view = null;
|
||||
for (int i = 0; i < listAdapter.getCount(); i++) {
|
||||
view = listAdapter.getView(i, view, listView);
|
||||
if (i == 0)
|
||||
view.setLayoutParams(new ViewGroup.LayoutParams(desiredWidth, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
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;
|
||||
|
||||
view.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
|
||||
totalHeight += view.getMeasuredHeight();
|
||||
public PluginView(PluginBase plugin) {
|
||||
this.plugin = plugin;
|
||||
baseView = (LinearLayout) getLayoutInflater().inflate(R.layout.configbuilder_single_plugin, null);
|
||||
unbinder = ButterKnife.bind(this, baseView);
|
||||
update();
|
||||
}
|
||||
ViewGroup.LayoutParams params = listView.getLayoutParams();
|
||||
params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
|
||||
listView.setLayoutParams(params);
|
||||
|
||||
public LinearLayout getBaseView() {
|
||||
return baseView;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
updating = true;
|
||||
enabledExclusive.setVisibility(areMultipleSelectionsAllowed(plugin.getType()) ? View.GONE : View.VISIBLE);
|
||||
enabledInclusive.setVisibility(areMultipleSelectionsAllowed(plugin.getType()) ? View.VISIBLE : View.GONE);
|
||||
enabledExclusive.setChecked(plugin.isEnabled(plugin.getType()));
|
||||
enabledInclusive.setChecked(plugin.isEnabled(plugin.getType()));
|
||||
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(plugin.getType()) ? View.GONE : View.VISIBLE);
|
||||
pluginVisibility.setVisibility(plugin.hasFragment() ? View.VISIBLE : View.INVISIBLE);
|
||||
pluginVisibility.setEnabled(!(plugin.pluginDescription.neverVisible || plugin.pluginDescription.alwayVisible) && plugin.isEnabled(plugin.getType()));
|
||||
pluginVisibility.setChecked(plugin.isFragmentVisible());
|
||||
updating = false;
|
||||
}
|
||||
|
||||
@OnCheckedChanged(R.id.plugin_visibility)
|
||||
void onVisibilityChanged() {
|
||||
if (updating) return;
|
||||
plugin.setFragmentVisible(plugin.getType(), pluginVisibility.isChecked());
|
||||
ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxVisible");
|
||||
MainApp.bus().post(new EventRefreshGui());
|
||||
ConfigBuilderPlugin.getPlugin().logPluginStatus();
|
||||
}
|
||||
|
||||
@OnCheckedChanged({R.id.plugin_enabled_exclusive, R.id.plugin_enabled_inclusive})
|
||||
void onEnabledChanged() {
|
||||
if (updating) return;
|
||||
boolean enabled = enabledExclusive.getVisibility() == View.VISIBLE ? enabledExclusive.isChecked() : enabledInclusive.isChecked();
|
||||
plugin.setPluginEnabled(plugin.getType(), enabled);
|
||||
plugin.setFragmentVisible(plugin.getType(), enabled);
|
||||
processOnEnabledCategoryChanged(plugin, plugin.getType());
|
||||
updateGUI();
|
||||
ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxEnabled");
|
||||
MainApp.bus().post(new EventRefreshGui());
|
||||
MainApp.bus().post(new EventConfigBuilderChange());
|
||||
ConfigBuilderPlugin.getPlugin().logPluginStatus();
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ConfigurationChange"));
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ package info.nightscout.androidaps.tabs;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
|
@ -19,7 +21,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
|||
/**
|
||||
* Created by mike on 30.05.2016.
|
||||
*/
|
||||
public class TabPageAdapter extends FragmentStatePagerAdapter {
|
||||
public class TabPageAdapter extends FragmentPagerAdapter {
|
||||
|
||||
ArrayList<PluginBase> visibleFragmentList = new ArrayList<>();
|
||||
|
||||
|
@ -76,5 +78,8 @@ public class TabPageAdapter extends FragmentStatePagerAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return System.identityHashCode(visibleFragmentList.get(position));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class HardLimits {
|
|||
public static final double MAXISF = 720; // mgdl
|
||||
|
||||
public static final double[] MAXIOB_AMA = {3, 5, 7, 12};
|
||||
public static final double[] MAXIOB_SMB = {3, 7, 12, 25};
|
||||
public static final double[] MAXIOB_SMB = {3, 7, 20, 25};
|
||||
|
||||
public static final double[] MAXBASAL = {2, 5, 10, 12};
|
||||
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_visibility.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_visibility.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 953 B |
BIN
app/src/main/res/drawable-mdpi/ic_visibility.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_visibility.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 413 B |
BIN
app/src/main/res/drawable-xhdpi/ic_visibility.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_visibility.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 847 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_visibility.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_visibility.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_visibility.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_visibility.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 233 B |
|
@ -1,240 +1,428 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment">
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/unlock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:text="@string/unlock_settings" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/main_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/configbuilder_unlock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/unlock_settings" />
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/configbuilder_mainlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_profilelabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/mdtp_circle_color"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/configbuilder_profile"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="false"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="10dp"
|
||||
app:srcCompat="@drawable/visibility_black_16x16" />
|
||||
</RelativeLayout>
|
||||
android:text="@string/configbuilder_profile"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/configbuilder_profilelistview"
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_profile_description"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardColorBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_insulinlabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/mdtp_circle_color"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/configbuilder_insulin"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/configbuilder_insulinlistview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardColorBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_bgsourcelabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/mdtp_circle_color"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/configbuilder_bgsource"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/configbuilder_bgsourcelistview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardColorBackground" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_pumplabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/mdtp_circle_color"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/configbuilder_pump"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/configbuilder_pumplistview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardColorBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_sensitivitylabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/mdtp_circle_color"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/configbuilder_sensitivity"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/configbuilder_sensitivitylistview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardColorBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_apslabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/mdtp_circle_color"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/configbuilder_aps"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/configbuilder_apslistview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardColorBackground" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_looplabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/mdtp_circle_color"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/configbuilder_loop"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/configbuilder_looplistview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardColorBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_constraintslabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/mdtp_circle_color"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/constraints"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/configbuilder_constraintslistview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardColorBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_treatmentslabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/mdtp_circle_color"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/configbuilder_treatments"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/configbuilder_treatmentslistview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardColorBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_generallabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/mdtp_circle_color"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/configbuilder_general"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/configbuilder_generallistview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardColorBackground" />
|
||||
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
app:srcCompat="@drawable/ic_visibility" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/profile_plugins"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_insulin"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_insulin_description"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
app:srcCompat="@drawable/ic_visibility" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/insulin_plugins"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_bgsource"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_bgsource_description"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
app:srcCompat="@drawable/ic_visibility" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bgsource_plugins"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_pump"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_pump_description"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
app:srcCompat="@drawable/ic_visibility" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/pump_plugins"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_sensitivity"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_sensitivity_description"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
app:srcCompat="@drawable/ic_visibility" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/sensitivity_plugins"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_aps"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_aps_description"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
app:srcCompat="@drawable/ic_visibility" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/aps_plugins"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_loop"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_loop_description"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
app:srcCompat="@drawable/ic_visibility" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/loop_plugins"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/constraints"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_constraints_description"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
app:srcCompat="@drawable/ic_visibility" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/constraints_plugins"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_treatments"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_treatments_description"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
app:srcCompat="@drawable/ic_visibility" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/treatments_plugins"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_general"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/configbuilder_general_description"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
app:srcCompat="@drawable/ic_visibility" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/general_plugins"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
|
@ -1,42 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/configbuilder_simpleitem_checkboxenabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:gravity="center_vertical" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_simpleitem_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="ConfigBuilder plugin text" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/configbuilder_simpleitem_settings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
app:srcCompat="@drawable/ic_settings" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/configbuilder_simpleitem_checkboxvisible"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false" />
|
||||
|
||||
</LinearLayout>
|
60
app/src/main/res/layout/configbuilder_single_plugin.xml
Normal file
60
app/src/main/res/layout/configbuilder_single_plugin.xml
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/plugin_enabled_exclusive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="16dp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/plugin_enabled_inclusive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="16dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/plugin_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp"
|
||||
tools:text="Plugin name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/plugin_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12sp"
|
||||
tools:text="A super exquisite plugin description" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/plugin_preferences"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
app:srcCompat="@drawable/ic_settings" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/plugin_visibility"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
|
@ -14,7 +14,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/objectives_fake_layout"
|
||||
android:visibility="gone">
|
||||
android:visibility="visible">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -83,16 +83,23 @@
|
|||
|
||||
|
||||
<string name="configbuilder_pump">Pump</string>
|
||||
<string name="configbuilder_pump_description">Which pump would you like to use with AndroidAPS?</string>
|
||||
<string name="configbuilder_treatments">Treatments</string>
|
||||
<string name="configbuilder_treatments_description">Which plugin should be used for treatment handling?</string>
|
||||
<string name="configbuilder_profile">Profile</string>
|
||||
<string name="configbuilder_profile_description">Which profile should AndroidAPS use?</string>
|
||||
<string name="configbuilder_aps">APS</string>
|
||||
<string name="configbuilder_aps_description">Which APS algorithm should make therapy adjustments?</string>
|
||||
<string name="configbuilder_general">General</string>
|
||||
<string name="configbuilder_general_description">These are some general plugins you might find useful to use.</string>
|
||||
<string name="configbuilder_constraints_description">Which constraints should be applied?</string>
|
||||
<string name="days">days</string>
|
||||
<string name="objectives_minimalduration">Minimal duration</string>
|
||||
<string name="constraints">Constraints</string>
|
||||
|
||||
<string name="loop">Loop</string>
|
||||
<string name="configbuilder_loop">Loop</string>
|
||||
<string name="configbuilder_loop_description">Use this to activate AndroidAPS\\' loop integration.</string>
|
||||
<string name="loop_aps_label">APS</string>
|
||||
<string name="loop_constraintsprocessed_label">After processed constraints</string>
|
||||
<string name="loop_tbrsetbypump_label">Temp basal set by pump</string>
|
||||
|
@ -121,6 +128,7 @@
|
|||
<string name="changeyourinput">Change your input!</string>
|
||||
<string name="setextendedbolusquestion">Set new extended bolus:</string>
|
||||
<string name="configbuilder_bgsource">BG Source</string>
|
||||
<string name="configbuilder_bgsource_description">Where should AndroidAPS gain it\'s data from?</string>
|
||||
<string name="xdrip">xDrip</string>
|
||||
<string name="apsmode_title">APS Mode</string>
|
||||
|
||||
|
@ -553,6 +561,7 @@
|
|||
<string name="restartingapp">Exiting application to apply settings.</string>
|
||||
<string name="danarv2pump">DanaRv2</string>
|
||||
<string name="configbuilder_insulin">Insulin</string>
|
||||
<string name="configbuilder_insulin_description">Which type of insulin are you using?</string>
|
||||
<string name="fastactinginsulin">Fast Acting Insulin</string>
|
||||
<string name="fastactinginsulincomment">Novorapid, Novolog, Humalog</string>
|
||||
<string name="ultrafastactinginsulincomment">Fiasp</string>
|
||||
|
@ -616,6 +625,7 @@
|
|||
<string name="openaps">OpenAPS</string>
|
||||
<string name="uploader">Uploader</string>
|
||||
<string name="configbuilder_sensitivity">Sensitivity detection</string>
|
||||
<string name="configbuilder_sensitivity_description">Which sensitivity algorithm should be used?</string>
|
||||
<string name="sensitivity_shortname">SENS</string>
|
||||
<string name="sensitivityoref0">Sensitivity Oref0</string>
|
||||
<string name="sensitivityaaps">Sensitivity AAPS</string>
|
||||
|
|
Loading…
Reference in a new issue