Skip to content

Commit

Permalink
remove binary "voodoo", just add constants for transparent white
Browse files Browse the repository at this point in the history
  • Loading branch information
serdiukov-o-nordwhale committed Feb 10, 2021
1 parent 3df80b9 commit 54ccbe0
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ private Customization() {}

final private static int black = Color.BLACK;
final private static int white = Color.WHITE;
final private static int whiteTransparent = 0x00ffffff;
final private static int whiteSemiTransparent = 0x80ffffff;
final private static int green = Color.GREEN;
final private static int darkGray = Color.DKGRAY;
final private static int lightGray = Color.LTGRAY;
Expand Down Expand Up @@ -61,7 +63,7 @@ private Customization() {}

// removing branding image from overlay
overlay.showBrandingImage = false;
overlay.backgroundColor = withAlpha(white, 0.5f);
overlay.backgroundColor = whiteSemiTransparent;

// setting custom location & image of cancel button
cancelButton.setLocation(FaceTecCancelButtonCustomization.ButtonLocation.TOP_RIGHT);
Expand All @@ -82,7 +84,7 @@ private Customization() {}

// frame (zoom's popup) customizations
// setting frame border, radius & elevation
frame.borderColor = withAlpha(white, 0.0f);
frame.borderColor = whiteTransparent;
frame.cornerRadius = defaultCornerRadius;
frame.borderWidth = 0;
frame.elevation = 19;
Expand Down Expand Up @@ -146,11 +148,4 @@ private Customization() {}

UITextStrings.put(R.string.FaceTec_instructions_message_ready, "Please Frame Your Face In The Small Oval, Then The Big Oval");
}

private static int withAlpha(int color, float alpha) {
int alphaComponent = (int) (alpha * (float) 0xff);
int colorWithoutAlpha = color & 0x00ffffff;

return (alphaComponent & 0xff) << 24 | colorWithoutAlpha;
}
}

0 comments on commit 54ccbe0

Please sign in to comment.