Search in sources :

Example 6 with RequiresApi

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);
        }
    });
}
Also used : CheckerBoardDrawable(com.facebook.fresco.samples.showcase.misc.CheckerBoardDrawable) DraweeController(com.facebook.drawee.interfaces.DraweeController) CompoundButton(android.widget.CompoundButton) SwitchCompat(android.support.v7.widget.SwitchCompat) RequiresApi(android.support.annotation.RequiresApi)

Example 7 with RequiresApi

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;
}
Also used : Cursor(android.database.Cursor) Uri(android.net.Uri) SuppressLint(android.annotation.SuppressLint) RequiresApi(android.support.annotation.RequiresApi)

Example 8 with RequiresApi

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());
}
Also used : MasterSecret(org.thoughtcrime.securesms.crypto.MasterSecret) InputStream(java.io.InputStream) Point(android.graphics.Point) SkiaImageRegionDecoder(com.davemorrissey.labs.subscaleview.decoder.SkiaImageRegionDecoder) RequiresApi(android.support.annotation.RequiresApi)

Example 9 with RequiresApi

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;
    }
}
Also used : Bitmap(android.graphics.Bitmap) BitmapFactory(android.graphics.BitmapFactory) RequiresApi(android.support.annotation.RequiresApi)

Example 10 with RequiresApi

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);
}
Also used : SessionManager(dz.easy.androidclient.Util.SessionManager) Handler(android.os.Handler) DataReceiver(dz.easy.androidclient.Services.DataReceiver) RequiresApi(android.support.annotation.RequiresApi)

Aggregations

RequiresApi (android.support.annotation.RequiresApi)11 Handler (android.os.Handler)3 RecyclerView (android.support.v7.widget.RecyclerView)3 View (android.view.View)3 TextView (android.widget.TextView)3 DatePickerDialog (android.app.DatePickerDialog)2 Intent (android.content.Intent)2 Uri (android.net.Uri)2 Button (android.widget.Button)2 EditText (android.widget.EditText)2 LovelyCustomDialog (com.yarolegovich.lovelydialog.LovelyCustomDialog)2 DataReceiver (dz.easy.androidclient.Services.DataReceiver)2 SessionManager (dz.easy.androidclient.Util.SessionManager)2 SuppressLint (android.annotation.SuppressLint)1 IntentFilter (android.content.IntentFilter)1 ContentObserver (android.database.ContentObserver)1 Cursor (android.database.Cursor)1 Bitmap (android.graphics.Bitmap)1 BitmapFactory (android.graphics.BitmapFactory)1 Point (android.graphics.Point)1