Skip to content

Commit 6afc984

Browse files
makovkastarfacebook-github-bot
authored andcommitted
Update loading banner text and colors
Summary: This diff updates the loading banner text and color on Android to match its style on iOS. Differential Revision: D22066823 fbshipit-source-id: 7f8d6cf1a6c4c48babe919995044978d7a81c674
1 parent fca3a39 commit 6afc984

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java

+4-8
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,8 @@ public void onChunkComplete(
200200

201201
try {
202202
JSONObject progress = new JSONObject(body.readUtf8());
203-
String status = null;
204-
if (progress.has("status")) {
205-
status = progress.getString("status");
206-
}
203+
String status =
204+
progress.has("status") ? progress.getString("status") : "Bundling";
207205
Integer done = null;
208206
if (progress.has("done")) {
209207
done = progress.getInt("done");
@@ -220,11 +218,9 @@ public void onChunkComplete(
220218
}
221219

222220
@Override
223-
public void onChunkProgress(Map<String, String> headers, long loaded, long total)
224-
throws IOException {
221+
public void onChunkProgress(Map<String, String> headers, long loaded, long total) {
225222
if ("application/javascript".equals(headers.get("Content-Type"))) {
226-
callback.onProgress(
227-
"Downloading JavaScript bundle", (int) (loaded / 1024), (int) (total / 1024));
223+
callback.onProgress("Downloading", (int) (loaded / 1024), (int) (total / 1024));
228224
}
229225
}
230226
});

ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public static void setDevLoadingEnabled(boolean enabled) {
3737
sEnabled = enabled;
3838
}
3939

40-
public DevLoadingViewController(
41-
Context context, ReactInstanceManagerDevHelper reactInstanceManagerHelper) {
40+
public DevLoadingViewController(ReactInstanceManagerDevHelper reactInstanceManagerHelper) {
4241
mReactInstanceManagerHelper = reactInstanceManagerHelper;
4342
}
4443

@@ -98,12 +97,7 @@ public void run() {
9897
message.append(status != null ? status : "Loading");
9998
if (done != null && total != null && total > 0) {
10099
message.append(
101-
String.format(
102-
Locale.getDefault(),
103-
" %.1f%% (%d/%d)",
104-
(float) done / total * 100,
105-
done,
106-
total));
100+
String.format(Locale.getDefault(), " %.1f%%", (float) done / total * 100));
107101
}
108102
message.append("\u2026"); // `...` character
109103
if (mDevLoadingView != null) {

ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,7 @@ public void onReceive(Context context, Intent intent) {
217217
setDevSupportEnabled(enableOnCreate);
218218

219219
mRedBoxHandler = redBoxHandler;
220-
mDevLoadingViewController =
221-
new DevLoadingViewController(applicationContext, reactInstanceManagerHelper);
220+
mDevLoadingViewController = new DevLoadingViewController(reactInstanceManagerHelper);
222221

223222
mExceptionLoggers.add(new JSExceptionLogger());
224223

ReactAndroid/src/main/res/devsupport/layout/dev_loading_view.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xmlns:android="http://schemas.android.com/apk/res/android"
55
android:layout_width="match_parent"
66
android:layout_height="wrap_content"
7-
android:background="#035900"
7+
android:background="#404040"
88
android:ellipsize="end"
99
android:gravity="center"
1010
android:paddingTop="5dp"

0 commit comments

Comments
 (0)