use of android.support.annotation.RequiresApi in project fresco by facebook.
the class ImageFormatKeyframesFragment method initAnimation.
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void initAnimation(View view) {
mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
mSimpleDraweeView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
DraweeController controller = Fresco.newDraweeControllerBuilder().setOldController(mSimpleDraweeView.getController()).setUri(URI_KEYFRAMES_ANIMATION).setAutoPlayAnimations(true).build();
mSimpleDraweeView.setController(controller);
final SwitchCompat switchBackground = (SwitchCompat) view.findViewById(R.id.switch_background);
switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mSimpleDraweeView.getHierarchy().setBackgroundImage(isChecked ? new CheckerBoardDrawable(getResources()) : null);
}
});
}
use of android.support.annotation.RequiresApi in project muzei by romannurik.
the class GalleryArtSource method addAllImagesFromTree.
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private int addAllImagesFromTree(final List<Uri> allImages, final Uri treeUri, final String parentDocumentId) {
final Uri childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(treeUri, parentDocumentId);
Cursor children = getContentResolver().query(childrenUri, new String[] { DocumentsContract.Document.COLUMN_DOCUMENT_ID, DocumentsContract.Document.COLUMN_MIME_TYPE }, null, null, null);
if (children == null) {
return 0;
}
int numImagesAdded = 0;
while (children.moveToNext()) {
String documentId = children.getString(children.getColumnIndex(DocumentsContract.Document.COLUMN_DOCUMENT_ID));
String mimeType = children.getString(children.getColumnIndex(DocumentsContract.Document.COLUMN_MIME_TYPE));
if (DocumentsContract.Document.MIME_TYPE_DIR.equals(mimeType)) {
// Recursively explore all directories
numImagesAdded += addAllImagesFromTree(allImages, treeUri, documentId);
} else if (mimeType != null && mimeType.startsWith("image/")) {
// Add images to the list
if (allImages != null) {
allImages.add(DocumentsContract.buildDocumentUriUsingTree(treeUri, documentId));
}
numImagesAdded++;
}
}
children.close();
return numImagesAdded;
}
use of android.support.annotation.RequiresApi in project Signal-Android by WhisperSystems.
the class AttachmentRegionDecoder method init.
@RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
@Override
public Point init(Context context, Uri uri) throws Exception {
Log.w(TAG, "Init!");
if (!PartAuthority.isLocalUri(uri)) {
passthrough = new SkiaImageRegionDecoder();
return passthrough.init(context, uri);
}
MasterSecret masterSecret = KeyCachingService.getMasterSecret(context);
if (masterSecret == null) {
throw new IllegalStateException("No master secret available...");
}
InputStream inputStream = PartAuthority.getAttachmentStream(context, masterSecret, uri);
this.bitmapRegionDecoder = BitmapRegionDecoder.newInstance(inputStream, false);
inputStream.close();
return new Point(bitmapRegionDecoder.getWidth(), bitmapRegionDecoder.getHeight());
}
use of android.support.annotation.RequiresApi in project Signal-Android by WhisperSystems.
the class AttachmentRegionDecoder method decodeRegion.
@RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
@Override
public Bitmap decodeRegion(Rect rect, int sampleSize) {
Log.w(TAG, "Decode region: " + rect);
if (passthrough != null) {
return passthrough.decodeRegion(rect, sampleSize);
}
synchronized (this) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = sampleSize;
options.inPreferredConfig = Bitmap.Config.RGB_565;
Bitmap bitmap = bitmapRegionDecoder.decodeRegion(rect, options);
if (bitmap == null) {
throw new RuntimeException("Skia image decoder returned null bitmap - image format may not be supported");
}
return bitmap;
}
}
use of android.support.annotation.RequiresApi in project easy by MehdiBenmesa.
the class AbsenceDetailFragment method onCreate.
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
exam = (TextView) getActivity().findViewById(R.id.exam);
controle = (TextView) getActivity().findViewById(R.id.control);
intero = (TextView) getActivity().findViewById(R.id.intero);
tp = (TextView) getActivity().findViewById(R.id.tps);
mReceiver = new DataReceiver(new Handler());
mReceiver.setReceiver(this);
SessionManager sessionManager = new SessionManager(getContext());
userID = sessionManager.getIdUser();
//String Module = sessionManager
AbsenceService.getAbsenceByStudent(getContext(), mReceiver);
if (getArguments().containsKey(ARG_ITEM_ID)) {
// load dummy item by using the passed item ID.
//accident = AppContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
}
//Toast.makeText(getContext() , moduleID , Toast.LENGTH_LONG).show();
setHasOptionsMenu(true);
}
Aggregations