本文整理匯總了Java中com.facebook.common.logging.FLog類的典型用法代碼示例。如果您正苦於以下問題:Java FLog類的具體用法?Java FLog怎麽用?Java FLog使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FLog類屬於com.facebook.common.logging包,在下文中一共展示了FLog類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleException
import com.facebook.common.logging.FLog; //導入依賴的package包/類
@Override
public void handleException(Exception e) {
if (mIsDevSupportEnabled) {
if (e instanceof JSException) {
FLog.e(ReactConstants.TAG, "Exception in native call from JS", e);
// TODO #11638796: convert the stack into something useful
showNewError(
e.getMessage() + "\n\n" + ((JSException) e).getStack(),
new StackFrame[] {},
JSEXCEPTION_ERROR_COOKIE,
ErrorType.JS);
} else {
showNewJavaError(e.getMessage(), e);
}
} else {
mDefaultNativeModuleCallExceptionHandler.handleException(e);
}
}
示例2: renderFrameAndCache
import com.facebook.common.logging.FLog; //導入依賴的package包/類
private boolean renderFrameAndCache(
int frameNumber,
CloseableReference<Bitmap> bitmapReference,
@BitmapAnimationBackend.FrameType int frameType) {
// Check if the bitmap is valid
if (!CloseableReference.isValid(bitmapReference)) {
return false;
}
// Try to render the frame
if (!mBitmapFrameRenderer.renderFrame(frameNumber, bitmapReference.get())) {
return false;
}
FLog.v(TAG, "Frame %d ready.", mFrameNumber);
// Cache the frame
synchronized (mPendingFrameDecodeJobs) {
mBitmapFrameCache.onFramePrepared(mFrameNumber, bitmapReference, frameType);
}
return true;
}
示例3: onCreate
import com.facebook.common.logging.FLog; //導入依賴的package包/類
protected void onCreate(Bundle savedInstanceState) {
boolean needsOverlayPermission = false;
if (getReactNativeHost().getUseDeveloperSupport() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// Get permission to show redbox in dev builds.
if (!Settings.canDrawOverlays(getContext())) {
needsOverlayPermission = true;
Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getContext().getPackageName()));
FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE);
Toast.makeText(getContext(), REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show();
((Activity) getContext()).startActivityForResult(serviceIntent, REQUEST_OVERLAY_PERMISSION_CODE);
}
}
if (mMainComponentName != null && !needsOverlayPermission) {
loadApp(mMainComponentName);
}
mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
}
示例4: initialize
import com.facebook.common.logging.FLog; //導入依賴的package包/類
@Override
public void initialize() {
super.initialize();
getReactApplicationContext().addLifecycleEventListener(this);
if (!hasBeenInitialized()) {
// Make sure the SoLoaderShim is configured to use our loader for native libraries.
// This code can be removed if using Fresco from Maven rather than from source
SoLoaderShim.setHandler(new FrescoHandler());
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;
}
示例5: removeLiveReference
import com.facebook.common.logging.FLog; //導入依賴的package包/類
/**
* Decreases the reference count of live object from the static map. Removes it if it's reference
* count has become 0.
*
* @param value the value to remove.
*/
private static void removeLiveReference(Object value) {
synchronized (sLiveObjects) {
Integer count = sLiveObjects.get(value);
if (count == null) {
// Uh oh.
FLog.wtf(
"SharedReference",
"No entry in sLiveObjects for value of type %s",
value.getClass());
} else if (count == 1) {
sLiveObjects.remove(value);
} else {
sLiveObjects.put(value, count - 1);
}
}
}
示例6: clear
import com.facebook.common.logging.FLog; //導入依賴的package包/類
/**
* Clears the database.
*/
@ReactMethod
public void clear(final Callback callback) {
new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
@Override
protected void doInBackgroundGuarded(Void... params) {
if (!mReactDatabaseSupplier.ensureDatabase()) {
callback.invoke(AsyncStorageErrorUtil.getDBError(null));
return;
}
try {
mReactDatabaseSupplier.clear();
callback.invoke();
} catch (Exception e) {
FLog.w(ReactConstants.TAG, e.getMessage(), e);
callback.invoke(AsyncStorageErrorUtil.getError(null, e.getMessage()));
}
}
}.execute();
}
示例7: run
import com.facebook.common.logging.FLog; //導入依賴的package包/類
@Override
public void run() {
try {
Runnable runnable = mWorkQueue.poll();
if (runnable != null) {
runnable.run();
} else {
// It is possible that a new worker was started before a previously started worker
// de-queued its work item.
FLog.v(TAG, "%s: Worker has nothing to run", mName);
}
} finally {
int workers = mPendingWorkers.decrementAndGet();
if (!mWorkQueue.isEmpty()) {
startWorkerIfNeeded();
} else {
FLog.v(TAG, "%s: worker finished; %d workers left", mName, workers);
}
}
}
示例8: getTrimRatio
import com.facebook.common.logging.FLog; //導入依賴的package包/類
@Override
public double getTrimRatio(MemoryTrimType trimType) {
switch (trimType) {
case OnCloseToDalvikHeapLimit:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return MemoryTrimType.OnCloseToDalvikHeapLimit.getSuggestedTrimRatio();
} else {
// On pre-lollipop versions we keep bitmaps on the native heap, so no need to trim here
// as it wouldn't help Dalvik heap anyway.
return 0;
}
case OnAppBackgrounded:
case OnSystemLowMemoryWhileAppInForeground:
case OnSystemLowMemoryWhileAppInBackground:
return 1;
default:
FLog.wtf(TAG, "unknown trim type: %s", trimType);
return 0;
}
}
示例9: resolveRootTagFromReactTag
import com.facebook.common.logging.FLog; //導入依賴的package包/類
public int resolveRootTagFromReactTag(int reactTag) {
if (mShadowNodeRegistry.isRootNode(reactTag)) {
return reactTag;
}
ReactShadowNode node = resolveShadowNode(reactTag);
int rootTag = 0;
if (node != null) {
rootTag = node.getRootNode().getReactTag();
} else {
FLog.w(
ReactConstants.TAG,
"Warning : attempted to resolve a non-existent react shadow node. reactTag=" + reactTag);
}
return rootTag;
}
示例10: parse
import com.facebook.common.logging.FLog; //導入依賴的package包/類
/**
* Parse a DebugServerException from the server json string.
* @param str json string returned by the debug server
* @return A DebugServerException or null if the string is not of proper form.
*/
@Nullable public static DebugServerException parse(String str) {
if (TextUtils.isEmpty(str)) {
return null;
}
try {
JSONObject jsonObject = new JSONObject(str);
String fullFileName = jsonObject.getString("filename");
return new DebugServerException(
jsonObject.getString("description"),
shortenFileName(fullFileName),
jsonObject.getInt("lineNumber"),
jsonObject.getInt("column"));
} catch (JSONException e) {
// I'm not sure how strict this format is for returned errors, or what other errors there can
// be, so this may end up being spammy. Can remove it later if necessary.
FLog.w(ReactConstants.TAG, "Could not parse DebugServerException from: " + str, e);
return null;
}
}
示例11: updateShadowNodeProp
import com.facebook.common.logging.FLog; //導入依賴的package包/類
public void updateShadowNodeProp(
ReactShadowNode nodeToUpdate,
ReactStylesDiffMap props) {
try {
if (mIndex == null) {
SHADOW_ARGS[0] = extractProperty(props);
mSetter.invoke(nodeToUpdate, SHADOW_ARGS);
Arrays.fill(SHADOW_ARGS, null);
} else {
SHADOW_GROUP_ARGS[0] = mIndex;
SHADOW_GROUP_ARGS[1] = extractProperty(props);
mSetter.invoke(nodeToUpdate, SHADOW_GROUP_ARGS);
Arrays.fill(SHADOW_GROUP_ARGS, null);
}
} catch (Throwable t) {
FLog.e(ViewManager.class, "Error while updating prop " + mPropName, t);
throw new JSApplicationIllegalArgumentException("Error while updating property '" +
mPropName + "' in shadow node of type: " + nodeToUpdate.getViewClass(), t);
}
}
示例12: reconnect
import com.facebook.common.logging.FLog; //導入依賴的package包/類
private void reconnect() {
if (mClosed) {
throw new IllegalStateException("Can't reconnect closed client");
}
if (!mSuppressConnectionErrors) {
FLog.w(TAG, "Couldn't connect to \"" + mUrl + "\", will silently retry");
mSuppressConnectionErrors = true;
}
mHandler.postDelayed(
new Runnable() {
@Override
public void run() {
delayedReconnect();
}
},
RECONNECT_DELAY_MS);
}
示例13: setStyle
import com.facebook.common.logging.FLog; //導入依賴的package包/類
@ReactMethod
public void setStyle(final String style) {
final Activity activity = getCurrentActivity();
if (activity == null) {
FLog.w(ReactConstants.TAG, "StatusBarModule: Ignored status bar change, current activity is null.");
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
UiThreadUtil.runOnUiThread(
new Runnable() {
@TargetApi(Build.VERSION_CODES.M)
@Override
public void run() {
View decorView = activity.getWindow().getDecorView();
decorView.setSystemUiVisibility(
style.equals("dark-content") ? View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : 0);
}
}
);
}
}
示例14: getDebugServerHost
import com.facebook.common.logging.FLog; //導入依賴的package包/類
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;
}
示例15: shouldOverrideUrlLoading
import com.facebook.common.logging.FLog; //導入依賴的package包/類
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith("http://") || url.startsWith("https://") ||
url.startsWith("file://")) {
return false;
} else {
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
view.getContext().startActivity(intent);
} catch (ActivityNotFoundException e) {
FLog.w(ReactConstants.TAG, "activity not found to handle uri scheme for: " + url, e);
}
return true;
}
}