diff --git a/app/src/main/java/com/termux/window/FloatingBubbleManager.java b/app/src/main/java/com/termux/window/FloatingBubbleManager.java index 1c9985d..ed49bf0 100644 --- a/app/src/main/java/com/termux/window/FloatingBubbleManager.java +++ b/app/src/main/java/com/termux/window/FloatingBubbleManager.java @@ -5,6 +5,7 @@ import android.view.ViewGroup; import android.view.WindowManager; +import com.termux.shared.view.ViewUtils; import com.termux.view.TerminalView; /** @@ -12,9 +13,10 @@ * to its original display. */ public class FloatingBubbleManager { - private static final int BUBBLE_SIZE = 200; + private static final int DEFAULT_BUBBLE_SIZE_DP = 80; private TermuxFloatView mTermuxFloatView; + private final int BUBBLE_SIZE_PX; private boolean mIsMinimized; @@ -26,9 +28,9 @@ public class FloatingBubbleManager { private Drawable mOriginalTerminalViewBackground; private Drawable mOriginalFloatViewBackground; - public FloatingBubbleManager(TermuxFloatView termuxFloatView) { mTermuxFloatView = termuxFloatView; + BUBBLE_SIZE_PX = ViewUtils.dpToPx(mTermuxFloatView.getContext(), DEFAULT_BUBBLE_SIZE_DP); } public void toggleBubble() { @@ -50,8 +52,9 @@ public void displayAsFloatingBubble() { captureOriginalLayoutValues(); WindowManager.LayoutParams layoutParams = getLayoutParams(); - layoutParams.width = BUBBLE_SIZE; - layoutParams.height = BUBBLE_SIZE; + + layoutParams.width = BUBBLE_SIZE_PX; + layoutParams.height = BUBBLE_SIZE_PX; TerminalView terminalView = getTerminalView(); terminalView.setBackgroundResource(R.drawable.round_button);