Updating shake handling for Android in ShakeDetector and DevSupportManagerImpl

Summary: If you use a ShakeDetector, you can specify the minimum number of shakes required to trigger a shake handler.  Otherwise, the minimum number of required shakes is set to 1 by default.

Reviewed By: achen1

Differential Revision: D5155604

fbshipit-source-id: 5073fa37d4c223eb18e85b5e850b95d37136e3d2
This commit is contained in:
Summer Kitahara
2017-06-05 21:25:09 -07:00
committed by Facebook Github Bot
parent 9e026ec358
commit aeccbd6906
5 changed files with 92 additions and 39 deletions
@@ -150,6 +150,7 @@ public class ReactInstanceManager {
private final boolean mLazyViewManagersEnabled;
private final boolean mSetupReactContextInBackgroundEnabled;
private final boolean mUseSeparateUIBackgroundThread;
private final int mMinNumShakes;
private final ReactInstanceDevCommandsHandler mDevInterface =
new ReactInstanceDevCommandsHandler() {
@@ -222,7 +223,8 @@ public class ReactInstanceManager {
boolean lazyNativeModulesEnabled,
boolean lazyViewManagersEnabled,
boolean setupReactContextInBackgroundEnabled,
boolean useSeparateUIBackgroundThread) {
boolean useSeparateUIBackgroundThread,
int minNumShakes) {
initializeSoLoaderIfNecessary(applicationContext);
@@ -240,7 +242,8 @@ public class ReactInstanceManager {
mDevInterface,
mJSMainModuleName,
useDeveloperSupport,
redBoxHandler);
redBoxHandler,
minNumShakes);
mBridgeIdleDebugListener = bridgeIdleDebugListener;
mLifecycleState = initialLifecycleState;
mUIImplementationProvider = uiImplementationProvider;
@@ -251,6 +254,7 @@ public class ReactInstanceManager {
mLazyViewManagersEnabled = lazyViewManagersEnabled;
mSetupReactContextInBackgroundEnabled = setupReactContextInBackgroundEnabled;
mUseSeparateUIBackgroundThread = useSeparateUIBackgroundThread;
mMinNumShakes = minNumShakes;
// Instantiate ReactChoreographer in UI thread.
ReactChoreographer.initialize();
@@ -685,6 +689,10 @@ public class ReactInstanceManager {
return mLifecycleState;
}
public int getMinNumShakes() {
return mMinNumShakes;
}
@ThreadConfined(UI)
private void onReloadWithJSDebugger(JavaJSExecutor.Factory jsExecutorFactory) {
synchronized (mAttachedRootViews) {