Search in sources :

Example 86 with Override

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);
}
Also used : View(android.view.View) Override(java.lang.Override)

Example 87 with Override

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());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Override(java.lang.Override) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 88 with Override

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());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Override(java.lang.Override) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 89 with Override

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());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Override(java.lang.Override) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 90 with Override

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);
}
Also used : String(java.lang.String) Override(java.lang.Override)

Aggregations

Override (java.lang.Override)177 StringBuilder (java.lang.StringBuilder)83 String (java.lang.String)36 NonNull (android.support.annotation.NonNull)24 ContentValues (android.content.ContentValues)12 ArrayList (java.util.ArrayList)11 View (android.view.View)10 Integer (java.lang.Integer)9 Long (java.lang.Long)9 HashMap (java.util.HashMap)9 Boolean (java.lang.Boolean)8 Double (java.lang.Double)8 Float (java.lang.Float)8 Short (java.lang.Short)8 Bitmap (android.graphics.Bitmap)5 Canvas (android.graphics.Canvas)5 Handler (android.os.Handler)5 HandlerThread (android.os.HandlerThread)5 SmallTest (android.test.suitebuilder.annotation.SmallTest)5 Map (java.util.Map)5