Skip to content

Commit

Permalink
Migrated to API 21, new tools and gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugen Martynov authored and JakeWharton committed Nov 23, 2014
1 parent 0c37fba commit 4b78c66
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 65 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ language: android

android:
components:
- build-tools-20.0.0
- build-tools-21.1.1
- extra-android-m2repository
- extra-google-m2repository
- android-20
- android-21
licenses:
- android-sdk-license-5be876d5
- android-sdk-preview-license-52d11cd2
Expand Down
2 changes: 1 addition & 1 deletion assertj-android-cardview-v7/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

dependencies {
compile project(':assertj-android')
compile 'com.android.support:cardview-v7:21.0.0-rc1'
compile 'com.android.support:cardview-v7:21.0.2'
}

android {
Expand Down
2 changes: 1 addition & 1 deletion assertj-android-gridlayout-v7/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

dependencies {
compile project(':assertj-android')
compile 'com.android.support:gridlayout-v7:20.0.0'
compile 'com.android.support:gridlayout-v7:21.0.2'
}

android {
Expand Down
2 changes: 1 addition & 1 deletion assertj-android-mediarouter-v7/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

dependencies {
compile project(':assertj-android')
compile 'com.android.support:mediarouter-v7:20.0.0'
compile 'com.android.support:mediarouter-v7:21.0.2'
}

android {
Expand Down
4 changes: 2 additions & 2 deletions assertj-android-palette-v7/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ apply plugin: 'com.android.library'

dependencies {
compile project(':assertj-android')
compile 'com.android.support:palette-v7:21.0.0-rc1'
compile 'com.android.support:palette-v7:21.0.2'
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion 'L'
minSdkVersion 21
}

compileOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// This class is generated. Do not modify directly!
package org.assertj.android.palette.v7.api;

import org.assertj.android.palette.v7.api.graphics.PaletteSwatchAssert;

/** Assertions for testing Android classes. */
@SuppressWarnings("deprecation")
public final class Assertions {
Expand All @@ -11,9 +13,9 @@ public static org.assertj.android.palette.v7.api.graphics.PaletteAssert assertTh
return new org.assertj.android.palette.v7.api.graphics.PaletteAssert(actual);
}

public static org.assertj.android.palette.v7.api.graphics.PaletteItemAssert assertThat(
android.support.v7.graphics.PaletteItem actual) {
return new org.assertj.android.palette.v7.api.graphics.PaletteItemAssert(actual);
public static PaletteSwatchAssert assertThat(
android.support.v7.graphics.Palette.Swatch actual) {
return new PaletteSwatchAssert(actual);
}

private Assertions() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.assertj.android.palette.v7.api.graphics;

import android.support.v7.graphics.Palette;
import android.support.v7.graphics.PaletteItem;

import org.assertj.core.api.AbstractAssert;

Expand All @@ -15,67 +14,61 @@ public PaletteAssert(Palette actual) {
super(actual, PaletteAssert.class);
}

public PaletteAssert hasVibrantColor(PaletteItem color) {
public PaletteAssert hasVibrantColor(int color) {
isNotNull();
PaletteItem actualColor = actual.getVibrantColor();
assertThat(equals(color, actualColor)) //
int actualColor = actual.getVibrantColor(getAnotherColor(color));
assertThat(color) //
.overridingErrorMessage("Expected vibrant color <%s> but was <%s>", color, actualColor) //
.isTrue();
.isEqualTo(actualColor);
return this;
}

public PaletteAssert hasDarkVibrantColor(PaletteItem color) {
public PaletteAssert hasDarkVibrantColor(int color) {
isNotNull();
PaletteItem actualColor = actual.getDarkVibrantColor();
assertThat(equals(color, actualColor)) //
int actualColor = actual.getDarkVibrantColor(getAnotherColor(color));
assertThat(color) //
.overridingErrorMessage("Expected dark vibrant color <%s> but was <%s>", color, actualColor) //
.isTrue();
.isEqualTo(actualColor);
return this;
}

public PaletteAssert hasLightVibrantColor(PaletteItem color) {
public PaletteAssert hasLightVibrantColor(int color) {
isNotNull();
PaletteItem actualColor = actual.getLightVibrantColor();
assertThat(equals(color, actualColor)) //
int actualColor = actual.getLightVibrantColor(getAnotherColor(color));
assertThat(color) //
.overridingErrorMessage("Expected light vibrant color <%s> but was <%s>", color, actualColor) //
.isTrue();
.isEqualTo(actualColor);
return this;
}

public PaletteAssert hasMutedColor(PaletteItem color) {
public PaletteAssert hasMutedColor(int color) {
isNotNull();
PaletteItem actualColor = actual.getMutedColor();
assertThat(equals(color, actualColor)) //
int actualColor = actual.getMutedColor(getAnotherColor(color));
assertThat(color) //
.overridingErrorMessage("Expected muted color <%s> but was <%s>", color, actualColor) //
.isTrue();
.isEqualTo(actualColor);
return this;
}

public PaletteAssert hasDarkMutedColor(PaletteItem color) {
public PaletteAssert hasDarkMutedColor(int color) {
isNotNull();
PaletteItem actualColor = actual.getDarkMutedColor();
assertThat(equals(color, actualColor)) //
int actualColor = actual.getDarkMutedColor(getAnotherColor(color));
assertThat(color) //
.overridingErrorMessage("Expected dark muted color <%s> but was <%s>", color, actualColor) //
.isTrue();
.isEqualTo(actualColor);
return this;
}

public PaletteAssert hasLightMutedColor(PaletteItem color) {
public PaletteAssert hasLightMutedColor(int color) {
isNotNull();
PaletteItem actualColor = actual.getLightMutedColor();
assertThat(equals(color, actualColor)) //
int actualColor = actual.getLightMutedColor(getAnotherColor(color));
assertThat(color) //
.overridingErrorMessage("Expected light muted color <%s> but was <%s>", color, actualColor) //
.isTrue();
.isEqualTo(actualColor);
return this;
}

private static boolean equals(PaletteItem actualColor, PaletteItem color) {
if (actualColor == color) {
return true;
}
if ((actualColor == null) || (color == null)) {
return false;
}
return actualColor.toString().equals(color.toString());
private static int getAnotherColor(int color) {
return 0xFFFFFFFF - color;
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package org.assertj.android.palette.v7.api.graphics;

import android.support.v7.graphics.PaletteItem;
import android.support.v7.graphics.Palette;

import org.assertj.core.api.AbstractAssert;

import static org.assertj.core.api.Assertions.assertThat;

/**
* Assertions for {@link PaletteItem} instances.
* Assertions for {@link Palette.Swatch} instances.
*/
public class PaletteItemAssert extends AbstractAssert<PaletteItemAssert, PaletteItem> {
public PaletteItemAssert(PaletteItem actual) {
super(actual, PaletteItemAssert.class);
public class PaletteSwatchAssert extends AbstractAssert<PaletteSwatchAssert, Palette.Swatch> {
public PaletteSwatchAssert(Palette.Swatch actual) {
super(actual, PaletteSwatchAssert.class);
}

public PaletteItemAssert hasRgb(int rgb) {
public PaletteSwatchAssert hasRgb(int rgb) {
isNotNull();
int actualRgb = actual.getRgb();
assertThat(actualRgb) //
Expand Down
2 changes: 1 addition & 1 deletion assertj-android-play-services/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

dependencies {
compile project(':assertj-android')
compile 'com.google.android.gms:play-services:5.2.08'
compile 'com.google.android.gms:play-services:6.1.71'
}

android {
Expand Down
2 changes: 1 addition & 1 deletion assertj-android-recyclerview-v7/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

dependencies {
compile project(':assertj-android')
compile 'com.android.support:recyclerview-v7:21.0.0-rc1'
compile 'com.android.support:recyclerview-v7:21.0.0'
}

android {
Expand Down
2 changes: 1 addition & 1 deletion assertj-android-support-v4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

dependencies {
compile project(':assertj-android')
compile 'com.android.support:support-v4:20.0.0'
compile 'com.android.support:support-v4:21.0.2'
}

android {
Expand Down
4 changes: 2 additions & 2 deletions assertj-android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apply plugin: 'com.android.library'

dependencies {
compile 'org.assertj:assertj-core:1.6.1'
compile 'com.android.support:support-annotations:20.0.0'
compile 'org.assertj:assertj-core:1.7.0'
compile 'com.android.support:support-annotations:21.0.2'
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
import static android.view.Display.FLAG_PRIVATE;
import static android.view.Display.FLAG_SECURE;
import static android.view.Display.FLAG_SUPPORTS_PROTECTED_BUFFERS;
import static android.view.Display.STATE_DOZING;
import static android.view.Display.STATE_DOZE;
import static android.view.Display.STATE_DOZE_SUSPEND;
import static android.view.Display.STATE_OFF;
import static android.view.Display.STATE_ON;
import static android.view.Display.STATE_UNKNOWN;
Expand Down Expand Up @@ -245,7 +246,8 @@ public static String orientationToString(@SurfaceRotation int orientation) {
@TargetApi(KITKAT_WATCH)
public static String stateToString(@DisplayState int state) {
return buildNamedValueString(state)
.value(STATE_DOZING, "dozing")
.value(STATE_DOZE, "dozing")
.value(STATE_DOZE_SUSPEND, "doze suspend")
.value(STATE_OFF, "off")
.value(STATE_ON, "on")
.value(STATE_UNKNOWN, "unknown")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import static java.lang.annotation.RetentionPolicy.SOURCE;

@IntDef({
Display.STATE_DOZING,
Display.STATE_DOZE,
Display.STATE_DOZE_SUSPEND,
Display.STATE_OFF,
Display.STATE_ON,
Display.STATE_UNKNOWN
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ subprojects {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
classpath 'com.android.tools.build:gradle:0.14.4'
}
}

Expand All @@ -17,7 +17,7 @@ subprojects {
}

ext {
minSdkVersion = 7
compileSdkVersion = 20
buildToolsVersion = '20.0.0'
minSdkVersion = 9
compileSdkVersion = 21
buildToolsVersion = '21.1.1'
}
4 changes: 2 additions & 2 deletions gradle/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ afterEvaluate { project ->
}

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

Expand All @@ -104,7 +104,7 @@ afterEvaluate { project ->

task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java
from android.sourceSets.main.java.sourceFiles
}

artifacts {
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jan 08 01:21:31 PST 2014
#Thu Nov 20 15:42:26 CET 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip

0 comments on commit 4b78c66

Please sign in to comment.