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
This commit is contained in:
Oleksandr Melnykov
2020-06-17 09:10:51 -07:00
committed by Facebook GitHub Bot
parent fca3a39da5
commit 6afc984e81
4 changed files with 8 additions and 19 deletions
@@ -200,10 +200,8 @@ public class BundleDownloader {
try {
JSONObject progress = new JSONObject(body.readUtf8());
String status = null;
if (progress.has("status")) {
status = progress.getString("status");
}
String status =
progress.has("status") ? progress.getString("status") : "Bundling";
Integer done = null;
if (progress.has("done")) {
done = progress.getInt("done");
@@ -220,11 +218,9 @@ public class BundleDownloader {
}
@Override
public void onChunkProgress(Map<String, String> headers, long loaded, long total)
throws IOException {
public void onChunkProgress(Map<String, String> headers, long loaded, long total) {
if ("application/javascript".equals(headers.get("Content-Type"))) {
callback.onProgress(
"Downloading JavaScript bundle", (int) (loaded / 1024), (int) (total / 1024));
callback.onProgress("Downloading", (int) (loaded / 1024), (int) (total / 1024));
}
}
});
@@ -37,8 +37,7 @@ public class DevLoadingViewController {
sEnabled = enabled;
}
public DevLoadingViewController(
Context context, ReactInstanceManagerDevHelper reactInstanceManagerHelper) {
public DevLoadingViewController(ReactInstanceManagerDevHelper reactInstanceManagerHelper) {
mReactInstanceManagerHelper = reactInstanceManagerHelper;
}
@@ -98,12 +97,7 @@ public class DevLoadingViewController {
message.append(status != null ? status : "Loading");
if (done != null && total != null && total > 0) {
message.append(
String.format(
Locale.getDefault(),
" %.1f%% (%d/%d)",
(float) done / total * 100,
done,
total));
String.format(Locale.getDefault(), " %.1f%%", (float) done / total * 100));
}
message.append("\u2026"); // `...` character
if (mDevLoadingView != null) {
@@ -217,8 +217,7 @@ public abstract class DevSupportManagerBase
setDevSupportEnabled(enableOnCreate);
mRedBoxHandler = redBoxHandler;
mDevLoadingViewController =
new DevLoadingViewController(applicationContext, reactInstanceManagerHelper);
mDevLoadingViewController = new DevLoadingViewController(reactInstanceManagerHelper);
mExceptionLoggers.add(new JSExceptionLogger());