com.facebook.Settings Java Examples

The following examples show how to use com.facebook.Settings. 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: Logger.java    From facebook-api-android-maven with Apache License 2.0 5 votes vote down vote up
public static void log(LoggingBehavior behavior, int priority, String tag, String string) {
    if (Settings.isLoggingBehaviorEnabled(behavior)) {
        string = replaceStrings(string);
        if (tag.startsWith(LOG_TAG_BASE) == false) {
            tag = LOG_TAG_BASE + tag;
        }
        Log.println(priority, tag, string);

        // Developer errors warrant special treatment by printing out a stack trace, to make both more noticeable,
        // and let the source of the problem be more easily pinpointed.
        if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
            (new Exception()).printStackTrace();
        }
    }
}
 
Example #2
Source File: Logger.java    From HypFacebook with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void log(LoggingBehavior behavior, int priority, String tag, String string) {
    if (Settings.isLoggingBehaviorEnabled(behavior)) {
        string = replaceStrings(string);
        if (tag.startsWith(LOG_TAG_BASE) == false) {
            tag = LOG_TAG_BASE + tag;
        }
        Log.println(priority, tag, string);

        // Developer errors warrant special treatment by printing out a stack trace, to make both more noticeable,
        // and let the source of the problem be more easily pinpointed.
        if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
            (new Exception()).printStackTrace();
        }
    }
}
 
Example #3
Source File: FileLruCache.java    From platform-friends-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void clearCache() {
    // get the current directory listing of files to delete
    final File[] filesToDelete = directory.listFiles(BufferFile.excludeBufferFiles());
    lastClearCacheTime.set(System.currentTimeMillis());
    if (filesToDelete != null) {
        Settings.getExecutor().execute(new Runnable() {
            @Override
            public void run() {
                for (File file : filesToDelete) {
                    file.delete();
                }
            }
        });
    }
}
 
Example #4
Source File: Logger.java    From Klyph with MIT License 5 votes vote down vote up
public static void log(LoggingBehavior behavior, int priority, String tag, String string) {
    if (Settings.isLoggingBehaviorEnabled(behavior)) {
        string = replaceStrings(string);
        if (tag.startsWith(LOG_TAG_BASE) == false) {
            tag = LOG_TAG_BASE + tag;
        }
        Log.println(priority, tag, string);

        // Developer errors warrant special treatment by printing out a stack trace, to make both more noticeable,
        // and let the source of the problem be more easily pinpointed.
        if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
            (new Exception()).printStackTrace();
        }
    }
}
 
Example #5
Source File: FileLruCache.java    From platform-friends-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void postTrim() {
    synchronized (lock) {
        if (!isTrimPending) {
            isTrimPending = true;
            Settings.getExecutor().execute(new Runnable() {
                @Override
                public void run() {
                    trim();
                }
            });
        }
    }
}
 
Example #6
Source File: FileLruCache.java    From Klyph with MIT License 5 votes vote down vote up
public void clearCache() {
    // get the current directory listing of files to delete
    final File[] filesToDelete = directory.listFiles(BufferFile.excludeBufferFiles());
    lastClearCacheTime.set(System.currentTimeMillis());
    if (filesToDelete != null) {
        Settings.getExecutor().execute(new Runnable() {
            @Override
            public void run() {
                for (File file : filesToDelete) {
                    file.delete();
                }
            }
        });
    }
}
 
Example #7
Source File: Logger.java    From KlyphMessenger with MIT License 5 votes vote down vote up
public static void log(LoggingBehavior behavior, int priority, String tag, String string) {
    if (Settings.isLoggingBehaviorEnabled(behavior)) {
        string = replaceStrings(string);
        if (tag.startsWith(LOG_TAG_BASE) == false) {
            tag = LOG_TAG_BASE + tag;
        }
        Log.println(priority, tag, string);

        // Developer errors warrant special treatment by printing out a stack trace, to make both more noticeable,
        // and let the source of the problem be more easily pinpointed.
        if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
            (new Exception()).printStackTrace();
        }
    }
}
 
Example #8
Source File: Logger.java    From platform-friends-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void log(LoggingBehavior behavior, int priority, String tag, String string) {
    if (Settings.isLoggingBehaviorEnabled(behavior)) {
        string = replaceStrings(string);
        if (tag.startsWith(LOG_TAG_BASE) == false) {
            tag = LOG_TAG_BASE + tag;
        }
        Log.println(priority, tag, string);

        // Developer errors warrant special treatment by printing out a stack trace, to make both more noticeable,
        // and let the source of the problem be more easily pinpointed.
        if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
            (new Exception()).printStackTrace();
        }
    }
}
 
Example #9
Source File: FileLruCache.java    From KlyphMessenger with MIT License 5 votes vote down vote up
public void clearCache() {
    // get the current directory listing of files to delete
    final File[] filesToDelete = directory.listFiles(BufferFile.excludeBufferFiles());
    lastClearCacheTime.set(System.currentTimeMillis());
    if (filesToDelete != null) {
        Settings.getExecutor().execute(new Runnable() {
            @Override
            public void run() {
                for (File file : filesToDelete) {
                    file.delete();
                }
            }
        });
    }
}
 
Example #10
Source File: FileLruCache.java    From facebook-api-android-maven with Apache License 2.0 5 votes vote down vote up
public void clearCache() {
    // get the current directory listing of files to delete
    final File[] filesToDelete = directory.listFiles(BufferFile.excludeBufferFiles());
    lastClearCacheTime.set(System.currentTimeMillis());
    if (filesToDelete != null) {
        Settings.getExecutor().execute(new Runnable() {
            @Override
            public void run() {
                for (File file : filesToDelete) {
                    file.delete();
                }
            }
        });
    }
}
 
Example #11
Source File: FileLruCache.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
public void clearCache() {
    // get the current directory listing of files to delete
    final File[] filesToDelete = directory.listFiles(BufferFile.excludeBufferFiles());
    lastClearCacheTime.set(System.currentTimeMillis());
    if (filesToDelete != null) {
        Settings.getExecutor().execute(new Runnable() {
            @Override
            public void run() {
                for (File file : filesToDelete) {
                    file.delete();
                }
            }
        });
    }
}
 
Example #12
Source File: FileLruCache.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
public void clearCache() {
    // get the current directory listing of files to delete
    final File[] filesToDelete = directory.listFiles(BufferFile.excludeBufferFiles());
    lastClearCacheTime.set(System.currentTimeMillis());
    if (filesToDelete != null) {
        Settings.getExecutor().execute(new Runnable() {
            @Override
            public void run() {
                for (File file : filesToDelete) {
                    file.delete();
                }
            }
        });
    }
}
 
Example #13
Source File: Logger.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
public static void log(LoggingBehavior behavior, int priority, String tag, String string) {
    if (Settings.isLoggingBehaviorEnabled(behavior)) {
        string = replaceStrings(string);
        if (tag.startsWith(LOG_TAG_BASE) == false) {
            tag = LOG_TAG_BASE + tag;
        }
        Log.println(priority, tag, string);

        // Developer errors warrant special treatment by printing out a stack trace, to make both more noticeable,
        // and let the source of the problem be more easily pinpointed.
        if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
            (new Exception()).printStackTrace();
        }
    }
}
 
Example #14
Source File: NativeProtocol.java    From facebook-api-android-maven with Apache License 2.0 5 votes vote down vote up
public static Intent createProxyAuthIntent(Context context, String applicationId, List<String> permissions,
        String e2e, boolean isRerequest, SessionDefaultAudience defaultAudience) {
    for (NativeAppInfo appInfo : facebookAppInfoList) {
        Intent intent = new Intent()
                .setClassName(appInfo.getPackage(), FACEBOOK_PROXY_AUTH_ACTIVITY)
                .putExtra(FACEBOOK_PROXY_AUTH_APP_ID_KEY, applicationId);

        if (!Utility.isNullOrEmpty(permissions)) {
            intent.putExtra(FACEBOOK_PROXY_AUTH_PERMISSIONS_KEY, TextUtils.join(",", permissions));
        }
        if (!Utility.isNullOrEmpty(e2e)) {
            intent.putExtra(FACEBOOK_PROXY_AUTH_E2E_KEY, e2e);
        }

        intent.putExtra(ServerProtocol.DIALOG_PARAM_RESPONSE_TYPE, ServerProtocol.DIALOG_RESPONSE_TYPE_TOKEN);
        intent.putExtra(ServerProtocol.DIALOG_PARAM_RETURN_SCOPES, ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
        intent.putExtra(ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, defaultAudience.getNativeProtocolAudience());

        if (!Settings.getPlatformCompatibilityEnabled()) {
            // Override the API Version for Auth
            intent.putExtra(ServerProtocol.DIALOG_PARAM_LEGACY_OVERRIDE, ServerProtocol.GRAPH_API_VERSION);

            // Only set the rerequest auth type for non legacy requests
            if (isRerequest) {
                intent.putExtra(ServerProtocol.DIALOG_PARAM_AUTH_TYPE, ServerProtocol.DIALOG_REREQUEST_AUTH_TYPE);
            }
        }

        intent = validateActivityIntent(context, intent, appInfo);

        if (intent != null) {
            return intent;
        }
    }
    return null;
}
 
Example #15
Source File: Logger.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
public static void log(LoggingBehavior behavior, int priority, String tag, String string) {
    if (Settings.isLoggingBehaviorEnabled(behavior)) {
        string = replaceStrings(string);
        if (tag.startsWith(LOG_TAG_BASE) == false) {
            tag = LOG_TAG_BASE + tag;
        }
        Log.println(priority, tag, string);

        // Developer errors warrant special treatment by printing out a stack trace, to make both more noticeable,
        // and let the source of the problem be more easily pinpointed.
        if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
            (new Exception()).printStackTrace();
        }
    }
}
 
Example #16
Source File: Logger.java    From android-skeleton-project with MIT License 5 votes vote down vote up
public static void log(LoggingBehavior behavior, int priority, String tag, String string) {
    if (Settings.isLoggingBehaviorEnabled(behavior)) {
        string = replaceStrings(string);
        if (tag.startsWith(LOG_TAG_BASE) == false) {
            tag = LOG_TAG_BASE + tag;
        }
        Log.println(priority, tag, string);

        // Developer errors warrant special treatment by printing out a stack trace, to make both more noticeable,
        // and let the source of the problem be more easily pinpointed.
        if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
            (new Exception()).printStackTrace();
        }
    }
}
 
Example #17
Source File: Logger.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 5 votes vote down vote up
public static void log(LoggingBehavior behavior, int priority, String tag, String string) {
    if (Settings.isLoggingBehaviorEnabled(behavior)) {
        string = replaceStrings(string);
        if (tag.startsWith(LOG_TAG_BASE) == false) {
            tag = LOG_TAG_BASE + tag;
        }
        Log.println(priority, tag, string);

        // Developer errors warrant special treatment by printing out a stack trace, to make both more noticeable,
        // and let the source of the problem be more easily pinpointed.
        if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
            (new Exception()).printStackTrace();
        }
    }
}
 
Example #18
Source File: FileLruCache.java    From HypFacebook with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void postTrim() {
    synchronized (lock) {
        if (!isTrimPending) {
            isTrimPending = true;
            Settings.getExecutor().execute(new Runnable() {
                @Override
                public void run() {
                    trim();
                }
            });
        }
    }
}
 
Example #19
Source File: FileLruCache.java    From facebook-api-android-maven with Apache License 2.0 5 votes vote down vote up
private void postTrim() {
    synchronized (lock) {
        if (!isTrimPending) {
            isTrimPending = true;
            Settings.getExecutor().execute(new Runnable() {
                @Override
                public void run() {
                    trim();
                }
            });
        }
    }
}
 
Example #20
Source File: Logger.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
public static void log(LoggingBehavior behavior, int priority, String tag, String string) {
    if (Settings.isLoggingBehaviorEnabled(behavior)) {
        string = replaceStrings(string);
        if (tag.startsWith(LOG_TAG_BASE) == false) {
            tag = LOG_TAG_BASE + tag;
        }
        Log.println(priority, tag, string);

        // Developer errors warrant special treatment by printing out a stack trace, to make both more noticeable,
        // and let the source of the problem be more easily pinpointed.
        if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
            (new Exception()).printStackTrace();
        }
    }
}
 
Example #21
Source File: FileLruCache.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
private void postTrim() {
    synchronized (lock) {
        if (!isTrimPending) {
            isTrimPending = true;
            Settings.getExecutor().execute(new Runnable() {
                @Override
                public void run() {
                    trim();
                }
            });
        }
    }
}
 
Example #22
Source File: FileLruCache.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
public void clearCache() {
    // get the current directory listing of files to delete
    final File[] filesToDelete = directory.listFiles(BufferFile.excludeBufferFiles());
    lastClearCacheTime.set(System.currentTimeMillis());
    if (filesToDelete != null) {
        Settings.getExecutor().execute(new Runnable() {
            @Override
            public void run() {
                for (File file : filesToDelete) {
                    file.delete();
                }
            }
        });
    }
}
 
Example #23
Source File: Logger.java    From KlyphMessenger with MIT License 4 votes vote down vote up
private boolean shouldLog() {
    return Settings.isLoggingBehaviorEnabled(behavior);
}
 
Example #24
Source File: WorkQueue.java    From facebook-api-android-maven with Apache License 2.0 4 votes vote down vote up
WorkQueue(int maxConcurrent) {
    this(maxConcurrent, Settings.getExecutor());
}
 
Example #25
Source File: WorkQueue.java    From FacebookImageShareIntent with MIT License 4 votes vote down vote up
WorkQueue(int maxConcurrent) {
    this(maxConcurrent, Settings.getExecutor());
}
 
Example #26
Source File: ServerProtocol.java    From FacebookImageShareIntent with MIT License 4 votes vote down vote up
public static final String getAPIVersion() {
    if (Settings.getPlatformCompatibilityEnabled()) {
        return LEGACY_API_VERSION;
    }
    return GRAPH_API_VERSION;
}
 
Example #27
Source File: Logger.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 4 votes vote down vote up
public synchronized static void registerAccessToken(String accessToken) {
    if (Settings.isLoggingBehaviorEnabled(LoggingBehavior.INCLUDE_ACCESS_TOKENS) == false) {
        registerStringToReplace(accessToken, "ACCESS_TOKEN_REMOVED");
    }
}
 
Example #28
Source File: Logger.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 4 votes vote down vote up
public static void log(LoggingBehavior behavior, String tag, String format, Object... args) {
    if (Settings.isLoggingBehaviorEnabled(behavior)) {
        String string = String.format(format, args);
        log(behavior, Log.DEBUG, tag, string);
    }
}
 
Example #29
Source File: Logger.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 4 votes vote down vote up
private boolean shouldLog() {
    return Settings.isLoggingBehaviorEnabled(behavior);
}
 
Example #30
Source File: ServerProtocol.java    From FacebookImageShareIntent with MIT License 4 votes vote down vote up
public static final String getGraphVideoUrlBase() {
    return String.format(GRAPH_VIDEO_URL_FORMAT, Settings.getFacebookDomain());
}