Search in sources :

Example 16 with Override

use of java.lang.Override in project storio by pushtorefresh.

the class PrimitiveMethodsFactoryMethodStorIOSQLitePutResolver method mapToContentValues.

/**
     * {@inheritDoc}
     */
@Override
@NonNull
public ContentValues mapToContentValues(@NonNull PrimitiveMethodsFactoryMethod object) {
    ContentValues contentValues = new ContentValues(8);
    contentValues.put("field1", object.getField1());
    contentValues.put("field7", object.getField7());
    contentValues.put("field6", object.getField6());
    contentValues.put("field8", object.getField8());
    contentValues.put("field3", object.getField3());
    contentValues.put("field2", object.getField2());
    contentValues.put("field5", object.getField5());
    contentValues.put("field4", object.getField4());
    return contentValues;
}
Also used : ContentValues(android.content.ContentValues) NonNull(android.support.annotation.NonNull) Override(java.lang.Override)

Example 17 with Override

use of java.lang.Override in project storio by pushtorefresh.

the class BoxedTypesMethodsConstructorIgnoreNullStorIOSQLiteGetResolver method mapFromCursor.

/**
     * {@inheritDoc}
     */
@Override
@NonNull
public BoxedTypesMethodsConstructorIgnoreNull mapFromCursor(@NonNull Cursor cursor) {
    Boolean field1 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
        field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
    }
    Short field2 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
        field2 = cursor.getShort(cursor.getColumnIndex("field2"));
    }
    Integer field3 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
        field3 = cursor.getInt(cursor.getColumnIndex("field3"));
    }
    Long field4 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
        field4 = cursor.getLong(cursor.getColumnIndex("field4"));
    }
    Float field5 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
        field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
    }
    Double field6 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
        field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
    }
    BoxedTypesMethodsConstructorIgnoreNull object = new BoxedTypesMethodsConstructorIgnoreNull(field1, field2, field3, field4, field5, field6);
    return object;
}
Also used : Integer(java.lang.Integer) Float(java.lang.Float) Long(java.lang.Long) Boolean(java.lang.Boolean) Double(java.lang.Double) Short(java.lang.Short) NonNull(android.support.annotation.NonNull) Override(java.lang.Override)

Example 18 with Override

use of java.lang.Override in project reactive-streams-jvm by reactive-streams.

the class PublisherVerification method optional_spec104_mustSignalOnErrorWhenFails.

// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.4
@Override
@Test
public void optional_spec104_mustSignalOnErrorWhenFails() throws Throwable {
    try {
        whenHasErrorPublisherTest(new PublisherTestRun<T>() {

            @Override
            public void run(final Publisher<T> pub) throws InterruptedException {
                final Latch onErrorlatch = new Latch(env);
                final Latch onSubscribeLatch = new Latch(env);
                pub.subscribe(new TestEnvironment.TestSubscriber<T>(env) {

                    @Override
                    public void onSubscribe(Subscription subs) {
                        onSubscribeLatch.assertOpen("Only one onSubscribe call expected");
                        onSubscribeLatch.close();
                    }

                    @Override
                    public void onError(Throwable cause) {
                        onSubscribeLatch.assertClosed("onSubscribe should be called prior to onError always");
                        onErrorlatch.assertOpen(String.format("Error-state Publisher %s called `onError` twice on new Subscriber", pub));
                        onErrorlatch.close();
                    }
                });
                onSubscribeLatch.expectClose("Should have received onSubscribe");
                onErrorlatch.expectClose(String.format("Error-state Publisher %s did not call `onError` on new Subscriber", pub));
                env.verifyNoAsyncErrors();
            }
        });
    } catch (SkipException se) {
        throw se;
    } catch (Throwable ex) {
        // which was wrong of him - he should have signalled on error using onError
        throw new RuntimeException(String.format("Publisher threw exception (%s) instead of signalling error via onError!", ex.getMessage()), ex);
    }
}
Also used : Latch(org.reactivestreams.tck.TestEnvironment.Latch) SkipException(org.testng.SkipException) Subscription(org.reactivestreams.Subscription) Override(java.lang.Override) Test(org.testng.annotations.Test) Override(java.lang.Override)

Example 19 with Override

use of java.lang.Override in project platform_frameworks_base by android.

the class IconTest method testAsync.

@SmallTest
public void testAsync() throws Exception {
    final Bitmap bit1 = ((BitmapDrawable) getContext().getDrawable(R.drawable.landscape)).getBitmap();
    final File dir = getContext().getExternalFilesDir(null);
    final File file1 = new File(dir, "async-original.png");
    bit1.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(file1));
    final Icon im1 = Icon.createWithFilePath(file1.toString());
    final HandlerThread thd = new HandlerThread("testAsync");
    thd.start();
    final Handler h = new Handler(thd.getLooper());
    L(TAG, "asyncTest: dispatching load to thread: " + thd);
    im1.loadDrawableAsync(mContext, new Icon.OnDrawableLoadedListener() {

        @Override
        public void onDrawableLoaded(Drawable draw1) {
            L(TAG, "asyncTest: thread: loading drawable");
            L(TAG, "asyncTest: thread: loaded: %dx%d", draw1.getIntrinsicWidth(), draw1.getIntrinsicHeight());
            final Bitmap test1 = Bitmap.createBitmap(draw1.getIntrinsicWidth(), draw1.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
            draw1.setBounds(0, 0, test1.getWidth(), test1.getHeight());
            draw1.draw(new Canvas(test1));
            try {
                test1.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(new File(dir, "async-test.png")));
            } catch (java.io.FileNotFoundException ex) {
                fail("couldn't create test file: " + ex);
            }
            if (!equalBitmaps(bit1, test1)) {
                findBitmapDifferences(bit1, test1);
                fail("testAsync: file1 differs, check " + dir);
            }
        }
    }, h);
    L(TAG, "asyncTest: awaiting result");
    // ;_;
    Thread.sleep(500);
    assertTrue("async-test.png does not exist!", new File(dir, "async-test.png").exists());
    L(TAG, "asyncTest: done");
}
Also used : Canvas(android.graphics.Canvas) Handler(android.os.Handler) Bitmap(android.graphics.Bitmap) HandlerThread(android.os.HandlerThread) FileOutputStream(java.io.FileOutputStream) File(java.io.File) Override(java.lang.Override) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 20 with Override

use of java.lang.Override in project platform_frameworks_base by android.

the class KeyguardSecurityViewFlipper method onTouchEvent.

@Override
public boolean onTouchEvent(MotionEvent ev) {
    boolean result = super.onTouchEvent(ev);
    mTempRect.set(0, 0, 0, 0);
    for (int i = 0; i < getChildCount(); i++) {
        View child = getChildAt(i);
        if (child.getVisibility() == View.VISIBLE) {
            offsetRectIntoDescendantCoords(child, mTempRect);
            ev.offsetLocation(mTempRect.left, mTempRect.top);
            result = child.dispatchTouchEvent(ev) || result;
            ev.offsetLocation(-mTempRect.left, -mTempRect.top);
        }
    }
    return result;
}
Also used : View(android.view.View) Override(java.lang.Override)

Aggregations

Override (java.lang.Override)176 StringBuilder (java.lang.StringBuilder)83 String (java.lang.String)35 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