Search in sources :

Example 36 with TargetApi

use of android.annotation.TargetApi in project android_frameworks_base by ResurrectionRemix.

the class MediaDecoder method retrieveDefaultRotation.

@TargetApi(17)
private void retrieveDefaultRotation() {
    MediaMetadataRetriever metadataRetriever = new MediaMetadataRetriever();
    metadataRetriever.setDataSource(mContext, mUri);
    String rotationString = metadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
    mDefaultRotation = rotationString == null ? 0 : Integer.parseInt(rotationString);
}
Also used : MediaMetadataRetriever(android.media.MediaMetadataRetriever) TargetApi(android.annotation.TargetApi)

Example 37 with TargetApi

use of android.annotation.TargetApi in project android_frameworks_base by ResurrectionRemix.

the class RenderTarget method forSurfaceTexture.

@TargetApi(11)
public RenderTarget forSurfaceTexture(SurfaceTexture surfaceTexture) {
    EGLConfig eglConfig = chooseEglConfig(mEgl, mDisplay);
    EGLSurface eglSurf = null;
    synchronized (mSurfaceSources) {
        eglSurf = mSurfaceSources.get(surfaceTexture);
        if (eglSurf == null) {
            eglSurf = mEgl.eglCreateWindowSurface(mDisplay, eglConfig, surfaceTexture, null);
            mSurfaceSources.put(surfaceTexture, eglSurf);
        }
    }
    checkEglError(mEgl, "eglCreateWindowSurface");
    checkSurface(mEgl, eglSurf);
    RenderTarget result = new RenderTarget(mDisplay, mContext, eglSurf, 0, false, true);
    result.setSurfaceSource(surfaceTexture);
    result.addReferenceTo(eglSurf);
    return result;
}
Also used : EGLSurface(javax.microedition.khronos.egl.EGLSurface) EGLConfig(javax.microedition.khronos.egl.EGLConfig) TargetApi(android.annotation.TargetApi)

Example 38 with TargetApi

use of android.annotation.TargetApi in project android_frameworks_base by ResurrectionRemix.

the class RenderTarget method forSurface.

@TargetApi(11)
public RenderTarget forSurface(Surface surface) {
    EGLConfig eglConfig = chooseEglConfig(mEgl, mDisplay);
    EGLSurface eglSurf = null;
    synchronized (mSurfaceSources) {
        eglSurf = mSurfaceSources.get(surface);
        if (eglSurf == null) {
            eglSurf = mEgl.eglCreateWindowSurface(mDisplay, eglConfig, surface, null);
            mSurfaceSources.put(surface, eglSurf);
        }
    }
    checkEglError(mEgl, "eglCreateWindowSurface");
    checkSurface(mEgl, eglSurf);
    RenderTarget result = new RenderTarget(mDisplay, mContext, eglSurf, 0, false, true);
    result.setSurfaceSource(surface);
    result.addReferenceTo(eglSurf);
    return result;
}
Also used : EGLSurface(javax.microedition.khronos.egl.EGLSurface) EGLConfig(javax.microedition.khronos.egl.EGLConfig) TargetApi(android.annotation.TargetApi)

Example 39 with TargetApi

use of android.annotation.TargetApi in project LshUtils by SenhLinsh.

the class LshXmlCreater method createRectangleCorner.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static GradientDrawable createRectangleCorner(float[] radii, ColorStateList color) {
    GradientDrawable rectangleCorner = createRectangleCorner(radii);
    rectangleCorner.setColor(color);
    return rectangleCorner;
}
Also used : GradientDrawable(android.graphics.drawable.GradientDrawable) TargetApi(android.annotation.TargetApi)

Example 40 with TargetApi

use of android.annotation.TargetApi in project UltimateAndroid by cymcsg.

the class DynamicGridModification method animateReorder.

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void animateReorder(final int oldPosition, final int newPosition) {
    boolean isForward = newPosition > oldPosition;
    List<Animator> resultList = new LinkedList<Animator>();
    if (isForward) {
        for (int pos = Math.min(oldPosition, newPosition); pos < Math.max(oldPosition, newPosition); pos++) {
            View view = getViewForId(getId(pos));
            if ((pos + 1) % getColumnCount() == 0) {
                resultList.add(createTranslationAnimations(view, -view.getWidth() * (getColumnCount() - 1), 0, view.getHeight(), 0));
            } else {
                resultList.add(createTranslationAnimations(view, view.getWidth(), 0, 0, 0));
            }
        }
    } else {
        for (int pos = Math.max(oldPosition, newPosition); pos > Math.min(oldPosition, newPosition); pos--) {
            View view = getViewForId(getId(pos));
            if ((pos + getColumnCount()) % getColumnCount() == 0) {
                resultList.add(createTranslationAnimations(view, view.getWidth() * (getColumnCount() - 1), 0, -view.getHeight(), 0));
            } else {
                resultList.add(createTranslationAnimations(view, -view.getWidth(), 0, 0, 0));
            }
        }
    }
    AnimatorSet resultSet = new AnimatorSet();
    resultSet.playTogether(resultList);
    resultSet.setDuration(MOVE_DURATION);
    resultSet.setInterpolator(new AccelerateDecelerateInterpolator());
    resultSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            mReorderAnimation = true;
            updateEnableState();
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mReorderAnimation = false;
            updateEnableState();
        }
    });
    resultSet.start();
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) GridView(android.widget.GridView) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) Point(android.graphics.Point) TargetApi(android.annotation.TargetApi)

Aggregations

TargetApi (android.annotation.TargetApi)1367 Intent (android.content.Intent)153 View (android.view.View)148 Test (org.junit.Test)119 SuppressLint (android.annotation.SuppressLint)115 Uri (android.net.Uri)70 ArrayList (java.util.ArrayList)68 Animator (android.animation.Animator)67 Point (android.graphics.Point)64 Window (android.view.Window)56 TextView (android.widget.TextView)56 IOException (java.io.IOException)56 ViewGroup (android.view.ViewGroup)54 Matchers.anyString (org.mockito.Matchers.anyString)53 SharedPreferences (android.content.SharedPreferences)44 File (java.io.File)44 Field (java.lang.reflect.Field)44 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)43 Bitmap (android.graphics.Bitmap)43 ImageView (android.widget.ImageView)40