code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
void dispatchSync(DispatchQueue networkQueue) {
long requestStartTime = System.currentTimeMillis();
try {
sendRequestSync();
} catch (NetworkUnavailableException e) {
responseCode = -1; // indicates failure
errorMessage = e.getMessage();
ApptentiveLog.w(NETWORK, e.getMessage());
ApptentiveLog.w(NE... | java |
public void setRequestProperty(String key, Object value) {
if (value != null) {
if (requestProperties == null) {
requestProperties = new HashMap<>();
}
requestProperties.put(key, value);
}
} | java |
public boolean getWhoCardRequestEnabled() {
InteractionConfiguration configuration = getConfiguration();
if (configuration == null) {
return false;
}
JSONObject profile = configuration.optJSONObject(KEY_PROFILE);
return profile.optBoolean(KEY_PROFILE_REQUEST, true);
} | java |
public MessageCenterStatus getRegularStatus() {
InteractionConfiguration configuration = getConfiguration();
if (configuration == null) {
return null;
}
JSONObject status = configuration.optJSONObject(KEY_STATUS);
if (status == null) {
return null;
}
String statusBody = status.optString(KEY_STATUS_B... | java |
public static boolean createScaledDownImageCacheFile(String sourcePath, String cachedFileName) {
File localFile = new File(cachedFileName);
// Retrieve image orientation
int imageOrientation = 0;
try {
ExifInterface exif = new ExifInterface(sourcePath);
imageOrientation = exif.getAttributeInt(ExifInterfa... | java |
public static synchronized boolean updateAdvertisingIdClientInfo(Context context) {
ApptentiveLog.v(ADVERTISER_ID, "Updating advertiser ID client info...");
AdvertisingIdClientInfo clientInfo = resolveAdvertisingIdClientInfo(context);
if (clientInfo != null && clientInfo.equals(cachedClientInfo)) {
return fals... | java |
synchronized boolean sendPayload(final PayloadData payload) {
if (payload == null) {
throw new IllegalArgumentException("Payload is null");
}
// we don't allow concurrent payload sending
if (isSendingPayload()) {
return false;
}
// we mark the sender as "busy" so no other payloads would be sent unti... | java |
private synchronized void handleFinishSendingPayload(PayloadData payload, boolean cancelled, String errorMessage, int responseCode, JSONObject responseData) {
sendingFlag = false; // mark sender as 'not busy'
try {
if (listener != null) {
listener.onFinishSending(this, payload, cancelled, errorMessage, resp... | java |
public CommerceExtendedData addItem(Item item) throws JSONException {
if (this.items == null) {
this.items = new ArrayList<>();
}
items.add(item);
return this;
} | java |
public void displayNewIncomingMessageItem(ApptentiveMessage message) {
messagingActionHandler.sendEmptyMessage(MSG_REMOVE_STATUS);
// Determine where to insert the new incoming message. It will be in front of any eidting
// area, i.e. composing, Who Card ...
int insertIndex = listItems.size(); // If inserted on... | java |
public void clearImageAttachmentBand() {
attachments.setVisibility(View.GONE);
images.clear();
attachments.setData(null);
} | java |
public void addImagesToImageAttachmentBand(final List<ImageItem> imagesToAttach) {
if (imagesToAttach == null || imagesToAttach.size() == 0) {
return;
}
attachments.setupLayoutListener();
attachments.setVisibility(View.VISIBLE);
images.addAll(imagesToAttach);
setAttachButtonState();
addAdditionalAttach... | java |
public void removeImageFromImageAttachmentBand(final int position) {
images.remove(position);
attachments.setupLayoutListener();
setAttachButtonState();
if (images.size() == 0) {
// Hide attachment band after last attachment is removed
attachments.setVisibility(View.GONE);
return;
}
addAdditionalAt... | java |
@Override
public long getRetryTimeoutMillis(int retryAttempt) {
long temp = Math.min(MAX_RETRY_CAP, (long) (retryTimeoutMillis * Math.pow(2.0, retryAttempt - 1)));
return (long) ((temp / 2) * (1.0 + RANDOM.nextDouble()));
} | java |
@Override
public boolean evaluate(FieldManager fieldManager, IndentPrinter printer) {
Comparable fieldValue = fieldManager.getValue(fieldName);
for (ConditionalTest test : conditionalTests) {
boolean result = test.operator.apply(fieldValue, test.parameter);
printer.print("- %s => %b", test.operator.descripti... | java |
@Override
public Serializable put(String key, Serializable value) {
Serializable ret = super.put(key, value);
notifyDataChanged();
return ret;
} | java |
public static synchronized Apptentive.DateTime getTimeAtInstall(Selector selector) {
ensureLoaded();
for (VersionHistoryEntry entry : versionHistoryEntries) {
switch (selector) {
case total:
// Since the list is ordered, this will be the first and oldest entry.
return new Apptentive.DateTime(entry.... | java |
public static synchronized boolean isUpdate(Selector selector) {
ensureLoaded();
Set<String> uniques = new HashSet<String>();
for (VersionHistoryEntry entry : versionHistoryEntries) {
switch (selector) {
case version_name:
uniques.add(entry.getVersionName());
break;
case version_code:
un... | java |
public static JSONArray getBaseArray() {
ensureLoaded();
JSONArray baseArray = new JSONArray();
for (VersionHistoryEntry entry : versionHistoryEntries) {
baseArray.put(entry);
}
return baseArray;
} | java |
public static void addCustomDeviceData(final String key, final String value) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
conversation.getDevice().getCustomData().put(key, trim(value));
return true;
}
}, "add custom dev... | java |
public static void removeCustomDeviceData(final String key) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
conversation.getDevice().getCustomData().remove(key);
return true;
}
}, "remove custom device data");
} | java |
public static void addCustomPersonData(final String key, final String value) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
conversation.getPerson().getCustomData().put(key, trim(value));
return true;
}
}, "add custom per... | java |
public static void removeCustomPersonData(final String key) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
conversation.getPerson().getCustomData().remove(key);
return true;
}
}, "remove custom person data");
} | java |
public static boolean isApptentivePushNotification(Intent intent) {
try {
if (!ApptentiveInternal.checkRegistered()) {
return false;
}
return ApptentiveInternal.getApptentivePushNotificationData(intent) != null;
} catch (Exception e) {
ApptentiveLog.e(PUSH, e, "Exception while checking for Apptentiv... | java |
public static boolean isApptentivePushNotification(Bundle bundle) {
try {
if (!ApptentiveInternal.checkRegistered()) {
return false;
}
return ApptentiveInternal.getApptentivePushNotificationData(bundle) != null;
} catch (Exception e) {
ApptentiveLog.e(PUSH, e, "Exception while checking for Apptentiv... | java |
public static boolean isApptentivePushNotification(Map<String, String> data) {
try {
if (!ApptentiveInternal.checkRegistered()) {
return false;
}
return ApptentiveInternal.getApptentivePushNotificationData(data) != null;
} catch (Exception e) {
ApptentiveLog.e(PUSH, e, "Exception while checking for ... | java |
public static void setRatingProvider(IRatingProvider ratingProvider) {
try {
if (ApptentiveInternal.isApptentiveRegistered()) {
ApptentiveInternal.getInstance().setRatingProvider(ratingProvider);
}
} catch (Exception e) {
ApptentiveLog.e(CONVERSATION, e, "Exception while setting rating provider");
l... | java |
public static void showMessageCenter(final Context context, final BooleanCallback callback, final Map<String, Object> customData) {
dispatchConversationTask(new ConversationDispatchTask(callback, DispatchQueue.mainQueue()) {
@Override
protected boolean execute(Conversation conversation) {
return ApptentiveI... | java |
public static void canShowMessageCenter(BooleanCallback callback) {
dispatchConversationTask(new ConversationDispatchTask(callback, DispatchQueue.mainQueue()) {
@Override
protected boolean execute(Conversation conversation) {
return ApptentiveInternal.canShowMessageCenterInternal(conversation);
}
}, "c... | java |
public static void addUnreadMessagesListener(final UnreadMessagesListener listener) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
conversation.getMessageManager().addHostUnreadMessagesListener(listener);
return true;
}
}... | java |
public static int getUnreadMessageCount() {
try {
if (ApptentiveInternal.isApptentiveRegistered()) {
ConversationProxy conversationProxy = ApptentiveInternal.getInstance().getConversationProxy();
return conversationProxy != null ? conversationProxy.getUnreadMessageCount() : 0;
}
} catch (Exception e) ... | java |
public static void sendAttachmentText(final String text) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
CompoundMessage message = new CompoundMessage();
message.setBody(text);
message.setRead(true);
message.setHidden(t... | java |
public static synchronized void engage(Context context, String event, BooleanCallback callback) {
engage(context, event, callback, null, (ExtendedData[]) null);
} | java |
public static synchronized void engage(final Context context, final String event, final BooleanCallback callback, final Map<String, Object> customData, final ExtendedData... extendedData) {
if (context == null) {
throw new IllegalArgumentException("Context is null");
}
if (StringUtils.isNullOrEmpty(event)) {
... | java |
public static void login(final String token, final LoginCallback callback) {
if (StringUtils.isNullOrEmpty(token)) {
throw new IllegalArgumentException("Token is null or empty");
}
dispatchOnConversationQueue(new DispatchTask() {
@Override
protected void execute() {
try {
loginGuarded(token, ca... | java |
public static <T> String join(List<T> list, String separator) {
StringBuilder builder = new StringBuilder();
int i = 0;
for (T t : list) {
builder.append(t);
if (++i < list.size()) builder.append(separator);
}
return builder.toString();
} | java |
public static String trim(String str) {
return str != null && str.length() > 0 ? str.trim() : str;
} | java |
public static String asJson(String key, Object value) {
try {
JSONObject json = new JSONObject();
json.put(key, value);
return json.toString();
} catch (Exception e) {
ApptentiveLog.e(e, "Exception while creating json-string { %s:%s }", key, value);
return null;
}
} | java |
public static byte[] hexToBytes(String hex) {
int length = hex.length();
byte[] ret = new byte[length / 2];
for (int i = 0; i < length; i += 2) {
ret[i / 2] = (byte) ((Character.digit(hex.charAt(i), 16) << 4) + Character.digit(hex.charAt(i + 1), 16));
}
return ret;
} | java |
void dispatchRequest(final HttpRequest request) {
networkQueue.dispatchAsync(new DispatchTask() {
@Override
protected void execute() {
request.dispatchSync(networkQueue);
}
});
} | java |
public synchronized void cancelAll() {
if (activeRequests.size() > 0) {
List<HttpRequest> temp = new ArrayList<>(activeRequests);
for (HttpRequest request : temp) {
request.cancel();
}
}
notifyCancelledAllRequests();
} | java |
synchronized void unregisterRequest(HttpRequest request) {
assertTrue(this == request.requestManager);
boolean removed = activeRequests.remove(request);
assertTrue(removed, "Attempted to unregister missing request: %s", request);
if (removed) {
notifyRequestFinished(request);
}
} | java |
public HttpJsonRequest createConversationTokenRequest(ConversationTokenRequest conversationTokenRequest, HttpRequest.Listener<HttpJsonRequest> listener) {
HttpJsonRequest request = createJsonRequest(ENDPOINT_CONVERSATION, conversationTokenRequest, HttpRequestMethod.POST);
request.addListener(listener);
return req... | java |
public boolean validateAndUpdateState() {
boolean validationPassed = true;
List<Fragment> fragments = getRetainedChildFragmentManager().getFragments();
for (Fragment fragment : fragments) {
SurveyQuestionView surveyQuestionView = (SurveyQuestionView) fragment;
answers.put(surveyQuestionView.getQuestionId()... | java |
private void exitActivity(ApptentiveViewExitType exitType) {
try {
exitActivityGuarded(exitType);
} catch (Exception e) {
ApptentiveLog.e(e, "Exception while trying to exit activity (type=%s)", exitType);
logException(e);
}
} | java |
public static void startSession(final Context context, final String appKey, final String appSignature) {
dispatchOnConversationQueue(new DispatchTask() {
@Override
protected void execute() {
try {
startSessionGuarded(context, appKey, appSignature);
} catch (Exception e) {
ApptentiveLog.e(TROUB... | java |
private static @Nullable String readAccessTokenFromClipboard(Context context) {
String text = Util.getClipboardText(context);
if (StringUtils.isNullOrEmpty(text)) {
return null;
}
//Since the token string should never contain spaces, attempt to repair line breaks introduced in the copying process.
text =... | java |
private static HttpRequest createTokenVerificationRequest(String apptentiveAppKey, String apptentiveAppSignature, String token, HttpRequest.Listener<HttpJsonRequest> listener) {
// TODO: move this logic to ApptentiveHttpClient
String URL = Constants.CONFIG_DEFAULT_SERVER_URL + "/debug_token/verify";
HttpRequest r... | java |
public boolean clickOn(int index) {
ImageItem item = getItem(index);
if (item == null || TextUtils.isEmpty(item.mimeType)) {
return false;
}
// For non-image items, the first tap will start it downloading
if (!Util.isMimeTypeImage(item.mimeType)) {
// It is being downloaded, do nothing (prevent double t... | java |
public void select(ImageItem image) {
if (selectedImages.contains(image)) {
selectedImages.remove(image);
} else {
selectedImages.add(image);
}
notifyDataSetChanged();
} | java |
public void setDefaultSelected(ArrayList<String> resultList) {
for (String uri : resultList) {
ImageItem image = getImageByUri(uri);
if (image != null) {
selectedImages.add(image);
}
}
if (selectedImages.size() > 0) {
notifyDataSetChanged();
}
} | java |
public void setData(List<ImageItem> images) {
selectedImages.clear();
if (images != null && images.size() > 0) {
this.images = images;
} else {
this.images.clear();
}
notifyDataSetChanged();
} | java |
public void setItemSize(int columnWidth, int columnHeight) {
if (itemWidth == columnWidth) {
return;
}
itemWidth = columnWidth;
itemHeight = columnHeight;
itemLayoutParams = new GridView.LayoutParams(itemWidth, itemHeight);
notifyDataSetChanged();
} | java |
public static void sendError(final Throwable throwable, final String description, final String extraData) {
if (!isConversationQueue()) {
dispatchOnConversationQueue(new DispatchTask() {
@Override
protected void execute() {
sendError(throwable, description, extraData);
}
});
return;
}
E... | java |
public static Integer parseWebColorAsAndroidColor(String input) {
// Swap if input is #RRGGBBAA, but not if it is #RRGGBB
Boolean swapAlpha = (input.length() == 9);
try {
Integer ret = Color.parseColor(input);
if (swapAlpha) {
ret = (ret >>> 8) | ((ret & 0x000000FF) << 24);
}
return ret;
} catch... | java |
public static Drawable getCompatDrawable(Context c, int drawableRes) {
Drawable d = null;
try {
d = ContextCompat.getDrawable(c, drawableRes);
} catch (Exception ex) {
logException(ex);
}
return d;
} | java |
public static StateListDrawable getSelectableImageButtonBackground(int selected_color) {
ColorDrawable selectedColor = new ColorDrawable(selected_color);
StateListDrawable states = new StateListDrawable();
states.addState(new int[]{android.R.attr.state_pressed}, selectedColor);
states.addState(new int[]{android... | java |
public static boolean openFileAttachment(final Context context, final String sourcePath, final String selectedFilePath, final String mimeTypeString) {
if ((Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
|| !Environment.isExternalStorageRemovable())
&& hasPermission(context, Manifest.p... | java |
public static int copyFile(String from, String to) {
InputStream inStream = null;
FileOutputStream fs = null;
try {
int bytesum = 0;
int byteread;
File oldfile = new File(from);
if (oldfile.exists()) {
inStream = new FileInputStream(from);
fs = new FileOutputStream(to);
byte[] buffer = new... | java |
public static StoredFile createLocalStoredFile(String sourceUrl, String localFilePath, String mimeType) {
InputStream is = null;
try {
Context context = ApptentiveInternal.getInstance().getApplicationContext();
if (URLUtil.isContentUrl(sourceUrl) && context != null) {
Uri uri = Uri.parse(sourceUrl);
i... | java |
public static StoredFile createLocalStoredFile(InputStream is, String sourceUrl, String localFilePath, String mimeType) {
if (is == null) {
return null;
}
// Copy the file contents over.
CountingOutputStream cos = null;
BufferedOutputStream bos = null;
FileOutputStream fos = null;
try {
File localF... | java |
public static Resources.Theme buildApptentiveInteractionTheme(Context context) {
Resources.Theme theme = context.getResources().newTheme();
// 1. Start by basing this on the Apptentive theme.
theme.applyStyle(R.style.ApptentiveTheme_Base_Versioned, true);
// 2. Get the theme from the host app. Overwrite what ... | java |
public static File getInternalDir(Context context, String path, boolean createIfNecessary) {
File filesDir = context.getFilesDir();
File internalDir = new File(filesDir, path);
if (!internalDir.exists() && createIfNecessary) {
boolean succeed = internalDir.mkdirs();
if (!succeed) {
ApptentiveLog.w(UTIL,... | java |
public static String getManifestMetadataString(Context context, String key) {
if (context == null) {
throw new IllegalArgumentException("Context is null");
}
if (key == null) {
throw new IllegalArgumentException("Key is null");
}
try {
String appPackageName = context.getPackageName();
PackageMan... | java |
public static @Nullable View.OnClickListener guarded(@Nullable final View.OnClickListener listener) {
if (listener != null) {
return new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
listener.onClick(v);
} catch (Exception e) {
ApptentiveLog.e(e, "Exception wh... | java |
public static void assertMainThread() {
if (imp != null && !DispatchQueue.isMainQueue()) {
imp.assertFailed(StringUtils.format("Expected 'main' thread but was '%s'", Thread.currentThread().getName()));
}
} | java |
public static void assertFail(String format, Object... args) {
assertFail(StringUtils.format(format, args));
} | java |
public T getValue() {
try {
value = parse(originalParameter);
} catch (InvalidParameterException e) {
throw new WebApplicationException(onError(e));
}
return value;
} | java |
public static Builder builder() {
return new AutoValue_BeadledomClientConfiguration.Builder()
.connectionPoolSize(DEFAULT_CONNECTION_POOL_SIZE)
.maxPooledPerRouteSize(DEFAULT_MAX_POOLED_PER_ROUTE)
.socketTimeoutMillis(DEFAULT_SOCKET_TIMEOUT_MILLIS)
.connectionTimeoutMillis(DEFAULT_CO... | java |
private Object invokeInTransactionAndUnitOfWork(MethodInvocation methodInvocation)
throws Throwable {
boolean unitOfWorkAlreadyStarted = unitOfWork.isActive();
if (!unitOfWorkAlreadyStarted) {
unitOfWork.begin();
}
Throwable originalThrowable = null;
try {
return dslContextProvide... | java |
private void endUnitOfWork(Throwable originalThrowable) throws Throwable {
try {
unitOfWork.end();
} catch (Throwable t) {
if (originalThrowable != null) {
throw originalThrowable;
} else {
throw t;
}
}
} | java |
public Integer getLimit() {
String limitFromRequest =
uriInfo.getQueryParameters().getFirst(LimitParameter.getDefaultLimitFieldName());
return limitFromRequest != null ? new LimitParameter(limitFromRequest).getValue()
: LimitParameter.getDefaultLimit();
} | java |
public Long getOffset() {
String offsetFromRequest =
uriInfo.getQueryParameters().getFirst(OffsetParameter.getDefaultOffsetFieldName());
return offsetFromRequest != null ? new OffsetParameter(offsetFromRequest).getValue()
: OffsetParameter.getDefaultOffset();
} | java |
private void checkLimitRange(int limit) {
int minLimit = offsetPaginationConfiguration.allowZeroLimit() ? 0 : 1;
if (limit < minLimit || limit > offsetPaginationConfiguration.maxLimit()) {
throw InvalidParameterException.create(
"Invalid value for '" + this.getParameterFieldName() + "': " + lim... | java |
@Override
public String getSignature() {
String signature = super.getSignature();
if (signature.indexOf('(') == -1) {
return signature;
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Condensing signature [{}]", signature);
}
int returnTypeSpace = signature.indexOf(" ");
Str... | java |
public GenericResponseBuilder<T> errorEntity(Object errorEntity, Annotation[] annotations) {
if (body != null) {
throw new IllegalStateException(
"entity already set. Only one of entity and errorEntity may be set");
}
rawBuilder.entity(errorEntity, annotations);
hasErrorEntity = true;
... | java |
public GenericResponseBuilder<T> header(String name, Object value) {
rawBuilder.header(name, value);
return this;
} | java |
public GenericResponseBuilder<T> replaceAll(MultivaluedMap<String, Object> headers) {
rawBuilder.replaceAll(headers);
return this;
} | java |
public GenericResponseBuilder<T> link(URI uri, String rel) {
rawBuilder.link(uri, rel);
return this;
} | java |
public static HealthStatus create(int status, String message, Throwable exception) {
return new AutoValue_HealthStatus(message, status, Optional.ofNullable(exception));
} | java |
public static BuildInfo create(Properties properties) {
checkNotNull(properties, "properties: null");
return builder()
.setArtifactId(
checkNotNull(properties.getProperty("project.artifactId"), "project.artifactId: null"))
.setGroupId(
checkNotNull(properties.getProperty(... | java |
public HealthDto doPrimaryHealthCheck() {
List<HealthDependency> primaryHealthDependencies = healthDependencies.values().stream()
.filter(HealthDependency::isPrimary)
.collect(Collectors.toList());
return checkHealth(primaryHealthDependencies);
} | java |
public List<HealthDependencyDto> doDependencyListing() {
List<HealthDependencyDto> listing = Lists.newArrayList();
for (HealthDependency dependency : healthDependencies.values()) {
listing.add(dependencyDtoBuilder(dependency).build());
}
return listing;
} | java |
public HealthDependencyDto doDependencyAvailabilityCheck(String name) {
HealthDependency dependency = healthDependencies.get(checkNotNull(name));
if (dependency == null) {
throw new WebApplicationException(Response.status(404).build());
}
return checkDependencyHealth(dependency);
} | java |
public static void checkParam(boolean expression, Object errorMessage) {
if (!expression) {
Response response = Response.status(Response.Status.BAD_REQUEST)
.type(MediaType.TEXT_PLAIN)
.build();
throw new WebApplicationException(String.valueOf(errorMessage), response);
}
} | java |
private boolean isExcludedBinding(Key<?> key) {
Class<?> rawType = key.getTypeLiteral().getRawType();
for (Class<?> excludedClass : excludedBindings) {
if (excludedClass.isAssignableFrom(rawType)) {
return true;
}
}
return false;
} | java |
protected void addField(String field) {
if (field.contains("/")) {
// Splits the field into, at most, 2 strings - "prefix" / "suffix" - since we guarantee the
// field contains a / this will ALWAYS have a length of 2.
String[] fields = field.split("/", 2);
String prefix = fields[0];
//... | java |
public void writeJson(JsonParser parser, JsonGenerator jgen) throws IOException {
checkNotNull(parser, "JsonParser cannot be null for writeJson.");
checkNotNull(jgen, "JsonGenerator cannot be null for writeJson.");
JsonToken curToken = parser.nextToken();
while (curToken != null) {
curToken = proc... | java |
private void processValue(JsonToken valueToken, JsonParser parser, JsonGenerator jgen)
throws IOException {
if (valueToken.isBoolean()) {
jgen.writeBoolean(parser.getBooleanValue());
} else if (valueToken.isNumeric()) {
if (parser.getNumberType() == JsonParser.NumberType.INT) {
jgen.wr... | java |
String lastLink() {
if (totalResults == null || currentLimit == 0L) {
return null;
}
Long lastOffset;
if (totalResults % currentLimit == 0L) {
lastOffset = totalResults - currentLimit;
} else {
// Truncation due to integral division gives floor-like behavior for free.
lastOf... | java |
String prevLink() {
if (currentOffset == 0 || currentLimit == 0) {
return null;
}
return urlWithUpdatedPagination(Math.max(0, currentOffset - currentLimit), currentLimit);
} | java |
public void resizeFBO(int fboWidth, int fboHeight) {
if (lightMap != null) {
lightMap.dispose();
}
lightMap = new LightMap(this, fboWidth, fboHeight);
} | java |
public void setCombinedMatrix(OrthographicCamera camera) {
this.setCombinedMatrix(
camera.combined,
camera.position.x,
camera.position.y,
camera.viewportWidth * camera.zoom,
camera.viewportHeight * camera.zoom);
} | java |
public void prepareRender() {
lightRenderedLastFrame = 0;
Gdx.gl.glDepthMask(false);
Gdx.gl.glEnable(GL20.GL_BLEND);
simpleBlendFunc.apply();
boolean useLightMap = (shadows || blur);
if (useLightMap) {
lightMap.frameBuffer.begin();
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
Gdx.gl.glClear(GL20.GL_COLOR... | java |
public boolean pointAtLight(float x, float y) {
for (Light light : lightList) {
if (light.contains(x, y)) return true;
}
return false;
} | java |
public void dispose() {
removeAll();
if (lightMap != null) lightMap.dispose();
if (lightShader != null) lightShader.dispose();
} | java |
public void removeAll() {
for (Light light : lightList) {
light.dispose();
}
lightList.clear();
for (Light light : disabledLights) {
light.dispose();
}
disabledLights.clear();
} | java |
public void setAmbientLight(float r, float g, float b, float a) {
this.ambientLight.set(r, g, b, a);
} | java |
@Override
public void setDistance(float dist) {
dist *= RayHandler.gammaCorrectionParameter;
this.distance = dist < 0.01f ? 0.01f : dist;
dirty = true;
} | java |
public void add(RayHandler rayHandler) {
this.rayHandler = rayHandler;
if (active) {
rayHandler.lightList.add(this);
} else {
rayHandler.disabledLights.add(this);
}
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.