Skip to content

Commit 0e9c9c7

Browse files
huntiefacebook-github-bot
authored andcommitted
Align paused overlay design on Android (#45942)
Summary: Pull Request resolved: #45942 Design refinements to the paused debugger overlay on Android. Changed: - Visual treatment of the button (text, icon colour, spacing) - The touch area of the button (whole unit becomes touchable to resume) - Overlay opacity reduced - Overlay animation removed Changelog: [Internal] Reviewed By: motiz88 Differential Revision: D60962345 fbshipit-source-id: 3c1c480e5469e6f7700fe96305bb83c348329ea6
1 parent 02e8969 commit 0e9c9c7

10 files changed

Lines changed: 50 additions & 24 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PausedInDebuggerOverlayDialogManager.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99

1010
import android.app.Dialog;
1111
import android.content.Context;
12+
import android.graphics.drawable.ColorDrawable;
1213
import android.view.Gravity;
1314
import android.view.LayoutInflater;
1415
import android.view.View;
1516
import android.view.Window;
17+
import android.view.WindowManager;
1618
import android.widget.TextView;
1719
import androidx.annotation.Nullable;
1820
import androidx.core.util.Supplier;
@@ -44,20 +46,32 @@ public void showPausedInDebuggerOverlay(
4446
if (context == null) {
4547
return;
4648
}
49+
4750
View dialogView =
4851
LayoutInflater.from(context).inflate(R.layout.paused_in_debugger_view, null);
49-
mPausedInDebuggerDialog = new Dialog(context);
52+
View resumeButton = Assertions.assertNotNull(dialogView.findViewById(R.id.button));
53+
resumeButton.setOnClickListener((v) -> listener.onResume());
54+
TextView buttonText = Assertions.assertNotNull(dialogView.findViewById(R.id.button_text));
55+
buttonText.setText(message);
56+
57+
mPausedInDebuggerDialog = new Dialog(context, R.style.NoAnimationDialog);
5058
mPausedInDebuggerDialog.setContentView(dialogView);
5159
mPausedInDebuggerDialog.setCancelable(false);
52-
TextView pausedText = Assertions.assertNotNull(dialogView.findViewById(R.id.paused_text));
53-
pausedText.setText(message);
54-
View resumeButton = Assertions.assertNotNull(dialogView.findViewById(R.id.resume_button));
55-
resumeButton.setOnClickListener((v) -> listener.onResume());
60+
5661
Window dialogWindow = mPausedInDebuggerDialog.getWindow();
5762
if (dialogWindow != null) {
63+
WindowManager.LayoutParams layoutParams = dialogWindow.getAttributes();
64+
layoutParams.dimAmount = 0.2f;
65+
66+
dialogWindow.setAttributes(layoutParams);
67+
dialogWindow.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
5868
dialogWindow.setGravity(Gravity.TOP);
69+
dialogWindow.setElevation(0);
70+
dialogWindow.setBackgroundDrawable(
71+
new ColorDrawable(android.graphics.Color.TRANSPARENT));
5972
dialogWindow.setBackgroundDrawableResource(R.drawable.paused_in_debugger_background);
6073
}
74+
6175
mPausedInDebuggerDialog.show();
6276
});
6377
}
9 Bytes
Loading
20 Bytes
Loading
13 Bytes
Loading
-156 Bytes
Loading
-397 Bytes
Loading

packages/react-native/ReactAndroid/src/main/res/devsupport/drawable/paused_in_debugger_background.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
android:color="#FFFFC1"
1616
/>
1717
<stroke
18-
android:color="#D0D0B8" android:width="2dp"
18+
android:color="#B4B49D" android:width="2dp"
1919
/>
2020
<corners
2121
android:radius="12dp"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
tools:ignore="MissingDefaultResource"
5+
>
6+
<solid android:color="#B3000000"/>
7+
</shape>
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<LinearLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
34
xmlns:app="http://schemas.android.com/apk/res-auto"
45
xmlns:tools="http://schemas.android.com/tools"
5-
android:id="@+id/layout"
6-
android:layout_width="match_parent"
6+
android:id="@+id/button"
7+
android:layout_width="wrap_content"
78
android:layout_height="wrap_content"
8-
android:gravity="center"
99
android:layoutDirection="ltr"
1010
android:orientation="horizontal"
11+
android:gravity="center_vertical"
12+
android:background="@android:color/transparent"
13+
android:clickable="true"
14+
android:focusable="true"
15+
android:paddingStart="17dp"
16+
android:paddingEnd="11dp"
1117
tools:ignore="MissingDefaultResource"
1218
>
13-
1419
<TextView
15-
android:id="@+id/paused_text"
20+
android:id="@+id/button_text"
1621
android:layout_width="wrap_content"
1722
android:layout_height="wrap_content"
18-
android:paddingStart="14dp"
1923
android:text=""
20-
android:textColor="@android:color/black"
21-
android:textSize="16sp"
24+
android:textColor="#444"
25+
android:textSize="16dp"
2226
android:textStyle="bold"
27+
android:layout_marginBottom="1dp"
2328
/>
24-
25-
<ImageButton
26-
android:id="@+id/resume_button"
27-
android:layout_width="48dp"
28-
android:layout_height="48dp"
29-
android:background="@drawable/ripple_effect"
30-
android:clickable="true"
31-
android:focusable="true"
32-
android:paddingVertical="8dp"
29+
<ImageView
30+
android:layout_width="32dp"
31+
android:layout_height="32dp"
3332
android:src="@drawable/ic_resume"
33+
android:layout_marginStart="8dp"
34+
android:layout_marginVertical="8dp"
3435
/>
3536
</LinearLayout>

packages/react-native/ReactAndroid/src/main/res/devsupport/values/styles.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,8 @@
3636
<item name="android:textColor">#dddddd</item>
3737
<item name="android:textSize">14sp</item>
3838
</style>
39+
<style name="NoAnimationDialog" parent="Theme.AppCompat.Dialog">
40+
<item name="android:windowEnterAnimation">@null</item>
41+
<item name="android:windowExitAnimation">@null</item>
42+
</style>
3943
</resources>

0 commit comments

Comments
 (0)