use of java.lang.Override in project android_frameworks_base by ResurrectionRemix.
the class KeyguardSecurityViewFlipper method onMeasure.
@Override
protected void onMeasure(int widthSpec, int heightSpec) {
final int widthMode = MeasureSpec.getMode(widthSpec);
final int heightMode = MeasureSpec.getMode(heightSpec);
if (DEBUG && widthMode != MeasureSpec.AT_MOST) {
Log.w(TAG, "onMeasure: widthSpec " + MeasureSpec.toString(widthSpec) + " should be AT_MOST");
}
if (DEBUG && heightMode != MeasureSpec.AT_MOST) {
Log.w(TAG, "onMeasure: heightSpec " + MeasureSpec.toString(heightSpec) + " should be AT_MOST");
}
final int widthSize = MeasureSpec.getSize(widthSpec);
final int heightSize = MeasureSpec.getSize(heightSpec);
int maxWidth = widthSize;
int maxHeight = heightSize;
final int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
if (lp.maxWidth > 0 && lp.maxWidth < maxWidth) {
maxWidth = lp.maxWidth;
}
if (lp.maxHeight > 0 && lp.maxHeight < maxHeight) {
maxHeight = lp.maxHeight;
}
}
final int wPadding = getPaddingLeft() + getPaddingRight();
final int hPadding = getPaddingTop() + getPaddingBottom();
maxWidth = Math.max(0, maxWidth - wPadding);
maxHeight = Math.max(0, maxHeight - hPadding);
int width = widthMode == MeasureSpec.EXACTLY ? widthSize : 0;
int height = heightMode == MeasureSpec.EXACTLY ? heightSize : 0;
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int childWidthSpec = makeChildMeasureSpec(maxWidth, lp.width);
final int childHeightSpec = makeChildMeasureSpec(maxHeight, lp.height);
child.measure(childWidthSpec, childHeightSpec);
width = Math.max(width, Math.min(child.getMeasuredWidth(), widthSize - wPadding));
height = Math.max(height, Math.min(child.getMeasuredHeight(), heightSize - hPadding));
}
setMeasuredDimension(width + wPadding, height + hPadding);
}
use of java.lang.Override in project facebook-android-sdk by facebook.
the class BatchRequestTests method testBatchCallbackIsCalled.
@LargeTest
public void testBatchCallbackIsCalled() {
final AtomicInteger count = new AtomicInteger();
GraphRequest request1 = GraphRequest.newGraphPathRequest(null, "4", new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse response) {
count.incrementAndGet();
}
});
GraphRequest request2 = GraphRequest.newGraphPathRequest(null, "4", new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse response) {
count.incrementAndGet();
}
});
GraphRequestBatch batch = new GraphRequestBatch(request1, request2);
batch.addCallback(new GraphRequestBatch.Callback() {
@Override
public void onBatchCompleted(GraphRequestBatch batch) {
count.incrementAndGet();
}
});
batch.executeAndWait();
assertEquals(3, count.get());
}
use of java.lang.Override in project facebook-android-sdk by facebook.
the class BatchRequestTests method testMixedBatchCallbacks.
@LargeTest
public void testMixedBatchCallbacks() {
final AtomicInteger requestProgressCount = new AtomicInteger();
final AtomicInteger requestCompletedCount = new AtomicInteger();
final AtomicInteger batchProgressCount = new AtomicInteger();
final AtomicInteger batchCompletedCount = new AtomicInteger();
final AccessToken accessToken = getAccessTokenForSharedUser();
String appId = getApplicationId();
GraphRequest.setDefaultBatchApplicationId(appId);
GraphRequest request1 = GraphRequest.newGraphPathRequest(null, "4", new GraphRequest.OnProgressCallback() {
@Override
public void onCompleted(GraphResponse response) {
requestCompletedCount.incrementAndGet();
}
@Override
public void onProgress(long current, long max) {
if (current == max) {
requestProgressCount.incrementAndGet();
} else if (current > max) {
requestProgressCount.set(0);
}
}
});
assertNotNull(request1);
GraphRequest request2 = GraphRequest.newGraphPathRequest(null, "4", null);
assertNotNull(request2);
GraphRequestBatch batch = new GraphRequestBatch(request1, request2);
batch.addCallback(new GraphRequestBatch.OnProgressCallback() {
@Override
public void onBatchCompleted(GraphRequestBatch batch) {
batchCompletedCount.incrementAndGet();
}
@Override
public void onBatchProgress(GraphRequestBatch batch, long current, long max) {
if (current == max) {
batchProgressCount.incrementAndGet();
} else if (current > max) {
batchProgressCount.set(0);
}
}
});
batch.executeAndWait();
assertEquals(1, requestProgressCount.get());
assertEquals(1, requestCompletedCount.get());
assertEquals(1, batchProgressCount.get());
assertEquals(1, batchCompletedCount.get());
}
use of java.lang.Override in project facebook-android-sdk by facebook.
the class BatchRequestTests method testBatchLastOnProgressCallbackIsCalledOnce.
@LargeTest
public void testBatchLastOnProgressCallbackIsCalledOnce() {
final AtomicInteger count = new AtomicInteger();
final AccessToken accessToken = getAccessTokenForSharedUser();
String appId = getApplicationId();
GraphRequest.setDefaultBatchApplicationId(appId);
GraphRequest request1 = GraphRequest.newGraphPathRequest(accessToken, "4", null);
assertNotNull(request1);
GraphRequest request2 = GraphRequest.newGraphPathRequest(accessToken, "4", null);
assertNotNull(request2);
GraphRequestBatch batch = new GraphRequestBatch(request1, request2);
batch.addCallback(new GraphRequestBatch.OnProgressCallback() {
@Override
public void onBatchCompleted(GraphRequestBatch batch) {
}
@Override
public void onBatchProgress(GraphRequestBatch batch, long current, long max) {
if (current == max) {
count.incrementAndGet();
} else if (current > max) {
count.set(0);
}
}
});
batch.executeAndWait();
assertEquals(1, count.get());
}
use of java.lang.Override in project zeppelin by apache.
the class MockHDFSFileInterpreter method runCommand.
@Override
public String runCommand(Op op, String path, Arg[] args) throws Exception {
String error = checkArgs(op, path, args);
assertNull(error);
String c = path + "?op=" + op.op;
if (args != null) {
for (Arg a : args) {
c += "&" + a.key + "=" + a.value;
}
}
return fs.get(c);
}
Aggregations