@Test public void testUiWhenDataIsNull() { mCurrentGuidanceSpeedView.setCurrentSpeedData(null); final View container = mCurrentGuidanceSpeedView.findViewById(R.id.guidance_current_speed_container); assertThat(container.getVisibility(), is(View.VISIBLE)); }
public void setCurrentSpeedData(@Nullable GuidanceSpeedData data) { populateUi(data); if (data == null || !data.isValid()) { mGuidanceSpeedData = data; return; } boolean refreshBackground = false; if (mGuidanceSpeedData == null || !mGuidanceSpeedData.isValid() || data.isSpeeding() != mGuidanceSpeedData.isSpeeding()) { refreshBackground = true; } mGuidanceSpeedData = data; if (refreshBackground) { post(this::refreshDrawableState); } }
GuidanceSpeedView extends BaseView { public void setCurrentSpeedData(@Nullable GuidanceSpeedData data) { populateUi(data); if (data == null || !data.isValid()) { mGuidanceSpeedData = data; return; } boolean refreshBackground = false; if (mGuidanceSpeedData == null || !mGuidanceSpeedData.isValid() || data.isSpeeding() != mGuidanceSpeedData.isSpeeding()) { refreshBackground = true; } mGuidanceSpeedData = data; if (refreshBackground) { post(this::refreshDrawableState); } } }
GuidanceSpeedView extends BaseView { public void setCurrentSpeedData(@Nullable GuidanceSpeedData data) { populateUi(data); if (data == null || !data.isValid()) { mGuidanceSpeedData = data; return; } boolean refreshBackground = false; if (mGuidanceSpeedData == null || !mGuidanceSpeedData.isValid() || data.isSpeeding() != mGuidanceSpeedData.isSpeeding()) { refreshBackground = true; } mGuidanceSpeedData = data; if (refreshBackground) { post(this::refreshDrawableState); } } GuidanceSpeedView(Context context);  GuidanceSpeedView(Context context, @Nullable AttributeSet attrs);  GuidanceSpeedView(Context context, @Nullable AttributeSet attrs, int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  GuidanceSpeedView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes); }
GuidanceSpeedView extends BaseView { public void setCurrentSpeedData(@Nullable GuidanceSpeedData data) { populateUi(data); if (data == null || !data.isValid()) { mGuidanceSpeedData = data; return; } boolean refreshBackground = false; if (mGuidanceSpeedData == null || !mGuidanceSpeedData.isValid() || data.isSpeeding() != mGuidanceSpeedData.isSpeeding()) { refreshBackground = true; } mGuidanceSpeedData = data; if (refreshBackground) { post(this::refreshDrawableState); } } GuidanceSpeedView(Context context);  GuidanceSpeedView(Context context, @Nullable AttributeSet attrs);  GuidanceSpeedView(Context context, @Nullable AttributeSet attrs, int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  GuidanceSpeedView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes); void setValueTextColor(int color); void setUnitTextColor(int color); void setCurrentSpeedData(@Nullable GuidanceSpeedData data); @NonNull GuidanceSpeedData getCurrentSpeedData(); int getValueTextColor(); int getUnitTextColor(); @Override void onRestoreInstanceState(Parcelable state); }
GuidanceSpeedView extends BaseView { public void setCurrentSpeedData(@Nullable GuidanceSpeedData data) { populateUi(data); if (data == null || !data.isValid()) { mGuidanceSpeedData = data; return; } boolean refreshBackground = false; if (mGuidanceSpeedData == null || !mGuidanceSpeedData.isValid() || data.isSpeeding() != mGuidanceSpeedData.isSpeeding()) { refreshBackground = true; } mGuidanceSpeedData = data; if (refreshBackground) { post(this::refreshDrawableState); } } GuidanceSpeedView(Context context);  GuidanceSpeedView(Context context, @Nullable AttributeSet attrs);  GuidanceSpeedView(Context context, @Nullable AttributeSet attrs, int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  GuidanceSpeedView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes); void setValueTextColor(int color); void setUnitTextColor(int color); void setCurrentSpeedData(@Nullable GuidanceSpeedData data); @NonNull GuidanceSpeedData getCurrentSpeedData(); int getValueTextColor(); int getUnitTextColor(); @Override void onRestoreInstanceState(Parcelable state);  }