Skip to content

Commit

Permalink
feat: fix android view corner dim
Browse files Browse the repository at this point in the history
  • Loading branch information
biezhihua committed Sep 13, 2022
1 parent 52575be commit c1d60a0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,25 @@ fun View.setRoundCornerRadiusAndRoundCornerBorder(style: GXStyle?) {
val borderColor = style?.borderColor?.value(this.context)
var cornerRadius = style?.borderRadius?.value

// 2022/06/21
// Fix a ui bug,
// if we set corner radius and border radius in the same time, it will produce some defects at the view corner.
// we need make a special process in order fix the defects.
if (cornerRadius != null && cornerRadius.size == 8 &&
borderRadius != null && borderWidth != null && borderColor != null
) {
val tl = cornerRadius[0]
val tr = cornerRadius[2]
val bl = cornerRadius[4]
val br = cornerRadius[6]
if (tl == tr && tr == bl && bl == br) {
cornerRadius = FloatArray(8) { tl + 1F.dpToPx() }
}
}

// 2022/09/13
// Fix a ui bug
// Remove logic of radius increase because it will caused corner dim
// if (cornerRadius != null && cornerRadius.size == 8 &&
// borderRadius != null && borderWidth != null && borderColor != null
// ) {
// val tl = cornerRadius[0]
// val tr = cornerRadius[2]
// val bl = cornerRadius[4]
// val br = cornerRadius[6]
// if (tl == tr && tr == bl && bl == br) {
// cornerRadius = FloatArray(8) { tl + 1F.dpToPx() }
// }
// }

if (this is GXIRoundCorner) {
if (this is GXView) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class MainActivity : AppCompatActivity() {
val intent = Intent(MainActivity@ this, GaiaXFastPreviewActivity::class.java)
intent.putExtra(
"GAIA_STUDIO_URL",
"gaiax://gaiax/preview?url=ws://30.78.149.204:9001&id=test-template&type=auto"
"gaiax://gaiax/preview?url=ws://30.78.147.194:9001&id=test-template&type=auto"
)
launcher.launch(intent)
}
Expand Down

0 comments on commit c1d60a0

Please sign in to comment.