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);
}
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;
}
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;
}
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;
}
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();
}
Aggregations