From a40078774119f8648cc9f08e0cbaaf6eb45132b0 Mon Sep 17 00:00:00 2001 From: Cuong Nguyen Date: Fri, 24 Apr 2015 16:55:16 +0700 Subject: [PATCH 1/2] Invalid Mock datasource --- HackVG/domain/src/test/java/GetMoviesUsecaseTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HackVG/domain/src/test/java/GetMoviesUsecaseTest.java b/HackVG/domain/src/test/java/GetMoviesUsecaseTest.java index ec26ae7..e964203 100644 --- a/HackVG/domain/src/test/java/GetMoviesUsecaseTest.java +++ b/HackVG/domain/src/test/java/GetMoviesUsecaseTest.java @@ -2,6 +2,7 @@ import com.hackvg.domain.GetMoviesUsecaseController; import com.hackvg.model.MediaDataSource; import com.hackvg.model.entities.MoviesWrapper; +import com.hackvg.model.rest.RestDataSource; import com.squareup.otto.Bus; import org.junit.Before; @@ -21,7 +22,7 @@ public class GetMoviesUsecaseTest { private GetMoviesUsecase getMoviesUsecase; @Mock - private MediaDataSource mockDataSource; + private RestDataSource mockRestDataSource; @Mock private Bus mockUiBus; @@ -32,8 +33,7 @@ public void setUp() { MockitoAnnotations.initMocks(this); getMoviesUsecase = new GetMoviesUsecaseController( - mockDataSource, mockUiBus - ); + mockRestDataSource, mockUiBus); } @Test @@ -41,7 +41,7 @@ public void testMoviesRequestExecution() { getMoviesUsecase.execute(); - verify(mockDataSource, times(1)) + verify(mockRestDataSource, times(1)) .getMovies(); } From 75ed868f9bb5197e8c7db70e9dc4280bd8902764 Mon Sep 17 00:00:00 2001 From: Cuong Nguyen Date: Fri, 24 Apr 2015 17:16:12 +0700 Subject: [PATCH 2/2] Fix crash when Palette can not find a color which matches the criteria then it will return null --- .../android/views/activities/MovieDetailActivity.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HackVG/app/src/main/java/com/hackvg/android/views/activities/MovieDetailActivity.java b/HackVG/app/src/main/java/com/hackvg/android/views/activities/MovieDetailActivity.java index 4f83e10..336c7f0 100644 --- a/HackVG/app/src/main/java/com/hackvg/android/views/activities/MovieDetailActivity.java +++ b/HackVG/app/src/main/java/com/hackvg/android/views/activities/MovieDetailActivity.java @@ -496,7 +496,10 @@ public void onGenerated(Palette palette) { setHeadersTitlColors(titleAndFabColors); - setVibrantElements(vibrantSwatch); + final Swatch vibrantSwatchColors = (vibrantSwatch != null) + ? vibrantSwatch : titleAndFabColors; + + setVibrantElements(vibrantSwatchColors); } } @@ -504,9 +507,6 @@ private void setVibrantElements(Swatch vibrantSwatch) { mFabButton.getBackground().setColorFilter(vibrantSwatch.getRgb(), PorterDuff.Mode.MULTIPLY); - - - } @OnClick(R.id.activity_detail_fab)