@Test public void testUi() { final TextView speedLimitView = mGuidanceSpeedLimitView.findViewById(R.id.speed_limit); GuidanceSpeedData data; mGuidanceSpeedLimitView.setCurrentSpeedData(null); assertThat(mGuidanceSpeedLimitView.getVisibility(), is(View.GONE)); data = new GuidanceSpeedData(45.0, SPEED_LIMIT); mGuidanceSpeedLimitView.setCurrentSpeedData(data); assertThat(mGuidanceSpeedLimitView.getVisibility(), is(View.VISIBLE)); assertThat(speedLimitView.getText().toString(), is(String.valueOf(SpeedFormatterUtil.format(50, UnitSystem.METRIC)))); data = new GuidanceSpeedData(60.0, SPEED_LIMIT); mGuidanceSpeedLimitView.setCurrentSpeedData(data); assertThat(mGuidanceSpeedLimitView.getVisibility(), is(View.VISIBLE)); assertThat(speedLimitView.getText().toString(), is(String.valueOf(SpeedFormatterUtil.format(50, UnitSystem.METRIC)))); data = new GuidanceSpeedData(150.0, 0.0); mGuidanceSpeedLimitView.setCurrentSpeedData(data); assertThat(mGuidanceSpeedLimitView.getVisibility(), is(View.GONE)); data = new GuidanceSpeedData(45.0, SPEED_LIMIT); mGuidanceSpeedLimitView.setCurrentSpeedData(data); assertThat(mGuidanceSpeedLimitView.getVisibility(), is(View.VISIBLE)); assertThat(speedLimitView.getText().toString(), is(String.valueOf(SpeedFormatterUtil.format(50, UnitSystem.METRIC)))); }
public void setCurrentSpeedData(@Nullable GuidanceSpeedData data) { populateUi(data); }
GuidanceSpeedLimitView extends BaseView { public void setCurrentSpeedData(@Nullable GuidanceSpeedData data) { populateUi(data); } }
GuidanceSpeedLimitView extends BaseView { public void setCurrentSpeedData(@Nullable GuidanceSpeedData data) { populateUi(data); } GuidanceSpeedLimitView(Context context);  GuidanceSpeedLimitView(Context context, @Nullable AttributeSet attrs);  GuidanceSpeedLimitView(Context context, @Nullable AttributeSet attrs, int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  GuidanceSpeedLimitView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes); }
GuidanceSpeedLimitView extends BaseView { public void setCurrentSpeedData(@Nullable GuidanceSpeedData data) { populateUi(data); } GuidanceSpeedLimitView(Context context);  GuidanceSpeedLimitView(Context context, @Nullable AttributeSet attrs);  GuidanceSpeedLimitView(Context context, @Nullable AttributeSet attrs, int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  GuidanceSpeedLimitView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes); void setCurrentSpeedData(@Nullable GuidanceSpeedData data); @NonNull GuidanceSpeedData getCurrentSpeedData(); @Override void onRestoreInstanceState(Parcelable state); }
GuidanceSpeedLimitView extends BaseView { public void setCurrentSpeedData(@Nullable GuidanceSpeedData data) { populateUi(data); } GuidanceSpeedLimitView(Context context);  GuidanceSpeedLimitView(Context context, @Nullable AttributeSet attrs);  GuidanceSpeedLimitView(Context context, @Nullable AttributeSet attrs, int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  GuidanceSpeedLimitView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes); void setCurrentSpeedData(@Nullable GuidanceSpeedData data); @NonNull GuidanceSpeedData getCurrentSpeedData(); @Override void onRestoreInstanceState(Parcelable state);  }