Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

fix https://github.com/lucasr/dspec/issues/8 #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions library/src/main/java/org/lucasr/dspec/DesignSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,10 @@

package org.lucasr.dspec;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.view.View;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -491,12 +484,12 @@ private void drawSpacings(Canvas canvas) {
break;

case RIGHT:
position1 = width - spacing.offset + spacing.size;
position1 = width - (spacing.offset + spacing.size);
position2 = width - spacing.offset;
break;

case BOTTOM:
position1 = height - spacing.offset + spacing.size;
position1 = height - (spacing.offset + spacing.size);
position2 = height - spacing.offset;
break;

Expand Down
8 changes: 7 additions & 1 deletion sample/src/main/res/raw/main_activity_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
"from": "LEFT" },
{ "offset": 0,
"size": 16,
"from": "RIGHT" }
"from": "RIGHT" },
{ "offset": 0,
"size": 16,
"from": "BOTTOM" },
{ "offset": 0,
"size": 16,
"from": "TOP" }
]
}