code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public Integer getColWidth() {
final Object result = getStateHelper().eval(PropertyKeys.colWidth, null);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
} | java |
public Collection<SelectItem> getFilterOptions() {
return (Collection<SelectItem>) getStateHelper().eval(PropertyKeys.filterOptions, null);
} | java |
public Sheet getSheet() {
if (sheet != null) {
return sheet;
}
UIComponent parent = getParent();
while (parent != null && !(parent instanceof Sheet)) {
parent = parent.getParent();
}
return (Sheet) parent;
} | java |
protected boolean validateRequired(final FacesContext context, final Object newValue) {
// If our value is valid, enforce the required property if present
if (isValid() && isRequired() && isEmpty(newValue)) {
final String requiredMessageStr = getRequiredMessage();
FacesMessage me... | java |
private void requestCameraPermission() {
Log.w("BARCODE-SCANNER", "Camera permission is not granted. Requesting permission");
final String[] permissions = new String[]{Manifest.permission.CAMERA};
if (!shouldShowRequestPermissionRationale(Manifest.permission.CAMERA)) {
requestPermi... | java |
@Override
public boolean onTouch(View v, MotionEvent event) {
boolean b = scaleGestureDetector.onTouchEvent(event);
boolean c = gestureDetector.onTouchEvent(event);
return b || c || v.onTouchEvent(event);
} | java |
protected boolean onTap(float rawX, float rawY) {
Log.d("CAPTURE-FRAGMENT", "got tap at: (" + rawX + ", " + rawY + ")");
Barcode barcode = null;
if (mMode == MVBarcodeScanner.ScanningMode.SINGLE_AUTO) {
BarcodeGraphic graphic = mGraphicOverlay.getFirstGraphic();
if (gra... | java |
@Override
public void onNewItem(int id, Barcode item) {
mGraphic.setId(id);
if (mListener != null) mListener.onNewBarcodeDetected(id, item);
} | java |
@Override
public void draw(Canvas canvas) {
Barcode barcode = mBarcode;
if (barcode == null) {
return;
}
// Draws the bounding box around the barcode.
RectF rect = getViewBoundingBox(barcode);
canvas.drawRect(rect, mOverlayPaint);
/**
*... | java |
protected int addClasspathElements( Collection<?> elements, URL[] urls, int startPosition )
throws MojoExecutionException
{
for ( Object object : elements )
{
try
{
if ( object instanceof Artifact )
{
urls[startPosit... | java |
public Collection<File> getClasspath( String scope )
throws MojoExecutionException
{
try
{
Collection<File> files = classpathBuilder.buildClasspathList( getProject(), scope, getProjectArtifacts(), isGenerator() );
if ( getLog().isDebugEnabled() )
{
... | java |
private void checkGwtUserVersion() throws MojoExecutionException
{
InputStream inputStream = Thread.currentThread().getContextClassLoader()
.getResourceAsStream( "org/codehaus/mojo/gwt/mojoGwtVersion.properties" );
Properties properties = new Properties();
try
{
... | java |
public String getProjectName( MavenProject project )
{
File dotProject = new File( project.getBasedir(), ".project" );
try
{
Xpp3Dom dom = Xpp3DomBuilder.build( ReaderFactory.newXmlReader( dotProject ) );
return dom.getChild( "name" ).getValue();
}
cat... | java |
private List<Artifact> getScopeArtifacts( final MavenProject project, final String scope )
{
if ( SCOPE_COMPILE.equals( scope ) )
{
return project.getCompileArtifacts();
}
if ( SCOPE_RUNTIME.equals( scope ) )
{
return project.getRuntimeArtifacts();
... | java |
private List<String> getSourceRoots( final MavenProject project, final String scope )
{
if ( SCOPE_COMPILE.equals( scope ) || SCOPE_RUNTIME.equals( scope ) )
{
return project.getCompileSourceRoots();
}
else if ( SCOPE_TEST.equals( scope ) )
{
List<Stri... | java |
private List<Resource> getResources( final MavenProject project, final String scope )
{
if ( SCOPE_COMPILE.equals( scope ) || SCOPE_RUNTIME.equals( scope ) )
{
return project.getResources();
}
else if ( SCOPE_TEST.equals( scope ) )
{
List<Resource> res... | java |
private String getProjectReferenceId( final String groupId, final String artifactId, final String version )
{
return groupId + ":" + artifactId + ":" + version;
} | java |
public String[] getModules()
{
// module has higher priority if set by expression
if ( module != null )
{
return new String[] { module };
}
if ( modules == null )
{
//Use a Set to avoid duplicate when user set src/main/java as <resource>
... | java |
private boolean isDeprecated( JavaMethod method )
{
if ( method == null )
return false;
for ( Annotation annotation : method.getAnnotations() )
{
if ( "java.lang.Deprecated".equals( annotation.getType().getFullyQualifiedName() ) )
{
return... | java |
public Set<GwtModule> getInherits()
throws GwtModuleReaderException
{
if ( inherits != null )
{
return inherits;
}
inherits = new HashSet<GwtModule>();
addInheritedModules( inherits, getLocalInherits() );
return inherits;
} | java |
protected Collection<ResourceFile> getAllResourceFiles()
throws MojoExecutionException
{
try
{
Set<ResourceFile> sourcesAndResources = new HashSet<ResourceFile>();
Set<String> sourcesAndResourcesPath = new HashSet<String>();
sourcesAndResourcesPath.addAll(... | java |
private String escapeHtml(String html) {
if (html == null) {
return null;
}
return html.replaceAll("&", "&").replaceAll("<", "<").replaceAll(
">", ">");
} | java |
public boolean parse(String criteria, Map<String, ? extends Object> attributes) throws CriteriaParseException {
if (criteria == null) {
return true;
} else {
try {
return Boolean.parseBoolean(FREEMARKER_BUILTINS.eval(criteria, attributes));
} catch (Te... | java |
public E getUser(HttpServletRequest servletRequest) {
AttributePrincipal principal = getUserPrincipal(servletRequest);
E result = this.userDao.getByPrincipal(principal);
if (result == null) {
throw new HttpStatusException(Status.FORBIDDEN, "User " + principal.getName() + " is not... | java |
@Override
public void attributeReplaced(HttpSessionBindingEvent hse) {
Object possibleClient = hse.getValue();
closeClient(possibleClient);
} | java |
@Override
public void attributeRemoved(HttpSessionBindingEvent hse) {
Object possibleClient = hse.getValue();
closeClient(possibleClient);
} | java |
protected void doDelete(String path, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
ClientResponse response = this.getResourceWrapper()
.rewritten(path, HttpMethod.DELETE)
.delete(ClientResponse.class);
... | java |
protected void doPut(String path) throws ClientException {
this.readLock.lock();
try {
ClientResponse response = this.getResourceWrapper()
.rewritten(path, HttpMethod.PUT)
.put(ClientResponse.class);
errorIfStatusNotEqualTo(response, Client... | java |
protected void doPut(String path, Object o) throws ClientException {
doPut(path, o, null);
} | java |
protected <T> T doGet(String path, Class<T> cls) throws ClientException {
return doGet(path, cls, null);
} | java |
protected <T> T doGet(String path, Class<T> cls, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.GET).getRequestBuilder();
requestBuilder = ensureJson... | java |
protected <T> T doGet(String path, MultivaluedMap<String, String> queryParams, GenericType<T> genericType) throws ClientException {
return doGet(path, queryParams, genericType, null);
} | java |
protected <T> T doPost(String path, MultivaluedMap<String, String> formParams, Class<T> cls, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuild... | java |
protected void doPost(String path) throws ClientException {
this.readLock.lock();
try {
ClientResponse response = getResourceWrapper().rewritten(path, HttpMethod.POST)
.post(ClientResponse.class);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, Cli... | java |
protected void doPostForm(String path, MultivaluedMap<String, String> formParams) throws ClientException {
doPostForm(path, formParams, null);
} | java |
protected void doPostForm(String path, MultivaluedMap<String, String> formParams, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder();
... | java |
public void doPostMultipart(String path, FormDataMultiPart formDataMultiPart) throws ClientException {
this.readLock.lock();
try {
ClientResponse response = getResourceWrapper()
.rewritten(path, HttpMethod.POST)
.type(Boundary.addBoundary(MediaType.MUL... | java |
public void doPostMultipart(String path, FormDataMultiPart formDataMultiPart, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper()
.rewritten(path, HttpMethod.POST).getReques... | java |
protected void doPostMultipart(String path, InputStream inputStream) throws ClientException {
doPostMultipart(path, inputStream, null);
} | java |
protected URI doPostCreate(String path, Object o) throws ClientException {
return doPostCreate(path, o, null);
} | java |
protected URI doPostCreate(String path, Object o, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder();
requestBuilder = ensurePo... | java |
protected URI doPostCreateMultipart(String path, InputStream inputStream) throws ClientException {
return doPostCreateMultipart(path, inputStream, null);
} | java |
protected URI doPostCreateMultipart(String path, InputStream inputStream, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder();
r... | java |
protected URI doPostCreateMultipart(String path, FormDataMultiPart formDataMultiPart) throws ClientException {
this.readLock.lock();
try {
ClientResponse response = getResourceWrapper()
.rewritten(path, HttpMethod.POST)
.type(Boundary.addBoundary(Media... | java |
protected ClientResponse doPostForProxy(String path, InputStream inputStream, MultivaluedMap<String, String> parameterMap, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, Ht... | java |
protected ClientResponse doGetForProxy(String path, MultivaluedMap<String, String> parameterMap, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.GET, parameterMap... | java |
protected ClientResponse doDeleteForProxy(String path, MultivaluedMap<String, String> parameterMap, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.DELETE, parame... | java |
protected void errorIfStatusEqualTo(ClientResponse response,
ClientResponse.Status... status) throws ClientException {
errorIf(response, status, true);
} | java |
protected Long extractId(URI uri) {
String uriStr = uri.toString();
return Long.valueOf(uriStr.substring(uriStr.lastIndexOf("/") + 1));
} | java |
private static boolean contains(Object[] arr, Object member) {
for (Object mem : arr) {
if (Objects.equals(mem, member)) {
return true;
}
}
return false;
} | java |
private static WebResource.Builder ensureJsonHeaders(MultivaluedMap<String, String> headers, WebResource.Builder requestBuilder, boolean contentType, boolean accept) {
boolean hasContentType = false;
boolean hasAccept = false;
if (headers != null) {
for (Map.Entry<String, List<String... | java |
private void checkBorderAndCenterWhenScale() {
RectF rect = getMatrixRectF();
float deltaX = 0;
float deltaY = 0;
int width = getWidth();
int height = getHeight();
if (rect.width() >= width) {
if (rect.left > 0) {
deltaX = -rect.left;
}
if (rect.right < width) {
deltaX = width - rect.rig... | java |
private RectF getMatrixRectF() {
Matrix matrix = scaleMatrix;
RectF rect = new RectF();
Drawable d = getDrawable();
if (null != d) {
rect.set(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
matrix.mapRect(rect);
}
return rect;
} | java |
private void checkMatrixBounds() {
RectF rect = getMatrixRectF();
float deltaX = 0, deltaY = 0;
final float viewWidth = getWidth();
final float viewHeight = getHeight();
// Check if image boundary exceeds imageView boundary
if (rect.top > 0 && isCheckTopAndBottom) {
deltaY = -rect.top;
}
if (rect.bo... | java |
private @Nullable Conversation loadConversationFromMetadata(ConversationMetadata metadata) throws SerializerException, ConversationLoadException {
// we're going to scan metadata in attempt to find existing conversations
ConversationMetadataItem item;
// if the user was logged in previously - we should have an a... | java |
private void handleConversationStateChange(Conversation conversation) {
ApptentiveLog.d(CONVERSATION, "Conversation state changed: %s", conversation);
checkConversationQueue();
assertTrue(conversation != null && !conversation.hasState(UNDEFINED));
if (conversation != null && !conversation.hasState(UNDEFINED))... | java |
public Apptentive.DateTime getTimeAtInstallTotal() {
// Simply return the first item's timestamp, if there is one.
if (versionHistoryItems.size() > 0) {
return new Apptentive.DateTime(versionHistoryItems.get(0).getTimestamp());
}
return new Apptentive.DateTime(Util.currentTimeSeconds());
} | java |
public Apptentive.DateTime getTimeAtInstallForVersionCode(int versionCode) {
for (VersionHistoryItem item : versionHistoryItems) {
if (item.getVersionCode() == versionCode) {
return new Apptentive.DateTime(item.getTimestamp());
}
}
return new Apptentive.DateTime(Util.currentTimeSeconds());
} | java |
public Apptentive.DateTime getTimeAtInstallForVersionName(String versionName) {
for (VersionHistoryItem item : versionHistoryItems) {
Apptentive.Version entryVersionName = new Apptentive.Version();
Apptentive.Version currentVersionName = new Apptentive.Version();
entryVersionName.setVersion(item.getVersionNa... | java |
public boolean isUpdateForVersionCode() {
Set<Integer> uniques = new HashSet<Integer>();
for (VersionHistoryItem item : versionHistoryItems) {
uniques.add(item.getVersionCode());
}
return uniques.size() > 1;
} | java |
public boolean isUpdateForVersionName() {
Set<String> uniques = new HashSet<String>();
for (VersionHistoryItem item : versionHistoryItems) {
uniques.add(item.getVersionName());
}
return uniques.size() > 1;
} | java |
public Interactions getInteractions() {
try {
if (!isNull(Interactions.KEY_NAME)) {
Object obj = get(Interactions.KEY_NAME);
if (obj instanceof JSONArray) {
Interactions interactions = new Interactions();
JSONArray interactionsJSONArray = (JSONArray) obj;
for (int i = 0; i < interactionsJSON... | java |
@Override
public Thread newThread(Runnable r) {
return new Thread(r, getName() + " (thread-" + threadNumber.getAndIncrement() + ")");
} | java |
@Override
protected void onTextChanged(final CharSequence text, final int start, final int before, final int after) {
mNeedsResize = true;
// Since this view may be reused, it is good to reset the text size
resetTextSize();
} | java |
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
if (w != oldw || h != oldh) {
mNeedsResize = true;
}
} | java |
@Override
public void setLineSpacing(float add, float mult) {
super.setLineSpacing(add, mult);
mSpacingMult = mult;
mSpacingAdd = add;
} | java |
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (changed || mNeedsResize) {
int widthLimit = (right - left) - getCompoundPaddingLeft() - getCompoundPaddingRight();
int heightLimit = (bottom - top) - getCompoundPaddingBottom() - getCompoundPaddingTop();
resiz... | java |
public void resizeText() {
int heightLimit = getHeight() - getPaddingBottom() - getPaddingTop();
int widthLimit = getWidth() - getPaddingLeft() - getPaddingRight();
resizeText(widthLimit, heightLimit);
} | java |
public void resizeText(int width, int height) {
CharSequence text = getText();
// Do not resize if the view does not have dimensions or there is no text
if (text == null || text.length() == 0 || height <= 0 || width <= 0 || mTextSize == 0) {
return;
}
if (getTransformationMethod() != null) {
text = get... | java |
static void saveCurrentSession(Context context, LogMonitorSession session) {
if (context == null) {
throw new IllegalArgumentException("Context is null");
}
if (session == null) {
throw new IllegalArgumentException("Session is null");
}
SharedPreferences prefs = getPrefs(context);
SharedPreferences.... | java |
static void deleteCurrentSession(Context context) {
SharedPreferences.Editor editor = getPrefs(context).edit();
editor.remove(PREFS_KEY_EMAIL_RECIPIENTS);
editor.remove(PREFS_KEY_FILTER_PID);
editor.apply();
} | java |
protected static void registerSensitiveKeys(Class<? extends JsonPayload> cls) {
List<Field> fields = RuntimeUtils.listFields(cls, new RuntimeUtils.FieldFilter() {
@Override
public boolean accept(Field field) {
return Modifier.isStatic(field.getModifiers()) && // static fields
field.getAnnotation(Sensi... | java |
private ImageScale scaleImage(int imageX, int imageY, int containerX, int containerY) {
ImageScale ret = new ImageScale();
// Compare aspects faster by multiplying out the divisors.
if (imageX * containerY > imageY * containerX) {
// Image aspect wider than container
ret.scale = (float) containerX / imageX;... | java |
public void update(double timestamp, String versionName, Integer versionCode) {
last = timestamp;
total++;
Long countForVersionName = versionNames.get(versionName);
if (countForVersionName == null) {
countForVersionName = 0L;
}
Long countForVersionCode = versionCodes.get(versionCode);
if (countForVersi... | java |
public static void serialize(File file, SerializableObject object) throws IOException {
AtomicFile atomicFile = new AtomicFile(file);
FileOutputStream stream = null;
try {
stream = atomicFile.startWrite();
DataOutputStream out = new DataOutputStream(stream);
object.writeExternal(out);
atomicFile.finis... | java |
public static <T extends SerializableObject> T deserialize(File file, Class<T> cls) throws IOException {
FileInputStream stream = null;
try {
stream = new FileInputStream(file);
DataInputStream in = new DataInputStream(stream);
try {
Constructor<T> constructor = cls.getDeclaredConstructor(DataInput.cl... | java |
public void storeInteractionManifest(String interactionManifest) {
try {
InteractionManifest payload = new InteractionManifest(interactionManifest);
Interactions interactions = payload.getInteractions();
Targets targets = payload.getTargets();
if (interactions != null && targets != null) {
setTargets(... | java |
boolean migrateConversationData() throws SerializerException {
long start = System.currentTimeMillis();
File legacyConversationDataFile = Util.getUnencryptedFilename(conversationDataFile);
if (legacyConversationDataFile.exists()) {
try {
ApptentiveLog.d(CONVERSATION, "Migrating %sconversation data...", has... | java |
public void scrollToChild(View child) {
child.getDrawingRect(mTempRect);
/* Offset from child's local coordinates to ScrollView coordinates */
offsetDescendantRectToMyCoords(child, mTempRect);
int scrollDelta = computeScrollDeltaToGetChildRectOnScreen(mTempRect);
if (scrollDelta != 0) {
scrollBy(0... | java |
public boolean isValid(boolean questionIsRequired) {
// If required and checked, other types must have text
if (questionIsRequired && isChecked() && isOtherType && (getOtherText().length() < 1)) {
otherTextInputLayout.setError(" ");
return false;
}
otherTextInputLayout.setError(null);
return true;
} | java |
void fetchAndStoreMessages(final boolean isMessageCenterForeground, final boolean showToast, @Nullable final MessageFetchListener listener) {
checkConversationQueue();
try {
String lastMessageId = messageStore.getLastReceivedMessageId();
fetchMessages(lastMessageId, new MessageFetchListener() {
@Override... | java |
@Override
public void onReceiveNotification(ApptentiveNotification notification) {
checkConversationQueue();
if (notification.hasName(NOTIFICATION_ACTIVITY_STARTED) ||
notification.hasName(NOTIFICATION_ACTIVITY_RESUMED)) {
final Activity activity = notification.getRequiredUserInfo(NOTIFICATION_KEY_ACTIVITY,... | java |
public static Object parseValue(Object value) {
if (value == null) {
return null;
}
if (value instanceof Double) {
return new BigDecimal((Double) value);
} else if (value instanceof Long) {
return new BigDecimal((Long) value);
} else if (value instanceof Integer) {
return new BigDecimal((Integer) ... | java |
private void invalidateCaches(Conversation conversation) {
checkConversationQueue();
conversation.setInteractionExpiration(0L);
Configuration config = Configuration.load();
config.setConfigurationCacheExpirationMillis(System.currentTimeMillis());
config.save();
} | java |
public static void dismissAllInteractions() {
if (!isConversationQueue()) {
dispatchOnConversationQueue(new DispatchTask() {
@Override
protected void execute() {
dismissAllInteractions();
}
});
return;
}
ApptentiveNotificationCenter.defaultCenter().postNotification(NOTIFICATION_INTERACT... | java |
private void storeManifestResponse(Context context, String manifest) {
try {
File file = new File(ApptentiveLog.getLogsDirectory(context), Constants.FILE_APPTENTIVE_ENGAGEMENT_MANIFEST);
Util.writeText(file, manifest);
} catch (Exception e) {
ApptentiveLog.e(CONVERSATION, e, "Exception while trying to save... | java |
private void updateConversationAdvertiserIdentifier(Conversation conversation) {
checkConversationQueue();
try {
Configuration config = Configuration.load();
if (config.isCollectingAdID()) {
AdvertisingIdClientInfo info = AdvertiserManager.getAdvertisingIdClientInfo();
String advertiserId = info != n... | java |
private static Serializable jsonObjectToSerializableType(JSONObject input) {
String type = input.optString(Apptentive.Version.KEY_TYPE, null);
try {
if (type != null) {
if (type.equals(Apptentive.Version.TYPE)) {
return new Apptentive.Version(input);
} else if (type.equals(Apptentive.DateTime.TYPE))... | java |
private static String wrapSymmetricKey(KeyPair wrapperKey, SecretKey symmetricKey) throws NoSuchPaddingException,
NoSuchAlgorithmException,
... | java |
private synchronized ApptentiveNotificationObserverList resolveObserverList(String name) {
ApptentiveNotificationObserverList list = observerListLookup.get(name);
if (list == null) {
list = new ApptentiveNotificationObserverList();
observerListLookup.put(name, list);
}
return list;
} | java |
public static String getErrorResponse(HttpURLConnection connection, boolean isZipped) throws IOException {
if (connection != null) {
InputStream is = null;
try {
is = connection.getErrorStream();
if (is != null) {
if (isZipped) {
is = new GZIPInputStream(is);
}
}
return Util.read... | java |
public static void writeToEncryptedFile(EncryptionKey encryptionKey, File file, byte[] data) throws IOException,
NoSuchPaddingException,
... | java |
@Override
public void onFinishSending(PayloadSender sender, PayloadData payload, boolean cancelled, String errorMessage, int responseCode, JSONObject responseData) {
ApptentiveNotificationCenter.defaultCenter()
.postNotification(NOTIFICATION_PAYLOAD_DID_FINISH_SEND,
NOTIFICATION_KEY_PAYLOAD, payload,
NOTI... | java |
private void sendNextPayload() {
singleThreadExecutor.execute(new Runnable() {
@Override
public void run() {
try {
sendNextPayloadSync();
} catch (Exception e) {
ApptentiveLog.e(e, "Exception while trying to send next payload");
logException(e);
}
}
});
} | java |
@Override
public void onCreate(SQLiteDatabase db) {
ApptentiveLog.d(DATABASE, "ApptentiveDatabase.onCreate(db)");
db.execSQL(SQL_CREATE_PAYLOAD_TABLE);
// Leave legacy tables in place for now.
db.execSQL(TABLE_CREATE_MESSAGE);
db.execSQL(TABLE_CREATE_FILESTORE);
db.execSQL(TABLE_CREATE_COMPOUND_FILESTORE)... | java |
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
ApptentiveLog.d(DATABASE, "Upgrade database from %d to %d", oldVersion, newVersion);
try {
DatabaseMigrator migrator = createDatabaseMigrator(oldVersion, newVersion);
if (migrator != null) {
migrator.onUpgrade(db, oldVer... | java |
void notifyObservers(ApptentiveNotification notification) {
boolean hasLostReferences = false;
// create a temporary list of observers to avoid concurrent modification errors
List<ApptentiveNotificationObserver> temp = new ArrayList<>(observers.size());
for (int i = 0; i < observers.size(); ++i) {
Apptentiv... | java |
boolean addObserver(ApptentiveNotificationObserver observer, boolean useWeakReference) {
if (observer == null) {
throw new IllegalArgumentException("Observer is null");
}
if (!contains(observer)) {
observers.add(useWeakReference ? new ObserverWeakReference(observer) : observer);
return true;
}
retu... | java |
boolean removeObserver(ApptentiveNotificationObserver observer) {
int index = indexOf(observer);
if (index != -1) {
observers.remove(index);
return true;
}
return false;
} | java |
private int indexOf(ApptentiveNotificationObserver observer) {
for (int i = 0; i < observers.size(); ++i) {
final ApptentiveNotificationObserver other = observers.get(i);
if (other == observer) {
return i;
}
final ObserverWeakReference otherReference = ObjectUtils.as(other, ObserverWeakReference.clas... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.