mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Abstracting Activity logic from Dev Loading View (#35256)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35256 Changelog: [General][Added] - Making Dev Loading View cross platform by abstracting out the activity/context logic from the controller in a polymorph class. Reviewed By: rshest Differential Revision: D40908923 fbshipit-source-id: db8e94f8ded5ffe0deeb88335cd7f3d1bf87243a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
29caed22cc
commit
1a4fa92b25
+5
-1
@@ -22,10 +22,11 @@ import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.R;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.devsupport.interfaces.DevLoadingViewManager;
|
||||
import java.util.Locale;
|
||||
|
||||
/** Controller to display loading messages on top of the screen. All methods are thread safe. */
|
||||
public class DevLoadingViewController {
|
||||
public class DevLoadingViewController implements DevLoadingViewManager {
|
||||
private static boolean sEnabled = true;
|
||||
private final ReactInstanceDevHelper mReactInstanceManagerHelper;
|
||||
private @Nullable TextView mDevLoadingView;
|
||||
@@ -39,6 +40,7 @@ public class DevLoadingViewController {
|
||||
mReactInstanceManagerHelper = reactInstanceManagerHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(final String message) {
|
||||
if (!sEnabled) {
|
||||
return;
|
||||
@@ -53,6 +55,7 @@ public class DevLoadingViewController {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(
|
||||
final @Nullable String status, final @Nullable Integer done, final @Nullable Integer total) {
|
||||
if (!sEnabled) {
|
||||
@@ -77,6 +80,7 @@ public class DevLoadingViewController {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
if (!sEnabled) {
|
||||
return;
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.devsupport.interfaces;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/** Interface to display loading messages on top of the screen. */
|
||||
public interface DevLoadingViewManager {
|
||||
|
||||
void showMessage(final String message);
|
||||
|
||||
void updateProgress(
|
||||
final @Nullable String status, final @Nullable Integer done, final @Nullable Integer total);
|
||||
|
||||
void hide();
|
||||
}
|
||||
Reference in New Issue
Block a user