55import android .view .ViewGroup ;
66import android .view .WindowManager ;
77
8+ import com .termux .shared .view .ViewUtils ;
89import com .termux .view .TerminalView ;
910
1011/**
1112 * Handles displaying our TermuxFloatView as a collapsed bubble and restoring back
1213 * to its original display.
1314 */
1415public class FloatingBubbleManager {
15- private static final int BUBBLE_SIZE = 200 ;
16+ private static final int DEFAULT_BUBBLE_SIZE_DP = 80 ;
1617
1718 private TermuxFloatView mTermuxFloatView ;
19+ private final int BUBBLE_SIZE_PX ;
1820
1921 private boolean mIsMinimized ;
2022
@@ -26,9 +28,9 @@ public class FloatingBubbleManager {
2628 private Drawable mOriginalTerminalViewBackground ;
2729 private Drawable mOriginalFloatViewBackground ;
2830
29-
3031 public FloatingBubbleManager (TermuxFloatView termuxFloatView ) {
3132 mTermuxFloatView = termuxFloatView ;
33+ BUBBLE_SIZE_PX = ViewUtils .dpToPx (mTermuxFloatView .getContext (), DEFAULT_BUBBLE_SIZE_DP );
3234 }
3335
3436 public void toggleBubble () {
@@ -50,8 +52,9 @@ public void displayAsFloatingBubble() {
5052 captureOriginalLayoutValues ();
5153
5254 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 ;
5558
5659 TerminalView terminalView = getTerminalView ();
5760 terminalView .setBackgroundResource (R .drawable .round_button );
0 commit comments