Skip to content

Commit

Permalink
Merge branch 'release/0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
saulmm committed Feb 7, 2016
2 parents de1c6b3 + db1a7a4 commit 4daba83
Show file tree
Hide file tree
Showing 78 changed files with 1,176 additions and 766 deletions.
51 changes: 39 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ apply plugin: 'com.android.databinding'

def cfg = rootProject.ext.configuration
def libs = rootProject.ext.libraries;
def test = rootProject.ext.testingLibraries;

android {
compileSdkVersion cfg.compileVersion
buildToolsVersion cfg.buildToolsVersion

//noinspection GroovyAssignabilityCheck
defaultConfig {
applicationId cfg.package
minSdkVersion cfg.compileVersion
Expand All @@ -19,39 +21,64 @@ android {

buildConfigField "String", "MARVEL_PUBLIC_KEY", "\"${marvel_public_key}\""
buildConfigField "String", "MARVEL_PRIVATE_KEY", "\"${marvel_private_key}\""

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

//noinspection GroovyAssignabilityCheck
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '23.0.2'
}

//noinspection GroovyAssignabilityCheck
dependencies {
// Square
compile "com.squareup.retrofit:retrofit:${libs.retrofit}"
compile "com.squareup.retrofit:converter-gson:${libs.retrofit}"
compile "com.squareup.retrofit:adapter-rxjava:${libs.retrofit}"

// ReactiveX
compile "io.reactivex:rxjava:${libs.rxjava}"
compile "io.reactivex:rxandroid:${libs.rxandroid}"
compile project(':domain')

// Others
compile "com.github.bumptech.glide:glide:${libs.glide}"
compile "jp.wasabeef:recyclerview-animators:${libs.recycler_animators}"
compile "com.jakewharton:butterknife:${libs.butterknife}"
compile "de.hdodenhof:circleimageview:${libs.circleimageview}"
compile "io.reactivex:rxandroid:${libs.rxandroid}"

compile "com.squareup.retrofit:retrofit:${libs.retrofit}"
compile "com.squareup.retrofit:converter-gson:${libs.retrofit}"
compile "com.squareup.retrofit:adapter-rxjava:${libs.retrofit}"

// Google
compile "com.google.dagger:dagger:${libs.dagger}"
apt "com.google.dagger:dagger-compiler:${libs.dagger}"
compile "org.glassfish:javax.annotation:${libs.javax_annotation}"

// Android
compile "com.android.support:design:${libs.supportVersion}"
compile "com.android.support:appcompat-v7:${libs.supportVersion}"
compile "com.android.support:cardview-v7:${libs.supportVersion}"
compile "com.android.support:recyclerview-v7:${libs.supportVersion}"
compile "com.android.support:palette-v7:${libs.supportVersion}"

// Test
testCompile "org.mockito:mockito-core:$test.mockito"
testCompile "junit:junit:$test.junit"

androidTestCompile "com.squareup.okhttp:mockwebserver:$libs.okhttp"
androidTestCompile "com.android.support.test:runner:$test.espressoRunner"
androidTestCompile "com.android.support.test:rules:$test.espressoRules"
androidTestCompile("com.android.support.test.espresso:espresso-core:$test.espresso") {
exclude group: 'javax.inject'
}

androidTestCompile "com.android.support.test.espresso:espresso-intents:$test.espresso"
androidTestCompile ("com.android.support.test.espresso:espresso-contrib:$test.espresso") {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}

androidTestApt "com.google.dagger:dagger-compiler:${libs.dagger}"

}

configurations.all {
resolutionStrategy.force "com.android.support:support-annotations:$libs.supportVersion"
resolutionStrategy.force "com.squareup.okhttp:okhttp:$libs.okhttp"
}
14 changes: 0 additions & 14 deletions app/src/androidTest/java/saulmm/avengers/ApplicationTest.java

This file was deleted.

12 changes: 12 additions & 0 deletions app/src/androidTest/java/saulmm/avengers/TestData.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package saulmm.avengers.tests;

import android.content.Intent;
import android.support.test.espresso.Espresso;
import android.support.test.espresso.contrib.RecyclerViewActions;
import android.support.test.espresso.intent.Intents;
import android.support.test.espresso.intent.rule.IntentsTestRule;
import android.support.test.espresso.matcher.ViewMatchers;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import android.util.Log;
import android.widget.TextView;

import com.squareup.okhttp.mockwebserver.Dispatcher;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import com.squareup.okhttp.mockwebserver.RecordedRequest;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import javax.inject.Inject;

import saulmm.avengers.R;
import saulmm.avengers.TestData;
import saulmm.avengers.injector.components.DaggerAvengersComponent;
import saulmm.avengers.injector.modules.ActivityModule;
import saulmm.avengers.repository.CharacterRepository;
import saulmm.avengers.rest.RestDataSource;
import saulmm.avengers.views.activities.CharacterDetailActivity;
import saulmm.avengers.views.activities.CharacterListActivity;

import static android.support.test.espresso.Espresso.*;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.Intents.times;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static android.support.test.espresso.matcher.ViewMatchers.*;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;

@LargeTest
@RunWith(AndroidJUnit4.class)
public class CharacterListActivityInstrumentationTest {
private MockWebServer mMockWebServer;

@Rule public ActivityTestRule<CharacterListActivity> mCharacterListIntentRule =
new ActivityTestRule<>(CharacterListActivity.class, true, false);

@Before public void setUp() throws Exception {
mMockWebServer = new MockWebServer();
mMockWebServer.start();

RestDataSource.END_POINT = mMockWebServer.getUrl("/").toString();
}

@Test public void showCharacters() {
mMockWebServer.enqueue(new MockResponse().setBody(TestData.TWENTY_CHARACTERS_JSON));

mCharacterListIntentRule.launchActivity(null);

onView(withId(R.id.activity_avengers_recycler)).check(matches(isDisplayed()));
}

@After public void tearDown() throws Exception {
mMockWebServer.shutdown();
}
}
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
>

<activity
android:name=".views.activities.CharacterListListActivity"
android:name=".views.activities.CharacterListActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
>
Expand All @@ -27,7 +27,7 @@

<activity
android:name=".views.activities.CharacterDetailActivity"
android:parentActivityName=".views.activities.CharacterListListActivity"
android:parentActivityName=".views.activities.CharacterListActivity"
android:theme="@style/AvengerDetailActivityTheme"
android:screenOrientation="portrait"
/>
Expand Down
6 changes: 1 addition & 5 deletions app/src/main/java/saulmm/avengers/AvengersApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,26 @@

import android.app.Application;

import saulmm.avengers.injector.AppModule;
import saulmm.avengers.injector.modules.AppModule;
import saulmm.avengers.injector.components.AppComponent;
import saulmm.avengers.injector.components.DaggerAppComponent;

public class AvengersApplication extends Application {

private AppComponent mAppComponent;

@Override
public void onCreate() {

super.onCreate();
initializeInjector();
}

private void initializeInjector() {

mAppComponent = DaggerAppComponent.builder()
.appModule(new AppModule(this))
.build();
}

public AppComponent getAppComponent() {

return mAppComponent;
}
}

This file was deleted.

40 changes: 0 additions & 40 deletions app/src/main/java/saulmm/avengers/domain/GetCharactersUsecase.java

This file was deleted.

47 changes: 0 additions & 47 deletions app/src/main/java/saulmm/avengers/domain/GetCollectionUsecase.java

This file was deleted.

13 changes: 0 additions & 13 deletions app/src/main/java/saulmm/avengers/domain/Usecase.java

This file was deleted.

28 changes: 0 additions & 28 deletions app/src/main/java/saulmm/avengers/injector/AppModule.java

This file was deleted.

Loading

0 comments on commit 4daba83

Please sign in to comment.