Add changeConnector()
This commit is contained in:
parent
7659f58776
commit
d863e39046
2 changed files with 44 additions and 27 deletions
|
@ -176,8 +176,25 @@ public class AutomationFragment extends SubscriberFragment {
|
|||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (position != initialPosition) {
|
||||
// conector type changed
|
||||
final TriggerConnector.Type newConnectorType = TriggerConnector.Type.values()[position];
|
||||
changeConnector(trigger, connector, TriggerConnector.Type.values()[position]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
mRootLayout.addView(spinner);
|
||||
} else {
|
||||
isFirstItem = false;
|
||||
}
|
||||
|
||||
mRootLayout.addView(trigger.createView(mContext));
|
||||
}
|
||||
}
|
||||
|
||||
public static void changeConnector(final Trigger trigger, final TriggerConnector connector, final TriggerConnector.Type newConnectorType) {
|
||||
if (connector.size() > 2) {
|
||||
// split connector
|
||||
int pos = connector.pos(trigger) - 1;
|
||||
|
@ -204,21 +221,6 @@ public class AutomationFragment extends SubscriberFragment {
|
|||
|
||||
connector.simplify().rebuildView();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
mRootLayout.addView(spinner);
|
||||
} else {
|
||||
isFirstItem = false;
|
||||
}
|
||||
|
||||
mRootLayout.addView(trigger.createView(mContext));
|
||||
}
|
||||
}
|
||||
|
||||
public void rebuild() {
|
||||
destroy();
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package info.nightscout.androidaps.plugins.general.automation;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({})
|
||||
public class ComposeTriggerTest {
|
||||
@Test
|
||||
public void testTriggerList() {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue