5
5
import android .view .ViewGroup ;
6
6
import android .view .WindowManager ;
7
7
8
+ import com .termux .shared .view .ViewUtils ;
8
9
import com .termux .view .TerminalView ;
9
10
10
11
/**
11
12
* Handles displaying our TermuxFloatView as a collapsed bubble and restoring back
12
13
* to its original display.
13
14
*/
14
15
public class FloatingBubbleManager {
15
- private static final int BUBBLE_SIZE = 200 ;
16
+ private static final int DEFAULT_BUBBLE_SIZE_DP = 80 ;
16
17
17
18
private TermuxFloatView mTermuxFloatView ;
19
+ private final int BUBBLE_SIZE_PX ;
18
20
19
21
private boolean mIsMinimized ;
20
22
@@ -26,9 +28,9 @@ public class FloatingBubbleManager {
26
28
private Drawable mOriginalTerminalViewBackground ;
27
29
private Drawable mOriginalFloatViewBackground ;
28
30
29
-
30
31
public FloatingBubbleManager (TermuxFloatView termuxFloatView ) {
31
32
mTermuxFloatView = termuxFloatView ;
33
+ BUBBLE_SIZE_PX = ViewUtils .dpToPx (mTermuxFloatView .getContext (), DEFAULT_BUBBLE_SIZE_DP );
32
34
}
33
35
34
36
public void toggleBubble () {
@@ -50,8 +52,9 @@ public void displayAsFloatingBubble() {
50
52
captureOriginalLayoutValues ();
51
53
52
54
WindowManager .LayoutParams layoutParams = getLayoutParams ();
53
- layoutParams .width = BUBBLE_SIZE ;
54
- layoutParams .height = BUBBLE_SIZE ;
55
+
56
+ layoutParams .width = BUBBLE_SIZE_PX ;
57
+ layoutParams .height = BUBBLE_SIZE_PX ;
55
58
56
59
TerminalView terminalView = getTerminalView ();
57
60
terminalView .setBackgroundResource (R .drawable .round_button );
0 commit comments