@Test public void testSettingDynamicPenalty() { DynamicPenalty dynamicPenalty = MockUtils.getDynamicPenality(Route.TrafficPenaltyMode.AVOID_LONG_TERM_CLOSURES); mTrafficOptionsPanel.setDynamicPenalty(dynamicPenalty); final List<OptionItem> items = mTrafficOptionsPanel.getOptionItems(); assertThat(items.size(), equalTo(1)); SingleChoiceOptionItem item = (SingleChoiceOptionItem) items.get(0); final List<String> labels = item.getLabels(); assertThat(labels.size(), equalTo(3)); String selectedId = item.getSelectedItemLabel(); assertThat(selectedId, equalTo(getString(R.string.msdkui_avoid_long_term_closures))); dynamicPenalty = MockUtils.getDynamicPenality(Route.TrafficPenaltyMode.DISABLED); mTrafficOptionsPanel.setDynamicPenalty(dynamicPenalty); selectedId = item.getSelectedItemLabel(); assertThat(selectedId, equalTo(getString(R.string.msdkui_disabled))); }
public void setDynamicPenalty(final DynamicPenalty penalty) { mDynamicPenalty = penalty; select(mDynamicPenalty.getTrafficPenaltyMode()); }
TrafficOptionsPanel extends OptionsPanel implements OptionItem.OnChangedListener { public void setDynamicPenalty(final DynamicPenalty penalty) { mDynamicPenalty = penalty; select(mDynamicPenalty.getTrafficPenaltyMode()); } }
TrafficOptionsPanel extends OptionsPanel implements OptionItem.OnChangedListener { public void setDynamicPenalty(final DynamicPenalty penalty) { mDynamicPenalty = penalty; select(mDynamicPenalty.getTrafficPenaltyMode()); } TrafficOptionsPanel(final Context context);  TrafficOptionsPanel(final Context context, final AttributeSet attrs);  TrafficOptionsPanel(final Context context, final AttributeSet attrs, final int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  TrafficOptionsPanel(final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes); }
TrafficOptionsPanel extends OptionsPanel implements OptionItem.OnChangedListener { public void setDynamicPenalty(final DynamicPenalty penalty) { mDynamicPenalty = penalty; select(mDynamicPenalty.getTrafficPenaltyMode()); } TrafficOptionsPanel(final Context context);  TrafficOptionsPanel(final Context context, final AttributeSet attrs);  TrafficOptionsPanel(final Context context, final AttributeSet attrs, final int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  TrafficOptionsPanel(final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes); DynamicPenalty getDynamicPenalty(); void setDynamicPenalty(final DynamicPenalty penalty); void populateDynamicPenalty(); @Override void onChanged(OptionItem item); }
TrafficOptionsPanel extends OptionsPanel implements OptionItem.OnChangedListener { public void setDynamicPenalty(final DynamicPenalty penalty) { mDynamicPenalty = penalty; select(mDynamicPenalty.getTrafficPenaltyMode()); } TrafficOptionsPanel(final Context context);  TrafficOptionsPanel(final Context context, final AttributeSet attrs);  TrafficOptionsPanel(final Context context, final AttributeSet attrs, final int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  TrafficOptionsPanel(final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes); DynamicPenalty getDynamicPenalty(); void setDynamicPenalty(final DynamicPenalty penalty); void populateDynamicPenalty(); @Override void onChanged(OptionItem item);  }