Skip to content

Commit

Permalink
Update loading banner text and colors
Browse files Browse the repository at this point in the history
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
  • Loading branch information
makovkastar authored and facebook-github-bot committed Jun 17, 2020
1 parent fca3a39 commit 6afc984
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,8 @@ public void onChunkComplete(

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");
Expand All @@ -220,11 +218,9 @@ public void onChunkComplete(
}

@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));
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public static void setDevLoadingEnabled(boolean enabled) {
sEnabled = enabled;
}

public DevLoadingViewController(
Context context, ReactInstanceManagerDevHelper reactInstanceManagerHelper) {
public DevLoadingViewController(ReactInstanceManagerDevHelper reactInstanceManagerHelper) {
mReactInstanceManagerHelper = reactInstanceManagerHelper;
}

Expand Down Expand Up @@ -98,12 +97,7 @@ public void run() {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ public void onReceive(Context context, Intent intent) {
setDevSupportEnabled(enableOnCreate);

mRedBoxHandler = redBoxHandler;
mDevLoadingViewController =
new DevLoadingViewController(applicationContext, reactInstanceManagerHelper);
mDevLoadingViewController = new DevLoadingViewController(reactInstanceManagerHelper);

mExceptionLoggers.add(new JSExceptionLogger());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#035900"
android:background="#404040"
android:ellipsize="end"
android:gravity="center"
android:paddingTop="5dp"
Expand Down

0 comments on commit 6afc984

Please sign in to comment.