Skip to content

Commit

Permalink
Made absolute adjustment a float value.
Browse files Browse the repository at this point in the history
  • Loading branch information
weisJ committed Mar 31, 2020
1 parent 3ee6d18 commit 6f3f1ab
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class FontSizeRule {
private final AdjustmentType type;
private final FontSizePreset preset;
private final float relativeAdjustment;
private final int absoluteAdjustment;
private final float absoluteAdjustment;

protected FontSizeRule(final FontSizePreset preset) {
this.preset = preset;
Expand All @@ -41,7 +41,7 @@ protected FontSizeRule(final FontSizePreset preset) {
}

protected FontSizeRule(final AdjustmentType type,
final int absoluteAdjustment, final float relativeAdjustment) {
final float absoluteAdjustment, final float relativeAdjustment) {
this.type = type;
this.absoluteAdjustment = absoluteAdjustment;
this.relativeAdjustment = relativeAdjustment;
Expand All @@ -56,7 +56,7 @@ public static FontSizeRule fromPreset(final FontSizePreset preset) {
return new FontSizeRule(preset);
}

public static FontSizeRule absoluteAdjustment(final int adjustment) {
public static FontSizeRule absoluteAdjustment(final float adjustment) {
return new FontSizeRule(AdjustmentType.ABSOLUTE_ADJUSTMENT, adjustment, 1f);
}

Expand Down Expand Up @@ -107,24 +107,24 @@ public String toString() {
public enum AdjustmentType {
NO_ADJUSTMENT {
@Override
public float adjustSize(final float size, final int absolute, final float relative) {
public float adjustSize(final float size, final float absolute, final float relative) {
return size;
}
},
ABSOLUTE_ADJUSTMENT {
@Override
public float adjustSize(final float size, final int absolute, final float relative) {
public float adjustSize(final float size, final float absolute, final float relative) {
return size + absolute;
}
},
RELATIVE_ADJUSTMENT {
@Override
public float adjustSize(final float size, final int absolute, final float relative) {
public float adjustSize(final float size, final float absolute, final float relative) {
return size * relative;
}
};

abstract public float adjustSize(final float size, final int absolute, final float relative);
abstract public float adjustSize(final float size, final float absolute, final float relative);
}

}

0 comments on commit 6f3f1ab

Please sign in to comment.