Skip to content

Commit cbdd8e1

Browse files
committed
Fix: The hard-coding problems of BubbleDrawer.
1 parent c64dffd commit cbdd8e1

5 files changed

Lines changed: 15 additions & 12 deletions

File tree

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ buildscript {
2020
coroutines : '0.20',
2121

2222
okio : '2.4.3',
23-
okhttp : '4.2.2',
23+
okhttp : '4.3.1',
2424
retrofit : '2.4.0',
2525

26-
glide : '4.10.0',
26+
glide : '4.11.0',
2727
anko : '0.10.8',
2828
eventbus : '3.1.1',
2929
gson : '2.8.5'

vkit/src/main/java/com/phantomvk/vkit/bubble/BubbleDrawer.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@
2424

2525
package com.phantomvk.vkit.bubble
2626

27+
import android.content.Context
2728
import android.graphics.*
2829
import androidx.annotation.ColorInt
29-
30-
class BubbleDrawer(@Direction var arrowDirection: Int = Direction.START,
31-
var arrowWidth: Float = 18F,
32-
var arrowHeight: Float = 36F,
33-
var arrowMarginTop: Float = 12F,
34-
var cornerRadius: Float = 30F,
35-
var strokeOffset: Float = 3F,
30+
import com.phantomvk.vkit.util.dip
31+
32+
class BubbleDrawer(var context: Context,
33+
@Direction var arrowDirection: Int = Direction.START,
34+
var arrowWidth: Float = context.dip(6F),
35+
var arrowHeight: Float = context.dip(12F),
36+
var arrowMarginTop: Float = context.dip(4F),
37+
var cornerRadius: Float = context.dip(10F),
38+
var strokeOffset: Float = context.dip(1F),
3639
@ColorInt var strokeColor: Int = 0xFFCFCFCF.toInt()) {
3740

3841
private val path = Path()

vkit/src/main/java/com/phantomvk/vkit/widget/BubbleFrameLayout.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ open class BubbleFrameLayout
4646
/**
4747
* Bubble drawer.
4848
*/
49-
private val mDrawer = BubbleDrawer()
49+
private val mDrawer = BubbleDrawer(context)
5050

5151
/**
5252
* Record if the user is touching the layout.

vkit/src/main/java/com/phantomvk/vkit/widget/BubbleLinearLayout.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ open class BubbleLinearLayout
4545
/**
4646
* Bubble drawer.
4747
*/
48-
private val mDrawer = BubbleDrawer()
48+
private val mDrawer = BubbleDrawer(context)
4949

5050
/**
5151
* Record if the user is touching the layout.

vkit/src/main/java/com/phantomvk/vkit/widget/BubbleRelativeLayout.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ open class BubbleRelativeLayout
4545
/**
4646
* Bubble drawer.
4747
*/
48-
private val mDrawer = BubbleDrawer()
48+
private val mDrawer = BubbleDrawer(context)
4949

5050
/**
5151
* Record if the user is touching the layout.

0 commit comments

Comments
 (0)