Java Code Examples for com.facebook.common.logging.FLog#w()
The following examples show how to use
com.facebook.common.logging.FLog#w() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CatalystInstanceImpl.java From react-native-GPay with MIT License | 6 votes |
public void callFunction(PendingJSCall function) { if (mDestroyed) { final String call = function.toString(); FLog.w(ReactConstants.TAG, "Calling JS function after bridge has been destroyed: " + call); return; } if (!mAcceptCalls) { // Most of the time the instance is initialized and we don't need to acquire the lock synchronized (mJSCallsPendingInitLock) { if (!mAcceptCalls) { mJSCallsPendingInit.add(function); return; } } } function.call(this); }
Example 2
Source File: JSTouchDispatcher.java From react-native-GPay with MIT License | 6 votes |
private void dispatchCancelEvent(MotionEvent androidEvent, EventDispatcher eventDispatcher) { // This means the gesture has already ended, via some other CANCEL or UP event. This is not // expected to happen very often as it would mean some child View has decided to intercept the // touch stream and start a native gesture only upon receiving the UP/CANCEL event. if (mTargetTag == -1) { FLog.w( ReactConstants.TAG, "Can't cancel already finished gesture. Is a child View trying to start a gesture from " + "an UP/CANCEL event?"); return; } Assertions.assertCondition( !mChildIsHandlingNativeGesture, "Expected to not have already sent a cancel for this gesture"); Assertions.assertNotNull(eventDispatcher).dispatchEvent( TouchEvent.obtain( mTargetTag, TouchEventType.CANCEL, androidEvent, mGestureStartTime, mTargetCoordinates[0], mTargetCoordinates[1], mTouchEventCoalescingKeyHelper)); }
Example 3
Source File: BufferedDiskCache.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 6 votes |
/** * Writes to disk cache * @throws IOException */ private void writeToDiskCache( final CacheKey key, final PooledByteBuffer buffer) { FLog.v(TAG, "About to write to disk-cache for key %s", key.toString()); try { mFileCache.insert( key, new WriterCallback() { @Override public void write(OutputStream os) throws IOException { mPooledByteStreams.copy(buffer.getStream(), os); } } ); FLog.v(TAG, "Successful disk-cache write for key %s", key.toString()); } catch (IOException ioe) { // Log failure // TODO: 3697790 FLog.w(TAG, ioe, "Failed to write to disk-cache for key %s", key.toString()); } }
Example 4
Source File: ReactDrawerLayoutManager_1d0b39_t.java From coming with MIT License | 6 votes |
@Override public void setElevation(ReactDrawerLayout view, float elevation) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // Facebook is using an older version of the support lib internally that doesn't support // setDrawerElevation so we invoke it using reflection. // TODO: Call the method directly when this is no longer needed. try { Method method = ReactDrawerLayout.class.getMethod("setDrawerElevation", float.class); method.invoke(view, PixelUtil.toPixelFromDIP(elevation)); } catch (Exception ex) { FLog.w( ReactConstants.TAG, "setDrawerElevation is not available in this version of the support lib.", ex); } } }
Example 5
Source File: PackagerConnectionSettings.java From react-native-GPay with MIT License | 6 votes |
public String getDebugServerHost() { // Check host setting first. If empty try to detect emulator type and use default // hostname for those String hostFromSettings = mPreferences.getString(PREFS_DEBUG_SERVER_HOST_KEY, null); if (!TextUtils.isEmpty(hostFromSettings)) { return Assertions.assertNotNull(hostFromSettings); } String host = AndroidInfoHelpers.getServerHost(); if (host.equals(AndroidInfoHelpers.DEVICE_LOCALHOST)) { FLog.w( TAG, "You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' " + "to forward the debug server's port to the device."); } return host; }
Example 6
Source File: BufferedDiskCache.java From fresco with MIT License | 6 votes |
/** * Writes to disk cache * * @throws IOException */ private void writeToDiskCache(final CacheKey key, final EncodedImage encodedImage) { FLog.v(TAG, "About to write to disk-cache for key %s", key.getUriString()); try { mFileCache.insert( key, new WriterCallback() { @Override public void write(OutputStream os) throws IOException { mPooledByteStreams.copy(encodedImage.getInputStream(), os); } }); mImageCacheStatsTracker.onDiskCachePut(key); FLog.v(TAG, "Successful disk-cache write for key %s", key.getUriString()); } catch (IOException ioe) { // Log failure // TODO: 3697790 FLog.w(TAG, ioe, "Failed to write to disk-cache for key %s", key.getUriString()); } }
Example 7
Source File: FabricUIManager.java From react-native-GPay with MIT License | 6 votes |
/** * Updates the root view size and re-render the RN surface. * * //TODO: change synchronization to integrate with new #render loop. */ private synchronized void updateRootSize(int rootTag, int newWidth, int newHeight) { ReactShadowNode rootNode = getRootNode(rootTag); if (rootNode == null) { FLog.w( ReactConstants.TAG, "Tried to update size of non-existent tag: " + rootTag); return; } ReactShadowNode newRootNode = rootNode.mutableCopy(rootNode.getInstanceHandle()); int newWidthSpec = View.MeasureSpec.makeMeasureSpec(newWidth, View.MeasureSpec.EXACTLY); int newHeightSpec = View.MeasureSpec.makeMeasureSpec(newHeight, View.MeasureSpec.EXACTLY); updateRootView(newRootNode, newWidthSpec, newHeightSpec); completeRoot(rootTag, newRootNode.getChildrenList()); }
Example 8
Source File: StagingArea.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 6 votes |
/** * @param key * @return value associated with given key or null if no value is associated */ public synchronized CloseableReference<PooledByteBuffer> get(final CacheKey key) { Preconditions.checkNotNull(key); CloseableReference<PooledByteBuffer> storedRef = mMap.get(key); if (storedRef != null) { synchronized (storedRef) { if (!CloseableReference.isValid(storedRef)) { // Reference is not valid, this means that someone cleared reference while it was still in // use. Log error // TODO: 3697790 mMap.remove(key); FLog.w( TAG, "Found closed reference %d for key %s (%d)", System.identityHashCode(storedRef), key.toString(), System.identityHashCode(key)); return null; } storedRef = storedRef.clone(); } } return storedRef; }
Example 9
Source File: ReflectUtils.java From react-native-text-gradient with MIT License | 6 votes |
@SuppressWarnings({"unchecked", "SameParameterValue"}) static <T> T invokeMethod(Object target, String name, @Nullable Class type) { type = type == null ? target.getClass() : type; try { Method method = type.getDeclaredMethod(name); method.setAccessible(true); return (T) method.invoke(target); } catch (Exception e) { FLog.w(ReactConstants.TAG, "Can't invoke " + type.getName() + " method " + name); FLog.w(ReactConstants.TAG, e.getMessage()); } return null; }
Example 10
Source File: FrescoModule.java From react-native-GPay with MIT License | 6 votes |
@Override public void initialize() { super.initialize(); getReactApplicationContext().addLifecycleEventListener(this); if (!hasBeenInitialized()) { if (mConfig == null) { mConfig = getDefaultConfig(getReactApplicationContext()); } Context context = getReactApplicationContext().getApplicationContext(); Fresco.initialize(context, mConfig); sHasBeenInitialized = true; } else if (mConfig != null) { FLog.w( ReactConstants.TAG, "Fresco has already been initialized with a different config. " + "The new Fresco configuration will be ignored!"); } mConfig = null; }
Example 11
Source File: DialogModule.java From react-native-GPay with MIT License | 5 votes |
@Override public void onHostResume() { mIsInForeground = true; // Check if a dialog has been created while the host was paused, so that we can show it now. FragmentManagerHelper fragmentManagerHelper = getFragmentManagerHelper(); if (fragmentManagerHelper != null) { fragmentManagerHelper.showPendingAlert(); } else { FLog.w(DialogModule.class, "onHostResume called but no FragmentManager found"); } }
Example 12
Source File: ReactRootView.java From react-native-GPay with MIT License | 5 votes |
@Override public boolean dispatchKeyEvent(KeyEvent ev) { if (mReactInstanceManager == null || !mIsAttachedToInstance || mReactInstanceManager.getCurrentReactContext() == null) { FLog.w( ReactConstants.TAG, "Unable to handle key event as the catalyst instance has not been attached"); return super.dispatchKeyEvent(ev); } mAndroidHWInputDeviceHelper.handleKeyEvent(ev); return super.dispatchKeyEvent(ev); }
Example 13
Source File: VitoView.java From fresco with MIT License | 5 votes |
public static void init(Implementation implementation) { if (sIsInitialized) { FLog.w(TAG, "VitoView has already been initialized!"); return; } else { sIsInitialized = true; } sImplementation = implementation; }
Example 14
Source File: BufferedDiskCache.java From fresco with MIT License | 5 votes |
/** Performs disk cache read. In case of any exception null is returned. */ private @Nullable PooledByteBuffer readFromDiskCache(final CacheKey key) throws IOException { try { FLog.v(TAG, "Disk cache read for %s", key.getUriString()); final BinaryResource diskCacheResource = mFileCache.getResource(key); if (diskCacheResource == null) { FLog.v(TAG, "Disk cache miss for %s", key.getUriString()); mImageCacheStatsTracker.onDiskCacheMiss(key); return null; } else { FLog.v(TAG, "Found entry in disk cache for %s", key.getUriString()); mImageCacheStatsTracker.onDiskCacheHit(key); } PooledByteBuffer byteBuffer; final InputStream is = diskCacheResource.openStream(); try { byteBuffer = mPooledByteBufferFactory.newByteBuffer(is, (int) diskCacheResource.size()); } finally { is.close(); } FLog.v(TAG, "Successful read from disk cache for %s", key.getUriString()); return byteBuffer; } catch (IOException ioe) { // TODO: 3697790 log failures // TODO: 5258772 - uncomment line below // mFileCache.remove(key); FLog.w(TAG, ioe, "Exception reading from cache for %s", key.getUriString()); mImageCacheStatsTracker.onDiskCacheGetFail(key); throw ioe; } }
Example 15
Source File: FabricUIManager.java From react-native-GPay with MIT License | 5 votes |
@Override @DoNotStrip public synchronized void updateRootLayoutSpecs(int rootViewTag, int widthMeasureSpec, int heightMeasureSpec) { ReactShadowNode rootNode = getRootNode(rootViewTag); if (rootNode == null) { FLog.w(ReactConstants.TAG, "Tried to update non-existent root tag: " + rootViewTag); return; } ReactShadowNode newRootNode = rootNode.mutableCopy(rootNode.getInstanceHandle()); updateRootView(newRootNode, widthMeasureSpec, heightMeasureSpec); mRootShadowNodeRegistry.replaceNode(newRootNode); }
Example 16
Source File: ImagePipelineFactory.java From fresco with MIT License | 5 votes |
/** Initializes {@link ImagePipelineFactory} with the specified config. */ public static synchronized void initialize( ImagePipelineConfig imagePipelineConfig, boolean forceSinglePipelineInstance) { if (sInstance != null) { FLog.w( TAG, "ImagePipelineFactory has already been initialized! `ImagePipelineFactory.initialize(...)` should only be called once to avoid unexpected behavior."); } sForceSinglePipelineInstance = forceSinglePipelineInstance; sInstance = new ImagePipelineFactory(imagePipelineConfig); }
Example 17
Source File: RNPromptModule.java From react-native-prompt-android with MIT License | 5 votes |
@Override public void onHostResume() { mIsInForeground = true; // Check if a dialog has been created while the host was paused, so that we can show it now. FragmentManagerHelper fragmentManagerHelper = getFragmentManagerHelper(); if (fragmentManagerHelper != null) { fragmentManagerHelper.showPendingAlert(); } else { FLog.w(DialogModule.class, "onHostResume called but no FragmentManager found"); } }
Example 18
Source File: ImageFilter.java From react-native-image-filter-kit with MIT License | 5 votes |
private void handleError( final @Nonnull Throwable error, final @Nullable Functor.Arity1<Integer> retry, final int retries ) { FLog.w(ReactConstants.TAG, "ImageFilterKit: " + error.toString()); MemoryTrimmer trimmer = MemoryTrimmer.getInstance(); if ( error instanceof TooManyBitmapsException && trimmer.isUsed() && retries < mClearCachesMaxRetries ) { FLog.d(ReactConstants.TAG, "ImageFilterKit: clearing caches ..."); trimmer.trim(); Fresco.getImagePipeline().clearCaches(); Task.delay(1, mFiltering.getToken()).continueWith(task -> { if (retry != null) { retry.call(retries + 1); } return null; }, UiThreadImmediateExecutorService.getInstance(), mFiltering.getToken()); } else { sendJSEvent(ImageFilterEvent.ON_FILTERING_ERROR, error.toString()); } }
Example 19
Source File: ReactRootView.java From react-native-GPay with MIT License | 5 votes |
@Override protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) { if (mReactInstanceManager == null || !mIsAttachedToInstance || mReactInstanceManager.getCurrentReactContext() == null) { FLog.w( ReactConstants.TAG, "Unable to handle focus changed event as the catalyst instance has not been attached"); super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); return; } mAndroidHWInputDeviceHelper.clearFocus(); super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); }
Example 20
Source File: RNPromptModule.java From react-native-prompt-android with MIT License | 4 votes |
@ReactMethod public void promptWithArgs(ReadableMap options, final Callback callback) { final FragmentManagerHelper fragmentManagerHelper = getFragmentManagerHelper(); if (fragmentManagerHelper == null) { FLog.w(RNPromptModule.class, "Tried to show an alert while not attached to an Activity"); return; } final Bundle args = new Bundle(); if (options.hasKey(KEY_TITLE)) { args.putString(RNPromptFragment.ARG_TITLE, options.getString(KEY_TITLE)); } if (options.hasKey(KEY_MESSAGE)) { String message = options.getString(KEY_MESSAGE); if (!message.isEmpty()) { args.putString(RNPromptFragment.ARG_MESSAGE, options.getString(KEY_MESSAGE)); } } if (options.hasKey(KEY_BUTTON_POSITIVE)) { args.putString(RNPromptFragment.ARG_BUTTON_POSITIVE, options.getString(KEY_BUTTON_POSITIVE)); } if (options.hasKey(KEY_BUTTON_NEGATIVE)) { args.putString(RNPromptFragment.ARG_BUTTON_NEGATIVE, options.getString(KEY_BUTTON_NEGATIVE)); } if (options.hasKey(KEY_BUTTON_NEUTRAL)) { args.putString(RNPromptFragment.ARG_BUTTON_NEUTRAL, options.getString(KEY_BUTTON_NEUTRAL)); } if (options.hasKey(KEY_ITEMS)) { ReadableArray items = options.getArray(KEY_ITEMS); CharSequence[] itemsArray = new CharSequence[items.size()]; for (int i = 0; i < items.size(); i++) { itemsArray[i] = items.getString(i); } args.putCharSequenceArray(RNPromptFragment.ARG_ITEMS, itemsArray); } if (options.hasKey(KEY_CANCELABLE)) { args.putBoolean(KEY_CANCELABLE, options.getBoolean(KEY_CANCELABLE)); } if (options.hasKey(KEY_TYPE)) { args.putString(KEY_TYPE, options.getString(KEY_TYPE)); } if (options.hasKey(KEY_STYLE)) { args.putString(KEY_STYLE, options.getString(KEY_STYLE)); } if (options.hasKey(KEY_DEFAULT_VALUE)) { args.putString(KEY_DEFAULT_VALUE, options.getString(KEY_DEFAULT_VALUE)); } if (options.hasKey(KEY_PLACEHOLDER)) { args.putString(KEY_PLACEHOLDER, options.getString(KEY_PLACEHOLDER)); } fragmentManagerHelper.showNewAlert(mIsInForeground, args, callback); }