repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequest.java
HttpRequest.dispatchSync
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
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...
[ "void", "dispatchSync", "(", "DispatchQueue", "networkQueue", ")", "{", "long", "requestStartTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "try", "{", "sendRequestSync", "(", ")", ";", "}", "catch", "(", "NetworkUnavailableException", "e", ")", ...
Send request synchronously on a background network queue
[ "Send", "request", "synchronously", "on", "a", "background", "network", "queue" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequest.java#L231-L270
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequest.java
HttpRequest.setRequestProperty
public void setRequestProperty(String key, Object value) { if (value != null) { if (requestProperties == null) { requestProperties = new HashMap<>(); } requestProperties.put(key, value); } }
java
public void setRequestProperty(String key, Object value) { if (value != null) { if (requestProperties == null) { requestProperties = new HashMap<>(); } requestProperties.put(key, value); } }
[ "public", "void", "setRequestProperty", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "requestProperties", "==", "null", ")", "{", "requestProperties", "=", "new", "HashMap", "<>", "(", ")"...
Sets HTTP request property
[ "Sets", "HTTP", "request", "property" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequest.java#L479-L486
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/model/MessageCenterInteraction.java
MessageCenterInteraction.getWhoCardRequestEnabled
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 boolean getWhoCardRequestEnabled() { InteractionConfiguration configuration = getConfiguration(); if (configuration == null) { return false; } JSONObject profile = configuration.optJSONObject(KEY_PROFILE); return profile.optBoolean(KEY_PROFILE_REQUEST, true); }
[ "public", "boolean", "getWhoCardRequestEnabled", "(", ")", "{", "InteractionConfiguration", "configuration", "=", "getConfiguration", "(", ")", ";", "if", "(", "configuration", "==", "null", ")", "{", "return", "false", ";", "}", "JSONObject", "profile", "=", "c...
When enabled, display Who Card to request profile info
[ "When", "enabled", "display", "Who", "Card", "to", "request", "profile", "info" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/model/MessageCenterInteraction.java#L130-L137
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/model/MessageCenterInteraction.java
MessageCenterInteraction.getRegularStatus
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 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...
[ "public", "MessageCenterStatus", "getRegularStatus", "(", ")", "{", "InteractionConfiguration", "configuration", "=", "getConfiguration", "(", ")", ";", "if", "(", "configuration", "==", "null", ")", "{", "return", "null", ";", "}", "JSONObject", "status", "=", ...
Regular status shows customer's hours, expected time until response
[ "Regular", "status", "shows", "customer", "s", "hours", "expected", "time", "until", "response" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/model/MessageCenterInteraction.java#L217-L231
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageUtil.java
ImageUtil.createScaledDownImageCacheFile
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 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...
[ "public", "static", "boolean", "createScaledDownImageCacheFile", "(", "String", "sourcePath", ",", "String", "cachedFileName", ")", "{", "File", "localFile", "=", "new", "File", "(", "cachedFileName", ")", ";", "// Retrieve image orientation", "int", "imageOrientation",...
This method creates a cached version of the original image, and compresses it in the process so it doesn't fill up the disk. Therefore, do not use it to store an exact copy of the file in question. @param sourcePath can be full file path or content uri string @param cachedFileName file name of the cache to be crea...
[ "This", "method", "creates", "a", "cached", "version", "of", "the", "original", "image", "and", "compresses", "it", "in", "the", "process", "so", "it", "doesn", "t", "fill", "up", "the", "disk", ".", "Therefore", "do", "not", "use", "it", "to", "store", ...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageUtil.java#L270-L307
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/AdvertiserManager.java
AdvertiserManager.updateAdvertisingIdClientInfo
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
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...
[ "public", "static", "synchronized", "boolean", "updateAdvertisingIdClientInfo", "(", "Context", "context", ")", "{", "ApptentiveLog", ".", "v", "(", "ADVERTISER_ID", ",", "\"Updating advertiser ID client info...\"", ")", ";", "AdvertisingIdClientInfo", "clientInfo", "=", ...
Returns true if changed
[ "Returns", "true", "if", "changed" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/AdvertiserManager.java#L36-L47
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/storage/PayloadSender.java
PayloadSender.sendPayload
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
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...
[ "synchronized", "boolean", "sendPayload", "(", "final", "PayloadData", "payload", ")", "{", "if", "(", "payload", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Payload is null\"", ")", ";", "}", "// we don't allow concurrent payload sendi...
Sends payload asynchronously. Returns boolean flag immediately indicating if payload send was scheduled @throws IllegalArgumentException is payload is null
[ "Sends", "payload", "asynchronously", ".", "Returns", "boolean", "flag", "immediately", "indicating", "if", "payload", "send", "was", "scheduled" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/storage/PayloadSender.java#L67-L98
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/storage/PayloadSender.java
PayloadSender.handleFinishSendingPayload
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
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...
[ "private", "synchronized", "void", "handleFinishSendingPayload", "(", "PayloadData", "payload", ",", "boolean", "cancelled", ",", "String", "errorMessage", ",", "int", "responseCode", ",", "JSONObject", "responseData", ")", "{", "sendingFlag", "=", "false", ";", "//...
Executed when we're done with the current payload @param payload - current payload @param cancelled - flag indicating if payload Http-request was cancelled @param errorMessage - if not <code>null</code> - payload request failed @param responseCode - http-request response code @param responseData - http-reqeust ...
[ "Executed", "when", "we", "re", "done", "with", "the", "current", "payload" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/storage/PayloadSender.java#L156-L167
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/model/CommerceExtendedData.java
CommerceExtendedData.addItem
public CommerceExtendedData addItem(Item item) throws JSONException { if (this.items == null) { this.items = new ArrayList<>(); } items.add(item); return this; }
java
public CommerceExtendedData addItem(Item item) throws JSONException { if (this.items == null) { this.items = new ArrayList<>(); } items.add(item); return this; }
[ "public", "CommerceExtendedData", "addItem", "(", "Item", "item", ")", "throws", "JSONException", "{", "if", "(", "this", ".", "items", "==", "null", ")", "{", "this", ".", "items", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "items", ".", "add"...
Add information about a purchased item to this record. Calls to this method can be chained. @param item A {@link CommerceExtendedData.Item} @return This object. @throws JSONException if item can't be added.
[ "Add", "information", "about", "a", "purchased", "item", "to", "this", "record", ".", "Calls", "to", "this", "method", "can", "be", "chained", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/model/CommerceExtendedData.java#L106-L112
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/MessageCenterFragment.java
MessageCenterFragment.displayNewIncomingMessageItem
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 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...
[ "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", "// ar...
Call only from handler.
[ "Call", "only", "from", "handler", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/MessageCenterFragment.java#L694-L731
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/messagecenter/view/holder/MessageComposerHolder.java
MessageComposerHolder.clearImageAttachmentBand
public void clearImageAttachmentBand() { attachments.setVisibility(View.GONE); images.clear(); attachments.setData(null); }
java
public void clearImageAttachmentBand() { attachments.setVisibility(View.GONE); images.clear(); attachments.setData(null); }
[ "public", "void", "clearImageAttachmentBand", "(", ")", "{", "attachments", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "images", ".", "clear", "(", ")", ";", "attachments", ".", "setData", "(", "null", ")", ";", "}" ]
Remove all images from attachment band.
[ "Remove", "all", "images", "from", "attachment", "band", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/messagecenter/view/holder/MessageComposerHolder.java#L184-L188
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/messagecenter/view/holder/MessageComposerHolder.java
MessageComposerHolder.addImagesToImageAttachmentBand
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 addImagesToImageAttachmentBand(final List<ImageItem> imagesToAttach) { if (imagesToAttach == null || imagesToAttach.size() == 0) { return; } attachments.setupLayoutListener(); attachments.setVisibility(View.VISIBLE); images.addAll(imagesToAttach); setAttachButtonState(); addAdditionalAttach...
[ "public", "void", "addImagesToImageAttachmentBand", "(", "final", "List", "<", "ImageItem", ">", "imagesToAttach", ")", "{", "if", "(", "imagesToAttach", "==", "null", "||", "imagesToAttach", ".", "size", "(", ")", "==", "0", ")", "{", "return", ";", "}", ...
Add new images to attachment band. @param imagesToAttach an array of new images to add
[ "Add", "new", "images", "to", "attachment", "band", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/messagecenter/view/holder/MessageComposerHolder.java#L195-L205
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/messagecenter/view/holder/MessageComposerHolder.java
MessageComposerHolder.removeImageFromImageAttachmentBand
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
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...
[ "public", "void", "removeImageFromImageAttachmentBand", "(", "final", "int", "position", ")", "{", "images", ".", "remove", "(", "position", ")", ";", "attachments", ".", "setupLayoutListener", "(", ")", ";", "setAttachButtonState", "(", ")", ";", "if", "(", "...
Remove an image from attachment band. @param position the postion index of the image to be removed
[ "Remove", "an", "image", "from", "attachment", "band", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/messagecenter/view/holder/MessageComposerHolder.java#L212-L222
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequestRetryPolicyDefault.java
HttpRequestRetryPolicyDefault.getRetryTimeoutMillis
@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 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())); }
[ "@", "Override", "public", "long", "getRetryTimeoutMillis", "(", "int", "retryAttempt", ")", "{", "long", "temp", "=", "Math", ".", "min", "(", "MAX_RETRY_CAP", ",", "(", "long", ")", "(", "retryTimeoutMillis", "*", "Math", ".", "pow", "(", "2.0", ",", "...
Returns the delay in millis for the next retry @param retryAttempt - number of retries attempted already
[ "Returns", "the", "delay", "in", "millis", "for", "the", "next", "retry" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequestRetryPolicyDefault.java#L57-L61
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/logic/ConditionalClause.java
ConditionalClause.evaluate
@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 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...
[ "@", "Override", "public", "boolean", "evaluate", "(", "FieldManager", "fieldManager", ",", "IndentPrinter", "printer", ")", "{", "Comparable", "fieldValue", "=", "fieldManager", ".", "getValue", "(", "fieldName", ")", ";", "for", "(", "ConditionalTest", "test", ...
The test in this conditional clause are implicitly ANDed together, so return false if any of them is false, and continue the loop for each test that is true; @return
[ "The", "test", "in", "this", "conditional", "clause", "are", "implicitly", "ANDed", "together", "so", "return", "false", "if", "any", "of", "them", "is", "false", "and", "continue", "the", "loop", "for", "each", "test", "that", "is", "true", ";" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/logic/ConditionalClause.java#L66-L77
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/storage/CustomData.java
CustomData.put
@Override public Serializable put(String key, Serializable value) { Serializable ret = super.put(key, value); notifyDataChanged(); return ret; }
java
@Override public Serializable put(String key, Serializable value) { Serializable ret = super.put(key, value); notifyDataChanged(); return ret; }
[ "@", "Override", "public", "Serializable", "put", "(", "String", "key", ",", "Serializable", "value", ")", "{", "Serializable", "ret", "=", "super", ".", "put", "(", "key", ",", "value", ")", ";", "notifyDataChanged", "(", ")", ";", "return", "ret", ";",...
region Saving when modified
[ "region", "Saving", "when", "modified" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/storage/CustomData.java#L43-L48
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/migration/v4_0_0/VersionHistoryStore.java
VersionHistoryStore.getTimeAtInstall
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 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....
[ "public", "static", "synchronized", "Apptentive", ".", "DateTime", "getTimeAtInstall", "(", "Selector", "selector", ")", "{", "ensureLoaded", "(", ")", ";", "for", "(", "VersionHistoryEntry", "entry", ":", "versionHistoryEntries", ")", "{", "switch", "(", "selecto...
Returns the number of seconds since the first time we saw this release of the app. Since the version entries are always stored in order, the first matching entry happened first. @param selector - The type of version entry we are looking for: total, version, or build. @return A DateTime representing the number of secon...
[ "Returns", "the", "number", "of", "seconds", "since", "the", "first", "time", "we", "saw", "this", "release", "of", "the", "app", ".", "Since", "the", "version", "entries", "are", "always", "stored", "in", "order", "the", "first", "matching", "entry", "hap...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/migration/v4_0_0/VersionHistoryStore.java#L109-L133
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/migration/v4_0_0/VersionHistoryStore.java
VersionHistoryStore.isUpdate
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 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...
[ "public", "static", "synchronized", "boolean", "isUpdate", "(", "Selector", "selector", ")", "{", "ensureLoaded", "(", ")", ";", "Set", "<", "String", ">", "uniques", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "VersionHistoryEntr...
Returns true if the current version or build is not the first version or build that we have seen. Basically, it just looks for two or more versions or builds. @param selector - The type of version entry we are looking for: version, or build. @return True if there are records with more than one version or build, depend...
[ "Returns", "true", "if", "the", "current", "version", "or", "build", "is", "not", "the", "first", "version", "or", "build", "that", "we", "have", "seen", ".", "Basically", "it", "just", "looks", "for", "two", "or", "more", "versions", "or", "builds", "."...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/migration/v4_0_0/VersionHistoryStore.java#L142-L158
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/migration/v4_0_0/VersionHistoryStore.java
VersionHistoryStore.getBaseArray
public static JSONArray getBaseArray() { ensureLoaded(); JSONArray baseArray = new JSONArray(); for (VersionHistoryEntry entry : versionHistoryEntries) { baseArray.put(entry); } return baseArray; }
java
public static JSONArray getBaseArray() { ensureLoaded(); JSONArray baseArray = new JSONArray(); for (VersionHistoryEntry entry : versionHistoryEntries) { baseArray.put(entry); } return baseArray; }
[ "public", "static", "JSONArray", "getBaseArray", "(", ")", "{", "ensureLoaded", "(", ")", ";", "JSONArray", "baseArray", "=", "new", "JSONArray", "(", ")", ";", "for", "(", "VersionHistoryEntry", "entry", ":", "versionHistoryEntries", ")", "{", "baseArray", "....
Don't use this directly. Used for debugging only. @return the base JSONArray
[ "Don", "t", "use", "this", "directly", ".", "Used", "for", "debugging", "only", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/migration/v4_0_0/VersionHistoryStore.java#L173-L180
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.addCustomDeviceData
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 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...
[ "public", "static", "void", "addCustomDeviceData", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "dispatchConversationTask", "(", "new", "ConversationDispatchTask", "(", ")", "{", "@", "Override", "protected", "boolean", "execute", "(",...
Add a custom data String to the Device. Custom data will be sent to the server, is displayed in the Conversation view, and can be used in Interaction targeting. Calls to this method are idempotent. @param key The key to store the data under. @param value A String value.
[ "Add", "a", "custom", "data", "String", "to", "the", "Device", ".", "Custom", "data", "will", "be", "sent", "to", "the", "server", "is", "displayed", "in", "the", "Conversation", "view", "and", "can", "be", "used", "in", "Interaction", "targeting", ".", ...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L234-L242
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.removeCustomDeviceData
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 removeCustomDeviceData(final String key) { dispatchConversationTask(new ConversationDispatchTask() { @Override protected boolean execute(Conversation conversation) { conversation.getDevice().getCustomData().remove(key); return true; } }, "remove custom device data"); }
[ "public", "static", "void", "removeCustomDeviceData", "(", "final", "String", "key", ")", "{", "dispatchConversationTask", "(", "new", "ConversationDispatchTask", "(", ")", "{", "@", "Override", "protected", "boolean", "execute", "(", "Conversation", "conversation", ...
Remove a piece of custom data from the device. Calls to this method are idempotent. @param key The key to remove.
[ "Remove", "a", "piece", "of", "custom", "data", "from", "the", "device", ".", "Calls", "to", "this", "method", "are", "idempotent", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L305-L313
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.addCustomPersonData
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 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...
[ "public", "static", "void", "addCustomPersonData", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "dispatchConversationTask", "(", "new", "ConversationDispatchTask", "(", ")", "{", "@", "Override", "protected", "boolean", "execute", "(",...
Add a custom data String to the Person. Custom data will be sent to the server, is displayed in the Conversation view, and can be used in Interaction targeting. Calls to this method are idempotent. @param key The key to store the data under. @param value A String value.
[ "Add", "a", "custom", "data", "String", "to", "the", "Person", ".", "Custom", "data", "will", "be", "sent", "to", "the", "server", "is", "displayed", "in", "the", "Conversation", "view", "and", "can", "be", "used", "in", "Interaction", "targeting", ".", ...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L323-L331
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.removeCustomPersonData
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 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"); }
[ "public", "static", "void", "removeCustomPersonData", "(", "final", "String", "key", ")", "{", "dispatchConversationTask", "(", "new", "ConversationDispatchTask", "(", ")", "{", "@", "Override", "protected", "boolean", "execute", "(", "Conversation", "conversation", ...
Remove a piece of custom data from the Person. Calls to this method are idempotent. @param key The key to remove.
[ "Remove", "a", "piece", "of", "custom", "data", "from", "the", "Person", ".", "Calls", "to", "this", "method", "are", "idempotent", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L394-L402
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.isApptentivePushNotification
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(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...
[ "public", "static", "boolean", "isApptentivePushNotification", "(", "Intent", "intent", ")", "{", "try", "{", "if", "(", "!", "ApptentiveInternal", ".", "checkRegistered", "(", ")", ")", "{", "return", "false", ";", "}", "return", "ApptentiveInternal", ".", "g...
Determines whether this Intent is a push notification sent from Apptentive. @param intent The received {@link Intent} you received in your BroadcastReceiver. @return True if the Intent came from, and should be handled by Apptentive.
[ "Determines", "whether", "this", "Intent", "is", "a", "push", "notification", "sent", "from", "Apptentive", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L496-L507
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.isApptentivePushNotification
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(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...
[ "public", "static", "boolean", "isApptentivePushNotification", "(", "Bundle", "bundle", ")", "{", "try", "{", "if", "(", "!", "ApptentiveInternal", ".", "checkRegistered", "(", ")", ")", "{", "return", "false", ";", "}", "return", "ApptentiveInternal", ".", "g...
Determines whether this Bundle came from an Apptentive push notification. This method is used with Urban Airship integrations. @param bundle The push payload bundle passed to GCM onMessageReceived() callback @return True if the push came from, and should be handled by Apptentive.
[ "Determines", "whether", "this", "Bundle", "came", "from", "an", "Apptentive", "push", "notification", ".", "This", "method", "is", "used", "with", "Urban", "Airship", "integrations", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L516-L527
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.isApptentivePushNotification
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 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 ...
[ "public", "static", "boolean", "isApptentivePushNotification", "(", "Map", "<", "String", ",", "String", ">", "data", ")", "{", "try", "{", "if", "(", "!", "ApptentiveInternal", ".", "checkRegistered", "(", ")", ")", "{", "return", "false", ";", "}", "retu...
Determines whether push payload data came from an Apptentive push notification. @param data The push payload data obtained through FCM's RemoteMessage.getData(), when using FCM @return True if the push came from, and should be handled by Apptentive.
[ "Determines", "whether", "push", "payload", "data", "came", "from", "an", "Apptentive", "push", "notification", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L535-L546
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.setRatingProvider
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 setRatingProvider(IRatingProvider ratingProvider) { try { if (ApptentiveInternal.isApptentiveRegistered()) { ApptentiveInternal.getInstance().setRatingProvider(ratingProvider); } } catch (Exception e) { ApptentiveLog.e(CONVERSATION, e, "Exception while setting rating provider"); l...
[ "public", "static", "void", "setRatingProvider", "(", "IRatingProvider", "ratingProvider", ")", "{", "try", "{", "if", "(", "ApptentiveInternal", ".", "isApptentiveRegistered", "(", ")", ")", "{", "ApptentiveInternal", ".", "getInstance", "(", ")", ".", "setRating...
Use this to choose where to send the user when they are prompted to rate the app. This should be the same place that the app was downloaded from. @param ratingProvider A {@link IRatingProvider} value.
[ "Use", "this", "to", "choose", "where", "to", "send", "the", "user", "when", "they", "are", "prompted", "to", "rate", "the", "app", ".", "This", "should", "be", "the", "same", "place", "that", "the", "app", "was", "downloaded", "from", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L857-L866
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.showMessageCenter
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 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...
[ "public", "static", "void", "showMessageCenter", "(", "final", "Context", "context", ",", "final", "BooleanCallback", "callback", ",", "final", "Map", "<", "String", ",", "Object", ">", "customData", ")", "{", "dispatchConversationTask", "(", "new", "ConversationD...
Opens the Apptentive Message Center UI Activity, and allows custom data to be sent with the next message the user sends. If the user sends multiple messages, this data will only be sent with the first message sent after this method is invoked. Additional invocations of this method with custom data will repeat this proc...
[ "Opens", "the", "Apptentive", "Message", "Center", "UI", "Activity", "and", "allows", "custom", "data", "to", "be", "sent", "with", "the", "next", "message", "the", "user", "sends", ".", "If", "the", "user", "sends", "multiple", "messages", "this", "data", ...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L953-L960
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.canShowMessageCenter
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 canShowMessageCenter(BooleanCallback callback) { dispatchConversationTask(new ConversationDispatchTask(callback, DispatchQueue.mainQueue()) { @Override protected boolean execute(Conversation conversation) { return ApptentiveInternal.canShowMessageCenterInternal(conversation); } }, "c...
[ "public", "static", "void", "canShowMessageCenter", "(", "BooleanCallback", "callback", ")", "{", "dispatchConversationTask", "(", "new", "ConversationDispatchTask", "(", "callback", ",", "DispatchQueue", ".", "mainQueue", "(", ")", ")", "{", "@", "Override", "prote...
Our SDK must connect to our server at least once to download initial configuration for Message Center. Call this method to see whether or not Message Center can be displayed. This task is performed asynchronously. @param callback Called after we check to see if Message Center can be displayed, but before it is display...
[ "Our", "SDK", "must", "connect", "to", "our", "server", "at", "least", "once", "to", "download", "initial", "configuration", "for", "Message", "Center", ".", "Call", "this", "method", "to", "see", "whether", "or", "not", "Message", "Center", "can", "be", "...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L970-L977
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.addUnreadMessagesListener
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 void addUnreadMessagesListener(final UnreadMessagesListener listener) { dispatchConversationTask(new ConversationDispatchTask() { @Override protected boolean execute(Conversation conversation) { conversation.getMessageManager().addHostUnreadMessagesListener(listener); return true; } }...
[ "public", "static", "void", "addUnreadMessagesListener", "(", "final", "UnreadMessagesListener", "listener", ")", "{", "dispatchConversationTask", "(", "new", "ConversationDispatchTask", "(", ")", "{", "@", "Override", "protected", "boolean", "execute", "(", "Conversati...
Add a listener to be notified when the number of unread messages in the Message Center changes. @param listener An UnreadMessagesListener that you instantiate. Do not pass in an anonymous class. Instead, create your listener as an instance variable and pass that in. This allows us to keep a weak reference to avoid mem...
[ "Add", "a", "listener", "to", "be", "notified", "when", "the", "number", "of", "unread", "messages", "in", "the", "Message", "Center", "changes", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L1007-L1015
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.getUnreadMessageCount
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 int getUnreadMessageCount() { try { if (ApptentiveInternal.isApptentiveRegistered()) { ConversationProxy conversationProxy = ApptentiveInternal.getInstance().getConversationProxy(); return conversationProxy != null ? conversationProxy.getUnreadMessageCount() : 0; } } catch (Exception e) ...
[ "public", "static", "int", "getUnreadMessageCount", "(", ")", "{", "try", "{", "if", "(", "ApptentiveInternal", ".", "isApptentiveRegistered", "(", ")", ")", "{", "ConversationProxy", "conversationProxy", "=", "ApptentiveInternal", ".", "getInstance", "(", ")", "....
Returns the number of unread messages in the Message Center. @return The number of unread messages.
[ "Returns", "the", "number", "of", "unread", "messages", "in", "the", "Message", "Center", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L1022-L1033
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.sendAttachmentText
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 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...
[ "public", "static", "void", "sendAttachmentText", "(", "final", "String", "text", ")", "{", "dispatchConversationTask", "(", "new", "ConversationDispatchTask", "(", ")", "{", "@", "Override", "protected", "boolean", "execute", "(", "Conversation", "conversation", ")...
Sends a text message to the server. This message will be visible in the conversation view on the server, but will not be shown in the client's Message Center. @param text The message you wish to send.
[ "Sends", "a", "text", "message", "to", "the", "server", ".", "This", "message", "will", "be", "visible", "in", "the", "conversation", "view", "on", "the", "server", "but", "will", "not", "be", "shown", "in", "the", "client", "s", "Message", "Center", "."...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L1041-L1055
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.engage
public static synchronized void engage(Context context, String event, BooleanCallback callback) { engage(context, event, callback, null, (ExtendedData[]) null); }
java
public static synchronized void engage(Context context, String event, BooleanCallback callback) { engage(context, event, callback, null, (ExtendedData[]) null); }
[ "public", "static", "synchronized", "void", "engage", "(", "Context", "context", ",", "String", "event", ",", "BooleanCallback", "callback", ")", "{", "engage", "(", "context", ",", "event", ",", "callback", ",", "null", ",", "(", "ExtendedData", "[", "]", ...
This method takes a unique event string, stores a record of that event having been visited, determines if there is an interaction that is able to run for this event, and then runs it. If more than one interaction can run, then the most appropriate interaction takes precedence. Only one interaction at most will run per ...
[ "This", "method", "takes", "a", "unique", "event", "string", "stores", "a", "record", "of", "that", "event", "having", "been", "visited", "determines", "if", "there", "is", "an", "interaction", "that", "is", "able", "to", "run", "for", "this", "event", "an...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L1223-L1225
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.engage
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 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)) { ...
[ "public", "static", "synchronized", "void", "engage", "(", "final", "Context", "context", ",", "final", "String", "event", ",", "final", "BooleanCallback", "callback", ",", "final", "Map", "<", "String", ",", "Object", ">", "customData", ",", "final", "Extende...
This method takes a unique event string, stores a record of that event having been visited, determines if there is an interaction that is able to run for this event, and then runs it. If more than one interaction can run, then the most appropriate interaction takes precedence. Only one interaction at most will run per ...
[ "This", "method", "takes", "a", "unique", "event", "string", "stores", "a", "record", "of", "that", "event", "having", "been", "visited", "determines", "if", "there", "is", "an", "interaction", "that", "is", "able", "to", "run", "for", "this", "event", "an...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L1329-L1366
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.login
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 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...
[ "public", "static", "void", "login", "(", "final", "String", "token", ",", "final", "LoginCallback", "callback", ")", "{", "if", "(", "StringUtils", ".", "isNullOrEmpty", "(", "token", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Token is...
Starts login process asynchronously. This call returns immediately. Using this method requires you to implement JWT generation on your server. Please read about it in Apptentive's Android Integration Reference Guide. @param token A JWT signed by your server using the secret from your app's Apptentive settings. @par...
[ "Starts", "login", "process", "asynchronously", ".", "This", "call", "returns", "immediately", ".", "Using", "this", "method", "requires", "you", "to", "implement", "JWT", "generation", "on", "your", "server", ".", "Please", "read", "about", "it", "in", "Appte...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L1434-L1452
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/StringUtils.java
StringUtils.join
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 <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(); }
[ "public", "static", "<", "T", ">", "String", "join", "(", "List", "<", "T", ">", "list", ",", "String", "separator", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "int", "i", "=", "0", ";", "for", "(", "T", "t", ...
Constructs and returns a string object that is the result of interposing a separator between the elements of the list
[ "Constructs", "and", "returns", "a", "string", "object", "that", "is", "the", "result", "of", "interposing", "a", "separator", "between", "the", "elements", "of", "the", "list" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/StringUtils.java#L125-L133
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/StringUtils.java
StringUtils.trim
public static String trim(String str) { return str != null && str.length() > 0 ? str.trim() : str; }
java
public static String trim(String str) { return str != null && str.length() > 0 ? str.trim() : str; }
[ "public", "static", "String", "trim", "(", "String", "str", ")", "{", "return", "str", "!=", "null", "&&", "str", ".", "length", "(", ")", ">", "0", "?", "str", ".", "trim", "(", ")", ":", "str", ";", "}" ]
Safely trims input string
[ "Safely", "trims", "input", "string" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/StringUtils.java#L145-L147
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/StringUtils.java
StringUtils.asJson
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 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; } }
[ "public", "static", "String", "asJson", "(", "String", "key", ",", "Object", "value", ")", "{", "try", "{", "JSONObject", "json", "=", "new", "JSONObject", "(", ")", ";", "json", ".", "put", "(", "key", ",", "value", ")", ";", "return", "json", ".", ...
Creates a simple json string from key and value
[ "Creates", "a", "simple", "json", "string", "from", "key", "and", "value" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/StringUtils.java#L159-L168
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/StringUtils.java
StringUtils.hexToBytes
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
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; }
[ "public", "static", "byte", "[", "]", "hexToBytes", "(", "String", "hex", ")", "{", "int", "length", "=", "hex", ".", "length", "(", ")", ";", "byte", "[", "]", "ret", "=", "new", "byte", "[", "length", "/", "2", "]", ";", "for", "(", "int", "i...
Converts a hex String to a byte array.
[ "Converts", "a", "hex", "String", "to", "a", "byte", "array", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/StringUtils.java#L173-L180
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequestManager.java
HttpRequestManager.dispatchRequest
void dispatchRequest(final HttpRequest request) { networkQueue.dispatchAsync(new DispatchTask() { @Override protected void execute() { request.dispatchSync(networkQueue); } }); }
java
void dispatchRequest(final HttpRequest request) { networkQueue.dispatchAsync(new DispatchTask() { @Override protected void execute() { request.dispatchSync(networkQueue); } }); }
[ "void", "dispatchRequest", "(", "final", "HttpRequest", "request", ")", "{", "networkQueue", ".", "dispatchAsync", "(", "new", "DispatchTask", "(", ")", "{", "@", "Override", "protected", "void", "execute", "(", ")", "{", "request", ".", "dispatchSync", "(", ...
Handles request synchronously
[ "Handles", "request", "synchronously" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequestManager.java#L68-L75
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequestManager.java
HttpRequestManager.cancelAll
public synchronized void cancelAll() { if (activeRequests.size() > 0) { List<HttpRequest> temp = new ArrayList<>(activeRequests); for (HttpRequest request : temp) { request.cancel(); } } notifyCancelledAllRequests(); }
java
public synchronized void cancelAll() { if (activeRequests.size() > 0) { List<HttpRequest> temp = new ArrayList<>(activeRequests); for (HttpRequest request : temp) { request.cancel(); } } notifyCancelledAllRequests(); }
[ "public", "synchronized", "void", "cancelAll", "(", ")", "{", "if", "(", "activeRequests", ".", "size", "(", ")", ">", "0", ")", "{", "List", "<", "HttpRequest", ">", "temp", "=", "new", "ArrayList", "<>", "(", "activeRequests", ")", ";", "for", "(", ...
Cancel all active requests
[ "Cancel", "all", "active", "requests" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequestManager.java#L80-L88
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequestManager.java
HttpRequestManager.unregisterRequest
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
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); } }
[ "synchronized", "void", "unregisterRequest", "(", "HttpRequest", "request", ")", "{", "assertTrue", "(", "this", "==", "request", ".", "requestManager", ")", ";", "boolean", "removed", "=", "activeRequests", ".", "remove", "(", "request", ")", ";", "assertTrue",...
Unregisters active request
[ "Unregisters", "active", "request" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/network/HttpRequestManager.java#L101-L109
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/comm/ApptentiveHttpClient.java
ApptentiveHttpClient.createConversationTokenRequest
public HttpJsonRequest createConversationTokenRequest(ConversationTokenRequest conversationTokenRequest, HttpRequest.Listener<HttpJsonRequest> listener) { HttpJsonRequest request = createJsonRequest(ENDPOINT_CONVERSATION, conversationTokenRequest, HttpRequestMethod.POST); request.addListener(listener); return req...
java
public HttpJsonRequest createConversationTokenRequest(ConversationTokenRequest conversationTokenRequest, HttpRequest.Listener<HttpJsonRequest> listener) { HttpJsonRequest request = createJsonRequest(ENDPOINT_CONVERSATION, conversationTokenRequest, HttpRequestMethod.POST); request.addListener(listener); return req...
[ "public", "HttpJsonRequest", "createConversationTokenRequest", "(", "ConversationTokenRequest", "conversationTokenRequest", ",", "HttpRequest", ".", "Listener", "<", "HttpJsonRequest", ">", "listener", ")", "{", "HttpJsonRequest", "request", "=", "createJsonRequest", "(", "...
region API Requests
[ "region", "API", "Requests" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/comm/ApptentiveHttpClient.java#L76-L80
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/SurveyFragment.java
SurveyFragment.validateAndUpdateState
public boolean validateAndUpdateState() { boolean validationPassed = true; List<Fragment> fragments = getRetainedChildFragmentManager().getFragments(); for (Fragment fragment : fragments) { SurveyQuestionView surveyQuestionView = (SurveyQuestionView) fragment; answers.put(surveyQuestionView.getQuestionId()...
java
public boolean validateAndUpdateState() { boolean validationPassed = true; List<Fragment> fragments = getRetainedChildFragmentManager().getFragments(); for (Fragment fragment : fragments) { SurveyQuestionView surveyQuestionView = (SurveyQuestionView) fragment; answers.put(surveyQuestionView.getQuestionId()...
[ "public", "boolean", "validateAndUpdateState", "(", ")", "{", "boolean", "validationPassed", "=", "true", ";", "List", "<", "Fragment", ">", "fragments", "=", "getRetainedChildFragmentManager", "(", ")", ".", "getFragments", "(", ")", ";", "for", "(", "Fragment"...
Run this when the user hits the send button, and only send if it returns true. This method will update the visual validation state of all questions, and update the answers instance variable with the latest answer state. @return true if all questions that have constraints have met those constraints.
[ "Run", "this", "when", "the", "user", "hits", "the", "send", "button", "and", "only", "send", "if", "it", "returns", "true", ".", "This", "method", "will", "update", "the", "visual", "validation", "state", "of", "all", "questions", "and", "update", "the", ...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/SurveyFragment.java#L280-L294
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/ApptentiveViewActivity.java
ApptentiveViewActivity.exitActivity
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
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); } }
[ "private", "void", "exitActivity", "(", "ApptentiveViewExitType", "exitType", ")", "{", "try", "{", "exitActivityGuarded", "(", "exitType", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ApptentiveLog", ".", "e", "(", "e", ",", "\"Exception while tr...
Helper to clean up the Activity, whether it is exited through the toolbar back button, or the hardware back button.
[ "Helper", "to", "clean", "up", "the", "Activity", "whether", "it", "is", "exited", "through", "the", "toolbar", "back", "button", "or", "the", "hardware", "back", "button", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/ApptentiveViewActivity.java#L255-L262
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/debug/LogMonitor.java
LogMonitor.startSession
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
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...
[ "public", "static", "void", "startSession", "(", "final", "Context", "context", ",", "final", "String", "appKey", ",", "final", "String", "appSignature", ")", "{", "dispatchOnConversationQueue", "(", "new", "DispatchTask", "(", ")", "{", "@", "Override", "protec...
Attempts to start a new troubleshooting session. First the SDK will check if there is an existing session stored in the persistent storage and then check if the clipboard contains a valid access token. This call is async and returns immediately.
[ "Attempts", "to", "start", "a", "new", "troubleshooting", "session", ".", "First", "the", "SDK", "will", "check", "if", "there", "is", "an", "existing", "session", "stored", "in", "the", "persistent", "storage", "and", "then", "check", "if", "the", "clipboar...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/debug/LogMonitor.java#L61-L73
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/debug/LogMonitor.java
LogMonitor.readAccessTokenFromClipboard
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 @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 =...
[ "private", "static", "@", "Nullable", "String", "readAccessTokenFromClipboard", "(", "Context", "context", ")", "{", "String", "text", "=", "Util", ".", "getClipboardText", "(", "context", ")", ";", "if", "(", "StringUtils", ".", "isNullOrEmpty", "(", "text", ...
Attempts to read access token from the clipboard
[ "Attempts", "to", "read", "access", "token", "from", "the", "clipboard" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/debug/LogMonitor.java#L173-L189
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/debug/LogMonitor.java
LogMonitor.createTokenVerificationRequest
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
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...
[ "private", "static", "HttpRequest", "createTokenVerificationRequest", "(", "String", "apptentiveAppKey", ",", "String", "apptentiveAppSignature", ",", "String", "token", ",", "HttpRequest", ".", "Listener", "<", "HttpJsonRequest", ">", "listener", ")", "{", "// TODO: mo...
region Token Verification
[ "region", "Token", "Verification" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/debug/LogMonitor.java#L195-L211
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java
ImageGridViewAdapter.clickOn
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 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...
[ "public", "boolean", "clickOn", "(", "int", "index", ")", "{", "ImageItem", "item", "=", "getItem", "(", "index", ")", ";", "if", "(", "item", "==", "null", "||", "TextUtils", ".", "isEmpty", "(", "item", ".", "mimeType", ")", ")", "{", "return", "fa...
Click an image @param index @return True if handled here; False, let the caller handle it, i.e. launch 3rd party app to open attachment
[ "Click", "an", "image" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java#L123-L151
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java
ImageGridViewAdapter.select
public void select(ImageItem image) { if (selectedImages.contains(image)) { selectedImages.remove(image); } else { selectedImages.add(image); } notifyDataSetChanged(); }
java
public void select(ImageItem image) { if (selectedImages.contains(image)) { selectedImages.remove(image); } else { selectedImages.add(image); } notifyDataSetChanged(); }
[ "public", "void", "select", "(", "ImageItem", "image", ")", "{", "if", "(", "selectedImages", ".", "contains", "(", "image", ")", ")", "{", "selectedImages", ".", "remove", "(", "image", ")", ";", "}", "else", "{", "selectedImages", ".", "add", "(", "i...
Select an image @param image
[ "Select", "an", "image" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java#L158-L165
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java
ImageGridViewAdapter.setDefaultSelected
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 setDefaultSelected(ArrayList<String> resultList) { for (String uri : resultList) { ImageItem image = getImageByUri(uri); if (image != null) { selectedImages.add(image); } } if (selectedImages.size() > 0) { notifyDataSetChanged(); } }
[ "public", "void", "setDefaultSelected", "(", "ArrayList", "<", "String", ">", "resultList", ")", "{", "for", "(", "String", "uri", ":", "resultList", ")", "{", "ImageItem", "image", "=", "getImageByUri", "(", "uri", ")", ";", "if", "(", "image", "!=", "n...
Re-Select image from selected list result @param resultList
[ "Re", "-", "Select", "image", "from", "selected", "list", "result" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java#L172-L182
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java
ImageGridViewAdapter.setData
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 setData(List<ImageItem> images) { selectedImages.clear(); if (images != null && images.size() > 0) { this.images = images; } else { this.images.clear(); } notifyDataSetChanged(); }
[ "public", "void", "setData", "(", "List", "<", "ImageItem", ">", "images", ")", "{", "selectedImages", ".", "clear", "(", ")", ";", "if", "(", "images", "!=", "null", "&&", "images", ".", "size", "(", ")", ">", "0", ")", "{", "this", ".", "images",...
Re-select image from selected image set @param images
[ "Re", "-", "select", "image", "from", "selected", "image", "set" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java#L200-L209
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java
ImageGridViewAdapter.setItemSize
public void setItemSize(int columnWidth, int columnHeight) { if (itemWidth == columnWidth) { return; } itemWidth = columnWidth; itemHeight = columnHeight; itemLayoutParams = new GridView.LayoutParams(itemWidth, itemHeight); notifyDataSetChanged(); }
java
public void setItemSize(int columnWidth, int columnHeight) { if (itemWidth == columnWidth) { return; } itemWidth = columnWidth; itemHeight = columnHeight; itemLayoutParams = new GridView.LayoutParams(itemWidth, itemHeight); notifyDataSetChanged(); }
[ "public", "void", "setItemSize", "(", "int", "columnWidth", ",", "int", "columnHeight", ")", "{", "if", "(", "itemWidth", "==", "columnWidth", ")", "{", "return", ";", "}", "itemWidth", "=", "columnWidth", ";", "itemHeight", "=", "columnHeight", ";", "itemLa...
Reset colum size @param columnWidth
[ "Reset", "colum", "size" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java#L216-L228
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/metric/MetricModule.java
MetricModule.sendError
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 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...
[ "public", "static", "void", "sendError", "(", "final", "Throwable", "throwable", ",", "final", "String", "description", ",", "final", "String", "extraData", ")", "{", "if", "(", "!", "isConversationQueue", "(", ")", ")", "{", "dispatchOnConversationQueue", "(", ...
Used for internal error reporting when we intercept a Throwable that may have otherwise caused a crash. @param throwable An optional throwable that was caught, and which we want to log. @param description An optional description of what happened. @param extraData Any extra data that may have contributed to the Thr...
[ "Used", "for", "internal", "error", "reporting", "when", "we", "intercept", "a", "Throwable", "that", "may", "have", "otherwise", "caused", "a", "crash", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/metric/MetricModule.java#L68-L106
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.parseWebColorAsAndroidColor
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 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...
[ "public", "static", "Integer", "parseWebColorAsAndroidColor", "(", "String", "input", ")", "{", "// Swap if input is #RRGGBBAA, but not if it is #RRGGBB", "Boolean", "swapAlpha", "=", "(", "input", ".", "length", "(", ")", "==", "9", ")", ";", "try", "{", "Integer",...
The web standard for colors is RGBA, but Android uses ARGB. This method provides a way to convert RGBA to ARGB.
[ "The", "web", "standard", "for", "colors", "is", "RGBA", "but", "Android", "uses", "ARGB", ".", "This", "method", "provides", "a", "way", "to", "convert", "RGBA", "to", "ARGB", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L340-L353
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.getCompatDrawable
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 Drawable getCompatDrawable(Context c, int drawableRes) { Drawable d = null; try { d = ContextCompat.getDrawable(c, drawableRes); } catch (Exception ex) { logException(ex); } return d; }
[ "public", "static", "Drawable", "getCompatDrawable", "(", "Context", "c", ",", "int", "drawableRes", ")", "{", "Drawable", "d", "=", "null", ";", "try", "{", "d", "=", "ContextCompat", ".", "getDrawable", "(", "c", ",", "drawableRes", ")", ";", "}", "cat...
helper method to get the drawable by its resource id, specific to the correct android version @param c @param drawableRes @return
[ "helper", "method", "to", "get", "the", "drawable", "by", "its", "resource", "id", "specific", "to", "the", "correct", "android", "version" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L386-L394
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.getSelectableImageButtonBackground
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 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...
[ "public", "static", "StateListDrawable", "getSelectableImageButtonBackground", "(", "int", "selected_color", ")", "{", "ColorDrawable", "selectedColor", "=", "new", "ColorDrawable", "(", "selected_color", ")", ";", "StateListDrawable", "states", "=", "new", "StateListDraw...
helper method to generate the ImageButton background with specified highlight color. @param selected_color the color shown as highlight @return
[ "helper", "method", "to", "generate", "the", "ImageButton", "background", "with", "specified", "highlight", "color", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L443-L449
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.openFileAttachment
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 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...
[ "public", "static", "boolean", "openFileAttachment", "(", "final", "Context", "context", ",", "final", "String", "sourcePath", ",", "final", "String", "selectedFilePath", ",", "final", "String", "mimeTypeString", ")", "{", "if", "(", "(", "Environment", ".", "ME...
This function launchs the default app to view the selected file, based on mime type @param sourcePath @param selectedFilePath the full path to the local storage @param mimeTypeString the mime type of the file to be opened @return true if file can be viewed
[ "This", "function", "launchs", "the", "default", "app", "to", "view", "the", "selected", "file", "based", "on", "mime", "type" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L644-L696
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.copyFile
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 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...
[ "public", "static", "int", "copyFile", "(", "String", "from", ",", "String", "to", ")", "{", "InputStream", "inStream", "=", "null", ";", "FileOutputStream", "fs", "=", "null", ";", "try", "{", "int", "bytesum", "=", "0", ";", "int", "byteread", ";", "...
This function copies file from one location to another @param from the full path to the source file @param to the full path to the destination file @return total bytes copied. 0 indicates
[ "This", "function", "copies", "file", "from", "one", "location", "to", "another" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L705-L728
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.createLocalStoredFile
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(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...
[ "public", "static", "StoredFile", "createLocalStoredFile", "(", "String", "sourceUrl", ",", "String", "localFilePath", ",", "String", "mimeType", ")", "{", "InputStream", "is", "=", "null", ";", "try", "{", "Context", "context", "=", "ApptentiveInternal", ".", "...
This method creates a cached file exactly copying from the input stream. @param sourceUrl the source file path or uri string @param localFilePath the cache file path string @param mimeType the mimeType of the source inputstream @return null if failed, otherwise a StoredFile object
[ "This", "method", "creates", "a", "cached", "file", "exactly", "copying", "from", "the", "input", "stream", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L914-L932
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.createLocalStoredFile
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 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...
[ "public", "static", "StoredFile", "createLocalStoredFile", "(", "InputStream", "is", ",", "String", "sourceUrl", ",", "String", "localFilePath", ",", "String", "mimeType", ")", "{", "if", "(", "is", "==", "null", ")", "{", "return", "null", ";", "}", "// Cop...
This method creates a cached file copy from the source input stream. @param is the source input stream @param sourceUrl the source file path or uri string @param localFilePath the cache file path string @param mimeType the mimeType of the source inputstream @return null if failed, otherwise a Store...
[ "This", "method", "creates", "a", "cached", "file", "copy", "from", "the", "source", "input", "stream", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L943-L985
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.buildApptentiveInteractionTheme
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 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 ...
[ "public", "static", "Resources", ".", "Theme", "buildApptentiveInteractionTheme", "(", "Context", "context", ")", "{", "Resources", ".", "Theme", "theme", "=", "context", ".", "getResources", "(", ")", ".", "newTheme", "(", ")", ";", "// 1. Start by basing this on...
Builds out the main theme that we would like to use for all Apptentive UI, basing it on the existing app theme, and adding Apptentive's theme where it doesn't override the existing app's attributes. Finally, it forces changes to the theme using ApptentiveThemeOverride. @param context The context for the app or Activity...
[ "Builds", "out", "the", "main", "theme", "that", "we", "would", "like", "to", "use", "for", "all", "Apptentive", "UI", "basing", "it", "on", "the", "existing", "app", "theme", "and", "adding", "Apptentive", "s", "theme", "where", "it", "doesn", "t", "ove...
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L1079-L1111
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.getInternalDir
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 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,...
[ "public", "static", "File", "getInternalDir", "(", "Context", "context", ",", "String", "path", ",", "boolean", "createIfNecessary", ")", "{", "File", "filesDir", "=", "context", ".", "getFilesDir", "(", ")", ";", "File", "internalDir", "=", "new", "File", "...
Returns and internal storage directory
[ "Returns", "and", "internal", "storage", "directory" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L1130-L1140
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.getManifestMetadataString
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 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...
[ "public", "static", "String", "getManifestMetadataString", "(", "Context", "context", ",", "String", "key", ")", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Context is null\"", ")", ";", "}", "if", "("...
Helper method for resolving manifest metadata string value @return null if key is missing or exception is thrown
[ "Helper", "method", "for", "resolving", "manifest", "metadata", "string", "value" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L1147-L1170
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.guarded
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 @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...
[ "public", "static", "@", "Nullable", "View", ".", "OnClickListener", "guarded", "(", "@", "Nullable", "final", "View", ".", "OnClickListener", "listener", ")", "{", "if", "(", "listener", "!=", "null", ")", "{", "return", "new", "View", ".", "OnClickListener...
Creates a fail-safe try..catch wrapped listener
[ "Creates", "a", "fail", "-", "safe", "try", "..", "catch", "wrapped", "listener" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L1207-L1223
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/debug/Assert.java
Assert.assertMainThread
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 assertMainThread() { if (imp != null && !DispatchQueue.isMainQueue()) { imp.assertFailed(StringUtils.format("Expected 'main' thread but was '%s'", Thread.currentThread().getName())); } }
[ "public", "static", "void", "assertMainThread", "(", ")", "{", "if", "(", "imp", "!=", "null", "&&", "!", "DispatchQueue", ".", "isMainQueue", "(", ")", ")", "{", "imp", ".", "assertFailed", "(", "StringUtils", ".", "format", "(", "\"Expected 'main' thread b...
Asserts that code executes on the main thread.
[ "Asserts", "that", "code", "executes", "on", "the", "main", "thread", "." ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/debug/Assert.java#L179-L183
train
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/debug/Assert.java
Assert.assertFail
public static void assertFail(String format, Object... args) { assertFail(StringUtils.format(format, args)); }
java
public static void assertFail(String format, Object... args) { assertFail(StringUtils.format(format, args)); }
[ "public", "static", "void", "assertFail", "(", "String", "format", ",", "Object", "...", "args", ")", "{", "assertFail", "(", "StringUtils", ".", "format", "(", "format", ",", "args", ")", ")", ";", "}" ]
General failure with a message
[ "General", "failure", "with", "a", "message" ]
887c08d7bd5ae6488a90366dfb58f58938861a93
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/debug/Assert.java#L201-L203
train
cerner/beadledom
pagination/src/main/java/com/cerner/beadledom/pagination/parameters/AbstractParameter.java
AbstractParameter.getValue
public T getValue() { try { value = parse(originalParameter); } catch (InvalidParameterException e) { throw new WebApplicationException(onError(e)); } return value; }
java
public T getValue() { try { value = parse(originalParameter); } catch (InvalidParameterException e) { throw new WebApplicationException(onError(e)); } return value; }
[ "public", "T", "getValue", "(", ")", "{", "try", "{", "value", "=", "parse", "(", "originalParameter", ")", ";", "}", "catch", "(", "InvalidParameterException", "e", ")", "{", "throw", "new", "WebApplicationException", "(", "onError", "(", "e", ")", ")", ...
Returns the parsed value.
[ "Returns", "the", "parsed", "value", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/pagination/src/main/java/com/cerner/beadledom/pagination/parameters/AbstractParameter.java#L38-L45
train
cerner/beadledom
client/beadledom-client/src/main/java/com/cerner/beadledom/client/BeadledomClientConfiguration.java
BeadledomClientConfiguration.builder
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
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...
[ "public", "static", "Builder", "builder", "(", ")", "{", "return", "new", "AutoValue_BeadledomClientConfiguration", ".", "Builder", "(", ")", ".", "connectionPoolSize", "(", "DEFAULT_CONNECTION_POOL_SIZE", ")", ".", "maxPooledPerRouteSize", "(", "DEFAULT_MAX_POOLED_PER_RO...
Default client config builder.
[ "Default", "client", "config", "builder", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/client/beadledom-client/src/main/java/com/cerner/beadledom/client/BeadledomClientConfiguration.java#L31-L38
train
cerner/beadledom
jooq/src/main/java/com/cerner/beadledom/jooq/JooqTxnInterceptor.java
JooqTxnInterceptor.invokeInTransactionAndUnitOfWork
private Object invokeInTransactionAndUnitOfWork(MethodInvocation methodInvocation) throws Throwable { boolean unitOfWorkAlreadyStarted = unitOfWork.isActive(); if (!unitOfWorkAlreadyStarted) { unitOfWork.begin(); } Throwable originalThrowable = null; try { return dslContextProvide...
java
private Object invokeInTransactionAndUnitOfWork(MethodInvocation methodInvocation) throws Throwable { boolean unitOfWorkAlreadyStarted = unitOfWork.isActive(); if (!unitOfWorkAlreadyStarted) { unitOfWork.begin(); } Throwable originalThrowable = null; try { return dslContextProvide...
[ "private", "Object", "invokeInTransactionAndUnitOfWork", "(", "MethodInvocation", "methodInvocation", ")", "throws", "Throwable", "{", "boolean", "unitOfWorkAlreadyStarted", "=", "unitOfWork", ".", "isActive", "(", ")", ";", "if", "(", "!", "unitOfWorkAlreadyStarted", "...
Invokes the method wrapped within a unit of work and a transaction. @param methodInvocation the method to be invoked within a transaction @return the result of the call to the invoked method @throws Throwable if an exception occurs during the method invocation, transaction, or unit of work
[ "Invokes", "the", "method", "wrapped", "within", "a", "unit", "of", "work", "and", "a", "transaction", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/jooq/src/main/java/com/cerner/beadledom/jooq/JooqTxnInterceptor.java#L38-L66
train
cerner/beadledom
jooq/src/main/java/com/cerner/beadledom/jooq/JooqTxnInterceptor.java
JooqTxnInterceptor.endUnitOfWork
private void endUnitOfWork(Throwable originalThrowable) throws Throwable { try { unitOfWork.end(); } catch (Throwable t) { if (originalThrowable != null) { throw originalThrowable; } else { throw t; } } }
java
private void endUnitOfWork(Throwable originalThrowable) throws Throwable { try { unitOfWork.end(); } catch (Throwable t) { if (originalThrowable != null) { throw originalThrowable; } else { throw t; } } }
[ "private", "void", "endUnitOfWork", "(", "Throwable", "originalThrowable", ")", "throws", "Throwable", "{", "try", "{", "unitOfWork", ".", "end", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "if", "(", "originalThrowable", "!=", "null", ")...
Ends the unit of work. <p>If originalThrowable is present, and an exception is thrown, then the originalThrowable will be preferred and thrown instead; if originalThrowable is not present, and an exception is thrown, then the unitOfWork exception will be thrown. @param originalThrowable the original exception that wa...
[ "Ends", "the", "unit", "of", "work", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/jooq/src/main/java/com/cerner/beadledom/jooq/JooqTxnInterceptor.java#L78-L88
train
cerner/beadledom
pagination/src/main/java/com/cerner/beadledom/pagination/parameters/OffsetPaginationParameters.java
OffsetPaginationParameters.getLimit
public Integer getLimit() { String limitFromRequest = uriInfo.getQueryParameters().getFirst(LimitParameter.getDefaultLimitFieldName()); return limitFromRequest != null ? new LimitParameter(limitFromRequest).getValue() : LimitParameter.getDefaultLimit(); }
java
public Integer getLimit() { String limitFromRequest = uriInfo.getQueryParameters().getFirst(LimitParameter.getDefaultLimitFieldName()); return limitFromRequest != null ? new LimitParameter(limitFromRequest).getValue() : LimitParameter.getDefaultLimit(); }
[ "public", "Integer", "getLimit", "(", ")", "{", "String", "limitFromRequest", "=", "uriInfo", ".", "getQueryParameters", "(", ")", ".", "getFirst", "(", "LimitParameter", ".", "getDefaultLimitFieldName", "(", ")", ")", ";", "return", "limitFromRequest", "!=", "n...
Retrieves the value of the limit field from the request. Will use the configured field name to find the parameter. @return The value of the limit.
[ "Retrieves", "the", "value", "of", "the", "limit", "field", "from", "the", "request", ".", "Will", "use", "the", "configured", "field", "name", "to", "find", "the", "parameter", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/pagination/src/main/java/com/cerner/beadledom/pagination/parameters/OffsetPaginationParameters.java#L28-L34
train
cerner/beadledom
pagination/src/main/java/com/cerner/beadledom/pagination/parameters/OffsetPaginationParameters.java
OffsetPaginationParameters.getOffset
public Long getOffset() { String offsetFromRequest = uriInfo.getQueryParameters().getFirst(OffsetParameter.getDefaultOffsetFieldName()); return offsetFromRequest != null ? new OffsetParameter(offsetFromRequest).getValue() : OffsetParameter.getDefaultOffset(); }
java
public Long getOffset() { String offsetFromRequest = uriInfo.getQueryParameters().getFirst(OffsetParameter.getDefaultOffsetFieldName()); return offsetFromRequest != null ? new OffsetParameter(offsetFromRequest).getValue() : OffsetParameter.getDefaultOffset(); }
[ "public", "Long", "getOffset", "(", ")", "{", "String", "offsetFromRequest", "=", "uriInfo", ".", "getQueryParameters", "(", ")", ".", "getFirst", "(", "OffsetParameter", ".", "getDefaultOffsetFieldName", "(", ")", ")", ";", "return", "offsetFromRequest", "!=", ...
Retrieves the value of the offset field from the request. Will use the configured field name to find the parameter @return The value of the offset.
[ "Retrieves", "the", "value", "of", "the", "offset", "field", "from", "the", "request", ".", "Will", "use", "the", "configured", "field", "name", "to", "find", "the", "parameter" ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/pagination/src/main/java/com/cerner/beadledom/pagination/parameters/OffsetPaginationParameters.java#L42-L48
train
cerner/beadledom
pagination/src/main/java/com/cerner/beadledom/pagination/parameters/LimitParameter.java
LimitParameter.checkLimitRange
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
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...
[ "private", "void", "checkLimitRange", "(", "int", "limit", ")", "{", "int", "minLimit", "=", "offsetPaginationConfiguration", ".", "allowZeroLimit", "(", ")", "?", "0", ":", "1", ";", "if", "(", "limit", "<", "minLimit", "||", "limit", ">", "offsetPagination...
Ensures that the limit is in the allowed range. @param limit the parsed limit value to check the range of @throws InvalidParameterException if the limit value is less outside of the allowed range
[ "Ensures", "that", "the", "limit", "is", "in", "the", "allowed", "range", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/pagination/src/main/java/com/cerner/beadledom/pagination/parameters/LimitParameter.java#L72-L81
train
cerner/beadledom
stagemonitor/src/main/java/com/cerner/beadledom/stagemonitor/request/CondensedCallStackElement.java
CondensedCallStackElement.getSignature
@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
@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...
[ "@", "Override", "public", "String", "getSignature", "(", ")", "{", "String", "signature", "=", "super", ".", "getSignature", "(", ")", ";", "if", "(", "signature", ".", "indexOf", "(", "'", "'", ")", "==", "-", "1", ")", "{", "return", "signature", ...
Returns the signature with the packages names shortened to only include the first character. @return the condensed signature. e.g. {@code void org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletRequest, HttpServletResponse)} would return {@code void o.j.r.p.s.s.HttpServletDispatcher.ser...
[ "Returns", "the", "signature", "with", "the", "packages", "names", "shortened", "to", "only", "include", "the", "first", "character", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/stagemonitor/src/main/java/com/cerner/beadledom/stagemonitor/request/CondensedCallStackElement.java#L54-L82
train
cerner/beadledom
jaxrs-genericresponse/src/main/java/com/cerner/beadledom/jaxrs/GenericResponseBuilder.java
GenericResponseBuilder.errorEntity
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> 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; ...
[ "public", "GenericResponseBuilder", "<", "T", ">", "errorEntity", "(", "Object", "errorEntity", ",", "Annotation", "[", "]", "annotations", ")", "{", "if", "(", "body", "!=", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"entity already set. ...
Sets the response error entity body on the builder. <p>A specific media type can be set using the {@code type(...)} methods. @param errorEntity the response error entity body @param annotations annotations, in addition to the annotations on the resource method returning the response, to be passed to the {@link Messag...
[ "Sets", "the", "response", "error", "entity", "body", "on", "the", "builder", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/jaxrs-genericresponse/src/main/java/com/cerner/beadledom/jaxrs/GenericResponseBuilder.java#L165-L173
train
cerner/beadledom
jaxrs-genericresponse/src/main/java/com/cerner/beadledom/jaxrs/GenericResponseBuilder.java
GenericResponseBuilder.header
public GenericResponseBuilder<T> header(String name, Object value) { rawBuilder.header(name, value); return this; }
java
public GenericResponseBuilder<T> header(String name, Object value) { rawBuilder.header(name, value); return this; }
[ "public", "GenericResponseBuilder", "<", "T", ">", "header", "(", "String", "name", ",", "Object", "value", ")", "{", "rawBuilder", ".", "header", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a header to the response. @param name the header name @param value the header value, {@code null} will clear any existing headers for the same name @return this builder @see Response.ResponseBuilder#header(String, Object)
[ "Adds", "a", "header", "to", "the", "response", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/jaxrs-genericresponse/src/main/java/com/cerner/beadledom/jaxrs/GenericResponseBuilder.java#L230-L233
train
cerner/beadledom
jaxrs-genericresponse/src/main/java/com/cerner/beadledom/jaxrs/GenericResponseBuilder.java
GenericResponseBuilder.replaceAll
public GenericResponseBuilder<T> replaceAll(MultivaluedMap<String, Object> headers) { rawBuilder.replaceAll(headers); return this; }
java
public GenericResponseBuilder<T> replaceAll(MultivaluedMap<String, Object> headers) { rawBuilder.replaceAll(headers); return this; }
[ "public", "GenericResponseBuilder", "<", "T", ">", "replaceAll", "(", "MultivaluedMap", "<", "String", ",", "Object", ">", "headers", ")", "{", "rawBuilder", ".", "replaceAll", "(", "headers", ")", ";", "return", "this", ";", "}" ]
Replaces all of the headers with the these headers. @param headers the new headers to be used, {@code null} to remove all existing headers @return this builder
[ "Replaces", "all", "of", "the", "headers", "with", "the", "these", "headers", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/jaxrs-genericresponse/src/main/java/com/cerner/beadledom/jaxrs/GenericResponseBuilder.java#L241-L244
train
cerner/beadledom
jaxrs-genericresponse/src/main/java/com/cerner/beadledom/jaxrs/GenericResponseBuilder.java
GenericResponseBuilder.link
public GenericResponseBuilder<T> link(URI uri, String rel) { rawBuilder.link(uri, rel); return this; }
java
public GenericResponseBuilder<T> link(URI uri, String rel) { rawBuilder.link(uri, rel); return this; }
[ "public", "GenericResponseBuilder", "<", "T", ">", "link", "(", "URI", "uri", ",", "String", "rel", ")", "{", "rawBuilder", ".", "link", "(", "uri", ",", "rel", ")", ";", "return", "this", ";", "}" ]
Adds a link header. @param uri the URI of the link header @param rel the value of the {@code rel} parameter @return this builder
[ "Adds", "a", "link", "header", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/jaxrs-genericresponse/src/main/java/com/cerner/beadledom/jaxrs/GenericResponseBuilder.java#L430-L433
train
cerner/beadledom
health/service/src/main/java/com/cerner/beadledom/health/HealthStatus.java
HealthStatus.create
public static HealthStatus create(int status, String message, Throwable exception) { return new AutoValue_HealthStatus(message, status, Optional.ofNullable(exception)); }
java
public static HealthStatus create(int status, String message, Throwable exception) { return new AutoValue_HealthStatus(message, status, Optional.ofNullable(exception)); }
[ "public", "static", "HealthStatus", "create", "(", "int", "status", ",", "String", "message", ",", "Throwable", "exception", ")", "{", "return", "new", "AutoValue_HealthStatus", "(", "message", ",", "status", ",", "Optional", ".", "ofNullable", "(", "exception",...
Create an instance with the given message, status code, and exception.
[ "Create", "an", "instance", "with", "the", "given", "message", "status", "code", "and", "exception", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/health/service/src/main/java/com/cerner/beadledom/health/HealthStatus.java#L21-L23
train
cerner/beadledom
common/src/main/java/com/cerner/beadledom/metadata/BuildInfo.java
BuildInfo.create
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 static BuildInfo create(Properties properties) { checkNotNull(properties, "properties: null"); return builder() .setArtifactId( checkNotNull(properties.getProperty("project.artifactId"), "project.artifactId: null")) .setGroupId( checkNotNull(properties.getProperty(...
[ "public", "static", "BuildInfo", "create", "(", "Properties", "properties", ")", "{", "checkNotNull", "(", "properties", ",", "\"properties: null\"", ")", ";", "return", "builder", "(", ")", ".", "setArtifactId", "(", "checkNotNull", "(", "properties", ".", "get...
Create an instance using the given properties. <p>Currently, at least the following properties are required: <ul> <li>git.commit.id</li> <li>project.artifactId</li> <li>project.groupId</li> <li>project.version</li> </ul> <p>Optional properties: <ul> <li>project.build.date</li> </ul>
[ "Create", "an", "instance", "using", "the", "given", "properties", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/common/src/main/java/com/cerner/beadledom/metadata/BuildInfo.java#L102-L116
train
cerner/beadledom
health/service/src/main/java/com/cerner/beadledom/health/internal/HealthChecker.java
HealthChecker.doPrimaryHealthCheck
public HealthDto doPrimaryHealthCheck() { List<HealthDependency> primaryHealthDependencies = healthDependencies.values().stream() .filter(HealthDependency::isPrimary) .collect(Collectors.toList()); return checkHealth(primaryHealthDependencies); }
java
public HealthDto doPrimaryHealthCheck() { List<HealthDependency> primaryHealthDependencies = healthDependencies.values().stream() .filter(HealthDependency::isPrimary) .collect(Collectors.toList()); return checkHealth(primaryHealthDependencies); }
[ "public", "HealthDto", "doPrimaryHealthCheck", "(", ")", "{", "List", "<", "HealthDependency", ">", "primaryHealthDependencies", "=", "healthDependencies", ".", "values", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "HealthDependency", "::", "isPrimary",...
Performs the Primary Health Check. <p>The resulting DTO will contain information about the health of all the main dependencies (currently, all dependencies) as well as an overall status of either 200 (if all dependencies are healthy) or 503 (if one or more dependencies are unhealthy) and corresponding message. Other m...
[ "Performs", "the", "Primary", "Health", "Check", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/health/service/src/main/java/com/cerner/beadledom/health/internal/HealthChecker.java#L59-L64
train
cerner/beadledom
health/service/src/main/java/com/cerner/beadledom/health/internal/HealthChecker.java
HealthChecker.doDependencyListing
public List<HealthDependencyDto> doDependencyListing() { List<HealthDependencyDto> listing = Lists.newArrayList(); for (HealthDependency dependency : healthDependencies.values()) { listing.add(dependencyDtoBuilder(dependency).build()); } return listing; }
java
public List<HealthDependencyDto> doDependencyListing() { List<HealthDependencyDto> listing = Lists.newArrayList(); for (HealthDependency dependency : healthDependencies.values()) { listing.add(dependencyDtoBuilder(dependency).build()); } return listing; }
[ "public", "List", "<", "HealthDependencyDto", ">", "doDependencyListing", "(", ")", "{", "List", "<", "HealthDependencyDto", ">", "listing", "=", "Lists", ".", "newArrayList", "(", ")", ";", "for", "(", "HealthDependency", "dependency", ":", "healthDependencies", ...
Returns a list of all health dependencies, but does not check their health.
[ "Returns", "a", "list", "of", "all", "health", "dependencies", "but", "does", "not", "check", "their", "health", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/health/service/src/main/java/com/cerner/beadledom/health/internal/HealthChecker.java#L78-L84
train
cerner/beadledom
health/service/src/main/java/com/cerner/beadledom/health/internal/HealthChecker.java
HealthChecker.doDependencyAvailabilityCheck
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 HealthDependencyDto doDependencyAvailabilityCheck(String name) { HealthDependency dependency = healthDependencies.get(checkNotNull(name)); if (dependency == null) { throw new WebApplicationException(Response.status(404).build()); } return checkDependencyHealth(dependency); }
[ "public", "HealthDependencyDto", "doDependencyAvailabilityCheck", "(", "String", "name", ")", "{", "HealthDependency", "dependency", "=", "healthDependencies", ".", "get", "(", "checkNotNull", "(", "name", ")", ")", ";", "if", "(", "dependency", "==", "null", ")",...
Returns information about a dependency, including the result of checking its health.
[ "Returns", "information", "about", "a", "dependency", "including", "the", "result", "of", "checking", "its", "health", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/health/service/src/main/java/com/cerner/beadledom/health/internal/HealthChecker.java#L89-L95
train
cerner/beadledom
jaxrs/src/main/java/com/cerner/beadledom/jaxrs/JaxRsParamConditions.java
JaxRsParamConditions.checkParam
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
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); } }
[ "public", "static", "void", "checkParam", "(", "boolean", "expression", ",", "Object", "errorMessage", ")", "{", "if", "(", "!", "expression", ")", "{", "Response", "response", "=", "Response", ".", "status", "(", "Response", ".", "Status", ".", "BAD_REQUEST...
Ensures the truth of an expression involving a jax-rs parameter. @param expression a boolean expression @param errorMessage the exception message to use if the check fails; will be converted to a string using {@link String#valueOf(Object)} @throws WebApplicationException with response status 400 if {@code expression} ...
[ "Ensures", "the", "truth", "of", "an", "expression", "involving", "a", "jax", "-", "rs", "parameter", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/jaxrs/src/main/java/com/cerner/beadledom/jaxrs/JaxRsParamConditions.java#L44-L51
train
cerner/beadledom
client/beadledom-client-guice/src/main/java/com/cerner/beadledom/client/BeadledomClientBuilderProvider.java
BeadledomClientBuilderProvider.isExcludedBinding
private boolean isExcludedBinding(Key<?> key) { Class<?> rawType = key.getTypeLiteral().getRawType(); for (Class<?> excludedClass : excludedBindings) { if (excludedClass.isAssignableFrom(rawType)) { return true; } } return false; }
java
private boolean isExcludedBinding(Key<?> key) { Class<?> rawType = key.getTypeLiteral().getRawType(); for (Class<?> excludedClass : excludedBindings) { if (excludedClass.isAssignableFrom(rawType)) { return true; } } return false; }
[ "private", "boolean", "isExcludedBinding", "(", "Key", "<", "?", ">", "key", ")", "{", "Class", "<", "?", ">", "rawType", "=", "key", ".", "getTypeLiteral", "(", ")", ".", "getRawType", "(", ")", ";", "for", "(", "Class", "<", "?", ">", "excludedClas...
This is to prevent circular dependency during binding resolution in the provider. As we loop through every binding in the injector, we need to exclude certain bindings as they havent been created yet.
[ "This", "is", "to", "prevent", "circular", "dependency", "during", "binding", "resolution", "in", "the", "provider", ".", "As", "we", "loop", "through", "every", "binding", "in", "the", "injector", "we", "need", "to", "exclude", "certain", "bindings", "as", ...
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/client/beadledom-client-guice/src/main/java/com/cerner/beadledom/client/BeadledomClientBuilderProvider.java#L121-L130
train
cerner/beadledom
jackson/src/main/java/com/cerner/beadledom/jackson/filter/FieldFilter.java
FieldFilter.addField
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
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]; //...
[ "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...
Adds a field to be filtered for this FieldFilter.
[ "Adds", "a", "field", "to", "be", "filtered", "for", "this", "FieldFilter", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/jackson/src/main/java/com/cerner/beadledom/jackson/filter/FieldFilter.java#L98-L122
train
cerner/beadledom
jackson/src/main/java/com/cerner/beadledom/jackson/filter/FieldFilter.java
FieldFilter.writeJson
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
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...
[ "public", "void", "writeJson", "(", "JsonParser", "parser", ",", "JsonGenerator", "jgen", ")", "throws", "IOException", "{", "checkNotNull", "(", "parser", ",", "\"JsonParser cannot be null for writeJson.\"", ")", ";", "checkNotNull", "(", "jgen", ",", "\"JsonGenerato...
Writes the json from the parser onto the generator, using the filters to only write the objects specified. @param parser JsonParser that is created from a Jackson utility (i.e. ObjectMapper) @param jgen JsonGenerator that is used for writing json onto an underlying stream @throws JsonGenerationException exception if J...
[ "Writes", "the", "json", "from", "the", "parser", "onto", "the", "generator", "using", "the", "filters", "to", "only", "write", "the", "objects", "specified", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/jackson/src/main/java/com/cerner/beadledom/jackson/filter/FieldFilter.java#L145-L153
train
cerner/beadledom
jackson/src/main/java/com/cerner/beadledom/jackson/filter/FieldFilter.java
FieldFilter.processValue
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
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...
[ "private", "void", "processValue", "(", "JsonToken", "valueToken", ",", "JsonParser", "parser", ",", "JsonGenerator", "jgen", ")", "throws", "IOException", "{", "if", "(", "valueToken", ".", "isBoolean", "(", ")", ")", "{", "jgen", ".", "writeBoolean", "(", ...
Uses a JsonToken + JsonParser to determine how to write a value to the JsonGenerator. <p>This separation exists so we can separate the iteration logic from the parsing logic. @param valueToken current token we are interested in from the parser @param parser current parser @param jgen JsonGenerator that is used for wr...
[ "Uses", "a", "JsonToken", "+", "JsonParser", "to", "determine", "how", "to", "write", "a", "value", "to", "the", "JsonGenerator", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/jackson/src/main/java/com/cerner/beadledom/jackson/filter/FieldFilter.java#L207-L239
train
cerner/beadledom
pagination/src/main/java/com/cerner/beadledom/pagination/OffsetPaginationLinks.java
OffsetPaginationLinks.lastLink
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 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...
[ "String", "lastLink", "(", ")", "{", "if", "(", "totalResults", "==", "null", "||", "currentLimit", "==", "0L", ")", "{", "return", "null", ";", "}", "Long", "lastOffset", ";", "if", "(", "totalResults", "%", "currentLimit", "==", "0L", ")", "{", "last...
Returns the last page link; null if no last page link is available.
[ "Returns", "the", "last", "page", "link", ";", "null", "if", "no", "last", "page", "link", "is", "available", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/pagination/src/main/java/com/cerner/beadledom/pagination/OffsetPaginationLinks.java#L80-L94
train
cerner/beadledom
pagination/src/main/java/com/cerner/beadledom/pagination/OffsetPaginationLinks.java
OffsetPaginationLinks.prevLink
String prevLink() { if (currentOffset == 0 || currentLimit == 0) { return null; } return urlWithUpdatedPagination(Math.max(0, currentOffset - currentLimit), currentLimit); }
java
String prevLink() { if (currentOffset == 0 || currentLimit == 0) { return null; } return urlWithUpdatedPagination(Math.max(0, currentOffset - currentLimit), currentLimit); }
[ "String", "prevLink", "(", ")", "{", "if", "(", "currentOffset", "==", "0", "||", "currentLimit", "==", "0", ")", "{", "return", "null", ";", "}", "return", "urlWithUpdatedPagination", "(", "Math", ".", "max", "(", "0", ",", "currentOffset", "-", "curren...
Returns the next prev link; null if no prev page link is available.
[ "Returns", "the", "next", "prev", "link", ";", "null", "if", "no", "prev", "page", "link", "is", "available", "." ]
75435bced5187d5455b46518fadf85c93cf32014
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/pagination/src/main/java/com/cerner/beadledom/pagination/OffsetPaginationLinks.java#L110-L116
train
libgdx/box2dlights
src/box2dLight/RayHandler.java
RayHandler.resizeFBO
public void resizeFBO(int fboWidth, int fboHeight) { if (lightMap != null) { lightMap.dispose(); } lightMap = new LightMap(this, fboWidth, fboHeight); }
java
public void resizeFBO(int fboWidth, int fboHeight) { if (lightMap != null) { lightMap.dispose(); } lightMap = new LightMap(this, fboWidth, fboHeight); }
[ "public", "void", "resizeFBO", "(", "int", "fboWidth", ",", "int", "fboHeight", ")", "{", "if", "(", "lightMap", "!=", "null", ")", "{", "lightMap", ".", "dispose", "(", ")", ";", "}", "lightMap", "=", "new", "LightMap", "(", "this", ",", "fboWidth", ...
Resize the FBO used for intermediate rendering.
[ "Resize", "the", "FBO", "used", "for", "intermediate", "rendering", "." ]
08cf93a41464f71d32475aaa2fe280dc6af78ff3
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L138-L143
train
libgdx/box2dlights
src/box2dLight/RayHandler.java
RayHandler.setCombinedMatrix
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 setCombinedMatrix(OrthographicCamera camera) { this.setCombinedMatrix( camera.combined, camera.position.x, camera.position.y, camera.viewportWidth * camera.zoom, camera.viewportHeight * camera.zoom); }
[ "public", "void", "setCombinedMatrix", "(", "OrthographicCamera", "camera", ")", "{", "this", ".", "setCombinedMatrix", "(", "camera", ".", "combined", ",", "camera", ".", "position", ".", "x", ",", "camera", ".", "position", ".", "y", ",", "camera", ".", ...
Sets combined matrix basing on camera position, rotation and zoom <p> Same as calling: {@code setCombinedMatrix( camera.combined, camera.position.x, camera.position.y, camera.viewportWidth * camera.zoom, camera.viewportHeight * camera.zoom );} @see #setCombinedMatrix(Matrix4, float, float, float, float)
[ "Sets", "combined", "matrix", "basing", "on", "camera", "position", "rotation", "and", "zoom" ]
08cf93a41464f71d32475aaa2fe280dc6af78ff3
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L158-L165
train
libgdx/box2dlights
src/box2dLight/RayHandler.java
RayHandler.prepareRender
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 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...
[ "public", "void", "prepareRender", "(", ")", "{", "lightRenderedLastFrame", "=", "0", ";", "Gdx", ".", "gl", ".", "glDepthMask", "(", "false", ")", ";", "Gdx", ".", "gl", ".", "glEnable", "(", "GL20", ".", "GL_BLEND", ")", ";", "simpleBlendFunc", ".", ...
Prepare all lights for rendering. <p>You should need to use this method only if you want to render lights on a frame buffer object. Use {@link #render()} otherwise. <p><b>NOTE!</b> Don't call this inside of any begin/end statements. @see #renderOnly() @see #render()
[ "Prepare", "all", "lights", "for", "rendering", "." ]
08cf93a41464f71d32475aaa2fe280dc6af78ff3
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L297-L339
train
libgdx/box2dlights
src/box2dLight/RayHandler.java
RayHandler.pointAtLight
public boolean pointAtLight(float x, float y) { for (Light light : lightList) { if (light.contains(x, y)) return true; } return false; }
java
public boolean pointAtLight(float x, float y) { for (Light light : lightList) { if (light.contains(x, y)) return true; } return false; }
[ "public", "boolean", "pointAtLight", "(", "float", "x", ",", "float", "y", ")", "{", "for", "(", "Light", "light", ":", "lightList", ")", "{", "if", "(", "light", ".", "contains", "(", "x", ",", "y", ")", ")", "return", "true", ";", "}", "return", ...
Checks whether the given point is inside of any light volume @return true if point is inside of any light volume
[ "Checks", "whether", "the", "given", "point", "is", "inside", "of", "any", "light", "volume" ]
08cf93a41464f71d32475aaa2fe280dc6af78ff3
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L400-L405
train
libgdx/box2dlights
src/box2dLight/RayHandler.java
RayHandler.dispose
public void dispose() { removeAll(); if (lightMap != null) lightMap.dispose(); if (lightShader != null) lightShader.dispose(); }
java
public void dispose() { removeAll(); if (lightMap != null) lightMap.dispose(); if (lightShader != null) lightShader.dispose(); }
[ "public", "void", "dispose", "(", ")", "{", "removeAll", "(", ")", ";", "if", "(", "lightMap", "!=", "null", ")", "lightMap", ".", "dispose", "(", ")", ";", "if", "(", "lightShader", "!=", "null", ")", "lightShader", ".", "dispose", "(", ")", ";", ...
Disposes all this rayHandler lights and resources
[ "Disposes", "all", "this", "rayHandler", "lights", "and", "resources" ]
08cf93a41464f71d32475aaa2fe280dc6af78ff3
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L422-L426
train
libgdx/box2dlights
src/box2dLight/RayHandler.java
RayHandler.removeAll
public void removeAll() { for (Light light : lightList) { light.dispose(); } lightList.clear(); for (Light light : disabledLights) { light.dispose(); } disabledLights.clear(); }
java
public void removeAll() { for (Light light : lightList) { light.dispose(); } lightList.clear(); for (Light light : disabledLights) { light.dispose(); } disabledLights.clear(); }
[ "public", "void", "removeAll", "(", ")", "{", "for", "(", "Light", "light", ":", "lightList", ")", "{", "light", ".", "dispose", "(", ")", ";", "}", "lightList", ".", "clear", "(", ")", ";", "for", "(", "Light", "light", ":", "disabledLights", ")", ...
Removes and disposes both all active and disabled lights
[ "Removes", "and", "disposes", "both", "all", "active", "and", "disabled", "lights" ]
08cf93a41464f71d32475aaa2fe280dc6af78ff3
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L431-L441
train
libgdx/box2dlights
src/box2dLight/RayHandler.java
RayHandler.setAmbientLight
public void setAmbientLight(float r, float g, float b, float a) { this.ambientLight.set(r, g, b, a); }
java
public void setAmbientLight(float r, float g, float b, float a) { this.ambientLight.set(r, g, b, a); }
[ "public", "void", "setAmbientLight", "(", "float", "r", ",", "float", "g", ",", "float", "b", ",", "float", "a", ")", "{", "this", ".", "ambientLight", ".", "set", "(", "r", ",", "g", ",", "b", ",", "a", ")", ";", "}" ]
Sets ambient light color. Specifies how shadows colored and their brightness. <p>Default = Color(0, 0, 0, 0) @param r shadows color red component @param g shadows color green component @param b shadows color blue component @param a shadows brightness component @see #setAmbientLight(float) @see #setAmbientLight(Color...
[ "Sets", "ambient", "light", "color", ".", "Specifies", "how", "shadows", "colored", "and", "their", "brightness", "." ]
08cf93a41464f71d32475aaa2fe280dc6af78ff3
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L530-L532
train
libgdx/box2dlights
src/box2dLight/PointLight.java
PointLight.setDistance
@Override public void setDistance(float dist) { dist *= RayHandler.gammaCorrectionParameter; this.distance = dist < 0.01f ? 0.01f : dist; dirty = true; }
java
@Override public void setDistance(float dist) { dist *= RayHandler.gammaCorrectionParameter; this.distance = dist < 0.01f ? 0.01f : dist; dirty = true; }
[ "@", "Override", "public", "void", "setDistance", "(", "float", "dist", ")", "{", "dist", "*=", "RayHandler", ".", "gammaCorrectionParameter", ";", "this", ".", "distance", "=", "dist", "<", "0.01f", "?", "0.01f", ":", "dist", ";", "dirty", "=", "true", ...
Sets light distance <p>MIN value capped to 0.1f meter <p>Actual recalculations will be done only on {@link #update()} call
[ "Sets", "light", "distance" ]
08cf93a41464f71d32475aaa2fe280dc6af78ff3
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/PointLight.java#L69-L74
train
libgdx/box2dlights
src/box2dLight/Light.java
Light.add
public void add(RayHandler rayHandler) { this.rayHandler = rayHandler; if (active) { rayHandler.lightList.add(this); } else { rayHandler.disabledLights.add(this); } }
java
public void add(RayHandler rayHandler) { this.rayHandler = rayHandler; if (active) { rayHandler.lightList.add(this); } else { rayHandler.disabledLights.add(this); } }
[ "public", "void", "add", "(", "RayHandler", "rayHandler", ")", "{", "this", ".", "rayHandler", "=", "rayHandler", ";", "if", "(", "active", ")", "{", "rayHandler", ".", "lightList", ".", "add", "(", "this", ")", ";", "}", "else", "{", "rayHandler", "."...
Adds light to specified RayHandler
[ "Adds", "light", "to", "specified", "RayHandler" ]
08cf93a41464f71d32475aaa2fe280dc6af78ff3
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/Light.java#L200-L207
train