Skip to content

Commit

Permalink
Merge pull request square#1080 from condda/master
Browse files Browse the repository at this point in the history
Naturalize's suggestions
  • Loading branch information
JakeWharton committed Jul 14, 2015
2 parents 8507b5d + b15d70e commit fbb9327
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
30 changes: 15 additions & 15 deletions picasso/src/main/java/com/squareup/picasso/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,45 +113,45 @@ private Request(Uri uri, int resourceId, String stableKey, List<Transformation>
}

@Override public String toString() {
final StringBuilder sb = new StringBuilder("Request{");
final StringBuilder builder = new StringBuilder("Request{");
if (resourceId > 0) {
sb.append(resourceId);
builder.append(resourceId);
} else {
sb.append(uri);
builder.append(uri);
}
if (transformations != null && !transformations.isEmpty()) {
for (Transformation transformation : transformations) {
sb.append(' ').append(transformation.key());
builder.append(' ').append(transformation.key());
}
}
if (stableKey != null) {
sb.append(" stableKey(").append(stableKey).append(')');
builder.append(" stableKey(").append(stableKey).append(')');
}
if (targetWidth > 0) {
sb.append(" resize(").append(targetWidth).append(',').append(targetHeight).append(')');
builder.append(" resize(").append(targetWidth).append(',').append(targetHeight).append(')');
}
if (centerCrop) {
sb.append(" centerCrop");
builder.append(" centerCrop");
}
if (centerInside) {
sb.append(" centerInside");
builder.append(" centerInside");
}
if (rotationDegrees != 0) {
sb.append(" rotation(").append(rotationDegrees);
builder.append(" rotation(").append(rotationDegrees);
if (hasRotationPivot) {
sb.append(" @ ").append(rotationPivotX).append(',').append(rotationPivotY);
builder.append(" @ ").append(rotationPivotX).append(',').append(rotationPivotY);
}
sb.append(')');
builder.append(')');
}
if (purgeable) {
sb.append(" purgeable");
builder.append(" purgeable");
}
if (config != null) {
sb.append(' ').append(config);
builder.append(' ').append(config);
}
sb.append('}');
builder.append('}');

return sb.toString();
return builder.toString();
}

String logId() {
Expand Down
8 changes: 4 additions & 4 deletions picasso/src/test/java/com/squareup/picasso/UtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ public class UtilsTest {

@Test public void getResourceById() throws IOException {
Request request = new Request.Builder(RESOURCE_ID_URI).build();
Resources resources = Utils.getResources(mockPackageResourceContext(), request);
int id = Utils.getResourceId(resources, request);
Resources res = Utils.getResources(mockPackageResourceContext(), request);
int id = Utils.getResourceId(res, request);
assertThat(id).isEqualTo(RESOURCE_ID_1);
}

@Test public void getResourceByTypeAndName() throws IOException {
Request request = new Request.Builder(RESOURCE_TYPE_URI).build();
Resources resources = Utils.getResources(mockPackageResourceContext(), request);
int id = Utils.getResourceId(resources, request);
Resources res = Utils.getResources(mockPackageResourceContext(), request);
int id = Utils.getResourceId(res, request);
assertThat(id).isEqualTo(RESOURCE_ID_1);
}

Expand Down

0 comments on commit fbb9327

Please sign in to comment.